コード例 #1
0
void
QPlaneStress2d :: giveEdgeDofMapping(IntArray &answer, int iEdge) const
{
    /*
     * provides dof mapping of local edge dofs (only nonzero are taken into account)
     * to global element dofs
     */

    int i;
    IntArray eNodes(3);
    this->interpolation.computeLocalEdgeMapping(eNodes,  iEdge);

    answer.resize(6);
    for ( i = 1; i <= 3; i++ ) {
        answer.at(i * 2 - 1) = eNodes.at(i) * 2 - 1;
        answer.at(i * 2) = eNodes.at(i) * 2;
    }
}
コード例 #2
0
ファイル: libeam3dnl.C プロジェクト: MartinFagerstrom/oofem
void
LIBeam3dNL :: giveEdgeDofMapping(IntArray &answer, int iEdge) const
{
    /*
     * provides dof mapping of local edge dofs (only nonzero are taken into account)
     * to global element dofs
     */
    int i;

    if ( iEdge != 1 ) {
        _error("giveEdgeDofMapping: wrong edge number");
    }

    answer.resize(12);
    for ( i = 1; i <= 12; i++ ) {
        answer.at(i) = i;
    }
}
コード例 #3
0
ファイル: PDF.cpp プロジェクト: hilarymartin/MAE_project
void PDF::WriteReferenceArray(const IntArray & array)
   {
   fprintf(file, " [ ");

   for (int i = 0; i < array.Length(); i++)
      WriteReference(array[i]);

   fprintf(file, " ] ");
   }
