diff options
author | ROUVREAU Vincent <vincent.rouvreau@inria.fr> | 2020-08-12 13:06:03 +0200 |
---|---|---|
committer | ROUVREAU Vincent <vincent.rouvreau@inria.fr> | 2020-08-12 13:06:03 +0200 |
commit | 458bc2dcf5044e1d5fde5326b2be35e526abd457 (patch) | |
tree | 9e1cca62b825421feec3835f1b548e0ef8dafad8 /src/python/include/Simplex_tree_interface.h | |
parent | 8f9c065df7f4629555ef09292c14c293891f1bdc (diff) |
code review: boundaries uses only once find and return a pair of iterator. Exception is raised when not found. tested
Diffstat (limited to 'src/python/include/Simplex_tree_interface.h')
-rw-r--r-- | src/python/include/Simplex_tree_interface.h | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/python/include/Simplex_tree_interface.h b/src/python/include/Simplex_tree_interface.h index c4f18eeb..2c695d1b 100644 --- a/src/python/include/Simplex_tree_interface.h +++ b/src/python/include/Simplex_tree_interface.h @@ -190,14 +190,12 @@ class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> { return Base::skeleton_simplex_range(dimension).end(); } - Boundary_simplex_iterator get_boundary_iterator_begin(const Simplex& simplex) { + std::pair<Boundary_simplex_iterator, Boundary_simplex_iterator> get_boundary_iterators(const Simplex& simplex) { + auto bd_sh = Base::find(simplex); + if (bd_sh == Base::null_simplex()) + throw std::runtime_error("simplex not found - cannot find boundaries"); // this specific case works because the range is just a pair of iterators - won't work if range was a vector - return Base::boundary_simplex_range(Base::find(simplex)).begin(); - } - - Boundary_simplex_iterator get_boundary_iterator_end(const Simplex& simplex) { - // this specific case works because the range is just a pair of iterators - won't work if range was a vector - return Base::boundary_simplex_range(Base::find(simplex)).end(); + return std::make_pair(Base::boundary_simplex_range(bd_sh).begin(), Base::boundary_simplex_range(bd_sh).end()); } }; |