MOAB: Mesh Oriented datABase
(version 5.4.1)
|
Iterate over all edges in a patch. More...
#include <EdgeIterator.hpp>
Classes | |
struct | Edge |
Public Member Functions | |
EdgeIterator (PatchData *patch, MsqError &err) | |
bool | is_at_end () const |
const Vector3D & | start () const |
const Vector3D & | end () const |
const Vector3D * | mid () const |
void | step (MsqError &err) |
Private Member Functions | |
void | get_adjacent_vertices (MsqError &err) |
Private Attributes | |
PatchData * | patchPtr |
size_t | vertIdx |
std::vector< Edge > | adjList |
std::vector< Edge >::iterator | adjIter |
Iterate over all edges in a patch.
Definition at line 43 of file EdgeIterator.hpp.
MBMesquite::EdgeIterator::EdgeIterator | ( | PatchData * | patch, |
MsqError & | err | ||
) |
Definition at line 40 of file EdgeIterator.cpp.
References adjIter, adjList, MBMesquite::PatchData::generate_vertex_to_element_data(), get_adjacent_vertices(), MSQ_ERRRTN, MBMesquite::PatchData::num_nodes(), patchPtr, and step().
const Vector3D & MBMesquite::EdgeIterator::end | ( | ) | const [inline] |
Definition at line 89 of file EdgeIterator.hpp.
References adjIter, patchPtr, and MBMesquite::PatchData::vertex_by_index().
Referenced by MBMesquite::MeshUtil::edge_length_distribution(), MBMesquite::MeshWriter::write_eps(), MBMesquite::MeshWriter::write_gnuplot(), and MBMesquite::MeshWriter::write_svg().
{ return patchPtr->vertex_by_index( adjIter->otherVertex ); }
void MBMesquite::EdgeIterator::get_adjacent_vertices | ( | MsqError & | err | ) | [private] |
Definition at line 55 of file EdgeIterator.cpp.
References adjIter, adjList, MBMesquite::edges, MBMesquite::PatchData::element_by_index(), MBMesquite::MsqMeshEntity::get_element_type(), MBMesquite::PatchData::get_vertex_element_adjacencies(), MBMesquite::MsqMeshEntity::get_vertex_index(), MBMesquite::MsqMeshEntity::get_vertex_index_array(), MSQ_ERRRTN, MBMesquite::MsqMeshEntity::node_count(), patchPtr, and vertIdx.
Referenced by EdgeIterator(), and step().
{ adjList.clear(); // Get all adjacent elements size_t num_elem; const size_t* elems = patchPtr->get_vertex_element_adjacencies( vertIdx, num_elem, err );MSQ_ERRRTN( err ); // Get all adjacent vertices from elements std::vector< size_t > elem_verts; for( size_t e = 0; e < num_elem; ++e ) { MsqMeshEntity& elem = patchPtr->element_by_index( elems[e] ); EntityTopology type = elem.get_element_type(); size_t num_edges = TopologyInfo::edges( type ); bool mid_edge, mid_face, mid_vol; TopologyInfo::higher_order( type, elem.node_count(), mid_edge, mid_face, mid_vol, err );MSQ_ERRRTN( err ); // For each edge for( size_t d = 0; d < num_edges; ++d ) { const unsigned* edge = TopologyInfo::edge_vertices( type, d, err );MSQ_ERRRTN( err ); size_t vert1 = elem.get_vertex_index( edge[0] ); size_t vert2 = elem.get_vertex_index( edge[1] ); size_t pmid = ~(size_t)0; if( mid_edge ) { int p = TopologyInfo::higher_order_from_side( type, elem.node_count(), 1, d, err );MSQ_ERRRTN( err ); pmid = elem.get_vertex_index_array()[p]; } // If this edge contains the input vertex (vert_idx) // AND the input vertex index is less than the // other vertex (avoids iterating over this edge twice) // add it to the list. if( vert1 > vert2 ) { if( vert2 == vertIdx ) adjList.push_back( Edge( vert1, pmid ) ); } else { if( vert1 == vertIdx ) adjList.push_back( Edge( vert2, pmid ) ); } } } // Remove duplicates std::sort( adjList.begin(), adjList.end() ); adjIter = std::unique( adjList.begin(), adjList.end() ); adjList.resize( adjIter - adjList.begin() ); adjIter = adjList.begin(); }
bool MBMesquite::EdgeIterator::is_at_end | ( | ) | const [inline] |
Definition at line 79 of file EdgeIterator.hpp.
References MBMesquite::PatchData::num_nodes(), patchPtr, and vertIdx.
Referenced by MBMesquite::MeshUtil::edge_length_distribution(), MBMesquite::MeshWriter::write_eps(), MBMesquite::MeshWriter::write_gnuplot(), and MBMesquite::MeshWriter::write_svg().
const Vector3D * MBMesquite::EdgeIterator::mid | ( | ) | const [inline] |
Definition at line 94 of file EdgeIterator.hpp.
References adjIter, MBMesquite::PatchData::num_nodes(), patchPtr, and MBMesquite::PatchData::vertex_by_index().
Referenced by MBMesquite::MeshWriter::write_eps(), and MBMesquite::MeshWriter::write_gnuplot().
const Vector3D & MBMesquite::EdgeIterator::start | ( | ) | const [inline] |
Definition at line 84 of file EdgeIterator.hpp.
References patchPtr, MBMesquite::PatchData::vertex_by_index(), and vertIdx.
Referenced by MBMesquite::MeshUtil::edge_length_distribution(), MBMesquite::MeshWriter::write_eps(), MBMesquite::MeshWriter::write_gnuplot(), and MBMesquite::MeshWriter::write_svg().
{ return patchPtr->vertex_by_index( vertIdx ); }
void MBMesquite::EdgeIterator::step | ( | MsqError & | err | ) | [inline] |
Definition at line 99 of file EdgeIterator.hpp.
References adjIter, adjList, get_adjacent_vertices(), MSQ_ERRRTN, MBMesquite::PatchData::num_nodes(), patchPtr, and vertIdx.
Referenced by MBMesquite::MeshUtil::edge_length_distribution(), EdgeIterator(), MBMesquite::MeshWriter::write_eps(), MBMesquite::MeshWriter::write_gnuplot(), and MBMesquite::MeshWriter::write_svg().
{ if( adjIter != adjList.end() ) { ++adjIter; } while( adjIter == adjList.end() && ++vertIdx < patchPtr->num_nodes() ) { get_adjacent_vertices( err );MSQ_ERRRTN( err ); } }
std::vector< Edge >::iterator MBMesquite::EdgeIterator::adjIter [private] |
Definition at line 65 of file EdgeIterator.hpp.
Referenced by EdgeIterator(), end(), get_adjacent_vertices(), mid(), and step().
std::vector< Edge > MBMesquite::EdgeIterator::adjList [private] |
Definition at line 64 of file EdgeIterator.hpp.
Referenced by EdgeIterator(), get_adjacent_vertices(), and step().
PatchData* MBMesquite::EdgeIterator::patchPtr [private] |
Definition at line 62 of file EdgeIterator.hpp.
Referenced by EdgeIterator(), end(), get_adjacent_vertices(), is_at_end(), mid(), start(), and step().
size_t MBMesquite::EdgeIterator::vertIdx [private] |
Definition at line 63 of file EdgeIterator.hpp.
Referenced by get_adjacent_vertices(), is_at_end(), start(), and step().