From 5ea1f5a9e96a3c937531516176cabc7226bed9da Mon Sep 17 00:00:00 2001 From: glisse Date: Tue, 6 Oct 2015 15:31:40 +0000 Subject: Introduce Options::contiguous_vertices. For now only used and checked in find_vertex. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/contiguous_vertices@833 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: ceee8ba85eb21991a836b8f1d1117bcaafeb8c1b --- src/Simplex_tree/include/gudhi/Simplex_tree.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/Simplex_tree/include') diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 96565ff1..d19071fb 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -85,6 +85,7 @@ struct Simplex_tree_options_full_featured { typedef int Simplex_key; static const bool store_key = true; static const bool store_filtration = true; + static const bool contiguous_vertices = true; }; /** @@ -564,9 +565,21 @@ class Simplex_tree { /** \brief Returns the Simplex_handle corresponding to the 0-simplex * representing the vertex with Vertex_handle v. */ Simplex_handle find_vertex(Vertex_handle v) { - return root_.members_.begin() + v; + if (Options::contiguous_vertices) { + assert(contiguous_vertices()); + return root_.members_.begin() + v; + } else { + return root_.members_.find(v); + } + } + + /** \private \brief Test if the vertices have contiguous numbering: 0, 1, etc. */ + bool contiguous_vertices() const { + if(root_.members_.empty()) return true; + if(root_.members_.front()!=0) return false; + if(root_.members_.back()!=root_.members_.size()-1) return false; + return true; } - //{ return root_.members_.find(v); } private: /** \brief Inserts a simplex represented by a vector of vertex. -- cgit v1.2.3 From 82424630adfec94295157491a3379bc7888d5f12 Mon Sep 17 00:00:00 2001 From: glisse Date: Thu, 8 Oct 2015 12:28:13 +0000 Subject: Fix contiguous_vertices(). Use it in boundary iterator. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/contiguous_vertices@838 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 5b4475f39fe6adf2190223a753625057260e8805 --- src/Simplex_tree/include/gudhi/Simplex_tree.h | 5 +++-- .../include/gudhi/Simplex_tree/Simplex_tree_iterators.h | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src/Simplex_tree/include') diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index d19071fb..30faebc8 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -573,11 +573,12 @@ class Simplex_tree { } } + public: /** \private \brief Test if the vertices have contiguous numbering: 0, 1, etc. */ bool contiguous_vertices() const { if(root_.members_.empty()) return true; - if(root_.members_.front()!=0) return false; - if(root_.members_.back()!=root_.members_.size()-1) return false; + if(root_.members_.begin()->first!=0) return false; + if(std::prev(root_.members_.end())->first!=root_.members_.size()-1) return false; return true; } diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h index f83f5ea8..856fdbdd 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h @@ -135,14 +135,27 @@ class Simplex_tree_boundary_simplex_iterator : public boost::iterator_facade< } Siblings * for_sib = sib_; - for (auto rit = suffix_.rbegin(); rit != suffix_.rend(); ++rit) { + Siblings * new_sib = sib_->oncles(); + auto rit = suffix_.rbegin(); + if (SimplexTree::Options::contiguous_vertices + && new_sib == nullptr + && rit != suffix_.rend()) { + // We reached the root, use a short-cut to find a vertex. We could also + // optimize finding the second vertex of a segment, but people are + // expected to call endpoints(). + assert(st_->contiguous_vertices()); + sh_ = for_sib->members_.begin()+*rit; + for_sib = sh_->second.children(); + ++rit; + } + for (; rit != suffix_.rend(); ++rit) { sh_ = for_sib->find(*rit); for_sib = sh_->second.children(); } sh_ = for_sib->find(last_); // sh_ points to the right simplex now suffix_.push_back(next_); next_ = sib_->parent(); - sib_ = sib_->oncles(); + sib_ = new_sib; } // Most of the storage should be moved to the range, iterators should be light. -- cgit v1.2.3 From 52dbe195ea62ca333c7e6834d9b92e4d9e5557ea Mon Sep 17 00:00:00 2001 From: glisse Date: Fri, 16 Oct 2015 15:25:35 +0000 Subject: Sort in parallel in initialize_filtration using TBB. No build machinery support for now. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/tbb@858 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 94071e9da20993dff60743ac75125f26ad62e55e --- src/Simplex_tree/include/gudhi/Simplex_tree.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/Simplex_tree/include') diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 4c6a95e8..edb1d7c9 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -35,6 +35,10 @@ #include #include +#ifdef GUDHI_USE_TBB +#include +#endif + #include #include #include @@ -788,8 +792,12 @@ class Simplex_tree { * heuristic consists in inserting the cofaces of a simplex as soon as * possible. */ +#ifdef GUDHI_USE_TBB + tbb::parallel_sort(filtration_vect_, is_before_in_filtration(this)); +#else std::stable_sort(filtration_vect_.begin(), filtration_vect_.end(), is_before_in_filtration(this)); +#endif } private: -- cgit v1.2.3 From b6c3298ce211935f65cc174cc86c0c6a5073035f Mon Sep 17 00:00:00 2001 From: glisse Date: Sat, 17 Oct 2015 18:55:35 +0000 Subject: Simplify operator== for the boundary iterator. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/contiguous_vertices@862 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 48228705e9f310ed842e214c5d8849e8f1e0c670 --- .../include/gudhi/Simplex_tree/Simplex_tree_iterators.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Simplex_tree/include') diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h index f77bac15..c5027f22 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h @@ -99,8 +99,7 @@ class Simplex_tree_boundary_simplex_iterator : public boost::iterator_facade< // any end() iterator explicit Simplex_tree_boundary_simplex_iterator(SimplexTree * st) - : last_(st->null_vertex()), - sib_(NULL) { + : sh_(st->null_simplex()) { } Simplex_tree_boundary_simplex_iterator(SimplexTree * st, Simplex_handle sh) @@ -113,7 +112,7 @@ class Simplex_tree_boundary_simplex_iterator : public boost::iterator_facade< if (sib_ != NULL) { sh_ = sib_->find(next_); } else { - last_ = st->null_vertex(); + sh_ = st->null_simplex(); } // vertex: == end() } @@ -121,16 +120,17 @@ class Simplex_tree_boundary_simplex_iterator : public boost::iterator_facade< friend class boost::iterator_core_access; // valid when iterating along the SAME boundary. bool equal(Simplex_tree_boundary_simplex_iterator const& other) const { - return (sib_ == other.sib_ && last_ == other.last_); + return sh_ == other.sh_; } Simplex_handle const& dereference() const { + assert(sh_ != st_->null_simplex()); return sh_; } void increment() { if (sib_ == NULL) { - last_ = st_->null_vertex(); + sh_ = st_->null_simplex(); return; } -- cgit v1.2.3 From a57e87727ea3cbf73ac8e4ce0fe65a19de1fe2d9 Mon Sep 17 00:00:00 2001 From: glisse Date: Mon, 9 Nov 2015 16:54:45 +0000 Subject: New Simplex_tree_options_fast_persistence, while Simplex_tree_options_full_featured switches to the safe default of allowing non-contiguous vertices. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/contiguous_vertices@896 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 60bc11a90027ed17233903d22a6494198f30eeb1 --- .../example/performance_rips_persistence.cpp | 2 +- .../example/rips_multifield_persistence.cpp | 5 +-- .../example/rips_persistence.cpp | 5 +-- src/Simplex_tree/include/gudhi/Simplex_tree.h | 36 ++++++++++++++++------ src/Simplex_tree/test/simplex_tree_unit_test.cpp | 2 +- 5 files changed, 34 insertions(+), 16 deletions(-) (limited to 'src/Simplex_tree/include') diff --git a/src/Persistent_cohomology/example/performance_rips_persistence.cpp b/src/Persistent_cohomology/example/performance_rips_persistence.cpp index 0e912d57..b0366c6c 100644 --- a/src/Persistent_cohomology/example/performance_rips_persistence.cpp +++ b/src/Persistent_cohomology/example/performance_rips_persistence.cpp @@ -85,7 +85,7 @@ int main(int argc, char * argv[]) { std::cout << "Compute Rips graph in " << enlapsed_sec << " sec.\n"; // Construct the Rips complex in a Simplex Tree - Simplex_tree<> st; + Simplex_tree st; start = std::chrono::system_clock::now(); // insert the proximity graph in the simplex tree diff --git a/src/Persistent_cohomology/example/rips_multifield_persistence.cpp b/src/Persistent_cohomology/example/rips_multifield_persistence.cpp index 5277bf7a..c5cd775d 100644 --- a/src/Persistent_cohomology/example/rips_multifield_persistence.cpp +++ b/src/Persistent_cohomology/example/rips_multifield_persistence.cpp @@ -68,7 +68,8 @@ int main(int argc, char * argv[]) { , euclidean_distance); // Construct the Rips complex in a Simplex Tree - Simplex_tree<> st; + typedef Simplex_tree ST; + ST st; // insert the proximity graph in the simplex tree st.insert_graph(prox_graph); // expand the graph until dimension dim_max @@ -78,7 +79,7 @@ int main(int argc, char * argv[]) { st.initialize_filtration(); // Compute the persistence diagram of the complex - Persistent_cohomology< Simplex_tree<>, Multi_field > pcoh(st); + Persistent_cohomology pcoh(st); // initializes the coefficient field for homology pcoh.init_coefficients(min_p, max_p); // compute persistent homology, disgarding persistent features of life shorter than min_persistence diff --git a/src/Persistent_cohomology/example/rips_persistence.cpp b/src/Persistent_cohomology/example/rips_persistence.cpp index 9b1ef42f..2d926a0d 100644 --- a/src/Persistent_cohomology/example/rips_persistence.cpp +++ b/src/Persistent_cohomology/example/rips_persistence.cpp @@ -65,7 +65,8 @@ int main(int argc, char * argv[]) { , euclidean_distance); // Construct the Rips complex in a Simplex Tree - Simplex_tree<> st; + typedef Simplex_tree ST; + ST st; // insert the proximity graph in the simplex tree st.insert_graph(prox_graph); // expand the graph until dimension dim_max @@ -78,7 +79,7 @@ int main(int argc, char * argv[]) { st.initialize_filtration(); // Compute the persistence diagram of the complex - persistent_cohomology::Persistent_cohomology< Simplex_tree<>, Field_Zp > pcoh(st); + persistent_cohomology::Persistent_cohomology pcoh(st); // initializes the coefficient field for homology pcoh.init_coefficients(p); diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 74ae1713..b9c2a245 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -77,16 +77,7 @@ namespace Gudhi { * @{ */ -/// Model of SimplexTreeOptions. -struct Simplex_tree_options_full_featured { - typedef linear_indexing_tag Indexing_tag; - typedef int Vertex_handle; - typedef double Filtration_value; - typedef int Simplex_key; - static const bool store_key = true; - static const bool store_filtration = true; - static const bool contiguous_vertices = true; -}; +struct Simplex_tree_options_full_featured; /** * \brief Simplex Tree data structure for representing simplicial complexes. @@ -1159,6 +1150,31 @@ std::istream& operator>>(std::istream & is, Simplex_tree & st) { return is; } + +/// Model of SimplexTreeOptions. +struct Simplex_tree_options_full_featured { + typedef linear_indexing_tag Indexing_tag; + typedef int Vertex_handle; + typedef double Filtration_value; + typedef int Simplex_key; + static const bool store_key = true; + static const bool store_filtration = true; + static const bool contiguous_vertices = false; +}; + +/** Model of SimplexTreeOptions, faster than + `Simplex_tree_options_full_featured` but note the unsafe + `contiguous_vertices` option. */ +struct Simplex_tree_options_fast_persistence { + typedef linear_indexing_tag Indexing_tag; + typedef int Vertex_handle; + typedef float Filtration_value; + typedef int Simplex_key; + static const bool store_key = true; + static const bool store_filtration = true; + static const bool contiguous_vertices = true; +}; + /** @} */ // end defgroup simplex_tree } // namespace Gudhi diff --git a/src/Simplex_tree/test/simplex_tree_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_unit_test.cpp index fff00d77..c2e214c0 100644 --- a/src/Simplex_tree/test/simplex_tree_unit_test.cpp +++ b/src/Simplex_tree/test/simplex_tree_unit_test.cpp @@ -509,7 +509,7 @@ BOOST_AUTO_TEST_CASE(NSimplexAndSubfaces_tree_insertion) { // Find in the simplex_tree // ------------------------------------------------------------------------------------------------------------------ typeVectorVertex simpleSimplexVector{1}; - Simplex_tree<>::Simplex_handle simplexFound = st.find(simpleSimplexVector); + typeST::Simplex_handle simplexFound = st.find(simpleSimplexVector); std::cout << "**************IS THE SIMPLEX {1} IN THE SIMPLEX TREE ?\n"; if (simplexFound != st.null_simplex()) std::cout << "***+ YES IT IS!\n"; -- cgit v1.2.3 From d91d9248c66451a765f58b6d03db2124b52c3ae2 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 7 Jan 2016 13:34:00 +0000 Subject: Cppcheck fixes after merge git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@951 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 4b66d24e46b604e2066c4c2e506b147af4be7e6a --- src/Simplex_tree/include/gudhi/Simplex_tree.h | 6 +++--- .../include/gudhi/Simplex_tree/Simplex_tree_iterators.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/Simplex_tree/include') diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 408c0588..50c67185 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -571,9 +571,9 @@ class Simplex_tree { public: /** \private \brief Test if the vertices have contiguous numbering: 0, 1, etc. */ bool contiguous_vertices() const { - if(root_.members_.empty()) return true; - if(root_.members_.begin()->first!=0) return false; - if(std::prev(root_.members_.end())->first!=root_.members_.size()-1) return false; + if (root_.members_.empty()) return true; + if (root_.members_.begin()->first != 0) return false; + if (std::prev(root_.members_.end())->first != root_.members_.size()-1) return false; return true; } diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h index c5027f22..794060ee 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h @@ -99,11 +99,13 @@ class Simplex_tree_boundary_simplex_iterator : public boost::iterator_facade< // any end() iterator explicit Simplex_tree_boundary_simplex_iterator(SimplexTree * st) - : sh_(st->null_simplex()) { + : sib_(NULL), + sh_(st->null_simplex()) { } Simplex_tree_boundary_simplex_iterator(SimplexTree * st, Simplex_handle sh) : suffix_(), + sib_(st->self_siblings(sh)), st_(st) { last_ = sh->first; Siblings * sib = st->self_siblings(sh); @@ -137,9 +139,7 @@ class Simplex_tree_boundary_simplex_iterator : public boost::iterator_facade< Siblings * for_sib = sib_; Siblings * new_sib = sib_->oncles(); auto rit = suffix_.rbegin(); - if (SimplexTree::Options::contiguous_vertices - && new_sib == nullptr - && rit != suffix_.rend()) { + if (SimplexTree::Options::contiguous_vertices && new_sib == nullptr && rit != suffix_.rend()) { // We reached the root, use a short-cut to find a vertex. We could also // optimize finding the second vertex of a segment, but people are // expected to call endpoints(). -- cgit v1.2.3 From 9aa92aa2b504d9530125a6a164f76c11f45d8bb5 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 8 Jan 2016 15:03:16 +0000 Subject: cpplint and cppcheck fixes git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@956 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: f54c0a2a375e8818c7162aec05249e446361834b --- src/Hasse_complex/include/gudhi/Hasse_complex.h | 10 ++-- .../example/parallel_rips_persistence.cpp | 2 +- src/Simplex_tree/include/gudhi/Simplex_tree.h | 4 +- .../gudhi/Simplex_tree/Simplex_tree_iterators.h | 60 ++++++++++++---------- .../gudhi/Simplex_tree/Simplex_tree_siblings.h | 2 +- src/common/include/gudhi/allocator.h | 10 ++-- 6 files changed, 47 insertions(+), 41 deletions(-) (limited to 'src/Simplex_tree/include') diff --git a/src/Hasse_complex/include/gudhi/Hasse_complex.h b/src/Hasse_complex/include/gudhi/Hasse_complex.h index 38887264..8b06b771 100644 --- a/src/Hasse_complex/include/gudhi/Hasse_complex.h +++ b/src/Hasse_complex/include/gudhi/Hasse_complex.h @@ -23,14 +23,14 @@ #ifndef HASSE_COMPLEX_H_ #define HASSE_COMPLEX_H_ +#include + #include #include #include // for pair #include -#include - #ifdef GUDHI_USE_TBB #include #endif @@ -109,12 +109,12 @@ class Hasse_complex { , dim_max_(cpx.dimension()) { int size = complex_.size(); #ifdef GUDHI_USE_TBB - tbb::parallel_for(0,size,[&](int idx){new (&complex_[idx]) Hasse_simp(cpx, cpx.simplex(idx));}); - for (int idx=0; idx #include #include -#include "gudhi/Hasse_complex.h" +#include #include diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 356deb3a..708cdef9 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -528,7 +528,7 @@ class Simplex_tree { * The type InputVertexRange must be a range of Vertex_handle * on which we can call std::begin() function */ - template> + template> Simplex_handle find(const InputVertexRange & s) { auto first = std::begin(s); auto last = std::end(s); @@ -635,7 +635,7 @@ class Simplex_tree { * * The type InputVertexRange must be a range for which .begin() and * .end() return input iterators, with 'value_type' Vertex_handle. */ - template> + template> std::pair insert_simplex(const InputVertexRange & simplex, Filtration_value filtration = 0) { auto first = std::begin(simplex); diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h index 794060ee..936b7a1f 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h @@ -54,7 +54,7 @@ class Simplex_tree_simplex_vertex_iterator : public boost::iterator_facade< explicit Simplex_tree_simplex_vertex_iterator(SimplexTree * st) : // any end() iterator - sib_(NULL), + sib_(nullptr), v_(st->null_vertex()) { } @@ -99,19 +99,19 @@ class Simplex_tree_boundary_simplex_iterator : public boost::iterator_facade< // any end() iterator explicit Simplex_tree_boundary_simplex_iterator(SimplexTree * st) - : sib_(NULL), - sh_(st->null_simplex()) { + : sib_(nullptr), + sh_(st->null_simplex()), + st_(st) { } Simplex_tree_boundary_simplex_iterator(SimplexTree * st, Simplex_handle sh) - : suffix_(), - sib_(st->self_siblings(sh)), + : last_(sh->first), + sib_(nullptr), st_(st) { - last_ = sh->first; Siblings * sib = st->self_siblings(sh); next_ = sib->parent(); - sib_ = sib->oncles(); /* \todo check if NULL*/ - if (sib_ != NULL) { + sib_ = sib->oncles(); + if (sib_ != nullptr) { sh_ = sib_->find(next_); } else { sh_ = st->null_simplex(); @@ -131,7 +131,7 @@ class Simplex_tree_boundary_simplex_iterator : public boost::iterator_facade< } void increment() { - if (sib_ == NULL) { + if (sib_ == nullptr) { sh_ = st_->null_simplex(); return; } @@ -189,13 +189,15 @@ class Simplex_tree_complex_simplex_iterator : public boost::iterator_facade< // any end() iterator Simplex_tree_complex_simplex_iterator() - : st_(NULL) { + : sib_(nullptr), + st_(nullptr) { } explicit Simplex_tree_complex_simplex_iterator(SimplexTree * st) - : st_(st) { - if (st == NULL || st->root() == NULL || st->root()->members().empty()) { - st_ = NULL; + : sib_(nullptr), + st_(st) { + if (st == nullptr || st->root() == nullptr || st->root()->members().empty()) { + st_ = nullptr; } else { sh_ = st->root()->members().begin(); sib_ = st->root(); @@ -210,10 +212,10 @@ class Simplex_tree_complex_simplex_iterator : public boost::iterator_facade< // valid when iterating along the SAME boundary. bool equal(Simplex_tree_complex_simplex_iterator const& other) const { - if (other.st_ == NULL) { - return (st_ == NULL); + if (other.st_ == nullptr) { + return (st_ == nullptr); } - if (st_ == NULL) { + if (st_ == nullptr) { return false; } return (&(sh_->second) == &(other.sh_->second)); @@ -227,8 +229,8 @@ class Simplex_tree_complex_simplex_iterator : public boost::iterator_facade< void increment() { ++sh_; if (sh_ == sib_->members().end()) { - if (sib_->oncles() == NULL) { - st_ = NULL; + if (sib_->oncles() == nullptr) { + st_ = nullptr; return; } // reach the end sh_ = sib_->oncles()->members().find(sib_->parent()); @@ -261,15 +263,19 @@ class Simplex_tree_skeleton_simplex_iterator : public boost::iterator_facade< // any end() iterator Simplex_tree_skeleton_simplex_iterator() - : st_(NULL) { + : sib_(nullptr), + st_(nullptr), + dim_skel_(0), + curr_dim_(0) { } Simplex_tree_skeleton_simplex_iterator(SimplexTree * st, int dim_skel) - : st_(st), + : sib_(nullptr), + st_(st), dim_skel_(dim_skel), curr_dim_(0) { - if (st == NULL || st->root() == NULL || st->root()->members().empty()) { - st_ = NULL; + if (st == nullptr || st->root() == nullptr || st->root()->members().empty()) { + st_ = nullptr; } else { sh_ = st->root()->members().begin(); sib_ = st->root(); @@ -285,10 +291,10 @@ class Simplex_tree_skeleton_simplex_iterator : public boost::iterator_facade< // valid when iterating along the SAME boundary. bool equal(Simplex_tree_skeleton_simplex_iterator const& other) const { - if (other.st_ == NULL) { - return (st_ == NULL); + if (other.st_ == nullptr) { + return (st_ == nullptr); } - if (st_ == NULL) { + if (st_ == nullptr) { return false; } return (&(sh_->second) == &(other.sh_->second)); @@ -302,8 +308,8 @@ class Simplex_tree_skeleton_simplex_iterator : public boost::iterator_facade< void increment() { ++sh_; if (sh_ == sib_->members().end()) { - if (sib_->oncles() == NULL) { - st_ = NULL; + if (sib_->oncles() == nullptr) { + st_ = nullptr; return; } // reach the end sh_ = sib_->oncles()->members().find(sib_->parent()); diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h index 158ee1f7..072afc8d 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h @@ -57,7 +57,7 @@ class Simplex_tree_siblings { /* Default constructor.*/ Simplex_tree_siblings() - : oncles_(NULL), + : oncles_(nullptr), parent_(-1), members_() { } diff --git a/src/common/include/gudhi/allocator.h b/src/common/include/gudhi/allocator.h index b825173b..4ede14e4 100644 --- a/src/common/include/gudhi/allocator.h +++ b/src/common/include/gudhi/allocator.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef GUDHI_ALLOCATOR_H_ -#define GUDHI_ALLOCATOR_H_ +#ifndef ALLOCATOR_H_ +#define ALLOCATOR_H_ #include #include @@ -43,13 +43,13 @@ struct no_init_allocator : Base { // Do nothing: that's the whole point! template - void construct(P*)noexcept{} + void construct(P*) noexcept {} - template void construct(P*p, U&&...u){ + template void construct(P*p, U&&...u) { Base_traits::construct(*(Base*)this, p, std::forward(u)...); } }; } // namespace Gudhi -#endif // GUDHI_ALLOCATOR_H_ +#endif // ALLOCATOR_H_ -- cgit v1.2.3