void Delamination :: findInitiationFronts(bool &failureChecked, const IntArray &CSnumbers, std :: vector< IntArray > &CSinterfaceNumbers, std :: vector< IntArray > &CSDofManNumbers, std :: vector< FloatArray > &initiationFactors, TimeStep *tStep) { // Loop through all cross sections associated with delaminations // Returns // CSinterfaceNumbers: the failed interface number associated with the cross sections. // CSDofManNumbers: the dofmanagers that should be enriched (associated with the cross sections) IntArray failedElementInterfaces; IntArray elementNumbers; SpatialLocalizer *localizer = this->giveDomain()->giveSpatialLocalizer(); // NB: Assumes that elements can only be included in one cross section. for ( int iCS = 1 ; iCS <= CSnumbers.giveSize() ; iCS++ ) { int eltSetNumber = this->giveDomain()->giveCrossSection(CSnumbers.at(iCS))->giveSetNumber(); //printf("Cross section No. %i, set No. %i \n",CSnumbers.at(iCS),eltSetNumber); IntArray elementNumbers = this->giveDomain()->giveSet(eltSetNumber)->giveElementList(); for ( auto eltNumber : elementNumbers ) { Element *elt = this->giveDomain()->giveGlobalElement(eltNumber); if ( Shell7BaseXFEM *shellElt = dynamic_cast < Shell7BaseXFEM * > (elt) ) { //bool recoverStresses = true; shellElt->giveFailedInterfaceNumber(failedElementInterfaces, initiationFactors[iCS-1], tStep, this->recoverStresses); //failedElementInterfaces.printYourself("failedElementInterfaces"); for (int eltInt : failedElementInterfaces ) { CSinterfaceNumbers[iCS-1].insertSortedOnce(eltInt); } if ( !failedElementInterfaces.isEmpty() ) { for (int iDF : shellElt->giveDofManArray() ) { //printf("element node %d \n",iDF); if ( this->initiationRadius > 0.0 ) { const FloatArray gCoords = this->giveDomain()->giveNode(iDF)->giveNodeCoordinates(); std :: list< int > nodeList; localizer->giveAllNodesWithinBox(nodeList,gCoords,initiationRadius); for ( int jNode : nodeList ) { //printf("nodeList node %d \n",jNode); CSDofManNumbers[iCS-1].insertSortedOnce(jNode); } } else { CSDofManNumbers[iCS-1].insertSortedOnce(iDF); } } } } } } failureChecked = true; }
int EIPrimaryUnknownMapper :: evaluateAt(FloatArray &answer, IntArray &dofMask, ValueModeType mode, Domain *oldd, FloatArray &coords, IntArray ®List, TimeStep *tStep) { Element *oelem; EIPrimaryUnknownMapperInterface *interface; SpatialLocalizer *sl = oldd->giveSpatialLocalizer(); FloatArray lcoords, closest; if ( regList.isEmpty() ) { oelem = sl->giveElementClosestToPoint(lcoords, closest, coords, 0); } else { // Take the minimum of any region double mindist = 0.0, distance; oelem = NULL; for ( int i = 1; i < regList.giveSize(); ++i ) { Element *tmpelem = sl->giveElementClosestToPoint( lcoords, closest, coords, regList.at(i) ); distance = closest.distance_square(coords); if ( tmpelem != NULL ) { distance = closest.distance_square(coords); if ( distance < mindist || i == 1 ) { mindist = distance; oelem = tmpelem; if ( distance == 0.0 ) { break; } } } } } if ( !oelem ) { OOFEM_WARNING("Couldn't find any element containing point."); return false; } interface = static_cast< EIPrimaryUnknownMapperInterface * >( oelem->giveInterface(EIPrimaryUnknownMapperInterfaceType) ); if ( interface ) { oelem->giveElementDofIDMask(dofMask); interface->EIPrimaryUnknownMI_computePrimaryUnknownVectorAtLocal(mode, tStep, lcoords, answer); } else { OOFEM_ERROR("Element does not support EIPrimaryUnknownMapperInterface"); } return true; }
bool DofManager :: computeM2LTransformation(FloatMatrix &answer, const IntArray &dofIDArry) { if ( !this->hasAnySlaveDofs() ) { return false; } FloatArray mstrContrs; if ( dofIDArry.isEmpty() ) { ///@todo I don't think this should be called like this since it relies on the order of the dofs. int cols = 0; for ( Dof *dof: *this ) { cols += dof->giveNumberOfPrimaryMasterDofs(); } answer.resize( this->giveNumberOfDofs(), cols ); answer.zero(); int k = 1, i = 1; for ( Dof *dof: *this ) { dof->computeDofTransformation(mstrContrs); answer.copySubVectorRow(mstrContrs, i, k); k += mstrContrs.giveSize(); i++; } } else { answer.resize( dofIDArry.giveSize(), giveNumberOfPrimaryMasterDofs(dofIDArry) ); answer.zero(); int k = 1; for ( int i = 1; i <= dofIDArry.giveSize(); i++ ) { this->giveDofWithID(dofIDArry.at(i))->computeDofTransformation(mstrContrs); answer.copySubVectorRow(mstrContrs, i, k); k += mstrContrs.giveSize(); } } return true; }
int EIPrimaryUnknownMapper :: evaluateAt(FloatArray &answer, IntArray &dofMask, ValueModeType mode, Domain *oldd, FloatArray &coords, IntArray ®List, TimeStep *tStep) { Element *oelem; EIPrimaryUnknownMapperInterface *interface; SpatialLocalizer *sl = oldd->giveSpatialLocalizer(); ///@todo Change to the other version after checking that it works properly. Will render "giveElementCloseToPoint" obsolete (superseeded by giveElementClosestToPoint). #if 1 if ( regList.isEmpty() ) { oelem = sl->giveElementContainingPoint(coords); } else { oelem = sl->giveElementContainingPoint(coords, & regList); } if ( !oelem ) { if ( regList.isEmpty() ) { oelem = oldd->giveSpatialLocalizer()->giveElementCloseToPoint(coords); } else { oelem = oldd->giveSpatialLocalizer()->giveElementCloseToPoint(coords, & regList); } if ( !oelem ) { OOFEM_WARNING("Couldn't find any element containing point."); return false; } } #else FloatArray lcoords, closest; if ( regList.isEmpty() ) { oelem = sl->giveElementClosestToPoint(lcoords, closest, coords, 0); } else { // Take the minimum of any region double mindist = 0.0, distance; oelem = NULL; for ( int i = 1; i < regList.giveSize(); ++i ) { Element *tmpelem = sl->giveElementClosestToPoint( lcoords, closest, coords, regList.at(i) ); distance = closest.distance_square(coords); if ( tmpelem != NULL ) { distance = closest.distance_square(coords); if ( distance < mindist || i == 1 ) { mindist = distance; oelem = tmpelem; if ( distance == 0.0 ) { break; } } } } } if ( !oelem ) { OOFEM_WARNING("Couldn't find any element containing point."); return false; } #endif interface = static_cast< EIPrimaryUnknownMapperInterface * >( oelem->giveInterface(EIPrimaryUnknownMapperInterfaceType) ); if ( interface ) { oelem->giveElementDofIDMask(dofMask); #if 1 FloatArray lcoords; if ( oelem->computeLocalCoordinates(lcoords, coords) ) { interface->EIPrimaryUnknownMI_computePrimaryUnknownVectorAtLocal(mode, tStep, lcoords, answer); } else { answer.clear(); } #else interface->EIPrimaryUnknownMI_computePrimaryUnknownVectorAtLocal(mode, tStep, lcoords, answer); #endif } else { OOFEM_ERROR("Element does not support EIPrimaryUnknownMapperInterface"); } return true; }