double NonlocalMaterialExtensionInterface :: computeWeightFunction(const FloatArray &src, const FloatArray &coord) { return computeWeightFunction( src.distance(coord) ); }
void MisesMatNl :: modifyNonlocalWeightFunctionAround(GaussPoint *gp) { MisesMatNlStatus *nonlocStatus, *status = static_cast< MisesMatNlStatus * >( this->giveStatus(gp) ); std :: list< localIntegrationRecord > *list = this->giveIPIntegrationList(gp); std :: list< localIntegrationRecord > :: iterator pos, postarget; // find the current Gauss point (target) in the list of it neighbors for ( pos = list->begin(); pos != list->end(); ++pos ) { if ( pos->nearGp == gp ) { postarget = pos; } } Element *elem = gp->giveElement(); FloatArray coords; elem->computeGlobalCoordinates( coords, * ( gp->giveNaturalCoordinates() ) ); double xtarget = coords.at(1); double w, wsum = 0., x, xprev, damage, damageprev = 0.0; Element *nearElem; // process the list from the target to the end double distance = 0.; // distance modified by damage xprev = xtarget; for ( pos = postarget; pos != list->end(); ++pos ) { nearElem = ( pos->nearGp )->giveElement(); nearElem->computeGlobalCoordinates( coords, * ( ( pos->nearGp )->giveNaturalCoordinates() ) ); x = coords.at(1); nonlocStatus = static_cast< MisesMatNlStatus * >( this->giveStatus(pos->nearGp) ); damage = nonlocStatus->giveTempDamage(); if ( pos != postarget ) { distance += ( x - xprev ) * 0.5 * ( computeDistanceModifier(damage) + computeDistanceModifier(damageprev) ); } w = computeWeightFunction(distance) * nearElem->computeVolumeAround(pos->nearGp); pos->weight = w; wsum += w; xprev = x; damageprev = damage; } // process the list from the target to the beginning distance = 0.; for ( pos = postarget; pos != list->begin(); --pos ) { nearElem = ( pos->nearGp )->giveElement(); nearElem->computeGlobalCoordinates( coords, * ( ( pos->nearGp )->giveNaturalCoordinates() ) ); x = coords.at(1); nonlocStatus = static_cast< MisesMatNlStatus * >( this->giveStatus(pos->nearGp) ); damage = nonlocStatus->giveTempDamage(); if ( pos != postarget ) { distance += ( xprev - x ) * 0.5 * ( computeDistanceModifier(damage) + computeDistanceModifier(damageprev) ); w = computeWeightFunction(distance) * nearElem->computeVolumeAround(pos->nearGp); pos->weight = w; wsum += w; } xprev = x; damageprev = damage; } // the beginning must be treated separately pos = list->begin(); if ( pos != postarget ) { nearElem = ( pos->nearGp )->giveElement(); nearElem->computeGlobalCoordinates( coords, * ( ( pos->nearGp )->giveNaturalCoordinates() ) ); x = coords.at(1); nonlocStatus = static_cast< MisesMatNlStatus * >( this->giveStatus(pos->nearGp) ); damage = nonlocStatus->giveTempDamage(); distance += ( xprev - x ) * 0.5 * ( computeDistanceModifier(damage) + computeDistanceModifier(damageprev) ); w = computeWeightFunction(distance) * nearElem->computeVolumeAround(pos->nearGp); pos->weight = w; wsum += w; } status->setIntegrationScale(wsum); }