本文整理汇总了C++中SpatialLocalizer::giveAllElementsWithIpWithinBox方法的典型用法代码示例。如果您正苦于以下问题:C++ SpatialLocalizer::giveAllElementsWithIpWithinBox方法的具体用法?C++ SpatialLocalizer::giveAllElementsWithIpWithinBox怎么用?C++ SpatialLocalizer::giveAllElementsWithIpWithinBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpatialLocalizer
的用法示例。
在下文中一共展示了SpatialLocalizer::giveAllElementsWithIpWithinBox方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tangent
void PLHoopStressCirc :: propagateInterfaces(Domain &iDomain, EnrichmentDomain &ioEnrDom)
{
// Fetch crack tip data
TipInfo tipInfoStart, tipInfoEnd;
ioEnrDom.giveTipInfos(tipInfoStart, tipInfoEnd);
std :: vector< TipInfo >tipInfo = {tipInfoStart, tipInfoEnd};
SpatialLocalizer *localizer = iDomain.giveSpatialLocalizer();
for ( size_t tipIndex = 0; tipIndex < tipInfo.size(); tipIndex++ ) {
// Construct circle points on an arc from -90 to 90 degrees
double angle = -90.0 + mAngleInc;
std :: vector< double >angles;
while ( angle <= ( 90.0 - mAngleInc ) ) {
angles.push_back(angle * M_PI / 180.0);
angle += mAngleInc;
}
const FloatArray &xT = tipInfo [ tipIndex ].mGlobalCoord;
const FloatArray &t = tipInfo [ tipIndex ].mTangDir;
const FloatArray &n = tipInfo [ tipIndex ].mNormalDir;
// It is meaningless to propagate a tip that is not inside any element
Element *el = localizer->giveElementContainingPoint(tipInfo [ tipIndex ].mGlobalCoord);
if ( el != NULL ) {
std :: vector< FloatArray >circPoints;
for ( size_t i = 0; i < angles.size(); i++ ) {
FloatArray tangent(2);
tangent.zero();
tangent.add(cos(angles [ i ]), t);
tangent.add(sin(angles [ i ]), n);
tangent.normalize();
FloatArray x(xT);
x.add(mRadius, tangent);
circPoints.push_back(x);
}
std :: vector< double >sigTTArray, sigRTArray;
// Loop over circle points
for ( size_t pointIndex = 0; pointIndex < circPoints.size(); pointIndex++ ) {
FloatArray stressVec;
if ( mUseRadialBasisFunc ) {
// Interpolate stress with radial basis functions
// Choose a cut-off length l:
// take the distance between two nodes in the element containing the
// crack tip multiplied by a constant factor.
// ( This choice implies that we hope that the element has reasonable
// aspect ratio.)
const FloatArray &x1 = * ( el->giveDofManager(1)->giveCoordinates() );
const FloatArray &x2 = * ( el->giveDofManager(2)->giveCoordinates() );
const double l = 1.0 * x1.distance(x2);
// Use the octree to get all elements that have
// at least one Gauss point in a certain region around the tip.
const double searchRadius = 3.0 * l;
std :: set< int >elIndices;
localizer->giveAllElementsWithIpWithinBox(elIndices, circPoints [ pointIndex ], searchRadius);
// Loop over the elements and Gauss points obtained.
// Evaluate the interpolation.
FloatArray sumQiWiVi;
double sumWiVi = 0.0;
for ( int elIndex: elIndices ) {
Element *gpEl = iDomain.giveElement(elIndex);
IntegrationRule *iRule = gpEl->giveDefaultIntegrationRulePtr();
for ( GaussPoint *gp_i: *iRule ) {
////////////////////////////////////////
// Compute global gp coordinates
FloatArray N;
FEInterpolation *interp = gpEl->giveInterpolation();
interp->evalN( N, * ( gp_i->giveCoordinates() ), FEIElementGeometryWrapper(gpEl) );
// Compute global coordinates of Gauss point
FloatArray globalCoord(2);
globalCoord.zero();
for ( int i = 1; i <= gpEl->giveNumberOfDofManagers(); i++ ) {
DofManager *dMan = gpEl->giveDofManager(i);
globalCoord.at(1) += N.at(i) * dMan->giveCoordinate(1);
globalCoord.at(2) += N.at(i) * dMan->giveCoordinate(2);
}
////////////////////////////////////////
// Compute weight of kernel function
FloatArray tipToGP;
tipToGP.beDifferenceOf(globalCoord, xT);
bool inFrontOfCrack = true;
//.........这里部分代码省略.........