summaryrefslogtreecommitdiff
path: root/src/python/gudhi/simplex_tree.pyx
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-08-12 13:06:03 +0200
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-08-12 13:06:03 +0200
commit458bc2dcf5044e1d5fde5326b2be35e526abd457 (patch)
tree9e1cca62b825421feec3835f1b548e0ef8dafad8 /src/python/gudhi/simplex_tree.pyx
parent8f9c065df7f4629555ef09292c14c293891f1bdc (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/gudhi/simplex_tree.pyx')
-rw-r--r--src/python/gudhi/simplex_tree.pyx14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/python/gudhi/simplex_tree.pyx b/src/python/gudhi/simplex_tree.pyx
index 3ebae923..bc5b43f4 100644
--- a/src/python/gudhi/simplex_tree.pyx
+++ b/src/python/gudhi/simplex_tree.pyx
@@ -293,12 +293,14 @@ cdef class SimplexTree:
:returns: The (simplices of the) boundary of a simplex
:rtype: generator with tuples(simplex, filtration)
"""
- cdef Simplex_tree_boundary_iterator it = self.get_ptr().get_boundary_iterator_begin(simplex)
- cdef Simplex_tree_boundary_iterator end = self.get_ptr().get_boundary_iterator_end(simplex)
-
- while it != end:
- yield self.get_ptr().get_simplex_and_filtration(dereference(it))
- preincrement(it)
+ cdef pair[Simplex_tree_boundary_iterator, Simplex_tree_boundary_iterator] it = self.get_ptr().get_boundary_iterators(simplex)
+
+ try:
+ while it.first != it.second:
+ yield self.get_ptr().get_simplex_and_filtration(dereference(it.first))
+ preincrement(it.first)
+ except RuntimeError:
+ print("simplex not found - cannot find boundaries")
def remove_maximal_simplex(self, simplex):