コード例 #4
0
ファイル: l4axisymm.C プロジェクト: JimBrouzoulis/oofem-1
void
L4Axisymm :: SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
{
    int found = 0;
    answer.resize(1);

    for ( int i = 1; i < 5; i++ ) {
        if ( pap == this->giveNode(i)->giveNumber() ) {
            found = 1;
        }
    }

    if ( found ) {
        answer.at(1) = pap;
    } else {
        _error("SPRNodalRecoveryMI_giveDofMansDeterminedByPatch: node unknown");
    }
}
コード例 #5
0
ファイル: fei2dquadlin.C プロジェクト: Benjamin-git/OOFEM_Jim
double FEI2dQuadLin :: evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo)
{
    IntArray eNodes;
    const FloatArray *node;
    double x1, x2, y1, y2;

    this->computeLocalEdgeMapping(eNodes, iEdge);

    node = cellgeo.giveVertexCoordinates( eNodes.at(1) );
    x1 = node->at(xind);
    y1 = node->at(yind);

    node = cellgeo.giveVertexCoordinates( eNodes.at(2) );
    x2 = node->at(xind);
    y2 = node->at(yind);

    return -( x2 * y1 - x1 * y2 );
}
コード例 #6
0
ファイル: activedof.C プロジェクト: Benjamin-git/OOFEM_Jim
void ActiveDof :: giveEquationNumbers(IntArray &masterEqNumbers, const UnknownNumberingScheme &s)
{
    if ( this->isPrimaryDof() ) {
        masterEqNumbers.resize(1);
        masterEqNumbers.at(1) = this->giveEquationNumber(s);
        return;
    }

    IntArray mstrEqNmbrs;

    int countOfMasterDofs = this->giveNumberOfMasterDofs();
    masterEqNumbers.preallocate(countOfMasterDofs);
    masterEqNumbers.clear();
    for ( int i = 1; i <= countOfMasterDofs; i++ ) {
        this->giveMasterDof(i)->giveEquationNumbers(mstrEqNmbrs, s);
        masterEqNumbers.followedBy(mstrEqNmbrs);
    }
}
コード例 #7
0
void
Quad1Mindlin :: SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
{
    int found = 0;
    answer.resize(1);

    for ( int i = 1; i < 5; i++ ) {
        if ( pap == this->giveNode(i)->giveNumber() ) {
            found = 1;
        }
    }

    if ( found ) {
        answer.at(1) = pap;
    } else {
        OOFEM_ERROR("node unknown");
    }
}
コード例 #8
0
ファイル: activedof.C プロジェクト: Benjamin-git/OOFEM_Jim
void ActiveDof :: giveDofIDs(IntArray &masterDofIDs)
{
    if ( this->isPrimaryDof() ) {
        masterDofIDs.resize(1);
        masterDofIDs.at(1) = this->giveDofID();
        return;
    }

    IntArray mstrDofIDs;

    int countOfMasterDofs = this->giveNumberOfMasterDofs();
    masterDofIDs.preallocate(countOfMasterDofs);
    masterDofIDs.clear();
    for ( int i = 1; i <= countOfMasterDofs; i++ ) {
        this->giveMasterDof(i)->giveDofIDs(mstrDofIDs);
        masterDofIDs.followedBy(mstrDofIDs);
    }
}
コード例 #9
0
void
Brick1_ht :: SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
{
    int found = 0;
    answer.resize(1);

    for ( int i = 1; i <= numberOfDofMans; i++ ) {
        if ( this->giveNode(i)->giveNumber() == pap ) {
            found = 1;
        }
    }

    if ( found ) {
        answer.at(1) = pap;
    } else {
        _error2("SPRNodalRecoveryMI_giveDofMansDeterminedByPatch: unknown node number %d", pap);
    }
}
コード例 #10
0
ファイル: loadbalancer.C プロジェクト: MartinFagerstrom/oofem
void
LoadBalancer :: initializeWtp(IntArray &wtp) {
    int i, size = wtp.giveSize();
    WorkTransferPlugin *plugin = NULL;

    if ( size ) {
        wtpList.growTo(size);
        for ( i = 1; i <= size; i++ ) {
            if ( wtp.at(i) == 1 ) {
                plugin = new NonlocalMaterialWTP(this);
            } else {
                OOFEM_ERROR("LoadBalancer::initializeWtp: Unknown work transfer plugin type");
            }

            wtpList.put(i, plugin);
        }
    }
}
コード例 #11
0
ファイル: lwedge.C プロジェクト: rreissnerr/oofem
void
LWedge :: SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap)
{
    int found = 0;
    answer.resize(1);

    for ( int i = 1; i <= 6; i++ ) {
        if ( this->giveNode(i)->giveNumber() == pap ) {
            found = 1;
        }
    }

    if ( found ) {
        answer.at(1) = pap;
    } else {
        OOFEM_ERROR("unknown node number %d", pap);
    }
}
コード例 #12
0
void GnuplotExportModule::outputMesh(Domain &iDomain)
{
    std::vector< std::vector<FloatArray> > pointArray;

    if(iDomain.giveNumberOfSpatialDimensions() == 2) {
        // Write all element edges to gnuplot
        for ( auto &el : iDomain.giveElements() ) {
            int numEdges = el->giveNumberOfNodes();


            for ( int edgeIndex = 1; edgeIndex <= numEdges; edgeIndex++ ) {
                std::vector<FloatArray> points;

                IntArray bNodes;
                el->giveInterpolation()->boundaryGiveNodes(bNodes, edgeIndex);

                int niLoc = bNodes.at(1);
                const FloatArray &xS = *(el->giveNode(niLoc)->giveCoordinates() );
                points.push_back(xS);

                int njLoc = bNodes.at( bNodes.giveSize() );
                const FloatArray &xE = *(el->giveNode(njLoc)->giveCoordinates() );
                points.push_back(xE);

                pointArray.push_back(points);
            }

        }


        double time = 0.0;

        TimeStep *ts = emodel->giveCurrentStep();
        if ( ts != NULL ) {
            time = ts->giveTargetTime();
        }

        std :: stringstream strMesh;
        strMesh << "MeshGnuplotTime" << time << ".dat";
        std :: string nameMesh = strMesh.str();

        WritePointsToGnuplot(nameMesh, pointArray);
    }
}
コード例 #13
0
void PrescribedGradientBCWeak :: computeIntForceGPContrib(FloatArray &oContrib_disp, IntArray &oDisp_loc_array, FloatArray &oContrib_trac, IntArray &oTrac_loc_array,TracSegArray &iEl, GaussPoint &iGP, int iDim, TimeStep *tStep, const FloatArray &iBndCoord, const double &iScaleFac, ValueModeType mode, CharType type, const UnknownNumberingScheme &s)
{

    SpatialLocalizer *localizer = domain->giveSpatialLocalizer();

	FloatMatrix contrib;
	assembleTangentGPContributionNew(contrib, iEl, iGP, iScaleFac, iBndCoord);

    // Compute vector of traction unknowns
    FloatArray tracUnknowns;
    iEl.mFirstNode->giveUnknownVector(tracUnknowns, giveTracDofIDs(), mode, tStep);

    iEl.giveTractionLocationArray(oTrac_loc_array, type, s);

    FloatArray dispElLocCoord, closestPoint;
    Element *dispEl = localizer->giveElementClosestToPoint(dispElLocCoord, closestPoint, iBndCoord );

    // Compute vector of displacement unknowns
    FloatArray dispUnknowns;
    int numDMan = dispEl->giveNumberOfDofManagers();
    for(int i = 1; i <= numDMan; i++) {
    	FloatArray nodeUnknowns;
    	DofManager *dMan = dispEl->giveDofManager(i);

    	IntArray dispIDs = giveRegularDispDofIDs();
        if(domain->hasXfemManager()) {
        	XfemManager *xMan = domain->giveXfemManager();
        	dispIDs.followedBy(xMan->giveEnrichedDofIDs(*dMan));
        }

        dMan->giveUnknownVector(nodeUnknowns, dispIDs,mode, tStep);
        dispUnknowns.append(nodeUnknowns);

    }

    dispEl->giveLocationArray(oDisp_loc_array, s);


    oContrib_disp.beTProductOf(contrib, tracUnknowns);
    oContrib_disp.negated();

    oContrib_trac.beProductOf(contrib, dispUnknowns);
    oContrib_trac.negated();
}
コード例 #14
0
ファイル: truss2d.C プロジェクト: MartinFagerstrom/oofem
void
Truss2d :: giveEdgeDofMapping(IntArray &answer, int iEdge) const
{
    /*
     * provides dof mapping of local edge dofs (only nonzero are taken into account)
     * to global element dofs
     */

    if ( iEdge != 1 ) {
        _error("giveEdgeDofMapping: wrong edge number");
    }


    answer.resize(4);
    answer.at(1) = 1;
    answer.at(2) = 2;
    answer.at(3) = 3;
    answer.at(4) = 4;
}
コード例 #15
0
void
StructuralInterfaceElementPhF :: computeLocationArrayOfDofIDs( const IntArray &dofIdArray, IntArray &answer )
{
    // Routine to compute the local ordering array an element given a dofid array.
    answer.resize( 0 );
    int k = 0;
    for(int i = 1; i <= this->giveNumberOfDofManagers(); i++) {
        DofManager *dMan = this->giveDofManager( i );
        for(int j = 1; j <= dofIdArray.giveSize( ); j++) {

            if(dMan->hasDofID( (DofIDItem) dofIdArray.at( j ) )) {
                // hack
                
                answer.followedBy( k + j );
            }
        }
        k += dMan->giveNumberOfDofs( );
    }
}
コード例 #16
0
ファイル: sloangraph.C プロジェクト: JimBrouzoulis/oofem-1
void
SloanGraph :: initStatusAndPriority()
{
    int i;

    this->findPeripheralNodes();
#ifndef MDC
    this->evaluateNodeDistances();
    int nnodes = domain->giveNumberOfDofManagers();

    for ( i = 1; i <= nnodes; i++ ) {
        int Distance = giveNode(i)->giveDistance();
        int Degree   = giveNode(i)->giveDegree();
        int Priority = WeightDistance * Distance - WeightDegree * ( Degree + 1 );
        giveNode(i)->setPriority(Priority);
        giveNode(i)->setStatus(SloanGraphNode :: Inactive);
    }

#else
    int NumLevels;
    int j;
    IntArray *Level;
    int End = endNode;

    int Distance, Degree, Priority;

    SloanLevelStructure BackSpine(this, End);
    NumLevels = BackSpine.giveDepth();

    for ( i = 1; i <= NumLevels; i++ ) {
        Level = BackSpine.giveLevel(i);
        for ( j = 1; j <= Level->giveSize(); j++ ) {
            Distance = i - 1;
            this->giveNode( Level->at(j) )->setDistance(Distance);
            Degree   = this->giveNode( Level->at(j) )->giveDegree();
            Priority = WeightDistance * Distance - WeightDegree * ( Degree + 1 );
            this->giveNode( Level->at(j) )->setPriority(Priority);
            this->giveNode( Level->at(j) )->setStatus(SloanGraphNode :: Inactive);
        }
    }

#endif
}
コード例 #17
0
void
SimpleCrossSection :: giveReducedCharacteristicVector(FloatArray &answer, GaussPoint *gp,
                                                      const FloatArray &charVector3d)
