diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/python/gudhi/alpha_complex.pyx | 8 | ||||
-rwxr-xr-x | src/python/test/test_alpha_complex.py | 5 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/python/gudhi/alpha_complex.pyx b/src/python/gudhi/alpha_complex.pyx index ea128743..f5f0ca5b 100644 --- a/src/python/gudhi/alpha_complex.pyx +++ b/src/python/gudhi/alpha_complex.pyx @@ -71,20 +71,18 @@ cdef class AlphaComplex: """ # The real cython constructor - def __cinit__(self, points = None, off_file = '', precision = 'safe'): + def __cinit__(self, points = [], off_file = '', precision = 'safe'): assert precision in ['fast', 'safe', 'exact'], "Alpha complex precision can only be 'fast', 'safe' or 'exact'" cdef bool fast = precision == 'fast' cdef bool exact = precision == 'exact' - cdef vector[vector[double]] pts if off_file: if os.path.isfile(off_file): points = read_points_from_off_file(off_file = off_file) else: print("file " + off_file + " not found.") - if points is None: - # Empty Alpha construction - points=[] + # need to copy the points to use them without the gil + cdef vector[vector[double]] pts pts = points with nogil: self.this_ptr = new Alpha_complex_interface(pts, fast, exact) diff --git a/src/python/test/test_alpha_complex.py b/src/python/test/test_alpha_complex.py index 814f8289..8f1424ec 100755 --- a/src/python/test/test_alpha_complex.py +++ b/src/python/test/test_alpha_complex.py @@ -25,12 +25,17 @@ __license__ = "MIT" def _empty_alpha(precision): + alpha_complex = gd.AlphaComplex(precision = precision) + assert alpha_complex.__is_defined() == True + +def _one_2d_point_alpha(precision): alpha_complex = gd.AlphaComplex(points=[[0, 0]], precision = precision) assert alpha_complex.__is_defined() == True def test_empty_alpha(): for precision in ['fast', 'safe', 'exact']: _empty_alpha(precision) + _one_2d_point_alpha(precision) def _infinite_alpha(precision): point_list = [[0, 0], [1, 0], [0, 1], [1, 1]] |