From c7b82f49f01075519189f1fdb56cc485e4ad9f46 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 21 May 2020 11:08:25 +0200 Subject: Use unique_pointer and template alpha complex interface for python interface --- src/python/include/Alpha_complex_interface.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/python/include') diff --git a/src/python/include/Alpha_complex_interface.h b/src/python/include/Alpha_complex_interface.h index 40de88f3..5fb694cd 100644 --- a/src/python/include/Alpha_complex_interface.h +++ b/src/python/include/Alpha_complex_interface.h @@ -23,29 +23,29 @@ #include #include #include +#include // for std::unique_ptr namespace Gudhi { namespace alpha_complex { +using Exact_kernel = CGAL::Epeck_d< CGAL::Dynamic_dimension_tag >; +using Inexact_kernel = CGAL::Epick_d< CGAL::Dynamic_dimension_tag >; + +template class Alpha_complex_interface { - using Dynamic_kernel = CGAL::Epeck_d< CGAL::Dynamic_dimension_tag >; - using Point_d = Dynamic_kernel::Point_d; + using Point_d = typename Kernel::Point_d; public: Alpha_complex_interface(const std::vector>& points) { auto mkpt = [](std::vector const& vec){ return Point_d(vec.size(), vec.begin(), vec.end()); }; - alpha_complex_ = new Alpha_complex(boost::adaptors::transform(points, mkpt)); + alpha_complex_ = std::make_unique>(boost::adaptors::transform(points, mkpt)); } Alpha_complex_interface(const std::string& off_file_name, bool from_file = true) { - alpha_complex_ = new Alpha_complex(off_file_name); - } - - ~Alpha_complex_interface() { - delete alpha_complex_; + alpha_complex_ = std::make_unique>(off_file_name); } std::vector get_point(int vh) { @@ -61,7 +61,7 @@ class Alpha_complex_interface { } private: - Alpha_complex* alpha_complex_; + std::unique_ptr> alpha_complex_; }; } // namespace alpha_complex -- cgit v1.2.3 From 50b460f867b5801ce3459d60fb86b02051eb4a7d Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Sat, 23 May 2020 09:52:24 +0200 Subject: Delaunay complex and tests all possibilities --- src/python/gudhi/alpha_complex.pyx | 22 ++++---- src/python/include/Alpha_complex_interface.h | 5 +- src/python/test/test_alpha_complex.py | 75 ++++++++++++++++++++++++---- 3 files changed, 82 insertions(+), 20 deletions(-) (limited to 'src/python/include') diff --git a/src/python/gudhi/alpha_complex.pyx b/src/python/gudhi/alpha_complex.pyx index e2d3db9c..700fa738 100644 --- a/src/python/gudhi/alpha_complex.pyx +++ b/src/python/gudhi/alpha_complex.pyx @@ -31,7 +31,7 @@ cdef extern from "Alpha_complex_interface.h" namespace "Gudhi": # bool from_file is a workaround for cython to find the correct signature Alpha_complex_exact_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 + + void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square, bool exact_version, bool default_filtration_value) nogil except + cdef extern from "Alpha_complex_interface.h" namespace "Gudhi": cdef cppclass Alpha_complex_inexact_interface "Gudhi::alpha_complex::Alpha_complex_interface": @@ -39,7 +39,7 @@ cdef extern from "Alpha_complex_interface.h" namespace "Gudhi": # bool from_file is a workaround for cython to find the correct signature Alpha_complex_inexact_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 + + void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square, bool exact_version, bool default_filtration_value) nogil except + # AlphaComplex python interface cdef class AlphaComplex: @@ -138,23 +138,27 @@ cdef class AlphaComplex: else: return self.exact_ptr.get_point(vertex) - def create_simplex_tree(self, max_alpha_square = float('inf')): + def create_simplex_tree(self, max_alpha_square = float('inf'), default_filtration_value = False): """ - :param max_alpha_square: The maximum alpha square threshold the - simplices shall not exceed. Default is set to infinity, and - there is very little point using anything else since it does - not save time. + :param max_alpha_square: The maximum alpha square threshold the simplices shall not exceed. Default is set to + infinity, and there is very little point using anything else since it does not save time. :type max_alpha_square: float + :param default_filtration_value: Set this value to `True` if filtration values are not needed to be computed + (will be set to `NaN`). Default value is `False` (which means compute the filtration values). + :type default_filtration_value: bool :returns: A simplex tree created from the Delaunay Triangulation. :rtype: SimplexTree """ stree = SimplexTree() cdef double mas = max_alpha_square cdef intptr_t stree_int_ptr=stree.thisptr + cdef bool compute_filtration = default_filtration_value == True if self.fast: with nogil: - self.inexact_ptr.create_simplex_tree(stree_int_ptr, mas) + self.inexact_ptr.create_simplex_tree(stree_int_ptr, + mas, False, compute_filtration) else: with nogil: - self.exact_ptr.create_simplex_tree(stree_int_ptr, mas) + self.exact_ptr.create_simplex_tree(stree_int_ptr, + mas, self.exact, compute_filtration) return stree diff --git a/src/python/include/Alpha_complex_interface.h b/src/python/include/Alpha_complex_interface.h index 5fb694cd..3dd01345 100644 --- a/src/python/include/Alpha_complex_interface.h +++ b/src/python/include/Alpha_complex_interface.h @@ -56,8 +56,9 @@ class Alpha_complex_interface { return vd; } - void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square) { - alpha_complex_->create_complex(*simplex_tree, max_alpha_square); + void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square, + bool exact_version, bool default_filtration_value) { + alpha_complex_->create_complex(*simplex_tree, max_alpha_square, exact_version, default_filtration_value); } private: diff --git a/src/python/test/test_alpha_complex.py b/src/python/test/test_alpha_complex.py index 77121302..913397dd 100755 --- a/src/python/test/test_alpha_complex.py +++ b/src/python/test/test_alpha_complex.py @@ -24,14 +24,18 @@ __copyright__ = "Copyright (C) 2016 Inria" __license__ = "MIT" -def test_empty_alpha(): - alpha_complex = AlphaComplex(points=[[0, 0]]) +def _empty_alpha(complexity): + alpha_complex = AlphaComplex(points=[[0, 0]], complexity = complexity) assert alpha_complex.__is_defined() == True +def test_empty_alpha(): + _empty_alpha('fast') + _empty_alpha('safe') + _empty_alpha('exact') -def test_infinite_alpha(): +def _infinite_alpha(complexity): point_list = [[0, 0], [1, 0], [0, 1], [1, 1]] - alpha_complex = AlphaComplex(points=point_list) + alpha_complex = AlphaComplex(points=point_list, complexity = complexity) assert alpha_complex.__is_defined() == True simplex_tree = alpha_complex.create_simplex_tree() @@ -79,10 +83,14 @@ def test_infinite_alpha(): else: assert False +def test_infinite_alpha(): + _infinite_alpha('fast') + _infinite_alpha('safe') + _infinite_alpha('exact') -def test_filtered_alpha(): +def _filtered_alpha(complexity): point_list = [[0, 0], [1, 0], [0, 1], [1, 1]] - filtered_alpha = AlphaComplex(points=point_list) + filtered_alpha = AlphaComplex(points=point_list, complexity = complexity) simplex_tree = filtered_alpha.create_simplex_tree(max_alpha_square=0.25) @@ -119,7 +127,12 @@ def test_filtered_alpha(): assert simplex_tree.get_star([0]) == [([0], 0.0), ([0, 1], 0.25), ([0, 2], 0.25)] assert simplex_tree.get_cofaces([0], 1) == [([0, 1], 0.25), ([0, 2], 0.25)] -def test_safe_alpha_persistence_comparison(): +def test_filtered_alpha(): + _filtered_alpha('fast') + _filtered_alpha('safe') + _filtered_alpha('exact') + +def _safe_alpha_persistence_comparison(complexity): #generate periodic signal time = np.arange(0, 10, 1) signal = [math.sin(x) for x in time] @@ -131,10 +144,10 @@ def test_safe_alpha_persistence_comparison(): embedding2 = [[signal[i], delayed[i]] for i in range(len(time))] #build alpha complex and simplex tree - alpha_complex1 = AlphaComplex(points=embedding1) + alpha_complex1 = AlphaComplex(points=embedding1, complexity = complexity) simplex_tree1 = alpha_complex1.create_simplex_tree() - alpha_complex2 = AlphaComplex(points=embedding2) + alpha_complex2 = AlphaComplex(points=embedding2, complexity = complexity) simplex_tree2 = alpha_complex2.create_simplex_tree() diag1 = simplex_tree1.persistence() @@ -143,3 +156,47 @@ def test_safe_alpha_persistence_comparison(): for (first_p, second_p) in zip_longest(diag1, diag2): assert first_p[0] == pytest.approx(second_p[0]) assert first_p[1] == pytest.approx(second_p[1]) + + +def test_safe_alpha_persistence_comparison(): + # Won't work for 'fast' version + _safe_alpha_persistence_comparison('safe') + _safe_alpha_persistence_comparison('exact') + +def _delaunay_complex(complexity): + point_list = [[0, 0], [1, 0], [0, 1], [1, 1]] + filtered_alpha = AlphaComplex(points=point_list, complexity = complexity) + + simplex_tree = filtered_alpha.create_simplex_tree(default_filtration_value = True) + + assert simplex_tree.num_simplices() == 11 + assert simplex_tree.num_vertices() == 4 + + assert point_list[0] == filtered_alpha.get_point(0) + assert point_list[1] == filtered_alpha.get_point(1) + assert point_list[2] == filtered_alpha.get_point(2) + assert point_list[3] == filtered_alpha.get_point(3) + try: + filtered_alpha.get_point(4) == [] + except IndexError: + pass + else: + assert False + try: + filtered_alpha.get_point(125) == [] + except IndexError: + pass + else: + assert False + + for filtered_value in simplex_tree.get_filtration(): + assert math.isnan(filtered_value[1]) + for filtered_value in simplex_tree.get_star([0]): + assert math.isnan(filtered_value[1]) + for filtered_value in simplex_tree.get_cofaces([0], 1): + assert math.isnan(filtered_value[1]) + +def test_delaunay_complex(): + _delaunay_complex('fast') + _delaunay_complex('safe') + _delaunay_complex('exact') -- cgit v1.2.3 From 78fb7ccd413ca655bdbe4adc9b4b256f20e11fe5 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Sun, 24 May 2020 10:16:58 +0200 Subject: c++ version to trigger exact/inexact kernel --- src/python/gudhi/alpha_complex.pyx | 59 ++++++---------------- src/python/include/Alpha_complex_interface.h | 73 ++++++++++++++++++++-------- 2 files changed, 68 insertions(+), 64 deletions(-) (limited to 'src/python/include') diff --git a/src/python/gudhi/alpha_complex.pyx b/src/python/gudhi/alpha_complex.pyx index 700fa738..5bc9ebc4 100644 --- a/src/python/gudhi/alpha_complex.pyx +++ b/src/python/gudhi/alpha_complex.pyx @@ -26,18 +26,10 @@ __copyright__ = "Copyright (C) 2016 Inria" __license__ = "GPL v3" cdef extern from "Alpha_complex_interface.h" namespace "Gudhi": - cdef cppclass Alpha_complex_exact_interface "Gudhi::alpha_complex::Alpha_complex_interface": - Alpha_complex_exact_interface(vector[vector[double]] points) nogil except + + cdef cppclass Alpha_complex_interface "Gudhi::alpha_complex::Alpha_complex_interface": + Alpha_complex_interface(vector[vector[double]] points, bool fast_version) nogil except + # bool from_file is a workaround for cython to find the correct signature - Alpha_complex_exact_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, bool exact_version, bool default_filtration_value) nogil except + - -cdef extern from "Alpha_complex_interface.h" namespace "Gudhi": - cdef cppclass Alpha_complex_inexact_interface "Gudhi::alpha_complex::Alpha_complex_interface": - Alpha_complex_inexact_interface(vector[vector[double]] points) nogil except + - # bool from_file is a workaround for cython to find the correct signature - Alpha_complex_inexact_interface(string off_file, bool from_file) nogil except + + Alpha_complex_interface(string off_file, bool fast_version, 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, bool exact_version, bool default_filtration_value) nogil except + @@ -61,8 +53,7 @@ cdef class AlphaComplex: """ - cdef Alpha_complex_exact_interface * exact_ptr - cdef Alpha_complex_inexact_interface * inexact_ptr + cdef Alpha_complex_interface * this_ptr cdef bool fast cdef bool exact @@ -91,10 +82,7 @@ cdef class AlphaComplex: cdef vector[vector[double]] pts if off_file: if os.path.isfile(off_file): - if self.fast: - self.inexact_ptr = new Alpha_complex_inexact_interface(off_file.encode('utf-8'), True) - else: - self.exact_ptr = new Alpha_complex_exact_interface(off_file.encode('utf-8'), True) + self.this_ptr = new Alpha_complex_interface(off_file.encode('utf-8'), self.fast, True) else: print("file " + off_file + " not found.") else: @@ -102,28 +90,17 @@ cdef class AlphaComplex: # Empty Alpha construction points=[] pts = points - if self.fast: - with nogil: - self.inexact_ptr = new Alpha_complex_inexact_interface(pts) - else: - with nogil: - self.exact_ptr = new Alpha_complex_exact_interface(pts) + with nogil: + self.this_ptr = new Alpha_complex_interface(pts, self.fast) def __dealloc__(self): - if self.fast: - if self.inexact_ptr != NULL: - del self.inexact_ptr - else: - if self.exact_ptr != NULL: - del self.exact_ptr + if self.this_ptr != NULL: + del self.this_ptr def __is_defined(self): """Returns true if AlphaComplex pointer is not NULL. """ - if self.fast: - return self.inexact_ptr != NULL - else: - return self.exact_ptr != NULL + return self.this_ptr != NULL def get_point(self, vertex): """This function returns the point corresponding to a given vertex. @@ -133,10 +110,7 @@ cdef class AlphaComplex: :rtype: list of float :returns: the point. """ - if self.fast: - return self.inexact_ptr.get_point(vertex) - else: - return self.exact_ptr.get_point(vertex) + return self.this_ptr.get_point(vertex) def create_simplex_tree(self, max_alpha_square = float('inf'), default_filtration_value = False): """ @@ -153,12 +127,7 @@ cdef class AlphaComplex: cdef double mas = max_alpha_square cdef intptr_t stree_int_ptr=stree.thisptr cdef bool compute_filtration = default_filtration_value == True - if self.fast: - with nogil: - self.inexact_ptr.create_simplex_tree(stree_int_ptr, - mas, False, compute_filtration) - else: - with nogil: - self.exact_ptr.create_simplex_tree(stree_int_ptr, - mas, self.exact, compute_filtration) + with nogil: + self.this_ptr.create_simplex_tree(stree_int_ptr, + mas, self.exact, compute_filtration) return stree diff --git a/src/python/include/Alpha_complex_interface.h b/src/python/include/Alpha_complex_interface.h index 3dd01345..46f2ba03 100644 --- a/src/python/include/Alpha_complex_interface.h +++ b/src/python/include/Alpha_complex_interface.h @@ -29,40 +29,75 @@ namespace Gudhi { namespace alpha_complex { -using Exact_kernel = CGAL::Epeck_d< CGAL::Dynamic_dimension_tag >; -using Inexact_kernel = CGAL::Epick_d< CGAL::Dynamic_dimension_tag >; - -template class Alpha_complex_interface { - using Point_d = typename Kernel::Point_d; + private: + using Exact_kernel = CGAL::Epeck_d< CGAL::Dynamic_dimension_tag >; + using Inexact_kernel = CGAL::Epick_d< CGAL::Dynamic_dimension_tag >; + using Point_exact_kernel = typename Exact_kernel::Point_d; + using Point_inexact_kernel = typename Inexact_kernel::Point_d; + + template + std::vector pt_cgal_to_cython(CgalPointType& ph) { + std::vector vd; + for (auto coord = ph.cartesian_begin(); coord != ph.cartesian_end(); coord++) + vd.push_back(CGAL::to_double(*coord)); + return vd; + } + + template + CgalPointType pt_cython_to_cgal(std::vector const& vec) { + return CgalPointType(vec.size(), vec.begin(), vec.end()); + } public: - Alpha_complex_interface(const std::vector>& points) { - auto mkpt = [](std::vector const& vec){ - return Point_d(vec.size(), vec.begin(), vec.end()); - }; - alpha_complex_ = std::make_unique>(boost::adaptors::transform(points, mkpt)); + Alpha_complex_interface(const std::vector>& points, bool fast_version) + : fast_version_(fast_version) { + auto pt = pt_cython_to_cgal(points[0]); + if (fast_version_) { + auto mkpt = [](std::vector const& vec) { + return Point_inexact_kernel(vec.size(), vec.begin(), vec.end()); + }; + ac_inexact_ptr_ = std::make_unique>(boost::adaptors::transform(points, mkpt)); + //ac_inexact_ptr_ = std::make_unique>(boost::adaptors::transform(points, pt_cython_to_cgal)); + } else { + auto mkpt = [](std::vector const& vec) { + return Point_exact_kernel(vec.size(), vec.begin(), vec.end()); + }; + ac_exact_ptr_ = std::make_unique>(boost::adaptors::transform(points, mkpt)); + //ac_exact_ptr_ = std::make_unique>(boost::adaptors::transform(points, pt_cython_to_cgal)); + } } - Alpha_complex_interface(const std::string& off_file_name, bool from_file = true) { - alpha_complex_ = std::make_unique>(off_file_name); + Alpha_complex_interface(const std::string& off_file_name, bool fast_version, bool from_file = true) + : fast_version_(fast_version) { + if (fast_version_) + ac_inexact_ptr_ = std::make_unique>(off_file_name); + else + ac_exact_ptr_ = std::make_unique>(off_file_name); } std::vector get_point(int vh) { - std::vector vd; - Point_d const& ph = alpha_complex_->get_point(vh); - for (auto coord = ph.cartesian_begin(); coord != ph.cartesian_end(); coord++) - vd.push_back(CGAL::to_double(*coord)); - return vd; + if (fast_version_) { + Point_inexact_kernel const& ph = ac_inexact_ptr_->get_point(vh); + return pt_cgal_to_cython(ph); + } else { + Point_exact_kernel const& ph = ac_exact_ptr_->get_point(vh); + return pt_cgal_to_cython(ph); + } } void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square, bool exact_version, bool default_filtration_value) { - alpha_complex_->create_complex(*simplex_tree, max_alpha_square, exact_version, default_filtration_value); + if (fast_version_) + ac_inexact_ptr_->create_complex(*simplex_tree, max_alpha_square, exact_version, default_filtration_value); + else + ac_exact_ptr_->create_complex(*simplex_tree, max_alpha_square, exact_version, default_filtration_value); } private: - std::unique_ptr> alpha_complex_; + bool fast_version_; + std::unique_ptr> ac_exact_ptr_; + std::unique_ptr> ac_inexact_ptr_; }; } // namespace alpha_complex -- cgit v1.2.3 From a7decae3cdf47441cbd72c31e794176dbd3739c4 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Mon, 25 May 2020 08:21:47 +0200 Subject: C++ version and documentation --- src/python/doc/alpha_complex_user.rst | 21 ++++++++++++++++++-- src/python/include/Alpha_complex_interface.h | 29 +++++++++++----------------- 2 files changed, 30 insertions(+), 20 deletions(-) (limited to 'src/python/include') diff --git a/src/python/doc/alpha_complex_user.rst b/src/python/doc/alpha_complex_user.rst index d49f45b4..c1ed0eaa 100644 --- a/src/python/doc/alpha_complex_user.rst +++ b/src/python/doc/alpha_complex_user.rst @@ -16,8 +16,25 @@ Definition Remarks ^^^^^^^ -When an :math:`\alpha`-complex is constructed with an infinite value of :math:`\alpha^2`, -the complex is a Delaunay complex (with special filtration values). +* When an :math:`\alpha`-complex is constructed with an infinite value of :math:`\alpha^2`, the complex is a Delaunay + complex (with special filtration values). The Delaunay complex without filtration values is also available by + passing :code:`default_filtration_value = True` to :func:`~gudhi.AlphaComplex.create_simplex_tree`. +* For people only interested in the topology of the Alpha complex (for instance persistence), Alpha complex is + equivalent to the `Čech complex `_ and much smaller if + you do not bound the radii. `Čech complex `_ can still + make sense in higher dimension precisely because you can bound the radii. +* Using the default :code:`complexity = 'safe'` makes the construction safe. + If you pass :code:`complexity = 'exact'` to :func:`~gudhi.AlphaComplex.__init__`, the filtration values are the exact + ones converted to the filtration value type of the simplicial complex. This can be very slow. + If you pass :code:`complexity = 'safe'` (the default) or :code:`complexity = 'fast'`, the filtration values are only + guaranteed to have a small multiplicative error compared to the exact value, see + `CGAL::Lazy_exact_nt::set_relative_precision_of_to_double `_ + for details. A drawback, when computing persistence, is that an empty exact interval [10^12,10^12] may become a + non-empty approximate interval [10^12,10^12+10^6]. + Using :code:`complexity = 'fast'` makes the computations slightly faster, and the combinatorics are still exact, but + the computation of filtration values can exceptionally be arbitrarily bad. In all cases, we still guarantee that the + output is a valid filtration (faces have a filtration value no larger than their cofaces). +* For performances reasons, it is advised to use Alpha_complex with `CGAL `_ :math:`\geq` 5.0.0. Example from points ------------------- diff --git a/src/python/include/Alpha_complex_interface.h b/src/python/include/Alpha_complex_interface.h index 46f2ba03..dce9c8e9 100644 --- a/src/python/include/Alpha_complex_interface.h +++ b/src/python/include/Alpha_complex_interface.h @@ -31,8 +31,8 @@ namespace alpha_complex { class Alpha_complex_interface { private: - using Exact_kernel = CGAL::Epeck_d< CGAL::Dynamic_dimension_tag >; - using Inexact_kernel = CGAL::Epick_d< CGAL::Dynamic_dimension_tag >; + using Exact_kernel = CGAL::Epeck_d; + using Inexact_kernel = CGAL::Epick_d; using Point_exact_kernel = typename Exact_kernel::Point_d; using Point_inexact_kernel = typename Inexact_kernel::Point_d; @@ -45,31 +45,24 @@ class Alpha_complex_interface { } template - CgalPointType pt_cython_to_cgal(std::vector const& vec) { + static CgalPointType pt_cython_to_cgal(std::vector const& vec) { return CgalPointType(vec.size(), vec.begin(), vec.end()); } public: Alpha_complex_interface(const std::vector>& points, bool fast_version) - : fast_version_(fast_version) { - auto pt = pt_cython_to_cgal(points[0]); + : fast_version_(fast_version) { if (fast_version_) { - auto mkpt = [](std::vector const& vec) { - return Point_inexact_kernel(vec.size(), vec.begin(), vec.end()); - }; - ac_inexact_ptr_ = std::make_unique>(boost::adaptors::transform(points, mkpt)); - //ac_inexact_ptr_ = std::make_unique>(boost::adaptors::transform(points, pt_cython_to_cgal)); + ac_inexact_ptr_ = std::make_unique>( + boost::adaptors::transform(points, pt_cython_to_cgal)); } else { - auto mkpt = [](std::vector const& vec) { - return Point_exact_kernel(vec.size(), vec.begin(), vec.end()); - }; - ac_exact_ptr_ = std::make_unique>(boost::adaptors::transform(points, mkpt)); - //ac_exact_ptr_ = std::make_unique>(boost::adaptors::transform(points, pt_cython_to_cgal)); + ac_exact_ptr_ = std::make_unique>( + boost::adaptors::transform(points, pt_cython_to_cgal)); } } Alpha_complex_interface(const std::string& off_file_name, bool fast_version, bool from_file = true) - : fast_version_(fast_version) { + : fast_version_(fast_version) { if (fast_version_) ac_inexact_ptr_ = std::make_unique>(off_file_name); else @@ -86,8 +79,8 @@ class Alpha_complex_interface { } } - void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square, - bool exact_version, bool default_filtration_value) { + void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square, bool exact_version, + bool default_filtration_value) { if (fast_version_) ac_inexact_ptr_->create_complex(*simplex_tree, max_alpha_square, exact_version, default_filtration_value); else -- cgit v1.2.3 From e7ccfabc395352823c0330ef876b9ac0ef72e840 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Fri, 5 Jun 2020 18:31:26 +0200 Subject: code review: rename ph as point --- src/python/include/Alpha_complex_interface.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/python/include') diff --git a/src/python/include/Alpha_complex_interface.h b/src/python/include/Alpha_complex_interface.h index dce9c8e9..3ac5db1f 100644 --- a/src/python/include/Alpha_complex_interface.h +++ b/src/python/include/Alpha_complex_interface.h @@ -37,9 +37,9 @@ class Alpha_complex_interface { using Point_inexact_kernel = typename Inexact_kernel::Point_d; template - std::vector pt_cgal_to_cython(CgalPointType& ph) { + std::vector pt_cgal_to_cython(CgalPointType& point) { std::vector vd; - for (auto coord = ph.cartesian_begin(); coord != ph.cartesian_end(); coord++) + for (auto coord = point.cartesian_begin(); coord != point.cartesian_end(); coord++) vd.push_back(CGAL::to_double(*coord)); return vd; } @@ -71,11 +71,11 @@ class Alpha_complex_interface { std::vector get_point(int vh) { if (fast_version_) { - Point_inexact_kernel const& ph = ac_inexact_ptr_->get_point(vh); - return pt_cgal_to_cython(ph); + Point_inexact_kernel const& point = ac_inexact_ptr_->get_point(vh); + return pt_cgal_to_cython(point); } else { - Point_exact_kernel const& ph = ac_exact_ptr_->get_point(vh); - return pt_cgal_to_cython(ph); + Point_exact_kernel const& point = ac_exact_ptr_->get_point(vh); + return pt_cgal_to_cython(point); } } -- cgit v1.2.3