//
// returns reduced stressVector or strainVector from full 3d vector reduced
// to vector required by gp->giveStressStrainMode()
//
{
    MaterialMode mode = gp->giveMaterialMode();
    StructuralMaterial *mat = static_cast< StructuralMaterial * >( gp->giveElement()->giveMaterial() );
    IntArray indx;
    int size = charVector3d.giveSize();
    int i, j;

    if ( ( mode == _3dShell ) || ( mode == _3dBeam ) || ( mode == _2dPlate ) || ( mode == _2dBeam ) ) {
        if ( size != 12 ) {
            OOFEM_ERROR("SimpleCrossSection :: giveReducedCharacteristicVector - charVector3d size mismatch");
        }

        mat->giveStressStrainMask( indx, ReducedForm, gp->giveMaterialMode() );
        answer.resize( indx.giveSize() );
        answer.zero();

        for ( i = 1; i <= indx.giveSize(); i++ ) {
            if ( ( j = indx.at(i) ) ) {
                answer.at(i) = charVector3d.at(j);
            }
        }

        return;
    } else if ( mode == _3dBeam ) {
        if ( size != 6 ) {
            OOFEM_ERROR("SimpleCrossSection :: giveReducedCharacteristicVector - charVector3d size mismatch");
        }

        answer =  charVector3d;
        return;
    } else if ( mode == _PlaneStressRot ) {
        if ( size != 7 ) {
            OOFEM_ERROR("SimpleCrossSection :: giveReducedCharacteristicVector - charVector3d size mismatch");
        }

        mat->giveStressStrainMask( indx, ReducedForm, gp->giveMaterialMode() );
        answer.resize( indx.giveSize() );
        answer.zero();

        for ( i = 1; i <= indx.giveSize(); i++ ) {
            if ( ( j = indx.at(i) ) ) {
                answer.at(i) = charVector3d.at(j);
            }
        }

        return;
    } else {
        StructuralCrossSection :: giveReducedCharacteristicVector(answer, gp, charVector3d);
        return;
    }
}
コード例 #18
0
ファイル: phasefieldelement.C プロジェクト: aishugang/oofem
void
PhaseFieldElement :: computeLocationArrayOfDofIDs( const IntArray &dofIdArray, IntArray &answer )
{
    // Routine to extract compute the location array an element given an dofid array.
    answer.clear();
    NLStructuralElement *el = this->giveElement();
    int k = 0;
    for ( int i = 1; i <= el->giveNumberOfDofManagers(); i++ ) {
        DofManager *dMan = el->giveDofManager( i );
        for ( int j = 1; j <= dofIdArray.giveSize( ); j++ ) {

            if ( dMan->hasDofID( (DofIDItem) dofIdArray.at( j ) ) ) {
                Dof *d = dMan->giveDofWithID( dofIdArray.at( j ) );
                answer.followedBy( k + d->giveNumber( ) );
            }
        }
        k += dMan->giveNumberOfDofs( );
    }
}
コード例 #19
0
ファイル: GraphUtils.cpp プロジェクト: wyrover/GDES
static void BuildNodesMap(const IntArray& nodes, Digraph& dg, IntNodeMap& nodes_map)
{
	for(unsigned int i=0;i<nodes.size();i++)
	{
		if(nodes_map.find(nodes[i]) == nodes_map.end())
		{
			nodes_map.insert(IntNodeMap::value_type(nodes[i], dg.addNode()));
		}
	}
}
コード例 #20
0
void 
StaggeredSolver :: instanciateYourself()
{
    int numDofIdGroups = idPos.giveSize()/2;
    this->UnknownNumberingSchemeList.resize(numDofIdGroups);
    IntArray idList; 
    for ( int i = 0; i < numDofIdGroups; i++ ) {
        int sz = idPos.at(i*2 + 2) - idPos.at(i*2 + 1) + 1;
        idList.resize(sz);
        for ( int j = 1; j <= sz; j++) {
            int pos = idPos.at(i*2 + 1) + j - 1;
            idList.at(j) = totalIdList.at(pos);
        }
        this->UnknownNumberingSchemeList[i].setDofIdArray(idList);
        this->UnknownNumberingSchemeList[i].setNumber(i+1);
  
    }    
    
    // Allocate stiffness matrices and internal forces vectors corresponding to each dof group
   
    this->fIntList.resize(numDofIdGroups);
    this->fExtList.resize(numDofIdGroups);
    this->locArrayList.resize(numDofIdGroups);            
    this->stiffnessMatrixList.resize(numDofIdGroups);
    this->X.resize(numDofIdGroups);
    this->dX.resize(numDofIdGroups);
    this->ddX.resize(numDofIdGroups);

    for ( int dG = 0; dG < numDofIdGroups; dG++ ) {
        this->giveTotalLocationArray(this->locArrayList[dG], UnknownNumberingSchemeList[dG], domain);         
        int neq = locArrayList[dG].giveSize();
        this->fIntList[dG].resize(neq);
        this->fExtList[dG].resize(neq);
        
        this->X[dG].resize(neq);
        this->X[dG].zero();
        this->dX[dG].resize(neq);
        this->dX[dG].zero();            
        this->ddX[dG].resize(neq);
        this->ddX[dG].zero();  
    }
}
コード例 #21
0
ファイル: executor.cpp プロジェクト: nlsynth/nli
void Executor::ExecArrayRead(MethodFrame *frame, Insn *insn) {
  int index = frame->reg_values_[insn->src_regs_[0]->id_].num_.int_part;
  if (insn->obj_reg_) {
    Object *array_obj = frame->reg_values_[insn->obj_reg_->id_].object_;
    CHECK(array_obj);
    CHECK(ArrayWrapper::IsIntArray(array_obj));
    IntArray *array = ArrayWrapper::GetIntArray(array_obj);
    frame->reg_values_[insn->dst_regs_[0]->id_].num_ = array->Read(index);
    frame->reg_values_[insn->dst_regs_[0]->id_].num_.type = array->GetWidth();
  } else {
    // local array.
    CHECK(insn->src_regs_.size() == 2);
    Value &array = frame->reg_values_[insn->src_regs_[1]->id_];
    Value &index = frame->reg_values_[insn->src_regs_[0]->id_];
    
    frame->reg_values_[insn->dst_regs_[0]->id_].num_ =
      array.local_int_array_->Read(numeric::Numeric::GetInt(index.num_));
    frame->reg_values_[insn->dst_regs_[0]->id_].type_ = Value::NUM;
  }
}
コード例 #22
0
ファイル: connectivitytable.C プロジェクト: Micket/oofem
void
ConnectivityTable :: giveElementNeighbourList(IntArray &answer, IntArray &elemList)
{
    if ( nodalConnectivityFlag == 0 ) {
        this->instanciateConnectivityTable();
    }

    answer.resize(0);

    for ( auto &el_num : elemList ) {
        Element *ielem = domain->giveElement( el_num );
        int nnode = ielem->giveNumberOfDofManagers();
        for ( int j = 1; j <= nnode; j++ ) {
            int jnode = ielem->giveDofManager(j)->giveNumber();
            for ( auto &val : this->nodalConnectivity[jnode-1] ) {
                answer.insertSortedOnce( val );
            }
        }
    }
}
コード例 #23
0
void
CoupledFieldsElement :: computeLocationArrayOfDofIDs(const IntArray &dofIdArray, IntArray &answer)
{
    // Routine to extract compute the location array an element given an dofid array.
    answer.resize(0);
    
    int k = 0;
    for ( int i = 1; i <= numberOfDofMans; i++ ) {
        DofManager *dMan = this->giveDofManager(i);        
        for (int j = 1; j <= dofIdArray.giveSize(); j++ ) {   
            
            if ( dMan->hasDofID( (DofIDItem) dofIdArray.at(j) ) ) {
                Dof *d = dMan->giveDofWithID( dofIdArray.at(j) );
                answer.followedBy( k + d->giveNumber() );
                //answer.followedBy( k + j );
            }
        }
        k += dMan->giveNumberOfDofs( );
    }
}
コード例 #24
0
ファイル: libeam2d.C プロジェクト: framby/OOFEM_Johannes
void
LIBeam2d :: giveEdgeDofMapping(IntArray &answer, int iEdge) const
{
    /*
     * provides dof mapping of local edge dofs (only nonzero are taken into account)
     * to global element dofs
     */

    if ( iEdge != 1 ) {
        OOFEM_ERROR("wrong edge number");
    }

    answer.resize(6);
    answer.at(1) = 1;
    answer.at(2) = 2;
    answer.at(3) = 3;
    answer.at(4) = 4;
    answer.at(5) = 5;
    answer.at(6) = 6;
}
コード例 #25
0
int
NonLinearDynamic :: estimateMaxPackSize(IntArray &commMap, CommunicationBuffer &buff, int packUnpackType)
{
    int mapSize = commMap.giveSize();
    int i, j, ndofs, count = 0, pcount = 0;
    IntArray locationArray;
    Domain *domain = this->giveDomain(1);
    DofManager *dman;
    Dof *jdof;

    if ( packUnpackType == ProblemCommMode__ELEMENT_CUT ) {
        for ( i = 1; i <= mapSize; i++ ) {
            count += domain->giveDofManager( commMap.at(i) )->giveNumberOfDofs();
        }

        return ( buff.givePackSize(MPI_DOUBLE, 1) * count );
    } else if ( packUnpackType == ProblemCommMode__NODE_CUT ) {
        for ( i = 1; i <= mapSize; i++ ) {
            ndofs = ( dman = domain->giveDofManager( commMap.at(i) ) )->giveNumberOfDofs();
            for ( j = 1; j <= ndofs; j++ ) {
                jdof = dman->giveDof(j);
                if ( jdof->isPrimaryDof() && ( jdof->__giveEquationNumber() ) ) {
                    count++;
                } else {
                    pcount++;
                }
            }
        }

        //printf ("\nestimated count is %d\n",count);
        return ( buff.givePackSize(MPI_DOUBLE, 1) * max(count, pcount) );
    } else if ( packUnpackType == ProblemCommMode__REMOTE_ELEMENT_MODE ) {
        for ( i = 1; i <= mapSize; i++ ) {
            count += domain->giveElement( commMap.at(i) )->estimatePackSize(buff);
        }

        return count;
    }

    return 0;
}
コード例 #26
0
void ParmetisLoadBalancer :: handleMasterSlaveDofManLinks()
{
    int idofman, ndofman = domain->giveNumberOfDofManagers();
    DofManager *dofman, *_masterPtr;
    //int myrank = domain->giveEngngModel()->giveRank();
    int __i, __j, __partition, _master;
    bool isSlave;
    IntArray slaveMastersDofMans;

    /*
     * We assume that in the old partitioning, the master and slave consistency was assured. This means that master is presented
     * on the same partition as slave. The master can be local (then all slaves are local) or master is shared (then slaves are on
     * partitions sharing the master).
     *
     * If master was local, then its new partitioning can be locally resolved (as all slaves were local).
     * If the master was shared, the new partitioning of master has to be communicated between old sharing partitions.
     */
    // handle master slave links between dofmans (master and slave required on same partition)

    for ( idofman = 1; idofman <= ndofman; idofman++ ) {
        dofman = domain->giveDofManager(idofman);
        isSlave = dofman->hasAnySlaveDofs();

        if ( isSlave ) {
            // ok have a look on its masters
            dofman->giveMasterDofMans(slaveMastersDofMans);
            for ( __i = 1; __i <= slaveMastersDofMans.giveSize(); __i++ ) {
                // loop over all slave masters
                _master = slaveMastersDofMans.at(__i);
                _masterPtr = domain->giveDofManager(_master);

                // now loop over all slave new partitions and annd then to master's partitions
                for ( __j = 1; __j <= dofManPartitions [ idofman - 1 ].giveSize(); __j++ ) {
                    __partition = dofManPartitions [ idofman - 1 ].at(__j);
                    // add slave partition to master
                    dofManPartitions [ _master - 1 ].insertOnce(__partition);
                }
            }
        }
    }
}
コード例 #27
0
void
CoupledFieldsElement :: computeVectorOfDofIDs(const IntArray &dofIdArray, ValueModeType valueMode, TimeStep *stepN, FloatArray &answer)
{
    // Routine to extract the solution vector for an element given an dofid array.
    // Size will be numberOfDofs and if a certain dofId does not exist a zero is used as value. 
    
    answer.resize( numberOfDofMans * dofIdArray.giveSize() ); // equal number of nodes for all fields
    answer.zero();
    int k = 1;
    for ( int i = 1; i <= numberOfDofMans; i++ ) {
        DofManager *dMan = this->giveDofManager(i);        
        for (int j = 1; j <= dofIdArray.giveSize(); j++ ) {   
            
            if ( dMan->hasDofID( (DofIDItem) dofIdArray.at(j) ) ) {
                Dof *d = dMan->giveDofWithID( dofIdArray.at(j) );
                answer.at(k) = d->giveUnknown(valueMode, stepN);
            }
            k++;
        }
    }
}
コード例 #28
0
void testConstructorsAndAssignment() {
	IntArray a;
	IntArray b(10000);
	IntArray c(5, 1);
	IntArray d(b);
	IntArray e({1, 1, 1, 1, 1});
	assert(a.size() == 0);
	assert(b == d);
	assert(b.size() == 10000);
	assert(c == e);


	IntArray tmp = c;
	b = c;
	assert(b == c);
	b = e;
	assert(c == tmp);

	b = b;
	assert(b == e);
}
コード例 #29
0
ファイル: skyline.C プロジェクト: Benjamin-git/OOFEM_Jim
int Skyline :: assemble(const IntArray &rloc, const IntArray &cloc, const FloatMatrix &mat)
{
    int dim1 = mat.giveNumberOfRows();
    int dim2 = mat.giveNumberOfColumns();
    for ( int i = 1; i <= dim1; i++ ) {
        int ii = rloc.at(i);
        if ( ii ) {
            for ( int j = 1; j <= dim2; j++ ) {
                int jj = cloc.at(j);
                if ( jj && ii <= jj ) {
                    this->at(ii, jj) += mat.at(i, j);
                }
            }
        }
    }

    // increment version
    this->version++;

    return 1;
}
コード例 #30
0
void
Tr2Shell7PhFi:: giveEdgeDofMapping(IntArray &answer, int iEdge) const
{
    /*
     * provides dof mapping of local edge dofs (only nonzero are taken into account)
     * to global element dofs
     */

    if ( iEdge == 1 ) {        // edge between nodes 1-4-2
        //answer.setValues(21, 1, 2, 3, 4, 5, 6, 7,   8, 9, 10, 11, 12, 13, 14,   22, 23, 24, 25, 26, 27, 28);
        answer.setValues(21, 1, 2, 3, 8, 9, 10, 22, 23, 24,  4, 5, 6, 11, 12, 13, 25, 26, 27,   7, 14, 28);
    } else if ( iEdge == 2 ) { // edge between nodes 2-5-3
        //answer.setValues(21,   8, 9, 10, 11, 12, 13, 14,   15, 16, 17, 18, 19, 20, 21,   29, 30, 31, 32, 33, 34, 35 );
        answer.setValues(21,   8, 9, 10, 15, 16, 17, 29, 30, 31,   11, 12, 13, 18, 19, 20, 32, 33, 34,   14, 21, 35);
    } else if ( iEdge == 3 ) { // edge between nodes 3-6-1
        //answer.setValues(21,   15, 16, 17, 18, 19, 20, 21,   1, 2, 3, 4, 5, 6, 7,   36, 37, 38, 39, 40, 41, 42);
        answer.setValues(21,   15, 16, 17, 1, 2, 3, 36, 37, 38,   18, 19, 20, 4, 5, 6, 39, 40, 41,   21, 7, 42);
    } else {
        _error("giveEdgeDofMapping: wrong edge number");
    }
}