summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-12-11 09:38:12 +0100
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-12-11 09:38:12 +0100
commit957da77f9484972ce34d0415502887f92080878e (patch)
treec830b74398c05762b52b5a12eb1450313874b8df
parentfda0084941ece5d41a258d19ca4eb0b3d87384a4 (diff)
code review: GUDHI_USE_EIGEN3 generated by CMake in __init__.py as suggested and roll back the other solution
-rw-r--r--src/python/CMakeLists.txt2
-rw-r--r--src/python/gudhi/__init__.py.in4
-rw-r--r--src/python/gudhi/simplex_tree.pxd2
-rw-r--r--src/python/gudhi/simplex_tree.pyx3
-rw-r--r--src/python/include/Simplex_tree_interface.h6
-rwxr-xr-xsrc/python/test/test_simplex_tree.py4
6 files changed, 8 insertions, 13 deletions
diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
index 45c89609..5a245aac 100644
--- a/src/python/CMakeLists.txt
+++ b/src/python/CMakeLists.txt
@@ -129,11 +129,13 @@ if(PYTHONINTERP_FOUND)
set(GUDHI_PYTHON_EXTRA_COMPILE_ARGS "${GUDHI_PYTHON_EXTRA_COMPILE_ARGS}'-DDEBUG_TRACES', ")
endif()
+ set(GUDHI_USE_EIGEN3 "False")
if (EIGEN3_FOUND)
add_gudhi_debug_info("Eigen3 version ${EIGEN3_VERSION}")
# No problem, even if no CGAL found
set(GUDHI_PYTHON_EXTRA_COMPILE_ARGS "${GUDHI_PYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_EIGEN3_ENABLED', ")
set(GUDHI_PYTHON_EXTRA_COMPILE_ARGS "${GUDHI_PYTHON_EXTRA_COMPILE_ARGS}'-DGUDHI_USE_EIGEN3', ")
+ set(GUDHI_USE_EIGEN3 "True")
endif (EIGEN3_FOUND)
set(GUDHI_CYTHON_MODULES "${GUDHI_CYTHON_MODULES}'off_reader', ")
diff --git a/src/python/gudhi/__init__.py.in b/src/python/gudhi/__init__.py.in
index 79e12fbc..3043201a 100644
--- a/src/python/gudhi/__init__.py.in
+++ b/src/python/gudhi/__init__.py.in
@@ -23,6 +23,10 @@ __all__ = [@GUDHI_PYTHON_MODULES@ @GUDHI_PYTHON_MODULES_EXTRA@]
__available_modules = ''
__missing_modules = ''
+# For unitary tests purpose
+# could use "if 'collapse_edges' in gudhi.__all__" when collapse edges will have a python module
+__GUDHI_USE_EIGEN3 = @GUDHI_USE_EIGEN3@
+
# Try to import * from gudhi.__module_name for default modules.
# Extra modules require an explicit import by the user (mostly because of
# unusual dependencies, but also to avoid cluttering namespace gudhi and
diff --git a/src/python/gudhi/simplex_tree.pxd b/src/python/gudhi/simplex_tree.pxd
index 283830ff..3c4cbed3 100644
--- a/src/python/gudhi/simplex_tree.pxd
+++ b/src/python/gudhi/simplex_tree.pxd
@@ -74,8 +74,6 @@ cdef extern from "Simplex_tree_interface.h" namespace "Gudhi":
Simplex_tree_skeleton_iterator get_skeleton_iterator_begin(int dimension) nogil
Simplex_tree_skeleton_iterator get_skeleton_iterator_end(int dimension) nogil
pair[Simplex_tree_boundary_iterator, Simplex_tree_boundary_iterator] get_boundary_iterators(vector[int] simplex) nogil except +
-
- cdef int _GUDHI_USE_EIGEN3
cdef extern from "Persistent_cohomology_interface.h" namespace "Gudhi":
cdef cppclass Simplex_tree_persistence_interface "Gudhi::Persistent_cohomology_interface<Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_full_featured>>":
diff --git a/src/python/gudhi/simplex_tree.pyx b/src/python/gudhi/simplex_tree.pyx
index eb44c0fc..7d6ab89a 100644
--- a/src/python/gudhi/simplex_tree.pyx
+++ b/src/python/gudhi/simplex_tree.pyx
@@ -17,9 +17,6 @@ __author__ = "Vincent Rouvreau"
__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "MIT"
-# For unitary tests purpose
-__GUDHI_USE_EIGEN3 = _GUDHI_USE_EIGEN3
-
# SimplexTree python interface
cdef class SimplexTree:
"""The simplex tree is an efficient and flexible data structure for
diff --git a/src/python/include/Simplex_tree_interface.h b/src/python/include/Simplex_tree_interface.h
index 50592e25..82444609 100644
--- a/src/python/include/Simplex_tree_interface.h
+++ b/src/python/include/Simplex_tree_interface.h
@@ -27,12 +27,6 @@
namespace Gudhi {
-#ifdef GUDHI_USE_EIGEN3
-const int _GUDHI_USE_EIGEN3 = 1;
-#else
-const int _GUDHI_USE_EIGEN3 = 0;
-#endif
-
template<typename SimplexTreeOptions = Simplex_tree_options_full_featured>
class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> {
public:
diff --git a/src/python/test/test_simplex_tree.py b/src/python/test/test_simplex_tree.py
index 15b472ee..0c072baa 100755
--- a/src/python/test/test_simplex_tree.py
+++ b/src/python/test/test_simplex_tree.py
@@ -8,7 +8,7 @@
- YYYY/MM Author: Description of the modification
"""
-from gudhi import SimplexTree, simplex_tree
+from gudhi import SimplexTree, __GUDHI_USE_EIGEN3
import pytest
__author__ = "Vincent Rouvreau"
@@ -355,7 +355,7 @@ def test_collapse_edges():
# If no Eigen3, collapse_edges just return a copy, no action. Maybe it would require some user warning
st.collapse_edges()
- if simplex_tree.__GUDHI_USE_EIGEN3:
+ if __GUDHI_USE_EIGEN3:
assert st.num_simplices() == 9
assert st.find([1, 3]) == False
for simplex in st.get_skeleton(0):