diff options
Diffstat (limited to 'src/Nerve_GIC')
-rw-r--r-- | src/Nerve_GIC/example/CMakeLists.txt | 34 | ||||
-rw-r--r-- | src/Nerve_GIC/include/gudhi/GIC.h | 18 | ||||
-rw-r--r-- | src/Nerve_GIC/test/CMakeLists.txt | 17 | ||||
-rw-r--r-- | src/Nerve_GIC/utilities/CMakeLists.txt | 36 |
4 files changed, 53 insertions, 52 deletions
diff --git a/src/Nerve_GIC/example/CMakeLists.txt b/src/Nerve_GIC/example/CMakeLists.txt index 4b0f4677..9faf1f3b 100644 --- a/src/Nerve_GIC/example/CMakeLists.txt +++ b/src/Nerve_GIC/example/CMakeLists.txt @@ -1,25 +1,21 @@ project(Nerve_GIC_examples) -if (NOT CGAL_VERSION VERSION_LESS 4.11.0) +add_executable ( CoordGIC CoordGIC.cpp ) +add_executable ( FuncGIC FuncGIC.cpp ) - add_executable ( CoordGIC CoordGIC.cpp ) - add_executable ( FuncGIC FuncGIC.cpp ) +if (TBB_FOUND) + target_link_libraries(CoordGIC ${TBB_LIBRARIES}) + target_link_libraries(FuncGIC ${TBB_LIBRARIES}) +endif() - if (TBB_FOUND) - target_link_libraries(CoordGIC ${TBB_LIBRARIES}) - target_link_libraries(FuncGIC ${TBB_LIBRARIES}) - endif() +# Copy files for not to pollute sources when testing +file(COPY "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) +file(COPY "${CMAKE_SOURCE_DIR}/data/points/COIL_database/lucky_cat.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) +file(COPY "${CMAKE_SOURCE_DIR}/data/points/COIL_database/lucky_cat_PCA1" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) - # Copy files for not to pollute sources when testing - file(COPY "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) - file(COPY "${CMAKE_SOURCE_DIR}/data/points/COIL_database/lucky_cat.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) - file(COPY "${CMAKE_SOURCE_DIR}/data/points/COIL_database/lucky_cat_PCA1" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) +add_test(NAME Nerve_GIC_example_CoordGIC COMMAND $<TARGET_FILE:CoordGIC> + "${CMAKE_CURRENT_BINARY_DIR}/tore3D_1307.off" "0") - add_test(NAME Nerve_GIC_example_CoordGIC COMMAND $<TARGET_FILE:CoordGIC> - "${CMAKE_CURRENT_BINARY_DIR}/tore3D_1307.off" "0") - - add_test(NAME Nerve_GIC_example_FuncGIC COMMAND $<TARGET_FILE:FuncGIC> - "${CMAKE_CURRENT_BINARY_DIR}/lucky_cat.off" - "${CMAKE_CURRENT_BINARY_DIR}/lucky_cat_PCA1") - -endif (NOT CGAL_VERSION VERSION_LESS 4.11.0) +add_test(NAME Nerve_GIC_example_FuncGIC COMMAND $<TARGET_FILE:FuncGIC> + "${CMAKE_CURRENT_BINARY_DIR}/lucky_cat.off" + "${CMAKE_CURRENT_BINARY_DIR}/lucky_cat_PCA1") diff --git a/src/Nerve_GIC/include/gudhi/GIC.h b/src/Nerve_GIC/include/gudhi/GIC.h index 1b1f9323..047fba61 100644 --- a/src/Nerve_GIC/include/gudhi/GIC.h +++ b/src/Nerve_GIC/include/gudhi/GIC.h @@ -17,6 +17,14 @@ #include <mutex> #endif +#if __has_include(<CGAL/version.h>) +# define GUDHI_GIC_USE_CGAL 1 +# include <gudhi/Bottleneck.h> +#elif __has_include(<hera/bottleneck.h>) +# define GUDHI_GIC_USE_HERA 1 +# include <hera/bottleneck.h> +#endif + #include <gudhi/Debug_utils.h> #include <gudhi/graph_simplicial_complex.h> #include <gudhi/reader_utils.h> @@ -25,7 +33,6 @@ #include <gudhi/Points_off_io.h> #include <gudhi/distance_functions.h> #include <gudhi/Persistent_cohomology.h> -#include <gudhi/Bottleneck.h> #include <boost/config.hpp> #include <boost/graph/graph_traits.hpp> @@ -35,8 +42,6 @@ #include <boost/graph/subgraph.hpp> #include <boost/graph/graph_utility.hpp> -#include <CGAL/version.h> // for CGAL_VERSION_NR - #include <iostream> #include <vector> #include <map> @@ -1228,7 +1233,14 @@ class Cover_complex { Cboot.set_cover_from_function(); Cboot.find_simplices(); Cboot.compute_PD(); +#ifdef GUDHI_GIC_USE_CGAL double db = Gudhi::persistence_diagram::bottleneck_distance(this->PD, Cboot.PD); +#elif defined GUDHI_GIC_USE_HERA + double db = hera::bottleneckDistExact(this->PD, Cboot.PD); +#else + double db; + throw std::logic_error("This function requires CGAL or Hera for the bottleneck distance."); +#endif if (verbose) std::clog << db << std::endl; distribution.push_back(db); } diff --git a/src/Nerve_GIC/test/CMakeLists.txt b/src/Nerve_GIC/test/CMakeLists.txt index 567bf43f..e012a178 100644 --- a/src/Nerve_GIC/test/CMakeLists.txt +++ b/src/Nerve_GIC/test/CMakeLists.txt @@ -1,15 +1,12 @@ project(Graph_induced_complex_tests) -if (NOT CGAL_VERSION VERSION_LESS 4.11.0) - include(GUDHI_boost_test) +include(GUDHI_boost_test) - add_executable ( Nerve_GIC_test_unit test_GIC.cpp ) - if (TBB_FOUND) - target_link_libraries(Nerve_GIC_test_unit ${TBB_LIBRARIES}) - endif() +add_executable ( Nerve_GIC_test_unit test_GIC.cpp ) +if (TBB_FOUND) + target_link_libraries(Nerve_GIC_test_unit ${TBB_LIBRARIES}) +endif() - file(COPY data DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) +file(COPY data DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) - gudhi_add_boost_test(Nerve_GIC_test_unit) - -endif (NOT CGAL_VERSION VERSION_LESS 4.11.0) +gudhi_add_boost_test(Nerve_GIC_test_unit) diff --git a/src/Nerve_GIC/utilities/CMakeLists.txt b/src/Nerve_GIC/utilities/CMakeLists.txt index 65a08d9a..4521a992 100644 --- a/src/Nerve_GIC/utilities/CMakeLists.txt +++ b/src/Nerve_GIC/utilities/CMakeLists.txt @@ -1,27 +1,23 @@ project(Nerve_GIC_examples) -if (NOT CGAL_VERSION VERSION_LESS 4.11.0) +add_executable ( Nerve Nerve.cpp ) +add_executable ( VoronoiGIC VoronoiGIC.cpp ) - add_executable ( Nerve Nerve.cpp ) - add_executable ( VoronoiGIC VoronoiGIC.cpp ) +if (TBB_FOUND) + target_link_libraries(Nerve ${TBB_LIBRARIES}) + target_link_libraries(VoronoiGIC ${TBB_LIBRARIES}) +endif() - if (TBB_FOUND) - target_link_libraries(Nerve ${TBB_LIBRARIES}) - target_link_libraries(VoronoiGIC ${TBB_LIBRARIES}) - endif() +file(COPY KeplerMapperVisuFromTxtFile.py km.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) +# Copy files for not to pollute sources when testing +file(COPY "${CMAKE_SOURCE_DIR}/data/points/human.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) - file(COPY KeplerMapperVisuFromTxtFile.py km.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) - # Copy files for not to pollute sources when testing - file(COPY "${CMAKE_SOURCE_DIR}/data/points/human.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) +add_test(NAME Nerve_GIC_utilities_nerve COMMAND $<TARGET_FILE:Nerve> + "human.off" "2" "10" "0.3") - add_test(NAME Nerve_GIC_utilities_nerve COMMAND $<TARGET_FILE:Nerve> - "human.off" "2" "10" "0.3") +add_test(NAME Nerve_GIC_utilities_VoronoiGIC COMMAND $<TARGET_FILE:VoronoiGIC> + "human.off" "100") - add_test(NAME Nerve_GIC_utilities_VoronoiGIC COMMAND $<TARGET_FILE:VoronoiGIC> - "human.off" "100") - - install(TARGETS Nerve DESTINATION bin) - install(TARGETS VoronoiGIC DESTINATION bin) - install(FILES KeplerMapperVisuFromTxtFile.py km.py km.py.COPYRIGHT DESTINATION bin) - -endif (NOT CGAL_VERSION VERSION_LESS 4.11.0) +install(TARGETS Nerve DESTINATION bin) +install(TARGETS VoronoiGIC DESTINATION bin) +install(FILES KeplerMapperVisuFromTxtFile.py km.py km.py.COPYRIGHT DESTINATION bin) |