summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com>2020-08-26 06:58:39 +0200
committerGitHub <noreply@github.com>2020-08-26 06:58:39 +0200
commita51d33cbeb97342cc8251d820104687daf94c0f3 (patch)
tree2575898fbe2e4bc294a3088a1bb940c0b8fff99f
parent644334d6bf42f8dcc750fe1b1b5ea0eebdbba167 (diff)
parentf424715caab7609085cf155abd98c88674ec329d (diff)
Merge pull request #387 from VincentRouvreau/alpha_complex_3d_does_not_require_eigen
Alpha complex 3d does not require eigen
-rw-r--r--src/Alpha_complex/example/CMakeLists.txt8
-rw-r--r--src/Alpha_complex/include/gudhi/Alpha_complex_3d.h6
-rw-r--r--src/Alpha_complex/test/CMakeLists.txt6
-rw-r--r--src/Alpha_complex/utilities/CMakeLists.txt4
-rw-r--r--src/Collapse/example/CMakeLists.txt41
-rw-r--r--src/Collapse/include/gudhi/Flag_complex_edge_collapser.h6
-rw-r--r--src/Collapse/test/CMakeLists.txt16
-rw-r--r--src/Collapse/utilities/CMakeLists.txt66
8 files changed, 87 insertions, 66 deletions
diff --git a/src/Alpha_complex/example/CMakeLists.txt b/src/Alpha_complex/example/CMakeLists.txt
index 2eecd50c..6e231773 100644
--- a/src/Alpha_complex/example/CMakeLists.txt
+++ b/src/Alpha_complex/example/CMakeLists.txt
@@ -25,7 +25,7 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0)
add_test(NAME Alpha_complex_example_fast_from_off_32 COMMAND $<TARGET_FILE:Alpha_complex_example_fast_from_off>
"${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" "32.0" "${CMAKE_CURRENT_BINARY_DIR}/fastalphaoffreader_result_32.txt")
-if (DIFF_PATH)
+ if (DIFF_PATH)
# Do not forget to copy test results files in current binary dir
file(COPY "alphaoffreader_for_doc_32.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
file(COPY "alphaoffreader_for_doc_60.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
@@ -43,8 +43,10 @@ if (DIFF_PATH)
add_test(Alpha_complex_example_fast_from_off_32_diff_files ${DIFF_PATH}
${CMAKE_CURRENT_BINARY_DIR}/fastalphaoffreader_result_32.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_32.txt)
set_tests_properties(Alpha_complex_example_fast_from_off_32_diff_files PROPERTIES DEPENDS Alpha_complex_example_fast_from_off_32)
-endif()
+ endif()
+ endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0)
+if (NOT CGAL_VERSION VERSION_LESS 4.11.0)
add_executable ( Alpha_complex_example_weighted_3d_from_points Weighted_alpha_complex_3d_from_points.cpp )
target_link_libraries(Alpha_complex_example_weighted_3d_from_points ${CGAL_LIBRARY})
if (TBB_FOUND)
@@ -61,4 +63,4 @@ endif()
add_test(NAME Alpha_complex_example_3d_from_points
COMMAND $<TARGET_FILE:Alpha_complex_example_3d_from_points>)
-endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0)
+endif(NOT CGAL_VERSION VERSION_LESS 4.11.0)
diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h
index f56e12d0..622b10ee 100644
--- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h
+++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h
@@ -38,8 +38,6 @@
#include <CGAL/iterator.h>
#include <CGAL/version.h> // for CGAL_VERSION_NR
-#include <Eigen/src/Core/util/Macros.h> // for EIGEN_VERSION_AT_LEAST
-
#include <boost/container/static_vector.hpp>
#include <iostream>
@@ -56,10 +54,6 @@
# error Alpha_complex_3d is only available for CGAL >= 4.11
#endif
-#if !EIGEN_VERSION_AT_LEAST(3,1,0)
-# error Alpha_complex_3d is only available for Eigen3 >= 3.1.0 installed with CGAL
-#endif
-
namespace Gudhi {
namespace alpha_complex {
diff --git a/src/Alpha_complex/test/CMakeLists.txt b/src/Alpha_complex/test/CMakeLists.txt
index fe4b23e4..f38bd096 100644
--- a/src/Alpha_complex/test/CMakeLists.txt
+++ b/src/Alpha_complex/test/CMakeLists.txt
@@ -18,6 +18,10 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0)
gudhi_add_boost_test(Alpha_complex_test_unit)
gudhi_add_boost_test(Delaunay_complex_test_unit)
+endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0)
+
+if (NOT CGAL_VERSION VERSION_LESS 4.11.0)
+
add_executable ( Alpha_complex_3d_test_unit Alpha_complex_3d_unit_test.cpp )
target_link_libraries(Alpha_complex_3d_test_unit ${CGAL_LIBRARY})
add_executable ( Weighted_alpha_complex_3d_test_unit Weighted_alpha_complex_3d_unit_test.cpp )
@@ -38,4 +42,4 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0)
gudhi_add_boost_test(Periodic_alpha_complex_3d_test_unit)
gudhi_add_boost_test(Weighted_periodic_alpha_complex_3d_test_unit)
-endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0)
+endif (NOT CGAL_VERSION VERSION_LESS 4.11.0)
diff --git a/src/Alpha_complex/utilities/CMakeLists.txt b/src/Alpha_complex/utilities/CMakeLists.txt
index 2ffbdde0..f0ddfc2c 100644
--- a/src/Alpha_complex/utilities/CMakeLists.txt
+++ b/src/Alpha_complex/utilities/CMakeLists.txt
@@ -27,7 +27,9 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0)
endif()
install(TARGETS alpha_complex_persistence DESTINATION bin)
+endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0)
+if (NOT CGAL_VERSION VERSION_LESS 4.11.0)
add_executable(alpha_complex_3d_persistence alpha_complex_3d_persistence.cpp)
target_link_libraries(alpha_complex_3d_persistence ${CGAL_LIBRARY} Boost::program_options)
if (TBB_FOUND)
@@ -75,4 +77,4 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0)
install(TARGETS alpha_complex_3d_persistence DESTINATION bin)
-endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0)
+endif (NOT CGAL_VERSION VERSION_LESS 4.11.0)
diff --git a/src/Collapse/example/CMakeLists.txt b/src/Collapse/example/CMakeLists.txt
index ba0e75e3..4456a844 100644
--- a/src/Collapse/example/CMakeLists.txt
+++ b/src/Collapse/example/CMakeLists.txt
@@ -1,23 +1,28 @@
project(Edge_collapse_examples)
-# Point cloud
-add_executable ( Edge_collapse_example_basic edge_collapse_basic_example.cpp )
-if (TBB_FOUND)
- target_link_libraries(Edge_collapse_example_basic ${TBB_LIBRARIES})
-endif()
+if (NOT EIGEN3_VERSION VERSION_LESS 3.1.0)
-add_test(NAME Edge_collapse_example_basic COMMAND $<TARGET_FILE:Edge_collapse_example_basic>)
+ # Point cloud
+ add_executable ( Edge_collapse_example_basic edge_collapse_basic_example.cpp )
+
+ if (TBB_FOUND)
+ target_link_libraries(Edge_collapse_example_basic ${TBB_LIBRARIES})
+ endif()
+
+ add_test(NAME Edge_collapse_example_basic COMMAND $<TARGET_FILE:Edge_collapse_example_basic>)
+
+ # Point cloud
+ add_executable ( Edge_collapse_conserve_persistence edge_collapse_conserve_persistence.cpp )
+
+ if (TBB_FOUND)
+ target_link_libraries(Edge_collapse_conserve_persistence ${TBB_LIBRARIES})
+ endif()
+
+ add_test(NAME Edge_collapse_conserve_persistence_1 COMMAND $<TARGET_FILE:Edge_collapse_conserve_persistence>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "0.2")
+
+ add_test(NAME Edge_collapse_conserve_persistence_2 COMMAND $<TARGET_FILE:Edge_collapse_conserve_persistence>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "1.8")
-# Point cloud
-add_executable ( Edge_collapse_conserve_persistence edge_collapse_conserve_persistence.cpp )
-
-if (TBB_FOUND)
- target_link_libraries(Edge_collapse_conserve_persistence ${TBB_LIBRARIES})
-endif()
-
-add_test(NAME Edge_collapse_conserve_persistence_1 COMMAND $<TARGET_FILE:Edge_collapse_conserve_persistence>
- "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "0.2")
-
-add_test(NAME Edge_collapse_conserve_persistence_2 COMMAND $<TARGET_FILE:Edge_collapse_conserve_persistence>
- "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "1.8")
+endif() \ No newline at end of file
diff --git a/src/Collapse/include/gudhi/Flag_complex_edge_collapser.h b/src/Collapse/include/gudhi/Flag_complex_edge_collapser.h
index b6b7f7c1..713c6608 100644
--- a/src/Collapse/include/gudhi/Flag_complex_edge_collapser.h
+++ b/src/Collapse/include/gudhi/Flag_complex_edge_collapser.h
@@ -18,6 +18,7 @@
#include <boost/iterator/iterator_facade.hpp>
#include <Eigen/Sparse>
+#include <Eigen/src/Core/util/Macros.h> // for EIGEN_VERSION_AT_LEAST
#ifdef GUDHI_USE_TBB
#include <tbb/parallel_sort.h>
@@ -34,6 +35,11 @@
#include <iterator> // for std::inserter
#include <type_traits> // for std::decay
+// Make compilation fail - required for external projects - https://github.com/GUDHI/gudhi-devel/issues/10
+#if !EIGEN_VERSION_AT_LEAST(3,1,0)
+# error Edge Collapse is only available for Eigen3 >= 3.1.0
+#endif
+
namespace Gudhi {
namespace collapse {
diff --git a/src/Collapse/test/CMakeLists.txt b/src/Collapse/test/CMakeLists.txt
index c7eafb46..c04199e2 100644
--- a/src/Collapse/test/CMakeLists.txt
+++ b/src/Collapse/test/CMakeLists.txt
@@ -1,9 +1,13 @@
project(Collapse_tests)
-include(GUDHI_boost_test)
+if (NOT EIGEN3_VERSION VERSION_LESS 3.1.0)
-add_executable ( Collapse_test_unit collapse_unit_test.cpp )
-if (TBB_FOUND)
- target_link_libraries(Collapse_test_unit ${TBB_LIBRARIES})
-endif()
-gudhi_add_boost_test(Collapse_test_unit)
+ include(GUDHI_boost_test)
+
+ add_executable ( Collapse_test_unit collapse_unit_test.cpp )
+ if (TBB_FOUND)
+ target_link_libraries(Collapse_test_unit ${TBB_LIBRARIES})
+ endif()
+ gudhi_add_boost_test(Collapse_test_unit)
+
+endif() \ No newline at end of file
diff --git a/src/Collapse/utilities/CMakeLists.txt b/src/Collapse/utilities/CMakeLists.txt
index c742144b..97fef649 100644
--- a/src/Collapse/utilities/CMakeLists.txt
+++ b/src/Collapse/utilities/CMakeLists.txt
@@ -1,33 +1,37 @@
project(Collapse_utilities)
-# From a point cloud
-add_executable ( point_cloud_edge_collapse_rips_persistence point_cloud_edge_collapse_rips_persistence.cpp )
-target_link_libraries(point_cloud_edge_collapse_rips_persistence Boost::program_options)
-
-if (TBB_FOUND)
- target_link_libraries(point_cloud_edge_collapse_rips_persistence ${TBB_LIBRARIES})
-endif()
-add_test(NAME Edge_collapse_utilities_point_cloud_rips_persistence COMMAND $<TARGET_FILE:point_cloud_edge_collapse_rips_persistence>
- "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-r" "0.25" "-m" "0.5" "-d" "3" "-p" "3" "-o" "off_results.pers")
-
-install(TARGETS point_cloud_edge_collapse_rips_persistence DESTINATION bin)
-
-# From a distance matrix
-add_executable ( distance_matrix_edge_collapse_rips_persistence distance_matrix_edge_collapse_rips_persistence.cpp )
-target_link_libraries(distance_matrix_edge_collapse_rips_persistence Boost::program_options)
-
-if (TBB_FOUND)
- target_link_libraries(distance_matrix_edge_collapse_rips_persistence ${TBB_LIBRARIES})
-endif()
-add_test(NAME Edge_collapse_utilities_distance_matrix_rips_persistence COMMAND $<TARGET_FILE:distance_matrix_edge_collapse_rips_persistence>
- "${CMAKE_SOURCE_DIR}/data/distance_matrix/tore3D_1307_distance_matrix.csv" "-r" "0.25" "-m" "0.5" "-d" "3" "-p" "3" "-o" "csv_results.pers")
-
-install(TARGETS distance_matrix_edge_collapse_rips_persistence DESTINATION bin)
-
-if (DIFF_PATH)
- add_test(Edge_collapse_utilities_diff_persistence ${DIFF_PATH}
- "off_results.pers" "csv_results.pers")
- set_tests_properties(Edge_collapse_utilities_diff_persistence PROPERTIES DEPENDS
- "Edge_collapse_utilities_point_cloud_rips_persistence;Edge_collapse_utilities_distance_matrix_rips_persistence")
-
-endif()
+if (NOT EIGEN3_VERSION VERSION_LESS 3.1.0)
+
+ # From a point cloud
+ add_executable ( point_cloud_edge_collapse_rips_persistence point_cloud_edge_collapse_rips_persistence.cpp )
+ target_link_libraries(point_cloud_edge_collapse_rips_persistence Boost::program_options)
+
+ if (TBB_FOUND)
+ target_link_libraries(point_cloud_edge_collapse_rips_persistence ${TBB_LIBRARIES})
+ endif()
+ add_test(NAME Edge_collapse_utilities_point_cloud_rips_persistence COMMAND $<TARGET_FILE:point_cloud_edge_collapse_rips_persistence>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-r" "0.25" "-m" "0.5" "-d" "3" "-p" "3" "-o" "off_results.pers")
+
+ install(TARGETS point_cloud_edge_collapse_rips_persistence DESTINATION bin)
+
+ # From a distance matrix
+ add_executable ( distance_matrix_edge_collapse_rips_persistence distance_matrix_edge_collapse_rips_persistence.cpp )
+ target_link_libraries(distance_matrix_edge_collapse_rips_persistence Boost::program_options)
+
+ if (TBB_FOUND)
+ target_link_libraries(distance_matrix_edge_collapse_rips_persistence ${TBB_LIBRARIES})
+ endif()
+ add_test(NAME Edge_collapse_utilities_distance_matrix_rips_persistence COMMAND $<TARGET_FILE:distance_matrix_edge_collapse_rips_persistence>
+ "${CMAKE_SOURCE_DIR}/data/distance_matrix/tore3D_1307_distance_matrix.csv" "-r" "0.25" "-m" "0.5" "-d" "3" "-p" "3" "-o" "csv_results.pers")
+
+ install(TARGETS distance_matrix_edge_collapse_rips_persistence DESTINATION bin)
+
+ if (DIFF_PATH)
+ add_test(Edge_collapse_utilities_diff_persistence ${DIFF_PATH}
+ "off_results.pers" "csv_results.pers")
+ set_tests_properties(Edge_collapse_utilities_diff_persistence PROPERTIES DEPENDS
+ "Edge_collapse_utilities_point_cloud_rips_persistence;Edge_collapse_utilities_distance_matrix_rips_persistence")
+
+ endif()
+
+endif() \ No newline at end of file