本文整理汇总了C++中SurfaceMesh::allocate方法的典型用法代码示例。如果您正苦于以下问题:C++ SurfaceMesh::allocate方法的具体用法?C++ SurfaceMesh::allocate怎么用?C++ SurfaceMesh::allocate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SurfaceMesh
的用法示例。
在下文中一共展示了SurfaceMesh::allocate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
//.........这里部分代码省略.........
//! node counter
std::size_t nodeCtr = 0;
//! Go through all elements
for ( std::size_t e = 0; e < numElements; e ++ ) {
//! Construct multi-index from linear counter
const MultiIndexType eM = MultiIndex::wrap( e, gridSizes );
//! Check if on requested boundary surface
const bool onBoundary = ( eM[ dir ] == mIndexComp );
//! If so, construct the surface element(s)
if ( onBoundary ) {
//! Get pointer to volume element
VolumeElement * vep = grid.elementPtr( eM );
//! Go through elements on the surface of the volume element
for ( unsigned se = 0; se < numSurfElementsPerElement; se ++ ) {
//! Create new surface element
SurfaceElement * surfElem = new SurfaceElement;
//! Extract the surface simplex's vertices
boost::array<unsigned, numSurfSimplexVertices> surfSimplex;
detail_::ExtractSurfaceSimplex<VolumeElement::shape>()( parameterSurfaceIndices,
se, surfSimplex );
//! Set volume element pointer
surfElem -> setVolumeElementPointer( vep );
//! Access to surface elements geometry nodes
typename SurfaceElement::NodePtrIter nodePtrIter =
surfElem -> nodesBegin();
//! Go through the parameter points of the surface element
typename SurfaceElement::ParamIter paramIter =
surfElem -> parametricBegin();
typename SurfaceElement::ParamIter paramEnd =
surfElem -> parametricEnd();
for ( unsigned p = 0; paramIter != paramEnd;
++paramIter, ++nodePtrIter, p++ ) {
//! ..
typename base::Vector<surfaceDim>::Type eta
= surfaceSupportPoints[ p ];
typename LinearSimplexFun::FunArray phi;
linearSimplexFun.evaluate( eta, phi );
typename base::Vector<volumeDim>::Type xi
= base::constantVector<volumeDim>( 0. );
for ( unsigned s = 0; s < phi.size(); s ++ ) {
xi += phi[s] * volumeVertices[ surfSimplex[s] ];
}
*paramIter = xi;
//! evaluate geometry at the parameter point
const typename VolumeElement::Node::VecDim x =
base::Geometry<VolumeElement>()( vep, xi );
//! convert to vector and pass to node
std::vector<double> xV( x.size() );
for ( int d = 0; d < x.size(); d ++ )
xV[d] = x[d];
SurfaceNode * surfNode = new SurfaceNode;
surfNode -> setX( xV.begin() );
surfNode -> setID( nodeCtr++ );
*nodePtrIter = surfNode;
surfaceNodes.push_back( surfNode );
} // end loop over surface element's nodes
//! Store element pointer
surfaceElements.push_back( surfElem );
} // end loop over simplices per volume element
} // end condition if volume element lies on requested bdry
}// end loop over all volume elements
surfaceMesh.allocate( surfaceNodes.size(), surfaceElements.size() );
std::copy( surfaceNodes.begin(), surfaceNodes.end(),
surfaceMesh.nodesBegin() );
std::copy( surfaceElements.begin(), surfaceElements.end(),
surfaceMesh.elementsBegin() );
return;
}