11 #ifndef SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_VERTICES_ITERATORS_H_
12 #define SKELETON_BLOCKER_ITERATORS_SKELETON_BLOCKERS_VERTICES_ITERATORS_H_
14 #include <boost/iterator/iterator_facade.hpp>
20 namespace skeleton_blocker {
27 template<
typename SkeletonBlockerComplex>
28 class Vertex_iterator :
public boost::iterator_facade< Vertex_iterator <SkeletonBlockerComplex>
29 , typename SkeletonBlockerComplex::Vertex_handle const
30 , boost::forward_traversal_tag
31 , typename SkeletonBlockerComplex::Vertex_handle const> {
32 friend class boost::iterator_core_access;
34 typedef typename SkeletonBlockerComplex::boost_vertex_iterator boost_vertex_iterator;
35 typedef typename SkeletonBlockerComplex::Vertex_handle Vertex_handle;
37 const SkeletonBlockerComplex* complex;
38 std::pair<boost_vertex_iterator, boost_vertex_iterator> vertexIterator;
46 vertexIterator(vertices(complex_->skeleton)) {
47 if (!finished() && !is_active()) {
56 complex(complex_), vertexIterator(vertices(complex_->skeleton)) {
57 vertexIterator.first = vertexIterator.second;
69 bool equal(
const Vertex_iterator& other)
const {
70 return vertexIterator == other.vertexIterator && complex == other.complex;
73 bool operator<(
const Vertex_iterator& other)
const {
74 return dereference() < other.dereference();
78 bool finished()
const {
79 return vertexIterator.first == vertexIterator.second;
82 void goto_next_valid() {
83 ++vertexIterator.first;
84 if (!finished() && !is_active()) {
89 bool is_active()
const {
90 return ((*complex)[
Vertex_handle(*vertexIterator.first)]).is_active();
94 template<
typename SkeletonBlockerComplex>
95 class Neighbors_vertices_iterator :
public boost::iterator_facade < Neighbors_vertices_iterator<SkeletonBlockerComplex>
96 , typename SkeletonBlockerComplex::Vertex_handle const
97 , boost::forward_traversal_tag
98 , typename SkeletonBlockerComplex::Vertex_handle const> {
99 friend class boost::iterator_core_access;
101 typedef SkeletonBlockerComplex
Complex;
102 typedef typename Complex::boost_adjacency_iterator boost_adjacency_iterator;
104 typedef typename Complex::Edge_handle Edge_handle;
110 boost_adjacency_iterator current_;
111 boost_adjacency_iterator end_;
114 Neighbors_vertices_iterator() : complex(NULL) { }
119 tie(current_, end_) = adjacent_vertices(v.vertex, complex->skeleton);
128 tie(current_, end_) = adjacent_vertices(v.vertex, complex->skeleton);
133 if (current_ != end_)
141 bool equal(
const Neighbors_vertices_iterator& other)
const {
142 return (complex == other.complex) && (v == other.v) && (current_ == other.current_) && (end_ == other.end_);
154 namespace skbl = skeleton_blocker;
Class that represents a geometric complex that can be simplified. The class allows access to points o...
Definition: Skeleton_blocker_geometric_complex.h:29
Iterator on the vertices of a simplicial complex.
Definition: Skeleton_blockers_vertices_iterators.h:31
Vertex_iterator(const SkeletonBlockerComplex *complex_, int end)
Definition: Skeleton_blockers_vertices_iterators.h:55
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14
Definition: SkeletonBlockerDS.h:56
Handle type for the vertices of a cell complex.
Definition: VertexHandle.h:15