int FluidDynamicMaterial :: giveIntVarCompFullIndx(IntArray &answer, InternalStateType type, MaterialMode mmode) { if ( type == IST_DeviatoricStress ) { if ( mmode == _2dFlow ) { answer.setValues(3, 1, 2, 3); return 1; } else if ( mmode == _2dAxiFlow ) { answer.setValues(4, 1, 2, 3, 6); return 1; } else if ( mmode == _3dFlow ) { answer.resize(6); for ( int i = 1; i <= 6; i++ ) answer.at(i) = i; return 1; } else { OOFEM_ERROR ("FluidDynamicMaterial :: giveIntVarCompFullIndx: material mode not supported"); return 0; } } else if ( type == IST_Viscosity ) { answer.resize(1); answer.at(1) = 1; return 1; } else { return Material :: giveIntVarCompFullIndx(answer, type, mmode); } }
int RCM2Material :: giveIntVarCompFullIndx(IntArray &answer, InternalStateType type, MaterialMode mmode) { if ( type == IST_CrackedFlag ) { answer.resize(1); answer.at(1) = 1; return 1; } else if ( type == IST_CrackDirs ) { answer.resize(9); for ( int i = 1; i <= 9; i++ ) { answer.at(i) = i; } return 1; } else if ( type == IST_CrackStatuses ) { answer.resize(3); for ( int i = 1; i <= 3; i++ ) { answer.at(i) = i; } return 1; } else { return StructuralMaterial :: giveIntVarCompFullIndx(answer, type, mmode); } }
void VTKXMLExportModule :: giveElementCell(IntArray &answer, Element *elem, int cell) { Element_Geometry_Type elemGT = elem->giveGeometryType(); int nelemNodes; if ( ( elemGT == EGT_point ) || ( elemGT == EGT_line_1 ) || ( elemGT == EGT_line_2 ) || ( elemGT == EGT_triangle_1 ) || ( elemGT == EGT_triangle_2 ) || ( elemGT == EGT_tetra_1 ) || ( elemGT == EGT_tetra_2 ) || ( elemGT == EGT_quad_1 ) || ( elemGT == EGT_quad_2 ) || ( elemGT == EGT_hexa_1 ) ) { nelemNodes = elem->giveNumberOfNodes(); answer.resize(nelemNodes); for ( int i = 1; i <= nelemNodes; i++ ) { answer.at(i) = elem->giveNode(i)->giveNumber() ; } } else if ( elemGT == EGT_hexa_2 ) { int HexaQuadNodeMapping [] = { 5, 8, 7, 6, 1, 4, 3, 2, 16, 15, 14, 13, 12, 11, 10, 9, 17, 20, 19, 18 }; nelemNodes = elem->giveNumberOfNodes(); answer.resize(nelemNodes); for ( int i = 1; i <= nelemNodes; i++ ) { answer.at(i) = elem->giveNode(HexaQuadNodeMapping [ i - 1 ])->giveNumber() ; } } else { OOFEM_ERROR("VTKXMLExportModule: unsupported element geometry type"); } }
void StaggeredSolver :: giveTotalLocationArray(IntArray &condensedLocationArray, const UnknownNumberingScheme &s, Domain *d) { IntArray nodalArray, ids, locationArray; locationArray.clear(); for ( auto &dman : d->giveDofManagers() ) { dman->giveCompleteLocationArray(nodalArray, s); locationArray.followedBy(nodalArray); } for ( auto &elem : d->giveElements() ) { for ( int i = 1; i <= elem->giveNumberOfInternalDofManagers(); i++ ) { elem->giveInternalDofManDofIDMask(i, ids); elem->giveInternalDofManager(i)->giveLocationArray(ids, nodalArray, s); locationArray.followedBy(nodalArray); } } IntArray nonZeroMask; nonZeroMask.findNonzeros(locationArray); condensedLocationArray.resize(nonZeroMask.giveSize()); for ( int i = 1; i <= nonZeroMask.giveSize(); i++ ) { condensedLocationArray.at(i) = locationArray.at( nonZeroMask.at(i) ); } }
void NonlocalMaterialWTP :: fastRebuildNonlocalTables() { Domain *d = lb->giveDomain(); int n, i, globnum, ie, nelem = d->giveNumberOfElements(); IntArray localElementDep; Element *elem; // build nonlocal element dependency array for each element for ( ie = 1; ie <= nelem; ie++ ) { elem = d->giveElement(ie); if ( ( elem->giveParallelMode() == Element_local ) ) { IntArray localMap; // translate here nonlocElementDependencyMap[_globnum] to corresponding local numbers globnum = elem->giveGlobalNumber(); n = nonlocElementDependencyMap [ globnum ].giveSize(); localElementDep.resize(n); for ( i = 1; i <= n; i++ ) { localElementDep.at(i) = d->elementGlobal2Local( nonlocElementDependencyMap [ globnum ].at(i) ); } elem->ipEvaluator(this, & NonlocalMaterialWTP :: fastElementIPNonlocTableUpdater, localElementDep); } } }
int IsoInterfaceDamageMaterial :: giveIntVarCompFullIndx(IntArray &answer, InternalStateType type, MaterialMode mmode) { if ( ( type == IST_DamageTensor ) || ( type == IST_DamageTensorTemp ) || ( type == IST_PrincipalDamageTensor ) || ( type == IST_PrincipalDamageTempTensor ) ) { answer.resize(9); answer.at(1) = 1; return 1; } else if ( type == IST_MaxEquivalentStrainLevel ) { answer.resize(1); answer.at(1) = 1; return 1; } else { return StructuralMaterial :: giveIntVarCompFullIndx(answer, type, mmode); } }
void EnrichmentItem :: computeEnrichedDofManDofIdArray(IntArray &oDofIdArray, DofManager &iDMan) { // Gives an array containing the dofId's that // are candidates for enrichment. At the moment, // regular dofs are considered as candidates. In // the future, we may also consider enriching // enriched dofs from other enrichment items. const IntArray *enrichesDofsWithIdArray = this->giveEnrichesDofsWithIdArray(); // Number of candidates for enrichment int numEnrCand = enrichesDofsWithIdArray->giveSize(); // Number of active enrichment functions int numEnrFunc = this->giveNumDofManEnrichments(iDMan); // Go through the list of dofs that the EI supports // and compare with the available dofs in the dofMan. int count = 0; for ( int i = 1; i <= numEnrFunc; i++ ) { for ( int j = 1; j <= numEnrCand; j++ ) { if ( iDMan.hasDofID( ( DofIDItem ) enrichesDofsWithIdArray->at(j) ) ) { count++; } } } oDofIdArray.resize(count); for ( int i = 1; i <= count; i++ ) { oDofIdArray.at(i) = this->giveStartOfDofIdPool() + i - 1; } }
int FETIBoundaryDofManager :: giveCompleteLocationArray(int rank, IntArray &locationArray) { int indx = 0, i; for ( i = 1; i <= numberOfPartitions; i++ ) { if ( partitions.at(i) != referencePartition ) { indx++; } if ( partitions.at(i) == rank ) { break; } } if ( ( indx == 0 ) || ( rank == referencePartition ) ) { return 0; } locationArray.resize(ndofs); for ( i = 1; i <= ndofs; i++ ) { locationArray.at(i) = codeNumbers.at( ( indx - 1 ) * ndofs + i ); } return 1; }
void Node2NodeContact :: giveLocationArray(IntArray &answer, const UnknownNumberingScheme &s) { // should return location array for the master and the slave node // TODO this whole thing should be rewritten answer.resize(6); answer.zero(); //TODO should use a proper unknownnumberingscheme IntArray dofIdArray = {D_u, D_v, D_w}; // master node for ( int i = 1; i <= dofIdArray.giveSize(); i++ ) { if ( this->masterNode->hasDofID( (DofIDItem)dofIdArray.at(i) ) ) { // add corresponding number Dof *dof= this->masterNode->giveDofWithID( (DofIDItem)dofIdArray.at(i) ); answer.at(i) = s.giveDofEquationNumber( dof ); } } // slave node for ( int i = 1; i <= dofIdArray.giveSize(); i++ ) { if ( this->slaveNode->hasDofID( (DofIDItem)dofIdArray.at(i) ) ) { // add corresponding number Dof *dof= this->slaveNode->giveDofWithID( (DofIDItem)dofIdArray.at(i) ); answer.at(3 + i) = s.giveDofEquationNumber( dof ); } } }
void FEI2dQuadLin :: computeLocalEdgeMapping(IntArray &edgeNodes, int iedge) { int aNode = 0, bNode = 0; edgeNodes.resize(2); if ( iedge == 1 ) { // edge between nodes 1 2 aNode = 1; bNode = 2; } else if ( iedge == 2 ) { // edge between nodes 2 3 aNode = 2; bNode = 3; } else if ( iedge == 3 ) { // edge between nodes 3 4 aNode = 3; bNode = 4; } else if ( iedge == 4 ) { // edge between nodes 4 1 aNode = 4; bNode = 1; } else { OOFEM_ERROR("wrong egde number (%d)", iedge); } edgeNodes.at(1) = aNode; edgeNodes.at(2) = bNode; }
void FEI3dTrQuad :: computeLocalEdgeMapping(IntArray &edgeNodes, int iedge) { int aNode = 0, bNode = 0, cNode = 0; edgeNodes.resize(3); if ( iedge == 1 ) { // edge between nodes 1 2 aNode = 1; bNode = 2; cNode = 4; } else if ( iedge == 2 ) { // edge between nodes 2 3 aNode = 2; bNode = 3; cNode = 5; } else if ( iedge == 3 ) { // edge between nodes 2 3 aNode = 3; bNode = 1; cNode = 6; } else { OOFEM_ERROR("Wrong edge number (%d)", iedge); } edgeNodes.at(1) = aNode; edgeNodes.at(2) = bNode; edgeNodes.at(3) = cNode; }
void DofManager :: giveLocationArray(const IntArray &dofIDArry, IntArray &locationArray, const UnknownNumberingScheme &s) const { if ( !hasSlaveDofs ) { int size; // prevents some size problem when connecting different elements with // different number of dofs size = dofIDArry.giveSize(); locationArray.resize(size); for ( int i = 1; i <= size; i++ ) { auto pos = this->findDofWithDofId( ( DofIDItem ) dofIDArry.at(i) ); if ( pos == this->end() ) { OOFEM_ERROR("incompatible dof (%d) requested", dofIDArry.at(i)); } locationArray.at(i) = s.giveDofEquationNumber( *pos ); } } else { IntArray mstrEqNmbrs; locationArray.clear(); for ( int dofid: dofIDArry ) { auto pos = this->findDofWithDofId( ( DofIDItem ) dofid ); if ( pos == this->end() ) { OOFEM_ERROR("incompatible dof (%d) requested", dofid); } (*pos)->giveEquationNumbers(mstrEqNmbrs, s); locationArray.followedBy(mstrEqNmbrs); } } }
void CebFipSlip90Material :: giveStressStrainMask(IntArray &answer, MatResponseForm form, MaterialMode mmode) const // // this function returns mask of reduced(if form == ReducedForm) // or Full(if form==FullForm) stressStrain vector in full or // reduced StressStrainVector // acording to stressStrain mode of given gp. // // // mask has size of reduced or full StressStrain Vector and i-th component // is index to full or reduced StressStrainVector where corresponding // stressStrain resides. // // Reduced form is sub-vector (of stress or strain components), // where components corresponding to imposed zero stress (plane stress,...) // are not included. On the other hand, if zero strain component is imposed // (Plane strain, ..) this condition must be taken into account in geometrical // relations, and corresponding component is included in reduced vector. // { if ( mmode == _1dInterface ) { answer.resize(1); answer.at(1) = 1; } else { StructuralMaterial :: giveStressStrainMask(answer, form, mmode); } }
void TrPlanestressRotAllman :: giveEdgeDofMapping(IntArray &answer, int iEdge) const { /* * provides dof mapping of local edge dofs (only nonzero are taken into account) * to global element dofs */ answer.resize(6); if ( iEdge == 1 ) { // edge between nodes 1,2 answer.at(1) = 1; answer.at(2) = 2; answer.at(3) = 3; answer.at(4) = 4; answer.at(5) = 5; answer.at(6) = 6; } else if ( iEdge == 2 ) { // edge between nodes 2 3 answer.at(1) = 4; answer.at(2) = 5; answer.at(3) = 6; answer.at(4) = 7; answer.at(5) = 8; answer.at(6) = 9; } else if ( iEdge == 3 ) { // edge between nodes 3 1 answer.at(1) = 7; answer.at(2) = 8; answer.at(3) = 9; answer.at(4) = 1; answer.at(5) = 2; answer.at(6) = 3; } else { OOFEM_ERROR("wrong edge number"); } }
void FEI3dTetQuad :: computeLocalEdgeMapping(IntArray &edgeNodes, int iedge) { edgeNodes.resize(3); if ( iedge == 1 ) { // edge between nodes 1 2 edgeNodes(0) = 1; edgeNodes(1) = 2; edgeNodes(2) = 5; } else if ( iedge == 2 ) { // edge between nodes 2 3 edgeNodes(0) = 2; edgeNodes(1) = 3; edgeNodes(2) = 6; } else if ( iedge == 3 ) { // edge between nodes 3 1 edgeNodes(0) = 3; edgeNodes(1) = 1; edgeNodes(2) = 7; } else if ( iedge == 4 ) { // edge between nodes 1 4 edgeNodes(0) = 1; edgeNodes(1) = 4; edgeNodes(2) = 8; } else if ( iedge == 5 ) { // edge between nodes 2 4 edgeNodes(0) = 2; edgeNodes(1) = 4; edgeNodes(2) = 9; } else if ( iedge == 6 ) { // edge between nodes 3 4 edgeNodes(0) = 3; edgeNodes(1) = 4; edgeNodes(2) = 10; } else { OOFEM_ERROR2("FEI3dTetQuad :: computeEdgeMapping: wrong egde number (%d)", iedge); } }
void Tr21Stokes :: giveDofManDofIDMask(int inode, EquationID ut, IntArray &answer) const { // Returns the mask for node number inode of this element. The mask tells what quantities // are held by each node. Since this element holds velocities (both in x and y direction), // in six nodes and pressure in three nodes the answer depends on which node is requested. if ( ( inode == 1 ) || ( inode == 2 ) || ( inode == 3 ) ) { if ( ( ut == EID_MomentumBalance ) || ( ut == EID_AuxMomentumBalance ) ) { answer.setValues(2, V_u, V_v); } else if ( ut == EID_ConservationEquation ) { answer.setValues(1, P_f); } else if ( ut == EID_MomentumBalance_ConservationEquation ) { answer.setValues(3, V_u, V_v, P_f); } else { _error("giveDofManDofIDMask: Unknown equation id encountered"); } } else if ( ( inode == 4 ) || ( inode == 5 ) || ( inode == 6 ) ) { if ( ( ut == EID_MomentumBalance ) || ( ut == EID_AuxMomentumBalance ) ) { answer.setValues(2, V_u, V_v); } else if ( ut == EID_ConservationEquation ) { answer.resize(0); } else if ( ut == EID_MomentumBalance_ConservationEquation ) { answer.setValues(2, V_u, V_v); } else { _error("giveDofManDofIDMask: Unknown equation id encountered"); } } }
/* * Returns array storing nonlocal dependency * (in terms of global element numbers) for given element */ void NonlocalMaterialWTP :: giveElementNonlocalDepArry(IntArray &answer, Domain *d, int num) { std :: set< int >relems; std :: set< int > :: const_iterator relemsIter; Element *ielem = d->giveElement(num); if ( ielem->giveMaterial()->giveInterface(NonlocalMaterialExtensionInterfaceType) ) { relems.clear(); // loop over element IRules and their IPs to retrieve remote (nonlocal) elements // store their global numbers in the relems set (to avoid redundancy) // and then keep them in nonlocTables array. ielem->ipEvaluator(this, & NonlocalMaterialWTP :: giveNonlocalDepArryElementPlugin, relems); // convert relems set into an int array // and store it answer.resize( relems.size() ); int _i = 1; for ( int relem: relems ) { answer.at(_i++) = relem; } } else { answer.clear(); } }
void Tr2Shell7 :: giveBoundaryLocationArray(IntArray &locationArray, const IntArray &bNodes, const UnknownNumberingScheme &s, IntArray *dofIdArray) { IntArray localloc; // not a nice solution here, trying to deduce if Boundary is egde or surface if (bNodes.giveSize() == 3) { // should be edge //detect edge number if (bNodes.at(1)==1 && bNodes.at(2)==2 && bNodes.at(3)==4) { // edge #1 giveEdgeDofMapping(localloc, 1); } else if (bNodes.at(1)==2 && bNodes.at(2)==3 && bNodes.at(3)==5) { // edge #2 giveEdgeDofMapping(localloc, 2); } else if (bNodes.at(1)==3 && bNodes.at(2)==1 && bNodes.at(3)==6) { // edge #3 giveEdgeDofMapping(localloc, 3); } else { OOFEM_ERROR ("wrong edge number detected"); } } else if (bNodes.giveSize() == 6) { // should be surface this->giveSurfaceDofMapping(localloc, 1); } else { OOFEM_ERROR ("boundary not supported/detected"); } IntArray eloc, dofID; this->giveLocationArray(eloc, s, &dofID); locationArray.resize(localloc.giveSize()); dofIdArray->resize(localloc.giveSize()); for (int i=1; i<=localloc.giveSize(); i++) { locationArray.at(i)=eloc.at(localloc.at(i)); dofIdArray->at(i) = dofID.at(localloc.at(i)); } }
void L4Axisymm :: giveEdgeDofMapping(IntArray &answer, int iEdge) const { /* * provides dof mapping of local edge dofs (only nonzero are taken into account) * to global element dofs */ answer.resize(4); if ( iEdge == 1 ) { // edge between nodes 1,2 answer.at(1) = 1; answer.at(2) = 2; answer.at(3) = 3; answer.at(4) = 4; } else if ( iEdge == 2 ) { // edge between nodes 2 3 answer.at(1) = 3; answer.at(2) = 4; answer.at(3) = 5; answer.at(4) = 6; } else if ( iEdge == 3 ) { // edge between nodes 3 4 answer.at(1) = 5; answer.at(2) = 6; answer.at(3) = 7; answer.at(4) = 8; } else if ( iEdge == 4 ) { // edge between nodes 4 1 answer.at(1) = 7; answer.at(2) = 8; answer.at(3) = 1; answer.at(4) = 2; } else { _error("giveEdgeDofMapping: wrong edge number"); } }
int EIPrimaryUnknownMapper :: mapAndUpdate(FloatArray &answer, ValueModeType mode, Domain *oldd, Domain *newd, TimeStep *tStep) { int inode, nd_nnodes = newd->giveNumberOfDofManagers(); int nsize = newd->giveEngngModel()->giveNumberOfDomainEquations( newd->giveNumber(), EModelDefaultEquationNumbering() ); FloatArray unknownValues; IntArray dofidMask, locationArray; IntArray reglist; #ifdef OOFEM_MAPPING_CHECK_REGIONS ConnectivityTable *conTable = newd->giveConnectivityTable(); const IntArray *nodeConnectivity; #endif answer.resize(nsize); answer.zero(); for ( inode = 1; inode <= nd_nnodes; inode++ ) { DofManager *node = newd->giveNode(inode); /* HUHU CHEATING */ #ifdef __PARALLEL_MODE if ( ( node->giveParallelMode() == DofManager_null ) || ( node->giveParallelMode() == DofManager_remote ) ) { continue; } #endif #ifdef OOFEM_MAPPING_CHECK_REGIONS // build up region list for node nodeConnectivity = conTable->giveDofManConnectivityArray(inode); reglist.resize( nodeConnectivity->giveSize() ); reglist.clear(); for ( int indx = 1; indx <= nodeConnectivity->giveSize(); indx++ ) { reglist.insertSortedOnce( newd->giveElement( nodeConnectivity->at(indx) )->giveRegionNumber() ); } #endif ///@todo Shouldn't we pass a primary field or something to this function? if ( this->evaluateAt(unknownValues, dofidMask, mode, oldd, * node->giveCoordinates(), reglist, tStep) ) { ///@todo This doesn't respect local coordinate systems in nodes. Supporting that would require major reworking. for ( int ii = 1; ii <= dofidMask.giveSize(); ii++ ) { // exclude slaves; they are determined from masters auto it = node->findDofWithDofId((DofIDItem)dofidMask.at(ii)); if ( it != node->end() ) { Dof *dof = *it; if ( dof->isPrimaryDof() ) { int eq = dof->giveEquationNumber(EModelDefaultEquationNumbering()); answer.at( eq ) += unknownValues.at(ii); } } } } else { OOFEM_ERROR("evaluateAt service failed for node %d", inode); } } return 1; }
void Quad1MindlinShell3D :: SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap) { pap.resize(4); for ( int i = 1; i < 5; i++ ) { pap.at(i) = this->giveNode(i)->giveNumber(); } }
void L4Axisymm :: SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap) { pap.resize(4); for ( int i = 1; i < 5; i++ ) { pap.at(i) = this->giveNode(i)->giveNumber(); } }
void Tria1PlateSubSoil :: SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap) { pap.resize(3); for ( int i = 1; i < 4; i++ ) { pap.at(i) = this->giveNode(i)->giveNumber(); } }
void QTRSpace :: SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap) { pap.resize(10); for ( int i = 1; i <= 10; i++ ) { pap.at(i) = this->giveNode(i)->giveNumber(); } }
void GradDpElement :: setNonlocalLocationArray(IntArray &answer, int nPrimNodes, int nPrimVars, int nSecNodes, int nSecVars) { answer.resize(nlSize); for ( int i = 1; i <= nlSize; i++ ) { answer.at(i) = i * nPrimVars + i; } }
void Tr2Shell7XFEM :: giveSurfaceDofMapping(IntArray &answer, int iSurf) const { answer.resize(42); for( int i = 1; i <= 42; i++){ answer.at(i) = i; } }
void QBrick1_ht :: SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap) { pap.resize(numberOfDofMans); for ( int i = 1; i <= numberOfDofMans; i++ ) { pap.at(i) = this->giveNode(i)->giveNumber(); } }
void QTrPlaneStrain :: SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap) { pap.resize(3); pap.at(1) = this->giveNode(1)->giveNumber(); pap.at(2) = this->giveNode(2)->giveNumber(); pap.at(3) = this->giveNode(3)->giveNumber(); }
void QWedge_ht :: SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap) { pap.resize(6); for ( int i = 1; i <= 6; i++ ) { pap.at(i) = this->giveNode(i)->giveNumber(); } }
void LineDistributedSpring :: SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap) { pap.resize(2); for ( int i = 1; i < 3; i++ ) { pap.at(i) = this->giveNode(i)->giveNumber(); } }