void PrescribedGradientBCWeak :: giveTractionLocationArray(IntArray &rows, const UnknownNumberingScheme &s) { OOFEM_ERROR("Not implemented.") #if 0 rows.clear(); // Loop over traction elements for ( size_t tracElInd = 0; tracElInd < mpTractionElements.size(); tracElInd++ ) { IntArray tracElRows, trac_loc_r; const TractionElement &tEl = * ( mpTractionElements [ tracElInd ] ); for ( int tracNodeInd : tEl.mTractionNodeInd ) { Node *tNode = mpTractionNodes [ tracNodeInd ]; tNode->giveLocationArray(giveTracDofIDs(), trac_loc_r, s); tracElRows.followedBy(trac_loc_r); } rows.followedBy(tracElRows); } if ( mpDisplacementLock != NULL ) { IntArray dispLock_r; mpDisplacementLock->giveLocationArray(giveDispLockDofIDs(), dispLock_r, s); rows.followedBy(dispLock_r); } #endif }
void DofManager :: giveCompleteMasterDofIDArray(IntArray &dofIDArray) const { if ( !hasSlaveDofs ) { dofIDArray.resizeWithValues(0, this->giveNumberOfDofs()); for ( Dof *dof: *this ) { dofIDArray.followedBy( dof->giveDofID() ); } } else { IntArray temp; for ( Dof *dof: *this ) { dof->giveDofIDs(temp); dofIDArray.followedBy(temp); } } }
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 DofManager :: giveCompleteLocationArray(IntArray &locationArray, const UnknownNumberingScheme &s) const { if ( !hasSlaveDofs ) { // prevents some size problem when connecting different elements with // different number of dofs locationArray.resizeWithValues(0, this->giveNumberOfDofs()); for ( Dof *dof: *this ) { locationArray.followedBy( s.giveDofEquationNumber( dof ) ); } } else { IntArray temp; locationArray.resize(0); for ( Dof *dof: *this ) { dof->giveEquationNumbers(temp, s); locationArray.followedBy(temp); } } }
IntArray XfemManager :: giveEnrichedDofIDs(const DofManager &iDMan) const { IntArray dofIdArray; for(int id : mXFEMPotentialDofIDs) { if(iDMan.hasDofID( DofIDItem(id) )) { dofIdArray.followedBy(id); } } return dofIdArray; }
void Node2NodeContactL :: giveLocationArray(IntArray &answer, const UnknownNumberingScheme &s) { Node2NodeContact :: giveLocationArray(answer, s); // Add one lagrange dof if ( this->masterNode->hasDofID( (DofIDItem)this->giveDofIdArray().at(1) ) ) { Dof *dof= this->masterNode->giveDofWithID( (DofIDItem)this->giveDofIdArray().at(1) ); answer.followedBy( s.giveDofEquationNumber(dof) ); } }
void SlaveDof :: giveMasterDofManArray(IntArray &answer) { IntArray mstrDofManArry; int masterDofs = this->giveNumberOfPrimaryMasterDofs(); answer.preallocate( masterDofs ); answer.resize( 0 ); for (int i = 1; i <= countOfMasterDofs; i++ ) { this->giveMasterDof(i)->giveMasterDofManArray(mstrDofManArry); answer.followedBy(mstrDofManArry); } }
void SlaveDof :: giveEquationNumbers(IntArray &masterEqNumbers, const UnknownNumberingScheme &s) { IntArray mstrEqNmbrs; int masterDofs = this->giveNumberOfPrimaryMasterDofs(); masterEqNumbers.preallocate( masterDofs ); masterEqNumbers.resize( 0 ); for (int i = 1; i <= countOfMasterDofs; i++ ) { this->giveMasterDof(i)->giveEquationNumbers(mstrEqNmbrs, s); masterEqNumbers.followedBy(mstrEqNmbrs); } }
void SlaveDof :: giveDofIDs(IntArray &masterDofIDs) { IntArray temp; int masterDofs = this->giveNumberOfPrimaryMasterDofs(); masterDofIDs.preallocate( masterDofs ); masterDofIDs.resize( 0 ); for (int i = 1; i <= countOfMasterDofs; i++ ) { this->giveMasterDof(i)->giveDofIDs(temp); masterDofIDs.followedBy(temp); } }
void LumpedMassElement :: giveDofManDofIDMask(int inode, EquationID eid, IntArray &answer) const { answer.resize(0, 6); DofManager *dman = this->giveDofManager(inode); int _i, _ndof = dman->giveNumberOfDofs(); DofIDItem _dofid; // simply collect all "structural" dofs of element node for ( _i = 1; _i <= _ndof; _i++ ) { _dofid = dman->giveDof(_i)->giveDofID(); if ( ( _dofid == D_u ) || ( _dofid == D_v ) || ( _dofid == D_w ) || ( _dofid == R_u ) || ( _dofid == R_v ) || ( _dofid == R_w ) ) { answer.followedBy(_dofid); } } }
void ActiveDof :: giveMasterDofManArray(IntArray &answer) { if ( this->isPrimaryDof() ) { answer.resize(1); answer.at(1) = this->giveDofManNumber(); return; } IntArray subMasterDofManArray; answer.resize( this->giveNumberOfPrimaryMasterDofs() ); int countOfMasterDofs = this->giveNumberOfMasterDofs(); for ( int i = 1; i <= countOfMasterDofs; i++ ) { this->giveMasterDof(i)->giveMasterDofManArray(subMasterDofManArray); answer.followedBy(subMasterDofManArray); } }
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); } }
void DofManager :: giveMasterDofIDArray(const IntArray &dofIDArry, IntArray &masterDofIDs) const { if ( !hasSlaveDofs ) { masterDofIDs = dofIDArry; } else { IntArray temp; masterDofIDs.clear(); for ( int dofid: dofIDArry ) { auto pos = this->findDofWithDofId( ( DofIDItem ) dofid ); if ( pos == this->end() ) { OOFEM_ERROR("incompatible dof (%d) requested", dofid); } (*pos)->giveDofIDs(temp); masterDofIDs.followedBy(temp); } } }
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); } }
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(); }
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( ); } }
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( ); } }
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( ); } }
void TrPlaneStress2dXFEM :: giveDofManDofIDMask(int inode, IntArray &answer) const { // Continuous part TrPlaneStress2d :: giveDofManDofIDMask(inode, answer); // Discontinuous part if( this->giveDomain()->hasXfemManager() ) { DofManager *dMan = giveDofManager(inode); XfemManager *xMan = giveDomain()->giveXfemManager(); const std::vector<int> &nodeEiIndices = xMan->giveNodeEnrichmentItemIndices( dMan->giveGlobalNumber() ); for ( size_t i = 0; i < nodeEiIndices.size(); i++ ) { EnrichmentItem *ei = xMan->giveEnrichmentItem(nodeEiIndices[i]); if ( ei->isDofManEnriched(* dMan) ) { IntArray eiDofIdArray; ei->computeEnrichedDofManDofIdArray(eiDofIdArray, *dMan); answer.followedBy(eiDofIdArray); } } } }
void EnrichmentItem :: createEnrichedDofs() { // Creates new dofs due to the enrichment and appends them to the dof managers int nrDofMan = this->giveDomain()->giveNumberOfDofManagers(); IntArray EnrDofIdArray; mEIDofIdArray.clear(); //int bcIndex = -1; int icIndex = -1; // Create new dofs for ( int i = 1; i <= nrDofMan; i++ ) { DofManager *dMan = this->giveDomain()->giveDofManager(i); if ( isDofManEnriched(* dMan) ) { //printf("dofMan %i is enriched \n", dMan->giveNumber()); computeEnrichedDofManDofIdArray(EnrDofIdArray, * dMan); // Collect boundary condition ID of existing dofs IntArray bcIndexArray; for ( Dof *dof: *dMan ) { bcIndexArray.followedBy(dof->giveBcId()); } bool foundBC = false; IntArray nonZeroBC; if ( !bcIndexArray.containsOnlyZeroes() ) { // BC is found on dofs foundBC = true; nonZeroBC.findNonzeros(bcIndexArray); } int iDof(1); for ( auto &dofid: EnrDofIdArray ) { if ( !dMan->hasDofID( ( DofIDItem ) ( dofid ) ) ) { if ( mInheritBoundaryConditions || mInheritOrderedBoundaryConditions ) { if ( foundBC ) { // Append dof with BC if ( mInheritOrderedBoundaryConditions ) { ///TODO: add choise of inheriting only specific BC. // Assume order type of new dofs are the same as original dMan->appendDof( new MasterDof(dMan, bcIndexArray.at(iDof), icIndex, ( DofIDItem ) dofid) ); } else { // Append enriched dofs with same BC dMan->appendDof( new MasterDof(dMan, bcIndexArray.at(nonZeroBC.at(1)), icIndex, ( DofIDItem ) dofid) ); } } else { // No BC found, append enriched dof without BC dMan->appendDof( new MasterDof(dMan, ( DofIDItem ) dofid) ); } } else { // Append enriched dof without BC dMan->appendDof( new MasterDof(dMan, ( DofIDItem ) dofid) ); } } iDof++; } } } // Remove old dofs int poolStart = giveStartOfDofIdPool(); int poolEnd = giveEndOfDofIdPool(); for ( int i = 1; i <= nrDofMan; i++ ) { DofManager *dMan = this->giveDomain()->giveDofManager(i); computeEnrichedDofManDofIdArray(EnrDofIdArray, * dMan); std :: vector< DofIDItem >dofsToRemove; for ( Dof *dof: *dMan ) { DofIDItem dofID = dof->giveDofID(); if ( dofID >= DofIDItem(poolStart) && dofID <= DofIDItem(poolEnd) ) { bool dofIsInIdArray = false; for ( int k = 1; k <= EnrDofIdArray.giveSize(); k++ ) { if ( dofID == DofIDItem( EnrDofIdArray.at(k) ) ) { dofIsInIdArray = true; break; } } if ( !dofIsInIdArray ) { dofsToRemove.push_back(dofID); } if(mEIDofIdArray.findFirstIndexOf(dofID) == 0 && dofIsInIdArray) { mEIDofIdArray.followedBy(dofID); } } } for ( size_t j = 0; j < dofsToRemove.size(); j++ ) { dMan->removeDof(dofsToRemove [ j ]); } } }
void MMALeastSquareProjection :: __init(Domain *dold, IntArray &type, FloatArray &coords, Set &elemSet, TimeStep *tStep, bool iCohesiveZoneGP) //(Domain* dold, IntArray& varTypes, GaussPoint* gp, TimeStep* tStep) { GaussPoint *sourceIp; Element *sourceElement; SpatialLocalizer *sl = dold->giveSpatialLocalizer(); IntegrationRule *iRule; IntArray patchList; this->patchDomain = dold; // find the closest IP on old mesh sourceElement = sl->giveElementContainingPoint(coords, elemSet); if ( !sourceElement ) { OOFEM_ERROR("no suitable source element found"); } // determine the type of patch Element_Geometry_Type egt = sourceElement->giveGeometryType(); if ( egt == EGT_line_1 ) { this->patchType = MMALSPPatchType_1dq; } else if ( ( egt == EGT_triangle_1 ) || ( egt == EGT_quad_1 ) ) { this->patchType = MMALSPPatchType_2dq; } else { OOFEM_ERROR("unsupported material mode"); } /* Determine the state of closest point. * Only IP in the neighbourhood with same state can be used * to interpolate the values. */ FloatArray dam; int state = 0; if ( this->stateFilter ) { iRule = sourceElement->giveDefaultIntegrationRulePtr(); for ( GaussPoint *gp: *iRule ) { sourceElement->giveIPValue(dam, gp, IST_PrincipalDamageTensor, tStep); if ( dam.computeNorm() > 1.e-3 ) { state = 1; // damaged } } } // from source neighbours the patch will be constructed Element *element; IntArray neighborList; patchList.resize(1); patchList.at(1) = sourceElement->giveNumber(); int minNumberOfPoints = this->giveNumberOfUnknownPolynomialCoefficients(this->patchType); int actualNumberOfPoints = sourceElement->giveDefaultIntegrationRulePtr()->giveNumberOfIntegrationPoints(); int nite = 0; int elemFlag; // check if number of IP in patchList is sufficient // some recursion control would be appropriate while ( ( actualNumberOfPoints < minNumberOfPoints ) && ( nite <= 2 ) ) { //if not, construct the neighborhood dold->giveConnectivityTable()->giveElementNeighbourList(neighborList, patchList); // count number of available points patchList.clear(); actualNumberOfPoints = 0; for ( int i = 1; i <= neighborList.giveSize(); i++ ) { if ( this->stateFilter ) { element = patchDomain->giveElement( neighborList.at(i) ); // exclude elements in different regions if ( !elemSet.hasElement( element->giveNumber() ) ) { continue; } iRule = element->giveDefaultIntegrationRulePtr(); elemFlag = 0; for ( GaussPoint *gp: *iRule ) { element->giveIPValue(dam, gp, IST_PrincipalDamageTensor, tStep); if ( state && ( dam.computeNorm() > 1.e-3 ) ) { actualNumberOfPoints++; elemFlag = 1; } else if ( ( state == 0 ) && ( dam.computeNorm() < 1.e-3 ) ) { actualNumberOfPoints++; elemFlag = 1; } } if ( elemFlag ) { // include this element with corresponding state in neighbor search. patchList.followedBy(neighborList.at(i), 10); } } else { // if (! yhis->stateFilter) element = patchDomain->giveElement( neighborList.at(i) ); // exclude elements in different regions if ( !elemSet.hasElement( element->giveNumber() ) ) { continue; } actualNumberOfPoints += element->giveDefaultIntegrationRulePtr()->giveNumberOfIntegrationPoints(); patchList.followedBy(neighborList.at(i), 10); } } // end loop over neighbor list nite++; } if ( nite > 2 ) { // not enough points -> take closest point projection patchGPList.clear(); sourceIp = sl->giveClosestIP(coords, elemSet); patchGPList.push_front(sourceIp); //fprintf(stderr, "MMALeastSquareProjection: too many neighbor search iterations\n"); //exit (1); return; } #ifdef MMALSP_ONLY_CLOSEST_POINTS // select only the nval closest IP points GaussPoint **gpList = ( GaussPoint ** ) malloc(sizeof( GaussPoint * ) * actualNumberOfPoints); FloatArray dist(actualNumberOfPoints), srcgpcoords; int npoints = 0; // check allocation of gpList if ( gpList == NULL ) { OOFEM_FATAL("memory allocation error"); } for ( int ielem = 1; ielem <= patchList.giveSize(); ielem++ ) { element = patchDomain->giveElement( patchList.at(ielem) ); iRule = element->giveDefaultIntegrationRulePtr(); for ( GaussPoint *srcgp: *iRule ) { if ( element->computeGlobalCoordinates( srcgpcoords, * ( srcgp->giveNaturalCoordinates() ) ) ) { element->giveIPValue(dam, srcgp, IST_PrincipalDamageTensor, tStep); if ( this->stateFilter ) { // consider only points with same state if ( ( ( state == 1 ) && ( norm(dam) > 1.e-3 ) ) || ( ( ( state == 0 ) && norm(dam) < 1.e-3 ) ) ) { npoints++; dist.at(npoints) = coords.distance(srcgpcoords); gpList [ npoints - 1 ] = srcgp; } } else { // take all points into account npoints++; dist.at(npoints) = coords.distance(srcgpcoords); gpList [ npoints - 1 ] = srcgp; } } else { OOFEM_ERROR("computeGlobalCoordinates failed"); } } } if ( npoints != actualNumberOfPoints ) { OOFEM_ERROR("internal error"); } //minNumberOfPoints = min (actualNumberOfPoints, minNumberOfPoints+2); patchGPList.clear(); // now find the minNumberOfPoints with smallest distance // from point of interest double swap, minDist; int minDistIndx = 0; // loop over all points for ( int i = 1; i <= minNumberOfPoints; i++ ) { minDist = dist.at(i); minDistIndx = i; // search for point with i-th smallest distance for ( j = i + 1; j <= actualNumberOfPoints; j++ ) { if ( dist.at(j) < minDist ) { minDist = dist.at(j); minDistIndx = j; } } // remember this ip patchGPList.push_front(gpList [ minDistIndx - 1 ]); swap = dist.at(i); dist.at(i) = dist.at(minDistIndx); dist.at(minDistIndx) = swap; srcgp = gpList [ i - 1 ]; gpList [ i - 1 ] = gpList [ minDistIndx - 1 ]; gpList [ minDistIndx - 1 ] = srcgp; } if ( patchGPList.size() != minNumberOfPoints ) { OOFEM_ERROR("internal error 2"); exit(1); } free(gpList); #else // take all neighbors patchGPList.clear(); for ( int ielem = 1; ielem <= patchList.giveSize(); ielem++ ) { element = patchDomain->giveElement( patchList.at(ielem) ); iRule = element->giveDefaultIntegrationRulePtr(); for ( GaussPoint *gp: *iRule ) { patchGPList.push_front( gp ); } } #endif }
void EnrichmentItem :: givePotentialEIDofIdArray(IntArray &answer) const { answer.clear(); for ( int i = this->giveStartOfDofIdPool(); i <= this->giveEndOfDofIdPool(); i++ ) { answer.followedBy(i); } }
void MatlabExportModule :: doOutputReactionForces(TimeStep *tStep, FILE *FID) { int domainIndex = 1; Domain *domain = emodel->giveDomain( domainIndex ); FloatArray reactions; IntArray dofManMap, dofidMap, eqnMap; #ifdef __SM_MODULE StructuralEngngModel *strEngMod = dynamic_cast< StructuralEngngModel * >(emodel); if ( strEngMod ) { strEngMod->buildReactionTable(dofManMap, dofidMap, eqnMap, tStep, domainIndex); strEngMod->computeReaction(reactions, tStep, 1); } else #endif { OOFEM_ERROR("Cannot export reaction forces - only implemented for structural problems."); } // Set the nodes and elements to export based on sets if ( this->reactionForcesNodeSet > 0 ) { Set *set = domain->giveSet( this->reactionForcesNodeSet ); reactionForcesDofManList = set->giveNodeList(); } int numDofManToExport = this->reactionForcesDofManList.giveSize(); if ( numDofManToExport == 0 ) { // No dofMan's given - export every dMan with reaction forces for (int i = 1; i <= domain->giveNumberOfDofManagers(); i++) { if ( dofManMap.contains(i) ) { this->reactionForcesDofManList.followedBy(i); } } numDofManToExport = this->reactionForcesDofManList.giveSize(); } // Output header fprintf( FID, "\n %%%% Export of reaction forces \n\n" ); // Output the dofMan numbers that are exported fprintf( FID, "\tReactionForces.DofManNumbers = [" ); for ( int i = 1; i <= numDofManToExport; i++ ) { fprintf( FID, "%i ", this->reactionForcesDofManList.at(i) ); } fprintf( FID, "];\n" ); // Define the reaction forces as a cell object fprintf( FID, "\tReactionForces.ReactionForces = cell(%i,1); \n", numDofManToExport ); fprintf( FID, "\tReactionForces.DofIDs = cell(%i,1); \n", numDofManToExport ); // Output the reaction forces for each dofMan. If a certain dof is not prescribed zero is exported. IntArray dofIDs; for ( int i = 1; i <= numDofManToExport; i++ ) { int dManNum = this->reactionForcesDofManList.at(i); fprintf(FID, "\tReactionForces.ReactionForces{%i} = [", i); if ( dofManMap.contains( dManNum ) ) { DofManager *dofMan = domain->giveDofManager( dManNum ); dofIDs.clear(); for ( Dof *dof: *dofMan ) { int num = dof->giveEquationNumber( EModelDefaultPrescribedEquationNumbering() ); int pos = eqnMap.findFirstIndexOf( num ); dofIDs.followedBy(dof->giveDofID()); if ( pos > 0 ) { fprintf(FID, "%e ", reactions.at(pos)); } else { fprintf( FID, "%e ", 0.0 ); // if not prescibed output zero } } } fprintf(FID, "];\n"); // Output dof ID's fprintf( FID, "\tReactionForces.DofIDs{%i} = [", i); if ( dofManMap.contains( dManNum ) ) { for ( int id: dofIDs ) { fprintf( FID, "%i ", id ); } } fprintf(FID, "];\n"); } }