22 #ifndef SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_VERTICES_ITERATORS_H_
23 #define SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_VERTICES_ITERATORS_H_
25 #include <boost/iterator/iterator_facade.hpp>
38 template<
typename SkeletonBlockerComplex>
39 class Vertex_iterator :
public boost::iterator_facade< Vertex_iterator <SkeletonBlockerComplex>
40 , typename SkeletonBlockerComplex::Vertex_handle const
41 , boost::forward_traversal_tag
42 , typename SkeletonBlockerComplex::Vertex_handle const> {
43 friend class boost::iterator_core_access;
45 typedef typename SkeletonBlockerComplex::boost_vertex_iterator boost_vertex_iterator;
46 typedef typename SkeletonBlockerComplex::Vertex_handle Vertex_handle;
48 const SkeletonBlockerComplex* complex;
49 std::pair<boost_vertex_iterator, boost_vertex_iterator> vertexIterator;
57 vertexIterator(vertices(complex_->skeleton)) {
58 if (!finished() && !is_active()) {
67 complex(complex_), vertexIterator(vertices(complex_->skeleton)) {
68 vertexIterator.first = vertexIterator.second;
76 Vertex_handle dereference()
const {
77 return (Vertex_handle(*(vertexIterator.first)));
80 bool equal(
const Vertex_iterator& other)
const {
81 return vertexIterator == other.vertexIterator && complex == other.complex;
84 bool operator<(
const Vertex_iterator& other)
const {
85 return dereference() < other.dereference();
89 bool finished()
const {
90 return vertexIterator.first == vertexIterator.second;
93 void goto_next_valid() {
94 ++vertexIterator.first;
95 if (!finished() && !is_active()) {
100 bool is_active()
const {
101 return ((*complex)[Vertex_handle(*vertexIterator.first)]).is_active();
105 template<
typename SkeletonBlockerComplex>
106 class Neighbors_vertices_iterator:
public boost::iterator_facade < Neighbors_vertices_iterator<SkeletonBlockerComplex>
107 , typename SkeletonBlockerComplex::Vertex_handle const
108 , boost::forward_traversal_tag
109 , typename SkeletonBlockerComplex::Vertex_handle const> {
110 friend class boost::iterator_core_access;
112 typedef SkeletonBlockerComplex
Complex;
113 typedef typename Complex::boost_adjacency_iterator boost_adjacency_iterator;
115 typedef typename Complex::Edge_handle Edge_handle;
121 boost_adjacency_iterator current_;
122 boost_adjacency_iterator end_;
128 Neighbors_vertices_iterator() : complex(NULL) { }
130 Neighbors_vertices_iterator(
const Complex* complex_, Vertex_handle v_) :
133 tie(current_, end_) = adjacent_vertices(v.vertex, complex->skeleton);
139 Neighbors_vertices_iterator(
const Complex* complex_, Vertex_handle v_,
int end) :
142 tie(current_, end_) = adjacent_vertices(v.vertex, complex->skeleton);
147 if (current_ != end_)
151 Vertex_handle dereference()
const {
152 return (Vertex_handle(*current_));
155 bool equal(
const Neighbors_vertices_iterator& other)
const {
156 return (complex == other.complex) && (v == other.v) && (current_ == other.current_) && (end_ == other.end_);
170 #endif // SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_VERTICES_ITERATORS_H_
Vertex_iterator(const SkeletonBlockerComplex *complex_, int end)
Definition: Skeleton_blockers_vertices_iterators.h:66
Definition: SkeletonBlockerDS.h:60
Iterator on the vertices of a simplicial complex.
Definition: Skeleton_blockers_vertices_iterators.h:39