diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-12-18 21:57:49 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-12-18 21:57:49 +0000 |
commit | c74dc9fdec3f571afb89c7db71d3a1bc28a3466d (patch) | |
tree | f765a10dedc3db211c22983b8de317b2dda8828f | |
parent | ac37226d69d131ef799ef82c91bf0d048880fa24 (diff) | |
parent | 4cf2e2232a2046590909d78c887a2b96a2af8177 (diff) |
Boost minimal version is now 1.56.0
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@3081 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: c3f409eb75ecb7a7f08735a99549c15662b7e5fe
-rw-r--r-- | src/Simplex_tree/include/gudhi/Simplex_tree.h | 7 | ||||
-rw-r--r-- | src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_iterators.h | 32 | ||||
-rw-r--r-- | src/cmake/modules/GUDHI_third_party_libraries.cmake | 2 | ||||
-rw-r--r-- | src/common/doc/main_page.h | 2 | ||||
-rw-r--r-- | src/common/include/gudhi/Debug_utils.h | 2 | ||||
-rw-r--r-- | src/cython/doc/installation.rst | 2 |
6 files changed, 31 insertions, 16 deletions
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index cb6ab309..81dff00d 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -106,8 +106,9 @@ class Simplex_tree { }; struct Key_simplex_base_dummy { Key_simplex_base_dummy() {} - void assign_key(Simplex_key) { } - Simplex_key key() const { assert(false); return -1; } + // Undefined so it will not link + void assign_key(Simplex_key); + Simplex_key key() const; }; typedef typename std::conditional<Options::store_key, Key_simplex_base_real, Key_simplex_base_dummy>::type Key_simplex_base; @@ -121,7 +122,7 @@ class Simplex_tree { }; struct Filtration_simplex_base_dummy { Filtration_simplex_base_dummy() {} - void assign_filtration(Filtration_value f) { assert(f == 0); } + void assign_filtration(Filtration_value GUDHI_CHECK_code(f)) { GUDHI_CHECK(f == 0, "filtration value specified for a complex that does not store them"); } Filtration_value filtration() const { return 0; } }; typedef typename std::conditional<Options::store_filtration, Filtration_simplex_base_real, 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 7e0a454d..ab7346d4 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 @@ -23,6 +23,8 @@ #ifndef SIMPLEX_TREE_SIMPLEX_TREE_ITERATORS_H_ #define SIMPLEX_TREE_SIMPLEX_TREE_ITERATORS_H_ +#include <gudhi/Debug_utils.h> + #include <boost/iterator/iterator_facade.hpp> #include <boost/version.hpp> #if BOOST_VERSION >= 105600 @@ -109,11 +111,18 @@ class Simplex_tree_boundary_simplex_iterator : public boost::iterator_facade< : last_(sh->first), sib_(nullptr), st_(st) { + // Only check once at the beginning instead of for every increment, as this is expensive. + if (SimplexTree::Options::contiguous_vertices) + GUDHI_CHECK(st_->contiguous_vertices(), "The set of vertices is not { 0, ..., n } without holes"); Siblings * sib = st->self_siblings(sh); next_ = sib->parent(); sib_ = sib->oncles(); if (sib_ != nullptr) { - sh_ = sib_->find(next_); + if (SimplexTree::Options::contiguous_vertices && sib_->oncles() == nullptr) + // Only relevant for edges + sh_ = sib_->members_.begin()+next_; + else + sh_ = sib_->find(next_); } else { sh_ = st->null_simplex(); } // vertex: == end() @@ -140,14 +149,19 @@ 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()) { - // 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; + if (SimplexTree::Options::contiguous_vertices && new_sib == nullptr) { + // We reached the root, use a short-cut to find a vertex. + if (rit == suffix_.rend()) { + // Segment, this vertex is the last boundary simplex + sh_ = for_sib->members_.begin()+last_; + sib_ = nullptr; + return; + } else { + // Dim >= 2, initial step of the descent + sh_ = for_sib->members_.begin()+*rit; + for_sib = sh_->second.children(); + ++rit; + } } for (; rit != suffix_.rend(); ++rit) { sh_ = for_sib->find(*rit); diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 8269c3bf..7696496c 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -1,6 +1,6 @@ # This files manage third party libraries required by GUDHI -find_package(Boost REQUIRED COMPONENTS system filesystem unit_test_framework program_options thread) +find_package(Boost 1.56.0 REQUIRED COMPONENTS system filesystem unit_test_framework program_options thread) if(NOT Boost_FOUND) message(FATAL_ERROR "NOTICE: This program requires Boost and will not be compiled.") diff --git a/src/common/doc/main_page.h b/src/common/doc/main_page.h index 148ee670..7ba8a4b7 100644 --- a/src/common/doc/main_page.h +++ b/src/common/doc/main_page.h @@ -258,7 +258,7 @@ * Examples of GUDHI headers inclusion can be found in \ref demos. * * \section compiling Compiling - * The library uses c++11 and requires <a target="_blank" href="http://www.boost.org/">Boost</a> with version 1.48.0 or + * The library uses c++11 and requires <a target="_blank" href="http://www.boost.org/">Boost</a> with version 1.56.0 or * more recent. It is a multi-platform library and compiles on Linux, Mac OSX and Visual Studio 2015. * * \subsection demos Demos and examples diff --git a/src/common/include/gudhi/Debug_utils.h b/src/common/include/gudhi/Debug_utils.h index 8ed3b7b3..e8bd7660 100644 --- a/src/common/include/gudhi/Debug_utils.h +++ b/src/common/include/gudhi/Debug_utils.h @@ -32,7 +32,7 @@ // GUDHI_CHECK throw an exception if expression is false in debug mode, but does nothing in release mode // Could assert in release mode, but cmake sets NDEBUG (for "NO DEBUG") in this mode, means assert does nothing. #ifdef GUDHI_DEBUG - #define GUDHI_CHECK(expression, excpt) if ((expression) == 0) throw excpt + #define GUDHI_CHECK(expression, excpt) ((expression) ? (void) 0 : (throw excpt)) #define GUDHI_CHECK_code(CODE) CODE #else #define GUDHI_CHECK(expression, excpt) (void) 0 diff --git a/src/cython/doc/installation.rst b/src/cython/doc/installation.rst index c182f176..2f689497 100644 --- a/src/cython/doc/installation.rst +++ b/src/cython/doc/installation.rst @@ -5,7 +5,7 @@ Compiling ********* The library uses c++11 and requires `Boost <http://www.boost.org/>`_ with -version 1.48.0 or more recent. It is a multi-platform library and compiles on +version 1.56.0 or more recent. It is a multi-platform library and compiles on Linux, Mac OSX and Visual Studio 2015. It also requires cmake to generate makefiles, and cython to compile the library. |