33 #ifndef __H__LIB_GRID__POLYCHAIN_UTIL_IMPL__
34 #define __H__LIB_GRID__POLYCHAIN_UTIL_IMPL__
42 template <
class TEdgeIterator>
45 TEdgeIterator edgesEnd,
49 if(edgesBegin == edgesEnd)
54 bool irregular =
false;
56 for(TEdgeIterator iter = edgesBegin; iter != edgesEnd; ++iter)
58 for(
size_t i = 0; i < 2; ++i){
59 Vertex* v = (*iter)->vertex(i);
65 if(cbEdgeIsInPolyChain(*aiter))
70 throw(
UGError(
"cbEdgeIsInPolyChain does not evaluate to true for "
71 "edge between edgesBegin and edgesEnd."));
98 template <
class TEdgeIterator>
99 std::pair<Vertex*, Edge*>
101 TEdgeIterator edgesEnd,
104 if(edgesBegin == edgesEnd)
105 return std::make_pair<Vertex*, Edge*>(NULL, NULL);
109 for(
size_t locInd = 0; locInd < 2; ++locInd){
111 for(TEdgeIterator iter = edgesBegin; iter != edgesEnd; ++iter)
113 Edge* curEdge = *iter;
118 return std::make_pair(curVrt, curEdge);
123 return std::make_pair((*edgesBegin)->vertex(0), *edgesBegin);
126 template <
class TEdgeIter>
128 TEdgeIter edgesBegin, TEdgeIter edgesEnd)
130 polyChainOut.clear();
138 for(TEdgeIter iter = edgesBegin; iter != edgesEnd; ++iter){
146 Edge* actEdge = *edgesBegin;
148 polyChainOut.push_back(actEdge->
vertex(0));
150 polyChainOut.push_back(actEdge->
vertex(1));
153 bool bRunning =
true;
159 eIter != assEdgesEnd; ++eIter)
168 polyChainOut.push_back(cv);
Base-class for edges.
Definition: grid_base_objects.h:397
virtual Vertex * vertex(size_t index) const
Definition: grid_base_objects.h:366
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
EdgeContainer::iterator AssociatedEdgeIterator
used to iterate over associated edges of vertices, faces and volumes
Definition: grid.h:249
void end_marking()
ends a marking sequence. Call this method when you're done with marking.
Definition: grid.cpp:1285
AssociatedEdgeIterator associated_edges_begin(Vertex *vrt)
DO NOT INVOKE! Subject to change.
Definition: grid.cpp:882
bool is_marked(GridObject *obj) const
returns true if the object is marked, false if not.
Definition: grid_impl.hpp:843
AssociatedEdgeIterator associated_edges_end(Vertex *vrt)
DO NOT INVOKE! Subject to change.
Definition: grid.cpp:892
void mark(GridObject *obj)
marks the object. Calls are only valid between calls to Grid::begin_marking and Grid::end_marking.
Definition: grid_impl.hpp:773
void begin_marking()
begin marking.
Definition: grid.cpp:1262
Instances of this class or of derived classes are thrown if errors arise.
Definition: error.h:104
Base-class for all vertex-types.
Definition: grid_base_objects.h:231
size_t GetPolyChainType(Grid &grid, TEdgeIterator edgesBegin, TEdgeIterator edgesEnd, Grid::edge_traits::callback cbEdgeIsInPolyChain)
returns an or combination of constants enumerated in PolyChainTypes.
Definition: polychain_util_impl.hpp:44
std::pair< Vertex *, Edge * > GetFirstSectionOfPolyChain(Grid &grid, TEdgeIterator edgesBegin, TEdgeIterator edgesEnd, Grid::edge_traits::callback cbEdgeIsInPolyChain)
Returns the start-vertex and start-edge of a polygonal chain.
Definition: polychain_util_impl.hpp:100
bool CreatePolyChain(std::vector< Vertex * > &polyChainOut, Grid &grid, TEdgeIter edgesBegin, TEdgeIter edgesEnd)
given a list of edges, this method collects associated vertices in a polychain
Definition: polychain_util_impl.hpp:127
@ PCT_OPEN
Definition: polychain_util.h:53
@ PCT_EMPTY
Definition: polychain_util.h:56
@ PCT_SEPARATED
Definition: polychain_util.h:54
@ PCT_CLOSED
Definition: polychain_util.h:52
@ PCT_IRREGULAR
Definition: polychain_util.h:55
@ PCT_UNKNOWN
Definition: polychain_util.h:51
bool IsBoundaryVertex1D(Grid &grid, Vertex *v, Grid::edge_traits::callback cbConsiderEdge)
returns whether a vertex lies on the boundary of a polygonal chain.
Definition: vertex_util.cpp:504
Vertex * GetConnectedVertex(Edge *e, Vertex *v)
returns the vertex that is connected to v via e.
Definition: vertex_util.cpp:78
boost::function< bool(base_object *)> callback
callback type for the elements base type.
Definition: grid.h:150