From d7e1a3a81dfa91a29e433887fcfdc73310f8db32 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Wed, 7 Aug 2019 11:34:57 +0200 Subject: Add the rest of modules --- .gitignore | 5 ++++ src/cython/CMakeLists.txt | 16 +++++------ src/cython/gudhi.pyx.in | 33 ---------------------- .../gudhi/euclidean_strong_witness_complex.pyx | 14 ++++++--- src/cython/gudhi/euclidean_witness_complex.pyx | 14 ++++++--- src/cython/gudhi/nerve_gic.pyx | 12 ++++++-- src/cython/gudhi/tangential_complex.pyx | 3 -- 7 files changed, 42 insertions(+), 55 deletions(-) delete mode 100644 src/cython/gudhi.pyx.in diff --git a/.gitignore b/.gitignore index 2b1817a4..8f8a8e6d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,11 @@ src/cython/gudhi/periodic_cubical_complex.cpp src/cython/gudhi/reader_utils.cpp src/cython/gudhi/rips_complex.cpp src/cython/gudhi/subsampling.cpp +src/cython/gudhi/euclidean_witness_complex.cpp +src/cython/gudhi/nerve_gic.cpp +src/cython/gudhi/strong_witness_complex.cpp +src/cython/gudhi/tangential_complex.cpp +src/cython/gudhi/witness_complex.cpp # Generated by tests data/points/COIL_database/lucky_cat.off_dist diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index 12eec9d9..dc0dd59d 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -100,18 +100,18 @@ if(PYTHONINTERP_FOUND) set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'cubical_complex', ") set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'periodic_cubical_complex', ") set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'reader_utils', ") - #set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'witness_complex', ") - #set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'strong_witness_complex', ") + set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'witness_complex', ") + set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'strong_witness_complex', ") if (NOT CGAL_VERSION VERSION_LESS 4.11.0) - #set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'bottleneck_distance', ") - #set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'nerve_gic', ") + set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'bottleneck_distance', ") + set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'nerve_gic', ") endif () if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'subsampling', ") - #set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'tangential_complex', ") - #set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'alpha_complex', ") - #set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'euclidean_witness_complex', ") - #set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'euclidean_strong_witness_complex', ") + set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'tangential_complex', ") + set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'alpha_complex', ") + set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'euclidean_witness_complex', ") + set(GUDHI_CYTHON_MODULES_TO_COMPILE "${GUDHI_CYTHON_MODULES_TO_COMPILE}'euclidean_strong_witness_complex', ") endif () if(CGAL_FOUND) diff --git a/src/cython/gudhi.pyx.in b/src/cython/gudhi.pyx.in deleted file mode 100644 index 1c380308..00000000 --- a/src/cython/gudhi.pyx.in +++ /dev/null @@ -1,33 +0,0 @@ -"""This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. - See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. - Author(s): Vincent Rouvreau - - Copyright (C) 2016 Inria - - Modification(s): - - YYYY/MM Author: Description of the modification -""" - -__author__ = "Vincent Rouvreau" -__copyright__ = "Copyright (C) 2016-2019 Inria" -__license__ = "https://gudhi.inria.fr/licensing/" -__version__ = "@GUDHI_VERSION@" -# This variable is used by doctest to find files -__root_source_dir__ = "@CMAKE_SOURCE_DIR@" -__debug_info__ = @GUDHI_CYTHON_DEBUG_INFO@ - -include '@CMAKE_CURRENT_SOURCE_DIR@/cython/off_reader.pyx' -include '@CMAKE_CURRENT_SOURCE_DIR@/cython/simplex_tree.pyx' -include '@CMAKE_CURRENT_SOURCE_DIR@/cython/rips_complex.pyx' -include '@CMAKE_CURRENT_SOURCE_DIR@/cython/cubical_complex.pyx' -include '@CMAKE_CURRENT_SOURCE_DIR@/cython/periodic_cubical_complex.pyx' -include '@CMAKE_CURRENT_SOURCE_DIR@/cython/persistence_graphical_tools.py' -include '@CMAKE_CURRENT_SOURCE_DIR@/cython/reader_utils.pyx' -include '@CMAKE_CURRENT_SOURCE_DIR@/cython/witness_complex.pyx' -include '@CMAKE_CURRENT_SOURCE_DIR@/cython/strong_witness_complex.pyx' -@GUDHI_CYTHON_ALPHA_COMPLEX@ -@GUDHI_CYTHON_EUCLIDEAN_WITNESS_COMPLEX@ -@GUDHI_CYTHON_SUBSAMPLING@ -@GUDHI_CYTHON_TANGENTIAL_COMPLEX@ -@GUDHI_CYTHON_BOTTLENECK_DISTANCE@ -@GUDHI_CYTHON_NERVE_GIC@ diff --git a/src/cython/gudhi/euclidean_strong_witness_complex.pyx b/src/cython/gudhi/euclidean_strong_witness_complex.pyx index 26bd8375..465635c4 100644 --- a/src/cython/gudhi/euclidean_strong_witness_complex.pyx +++ b/src/cython/gudhi/euclidean_strong_witness_complex.pyx @@ -1,6 +1,10 @@ from cython cimport numeric from libcpp.vector cimport vector from libcpp.utility cimport pair +from libc.stdint cimport intptr_t + +from gudhi.simplex_tree cimport * +from gudhi.simplex_tree import SimplexTree """ This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. @@ -65,12 +69,14 @@ cdef class EuclideanStrongWitnessComplex: :returns: A simplex tree created from the Delaunay Triangulation. :rtype: SimplexTree """ - simplex_tree = SimplexTree() + stree = SimplexTree() + cdef intptr_t stree_int_ptr=stree.thisptr + cdef Simplex_tree_interface_full_featured* stree_ptr = stree_int_ptr if limit_dimension is not -1: - self.thisptr.create_simplex_tree(simplex_tree.thisptr, max_alpha_square, limit_dimension) + self.thisptr.create_simplex_tree(stree_ptr, max_alpha_square, limit_dimension) else: - self.thisptr.create_simplex_tree(simplex_tree.thisptr, max_alpha_square) - return simplex_tree + self.thisptr.create_simplex_tree(stree_ptr, max_alpha_square) + return stree def get_point(self, vertex): """This function returns the point corresponding to a given vertex. diff --git a/src/cython/gudhi/euclidean_witness_complex.pyx b/src/cython/gudhi/euclidean_witness_complex.pyx index e687c6f3..92d54eb5 100644 --- a/src/cython/gudhi/euclidean_witness_complex.pyx +++ b/src/cython/gudhi/euclidean_witness_complex.pyx @@ -1,6 +1,10 @@ from cython cimport numeric from libcpp.vector cimport vector from libcpp.utility cimport pair +from libc.stdint cimport intptr_t + +from gudhi.simplex_tree cimport * +from gudhi.simplex_tree import SimplexTree """ This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. @@ -65,12 +69,14 @@ cdef class EuclideanWitnessComplex: :returns: A simplex tree created from the Delaunay Triangulation. :rtype: SimplexTree """ - simplex_tree = SimplexTree() + stree = SimplexTree() + cdef intptr_t stree_int_ptr=stree.thisptr + cdef Simplex_tree_interface_full_featured* stree_ptr = stree_int_ptr if limit_dimension is not -1: - self.thisptr.create_simplex_tree(simplex_tree.thisptr, max_alpha_square, limit_dimension) + self.thisptr.create_simplex_tree(stree_ptr, max_alpha_square, limit_dimension) else: - self.thisptr.create_simplex_tree(simplex_tree.thisptr, max_alpha_square) - return simplex_tree + self.thisptr.create_simplex_tree(stree_ptr, max_alpha_square) + return stree def get_point(self, vertex): """This function returns the point corresponding to a given vertex. diff --git a/src/cython/gudhi/nerve_gic.pyx b/src/cython/gudhi/nerve_gic.pyx index 3c8f1200..9fec626f 100644 --- a/src/cython/gudhi/nerve_gic.pyx +++ b/src/cython/gudhi/nerve_gic.pyx @@ -4,6 +4,10 @@ from libcpp.utility cimport pair from libcpp.string cimport string from libcpp cimport bool import os +from libc.stdint cimport intptr_t + +from gudhi.simplex_tree cimport * +from gudhi.simplex_tree import SimplexTree """ This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT. See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details. @@ -158,9 +162,11 @@ cdef class CoverComplex: :returns: A simplex tree created from the Cover complex. :rtype: SimplexTree """ - simplex_tree = SimplexTree() - self.thisptr.create_simplex_tree(simplex_tree.thisptr) - return simplex_tree + stree = SimplexTree() + cdef intptr_t stree_int_ptr=stree.thisptr + cdef Simplex_tree_interface_full_featured* stree_ptr = stree_int_ptr + self.thisptr.create_simplex_tree(stree_ptr) + return stree def find_simplices(self): """Computes the simplices of the simplicial complex. diff --git a/src/cython/gudhi/tangential_complex.pyx b/src/cython/gudhi/tangential_complex.pyx index b2d55520..9eb22115 100644 --- a/src/cython/gudhi/tangential_complex.pyx +++ b/src/cython/gudhi/tangential_complex.pyx @@ -147,9 +147,6 @@ cdef class TangentialComplex: cdef Simplex_tree_interface_full_featured* stree_ptr = stree_int_ptr self.thisptr.create_simplex_tree(stree_ptr) return stree - simplex_tree = SimplexTree() - self.thisptr.create_simplex_tree(simplex_tree.thisptr) - return simplex_tree def fix_inconsistencies_using_perturbation(self, max_perturb, time_limit=-1.0): """Attempts to fix inconsistencies by perturbing the point positions. -- cgit v1.2.3