本文整理汇总了C++中SpatialLocalizer::init方法的典型用法代码示例。如果您正苦于以下问题:C++ SpatialLocalizer::init方法的具体用法?C++ SpatialLocalizer::init怎么用?C++ SpatialLocalizer::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpatialLocalizer
的用法示例。
在下文中一共展示了SpatialLocalizer::init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeResultAtCenterOfGravity
void
FreeWarping :: computeResultAtCenterOfGravity(TimeStep *tStep)
{
int noCS = this->giveDomain(1)->giveNumberOfCrossSectionModels(); //number of warping Crosssections
SolutionAtCG.resize(noCS);
Element *closestElement;
FloatArray lcoords, closest, lcg;
SpatialLocalizer *sp = this->giveDomain(1)->giveSpatialLocalizer();
sp->init();
lcoords.resize(2);
closest.resize(2);
lcg.resize(2);
for ( int j = 1; j <= noCS; ++j ) {
lcg.at(1) = CG.at(j, 1);
lcg.at(2) = CG.at(j, 2);
closestElement = sp->giveElementClosestToPoint(lcoords, closest, lcg, 0);
StructuralElement *sE = dynamic_cast< StructuralElement * >(closestElement);
FloatArray u, r, b;
FloatMatrix N;
sE->computeNmatrixAt(lcoords, N);
sE->computeVectorOf(VM_Total, tStep, u);
u.resizeWithValues(3);
r.beProductOf(N, u);
SolutionAtCG.at(j) = r.at(1);
}
}
示例2: postInitialize
void HangingNode :: postInitialize()
{
Node :: postInitialize();
Element *e;
FEInterpolation *fei;
FloatArray lcoords, masterContribution;
#ifdef __OOFEG
if ( initialized ) {
return;
}
initialized = true;
#endif
// First check element and interpolation
if ( masterElement == -1 ) { // Then we find it by taking the closest (probably containing element)
FloatArray closest;
SpatialLocalizer *sp = this->domain->giveSpatialLocalizer();
sp->init();
// Closest point or containing point? It should be contained, but with numerical errors it might be slightly outside
// so the closest point is more robust.
if ( !( e = sp->giveElementClosestToPoint(lcoords, closest, coordinates, this->masterRegion) ) ) {
OOFEM_ERROR("Couldn't find closest element (automatically).");
}
this->masterElement = e->giveNumber();
} else if ( !( e = this->giveDomain()->giveElement(this->masterElement) ) ) {
OOFEM_ERROR("Requested element %d doesn't exist.", this->masterElement);
}
if ( !( fei = e->giveInterpolation() ) ) {
OOFEM_ERROR("Requested element %d doesn't have a interpolator.", this->masterElement);
}
if ( lcoords.giveSize() == 0 ) { // we don't need to do this again if the spatial localizer was used.
fei->global2local( lcoords, coordinates, FEIElementGeometryWrapper(e) );
}
// Initialize slave dofs (inside check of consistency of receiver and master dof)
const IntArray &masterNodes = e->giveDofManArray();
for ( Dof *dof: *this ) {
SlaveDof *sdof = dynamic_cast< SlaveDof * >(dof);
if ( sdof ) {
DofIDItem id = sdof->giveDofID();
fei = e->giveInterpolation(id);
if ( !fei ) {
OOFEM_ERROR("Requested interpolation for dof id %d doesn't exist in element %d.",
id, this->masterElement);
}
#if 0 // This won't work (yet), as it requires some more general FEI classes, or something similar.
if ( fei->hasMultiField() ) {
FloatMatrix multiContribution;
IntArray masterDofIDs, masterNodesDup, dofids;
fei->evalMultiN(multiContribution, dofids, lcoords, FEIElementGeometryWrapper(e), 0.0);
masterContribution.flatten(multiContribution);
masterDofIDs.clear();
for ( int i = 0; i <= multiContribution.giveNumberOfColumns(); ++i ) {
masterDofIDs.followedBy(dofids);
masterNodesDup.followedBy(masterNodes);
}
sdof->initialize(masterNodesDup, & masterDofIDs, masterContribution);
} else { }
#else
// Note: There can be more masterNodes than masterContributions, since all the
// FEI classes are based on that the first nodes correspond to the simpler/linear interpolation.
// If this assumption is changed in FEIElementGeometryWrapper + friends,
// masterNode will also need to be modified for each dof accordingly.
fei->evalN( masterContribution, lcoords, FEIElementGeometryWrapper(e) );
sdof->initialize(masterNodes, IntArray(), masterContribution);
#endif
}
}
}