diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-03-28 10:32:51 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-03-28 10:32:51 +0000 |
commit | 4540f8841fa9b8846012dc3cc7e8a20007d1a97f (patch) | |
tree | 4cdd6f0861eca43e1583948c471a0b9679759c36 | |
parent | f0e209149a6bf1d3b13572f3704986a429130a48 (diff) | |
parent | 6ed42daddfede2288bc02ab2e98fc12b47cac74e (diff) |
Merge last trunk modifications
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2263 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 9b430e79ecc94bee975d748eb3e2106c7dbab3ce
55 files changed, 863 insertions, 970 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5185391b..18cd0ca2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,177 +5,88 @@ include(CMakeGUDHIVersion.txt) # Generate GUDHI official version file configure_file(GUDHIVersion.cmake.in "${CMAKE_SOURCE_DIR}/GUDHIVersion.cmake" @ONLY) -find_package(Boost REQUIRED COMPONENTS system filesystem unit_test_framework chrono timer date_time program_options thread REQUIRED) - -if(NOT Boost_FOUND) - message(FATAL_ERROR "NOTICE: This program requires Boost and will not be compiled.") +set(CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/src/cmake/modules/") +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/cmake/modules/") +message("CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}") +message("CMAKE_MODULE_PATH = ${CMAKE_MODULE_PATH}") + +enable_testing() + +# For "make user_version" +include("${CMAKE_MODULE_PATH}/GUDHI_user_version_target.txt") +# For "make doxygen" +include("${CMAKE_MODULE_PATH}/GUDHI_doxygen_target.txt") +# For third parties libraries management - To be done last as CGAL updates CMAKE_MODULE_PATH +include("${CMAKE_MODULE_PATH}/GUDHI_third_party_libraries.txt") + +if(MSVC) + # Turn off some VC++ warnings + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4668 /wd4311 /wd4800 /wd4820 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018") else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pedantic") +endif() - set(CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/src/cmake/modules/") - set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/cmake/modules/") - message("CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}") - message("CMAKE_MODULE_PATH = ${CMAKE_MODULE_PATH}") - - enable_testing() - - # For "make user_version" - include(${CMAKE_MODULE_PATH}/GUDHI_user_version_target.txt) - # For "make doxygen" - include(${CMAKE_MODULE_PATH}/GUDHI_doxygen_target.txt) - - find_package(GMP) - if(GMP_FOUND) - message(STATUS "GMP_LIBRARIES = ${GMP_LIBRARIES}") - INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR}) - find_package(GMPXX) - if(GMPXX_FOUND) - message(STATUS "GMPXX_LIBRARIES = ${GMPXX_LIBRARIES}") - INCLUDE_DIRECTORIES(${GMPXX_INCLUDE_DIR}) - endif() - endif() - - # In CMakeLists.txt, when include(${CGAL_USE_FILE}), CMAKE_CXX_FLAGS are overwritten. - # cf. http://doc.cgal.org/latest/Manual/installation.html#title40 - # A workaround is to include(${CGAL_USE_FILE}) before adding "-std=c++11". - # A fix would be to use https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html - # or even better https://cmake.org/cmake/help/v3.1/variable/CMAKE_CXX_STANDARD.html - # but it implies to use cmake version 3.1 at least. - find_package(CGAL) - # Only CGAL versions > 4.4 supports what Gudhi uses from CGAL - if (CGAL_VERSION VERSION_LESS 4.4.0) - message("CGAL version ${CGAL_VERSION} is considered too old to be used by Gudhi.") - unset(CGAL_FOUND) - endif() - if(CGAL_FOUND) - message(STATUS "CGAL version: ${CGAL_VERSION}.") - include( ${CGAL_USE_FILE} ) - - if (NOT CGAL_VERSION VERSION_LESS 4.8.0) - include_directories(BEFORE "src/common/include/gudhi_patches") - endif() - endif() - - if(MSVC) - # Turn off some VC++ warnings - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4668 /wd4311 /wd4800 /wd4820 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018") - else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pedantic") - endif() - - if(CMAKE_BUILD_TYPE MATCHES Debug) - message("++ Debug compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") - else() - message("++ Release compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}") - endif() - - set(Boost_USE_STATIC_LIBS ON) - set(Boost_USE_MULTITHREADED ON) - set(Boost_USE_STATIC_RUNTIME OFF) - - # Find TBB package for parallel sort - not mandatory, just optional. - set(TBB_FIND_QUIETLY ON) - find_package(TBB) - if (TBB_FOUND) - include(${TBB_USE_FILE}) - message("TBB found in ${TBB_LIBRARY_DIRS}") - add_definitions(-DGUDHI_USE_TBB) - endif() - - find_package(Eigen3 3.1.0) - if (EIGEN3_FOUND) - message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.") - include( ${EIGEN3_USE_FILE} ) - #include_directories (BEFORE "../../include") - endif (EIGEN3_FOUND) - - # Required programs for unitary tests purpose - FIND_PROGRAM( GCOVR_PATH gcovr ) - if (GCOVR_PATH) - message("gcovr found in ${GCOVR_PATH}") - endif() - FIND_PROGRAM( GPROF_PATH gprof ) - if (GPROF_PATH) - message("gprof found in ${GPROF_PATH}") - endif() - FIND_PROGRAM( DIFF_PATH diff ) - if (DIFF_PATH) - message("diff found in ${DIFF_PATH}") - endif() - - # BOOST ISSUE result_of vs C++11 - add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE) - # BOOST ISSUE with Libraries name resolution under Windows - add_definitions(-DBOOST_ALL_NO_LIB) - # problem with Visual Studio link on Boost program_options - add_definitions( -DBOOST_ALL_DYN_LINK ) - - INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) - LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) - - message(STATUS "boost include dirs:" ${Boost_INCLUDE_DIRS}) - message(STATUS "boost library dirs:" ${Boost_LIBRARY_DIRS}) - - if (DEBUG_TRACES) - # For programs to be more verbose - message(STATUS "DEBUG_TRACES are activated") - add_definitions(-DDEBUG_TRACES) - endif() - - include_directories(src/common/include/) - include_directories(src/Alpha_complex/include/) - include_directories(src/Bitmap_cubical_complex/include/) - include_directories(src/Bottleneck_distance/include/) - include_directories(src/Contraction/include/) - include_directories(src/Hasse_complex/include/) - include_directories(src/Persistent_cohomology/include/) - include_directories(src/Rips_complex/include/) - include_directories(src/Simplex_tree/include/) - include_directories(src/Skeleton_blocker/include/) - include_directories(src/Spatial_searching/include/) - include_directories(src/Subsampling/include/) - include_directories(src/Tangential_complex/include/) - include_directories(src/Witness_complex/include/) - - add_subdirectory(src/common/example) - add_subdirectory(src/common/test) - add_subdirectory(src/Simplex_tree/test) - add_subdirectory(src/Simplex_tree/example) - add_subdirectory(src/Persistent_cohomology/test) - add_subdirectory(src/Persistent_cohomology/example) - add_subdirectory(src/Persistent_cohomology/benchmark) - add_subdirectory(src/Skeleton_blocker/test) - add_subdirectory(src/Skeleton_blocker/example) - add_subdirectory(src/Contraction/example) - add_subdirectory(src/Witness_complex/test) - add_subdirectory(src/Witness_complex/example) - add_subdirectory(src/Bitmap_cubical_complex/test) - add_subdirectory(src/Bitmap_cubical_complex/example) - add_subdirectory(src/Alpha_complex/example) - add_subdirectory(src/Alpha_complex/test) - add_subdirectory(src/Spatial_searching/example) - add_subdirectory(src/Spatial_searching/test) - add_subdirectory(src/Subsampling/example) - add_subdirectory(src/Subsampling/test) - add_subdirectory(src/Tangential_complex/example) - add_subdirectory(src/Tangential_complex/test) - add_subdirectory(src/Tangential_complex/benchmark) - add_subdirectory(src/Bottleneck_distance/example) - add_subdirectory(src/Bottleneck_distance/test) - add_subdirectory(src/Bottleneck_distance/benchmark) - add_subdirectory(src/Rips_complex/example) - add_subdirectory(src/Rips_complex/test) - - # data points generator - add_subdirectory(data/points/generator) - - # Please let GudhUI in last compilation position as QT is known to modify CMAKE_CXX_FLAGS - # GudhUI - add_subdirectory(src/GudhUI) - - # This variable is used by Cython CMakeLists.txt to know its path - set(GUDHI_CYTHON_PATH "src/cython") - add_subdirectory(${GUDHI_CYTHON_PATH}) - -endif() - - +if(CMAKE_BUILD_TYPE MATCHES Debug) + message("++ Debug compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") +else() + message("++ Release compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}") +endif() + +if (DEBUG_TRACES) + # For programs to be more verbose + message(STATUS "DEBUG_TRACES are activated") + add_definitions(-DDEBUG_TRACES) +endif() + +include_directories(src/common/include/) +include_directories(src/Alpha_complex/include/) +include_directories(src/Bitmap_cubical_complex/include/) +include_directories(src/Bottleneck_distance/include/) +include_directories(src/Contraction/include/) +include_directories(src/Hasse_complex/include/) +include_directories(src/Persistent_cohomology/include/) +include_directories(src/Rips_complex/include/) +include_directories(src/Simplex_tree/include/) +include_directories(src/Skeleton_blocker/include/) +include_directories(src/Spatial_searching/include/) +include_directories(src/Subsampling/include/) +include_directories(src/Tangential_complex/include/) +include_directories(src/Witness_complex/include/) + +add_subdirectory(src/common/example) +add_subdirectory(src/common/test) +add_subdirectory(src/Simplex_tree/test) +add_subdirectory(src/Simplex_tree/example) +add_subdirectory(src/Persistent_cohomology/test) +add_subdirectory(src/Persistent_cohomology/example) +add_subdirectory(src/Persistent_cohomology/benchmark) +add_subdirectory(src/Skeleton_blocker/test) +add_subdirectory(src/Skeleton_blocker/example) +add_subdirectory(src/Contraction/example) +add_subdirectory(src/Witness_complex/test) +add_subdirectory(src/Witness_complex/example) +add_subdirectory(src/Bitmap_cubical_complex/test) +add_subdirectory(src/Bitmap_cubical_complex/example) +add_subdirectory(src/Alpha_complex/example) +add_subdirectory(src/Alpha_complex/test) +add_subdirectory(src/Spatial_searching/example) +add_subdirectory(src/Spatial_searching/test) +add_subdirectory(src/Subsampling/example) +add_subdirectory(src/Subsampling/test) +add_subdirectory(src/Tangential_complex/example) +add_subdirectory(src/Tangential_complex/test) +add_subdirectory(src/Tangential_complex/benchmark) +add_subdirectory(src/Bottleneck_distance/example) +add_subdirectory(src/Bottleneck_distance/test) +add_subdirectory(src/Bottleneck_distance/benchmark) +add_subdirectory(src/Rips_complex/example) +add_subdirectory(src/Rips_complex/test) + +# data points generator +add_subdirectory(data/points/generator) + +add_subdirectory(src/GudhUI) + +# This variable is used by Cython CMakeLists.txt to know its path +set(GUDHI_CYTHON_PATH "src/cython") +add_subdirectory(${GUDHI_CYTHON_PATH}) diff --git a/data/points/generator/CMakeLists.txt b/data/points/generator/CMakeLists.txt index f559610c..9a7f7bce 100644 --- a/data/points/generator/CMakeLists.txt +++ b/data/points/generator/CMakeLists.txt @@ -1,18 +1,14 @@ cmake_minimum_required(VERSION 2.6) project(Data_points_generator) -if(CGAL_FOUND) - if (NOT CGAL_VERSION VERSION_LESS 4.6.0) - if (EIGEN3_FOUND) - add_executable ( hypergenerator hypergenerator.cpp ) - target_link_libraries(hypergenerator ${Boost_SYSTEM_LIBRARY}) - add_test(hypergenerator_on_sphere_3000_10_5.0 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator on sphere onSphere.off 3000 10 5.0) - add_test(hypergenerator_on_sphere_10000_3 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator on sphere onSphere.off 10000 3) - add_test(hypergenerator_in_sphere_7000_12_10.8 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator in sphere inSphere.off 7000 12 10.8) - add_test(hypergenerator_in_sphere_50000_2 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator in sphere inSphere.off 50000 2) - # on cube is not available in CGAL - add_test(hypergenerator_in_cube_7000_12_10.8 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator in cube inCube.off 7000 12 10.8) - add_test(hypergenerator_in_cube_50000_2 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator in cube inCube.off 50000 3) - endif(EIGEN3_FOUND) - endif(NOT CGAL_VERSION VERSION_LESS 4.6.0) -endif(CGAL_FOUND) +if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) + add_executable ( hypergenerator hypergenerator.cpp ) + target_link_libraries(hypergenerator ${Boost_SYSTEM_LIBRARY}) + add_test(hypergenerator_on_sphere_3000_10_5.0 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator on sphere onSphere.off 3000 10 5.0) + add_test(hypergenerator_on_sphere_10000_3 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator on sphere onSphere.off 10000 3) + add_test(hypergenerator_in_sphere_7000_12_10.8 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator in sphere inSphere.off 7000 12 10.8) + add_test(hypergenerator_in_sphere_50000_2 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator in sphere inSphere.off 50000 2) + # on cube is not available in CGAL + add_test(hypergenerator_in_cube_7000_12_10.8 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator in cube inCube.off 7000 12 10.8) + add_test(hypergenerator_in_cube_50000_2 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator in cube inCube.off 50000 3) +endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) diff --git a/src/Alpha_complex/example/CMakeLists.txt b/src/Alpha_complex/example/CMakeLists.txt index 71a95d61..b9bcdb55 100644 --- a/src/Alpha_complex/example/CMakeLists.txt +++ b/src/Alpha_complex/example/CMakeLists.txt @@ -2,32 +2,28 @@ cmake_minimum_required(VERSION 2.6) project(Alpha_complex_examples) # need CGAL 4.7 -# cmake -DCGAL_DIR=~/workspace/CGAL-4.7-Ic-41 ../../.. -if(CGAL_FOUND) - if (NOT CGAL_VERSION VERSION_LESS 4.7.0) - if (EIGEN3_FOUND) - add_executable ( alphapoints Alpha_complex_from_points.cpp ) - target_link_libraries(alphapoints ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${CGAL_LIBRARY}) - add_executable ( alphaoffreader Alpha_complex_from_off.cpp ) - target_link_libraries(alphaoffreader ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${CGAL_LIBRARY}) - if (TBB_FOUND) - target_link_libraries(alphapoints ${TBB_LIBRARIES}) - target_link_libraries(alphaoffreader ${TBB_LIBRARIES}) - endif() +# cmake -DCGAL_DIR=~/workspace/CGAL-4.7 .. +if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) + add_executable ( alphapoints Alpha_complex_from_points.cpp ) + target_link_libraries(alphapoints ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${CGAL_LIBRARY}) + add_executable ( alphaoffreader Alpha_complex_from_off.cpp ) + target_link_libraries(alphaoffreader ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${CGAL_LIBRARY}) + if (TBB_FOUND) + target_link_libraries(alphapoints ${TBB_LIBRARIES}) + target_link_libraries(alphaoffreader ${TBB_LIBRARIES}) + endif() - add_test(alphapoints ${CMAKE_CURRENT_BINARY_DIR}/alphapoints) - # Do not forget to copy test files in current binary dir - file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) - add_test(alphaoffreader_doc_60 ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader alphacomplexdoc.off 60.0 ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_60.txt) - add_test(alphaoffreader_doc_32 ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader alphacomplexdoc.off 32.0 ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_32.txt) - 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}/) + add_test(alphapoints ${CMAKE_CURRENT_BINARY_DIR}/alphapoints) + # Do not forget to copy test files in current binary dir + file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) + add_test(alphaoffreader_doc_60 ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader alphacomplexdoc.off 60.0 ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_60.txt) + add_test(alphaoffreader_doc_32 ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader alphacomplexdoc.off 32.0 ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_32.txt) + 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}/) - add_test(alphaoffreader_doc_60_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_60.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_60.txt) - add_test(alphaoffreader_doc_32_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_32.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_32.txt) - endif() - endif(EIGEN3_FOUND) - endif(NOT CGAL_VERSION VERSION_LESS 4.7.0) -endif(CGAL_FOUND) + add_test(alphaoffreader_doc_60_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_60.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_60.txt) + add_test(alphaoffreader_doc_32_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_32.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_32.txt) + endif() +endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) diff --git a/src/Alpha_complex/test/CMakeLists.txt b/src/Alpha_complex/test/CMakeLists.txt index efc0565f..32091196 100644 --- a/src/Alpha_complex/test/CMakeLists.txt +++ b/src/Alpha_complex/test/CMakeLists.txt @@ -10,23 +10,19 @@ if (GPROF_PATH) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") endif() -if(CGAL_FOUND) - if (NOT CGAL_VERSION VERSION_LESS 4.7.0) - if (EIGEN3_FOUND) - add_executable ( AlphaComplexUT Alpha_complex_unit_test.cpp ) - target_link_libraries(AlphaComplexUT ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) - if (TBB_FOUND) - target_link_libraries(AlphaComplexUT ${TBB_LIBRARIES}) - endif() +if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) + add_executable ( AlphaComplexUT Alpha_complex_unit_test.cpp ) + target_link_libraries(AlphaComplexUT ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + if (TBB_FOUND) + target_link_libraries(AlphaComplexUT ${TBB_LIBRARIES}) + endif() - # Do not forget to copy test files in current binary dir - file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) + # Do not forget to copy test files in current binary dir + file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) - add_test(AlphaComplexUT ${CMAKE_CURRENT_BINARY_DIR}/AlphaComplexUT - # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/AlphaComplexUT.xml --log_level=test_suite --report_level=no) + add_test(AlphaComplexUT ${CMAKE_CURRENT_BINARY_DIR}/AlphaComplexUT + # XML format for Jenkins xUnit plugin + --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/AlphaComplexUT.xml --log_level=test_suite --report_level=no) - endif(EIGEN3_FOUND) - endif (NOT CGAL_VERSION VERSION_LESS 4.7.0) -endif(CGAL_FOUND) +endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) diff --git a/src/Bottleneck_distance/benchmark/CMakeLists.txt b/src/Bottleneck_distance/benchmark/CMakeLists.txt index c99e0373..170081ce 100644 --- a/src/Bottleneck_distance/benchmark/CMakeLists.txt +++ b/src/Bottleneck_distance/benchmark/CMakeLists.txt @@ -1,14 +1,9 @@ cmake_minimum_required(VERSION 2.6) project(Bottleneck_distance_benchmark) - -# requires CGAL 4.8 -# cmake -DCGAL_DIR=~/workspace/CGAL-4.8 ../../.. -if(CGAL_FOUND) - if (NOT CGAL_VERSION VERSION_LESS 4.8.0) - add_executable ( bottleneck_chrono bottleneck_chrono.cpp ) - if (TBB_FOUND) - target_link_libraries(bottleneck_chrono ${TBB_LIBRARIES}) - endif(TBB_FOUND) - endif () -endif() +if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) + add_executable ( bottleneck_chrono bottleneck_chrono.cpp ) + if (TBB_FOUND) + target_link_libraries(bottleneck_chrono ${TBB_LIBRARIES}) + endif(TBB_FOUND) +endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Bottleneck_distance/doc/Intro_bottleneck_distance.h b/src/Bottleneck_distance/doc/Intro_bottleneck_distance.h index 5223678d..3998fe8d 100644 --- a/src/Bottleneck_distance/doc/Intro_bottleneck_distance.h +++ b/src/Bottleneck_distance/doc/Intro_bottleneck_distance.h @@ -35,9 +35,9 @@ namespace persistence_diagram { * * \section bottleneckdefinition Definition * - * The bottleneck distance measures the similarity between two persistence diagrams. It is the shortest distance b for which there exists a perfect matching between - * the points of the two diagrams (completed with all the points on the diagonal in order to ignore cardinality mismatchs) such that - * any couple of matched points are at distance at most b. + * The bottleneck distance measures the similarity between two persistence diagrams. It is the shortest distance b for + * which there exists a perfect matching between the points of the two diagrams (completed with all the points on the + * diagonal in order to ignore cardinality mismatchs) such that any couple of matched points are at distance at most b. * * \image html perturb_pd.png On this picture, the red edges represent the matching. The bottleneck distance is the length of the longest edge. * diff --git a/src/Bottleneck_distance/example/CMakeLists.txt b/src/Bottleneck_distance/example/CMakeLists.txt index 55f22c01..b0a19f8b 100644 --- a/src/Bottleneck_distance/example/CMakeLists.txt +++ b/src/Bottleneck_distance/example/CMakeLists.txt @@ -1,24 +1,20 @@ cmake_minimum_required(VERSION 2.6) project(Bottleneck_distance_examples) -# requires CGAL 4.8 -# cmake -DCGAL_DIR=~/workspace/CGAL-4.8 ../../.. -if(CGAL_FOUND) - if (NOT CGAL_VERSION VERSION_LESS 4.8.0) - add_executable (bottleneck_read_file_example bottleneck_read_file_example.cpp) - add_executable (bottleneck_basic_example bottleneck_basic_example.cpp) +if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) + add_executable (bottleneck_read_file_example bottleneck_read_file_example.cpp) + add_executable (bottleneck_basic_example bottleneck_basic_example.cpp) - add_test(bottleneck_basic_example ${CMAKE_CURRENT_BINARY_DIR}/bottleneck_basic_example) + add_test(bottleneck_basic_example ${CMAKE_CURRENT_BINARY_DIR}/bottleneck_basic_example) - add_executable (alpha_rips_persistence_bottleneck_distance alpha_rips_persistence_bottleneck_distance.cpp) - target_link_libraries(alpha_rips_persistence_bottleneck_distance ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}) - if (TBB_FOUND) - target_link_libraries(bottleneck_read_file_example ${TBB_LIBRARIES}) - target_link_libraries(bottleneck_basic_example ${TBB_LIBRARIES}) - target_link_libraries(alpha_rips_persistence_bottleneck_distance ${TBB_LIBRARIES}) - endif(TBB_FOUND) - add_test(alpha_rips_persistence_bottleneck_distance ${CMAKE_CURRENT_BINARY_DIR}/alpha_rips_persistence_bottleneck_distance - ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off -r 0.15 -m 0.12 -d 3 -p 3) + add_executable (alpha_rips_persistence_bottleneck_distance alpha_rips_persistence_bottleneck_distance.cpp) + target_link_libraries(alpha_rips_persistence_bottleneck_distance ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}) + if (TBB_FOUND) + target_link_libraries(bottleneck_read_file_example ${TBB_LIBRARIES}) + target_link_libraries(bottleneck_basic_example ${TBB_LIBRARIES}) + target_link_libraries(alpha_rips_persistence_bottleneck_distance ${TBB_LIBRARIES}) + endif(TBB_FOUND) + add_test(alpha_rips_persistence_bottleneck_distance ${CMAKE_CURRENT_BINARY_DIR}/alpha_rips_persistence_bottleneck_distance + ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off -r 0.15 -m 0.12 -d 3 -p 3) - endif () -endif() +endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Bottleneck_distance/example/alpha_rips_persistence_bottleneck_distance.cpp b/src/Bottleneck_distance/example/alpha_rips_persistence_bottleneck_distance.cpp index 6e9be97b..fd9f0858 100644 --- a/src/Bottleneck_distance/example/alpha_rips_persistence_bottleneck_distance.cpp +++ b/src/Bottleneck_distance/example/alpha_rips_persistence_bottleneck_distance.cpp @@ -56,7 +56,7 @@ void program_options(int argc, char * argv[] , int & p , Filtration_value & min_persistence); -static inline std::pair<double, double> compute_root_square (std::pair<double, double> input) { +static inline std::pair<double, double> compute_root_square(std::pair<double, double> input) { return std::make_pair(std::sqrt(input.first), std::sqrt(input.second)); } diff --git a/src/Bottleneck_distance/test/CMakeLists.txt b/src/Bottleneck_distance/test/CMakeLists.txt index 3e61f4cf..3d8e1f95 100644 --- a/src/Bottleneck_distance/test/CMakeLists.txt +++ b/src/Bottleneck_distance/test/CMakeLists.txt @@ -11,19 +11,15 @@ if (GPROF_PATH) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") endif() -# requires CGAL 4.8 -# cmake -DCGAL_DIR=~/workspace/CGAL-4.8 ../../.. -if(CGAL_FOUND) - if (NOT CGAL_VERSION VERSION_LESS 4.8.0) - add_executable ( bottleneckUT bottleneck_unit_test.cpp ) - target_link_libraries(bottleneckUT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) - if (TBB_FOUND) - target_link_libraries(bottleneckUT ${TBB_LIBRARIES}) - endif(TBB_FOUND) +if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) + add_executable ( bottleneckUT bottleneck_unit_test.cpp ) + target_link_libraries(bottleneckUT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + if (TBB_FOUND) + target_link_libraries(bottleneckUT ${TBB_LIBRARIES}) + endif(TBB_FOUND) - # Unitary tests - add_test(NAME bottleneckUT COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bottleneckUT - # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/bottleneckUT.xml --log_level=test_suite --report_level=no) - endif () -endif() + # Unitary tests + add_test(NAME bottleneckUT COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bottleneckUT + # XML format for Jenkins xUnit plugin + --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/bottleneckUT.xml --log_level=test_suite --report_level=no) +endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index abd4d12c..4fa73662 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,154 +9,85 @@ enable_testing() list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/") -find_package(Boost REQUIRED COMPONENTS system filesystem program_options chrono timer date_time REQUIRED) +# For "make doxygen" +set(GUDHI_USER_VERSION_DIR ${CMAKE_SOURCE_DIR}) +include(${CMAKE_MODULE_PATH}/GUDHI_doxygen_target.txt) -if(NOT Boost_FOUND) - message(FATAL_ERROR "NOTICE: This program requires Boost and will not be compiled.") +# For third parties libraries management - To be done last as CGAL updates CMAKE_MODULE_PATH +include("${CMAKE_MODULE_PATH}/GUDHI_third_party_libraries.txt") + +if(MSVC) + # Turn off some VC++ warnings + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4668 /wd4311 /wd4800 /wd4820 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018") else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pedantic") +endif() - # For "make doxygen" - set(GUDHI_USER_VERSION_DIR ${CMAKE_SOURCE_DIR}) - include(${CMAKE_MODULE_PATH}/GUDHI_doxygen_target.txt) - - find_package(GMP) - if(GMP_FOUND) - message(STATUS "GMP_LIBRARIES = ${GMP_LIBRARIES}") - INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR}) - find_package(GMPXX) - if(GMPXX_FOUND) - message(STATUS "GMPXX_LIBRARIES = ${GMPXX_LIBRARIES}") - INCLUDE_DIRECTORIES(${GMPXX_INCLUDE_DIR}) - endif() - endif() - - # In CMakeLists.txt, when include(${CGAL_USE_FILE}), CMAKE_CXX_FLAGS are overwritten. - # cf. http://doc.cgal.org/latest/Manual/installation.html#title40 - # A workaround is to include(${CGAL_USE_FILE}) before adding "-std=c++11". - # A fix would be to use https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html - # or even better https://cmake.org/cmake/help/v3.1/variable/CMAKE_CXX_STANDARD.html - # but it implies to use cmake version 3.1 at least. - - # find CGAL in QUIET mode for cmake to be less verbose when CGAL is not found. - find_package(CGAL QUIET) - # Only CGAL versions > 4.4 supports what Gudhi uses from CGAL - if (CGAL_VERSION VERSION_LESS 4.4.0 AND CGAL_FOUND) - message("CGAL version ${CGAL_VERSION} is considered too old to be used by Gudhi.") - unset(CGAL_FOUND) - endif(CGAL_VERSION VERSION_LESS 4.4.0 AND CGAL_FOUND) - if(CGAL_FOUND) - message(STATUS "CGAL version: ${CGAL_VERSION}.") - include( ${CGAL_USE_FILE} ) - - if (NOT CGAL_VERSION VERSION_LESS 4.8.0) - include_directories(BEFORE "include/gudhi_patches") - endif() - endif() - - if(MSVC) - # Turn off some VC++ warnings - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4668 /wd4311 /wd4800 /wd4820 /wd4503 /wd4244 /wd4345 /wd4996 /wd4396 /wd4018") - else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pedantic") - endif() - - if(CMAKE_BUILD_TYPE MATCHES Debug) - message("++ Debug compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") - else() - message("++ Release compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}") - endif() - - set(Boost_USE_STATIC_LIBS ON) - set(Boost_USE_MULTITHREADED ON) - set(Boost_USE_STATIC_RUNTIME OFF) - - # Find TBB package for parallel sort - not mandatory, just optional. - set(TBB_FIND_QUIETLY ON) - find_package(TBB) - if (TBB_FOUND) - include(${TBB_USE_FILE}) - message("TBB found in ${TBB_LIBRARY_DIRS}") - add_definitions(-DGUDHI_USE_TBB) - endif() - - find_package(Eigen3 3.1.0) - if (EIGEN3_FOUND) - message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.") - include( ${EIGEN3_USE_FILE} ) - #include_directories (BEFORE "../../include") - endif (EIGEN3_FOUND) - - # BOOST ISSUE result_of vs C++11 - add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE) - # BOOST ISSUE with Libraries name resolution under Windows - add_definitions(-DBOOST_ALL_NO_LIB) - # problem with Visual Studio link on Boost program_options - add_definitions( -DBOOST_ALL_DYN_LINK ) - - INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) - LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) - - if (DEBUG_TRACES) - message(STATUS "DEBUG_TRACES are activated") - # For programs to be more verbose - add_definitions(-DDEBUG_TRACES) - endif() - - #--------------------------------------------------------------------------------------- - # Gudhi compilation part - include_directories(include) - - add_subdirectory(example/common) - add_subdirectory(example/Simplex_tree) - add_subdirectory(example/Persistent_cohomology) - add_subdirectory(example/Skeleton_blocker) - add_subdirectory(example/Contraction) - add_subdirectory(example/Bitmap_cubical_complex) - add_subdirectory(example/Witness_complex) - add_subdirectory(example/Alpha_complex) - add_subdirectory(example/Rips_complex) - add_subdirectory(example/Spatial_searching) - add_subdirectory(example/Subsampling) - add_subdirectory(example/Tangential_complex) - add_subdirectory(example/Bottleneck_distance) - - # data points generator - add_subdirectory(data/points/generator) - - # Please let GudhUI in last compilation position as QT is known to modify CMAKE_CXX_FLAGS - # GudhUI - add_subdirectory(GudhUI) - - # This variable is used by Cython CMakeLists.txt to know its path - set(GUDHI_CYTHON_PATH "cython") - add_subdirectory(${GUDHI_CYTHON_PATH}) - #--------------------------------------------------------------------------------------- - - #--------------------------------------------------------------------------------------- - # GUDHIConfig.cmake - # Export the package for use from the build-tree - # (this registers the build-tree with a global CMake-registry) - export(PACKAGE GUDHI) - - message("++ make install will install ${PROJECT_NAME} in the following directory : ${CMAKE_INSTALL_PREFIX}") - # Create the GUDHIConfig.cmake and GUDHIConfigVersion files - set(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include") - configure_file(GUDHIConfig.cmake.in "${PROJECT_BINARY_DIR}/GUDHIConfig.cmake" @ONLY) - configure_file(GUDHIConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/GUDHIConfigVersion.cmake" @ONLY) - - #--------------------------------------------------------------------------------------- - - #--------------------------------------------------------------------------------------- - # Gudhi installation part - - # Install the GUDHIConfig.cmake and GUDHIConfigVersion.cmake - install(FILES - "${PROJECT_BINARY_DIR}/GUDHIConfig.cmake" - "${PROJECT_BINARY_DIR}/GUDHIConfigVersion.cmake" - DESTINATION share/gudhi) - - # install the include file on "make install" - install(DIRECTORY include/gudhi DESTINATION include) - #--------------------------------------------------------------------------------------- - -endif() +if(CMAKE_BUILD_TYPE MATCHES Debug) + message("++ Debug compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") +else() + message("++ Release compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}") +endif() + +if (DEBUG_TRACES) + message(STATUS "DEBUG_TRACES are activated") + # For programs to be more verbose + add_definitions(-DDEBUG_TRACES) +endif() + +#--------------------------------------------------------------------------------------- +# Gudhi compilation part +include_directories(include) + +add_subdirectory(example/common) +add_subdirectory(example/Simplex_tree) +add_subdirectory(example/Persistent_cohomology) +add_subdirectory(example/Skeleton_blocker) +add_subdirectory(example/Contraction) +add_subdirectory(example/Bitmap_cubical_complex) +add_subdirectory(example/Witness_complex) +add_subdirectory(example/Alpha_complex) +add_subdirectory(example/Rips_complex) +add_subdirectory(example/Spatial_searching) +add_subdirectory(example/Subsampling) +add_subdirectory(example/Tangential_complex) +add_subdirectory(example/Bottleneck_distance) + +# data points generator +add_subdirectory(data/points/generator) + +# Please let GudhUI in last compilation position as QT is known to modify CMAKE_CXX_FLAGS +# GudhUI +add_subdirectory(GudhUI) + +# This variable is used by Cython CMakeLists.txt to know its path +set(GUDHI_CYTHON_PATH "cython") +add_subdirectory(${GUDHI_CYTHON_PATH}) +#--------------------------------------------------------------------------------------- + +#--------------------------------------------------------------------------------------- +# GUDHIConfig.cmake +# Export the package for use from the build-tree +# (this registers the build-tree with a global CMake-registry) +export(PACKAGE GUDHI) + +message("++ make install will install ${PROJECT_NAME} in the following directory : ${CMAKE_INSTALL_PREFIX}") +# Create the GUDHIConfig.cmake and GUDHIConfigVersion files +set(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include") +configure_file(GUDHIConfig.cmake.in "${PROJECT_BINARY_DIR}/GUDHIConfig.cmake" @ONLY) +configure_file(GUDHIConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/GUDHIConfigVersion.cmake" @ONLY) + +#--------------------------------------------------------------------------------------- + +#--------------------------------------------------------------------------------------- +# Gudhi installation part + +# Install the GUDHIConfig.cmake and GUDHIConfigVersion.cmake +install(FILES + "${PROJECT_BINARY_DIR}/GUDHIConfig.cmake" + "${PROJECT_BINARY_DIR}/GUDHIConfigVersion.cmake" + DESTINATION share/gudhi) + +# install the include file on "make install" +install(DIRECTORY include/gudhi DESTINATION include) +#--------------------------------------------------------------------------------------- diff --git a/src/Contraction/example/Garland_heckbert.cpp b/src/Contraction/example/Garland_heckbert.cpp index 4689519f..8b5a6a6c 100644 --- a/src/Contraction/example/Garland_heckbert.cpp +++ b/src/Contraction/example/Garland_heckbert.cpp @@ -35,10 +35,6 @@ #include "Garland_heckbert/Error_quadric.h" -using namespace Gudhi; -using namespace skeleton_blocker; -using namespace contraction; - struct Geometry_trait { typedef Point_d Point; }; @@ -46,7 +42,8 @@ struct Geometry_trait { /** * The vertex stored in the complex contains a quadric. */ -struct Garland_heckbert_traits : public Skeleton_blocker_simple_geometric_traits<Geometry_trait> { +struct Garland_heckbert_traits + : public Gudhi::skeleton_blocker::Skeleton_blocker_simple_geometric_traits<Geometry_trait> { public: struct Garland_heckbert_vertex : public Simple_geometric_vertex { Error_quadric<Geometry_trait::Point> quadric; @@ -54,19 +51,21 @@ struct Garland_heckbert_traits : public Skeleton_blocker_simple_geometric_traits typedef Garland_heckbert_vertex Graph_vertex; }; -typedef Skeleton_blocker_geometric_complex< Garland_heckbert_traits > Complex; -typedef Edge_profile<Complex> EdgeProfile; -typedef Skeleton_blocker_contractor<Complex> Complex_contractor; +using Complex = Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex< Garland_heckbert_traits >; +using EdgeProfile = Gudhi::contraction::Edge_profile<Complex>; +using Complex_contractor = Gudhi::contraction::Skeleton_blocker_contractor<Complex>; /** * How the new vertex is placed after an edge collapse : here it is placed at * the point minimizing the cost of the quadric. */ class GH_placement : public Gudhi::contraction::Placement_policy<EdgeProfile> { + Complex& complex_; + public: typedef Gudhi::contraction::Placement_policy<EdgeProfile>::Placement_type Placement_type; - GH_placement(Complex& complex) { } + GH_placement(Complex& complex) : complex_(complex) { (void)complex_; } Placement_type operator()(const EdgeProfile& profile) const override { auto sum_quad(profile.v0().quadric); @@ -85,10 +84,12 @@ class GH_placement : public Gudhi::contraction::Placement_policy<EdgeProfile> { * which expresses a squared distances with triangles planes. */ class GH_cost : public Gudhi::contraction::Cost_policy<EdgeProfile> { + Complex& complex_; + public: typedef Gudhi::contraction::Cost_policy<EdgeProfile>::Cost_type Cost_type; - GH_cost(Complex& complex) { } + GH_cost(Complex& complex) : complex_(complex) { (void)complex_; } Cost_type operator()(EdgeProfile const& profile, boost::optional<Point> const& new_point) const override { Cost_type res; @@ -107,8 +108,10 @@ class GH_cost : public Gudhi::contraction::Cost_policy<EdgeProfile> { * and we update them when contracting an edge (the quadric become the sum of both quadrics). */ class GH_visitor : public Gudhi::contraction::Contraction_visitor<EdgeProfile> { + Complex& complex_; + public: - GH_visitor(Complex& complex) { } + GH_visitor(Complex& complex) : complex_(complex) { (void)complex_; } // Compute quadrics for every vertex v // The quadric of v consists in the sum of quadric @@ -147,7 +150,7 @@ int main(int argc, char *argv[]) { typedef Complex::Vertex_handle Vertex_handle; // load the points - Skeleton_blocker_off_reader<Complex> off_reader(argv[1], complex); + Gudhi::skeleton_blocker::Skeleton_blocker_off_reader<Complex> off_reader(argv[1], complex); if (!off_reader.is_valid()) { std::cerr << "Unable to read file:" << argv[1] << std::endl; return EXIT_FAILURE; @@ -168,7 +171,7 @@ int main(int argc, char *argv[]) { Complex_contractor contractor(complex, new GH_cost(complex), new GH_placement(complex), - contraction::make_link_valid_contraction<EdgeProfile>(), + Gudhi::contraction::make_link_valid_contraction<EdgeProfile>(), new GH_visitor(complex)); std::cout << "Contract " << num_contractions << " edges" << std::endl; @@ -180,7 +183,7 @@ int main(int argc, char *argv[]) { complex.num_triangles() << " triangles." << std::endl; // write simplified complex - Skeleton_blocker_off_writer<Complex> off_writer(argv[2], complex); + Gudhi::skeleton_blocker::Skeleton_blocker_off_writer<Complex> off_writer(argv[2], complex); return EXIT_SUCCESS; } diff --git a/src/Contraction/example/Garland_heckbert/Error_quadric.h b/src/Contraction/example/Garland_heckbert/Error_quadric.h index 076f1be0..e7dafaa0 100644 --- a/src/Contraction/example/Garland_heckbert/Error_quadric.h +++ b/src/Contraction/example/Garland_heckbert/Error_quadric.h @@ -21,8 +21,8 @@ * */ -#ifndef ERROR_QUADRIC_H_ -#define ERROR_QUADRIC_H_ +#ifndef GARLAND_HECKBERT_ERROR_QUADRIC_H_ +#define GARLAND_HECKBERT_ERROR_QUADRIC_H_ #include <boost/optional/optional.hpp> @@ -179,4 +179,4 @@ template <typename Point> class Error_quadric { } }; -#endif // ERROR_QUADRIC_H_ +#endif // GARLAND_HECKBERT_ERROR_QUADRIC_H_ diff --git a/src/Contraction/example/Rips_contraction.cpp b/src/Contraction/example/Rips_contraction.cpp index 7f19e239..8289b1d3 100644 --- a/src/Contraction/example/Rips_contraction.cpp +++ b/src/Contraction/example/Rips_contraction.cpp @@ -27,19 +27,15 @@ #include <boost/timer/timer.hpp> #include <iostream> -using namespace Gudhi; -using namespace skeleton_blocker; -using namespace contraction; - struct Geometry_trait { typedef Point_d Point; }; -typedef Geometry_trait::Point Point; -typedef Skeleton_blocker_simple_geometric_traits<Geometry_trait> Complex_geometric_traits; -typedef Skeleton_blocker_geometric_complex< Complex_geometric_traits > Complex; -typedef Edge_profile<Complex> Profile; -typedef Skeleton_blocker_contractor<Complex> Complex_contractor; +using Complex_geometric_traits = Gudhi::skeleton_blocker::Skeleton_blocker_simple_geometric_traits<Geometry_trait>; +using Complex = Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex< Complex_geometric_traits >; +using Profile = Gudhi::contraction::Edge_profile<Complex>; +using Complex_contractor = Gudhi::contraction::Skeleton_blocker_contractor<Complex>; + template<typename ComplexType> void build_rips(ComplexType& complex, double offset) { @@ -62,7 +58,7 @@ int main(int argc, char *argv[]) { Complex complex; // load only the points - Skeleton_blocker_off_reader<Complex> off_reader(argv[1], complex, true); + Gudhi::skeleton_blocker::Skeleton_blocker_off_reader<Complex> off_reader(argv[1], complex, true); if (!off_reader.is_valid()) { std::cerr << "Unable to read file:" << argv[1] << std::endl; return EXIT_FAILURE; @@ -79,10 +75,10 @@ int main(int argc, char *argv[]) { complex.num_edges() << " edges" << std::endl; Complex_contractor contractor(complex, - new Edge_length_cost<Profile>, - contraction::make_first_vertex_placement<Profile>(), - contraction::make_link_valid_contraction<Profile>(), - contraction::make_remove_popable_blockers_visitor<Profile>()); + new Gudhi::contraction::Edge_length_cost<Profile>, + Gudhi::contraction::make_first_vertex_placement<Profile>(), + Gudhi::contraction::make_link_valid_contraction<Profile>(), + Gudhi::contraction::make_remove_popable_blockers_visitor<Profile>()); contractor.contract_edges(); std::cout << "Counting final number of simplices \n"; diff --git a/src/Doxyfile b/src/Doxyfile index 9f08024c..d2d0a447 100644 --- a/src/Doxyfile +++ b/src/Doxyfile @@ -500,7 +500,7 @@ HIDE_SCOPE_NAMES = NO # the files that are included by a file in the documentation of that file. # The default value is: YES. -SHOW_INCLUDE_FILES = YES +SHOW_INCLUDE_FILES = NO # If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each # grouped member an include statement to the documentation, telling the reader @@ -847,9 +847,11 @@ IMAGE_PATH = doc/Skeleton_blocker/ \ doc/Persistent_cohomology/ \ doc/Witness_complex/ \ doc/Bitmap_cubical_complex/ \ + doc/Rips_complex/ \ doc/Subsampling/ \ doc/Spatial_searching/ \ - doc/Tangential_complex/ + doc/Tangential_complex/ \ + doc/Bottleneck_distance/ # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program @@ -2151,7 +2153,7 @@ TEMPLATE_RELATIONS = YES # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. -INCLUDE_GRAPH = YES +INCLUDE_GRAPH = NO # If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are # set to YES then doxygen will generate a graph for each documented file showing @@ -2160,7 +2162,7 @@ INCLUDE_GRAPH = YES # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. -INCLUDED_BY_GRAPH = YES +INCLUDED_BY_GRAPH = NO # If the CALL_GRAPH tag is set to YES then doxygen will generate a call # dependency graph for every global function or class method. diff --git a/src/GudhUI/CMakeLists.txt b/src/GudhUI/CMakeLists.txt index 64429baa..ca2e47c1 100644 --- a/src/GudhUI/CMakeLists.txt +++ b/src/GudhUI/CMakeLists.txt @@ -5,6 +5,10 @@ find_package(Qt5 COMPONENTS Widgets Xml OpenGL) find_package(QGLViewer) find_package(OpenGL) +if (CGAL_VERSION VERSION_EQUAL 4.8.0) + message(ERROR " GudhUI does not compile with CGAL 4.8.0. 4.8.1, 4.8.2 and 4.9 are OK.") +endif() + if (NOT CGAL_FOUND) message(ERROR " GudhUI requires CGAL and will not be compiled.") endif() @@ -23,7 +27,7 @@ endif() -if ( CGAL_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND ) +if ( CGAL_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND AND NOT CGAL_VERSION VERSION_EQUAL 4.8.0) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) diff --git a/src/GudhUI/utils/Critical_points.h b/src/GudhUI/utils/Critical_points.h index b88293e9..2a18e079 100644 --- a/src/GudhUI/utils/Critical_points.h +++ b/src/GudhUI/utils/Critical_points.h @@ -105,6 +105,9 @@ template<typename SkBlComplex> class Critical_points { if (link.empty()) return 0; + Edge_contractor<Complex> contractor(link, link.num_vertices() - 1); + (void)contractor; + if (link.num_connected_components() > 1) // one than more CC -> not contractible return 0; diff --git a/src/GudhUI/utils/Is_manifold.h b/src/GudhUI/utils/Is_manifold.h index 6dd7898e..d0974463 100644 --- a/src/GudhUI/utils/Is_manifold.h +++ b/src/GudhUI/utils/Is_manifold.h @@ -76,6 +76,8 @@ template<typename SkBlComplex> class Is_manifold { bool is_k_sphere(Vertex_handle v, int k) { auto link = input_complex_.link(v); + Edge_contractor<Complex> contractor(link, link.num_vertices() - 1); + (void)contractor; return (is_sphere_simplex(link) == k); } diff --git a/src/GudhUI/utils/Vertex_collapsor.h b/src/GudhUI/utils/Vertex_collapsor.h index 3f0e7ffd..568dab2f 100644 --- a/src/GudhUI/utils/Vertex_collapsor.h +++ b/src/GudhUI/utils/Vertex_collapsor.h @@ -80,6 +80,8 @@ template<typename SkBlComplex> class Vertex_collapsor { if (link.empty()) return false; if (link.is_cone()) return true; if (link.num_connected_components() > 1) return false; + Edge_contractor<Complex> contractor(link, link.num_vertices() - 1); + (void)contractor; return (link.num_vertices() == 1); } }; diff --git a/src/Persistent_cohomology/example/CMakeLists.txt b/src/Persistent_cohomology/example/CMakeLists.txt index 20700d86..a6b698c3 100644 --- a/src/Persistent_cohomology/example/CMakeLists.txt +++ b/src/Persistent_cohomology/example/CMakeLists.txt @@ -81,28 +81,26 @@ if(CGAL_FOUND) ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.weights 2 0.45) - if (NOT CGAL_VERSION VERSION_LESS 4.7.0) - if (EIGEN3_FOUND) - add_executable (alpha_complex_persistence alpha_complex_persistence.cpp) - target_link_libraries(alpha_complex_persistence - ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}) - - add_executable(periodic_alpha_complex_3d_persistence periodic_alpha_complex_3d_persistence.cpp) - target_link_libraries(periodic_alpha_complex_3d_persistence ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY}) - - add_executable(custom_persistence_sort custom_persistence_sort.cpp) - target_link_libraries(custom_persistence_sort ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY}) - - if (TBB_FOUND) - target_link_libraries(alpha_complex_persistence ${TBB_LIBRARIES}) - target_link_libraries(periodic_alpha_complex_3d_persistence ${TBB_LIBRARIES}) - target_link_libraries(custom_persistence_sort ${TBB_LIBRARIES}) - endif(TBB_FOUND) - add_test(alpha_complex_persistence_2_0_45 ${CMAKE_CURRENT_BINARY_DIR}/alpha_complex_persistence - ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -m 0.45 -p 2) - add_test(periodic_alpha_complex_3d_persistence_2_0 ${CMAKE_CURRENT_BINARY_DIR}/periodic_alpha_complex_3d_persistence - ${CMAKE_SOURCE_DIR}/data/points/grid_10_10_10_in_0_1.off ${CMAKE_SOURCE_DIR}/data/points/iso_cuboid_3_in_0_1.txt 2 0) - add_test(custom_persistence_sort ${CMAKE_CURRENT_BINARY_DIR}/custom_persistence_sort) - endif(EIGEN3_FOUND) - endif (NOT CGAL_VERSION VERSION_LESS 4.7.0) + if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) + add_executable (alpha_complex_persistence alpha_complex_persistence.cpp) + target_link_libraries(alpha_complex_persistence + ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}) + + add_executable(periodic_alpha_complex_3d_persistence periodic_alpha_complex_3d_persistence.cpp) + target_link_libraries(periodic_alpha_complex_3d_persistence ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY}) + + add_executable(custom_persistence_sort custom_persistence_sort.cpp) + target_link_libraries(custom_persistence_sort ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY}) + + if (TBB_FOUND) + target_link_libraries(alpha_complex_persistence ${TBB_LIBRARIES}) + target_link_libraries(periodic_alpha_complex_3d_persistence ${TBB_LIBRARIES}) + target_link_libraries(custom_persistence_sort ${TBB_LIBRARIES}) + endif(TBB_FOUND) + add_test(alpha_complex_persistence_2_0_45 ${CMAKE_CURRENT_BINARY_DIR}/alpha_complex_persistence + ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -m 0.45 -p 2) + add_test(periodic_alpha_complex_3d_persistence_2_0 ${CMAKE_CURRENT_BINARY_DIR}/periodic_alpha_complex_3d_persistence + ${CMAKE_SOURCE_DIR}/data/points/grid_10_10_10_in_0_1.off ${CMAKE_SOURCE_DIR}/data/points/iso_cuboid_3_in_0_1.txt 2 0) + add_test(custom_persistence_sort ${CMAKE_CURRENT_BINARY_DIR}/custom_persistence_sort) + endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) endif(CGAL_FOUND) diff --git a/src/Persistent_cohomology/example/alpha_complex_3d_helper.h b/src/Persistent_cohomology/example/alpha_complex_3d_helper.h index ceefd2ba..7865e4ec 100644 --- a/src/Persistent_cohomology/example/alpha_complex_3d_helper.h +++ b/src/Persistent_cohomology/example/alpha_complex_3d_helper.h @@ -20,8 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef EXAMPLE_PERSISTENT_COHOMOLOGY_ALPHA_COMPLEX_3D_HELPER_H_ -#define EXAMPLE_PERSISTENT_COHOMOLOGY_ALPHA_COMPLEX_3D_HELPER_H_ +#ifndef ALPHA_COMPLEX_3D_HELPER_H_ +#define ALPHA_COMPLEX_3D_HELPER_H_ template<class Vertex_list, class Cell_handle> Vertex_list from_cell(const Cell_handle& ch) { @@ -73,4 +73,4 @@ Vertex_list from_vertex(const Vertex_handle& vh) { return the_list; } -#endif // EXAMPLE_PERSISTENT_COHOMOLOGY_ALPHA_COMPLEX_3D_HELPER_H_ +#endif // ALPHA_COMPLEX_3D_HELPER_H_ diff --git a/src/Persistent_cohomology/example/alpha_complex_3d_persistence.cpp b/src/Persistent_cohomology/example/alpha_complex_3d_persistence.cpp index ffb98283..fd227b82 100644 --- a/src/Persistent_cohomology/example/alpha_complex_3d_persistence.cpp +++ b/src/Persistent_cohomology/example/alpha_complex_3d_persistence.cpp @@ -20,18 +20,17 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <boost/variant.hpp> + #include <gudhi/Simplex_tree.h> #include <gudhi/Persistent_cohomology.h> #include <gudhi/Points_3D_off_io.h> -#include <boost/variant.hpp> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Delaunay_triangulation_3.h> #include <CGAL/Alpha_shape_3.h> #include <CGAL/iterator.h> -#include "alpha_complex_3d_helper.h" - #include <fstream> #include <cmath> #include <string> @@ -41,6 +40,8 @@ #include <list> #include <vector> +#include "alpha_complex_3d_helper.h" + // Alpha_shape_3 templates type definitions using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel; using Vb = CGAL::Alpha_shape_vertex_base_3<Kernel>; diff --git a/src/Persistent_cohomology/example/exact_alpha_complex_3d_persistence.cpp b/src/Persistent_cohomology/example/exact_alpha_complex_3d_persistence.cpp index c016a596..8a335075 100644 --- a/src/Persistent_cohomology/example/exact_alpha_complex_3d_persistence.cpp +++ b/src/Persistent_cohomology/example/exact_alpha_complex_3d_persistence.cpp @@ -20,18 +20,17 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <boost/variant.hpp> + #include <gudhi/Simplex_tree.h> #include <gudhi/Persistent_cohomology.h> #include <gudhi/Points_3D_off_io.h> -#include <boost/variant.hpp> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Delaunay_triangulation_3.h> #include <CGAL/Alpha_shape_3.h> #include <CGAL/iterator.h> -#include "alpha_complex_3d_helper.h" - #include <fstream> #include <cmath> #include <string> @@ -41,6 +40,8 @@ #include <list> #include <vector> +#include "alpha_complex_3d_helper.h" + // Alpha_shape_3 templates type definitions using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel; using Exact_tag = CGAL::Tag_true; diff --git a/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp b/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp index 4f6ea40e..8928cfc2 100644 --- a/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp +++ b/src/Persistent_cohomology/example/periodic_alpha_complex_3d_persistence.cpp @@ -20,10 +20,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <boost/variant.hpp> + #include <gudhi/Simplex_tree.h> #include <gudhi/Persistent_cohomology.h> #include <gudhi/Points_3D_off_io.h> -#include <boost/variant.hpp> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h> @@ -31,8 +32,6 @@ #include <CGAL/Alpha_shape_3.h> #include <CGAL/iterator.h> -#include "alpha_complex_3d_helper.h" - #include <fstream> #include <cmath> #include <string> @@ -43,6 +42,8 @@ #include <vector> #include <cstdlib> +#include "alpha_complex_3d_helper.h" + // Traits using K = CGAL::Exact_predicates_inexact_constructions_kernel; using PK = CGAL::Periodic_3_Delaunay_triangulation_traits_3<K>; diff --git a/src/Persistent_cohomology/example/plain_homology.cpp b/src/Persistent_cohomology/example/plain_homology.cpp index ae82c817..50f692f2 100644 --- a/src/Persistent_cohomology/example/plain_homology.cpp +++ b/src/Persistent_cohomology/example/plain_homology.cpp @@ -27,13 +27,11 @@ #include <vector> #include <cstdint> // for std::uint8_t -using namespace Gudhi; - /* We could perfectly well use the default Simplex_tree<> (which uses * Simplex_tree_options_full_featured), the following simply demonstrates * how to save on storage by not storing a filtration value. */ -struct MyOptions : Simplex_tree_options_full_featured { +struct MyOptions : Gudhi::Simplex_tree_options_full_featured { // Implicitly use 0 as filtration value for all simplices static const bool store_filtration = false; // The persistence algorithm needs this @@ -43,7 +41,10 @@ struct MyOptions : Simplex_tree_options_full_featured { // Maximum number of simplices to compute persistence is 2^8 - 1 = 255. One is reserved for null_key typedef std::uint8_t Simplex_key; }; -typedef Simplex_tree<MyOptions> ST; + +using ST = Gudhi::Simplex_tree<MyOptions>; +using Field_Zp = Gudhi::persistent_cohomology::Field_Zp; +using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomology<ST, Field_Zp>; int main() { ST st; @@ -70,7 +71,7 @@ int main() { st.initialize_filtration(); // Class for homology computation - persistent_cohomology::Persistent_cohomology<ST, persistent_cohomology::Field_Zp> pcoh(st); + Persistent_cohomology pcoh(st); // Initialize the coefficient field Z/2Z for homology pcoh.init_coefficients(2); diff --git a/src/Persistent_cohomology/example/weighted_alpha_complex_3d_persistence.cpp b/src/Persistent_cohomology/example/weighted_alpha_complex_3d_persistence.cpp index 5203548a..34b90933 100644 --- a/src/Persistent_cohomology/example/weighted_alpha_complex_3d_persistence.cpp +++ b/src/Persistent_cohomology/example/weighted_alpha_complex_3d_persistence.cpp @@ -20,10 +20,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <boost/variant.hpp> + #include <gudhi/Simplex_tree.h> #include <gudhi/Persistent_cohomology.h> #include <gudhi/Points_3D_off_io.h> -#include <boost/variant.hpp> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Regular_triangulation_euclidean_traits_3.h> @@ -31,8 +32,6 @@ #include <CGAL/Alpha_shape_3.h> #include <CGAL/iterator.h> -#include "alpha_complex_3d_helper.h" - #include <fstream> #include <cmath> #include <string> @@ -43,13 +42,15 @@ #include <vector> #include <cstdlib> +#include "alpha_complex_3d_helper.h" + // Traits using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel; using Gt = CGAL::Regular_triangulation_euclidean_traits_3<Kernel>; using Vb = CGAL::Alpha_shape_vertex_base_3<Gt>; using Fb = CGAL::Alpha_shape_cell_base_3<Gt>; using Tds = CGAL::Triangulation_data_structure_3<Vb, Fb>; -using Triangulation_3 = CGAL::Regular_triangulation_3<Gt,Tds>; +using Triangulation_3 = CGAL::Regular_triangulation_3<Gt, Tds>; using Alpha_shape_3 = CGAL::Alpha_shape_3<Triangulation_3>; // From file type definition @@ -115,8 +116,7 @@ int main(int argc, char * const argv[]) { double weight = 0.0; std::size_t index = 0; // Attempt read the weight in a double format, return false if it fails - while((weights_ifstr >> weight) && (index < lp.size())) - { + while ((weights_ifstr >> weight) && (index < lp.size())) { wp.push_back(Weighted_point_3(lp[index], weight)); index++; } diff --git a/src/Simplex_tree/example/mini_simplex_tree.cpp b/src/Simplex_tree/example/mini_simplex_tree.cpp index 7e48aaaf..ad99df23 100644 --- a/src/Simplex_tree/example/mini_simplex_tree.cpp +++ b/src/Simplex_tree/example/mini_simplex_tree.cpp @@ -24,19 +24,18 @@ #include <iostream> #include <initializer_list> -using namespace Gudhi; - -struct MyOptions : Simplex_tree_options_full_featured { +struct MyOptions : Gudhi::Simplex_tree_options_full_featured { // Not doing persistence, so we don't need those static const bool store_key = false; static const bool store_filtration = false; // I have few vertices typedef short Vertex_handle; }; -typedef Simplex_tree<MyOptions> ST; + +using ST = Gudhi::Simplex_tree<MyOptions>; // Dictionary should be private, but for now this is the easiest way. -static_assert(sizeof(ST::Dictionary::value_type) < sizeof(Simplex_tree<>::Dictionary::value_type), +static_assert(sizeof(ST::Dictionary::value_type) < sizeof(Gudhi::Simplex_tree<>::Dictionary::value_type), "Not storing the filtration and key should save some space"); int main() { diff --git a/src/Spatial_searching/test/CMakeLists.txt b/src/Spatial_searching/test/CMakeLists.txt index 2c685c72..bdc95e4a 100644 --- a/src/Spatial_searching/test/CMakeLists.txt +++ b/src/Spatial_searching/test/CMakeLists.txt @@ -10,16 +10,12 @@ if (GPROF_PATH) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") endif() -if(CGAL_FOUND) - if (NOT CGAL_VERSION VERSION_LESS 4.8.1) - if (EIGEN3_FOUND) - add_executable( Spatial_searching_test_Kd_tree_search test_Kd_tree_search.cpp ) - target_link_libraries(Spatial_searching_test_Kd_tree_search - ${CGAL_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) + add_executable( Spatial_searching_test_Kd_tree_search test_Kd_tree_search.cpp ) + target_link_libraries(Spatial_searching_test_Kd_tree_search + ${CGAL_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) - add_test(Spatial_searching_test_Kd_tree_search ${CMAKE_CURRENT_BINARY_DIR}/Spatial_searching_test_Kd_tree_search - # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Spatial_searching_UT.xml --log_level=test_suite --report_level=no) - endif() - endif () -endif() + add_test(Spatial_searching_test_Kd_tree_search ${CMAKE_CURRENT_BINARY_DIR}/Spatial_searching_test_Kd_tree_search + # XML format for Jenkins xUnit plugin + --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Spatial_searching_UT.xml --log_level=test_suite --report_level=no) +endif () diff --git a/src/Subsampling/example/CMakeLists.txt b/src/Subsampling/example/CMakeLists.txt index 0fd3335c..bb043297 100644 --- a/src/Subsampling/example/CMakeLists.txt +++ b/src/Subsampling/example/CMakeLists.txt @@ -1,21 +1,17 @@ cmake_minimum_required(VERSION 2.6) project(Subsampling_examples) -if(CGAL_FOUND) - if (NOT CGAL_VERSION VERSION_LESS 4.8.1) - if (EIGEN3_FOUND) - add_executable(Subsampling_example_pick_n_random_points example_pick_n_random_points.cpp) - add_executable(Subsampling_example_choose_n_farthest_points example_choose_n_farthest_points.cpp) - add_executable(Subsampling_example_custom_kernel example_custom_kernel.cpp) - add_executable(Subsampling_example_sparsify_point_set example_sparsify_point_set.cpp) - target_link_libraries(Subsampling_example_sparsify_point_set ${CGAL_LIBRARY}) +if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) + add_executable(Subsampling_example_pick_n_random_points example_pick_n_random_points.cpp) + add_executable(Subsampling_example_choose_n_farthest_points example_choose_n_farthest_points.cpp) + add_executable(Subsampling_example_custom_kernel example_custom_kernel.cpp) + add_executable(Subsampling_example_sparsify_point_set example_sparsify_point_set.cpp) + target_link_libraries(Subsampling_example_sparsify_point_set ${CGAL_LIBRARY}) - add_test(Subsampling_example_pick_n_random_points - ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_example_pick_n_random_points) - add_test(Subsampling_example_choose_n_farthest_points - ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_example_choose_n_farthest_points) - add_test(Subsampling_example_sparsify_point_set - ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_example_sparsify_point_set) - endif() - endif () -endif() + add_test(Subsampling_example_pick_n_random_points + ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_example_pick_n_random_points) + add_test(Subsampling_example_choose_n_farthest_points + ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_example_choose_n_farthest_points) + add_test(Subsampling_example_sparsify_point_set + ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_example_sparsify_point_set) +endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Subsampling/test/CMakeLists.txt b/src/Subsampling/test/CMakeLists.txt index 3a2fb649..5517fe9d 100644 --- a/src/Subsampling/test/CMakeLists.txt +++ b/src/Subsampling/test/CMakeLists.txt @@ -10,29 +10,25 @@ if (GPROF_PATH) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") endif() -if(CGAL_FOUND) - if (NOT CGAL_VERSION VERSION_LESS 4.8.1) - if (EIGEN3_FOUND) - add_executable( Subsampling_test_pick_n_random_points test_pick_n_random_points.cpp ) - target_link_libraries(Subsampling_test_pick_n_random_points ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) + add_executable( Subsampling_test_pick_n_random_points test_pick_n_random_points.cpp ) + target_link_libraries(Subsampling_test_pick_n_random_points ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) - add_executable( Subsampling_test_choose_n_farthest_points test_choose_n_farthest_points.cpp ) - target_link_libraries(Subsampling_test_choose_n_farthest_points ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + add_executable( Subsampling_test_choose_n_farthest_points test_choose_n_farthest_points.cpp ) + target_link_libraries(Subsampling_test_choose_n_farthest_points ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) - add_executable(Subsampling_test_sparsify_point_set test_sparsify_point_set.cpp) - target_link_libraries(Subsampling_test_sparsify_point_set ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + add_executable(Subsampling_test_sparsify_point_set test_sparsify_point_set.cpp) + target_link_libraries(Subsampling_test_sparsify_point_set ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) - add_test(Subsampling_test_pick_n_random_points ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_test_pick_n_random_points - # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Subsampling_test_pick_n_random_points_UT.xml --log_level=test_suite --report_level=no) + add_test(Subsampling_test_pick_n_random_points ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_test_pick_n_random_points + # XML format for Jenkins xUnit plugin + --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Subsampling_test_pick_n_random_points_UT.xml --log_level=test_suite --report_level=no) - add_test(Subsampling_test_choose_n_farthest_points ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_test_choose_n_farthest_points - # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Subsampling_test_choose_n_farthest_points_UT.xml --log_level=test_suite --report_level=no) + add_test(Subsampling_test_choose_n_farthest_points ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_test_choose_n_farthest_points + # XML format for Jenkins xUnit plugin + --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Subsampling_test_choose_n_farthest_points_UT.xml --log_level=test_suite --report_level=no) - add_test(Subsampling_test_sparsify_point_set ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_test_sparsify_point_set - # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Subsampling_test_sparsify_point_set_UT.xml --log_level=test_suite --report_level=no) - endif() - endif () -endif() + add_test(Subsampling_test_sparsify_point_set ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_test_sparsify_point_set + # XML format for Jenkins xUnit plugin + --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Subsampling_test_sparsify_point_set_UT.xml --log_level=test_suite --report_level=no) +endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Tangential_complex/benchmark/CMakeLists.txt b/src/Tangential_complex/benchmark/CMakeLists.txt index 788c2b4d..ef772be8 100644 --- a/src/Tangential_complex/benchmark/CMakeLists.txt +++ b/src/Tangential_complex/benchmark/CMakeLists.txt @@ -1,17 +1,11 @@ cmake_minimum_required(VERSION 2.6) project(Tangential_complex_benchmark) -# need CGAL 4.8 -if(CGAL_FOUND) - if (NOT CGAL_VERSION VERSION_LESS 4.8.0) - if (EIGEN3_FOUND) - add_executable(Tangential_complex_benchmark benchmark_tc.cpp) - target_link_libraries(Tangential_complex_benchmark - ${Boost_DATE_TIME_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY}) - if (TBB_FOUND) - target_link_libraries(Tangential_complex_benchmark ${TBB_LIBRARIES}) - endif(TBB_FOUND) - endif(EIGEN3_FOUND) - endif (NOT CGAL_VERSION VERSION_LESS 4.8.0) -endif(CGAL_FOUND) - +if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) + add_executable(Tangential_complex_benchmark benchmark_tc.cpp) + target_link_libraries(Tangential_complex_benchmark + ${Boost_DATE_TIME_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY}) + if (TBB_FOUND) + target_link_libraries(Tangential_complex_benchmark ${TBB_LIBRARIES}) + endif(TBB_FOUND) +endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Tangential_complex/example/CMakeLists.txt b/src/Tangential_complex/example/CMakeLists.txt index a75ccd5b..47a56e3b 100644 --- a/src/Tangential_complex/example/CMakeLists.txt +++ b/src/Tangential_complex/example/CMakeLists.txt @@ -1,23 +1,19 @@ cmake_minimum_required(VERSION 2.6) project(Tangential_complex_examples) -if(CGAL_FOUND) - if (NOT CGAL_VERSION VERSION_LESS 4.8.0) - if (EIGEN3_FOUND) - add_executable( Tangential_complex_example_basic example_basic.cpp ) - target_link_libraries(Tangential_complex_example_basic ${CGAL_LIBRARY} ${Boost_DATE_TIME_LIBRARY}) - add_executable( Tangential_complex_example_with_perturb example_with_perturb.cpp ) - target_link_libraries(Tangential_complex_example_with_perturb ${CGAL_LIBRARY} ${Boost_DATE_TIME_LIBRARY}) - if (TBB_FOUND) - target_link_libraries(Tangential_complex_example_basic ${TBB_LIBRARIES}) - target_link_libraries(Tangential_complex_example_with_perturb ${TBB_LIBRARIES}) - endif(TBB_FOUND) +if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) + add_executable( Tangential_complex_example_basic example_basic.cpp ) + target_link_libraries(Tangential_complex_example_basic ${CGAL_LIBRARY} ${Boost_DATE_TIME_LIBRARY}) + add_executable( Tangential_complex_example_with_perturb example_with_perturb.cpp ) + target_link_libraries(Tangential_complex_example_with_perturb ${CGAL_LIBRARY} ${Boost_DATE_TIME_LIBRARY}) + if (TBB_FOUND) + target_link_libraries(Tangential_complex_example_basic ${TBB_LIBRARIES}) + target_link_libraries(Tangential_complex_example_with_perturb ${TBB_LIBRARIES}) + endif(TBB_FOUND) - add_test(Tangential_complex_example_basic - ${CMAKE_CURRENT_BINARY_DIR}/Tangential_complex_example_basic) + add_test(Tangential_complex_example_basic + ${CMAKE_CURRENT_BINARY_DIR}/Tangential_complex_example_basic) - add_test(Tangential_complex_example_with_perturb - ${CMAKE_CURRENT_BINARY_DIR}/Tangential_complex_example_with_perturb) - endif(EIGEN3_FOUND) - endif(NOT CGAL_VERSION VERSION_LESS 4.8.0) -endif(CGAL_FOUND) + add_test(Tangential_complex_example_with_perturb + ${CMAKE_CURRENT_BINARY_DIR}/Tangential_complex_example_with_perturb) +endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Tangential_complex/test/CMakeLists.txt b/src/Tangential_complex/test/CMakeLists.txt index 075028c8..b2bf5dd7 100644 --- a/src/Tangential_complex/test/CMakeLists.txt +++ b/src/Tangential_complex/test/CMakeLists.txt @@ -10,22 +10,14 @@ if (GPROF_PATH) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") endif() -if(CGAL_FOUND) - if (NOT CGAL_VERSION VERSION_LESS 4.8.0) - if (EIGEN3_FOUND) - message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.") - include( ${EIGEN3_USE_FILE} ) - include_directories (BEFORE "../../include") +if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) + add_executable( Tangential_complex_test_TC test_tangential_complex.cpp ) + target_link_libraries(Tangential_complex_test_TC ${CGAL_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + if (TBB_FOUND) + target_link_libraries(Tangential_complex_test_TC ${TBB_LIBRARIES}) + endif() + add_test(Tangential_complex_test_TC ${CMAKE_CURRENT_BINARY_DIR}/Tangential_complex_test_TC + # XML format for Jenkins xUnit plugin + --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Tangential_complex_UT.xml --log_level=test_suite --report_level=no) - add_executable( Tangential_complex_test_TC test_tangential_complex.cpp ) - target_link_libraries(Tangential_complex_test_TC ${CGAL_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) - if (TBB_FOUND) - target_link_libraries(Tangential_complex_test_TC ${TBB_LIBRARIES}) - endif() - add_test(Tangential_complex_test_TC ${CMAKE_CURRENT_BINARY_DIR}/Tangential_complex_test_TC - # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Tangential_complex_UT.xml --log_level=test_suite --report_level=no) - - endif() - endif () -endif()
\ No newline at end of file +endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Witness_complex/example/CMakeLists.txt b/src/Witness_complex/example/CMakeLists.txt index 9990c541..549a85be 100644 --- a/src/Witness_complex/example/CMakeLists.txt +++ b/src/Witness_complex/example/CMakeLists.txt @@ -9,40 +9,36 @@ endif() add_test(Witness_complex_test_nearest_landmark_table Witness_complex_example_nearest_landmark_table) # CGAL and Eigen3 are required for Euclidean version of Witness -if(CGAL_FOUND) - if (NOT CGAL_VERSION VERSION_LESS 4.6.0) - if (EIGEN3_FOUND) - add_executable( Witness_complex_example_off example_witness_complex_off.cpp ) - target_link_libraries(Witness_complex_example_off ${Boost_SYSTEM_LIBRARY}) - add_executable( Witness_complex_example_strong_off example_strong_witness_complex_off.cpp ) - target_link_libraries(Witness_complex_example_strong_off ${Boost_SYSTEM_LIBRARY}) - add_executable ( Witness_complex_example_sphere example_witness_complex_sphere.cpp ) - target_link_libraries(Witness_complex_example_sphere ${Boost_SYSTEM_LIBRARY}) +if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) + add_executable( Witness_complex_example_off example_witness_complex_off.cpp ) + target_link_libraries(Witness_complex_example_off ${Boost_SYSTEM_LIBRARY}) + add_executable( Witness_complex_example_strong_off example_strong_witness_complex_off.cpp ) + target_link_libraries(Witness_complex_example_strong_off ${Boost_SYSTEM_LIBRARY}) + add_executable ( Witness_complex_example_sphere example_witness_complex_sphere.cpp ) + target_link_libraries(Witness_complex_example_sphere ${Boost_SYSTEM_LIBRARY}) - add_executable ( Witness_complex_example_witness_persistence example_witness_complex_persistence.cpp ) - target_link_libraries(Witness_complex_example_witness_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}) + add_executable ( Witness_complex_example_witness_persistence example_witness_complex_persistence.cpp ) + target_link_libraries(Witness_complex_example_witness_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}) - add_executable ( Witness_complex_example_strong_witness_persistence example_strong_witness_persistence.cpp ) - target_link_libraries(Witness_complex_example_strong_witness_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}) + add_executable ( Witness_complex_example_strong_witness_persistence example_strong_witness_persistence.cpp ) + target_link_libraries(Witness_complex_example_strong_witness_persistence ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}) - if (TBB_FOUND) - target_link_libraries(Witness_complex_example_witness_persistence ${TBB_LIBRARIES}) - target_link_libraries(Witness_complex_example_strong_witness_persistence ${TBB_LIBRARIES}) - endif() + if (TBB_FOUND) + target_link_libraries(Witness_complex_example_witness_persistence ${TBB_LIBRARIES}) + target_link_libraries(Witness_complex_example_strong_witness_persistence ${TBB_LIBRARIES}) + endif() - add_test(Witness_complex_off_test_torus - ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_example_off - ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off 20 1.0 3) - add_test(Witness_complex_strong_off_test_torus - ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_example_strong_off - ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off 20 1.0 3) - add_test(Witness_complex_test_sphere_10 Witness_complex_example_sphere 10) - add_test(Witness_complex_test_torus_persistence - ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_example_witness_persistence - ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off -l 20 -a 0.5) - add_test(Witness_complex_strong_test_torus_persistence - ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_example_strong_witness_persistence - ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off -l 20 -a 0.5) - endif(EIGEN3_FOUND) - endif (NOT CGAL_VERSION VERSION_LESS 4.6.0) -endif() + add_test(Witness_complex_off_test_torus + ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_example_off + ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off 20 1.0 3) + add_test(Witness_complex_strong_off_test_torus + ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_example_strong_off + ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off 20 1.0 3) + add_test(Witness_complex_test_sphere_10 Witness_complex_example_sphere 10) + add_test(Witness_complex_test_torus_persistence + ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_example_witness_persistence + ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off -l 20 -a 0.5) + add_test(Witness_complex_strong_test_torus_persistence + ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_example_strong_witness_persistence + ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off -l 20 -a 0.5) +endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) diff --git a/src/Witness_complex/example/example_nearest_landmark_table.cpp b/src/Witness_complex/example/example_nearest_landmark_table.cpp index 7084d416..b8594212 100644 --- a/src/Witness_complex/example/example_nearest_landmark_table.cpp +++ b/src/Witness_complex/example/example_nearest_landmark_table.cpp @@ -23,7 +23,7 @@ #define BOOST_PARAMETER_MAX_ARITY 12 #include <gudhi/Simplex_tree.h> -#include <gudhi/Strong_witness_complex.h> +#include <gudhi/Witness_complex.h> #include <gudhi/Persistent_cohomology.h> #include <iostream> @@ -35,7 +35,7 @@ int main(int argc, char * const argv[]) { using Nearest_landmark_range = std::vector<std::pair<std::size_t, double>>; using Nearest_landmark_table = std::vector<Nearest_landmark_range>; - using Witness_complex = Gudhi::witness_complex::Strong_witness_complex<Nearest_landmark_table>; + using Witness_complex = Gudhi::witness_complex::Witness_complex<Nearest_landmark_table>; using Simplex_tree = Gudhi::Simplex_tree<>; using Field_Zp = Gudhi::persistent_cohomology::Field_Zp; using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomology<Simplex_tree, Field_Zp>; @@ -56,7 +56,7 @@ int main(int argc, char * const argv[]) { std::make_pair(2, 3), std::make_pair(3, 4)}; nlt.push_back(w4); Witness_complex witness_complex(nlt); - witness_complex.create_complex(simplex_tree, 4.1, 2); + witness_complex.create_complex(simplex_tree, 4.1); std::cout << "Number of simplices: " << simplex_tree.num_simplices() << std::endl; diff --git a/src/Witness_complex/example/example_witness_complex_sphere.cpp b/src/Witness_complex/example/example_witness_complex_sphere.cpp index 06fe3889..124fd99b 100644 --- a/src/Witness_complex/example/example_witness_complex_sphere.cpp +++ b/src/Witness_complex/example/example_witness_complex_sphere.cpp @@ -60,12 +60,12 @@ int main(int argc, char * const argv[]) { } int number_of_landmarks = atoi(argv[1]); - clock_t start, end; std::vector< std::pair<int, double> > l_time; // Generate points for (int nbP = 500; nbP < 10000; nbP += 500) { + clock_t start, end; // Construct the Simplex Tree Gudhi::Simplex_tree<> simplex_tree; Point_Vector point_vector, landmarks; diff --git a/src/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h index e2791f76..63f03687 100644 --- a/src/Witness_complex/include/gudhi/Witness_complex.h +++ b/src/Witness_complex/include/gudhi/Witness_complex.h @@ -178,7 +178,7 @@ class Witness_complex { norelax_dist2 = l_it->second; } } else if (dim == 0) { - for (;l_it != end && l_it->second - alpha2 <= norelax_dist2; ++l_it) { + for (; l_it != end && l_it->second - alpha2 <= norelax_dist2; ++l_it) { simplex.push_back(l_it->first); double filtration_value = 0; // if norelax_dist is infinite, relaxation is 0. diff --git a/src/Witness_complex/test/CMakeLists.txt b/src/Witness_complex/test/CMakeLists.txt index 12b3be56..e73f9c3a 100644 --- a/src/Witness_complex/test/CMakeLists.txt +++ b/src/Witness_complex/test/CMakeLists.txt @@ -23,20 +23,16 @@ add_test(NAME simple_witness_complex --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Witness_complex_test_simple_witness_complexUT.xml --log_level=test_suite --report_level=no) # CGAL and Eigen3 are required for Euclidean version of Witness -if(CGAL_FOUND) - if (NOT CGAL_VERSION VERSION_LESS 4.6.0) - if (EIGEN3_FOUND) - add_executable ( Witness_complex_test_euclidean_simple_witness_complex test_euclidean_simple_witness_complex.cpp ) - target_link_libraries(Witness_complex_test_euclidean_simple_witness_complex ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) - if (TBB_FOUND) - target_link_libraries(Witness_complex_test_euclidean_simple_witness_complex ${TBB_LIBRARIES}) - endif(TBB_FOUND) +if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) + add_executable ( Witness_complex_test_euclidean_simple_witness_complex test_euclidean_simple_witness_complex.cpp ) + target_link_libraries(Witness_complex_test_euclidean_simple_witness_complex ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + if (TBB_FOUND) + target_link_libraries(Witness_complex_test_euclidean_simple_witness_complex ${TBB_LIBRARIES}) + endif(TBB_FOUND) - # Unitary tests definition and xml result file generation - add_test(NAME euclidean_simple_witness_complex - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_test_euclidean_simple_witness_complex - # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Witness_complex_test_euclidean_simple_witness_complexUT.xml --log_level=test_suite --report_level=no) - endif(EIGEN3_FOUND) - endif (NOT CGAL_VERSION VERSION_LESS 4.6.0) -endif() + # Unitary tests definition and xml result file generation + add_test(NAME euclidean_simple_witness_complex + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_test_euclidean_simple_witness_complex + # XML format for Jenkins xUnit plugin + --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Witness_complex_test_euclidean_simple_witness_complexUT.xml --log_level=test_suite --report_level=no) +endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) diff --git a/src/cmake/modules/GUDHI_third_party_libraries.txt b/src/cmake/modules/GUDHI_third_party_libraries.txt new file mode 100644 index 00000000..1974f70f --- /dev/null +++ b/src/cmake/modules/GUDHI_third_party_libraries.txt @@ -0,0 +1,107 @@ +# This files manage third party libraries required by GUDHI + +find_package(Boost REQUIRED COMPONENTS system filesystem unit_test_framework chrono timer date_time program_options thread) + +if(NOT Boost_FOUND) + message(FATAL_ERROR "NOTICE: This program requires Boost and will not be compiled.") +endif(NOT Boost_FOUND) + +find_package(GMP) +if(GMP_FOUND) + message(STATUS "GMP_LIBRARIES = ${GMP_LIBRARIES}") + INCLUDE_DIRECTORIES(${GMP_INCLUDE_DIR}) + find_package(GMPXX) + if(GMPXX_FOUND) + message(STATUS "GMPXX_LIBRARIES = ${GMPXX_LIBRARIES}") + INCLUDE_DIRECTORIES(${GMPXX_INCLUDE_DIR}) + endif() +endif() + +# In CMakeLists.txt, when include(${CGAL_USE_FILE}), CMAKE_CXX_FLAGS are overwritten. +# cf. http://doc.cgal.org/latest/Manual/installation.html#title40 +# A workaround is to include(${CGAL_USE_FILE}) before adding "-std=c++11". +# A fix would be to use https://cmake.org/cmake/help/v3.1/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html +# or even better https://cmake.org/cmake/help/v3.1/variable/CMAKE_CXX_STANDARD.html +# but it implies to use cmake version 3.1 at least. +find_package(CGAL) + +# Only CGAL versions > 4.4 supports what Gudhi uses from CGAL +if (CGAL_VERSION VERSION_LESS 4.4.0) + message("CGAL version ${CGAL_VERSION} is considered too old to be used by Gudhi.") + unset(CGAL_FOUND) +endif() +if(CGAL_FOUND) + message(STATUS "CGAL version: ${CGAL_VERSION}.") + include( ${CGAL_USE_FILE} ) + + if (NOT CGAL_VERSION VERSION_LESS 4.8.0) + # HACK to detect CGAL version 4.8.0 + # CGAL version 4.8, 4.8.1 and 4.8.2 are identified as version 4.8.1000) + # cf. https://github.com/CGAL/cgal/issues/1559 + # Limit the HACK between CGAL versions 4.8 and 4.9 because of file read + if (NOT CGAL_VERSION VERSION_GREATER 4.9.0) + foreach(CGAL_INCLUDE_DIR ${CGAL_INCLUDE_DIRS}) + if (EXISTS "${CGAL_INCLUDE_DIR}/CGAL/version.h") + FILE(READ "${CGAL_INCLUDE_DIR}/CGAL/version.h" contents) + STRING(REGEX REPLACE "\n" ";" contents "${contents}") + foreach(Line ${contents}) + if("${Line}" STREQUAL "#define CGAL_VERSION 4.8") + set(CGAL_VERSION 4.8.0) + message (">>>>> HACK CGAL version to ${CGAL_VERSION}") + endif("${Line}" STREQUAL "#define CGAL_VERSION 4.8") + endforeach(Line ${contents}) + endif (EXISTS "${CGAL_INCLUDE_DIR}/CGAL/version.h") + endforeach(CGAL_INCLUDE_DIR ${CGAL_INCLUDE_DIRS}) + endif(NOT CGAL_VERSION VERSION_GREATER 4.9.0) + + # For dev version + include_directories(BEFORE "src/common/include/gudhi_patches") + # For user version + include_directories(BEFORE "include/gudhi_patches") + endif() +endif() + +# Find TBB package for parallel sort - not mandatory, just optional. +set(TBB_FIND_QUIETLY ON) +find_package(TBB) +if (TBB_FOUND) + include(${TBB_USE_FILE}) + message("TBB found in ${TBB_LIBRARY_DIRS}") + add_definitions(-DGUDHI_USE_TBB) +endif() + +set(CGAL_WITH_EIGEN3_VERSION 0.0.0) +find_package(Eigen3 3.1.0) +if (EIGEN3_FOUND) + message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.") + include( ${EIGEN3_USE_FILE} ) + set(CGAL_WITH_EIGEN3_VERSION ${CGAL_VERSION}) +endif (EIGEN3_FOUND) + +# Required programs for unitary tests purpose +FIND_PROGRAM( GCOVR_PATH gcovr ) +if (GCOVR_PATH) + message("gcovr found in ${GCOVR_PATH}") +endif() +# Required programs for unitary tests purpose +FIND_PROGRAM( GPROF_PATH gprof ) +if (GPROF_PATH) + message("gprof found in ${GPROF_PATH}") +endif() +FIND_PROGRAM( DIFF_PATH diff ) +if (DIFF_PATH) + message("diff found in ${DIFF_PATH}") +endif() + +# BOOST ISSUE result_of vs C++11 +add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE) +# BOOST ISSUE with Libraries name resolution under Windows +add_definitions(-DBOOST_ALL_NO_LIB) +# problem with Visual Studio link on Boost program_options +add_definitions( -DBOOST_ALL_DYN_LINK ) + +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) +LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) + +message(STATUS "boost include dirs:" ${Boost_INCLUDE_DIRS}) +message(STATUS "boost library dirs:" ${Boost_LIBRARY_DIRS}) diff --git a/src/common/doc/main_page.h b/src/common/doc/main_page.h index 593faea5..e6f29fa8 100644 --- a/src/common/doc/main_page.h +++ b/src/common/doc/main_page.h @@ -122,7 +122,7 @@ <b>Author:</b> Clément Jamin<br> <b>Introduced in:</b> GUDHI 2.0.0<br> <b>Copyright:</b> GPL v3<br> - <b>Requires:</b> \ref cgal ≥ 4.8.0 and \ref eigen3 + <b>Requires:</b> \ref cgal ≥ 4.8.1 and \ref eigen3 </td> <td width="75%"> A Tangential Delaunay complex is a <a target="_blank" href="https://en.wikipedia.org/wiki/Simplicial_complex">simplicial complex</a> @@ -161,7 +161,7 @@ <b>Author:</b> François Godi<br> <b>Introduced in:</b> GUDHI 2.0.0<br> <b>Copyright:</b> GPL v3<br> - <b>Requires:</b> \ref cgal ≥ 4.8.0 and \ref eigen3 + <b>Requires:</b> \ref cgal ≥ 4.8.1 and \ref eigen3 </td> <td width="75%"> Bottleneck distance measures the similarity between two persistence diagrams. @@ -297,11 +297,27 @@ make doxygen * \li <a href="_persistent_cohomology_2custom_persistence_sort_8cpp-example.html"> * Persistent_cohomology/custom_persistence_sort.cpp</a> * - * The following example requires CGAL version ≥ 4.8.0: - * \li <a href="_bottleneck_distance_2_bottleneck_basic_example_8cpp-example.html"> + * The following example requires CGAL version ≥ 4.8.1: + * \li <a href="_bottleneck_distance_2alpha_rips_persistence_bottleneck_distance_8cpp-example.html"> + * Bottleneck_distance/alpha_rips_persistence_bottleneck_distance.cpp.cpp</a> + * \li <a href="_bottleneck_distance_2bottleneck_basic_example_8cpp-example.html"> * Bottleneck_distance/bottleneck_basic_example.cpp</a> - * \li <a href="_bottleneck_distance_2_bottleneck_read_file_example_8cpp-example.html"> + * \li <a href="_bottleneck_distance_2bottleneck_read_file_example_8cpp-example.html"> * Bottleneck_distance/bottleneck_read_file_example.cpp</a> + * \li <a href="_spatial_searching_2example_spatial_searching_8cpp-example.html"> + * Spatial_searching/example_spatial_searching.cpp</a> + * \li <a href="_subsampling_2example_choose_n_farthest_points_8cpp-example.html"> + * Subsampling/example_choose_n_farthest_points.cpp</a> + * \li <a href="_subsampling_2example_custom_kernel_8cpp-example.html"> + * Subsampling/example_custom_kernel.cpp</a> + * \li <a href="_subsampling_2example_pick_n_random_points_8cpp-example.html"> + * Subsampling/example_pick_n_random_points.cpp</a> + * \li <a href="_subsampling_2example_sparsify_point_set_8cpp-example.html"> + * Subsampling/example_sparsify_point_set.cpp</a> + * \li <a href="_tangential_complex_2example_basic_8cpp-example.html"> + * Tangential_complex/example_basic.cpp</a> + * \li <a href="_tangential_complex_2example_with_perturb_8cpp-example.html"> + * Tangential_complex/example_with_perturb.cpp</a> * * \subsection eigen3 Eigen3 * The \ref alpha_complex data structure and few examples requires @@ -405,6 +421,7 @@ make doxygen /*! @file Examples * @example Alpha_complex/Alpha_complex_from_off.cpp * @example Alpha_complex/Alpha_complex_from_points.cpp + * @example Bottleneck_distance/alpha_rips_persistence_bottleneck_distance.cpp * @example Bottleneck_distance/bottleneck_basic_example.cpp * @example Bottleneck_distance/bottleneck_read_file_example.cpp * @example Bitmap_cubical_complex/Bitmap_cubical_complex.cpp @@ -437,6 +454,11 @@ make doxygen * @example Skeleton_blocker/Skeleton_blocker_from_simplices.cpp * @example Skeleton_blocker/Skeleton_blocker_iteration.cpp * @example Skeleton_blocker/Skeleton_blocker_link.cpp + * @example Spatial_searching/example_spatial_searching.cpp + * @example Subsampling/example_choose_n_farthest_points.cpp + * @example Subsampling/example_custom_kernel.cpp + * @example Subsampling/example_pick_n_random_points.cpp + * @example Subsampling/example_sparsify_point_set.cpp * @example Tangential_complex/example_basic.cpp * @example Tangential_complex/example_with_perturb.cpp * @example Witness_complex/example_nearest_landmark_table.cpp diff --git a/src/common/example/CMakeLists.txt b/src/common/example/CMakeLists.txt index b0c6d69a..61c94391 100644 --- a/src/common/example/CMakeLists.txt +++ b/src/common/example/CMakeLists.txt @@ -10,12 +10,10 @@ if(CGAL_FOUND) target_link_libraries(cgal_3D_off_reader ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY}) add_test(cgal_3D_off_reader ${CMAKE_CURRENT_BINARY_DIR}/cgal_3D_off_reader ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off) - # need CGAL 4.7 - if (NOT CGAL_VERSION VERSION_LESS 4.7.0) - if (EIGEN3_FOUND) - add_executable ( cgal_off_reader example_CGAL_points_off_reader.cpp ) - target_link_libraries(cgal_off_reader ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY}) - add_test(cgal_off_reader ${CMAKE_CURRENT_BINARY_DIR}/cgal_off_reader ${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off) - endif(EIGEN3_FOUND) - endif (NOT CGAL_VERSION VERSION_LESS 4.7.0) + # need CGAL 4.7and Eigen3 + if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) + add_executable ( cgal_off_reader example_CGAL_points_off_reader.cpp ) + target_link_libraries(cgal_off_reader ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY}) + add_test(cgal_off_reader ${CMAKE_CURRENT_BINARY_DIR}/cgal_off_reader ${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off) + endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) endif() diff --git a/src/common/include/gudhi/distance_functions.h b/src/common/include/gudhi/distance_functions.h index 7bf97c23..22747637 100644 --- a/src/common/include/gudhi/distance_functions.h +++ b/src/common/include/gudhi/distance_functions.h @@ -24,8 +24,8 @@ #define DISTANCE_FUNCTIONS_H_ #include <cmath> // for std::sqrt -#include <type_traits> // for std::decay -#include <iterator> // for std::begin, std::end +#include <type_traits> // for std::decay +#include <iterator> // for std::begin, std::end /** @file * @brief Global distance functions diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index 25cf952e..ba38fe3d 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -18,213 +18,201 @@ FIND_PROGRAM( PYTHON_PATH python ) FIND_PROGRAM( CYTHON_PATH cython ) if(PYTHON_PATH AND CYTHON_PATH) - find_package(Boost REQUIRED COMPONENTS system REQUIRED) - - if(NOT Boost_FOUND) - message(FATAL_ERROR "NOTICE: This demo requires Boost and will not be compiled.") - else(NOT Boost_FOUND) - - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_RESULT_OF_USE_DECLTYPE', ") - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_ALL_NO_LIB', ") - set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${Boost_LIBRARY_DIRS}', ") - if(WIN32) - set( returnValue "" ) - find_the_lib (${returnValue} ${Boost_SYSTEM_LIBRARY}) - set(BOOST_SYSTEM_LIB_NAME ${returnValue}) - else() - set(BOOST_SYSTEM_LIB_NAME "boost_system") - endif() - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'${BOOST_SYSTEM_LIB_NAME}', ") - - # Gudhi and CGAL compilation option - if(MSVC) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'/fp:strict', ") - else(MSVC) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-std=c++11', ") - endif(MSVC) - if(CMAKE_COMPILER_IS_GNUCXX) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-frounding-math', ") - endif(CMAKE_COMPILER_IS_GNUCXX) - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-fp-model strict', ") - endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") - if (DEBUG_TRACES) - # For programs to be more verbose - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DDEBUG_TRACES', ") - endif() - - find_package(Eigen3 3.1.0) - - if (EIGEN3_FOUND) - # No problem, even if no CGAL found - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_EIGEN3_ENABLED', ") - endif (EIGEN3_FOUND) - - # Copy recursively include, cython, example, doc and test repositories before packages finding - # Some tests and doc files are removed in case some packages are not found - file(COPY include DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - file(COPY cython DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - file(COPY example DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - file(COPY test DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - file(COPY doc DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - # Developper version for doc images - file(GLOB GUDHI_DEV_DOC_IMAGES "${CMAKE_SOURCE_DIR}/src/*/doc/*.png") - file(COPY ${GUDHI_DEV_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") - file(GLOB GUDHI_DEV_DOC_IMAGES "${CMAKE_SOURCE_DIR}/src/*/doc/*.svg") - file(COPY ${GUDHI_DEV_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") - # User version for doc images - file(GLOB GUDHI_USER_DOC_IMAGES "${CMAKE_SOURCE_DIR}/doc/*/*.png") - file(COPY ${GUDHI_USER_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") - file(GLOB GUDHI_USER_DOC_IMAGES "${CMAKE_SOURCE_DIR}/doc/*/*.svg") - file(COPY ${GUDHI_USER_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") - # Biblio - file(GLOB GUDHI_BIB_FILES "${CMAKE_SOURCE_DIR}/biblio/*.bib") - file(COPY ${GUDHI_BIB_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") - # Cubical complex perseus doc example - file(GLOB GUDHI_CUBICAL_PERSEUS_FILES "${CMAKE_SOURCE_DIR}/data/bitmap/*cubicalcomplexdoc.txt") - file(COPY ${GUDHI_CUBICAL_PERSEUS_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") - file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") - file(COPY "${CMAKE_SOURCE_DIR}/data/distance_matrix/full_square_distance_matrix.csv" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") - # Persistence graphical tools examples - file(COPY "${CMAKE_SOURCE_DIR}/data/bitmap/3d_torus.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") - file(COPY "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") - - if (NOT CGAL_VERSION VERSION_LESS 4.8.1) - # If CGAL_VERSION >= 4.8.1, include subsampling - # CGAL things are done in CGAL_VERSION >= 4.8.0 - set(GUDHI_CYTHON_SUBSAMPLING "include 'cython/subsampling.pyx'") - else (NOT CGAL_VERSION VERSION_LESS 4.8.1) - # Remove alpha complex unitary tests - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_subsampling.py) - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_ref.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_sum.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_user.rst") - endif (NOT CGAL_VERSION VERSION_LESS 4.8.1) - if (NOT CGAL_VERSION VERSION_LESS 4.8.0) - # If CGAL_VERSION >= 4.8.0, include tangential complex - set(GUDHI_CYTHON_TANGENTIAL_COMPLEX "include 'cython/tangential_complex.pyx'") - set(GUDHI_CYTHON_BOTTLENECK_DISTANCE "include 'cython/bottleneck_distance.pyx'") - else (NOT CGAL_VERSION VERSION_LESS 4.8.0) - # Remove tangential complex and bottleneck unitary tests - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_tangential_complex.py) - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_bottleneck_distance.py) - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_ref.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_sum.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_user.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_ref.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_sum.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_user.rst") - endif (NOT CGAL_VERSION VERSION_LESS 4.8.0) - if (NOT CGAL_VERSION VERSION_LESS 4.7.0) - # If CGAL_VERSION >= 4.7.0, include alpha - set(GUDHI_CYTHON_ALPHA_COMPLEX "include 'cython/alpha_complex.pyx'") - else (NOT CGAL_VERSION VERSION_LESS 4.7.0) - # Remove alpha complex unitary tests - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_alpha_complex.py) - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_ref.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_sum.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_user.rst") - endif (NOT CGAL_VERSION VERSION_LESS 4.7.0) - if (NOT CGAL_VERSION VERSION_LESS 4.6.0) - # If CGAL_VERSION >= 4.6.0, include euclidean versions of witness complex - set(GUDHI_CYTHON_EUCLIDEAN_WITNESS_COMPLEX - "include 'cython/euclidean_witness_complex.pyx'\ninclude 'cython/euclidean_strong_witness_complex.pyx'\n") - else (NOT CGAL_VERSION VERSION_LESS 4.6.0) - # Remove alpha complex unitary tests - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_euclidean_witness_complex.py) - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/euclidean_witness_complex_ref.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/euclidean_strong_witness_complex_ref.rst") - endif (NOT CGAL_VERSION VERSION_LESS 4.6.0) - - if(CGAL_FOUND) - # Add CGAL compilation args - if(CGAL_HEADER_ONLY) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_HEADER_ONLY', ") - else(CGAL_HEADER_ONLY) - if(WIN32) - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'CGAL-vc140-mt-4.7', ") - else(WIN32) - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'CGAL', ") - endif(WIN32) - set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${CGAL_LIBRARIES_DIR}', ") - endif(CGAL_HEADER_ONLY) - # GMP and GMPXX are not required, but if present, CGAL will link with them. - if(GMP_FOUND) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMP', ") - if(WIN32) - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'libgmp-10', ") - else(WIN32) - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'gmp', ") - endif(WIN32) - set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${GMP_LIBRARIES_DIR}', ") - if(GMPXX_FOUND) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMPXX', ") - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'gmpxx', ") - set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${GMPXX_LIBRARIES_DIR}', ") - endif(GMPXX_FOUND) - endif(GMP_FOUND) - endif(CGAL_FOUND) - - # Specific for Mac - if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-mmacosx-version-min=10.9', ") - set(GUDHI_CYTHON_EXTRA_LINK_ARGS "${GUDHI_CYTHON_EXTRA_LINK_ARGS}'-mmacosx-version-min=10.9', ") - endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - - # Loop on INCLUDE_DIRECTORIES PROPERTY - get_property(GUDHI_INCLUDE_DIRECTORIES DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) - foreach(GUDHI_INCLUDE_DIRECTORY ${GUDHI_INCLUDE_DIRECTORIES}) - set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${GUDHI_INCLUDE_DIRECTORY}', ") - endforeach() - set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${CMAKE_SOURCE_DIR}/${GUDHI_CYTHON_PATH}/include', ") - - if (TBB_FOUND) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DGUDHI_USE_TBB', ") - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'tbb', 'tbbmalloc', ") - set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${TBB_LIBRARY_DIRS}', ") - set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${TBB_INCLUDE_DIRS}', ") - endif() - - # Generate cythonize_gudhi.py file to cythonize Gudhi - configure_file(cythonize_gudhi.py.in "${CMAKE_CURRENT_BINARY_DIR}/cythonize_gudhi.py" @ONLY) - # Generate gudhi.pyx - Gudhi cython file - configure_file(gudhi.pyx.in "${CMAKE_CURRENT_BINARY_DIR}/gudhi.pyx" @ONLY) - - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_RESULT_OF_USE_DECLTYPE', ") + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_ALL_NO_LIB', ") + set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${Boost_LIBRARY_DIRS}', ") + if(WIN32) + set( returnValue "" ) + find_the_lib (${returnValue} ${Boost_SYSTEM_LIBRARY}) + set(BOOST_SYSTEM_LIB_NAME ${returnValue}) + else() + set(BOOST_SYSTEM_LIB_NAME "boost_system") + endif() + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'${BOOST_SYSTEM_LIB_NAME}', ") + + # Gudhi and CGAL compilation option + if(MSVC) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'/fp:strict', ") + else(MSVC) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-std=c++11', ") + endif(MSVC) + if(CMAKE_COMPILER_IS_GNUCXX) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-frounding-math', ") + endif(CMAKE_COMPILER_IS_GNUCXX) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-fp-model strict', ") + endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + if (DEBUG_TRACES) + # For programs to be more verbose + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DDEBUG_TRACES', ") + endif() + + find_package(Eigen3 3.1.0) + + if (EIGEN3_FOUND) + # No problem, even if no CGAL found + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_EIGEN3_ENABLED', ") + endif (EIGEN3_FOUND) + + # Copy recursively include, cython, example, doc and test repositories before packages finding + # Some tests and doc files are removed in case some packages are not found + file(COPY include DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(COPY cython DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(COPY example DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(COPY test DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(COPY doc DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + # Developper version for doc images + file(GLOB GUDHI_DEV_DOC_IMAGES "${CMAKE_SOURCE_DIR}/src/*/doc/*.png") + file(COPY ${GUDHI_DEV_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") + file(GLOB GUDHI_DEV_DOC_IMAGES "${CMAKE_SOURCE_DIR}/src/*/doc/*.svg") + file(COPY ${GUDHI_DEV_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") + # User version for doc images + file(GLOB GUDHI_USER_DOC_IMAGES "${CMAKE_SOURCE_DIR}/doc/*/*.png") + file(COPY ${GUDHI_USER_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") + file(GLOB GUDHI_USER_DOC_IMAGES "${CMAKE_SOURCE_DIR}/doc/*/*.svg") + file(COPY ${GUDHI_USER_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") + # Biblio + file(GLOB GUDHI_BIB_FILES "${CMAKE_SOURCE_DIR}/biblio/*.bib") + file(COPY ${GUDHI_BIB_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") + # Cubical complex perseus doc example + file(GLOB GUDHI_CUBICAL_PERSEUS_FILES "${CMAKE_SOURCE_DIR}/data/bitmap/*cubicalcomplexdoc.txt") + file(COPY ${GUDHI_CUBICAL_PERSEUS_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") + file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") + file(COPY "${CMAKE_SOURCE_DIR}/data/distance_matrix/full_square_distance_matrix.csv" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") + # Persistence graphical tools examples + file(COPY "${CMAKE_SOURCE_DIR}/data/bitmap/3d_torus.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") + file(COPY "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") + + if (NOT CGAL_VERSION VERSION_LESS 4.8.1) + # If CGAL_VERSION >= 4.8.1, include subsampling + set(GUDHI_CYTHON_SUBSAMPLING "include 'cython/subsampling.pyx'") + set(GUDHI_CYTHON_TANGENTIAL_COMPLEX "include 'cython/tangential_complex.pyx'") + set(GUDHI_CYTHON_BOTTLENECK_DISTANCE "include 'cython/bottleneck_distance.pyx'") + else (NOT CGAL_VERSION VERSION_LESS 4.8.1) + # Remove subsampling unitary tests + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_subsampling.py) + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_ref.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_sum.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_user.rst") + # Remove tangential complex and bottleneck unitary tests + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_tangential_complex.py) + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_bottleneck_distance.py) + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_ref.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_sum.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_user.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_ref.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_sum.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_user.rst") + endif (NOT CGAL_VERSION VERSION_LESS 4.8.1) + if (NOT CGAL_VERSION VERSION_LESS 4.7.0) + # If CGAL_VERSION >= 4.7.0, include alpha + set(GUDHI_CYTHON_ALPHA_COMPLEX "include 'cython/alpha_complex.pyx'") + else (NOT CGAL_VERSION VERSION_LESS 4.7.0) + # Remove alpha complex unitary tests + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_alpha_complex.py) + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_ref.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_sum.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_user.rst") + endif (NOT CGAL_VERSION VERSION_LESS 4.7.0) + if (NOT CGAL_VERSION VERSION_LESS 4.6.0) + # If CGAL_VERSION >= 4.6.0, include euclidean versions of witness complex + set(GUDHI_CYTHON_EUCLIDEAN_WITNESS_COMPLEX + "include 'cython/euclidean_witness_complex.pyx'\ninclude 'cython/euclidean_strong_witness_complex.pyx'\n") + else (NOT CGAL_VERSION VERSION_LESS 4.6.0) + # Remove alpha complex unitary tests + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_euclidean_witness_complex.py) + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/euclidean_witness_complex_ref.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/euclidean_strong_witness_complex_ref.rst") + endif (NOT CGAL_VERSION VERSION_LESS 4.6.0) + + if(CGAL_FOUND) + # Add CGAL compilation args + if(CGAL_HEADER_ONLY) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_HEADER_ONLY', ") + else(CGAL_HEADER_ONLY) + if(WIN32) + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'CGAL-vc140-mt-4.7', ") + else(WIN32) + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'CGAL', ") + endif(WIN32) + set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${CGAL_LIBRARIES_DIR}', ") + endif(CGAL_HEADER_ONLY) + # GMP and GMPXX are not required, but if present, CGAL will link with them. + if(GMP_FOUND) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMP', ") + if(WIN32) + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'libgmp-10', ") + else(WIN32) + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'gmp', ") + endif(WIN32) + set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${GMP_LIBRARIES_DIR}', ") + if(GMPXX_FOUND) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMPXX', ") + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'gmpxx', ") + set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${GMPXX_LIBRARIES_DIR}', ") + endif(GMPXX_FOUND) + endif(GMP_FOUND) + endif(CGAL_FOUND) + + # Specific for Mac + if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-mmacosx-version-min=10.9', ") + set(GUDHI_CYTHON_EXTRA_LINK_ARGS "${GUDHI_CYTHON_EXTRA_LINK_ARGS}'-mmacosx-version-min=10.9', ") + endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + + # Loop on INCLUDE_DIRECTORIES PROPERTY + get_property(GUDHI_INCLUDE_DIRECTORIES DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) + foreach(GUDHI_INCLUDE_DIRECTORY ${GUDHI_INCLUDE_DIRECTORIES}) + set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${GUDHI_INCLUDE_DIRECTORY}', ") + endforeach() + set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${CMAKE_SOURCE_DIR}/${GUDHI_CYTHON_PATH}/include', ") + + if (TBB_FOUND) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DGUDHI_USE_TBB', ") + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'tbb', 'tbbmalloc', ") + set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${TBB_LIBRARY_DIRS}', ") + set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${TBB_INCLUDE_DIRS}', ") + endif() + + # Generate cythonize_gudhi.py file to cythonize Gudhi + configure_file(cythonize_gudhi.py.in "${CMAKE_CURRENT_BINARY_DIR}/cythonize_gudhi.py" @ONLY) + # Generate gudhi.pyx - Gudhi cython file + configure_file(gudhi.pyx.in "${CMAKE_CURRENT_BINARY_DIR}/gudhi.pyx" @ONLY) + + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND python "${CMAKE_CURRENT_BINARY_DIR}/cythonize_gudhi.py" "build_ext" "--inplace") + + add_custom_target(cython ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" + COMMENT "Do not forget to add ${CMAKE_CURRENT_BINARY_DIR}/ to your PYTHONPATH before using examples or tests") + + if(UNIX) + set( ENV{PYTHONPATH} $ENV{PYTHONPATH}:${CMAKE_CURRENT_BINARY_DIR}/ ) + endif(UNIX) + + # Unitary tests are available through py.test + find_program( PYTEST_PATH py.test ) + if(PYTEST_PATH) + add_test( + NAME gudhi_cython_py_test WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND python "${CMAKE_CURRENT_BINARY_DIR}/cythonize_gudhi.py" "build_ext" "--inplace") - - add_custom_target(cython ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" - COMMENT "Do not forget to add ${CMAKE_CURRENT_BINARY_DIR}/ to your PYTHONPATH before using examples or tests") - - if(UNIX) - set( ENV{PYTHONPATH} $ENV{PYTHONPATH}:${CMAKE_CURRENT_BINARY_DIR}/ ) - endif(UNIX) - - # Unitary tests are available through py.test - find_program( PYTEST_PATH py.test ) - if(PYTEST_PATH) - add_test( - NAME gudhi_cython_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTEST_PATH}) - set_tests_properties(gudhi_cython_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") - endif(PYTEST_PATH) - - # Documentation generation is available through sphinx - find_program( SPHINX_PATH sphinx-build ) - if(SPHINX_PATH) - if (UNIX) - add_custom_target(sphinx - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" - COMMAND make html doctest) - else (UNIX) - add_custom_target(sphinx - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc - COMMAND make.bat html) - endif (UNIX) - endif(SPHINX_PATH) - endif(NOT Boost_FOUND) + COMMAND ${PYTEST_PATH}) + set_tests_properties(gudhi_cython_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + endif(PYTEST_PATH) + + # Documentation generation is available through sphinx + find_program( SPHINX_PATH sphinx-build ) + if(SPHINX_PATH) + if (UNIX) + add_custom_target(sphinx + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" + COMMAND make html doctest) + else (UNIX) + add_custom_target(sphinx + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc + COMMAND make.bat html) + endif (UNIX) + endif(SPHINX_PATH) endif(PYTHON_PATH AND CYTHON_PATH) diff --git a/src/cython/include/Alpha_complex_interface.h b/src/cython/include/Alpha_complex_interface.h index d74ff304..d47db71f 100644 --- a/src/cython/include/Alpha_complex_interface.h +++ b/src/cython/include/Alpha_complex_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef ALPHA_COMPLEX_INTERFACE_H -#define ALPHA_COMPLEX_INTERFACE_H +#ifndef INCLUDE_ALPHA_COMPLEX_INTERFACE_H_ +#define INCLUDE_ALPHA_COMPLEX_INTERFACE_H_ #include <gudhi/Simplex_tree.h> #include <gudhi/Alpha_complex.h> @@ -79,4 +79,4 @@ class Alpha_complex_interface { } // namespace Gudhi -#endif // ALPHA_COMPLEX_INTERFACE_H +#endif // INCLUDE_ALPHA_COMPLEX_INTERFACE_H_ diff --git a/src/cython/include/Bottleneck_distance_interface.h b/src/cython/include/Bottleneck_distance_interface.h index 6819734b..d5fbf6ea 100644 --- a/src/cython/include/Bottleneck_distance_interface.h +++ b/src/cython/include/Bottleneck_distance_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef BOTTLENECK_DISTANCE_INTERFACE_H -#define BOTTLENECK_DISTANCE_INTERFACE_H +#ifndef INCLUDE_BOTTLENECK_DISTANCE_INTERFACE_H_ +#define INCLUDE_BOTTLENECK_DISTANCE_INTERFACE_H_ #include <gudhi/Bottleneck.h> @@ -45,9 +45,9 @@ namespace persistence_diagram { return bottleneck_distance(diag1, diag2); } -} // namespace alpha_complex +} // namespace persistence_diagram } // namespace Gudhi -#endif // BOTTLENECK_DISTANCE_INTERFACE_H +#endif // INCLUDE_BOTTLENECK_DISTANCE_INTERFACE_H_ diff --git a/src/cython/include/Cubical_complex_interface.h b/src/cython/include/Cubical_complex_interface.h index 4c53523b..7c0148f1 100644 --- a/src/cython/include/Cubical_complex_interface.h +++ b/src/cython/include/Cubical_complex_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef CUBICAL_COMPLEX_INTERFACE_H -#define CUBICAL_COMPLEX_INTERFACE_H +#ifndef INCLUDE_CUBICAL_COMPLEX_INTERFACE_H_ +#define INCLUDE_CUBICAL_COMPLEX_INTERFACE_H_ #include <gudhi/Bitmap_cubical_complex.h> #include <gudhi/Bitmap_cubical_complex_base.h> @@ -38,7 +38,6 @@ namespace cubical_complex { template<typename CubicalComplexOptions = Bitmap_cubical_complex_base<double>> class Cubical_complex_interface : public Bitmap_cubical_complex<CubicalComplexOptions> { public: - Cubical_complex_interface(const std::vector<unsigned>& dimensions, const std::vector<double>& top_dimensional_cells) : Bitmap_cubical_complex<CubicalComplexOptions>(dimensions, top_dimensional_cells) { @@ -47,12 +46,11 @@ class Cubical_complex_interface : public Bitmap_cubical_complex<CubicalComplexOp Cubical_complex_interface(const std::string& perseus_file) : Bitmap_cubical_complex<CubicalComplexOptions>(perseus_file.c_str()) { } - }; } // namespace cubical_complex } // namespace Gudhi -#endif // CUBICAL_COMPLEX_INTERFACE_H +#endif // INCLUDE_CUBICAL_COMPLEX_INTERFACE_H_ diff --git a/src/cython/include/Euclidean_strong_witness_complex_interface.h b/src/cython/include/Euclidean_strong_witness_complex_interface.h index 67d85e18..b9dd8177 100644 --- a/src/cython/include/Euclidean_strong_witness_complex_interface.h +++ b/src/cython/include/Euclidean_strong_witness_complex_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef EUCLIDEAN_STRONG_WITNESS_COMPLEX_INTERFACE_H -#define EUCLIDEAN_STRONG_WITNESS_COMPLEX_INTERFACE_H +#ifndef INCLUDE_EUCLIDEAN_STRONG_WITNESS_COMPLEX_INTERFACE_H_ +#define INCLUDE_EUCLIDEAN_STRONG_WITNESS_COMPLEX_INTERFACE_H_ #include <gudhi/Simplex_tree.h> #include <gudhi/Euclidean_strong_witness_complex.h> @@ -50,7 +50,7 @@ class Euclidean_strong_witness_complex_interface { Euclidean_strong_witness_complex_interface(const std::vector<std::vector<double>>& landmarks, const std::vector<std::vector<double>>& witnesses) { landmarks_.reserve(landmarks.size()); - for(auto& landmark : landmarks) + for (auto& landmark : landmarks) landmarks_.emplace_back(landmark.begin(), landmark.end()); witness_complex_ = new Euclidean_strong_witness_complex<Dynamic_kernel>(landmarks_, witnesses); } @@ -87,7 +87,7 @@ class Euclidean_strong_witness_complex_interface { } // namespace witness_complex -} // namespace Gudhi +} // namespace Gudhi -#endif // EUCLIDEAN_STRONG_WITNESS_COMPLEX_INTERFACE_H +#endif // INCLUDE_EUCLIDEAN_STRONG_WITNESS_COMPLEX_INTERFACE_H_ diff --git a/src/cython/include/Euclidean_witness_complex_interface.h b/src/cython/include/Euclidean_witness_complex_interface.h index a2db6a2d..2a09b3b5 100644 --- a/src/cython/include/Euclidean_witness_complex_interface.h +++ b/src/cython/include/Euclidean_witness_complex_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef EUCLIDEAN_WITNESS_COMPLEX_INTERFACE_H -#define EUCLIDEAN_WITNESS_COMPLEX_INTERFACE_H +#ifndef INCLUDE_EUCLIDEAN_WITNESS_COMPLEX_INTERFACE_H_ +#define INCLUDE_EUCLIDEAN_WITNESS_COMPLEX_INTERFACE_H_ #include <gudhi/Simplex_tree.h> #include <gudhi/Euclidean_witness_complex.h> @@ -50,7 +50,7 @@ class Euclidean_witness_complex_interface { Euclidean_witness_complex_interface(const std::vector<std::vector<double>>& landmarks, const std::vector<std::vector<double>>& witnesses) { landmarks_.reserve(landmarks.size()); - for(auto& landmark : landmarks) + for (auto& landmark : landmarks) landmarks_.emplace_back(landmark.begin(), landmark.end()); witness_complex_ = new Euclidean_witness_complex<Dynamic_kernel>(landmarks_, witnesses); } @@ -86,7 +86,7 @@ class Euclidean_witness_complex_interface { } // namespace witness_complex -} // namespace Gudhi +} // namespace Gudhi -#endif // EUCLIDEAN_WITNESS_COMPLEX_INTERFACE_H +#endif // INCLUDE_EUCLIDEAN_WITNESS_COMPLEX_INTERFACE_H_ diff --git a/src/cython/include/Off_reader_interface.h b/src/cython/include/Off_reader_interface.h index 97d64d3e..0ca55500 100644 --- a/src/cython/include/Off_reader_interface.h +++ b/src/cython/include/Off_reader_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef OFF_READER_INTERFACE_H -#define OFF_READER_INTERFACE_H +#ifndef INCLUDE_OFF_READER_INTERFACE_H_ +#define INCLUDE_OFF_READER_INTERFACE_H_ #include <gudhi/Points_off_io.h> @@ -38,5 +38,5 @@ std::vector<std::vector<double>> read_points_from_OFF_file(const std::string& of } // namespace Gudhi -#endif // OFF_READER_INTERFACE_H +#endif // INCLUDE_OFF_READER_INTERFACE_H_ diff --git a/src/cython/include/Persistent_cohomology_interface.h b/src/cython/include/Persistent_cohomology_interface.h index 1ff0e09b..55028fd0 100644 --- a/src/cython/include/Persistent_cohomology_interface.h +++ b/src/cython/include/Persistent_cohomology_interface.h @@ -20,13 +20,14 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef PERSISTENT_COHOMOLOGY_INTERFACE_H -#define PERSISTENT_COHOMOLOGY_INTERFACE_H +#ifndef INCLUDE_PERSISTENT_COHOMOLOGY_INTERFACE_H_ +#define INCLUDE_PERSISTENT_COHOMOLOGY_INTERFACE_H_ #include <gudhi/Persistent_cohomology.h> #include <vector> #include <utility> // for std::pair +#include <algorithm> // for sort namespace Gudhi { @@ -34,12 +35,10 @@ template<class FilteredComplex> class Persistent_cohomology_interface : public persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomology::Field_Zp> { private: - /* * Compare two intervals by dimension, then by length. */ struct cmp_intervals_by_dim_then_length { - explicit cmp_intervals_by_dim_then_length(FilteredComplex * sc) : sc_(sc) { } @@ -55,23 +54,26 @@ persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomol }; public: - Persistent_cohomology_interface(FilteredComplex* stptr) : persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomology::Field_Zp>(*stptr), stptr_(stptr) { } Persistent_cohomology_interface(FilteredComplex* stptr, bool persistence_dim_max) - : persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomology::Field_Zp>(*stptr, - persistence_dim_max), - stptr_(stptr) { } + : persistent_cohomology::Persistent_cohomology<FilteredComplex, + persistent_cohomology::Field_Zp>(*stptr, persistence_dim_max), + stptr_(stptr) { } - std::vector<std::pair<int, std::pair<double, double>>> get_persistence(int homology_coeff_field, double min_persistence) { - persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomology::Field_Zp>::init_coefficients(homology_coeff_field); - persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomology::Field_Zp>::compute_persistent_cohomology(min_persistence); + std::vector<std::pair<int, std::pair<double, double>>> get_persistence(int homology_coeff_field, + double min_persistence) { + persistent_cohomology::Persistent_cohomology<FilteredComplex, + persistent_cohomology::Field_Zp>::init_coefficients(homology_coeff_field); + persistent_cohomology::Persistent_cohomology<FilteredComplex, + persistent_cohomology::Field_Zp>::compute_persistent_cohomology(min_persistence); // Custom sort and output persistence cmp_intervals_by_dim_then_length cmp(stptr_); - auto persistent_pairs = persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomology::Field_Zp>::get_persistent_pairs(); + auto persistent_pairs = persistent_cohomology::Persistent_cohomology<FilteredComplex, + persistent_cohomology::Field_Zp>::get_persistent_pairs(); std::sort(std::begin(persistent_pairs), std::end(persistent_pairs), cmp); std::vector<std::pair<int, std::pair<double, double>>> persistence; @@ -81,16 +83,13 @@ persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomol stptr_->filtration(get<1>(pair))))); } return persistence; - } private: // A copy FilteredComplex* stptr_; - }; -} // namespace Gudhi - -#endif // PERSISTENT_COHOMOLOGY_INTERFACE_H +} // namespace Gudhi +#endif // INCLUDE_PERSISTENT_COHOMOLOGY_INTERFACE_H_ diff --git a/src/cython/include/Rips_complex_interface.h b/src/cython/include/Rips_complex_interface.h index 01df5366..1879bd74 100644 --- a/src/cython/include/Rips_complex_interface.h +++ b/src/cython/include/Rips_complex_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef RIPS_COMPLEX_INTERFACE_H -#define RIPS_COMPLEX_INTERFACE_H +#ifndef INCLUDE_RIPS_COMPLEX_INTERFACE_H_ +#define INCLUDE_RIPS_COMPLEX_INTERFACE_H_ #include <gudhi/Simplex_tree.h> #include <gudhi/Rips_complex.h> @@ -53,7 +53,6 @@ class Rips_complex_interface { } else { // Rips construction where values is a distance matrix rips_complex_ = new Rips_complex<Simplex_tree_interface<>::Filtration_value>(values, threshold); - } } @@ -65,11 +64,10 @@ class Rips_complex_interface { threshold, Euclidean_distance()); } else { // Rips construction where values is a distance matrix - Distance_matrix distances = read_lower_triangular_matrix_from_csv_file<Simplex_tree_interface<>::Filtration_value>(file_name); + Distance_matrix distances = + read_lower_triangular_matrix_from_csv_file<Simplex_tree_interface<>::Filtration_value>(file_name); rips_complex_ = new Rips_complex<Simplex_tree_interface<>::Filtration_value>(distances, threshold); - } - } void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, int dim_max) { @@ -85,4 +83,4 @@ class Rips_complex_interface { } // namespace Gudhi -#endif // RIPS_COMPLEX_INTERFACE_H +#endif // INCLUDE_RIPS_COMPLEX_INTERFACE_H_ diff --git a/src/cython/include/Simplex_tree_interface.h b/src/cython/include/Simplex_tree_interface.h index c2783e22..4266b3ef 100644 --- a/src/cython/include/Simplex_tree_interface.h +++ b/src/cython/include/Simplex_tree_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef SIMPLEX_TREE_INTERFACE_H -#define SIMPLEX_TREE_INTERFACE_H +#ifndef INCLUDE_SIMPLEX_TREE_INTERFACE_H_ +#define INCLUDE_SIMPLEX_TREE_INTERFACE_H_ #include <gudhi/graph_simplicial_complex.h> #include <gudhi/distance_functions.h> @@ -48,7 +48,6 @@ class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> { using Complex = std::vector<std::pair<Simplex, Filtration_value>>; public: - bool find_simplex(const Simplex& vh) { return (Base::find(vh) != Base::null_simplex()); } @@ -98,7 +97,6 @@ class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> { filtered_tree.push_back(std::make_pair(simplex, Base::filtration(f_simplex))); } return filtered_tree; - } Complex get_skeleton_tree(int dimension) { @@ -144,10 +142,8 @@ class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> { void create_persistence(Gudhi::Persistent_cohomology_interface<Base>* pcoh) { pcoh = new Gudhi::Persistent_cohomology_interface<Base>(*this); } - }; -} // namespace Gudhi - -#endif // SIMPLEX_TREE_INTERFACE_H +} // namespace Gudhi +#endif // INCLUDE_SIMPLEX_TREE_INTERFACE_H_ diff --git a/src/cython/include/Strong_witness_complex_interface.h b/src/cython/include/Strong_witness_complex_interface.h index 83bf0f3c..d05eaac5 100644 --- a/src/cython/include/Strong_witness_complex_interface.h +++ b/src/cython/include/Strong_witness_complex_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef STRONG_WITNESS_COMPLEX_INTERFACE_H -#define STRONG_WITNESS_COMPLEX_INTERFACE_H +#ifndef INCLUDE_STRONG_WITNESS_COMPLEX_INTERFACE_H_ +#define INCLUDE_STRONG_WITNESS_COMPLEX_INTERFACE_H_ #include <gudhi/Simplex_tree.h> #include <gudhi/Strong_witness_complex.h> @@ -64,12 +64,10 @@ class Strong_witness_complex_interface { private: Strong_witness_complex<Nearest_landmark_table>* witness_complex_; - }; } // namespace witness_complex -} // namespace Gudhi - -#endif // STRONG_WITNESS_COMPLEX_INTERFACE_H +} // namespace Gudhi +#endif // INCLUDE_STRONG_WITNESS_COMPLEX_INTERFACE_H_ diff --git a/src/cython/include/Subsampling_interface.h b/src/cython/include/Subsampling_interface.h index 5fc16767..1c6032c0 100644 --- a/src/cython/include/Subsampling_interface.h +++ b/src/cython/include/Subsampling_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef SUBSAMPLING_INTERFACE_H -#define SUBSAMPLING_INTERFACE_H +#ifndef INCLUDE_SUBSAMPLING_INTERFACE_H_ +#define INCLUDE_SUBSAMPLING_INTERFACE_H_ #include <gudhi/choose_n_farthest_points.h> #include <gudhi/pick_n_random_points.h> @@ -112,10 +112,8 @@ std::vector<std::vector<double>> subsampling_sparsify_points_from_file(const std return subsampling_sparsify_points(points, min_squared_dist); } - } // namespace subsampling } // namespace Gudhi -#endif // SUBSAMPLING_INTERFACE_H - +#endif // INCLUDE_SUBSAMPLING_INTERFACE_H_ diff --git a/src/cython/include/Tangential_complex_interface.h b/src/cython/include/Tangential_complex_interface.h index 2ca4c393..5e9dc0e4 100644 --- a/src/cython/include/Tangential_complex_interface.h +++ b/src/cython/include/Tangential_complex_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef TANGENTIAL_COMPLEX_INTERFACE_H -#define TANGENTIAL_COMPLEX_INTERFACE_H +#ifndef INCLUDE_TANGENTIAL_COMPLEX_INTERFACE_H_ +#define INCLUDE_TANGENTIAL_COMPLEX_INTERFACE_H_ #include <gudhi/Simplex_tree.h> #include <gudhi/Tangential_complex.h> @@ -33,6 +33,7 @@ #include <vector> #include <utility> // std::pair #include <iostream> +#include <string> namespace Gudhi { @@ -49,7 +50,7 @@ class Tangential_complex_interface { unsigned intrisic_dim = 0; if (points.size() > 0) intrisic_dim = points[0].size() - 1; - + tangential_complex_ = new TC(points, intrisic_dim, k); tangential_complex_->compute_tangential_complex(); num_inconsistencies_ = tangential_complex_->number_of_inconsistent_simplices(); @@ -117,7 +118,6 @@ class Tangential_complex_interface { } // namespace tangential_complex -} // namespace Gudhi - -#endif // TANGENTIAL_COMPLEX_INTERFACE_H +} // namespace Gudhi +#endif // INCLUDE_TANGENTIAL_COMPLEX_INTERFACE_H_ diff --git a/src/cython/include/Witness_complex_interface.h b/src/cython/include/Witness_complex_interface.h index 4f2a903b..6501cc35 100644 --- a/src/cython/include/Witness_complex_interface.h +++ b/src/cython/include/Witness_complex_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef WITNESS_COMPLEX_INTERFACE_H -#define WITNESS_COMPLEX_INTERFACE_H +#ifndef INCLUDE_WITNESS_COMPLEX_INTERFACE_H_ +#define INCLUDE_WITNESS_COMPLEX_INTERFACE_H_ #include <gudhi/Simplex_tree.h> #include <gudhi/Witness_complex.h> @@ -64,12 +64,11 @@ class Witness_complex_interface { private: Witness_complex<Nearest_landmark_table>* witness_complex_; - }; } // namespace witness_complex -} // namespace Gudhi +} // namespace Gudhi -#endif // WITNESS_COMPLEX_INTERFACE_H +#endif // INCLUDE_WITNESS_COMPLEX_INTERFACE_H_ |