diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-03-22 07:39:11 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-03-22 07:39:11 +0000 |
commit | 3ffe80a4d17b59422dab18b0898e3f9ca4131672 (patch) | |
tree | e498dbd3bc433141ead2496e8007cfc502d7cf07 /src/cython/cython/simplex_tree.pyx | |
parent | cd0f1b7513be17bfca4de6ea4744a3d931694a8f (diff) |
Interface insert_simplex and insert_simplex_and_subfaces in SimplexTree
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2217 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 1e426a8cbcba192a50b05b5cc7fa4a0fd50d8c9b
Diffstat (limited to 'src/cython/cython/simplex_tree.pyx')
-rw-r--r-- | src/cython/cython/simplex_tree.pyx | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/cython/cython/simplex_tree.pyx b/src/cython/cython/simplex_tree.pyx index 489c711f..4e23fbde 100644 --- a/src/cython/cython/simplex_tree.pyx +++ b/src/cython/cython/simplex_tree.pyx @@ -46,6 +46,7 @@ cdef extern from "Simplex_tree_interface.h" namespace "Gudhi": bint find_simplex(vector[int] simplex) bint insert_simplex_and_subfaces(vector[int] simplex, double filtration) + bint insert_simplex(vector[int] simplex, double filtration) vector[pair[vector[int], double]] get_filtered_tree() vector[pair[vector[int], double]] get_skeleton_tree(int dimension) vector[pair[vector[int], double]] get_stars(vector[int] simplex) @@ -196,7 +197,7 @@ cdef class SimplexTree: complex.push_back(i) return self.thisptr.find_simplex(complex) - def insert(self, simplex, filtration=0.0): + def insert_simplex(self, simplex, filtration=0.0): """This function inserts the given N-simplex with the given filtration value (default value is '0.0'). @@ -211,6 +212,23 @@ cdef class SimplexTree: cdef vector[int] complex for i in simplex: complex.push_back(i) + return self.thisptr.insert_simplex(complex, <double>filtration) + + def insert_simplex_and_subfaces(self, simplex, filtration=0.0): + """This function inserts the given N-simplex and its subfaces with the + given filtration value (default value is '0.0'). + + :param simplex: The N-simplex to insert, represented by a list of + vertex. + :type simplex: list of int. + :param filtration: The filtration value of the simplex. + :type filtration: float. + :returns: true if the simplex was found, false otherwise. + :rtype: bool + """ + cdef vector[int] complex + for i in simplex: + complex.push_back(i) return self.thisptr.insert_simplex_and_subfaces(complex, <double>filtration) |