本文整理汇总了C++中MESH::nodePtr方法的典型用法代码示例。如果您正苦于以下问题:C++ MESH::nodePtr方法的具体用法?C++ MESH::nodePtr怎么用?C++ MESH::nodePtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MESH
的用法示例。
在下文中一共展示了MESH::nodePtr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply
//! Get required faces of every element and store the unqiue ones
static void apply( const MESH & mesh,
const std::vector<Face> & faces,
FaceMesh & faceMesh )
{
// 1. Allocate space for nodes and face elements
const std::size_t numNodes = std::distance( mesh.nodesBegin(),
mesh.nodesEnd() );
const std::size_t numElements = faces.size();
faceMesh.allocate( numNodes, numElements );
// 2. Copy nodes (not just the pointers!!!)
typename MESH::NodePtrConstIter sourceNode = mesh.nodesBegin();
typename MESH::NodePtrConstIter finalNode = mesh.nodesEnd();
typename FaceMesh::NodePtrIter copyNode = faceMesh.nodesBegin();
for ( ; sourceNode != finalNode; ++sourceNode, ++copyNode ) {
// Copy the global ID
(*copyNode) -> setID( (*sourceNode) -> getID() );
// Copy the coordinates
std::vector<double> x( Node::dim );
(*sourceNode) -> getX( x.begin() );
(*copyNode) -> setX( x.begin() );
}
// 3. Generate new elements from faces
typename FaceMesh::ElementPtrIter elemIter = faceMesh.elementsBegin();
typename FaceMesh::ElementPtrIter elemEnd = faceMesh.elementsEnd();
typename std::vector<Face>::const_iterator faceIter = faces.begin();
for ( ; elemIter != elemEnd; ++elemIter, ++faceIter ) {
// Extract face's node IDs
Face nodeIDs;
for ( unsigned v = 0; v < nodeIDs.size(); v ++ )
nodeIDs[v] = faceIter -> at( v );
// Set face element connectivity
typename FaceMesh::Element::NodePtrIter node =
(*elemIter) -> nodesBegin();
for ( unsigned v = 0; v < Face::size(); v++, ++node ) {
(*node) = mesh.nodePtr( nodeIDs[v] );
}
}
return;
}