summaryrefslogtreecommitdiff
path: root/src/python/gudhi/alpha_complex.pyx
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2020-05-11 23:40:20 +0200
committerGitHub <noreply@github.com>2020-05-11 23:40:20 +0200
commit1efd71c502bacce375e1950e10a8112208acd0cf (patch)
tree22becdf1fb6059ca93fd82651e7bf173b8d2debb /src/python/gudhi/alpha_complex.pyx
parentfa969d52cfbb7474a717c548c8c3275710fe8247 (diff)
parent894462a364dd5d4bf4a5250c0c3c075c561fb174 (diff)
Merge pull request #304 from mglisse/nogil1
Add some nogil for cython
Diffstat (limited to 'src/python/gudhi/alpha_complex.pyx')
-rw-r--r--src/python/gudhi/alpha_complex.pyx17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/python/gudhi/alpha_complex.pyx b/src/python/gudhi/alpha_complex.pyx
index e04dc652..d75e374a 100644
--- a/src/python/gudhi/alpha_complex.pyx
+++ b/src/python/gudhi/alpha_complex.pyx
@@ -27,11 +27,11 @@ __license__ = "GPL v3"
cdef extern from "Alpha_complex_interface.h" namespace "Gudhi":
cdef cppclass Alpha_complex_interface "Gudhi::alpha_complex::Alpha_complex_interface":
- Alpha_complex_interface(vector[vector[double]] points) except +
+ Alpha_complex_interface(vector[vector[double]] points) nogil except +
# bool from_file is a workaround for cython to find the correct signature
- Alpha_complex_interface(string off_file, bool from_file) except +
- vector[double] get_point(int vertex) except +
- void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) except +
+ Alpha_complex_interface(string off_file, bool from_file) nogil except +
+ vector[double] get_point(int vertex) nogil except +
+ void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) nogil except +
# AlphaComplex python interface
cdef class AlphaComplex:
@@ -70,6 +70,7 @@ cdef class AlphaComplex:
# The real cython constructor
def __cinit__(self, points = None, off_file = ''):
+ cdef vector[vector[double]] pts
if off_file:
if os.path.isfile(off_file):
self.thisptr = new Alpha_complex_interface(
@@ -80,7 +81,9 @@ cdef class AlphaComplex:
if points is None:
# Empty Alpha construction
points=[]
- self.thisptr = new Alpha_complex_interface(points)
+ pts = points
+ with nogil:
+ self.thisptr = new Alpha_complex_interface(pts)
def __dealloc__(self):
@@ -113,6 +116,8 @@ cdef class AlphaComplex:
:rtype: SimplexTree
"""
stree = SimplexTree()
+ cdef double mas = max_alpha_square
cdef intptr_t stree_int_ptr=stree.thisptr
- self.thisptr.create_simplex_tree(<Simplex_tree_interface_full_featured*>stree_int_ptr, max_alpha_square)
+ with nogil:
+ self.thisptr.create_simplex_tree(<Simplex_tree_interface_full_featured*>stree_int_ptr, mas)
return stree