summaryrefslogtreecommitdiff
path: root/src/Skeleton_blocker/include/gudhi/Skeleton_blocker
diff options
context:
space:
mode:
Diffstat (limited to 'src/Skeleton_blocker/include/gudhi/Skeleton_blocker')
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_complex_visitor.h10
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_link_superior.h6
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_off_io.h8
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simplex.h4
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h24
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/internal/Trie.h34
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_blockers_iterators.h4
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_simplices_iterators.h109
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_triangles_iterators.h18
9 files changed, 152 insertions, 65 deletions
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_complex_visitor.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_complex_visitor.h
index 72bdf4c9..4ade68e7 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_complex_visitor.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_complex_visitor.h
@@ -41,7 +41,7 @@ class Skeleton_blocker_complex_visitor {
virtual void on_add_vertex(Vertex_handle) = 0;
virtual void on_remove_vertex(Vertex_handle) = 0;
- virtual void on_add_edge(Vertex_handle a, Vertex_handle b) = 0;
+ virtual void on_add_edge_without_blockers(Vertex_handle a, Vertex_handle b) = 0;
virtual void on_remove_edge(Vertex_handle a, Vertex_handle b) = 0;
/**
@@ -54,7 +54,7 @@ class Skeleton_blocker_complex_visitor {
* @brief Called when performing an edge contraction when
* an edge bx is replaced by an edge ax (not already present).
* Precisely, this methods is called this way in contract_edge :
- * add_edge(a,x)
+ * add_edge_without_blockers(a,x)
* on_swaped_edge(a,b,x)
* remove_edge(b,x)
*/
@@ -79,7 +79,7 @@ class Dummy_complex_visitor : public Skeleton_blocker_complex_visitor<
}
void on_remove_vertex(Vertex_handle) {
}
- void on_add_edge(Vertex_handle a, Vertex_handle b) {
+ void on_add_edge_without_blockers(Vertex_handle a, Vertex_handle b) {
}
void on_remove_edge(Vertex_handle a, Vertex_handle b) {
}
@@ -108,8 +108,8 @@ class Print_complex_visitor : public Skeleton_blocker_complex_visitor<
void on_remove_vertex(Vertex_handle v) {
std::cerr << "on_remove_vertex:" << v << std::endl;
}
- void on_add_edge(Vertex_handle a, Vertex_handle b) {
- std::cerr << "on_add_edge:" << a << "," << b << std::endl;
+ void on_add_edge_without_blockers(Vertex_handle a, Vertex_handle b) {
+ std::cerr << "on_add_edge_without_blockers:" << a << "," << b << std::endl;
}
void on_remove_edge(Vertex_handle a, Vertex_handle b) {
std::cerr << "on_remove_edge:" << a << "," << b << std::endl;
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_link_superior.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_link_superior.h
index d39fa9f3..876bdba9 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_link_superior.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_link_superior.h
@@ -44,13 +44,13 @@ class Skeleton_blocker_link_superior : public Skeleton_blocker_link_complex<
public:
typedef typename ComplexType::Vertex_handle Vertex_handle;
typedef typename ComplexType::Root_vertex_handle Root_vertex_handle;
- typedef typename ComplexType::Simplex_handle Simplex_handle;
+ typedef typename ComplexType::Simplex Simplex;
typedef typename ComplexType::Root_simplex_handle Root_simplex_handle;
typedef typename ComplexType::BlockerMap BlockerMap;
typedef typename ComplexType::BlockerPair BlockerPair;
typedef typename ComplexType::BlockerMapIterator BlockerMapIterator;
typedef typename ComplexType::BlockerMapConstIterator BlockerMapConstIterator;
- typedef typename ComplexType::Simplex_handle::Simplex_vertex_const_iterator AddressSimplexConstIterator;
+ typedef typename ComplexType::Simplex::Simplex_vertex_const_iterator AddressSimplexConstIterator;
typedef typename ComplexType::Root_simplex_handle::Simplex_vertex_const_iterator IdSimplexConstIterator;
Skeleton_blocker_link_superior()
@@ -58,7 +58,7 @@ class Skeleton_blocker_link_superior : public Skeleton_blocker_link_complex<
}
Skeleton_blocker_link_superior(const ComplexType & parent_complex,
- Simplex_handle& alpha_parent_adress)
+ Simplex& alpha_parent_adress)
: Skeleton_blocker_link_complex<ComplexType>(parent_complex,
alpha_parent_adress, true) {
}
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_off_io.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_off_io.h
index ec000986..ad2d2f85 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_off_io.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_off_io.h
@@ -61,7 +61,7 @@ class Skeleton_blocker_off_flag_visitor_reader {
if (!load_only_points_) {
for (size_t i = 0; i < face.size(); ++i)
for (size_t j = i + 1; j < face.size(); ++j) {
- complex_.add_edge(Vertex_handle(face[i]), Vertex_handle(face[j]));
+ complex_.add_edge_without_blockers(Vertex_handle(face[i]), Vertex_handle(face[j]));
}
}
}
@@ -76,12 +76,12 @@ template<typename Complex>
class Skeleton_blocker_off_visitor_reader {
Complex& complex_;
typedef typename Complex::Vertex_handle Vertex_handle;
- typedef typename Complex::Simplex_handle Simplex_handle;
+ typedef typename Complex::Simplex Simplex;
typedef typename Complex::Point Point;
const bool load_only_points_;
std::vector<Point> points_;
- std::vector<Simplex_handle> maximal_faces_;
+ std::vector<Simplex> maximal_faces_;
public:
explicit Skeleton_blocker_off_visitor_reader(Complex& complex, bool load_only_points = false) :
@@ -99,7 +99,7 @@ class Skeleton_blocker_off_visitor_reader {
void maximal_face(const std::vector<int>& face) {
if (!load_only_points_) {
- Simplex_handle s;
+ Simplex s;
for (auto x : face)
s.add_vertex(Vertex_handle(x));
maximal_faces_.emplace_back(s);
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simplex.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simplex.h
index 0d838d50..714bf23c 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simplex.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_simplex.h
@@ -218,7 +218,7 @@ class Skeleton_blocker_simplex {
}
/**
- * Returns the first vertex of the (oriented) simplex.
+ * Returns the first and smallest vertex of the simplex.
*
* Be careful : assumes the simplex is non-empty.
*/
@@ -228,7 +228,7 @@ class Skeleton_blocker_simplex {
}
/**
- * Returns the last vertex of the (oriented) simplex.
+ * Returns the last and greatest vertex of the simplex.
*
* Be careful : assumes the simplex is non-empty.
*/
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h
index 1b1fe3f0..0dd5dd54 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/Skeleton_blocker_sub_complex.h
@@ -66,12 +66,12 @@ class Skeleton_blocker_sub_complex : public ComplexType {
public:
using ComplexType::add_vertex;
- using ComplexType::add_edge;
+ using ComplexType::add_edge_without_blockers;
using ComplexType::add_blocker;
typedef typename ComplexType::Vertex_handle Vertex_handle;
typedef typename ComplexType::Root_vertex_handle Root_vertex_handle;
- typedef typename ComplexType::Simplex_handle Simplex_handle;
+ typedef typename ComplexType::Simplex Simplex;
typedef typename ComplexType::Root_simplex_handle Root_simplex_handle;
protected:
@@ -109,11 +109,11 @@ class Skeleton_blocker_sub_complex : public ComplexType {
* It assumes that both vertices corresponding to v1_root and v2_root are present
* in the sub-complex.
*/
- void add_edge(Root_vertex_handle v1_root, Root_vertex_handle v2_root) {
+ void add_edge_without_blockers(Root_vertex_handle v1_root, Root_vertex_handle v2_root) {
auto v1_sub(this->get_address(v1_root));
auto v2_sub(this->get_address(v2_root));
assert(v1_sub && v2_sub);
- this->ComplexType::add_edge(*v1_sub, *v2_sub);
+ this->ComplexType::add_edge_without_blockers(*v1_sub, *v2_sub);
}
/**
@@ -124,7 +124,7 @@ class Skeleton_blocker_sub_complex : public ComplexType {
void add_blocker(const Root_simplex_handle& blocker_root) {
auto blocker_sub = this->get_address(blocker_root);
assert(blocker_sub);
- this->add_blocker(new Simplex_handle(*blocker_sub));
+ this->add_blocker(new Simplex(*blocker_sub));
}
public:
@@ -133,7 +133,7 @@ class Skeleton_blocker_sub_complex : public ComplexType {
* vertices of 'simplex'.
*/
void make_restricted_complex(const ComplexType & parent_complex,
- const Simplex_handle& simplex) {
+ const Simplex& simplex) {
this->clear();
// add vertices to the sub complex
for (auto x : simplex) {
@@ -145,11 +145,11 @@ class Skeleton_blocker_sub_complex : public ComplexType {
// add edges to the sub complex
for (auto x : simplex) {
// x_neigh is the neighbor of x intersected with vertices_simplex
- Simplex_handle x_neigh;
+ Simplex x_neigh;
parent_complex.add_neighbours(x, x_neigh, true);
x_neigh.intersection(simplex);
for (auto y : x_neigh) {
- this->add_edge(parent_complex[x].get_id(), parent_complex[y].get_id());
+ this->add_edge_without_blockers(parent_complex[x].get_id(), parent_complex[y].get_id());
}
}
@@ -158,9 +158,9 @@ class Skeleton_blocker_sub_complex : public ComplexType {
// check if it is the first time we encounter the blocker
if (simplex.contains(*blocker)) {
Root_simplex_handle blocker_root(parent_complex.get_id(*(blocker)));
- Simplex_handle blocker_restr(
+ Simplex blocker_restr(
*(this->get_simplex_address(blocker_root)));
- this->add_blocker(new Simplex_handle(blocker_restr));
+ this->add_blocker(new Simplex(blocker_restr));
}
}
}
@@ -188,7 +188,7 @@ class Skeleton_blocker_sub_complex : public ComplexType {
// * Allocates a simplex in L corresponding to the simplex s in K
// * with its local adresses and returns an AddressSimplex.
// */
- // boost::optional<Simplex_handle> get_address(const Root_simplex_handle & s) const;
+ // boost::optional<Simplex> get_address(const Root_simplex_handle & s) const;
// private:
/**
@@ -220,7 +220,7 @@ bool proper_face_in_union(
// we test that all vertices of 'addresses_sigma_in_link' but 'vertex_to_be_ignored'
// are in link1 if it is the case we construct the corresponding simplex
bool vertices_sigma_are_in_link = true;
- typename ComplexType::Simplex_handle sigma_in_link;
+ typename ComplexType::Simplex sigma_in_link;
for (int i = 0; i < addresses_sigma_in_link.size(); ++i) {
if (i != vertex_to_be_ignored) {
if (!addresses_sigma_in_link[i]) {
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/internal/Trie.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/internal/Trie.h
index aa0416ef..499980c4 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/internal/Trie.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/internal/Trie.h
@@ -36,7 +36,7 @@ namespace skbl {
template<typename SimplexHandle>
struct Trie {
- typedef SimplexHandle Simplex_handle;
+ typedef SimplexHandle Simplex;
typedef typename SimplexHandle::Vertex_handle Vertex_handle;
Vertex_handle v;
@@ -64,7 +64,7 @@ struct Trie {
}
}
- typedef typename Simplex_handle::Simplex_vertex_const_iterator Simplex_vertex_const_iterator;
+ typedef typename Simplex::Simplex_vertex_const_iterator Simplex_vertex_const_iterator;
Trie* make_trie(Simplex_vertex_const_iterator s_it, Simplex_vertex_const_iterator s_end) {
if (s_it == s_end) {
@@ -97,7 +97,7 @@ struct Trie {
return;
}
- void maximal_faces_helper(std::vector<Simplex_handle>& res) const {
+ void maximal_faces_helper(std::vector<Simplex>& res) const {
if (is_leaf()) res.push_back(simplex());
else
for (auto child : childs)
@@ -108,14 +108,14 @@ struct Trie {
/**
* adds the simplex to the trie
*/
- void add_simplex(const Simplex_handle& s) {
+ void add_simplex(const Simplex& s) {
if (s.empty()) return;
assert(v == s.first_vertex());
add_simplex_helper(s.begin(), s.end());
}
- std::vector<Simplex_handle> maximal_faces() const {
- std::vector<Simplex_handle> res;
+ std::vector<Simplex> maximal_faces() const {
+ std::vector<Simplex> res;
maximal_faces_helper(res);
return res;
}
@@ -123,14 +123,14 @@ struct Trie {
/**
* Goes to the root in the trie to consitute simplex
*/
- void add_vertices_up_to_the_root(Simplex_handle& res) const {
+ void add_vertices_up_to_the_root(Simplex& res) const {
res.add_vertex(v);
if (parent_)
parent_->add_vertices_up_to_the_root(res);
}
- Simplex_handle simplex() const {
- Simplex_handle res;
+ Simplex simplex() const {
+ Simplex res;
add_vertices_up_to_the_root(res);
return res;
}
@@ -156,7 +156,7 @@ struct Trie {
/**
* true iff the simplex corresponds to one node in the trie
*/
- bool contains(const Simplex_handle& s) const {
+ bool contains(const Simplex& s) const {
Trie const* current = this;
if (s.empty()) return true;
if (current->v != s.first_vertex()) return false;
@@ -196,9 +196,9 @@ struct Trie {
template<typename SimplexHandle>
struct Tries {
typedef typename SimplexHandle::Vertex_handle Vertex_handle;
- typedef SimplexHandle Simplex_handle;
+ typedef SimplexHandle Simplex;
- typedef Trie<Simplex_handle> STrie;
+ typedef Trie<Simplex> STrie;
template<typename SimpleHandleOutputIterator>
Tries(unsigned num_vertices, SimpleHandleOutputIterator simplex_begin, SimpleHandleOutputIterator simplex_end) :
@@ -218,14 +218,14 @@ struct Tries {
// return a simplex that consists in all u such uv is an edge and u>v
- Simplex_handle positive_neighbors(Vertex_handle v) const {
- Simplex_handle res;
+ Simplex positive_neighbors(Vertex_handle v) const {
+ Simplex res;
for (auto child : cofaces_[v]->childs)
res.add_vertex(child->v);
return res;
}
- bool contains(const Simplex_handle& s) const {
+ bool contains(const Simplex& s) const {
auto first_v = s.first_vertex();
return cofaces_[first_v]->contains(s);
}
@@ -238,8 +238,8 @@ struct Tries {
// init_next_dimension must be called first
- std::vector<Simplex_handle> next_dimension_simplices() const {
- std::vector<Simplex_handle> res;
+ std::vector<Simplex> next_dimension_simplices() const {
+ std::vector<Simplex> res;
while (!to_see_.empty() && to_see_.front()->simplex().dimension() == current_dimension_) {
res.emplace_back(to_see_.front()->simplex());
for (auto child : to_see_.front()->childs)
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_blockers_iterators.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_blockers_iterators.h
index 56a20a24..4a437ac6 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_blockers_iterators.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_blockers_iterators.h
@@ -31,7 +31,7 @@ namespace skbl {
/**
* @brief Iterator through the blockers of a vertex.
*/
-// ReturnType = const Simplex_handle* or Simplex_handle*
+// ReturnType = const Simplex* or Simplex*
// MapIteratorType = BlockerMapConstIterator or BlockerMapIterator
template<typename MapIteratorType, typename ReturnType>
@@ -83,7 +83,7 @@ ReturnType
/**
* @brief Iterator through the blockers of a vertex
*/
-// ReturnType = const Simplex_handle* or Simplex_handle*
+// ReturnType = const Simplex* or Simplex*
// MapIteratorType = BlockerMapConstIterator or BlockerMapIterator
template<typename MapIteratorType, typename ReturnType>
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_simplices_iterators.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_simplices_iterators.h
index 27411fc1..b8d99201 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_simplices_iterators.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_simplices_iterators.h
@@ -48,20 +48,20 @@ namespace skbl {
template<typename SkeletonBlockerComplex, typename Link>
class Simplex_around_vertex_iterator :
public boost::iterator_facade < Simplex_around_vertex_iterator<SkeletonBlockerComplex, Link>
-, typename SkeletonBlockerComplex::Simplex_handle
+, typename SkeletonBlockerComplex::Simplex
, boost::forward_traversal_tag
-, typename SkeletonBlockerComplex::Simplex_handle
+, typename SkeletonBlockerComplex::Simplex
> {
friend class boost::iterator_core_access;
typedef SkeletonBlockerComplex Complex;
typedef typename Complex::Vertex_handle Vertex_handle;
typedef typename Complex::Edge_handle Edge_handle;
- typedef typename Complex::Simplex_handle Simplex_handle;
+ typedef typename Complex::Simplex Simplex;
// Link_vertex_handle == Complex_Vertex_handle but this renaming helps avoiding confusion
typedef typename Link::Vertex_handle Link_vertex_handle;
- typedef typename Gudhi::skbl::Trie<Simplex_handle> Trie;
+ typedef typename Gudhi::skbl::Trie<Simplex> Trie;
private:
const Complex* complex;
@@ -120,7 +120,7 @@ public boost::iterator_facade < Simplex_around_vertex_iterator<SkeletonBlockerCo
Trie* res = new Trie(parent_vertex(link_vh), parent);
for (Link_vertex_handle nv : link_v->vertex_range(link_vh)) {
if (link_vh < nv) {
- Simplex_handle simplex_node_plus_nv(res->simplex());
+ Simplex simplex_node_plus_nv(res->simplex());
simplex_node_plus_nv.add_vertex(parent_vertex(nv));
if (complex->contains(simplex_node_plus_nv)) {
res->add_child(build_trie(nv, res));
@@ -176,13 +176,13 @@ public boost::iterator_facade < Simplex_around_vertex_iterator<SkeletonBlockerCo
}
}
- Simplex_handle dereference() const {
+ Simplex dereference() const {
assert(!nodes_to_be_seen.empty());
Trie* first_node = nodes_to_be_seen.front();
return first_node->simplex();
}
- Simplex_handle get_trie_address() const {
+ Simplex get_trie_address() const {
assert(!nodes_to_be_seen.empty());
return nodes_to_be_seen.front();
}
@@ -200,9 +200,9 @@ public boost::iterator_facade < Simplex_around_vertex_iterator<SkeletonBlockerCo
template<typename SkeletonBlockerComplex>
class Simplex_iterator :
public boost::iterator_facade < Simplex_iterator<SkeletonBlockerComplex>
-, typename SkeletonBlockerComplex::Simplex_handle
+, typename SkeletonBlockerComplex::Simplex
, boost::forward_traversal_tag
-, typename SkeletonBlockerComplex::Simplex_handle
+, typename SkeletonBlockerComplex::Simplex
> {
typedef Skeleton_blocker_link_superior<SkeletonBlockerComplex> Link;
@@ -213,7 +213,7 @@ public boost::iterator_facade < Simplex_iterator<SkeletonBlockerComplex>
typedef SkeletonBlockerComplex Complex;
typedef typename Complex::Vertex_handle Vertex_handle;
typedef typename Complex::Edge_handle Edge_handle;
- typedef typename Complex::Simplex_handle Simplex_handle;
+ typedef typename Complex::Simplex Simplex;
typedef typename Complex::Complex_vertex_iterator Complex_vertex_iterator;
typedef typename Link::Vertex_handle Link_vertex_handle;
@@ -290,7 +290,7 @@ public boost::iterator_facade < Simplex_iterator<SkeletonBlockerComplex>
}
}
- Simplex_handle dereference() const {
+ Simplex dereference() const {
return current_simplex_around_current_vertex_.dereference();
}
@@ -304,6 +304,93 @@ public boost::iterator_facade < Simplex_iterator<SkeletonBlockerComplex>
}
};
+/**
+ * Iterator through the maximal faces of the coboundary of a simplex.
+ */
+template<typename SkeletonBlockerComplex, typename Link>
+class Simplex_coboundary_iterator :
+public boost::iterator_facade < Simplex_coboundary_iterator<SkeletonBlockerComplex, Link>
+, typename SkeletonBlockerComplex::Simplex, boost::forward_traversal_tag, typename SkeletonBlockerComplex::Simplex> {
+ friend class boost::iterator_core_access;
+ typedef SkeletonBlockerComplex Complex;
+ typedef typename Complex::Vertex_handle Vertex_handle;
+ typedef typename Complex::Edge_handle Edge_handle;
+ typedef typename Complex::Simplex Simplex;
+ typedef typename Complex::Complex_vertex_iterator Complex_vertex_iterator;
+
+ // Link_vertex_handle == Complex_Vertex_handle but this renaming helps avoiding confusion
+ typedef typename Link::Vertex_handle Link_vertex_handle;
+
+ private:
+ const Complex* complex;
+ const Simplex& sigma;
+ std::shared_ptr<Link> link;
+ Complex_vertex_iterator current_vertex;
+ Complex_vertex_iterator link_vertex_end;
+
+ public:
+ Simplex_coboundary_iterator() : complex(0) {}
+
+ Simplex_coboundary_iterator(const Complex* complex_, const Simplex& sigma_) :
+ complex(complex_),
+ sigma(sigma_),
+ //need only vertices of the link hence the true flag
+ link(new Link(*complex_, sigma_, false, true)) {
+ auto link_vertex_range = link->vertex_range();
+ current_vertex = link_vertex_range.begin();
+ link_vertex_end = link_vertex_range.end();
+ }
+
+ Simplex_coboundary_iterator(const Simplex_coboundary_iterator& other) :
+ complex(other.complex),
+ sigma(other.sigma),
+ link(other.link),
+ current_vertex(other.current_vertex),
+ link_vertex_end(other.link_vertex_end) { }
+
+ // returns an iterator to the end
+ Simplex_coboundary_iterator(const Complex* complex_,const Simplex& sigma_, bool end) :
+ complex(complex_),
+ sigma(sigma_) {
+ // to represent an end iterator without having to build a useless link, we use
+ // the convection that link is not initialized.
+ }
+
+ private:
+ Vertex_handle parent_vertex(Link_vertex_handle link_vh) const {
+ return complex->convert_handle_from_another_complex(*link, link_vh);
+ }
+
+public:
+ friend std::ostream& operator<<(std::ostream& stream, const Simplex_coboundary_iterator& sci) {
+ return stream;
+ }
+
+ // assume that iterator points to the same complex and comes from the same simplex
+ bool equal(const Simplex_coboundary_iterator& other) const {
+ assert(complex == other.complex && sigma == other.sigma);
+ if(is_end()) return other.is_end();
+ if(other.is_end()) return is_end();
+ return *current_vertex == *(other.current_vertex);
+ }
+
+ void increment() {
+ ++current_vertex;
+ }
+
+ Simplex dereference() const {
+ Simplex res(sigma);
+ res.add_vertex(parent_vertex(*current_vertex));
+ return res;
+ }
+
+private:
+ bool is_end() const {
+ return !link || current_vertex == link_vertex_end;
+ }
+};
+
+
} // namespace skbl
} // namespace Gudhi
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_triangles_iterators.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_triangles_iterators.h
index 28f5805d..116023d7 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_triangles_iterators.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker/iterators/Skeleton_blockers_triangles_iterators.h
@@ -37,15 +37,15 @@ namespace skbl {
template<typename Complex, typename LinkType>
class Triangle_around_vertex_iterator : public boost::iterator_facade
< Triangle_around_vertex_iterator <Complex, LinkType>
-, typename Complex::Simplex_handle const
+, typename Complex::Simplex const
, boost::forward_traversal_tag
-, typename Complex::Simplex_handle const> {
+, typename Complex::Simplex const> {
friend class boost::iterator_core_access;
template<typename T> friend class Triangle_iterator;
private:
typedef typename LinkType::Vertex_handle Vertex_handle;
typedef typename LinkType::Root_vertex_handle Root_vertex_handle;
- typedef typename LinkType::Simplex_handle Simplex_handle;
+ typedef typename LinkType::Simplex Simplex;
typedef typename Complex::Complex_edge_iterator Complex_edge_iterator_;
const Complex* complex_;
@@ -87,10 +87,10 @@ class Triangle_around_vertex_iterator : public boost::iterator_facade
return (complex_ == other.complex_) && ((finished() && other.finished()) || current_edge_ == other.current_edge_);
}
- Simplex_handle dereference() const {
+ Simplex dereference() const {
Root_vertex_handle v1 = (*link_)[*current_edge_].first();
Root_vertex_handle v2 = (*link_)[*current_edge_].second();
- return Simplex_handle(v_, *(complex_->get_address(v1)), *(complex_->get_address(v2)));
+ return Simplex(v_, *(complex_->get_address(v1)), *(complex_->get_address(v2)));
}
void increment() {
@@ -112,14 +112,14 @@ class Triangle_around_vertex_iterator : public boost::iterator_facade
template<typename SkeletonBlockerComplex>
class Triangle_iterator : public boost::iterator_facade<
Triangle_iterator <SkeletonBlockerComplex>,
-typename SkeletonBlockerComplex::Simplex_handle const
+typename SkeletonBlockerComplex::Simplex const
, boost::forward_traversal_tag
-, typename SkeletonBlockerComplex::Simplex_handle const> {
+, typename SkeletonBlockerComplex::Simplex const> {
friend class boost::iterator_core_access;
private:
typedef typename SkeletonBlockerComplex::Vertex_handle Vertex_handle;
typedef typename SkeletonBlockerComplex::Root_vertex_handle Root_vertex_handle;
- typedef typename SkeletonBlockerComplex::Simplex_handle Simplex_handle;
+ typedef typename SkeletonBlockerComplex::Simplex Simplex;
typedef typename SkeletonBlockerComplex::Superior_triangle_around_vertex_iterator STAVI;
typedef typename SkeletonBlockerComplex::Complex_vertex_iterator Complex_vertex_iterator;
@@ -175,7 +175,7 @@ typename SkeletonBlockerComplex::Simplex_handle const
current_vertex_ == other.current_vertex_ && current_triangle_ == other.current_triangle_));
}
- Simplex_handle dereference() const {
+ Simplex dereference() const {
return *current_triangle_;
}