From 5de02a8e89ce7905281a0ef6d40f82ef04d426d6 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 30 May 2017 11:14:43 +0000 Subject: Typo git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/persistence_representation_integration@2472 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 457b970258b8a99519db664358c19d0dee80d879 --- .../utilities/persistence_vectors/CMakeLists.txt | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt (limited to 'src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt') diff --git a/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt new file mode 100644 index 00000000..8033e27a --- /dev/null +++ b/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 2.6) +project(GUDHI_STAT) + +#persitence vectors +add_executable ( create_persistence_vectors create_persistence_vectors.cpp ) +target_link_libraries(create_persistence_vectors ${Boost_SYSTEM_LIBRARY}) +add_test ( create_persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/create_persistence_vectors -1 "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) + +add_executable ( average_persistence_vectors average_persistence_vectors.cpp ) +target_link_libraries(average_persistence_vectors ${Boost_SYSTEM_LIBRARY}) +add_test ( average_persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/average_persistence_vectors "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.vect" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.vect" ) + +add_executable ( compute_distance_of_persistence_vectors compute_distance_of_persistence_vectors.cpp ) +target_link_libraries(compute_distance_of_persistence_vectors ${Boost_SYSTEM_LIBRARY}) +add_test ( compute_distance_of_persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/compute_distance_of_persistence_vectors -1 "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.vect" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.vect" ) + +add_executable ( compute_scalar_product_of_persistence_vectors compute_scalar_product_of_persistence_vectors.cpp ) +target_link_libraries(compute_scalar_product_of_persistence_vectors ${Boost_SYSTEM_LIBRARY}) +add_test ( compute_scalar_product_of_persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/compute_scalar_product_of_persistence_vectors "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.vect" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.vect" ) + +add_executable ( plot_persistence_vectors plot_persistence_vectors.cpp ) +target_link_libraries(plot_persistence_vectors ${Boost_SYSTEM_LIBRARY}) +add_test ( plot_persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/plot_persistence_vectors "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.vect" ) + + -- cgit v1.2.3 From 82e2f453feae8011a529b0e932a7c2a2f6472f9d Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 6 Jun 2017 11:15:17 +0000 Subject: Make build out of source git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/persistence_representation_integration@2513 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7b6b18858d5e71613c4c15c4c262b4c4b5a6ac8e --- .../example/CMakeLists.txt | 48 ++++++----- .../example/simple_diagram.txt | 4 - .../test/CMakeLists.txt | 98 +++++++--------------- .../utilities/persistence_heat_maps/CMakeLists.txt | 42 +++++++--- .../utilities/persistence_intervals/CMakeLists.txt | 40 ++++++--- .../persistence_landscapes/CMakeLists.txt | 28 +++++-- .../persistence_landscapes_on_grid/CMakeLists.txt | 29 +++++-- .../utilities/persistence_vectors/CMakeLists.txt | 29 +++++-- 8 files changed, 175 insertions(+), 143 deletions(-) delete mode 100644 src/Persistence_representations/example/simple_diagram.txt (limited to 'src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt') diff --git a/src/Persistence_representations/example/CMakeLists.txt b/src/Persistence_representations/example/CMakeLists.txt index 3357017a..7788b603 100644 --- a/src/Persistence_representations/example/CMakeLists.txt +++ b/src/Persistence_representations/example/CMakeLists.txt @@ -1,27 +1,33 @@ cmake_minimum_required(VERSION 2.6) project(Persistence_representations_example) -file(COPY "simple_diagram.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) - -add_executable ( persistence_landscape_on_grid persistence_landscape_on_grid.cpp ) -target_link_libraries(persistence_landscape_on_grid ${Boost_SYSTEM_LIBRARY}) -add_test ( persistence_landscape_on_grid ${CMAKE_CURRENT_BINARY_DIR}/persistence_landscape_on_grid ) - -add_executable ( persistence_landscape persistence_landscape.cpp ) -target_link_libraries(persistence_landscape ${Boost_SYSTEM_LIBRARY}) -add_test ( persistence_landscape ${CMAKE_CURRENT_BINARY_DIR}/persistence_landscape ) - -add_executable ( persistence_intervals persistence_intervals.cpp ) -target_link_libraries(persistence_intervals ${Boost_SYSTEM_LIBRARY}) -add_test ( persistence_intervals ${CMAKE_CURRENT_BINARY_DIR}/persistence_intervals simple_diagram.txt ) - -add_executable ( persistence_vectors persistence_vectors.cpp ) -target_link_libraries(persistence_vectors ${Boost_SYSTEM_LIBRARY}) -add_test ( persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/persistence_vectors ) - -add_executable ( persistence_heat_maps persistence_heat_maps.cpp ) -target_link_libraries(persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) -add_test ( persistence_heat_maps ${CMAKE_CURRENT_BINARY_DIR}/persistence_heat_maps ) +file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") + +add_executable ( Persistence_representations_example_landscape_on_grid persistence_landscape_on_grid.cpp ) +target_link_libraries(Persistence_representations_example_landscape_on_grid ${Boost_SYSTEM_LIBRARY}) +add_test(NAME Persistence_representations_example_landscape_on_grid + COMMAND $) + +add_executable ( Persistence_representations_example_landscape persistence_landscape.cpp ) +target_link_libraries(Persistence_representations_example_landscape ${Boost_SYSTEM_LIBRARY}) +add_test(NAME Persistence_representations_example_landscape + COMMAND $) + +add_executable ( Persistence_representations_example_intervals persistence_intervals.cpp ) +target_link_libraries(Persistence_representations_example_intervals ${Boost_SYSTEM_LIBRARY}) +add_test(NAME Persistence_representations_example_intervals + COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") + +add_executable ( Persistence_representations_example_vectors persistence_vectors.cpp ) +target_link_libraries(Persistence_representations_example_vectors ${Boost_SYSTEM_LIBRARY}) +add_test(NAME Persistence_representations_example_vectors + COMMAND $) + +add_executable ( Persistence_representations_example_heat_maps persistence_heat_maps.cpp ) +target_link_libraries(Persistence_representations_example_heat_maps ${Boost_SYSTEM_LIBRARY}) +add_test(NAME Persistence_representations_example_heat_maps + COMMAND $) diff --git a/src/Persistence_representations/example/simple_diagram.txt b/src/Persistence_representations/example/simple_diagram.txt deleted file mode 100644 index 2f199fd4..00000000 --- a/src/Persistence_representations/example/simple_diagram.txt +++ /dev/null @@ -1,4 +0,0 @@ -1 2 -3 4 -5 6 -7 8 \ No newline at end of file diff --git a/src/Persistence_representations/test/CMakeLists.txt b/src/Persistence_representations/test/CMakeLists.txt index 7b6de74e..4483de07 100644 --- a/src/Persistence_representations/test/CMakeLists.txt +++ b/src/Persistence_representations/test/CMakeLists.txt @@ -1,89 +1,47 @@ cmake_minimum_required(VERSION 2.6) -project(GUDHI_STAT_CCUT) - -if (GCOVR_PATH) - # for gcovr to make coverage reports - Corbera Jenkins plugin - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage") -endif() -if (GPROF_PATH) - # for gprof to make coverage reports - Jenkins - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pg") -endif() - -# copy data directory for tests purpose. QUESTION -- DOEST IT WORK IF WE CREATE A NEW FOLDER FOR EACH TEST? i THINK THAT WE SHOULD MAKE THS COPYING TO EACH TEST FOLDER. -file(COPY data DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) -add_executable ( persistence_intervals_test persistence_intervals_test.cpp ) -target_link_libraries(persistence_intervals_test ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) - +project(Persistence_representations_test) -# Unitary tests -add_test(NAME persistence_intervals_test - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/persistence_intervals_test - # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/persistence_intervals_UT.xml --log_level=test_suite --report_level=no) +include(GUDHI_test_coverage) -add_executable ( vector_representation_test vector_representation_test.cpp ) -target_link_libraries(vector_representation_test ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +# copy data directory for tests purpose. +file(COPY data DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) +add_executable ( Persistence_intervals_test_unit persistence_intervals_test.cpp ) +target_link_libraries(Persistence_intervals_test_unit ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) -# Unitary tests -add_test(NAME vector_representation_test - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/vector_representation_test - # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/vector_representation_UT.xml --log_level=test_suite --report_level=no) +gudhi_add_coverage_test(Persistence_intervals_test_unit) -add_executable ( persistence_lanscapes_test persistence_lanscapes_test.cpp ) -target_link_libraries(persistence_lanscapes_test ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +add_executable (Vector_representation_test_unit vector_representation_test.cpp ) +target_link_libraries(Vector_representation_test_unit ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) -# Unitary tests -add_test(NAME persistence_lanscapes_test - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/persistence_lanscapes_test - # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/persistence_lanscapes_UT.xml --log_level=test_suite --report_level=no) +gudhi_add_coverage_test(Vector_representation_test_unit) -add_executable ( persistence_lanscapes_on_grid_test persistence_lanscapes_on_grid_test.cpp ) -target_link_libraries(persistence_lanscapes_on_grid_test ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +add_executable (Persistence_lanscapes_test_unit persistence_lanscapes_test.cpp ) +target_link_libraries(Persistence_lanscapes_test_unit ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) -# Unitary tests -add_test(NAME persistence_lanscapes_on_grid_test - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/persistence_lanscapes_on_grid_test - # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/persistence_lanscapes_on_grid_UT.xml --log_level=test_suite --report_level=no) +gudhi_add_coverage_test(Persistence_lanscapes_test_unit) -add_executable ( persistence_heat_maps_test persistence_heat_maps_test.cpp ) -target_link_libraries(persistence_heat_maps_test ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +add_executable ( Persistence_lanscapes_on_grid_test_unit persistence_lanscapes_on_grid_test.cpp ) +target_link_libraries(Persistence_lanscapes_on_grid_test_unit ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) -# Unitary tests -add_test(NAME persistence_heat_maps_test - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/persistence_heat_maps_test - # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/persistence_heat_maps_UT.xml --log_level=test_suite --report_level=no) +gudhi_add_coverage_test(Persistence_lanscapes_on_grid_test_unit) -add_executable ( read_persistence_from_file_test read_persistence_from_file_test.cpp ) -target_link_libraries(read_persistence_from_file_test ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +add_executable (Persistence_heat_maps_test_unit persistence_heat_maps_test.cpp ) +target_link_libraries(Persistence_heat_maps_test_unit ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) -# Unitary tests -add_test(NAME read_persistence_from_file_test - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/read_persistence_from_file_test - # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/read_persistence_from_file_UT.xml --log_level=test_suite --report_level=no) +gudhi_add_coverage_test(Persistence_heat_maps_test_unit) +add_executable ( Read_persistence_from_file_test_unit read_persistence_from_file_test.cpp ) +target_link_libraries(Read_persistence_from_file_test_unit ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +gudhi_add_coverage_test(Read_persistence_from_file_test_unit) if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) -add_executable ( persistence_intervals_with_distances_test persistence_intervals_with_distances_test.cpp ) -target_link_libraries(persistence_intervals_with_distances_test ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) -if (TBB_FOUND) -target_link_libraries(persistence_intervals_with_distances_test ${TBB_LIBRARIES}) -endif(TBB_FOUND) -# Unitary tests -add_test(NAME persistence_intervals_with_distances_test - COMMAND ${CMAKE_CURRENT_BINARY_DIR}/persistence_intervals_with_distances_test - # XML format for Jenkins xUnit plugin - --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/persistence_intervals_with_distances_test_UT.xml --log_level=test_suite --report_level=no) + add_executable (Persistence_intervals_with_distances_test_unit persistence_intervals_with_distances_test.cpp ) + target_link_libraries(Persistence_intervals_with_distances_test_unit ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + if (TBB_FOUND) + target_link_libraries(Persistence_intervals_with_distances_test_unit ${TBB_LIBRARIES}) + endif(TBB_FOUND) + gudhi_add_coverage_test(Persistence_intervals_with_distances_test_unit) endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt index 4ad924cb..0dd63852 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt @@ -1,41 +1,63 @@ cmake_minimum_required(VERSION 2.6) project(Persistence_representations_heat_maps_utilities) -#persitence heat maps +file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") add_executable ( create_persistence_heat_maps create_persistence_heat_maps.cpp ) target_link_libraries(create_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) -add_test ( create_persistence_heat_maps ${CMAKE_CURRENT_BINARY_DIR}/create_persistence_heat_maps 10 -1 -1 4 -1 "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) + +add_test(NAME create_persistence_heat_maps COMMAND $ + "10" "-1" "-1" "4" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") + add_executable ( create_pssk create_pssk.cpp ) target_link_libraries(create_pssk ${Boost_SYSTEM_LIBRARY}) -add_test ( create_pssk ${CMAKE_CURRENT_BINARY_DIR}/create_pssk 10 -1 -1 4 -1 "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) + +add_test(NAME create_pssk COMMAND $ + "10" "-1" "-1" "4" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") add_executable ( create_p_h_m_weighted_by_distance_from_diagonal create_p_h_m_weighted_by_distance_from_diagonal.cpp ) target_link_libraries(create_p_h_m_weighted_by_distance_from_diagonal ${Boost_SYSTEM_LIBRARY}) -add_test ( create_p_h_m_weighted_by_distance_from_diagonal ${CMAKE_CURRENT_BINARY_DIR}/create_p_h_m_weighted_by_distance_from_diagonal 10 -1 -1 4 -1 "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) + +add_test(NAME create_p_h_m_weighted_by_distance_from_diagonal COMMAND $ + "10" "-1" "-1" "4" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") add_executable ( create_p_h_m_weighted_by_squared_diag_distance create_p_h_m_weighted_by_squared_diag_distance.cpp ) target_link_libraries(create_p_h_m_weighted_by_squared_diag_distance ${Boost_SYSTEM_LIBRARY}) -add_test (create_p_h_m_weighted_by_squared_diag_distance ${CMAKE_CURRENT_BINARY_DIR}/create_p_h_m_weighted_by_squared_diag_distance 10 -1 -1 4 -1 "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) + +add_test(NAME create_p_h_m_weighted_by_squared_diag_distance COMMAND $ + "10" "-1" "-1" "4" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") add_executable ( create_p_h_m_weighted_by_arctan_of_their_persistence create_p_h_m_weighted_by_arctan_of_their_persistence.cpp ) target_link_libraries(create_p_h_m_weighted_by_arctan_of_their_persistence ${Boost_SYSTEM_LIBRARY}) -add_test ( create_p_h_m_weighted_by_arctan_of_their_persistence ${CMAKE_CURRENT_BINARY_DIR}/create_p_h_m_weighted_by_arctan_of_their_persistence 10 -1 -1 4 -1 "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) + +add_test(NAME create_p_h_m_weighted_by_arctan_of_their_persistence COMMAND $ + "10" "-1" "-1" "4" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") add_executable ( average_persistence_heat_maps average_persistence_heat_maps.cpp ) target_link_libraries(average_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) -add_test ( average_persistence_heat_maps ${CMAKE_CURRENT_BINARY_DIR}/average_persistence_heat_maps "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) + +add_test(NAME average_persistence_heat_maps COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt" + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") add_executable ( plot_persistence_heat_map plot_persistence_heat_map.cpp ) target_link_libraries(plot_persistence_heat_map ${Boost_SYSTEM_LIBRARY}) -add_test ( plot_persistence_heat_map ${CMAKE_CURRENT_BINARY_DIR}/plot_persistence_heat_map "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) + +add_test(NAME plot_persistence_heat_map COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") add_executable ( compute_distance_of_persistence_heat_maps compute_distance_of_persistence_heat_maps.cpp ) target_link_libraries(compute_distance_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) -add_test ( compute_distance_of_persistence_heat_maps ${CMAKE_CURRENT_BINARY_DIR}/compute_distance_of_persistence_heat_maps 1 "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) + +add_test(NAME compute_distance_of_persistence_heat_maps COMMAND $ + "1" + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt" + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") add_executable ( compute_scalar_product_of_persistence_heat_maps compute_scalar_product_of_persistence_heat_maps.cpp ) target_link_libraries(compute_scalar_product_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) -add_test ( compute_scalar_product_of_persistence_heat_maps ${CMAKE_CURRENT_BINARY_DIR}/compute_scalar_product_of_persistence_heat_maps "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) +add_test(NAME compute_scalar_product_of_persistence_heat_maps COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt" + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") diff --git a/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt index b5c5928d..105b7efb 100644 --- a/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt @@ -1,32 +1,46 @@ cmake_minimum_required(VERSION 2.6) -project(GUDHI_STAT) +project(Persistence_representations_intervals_utilities) + +file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") -#persitence diagrams add_executable ( plot_persistence_intervals plot_persistence_intervals.cpp ) target_link_libraries( plot_persistence_intervals ${Boost_SYSTEM_LIBRARY}) -add_test ( plot_persistence_intervals ${CMAKE_CURRENT_BINARY_DIR}/plot_persistence_intervals "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) + +add_test(NAME plot_persistence_intervals COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") add_executable ( compute_birth_death_range_in_persistence_diagram compute_birth_death_range_in_persistence_diagram.cpp ) target_link_libraries( compute_birth_death_range_in_persistence_diagram ${Boost_SYSTEM_LIBRARY}) -add_test ( compute_birth_death_range_in_persistence_diagram ${CMAKE_CURRENT_BINARY_DIR}/compute_birth_death_range_in_persistence_diagram -1 "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) + +add_test(NAME compute_birth_death_range_in_persistence_diagram COMMAND $ + "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") add_executable ( compute_number_of_dominant_intervals compute_number_of_dominant_intervals.cpp ) target_link_libraries( compute_number_of_dominant_intervals ${Boost_SYSTEM_LIBRARY}) -add_test ( compute_number_of_dominant_intervals ${CMAKE_CURRENT_BINARY_DIR}/compute_number_of_dominant_intervals "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" -1 2 ) + +add_test(NAME compute_number_of_dominant_intervals COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt" "-1" "2") add_executable ( plot_histogram_of_intervals_lengths plot_histogram_of_intervals_lengths.cpp ) target_link_libraries( plot_histogram_of_intervals_lengths ${Boost_SYSTEM_LIBRARY}) -add_test ( plot_histogram_of_intervals_lengths ${CMAKE_CURRENT_BINARY_DIR}/plot_histogram_of_intervals_lengths "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" 2 ) + +add_test(NAME plot_histogram_of_intervals_lengths COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt" "2") add_executable ( plot_persistence_Betti_numbers plot_persistence_Betti_numbers.cpp ) target_link_libraries( plot_persistence_Betti_numbers ${Boost_SYSTEM_LIBRARY}) -add_test ( plot_persistence_Betti_numbers ${CMAKE_CURRENT_BINARY_DIR}/plot_persistence_Betti_numbers "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) + +add_test(NAME plot_persistence_Betti_numbers COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) -add_executable ( compute_bottleneck_distance compute_bottleneck_distance.cpp ) -target_link_libraries( compute_bottleneck_distance ${Boost_SYSTEM_LIBRARY}) -if (TBB_FOUND) -target_link_libraries(compute_bottleneck_distance ${TBB_LIBRARIES}) -endif(TBB_FOUND) -add_test ( compute_bottleneck_distance ${CMAKE_CURRENT_BINARY_DIR}/compute_bottleneck_distance "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) + add_executable ( compute_bottleneck_distance compute_bottleneck_distance.cpp ) + target_link_libraries( compute_bottleneck_distance ${Boost_SYSTEM_LIBRARY}) + if (TBB_FOUND) + target_link_libraries(compute_bottleneck_distance ${TBB_LIBRARIES}) + endif(TBB_FOUND) + + add_test(NAME compute_bottleneck_distance COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt" + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt index 43533102..baf8de3c 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt @@ -1,26 +1,38 @@ cmake_minimum_required(VERSION 2.6) -project(GUDHI_STAT) +project(Persistence_representations_lanscapes_utilities) +file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") - -#persitence landscapes add_executable ( create_landscapes create_landscapes.cpp ) target_link_libraries(create_landscapes ${Boost_SYSTEM_LIBRARY}) -add_test ( create_landscapes ${CMAKE_CURRENT_BINARY_DIR}/create_landscapes -1 "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) + +# Will create simple_diagram.txt.land +add_test(NAME create_landscapes COMMAND $ + "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") add_executable ( average_landscapes average_landscapes.cpp ) target_link_libraries(average_landscapes ${Boost_SYSTEM_LIBRARY}) -add_test ( average_landscapes ${CMAKE_CURRENT_BINARY_DIR}/average_landscapes "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.land" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.land" ) + +add_test(NAME average_landscapes COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt" + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") add_executable ( plot_landscapes plot_landscapes.cpp ) target_link_libraries(plot_landscapes ${Boost_SYSTEM_LIBRARY}) -add_test ( plot_landscapes ${CMAKE_CURRENT_BINARY_DIR}/plot_landscapes "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.land" ) + +add_test(NAME plot_landscapes COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") add_executable ( compute_distance_of_landscapes compute_distance_of_landscapes.cpp ) target_link_libraries(compute_distance_of_landscapes ${Boost_SYSTEM_LIBRARY}) -add_test ( compute_distance_of_landscapes ${CMAKE_CURRENT_BINARY_DIR}/compute_distance_of_landscapes 1 "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.land" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.land" ) + +add_test(NAME compute_distance_of_landscapes COMMAND $ + "1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.land" + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.land") add_executable ( compute_scalar_product_of_landscapes compute_scalar_product_of_landscapes.cpp ) target_link_libraries(compute_scalar_product_of_landscapes ${Boost_SYSTEM_LIBRARY}) -add_test ( compute_scalar_product_of_landscapes ${CMAKE_CURRENT_BINARY_DIR}/compute_scalar_product_of_landscapes "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.land" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.land" ) +add_test(NAME compute_scalar_product_of_landscapes COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.land" + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.land") diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt index f1ef144b..55a4fd50 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt @@ -1,27 +1,38 @@ cmake_minimum_required(VERSION 2.6) -project(GUDHI_STAT) +project(Persistence_representations_lanscapes_on_grid_utilities) +file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") - - -#persitence landscapes on a grid add_executable ( create_landscapes_on_grid create_landscapes_on_grid.cpp ) target_link_libraries(create_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) -add_test ( create_landscapes_on_grid ${CMAKE_CURRENT_BINARY_DIR}/create_landscapes_on_grid 100 -1 -1 -1 "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) + +# Will create simple_diagram.txt.land +add_test(NAME create_landscapes_on_grid COMMAND $ + "100" "-1" "-1" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") add_executable ( average_landscapes_on_grid average_landscapes_on_grid.cpp ) target_link_libraries(average_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) -add_test ( average_landscapes_on_grid ${CMAKE_CURRENT_BINARY_DIR}/average_landscapes_on_grid "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.g_land" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.g_land" ) + +add_test(NAME average_landscapes_on_grid COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land" + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land") add_executable ( plot_landscapes_on_grid plot_landscapes_on_grid.cpp ) target_link_libraries(plot_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) -add_test ( plot_landscapes_on_grid ${CMAKE_CURRENT_BINARY_DIR}/plot_landscapes_on_grid "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.g_land" ) + +add_test(NAME plot_landscapes_on_grid COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land") add_executable ( compute_distance_of_landscapes_on_grid compute_distance_of_landscapes_on_grid.cpp ) target_link_libraries(compute_distance_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) -add_test ( compute_distance_of_landscapes_on_grids ${CMAKE_CURRENT_BINARY_DIR}/compute_distance_of_landscapes_on_grid "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.g_land" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.g_land" ) + +add_test(NAME compute_distance_of_landscapes_on_grid COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land" + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land") add_executable ( compute_scalar_product_of_landscapes_on_grid compute_scalar_product_of_landscapes_on_grid.cpp ) target_link_libraries(compute_scalar_product_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) -add_test ( compute_scalar_product_of_landscapes_on_grid ${CMAKE_CURRENT_BINARY_DIR}/compute_scalar_product_of_landscapes_on_grid "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.g_land" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.g_land" ) +add_test(NAME compute_scalar_product_of_landscapes_on_grid COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land" + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land") diff --git a/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt index 8033e27a..e3d1013b 100644 --- a/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt @@ -1,25 +1,38 @@ cmake_minimum_required(VERSION 2.6) -project(GUDHI_STAT) +project(Persistence_vectors_utilities) + +file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") -#persitence vectors add_executable ( create_persistence_vectors create_persistence_vectors.cpp ) target_link_libraries(create_persistence_vectors ${Boost_SYSTEM_LIBRARY}) -add_test ( create_persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/create_persistence_vectors -1 "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" ) + +# Will create simple_diagram.txt.vect +add_test(NAME create_persistence_vectors COMMAND $ + "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") add_executable ( average_persistence_vectors average_persistence_vectors.cpp ) target_link_libraries(average_persistence_vectors ${Boost_SYSTEM_LIBRARY}) -add_test ( average_persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/average_persistence_vectors "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.vect" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.vect" ) + +add_test(NAME average_persistence_vectors COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect" + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect") add_executable ( compute_distance_of_persistence_vectors compute_distance_of_persistence_vectors.cpp ) target_link_libraries(compute_distance_of_persistence_vectors ${Boost_SYSTEM_LIBRARY}) -add_test ( compute_distance_of_persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/compute_distance_of_persistence_vectors -1 "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.vect" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.vect" ) + +add_test(NAME compute_distance_of_persistence_vectors COMMAND $ + "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect" + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect") add_executable ( compute_scalar_product_of_persistence_vectors compute_scalar_product_of_persistence_vectors.cpp ) target_link_libraries(compute_scalar_product_of_persistence_vectors ${Boost_SYSTEM_LIBRARY}) -add_test ( compute_scalar_product_of_persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/compute_scalar_product_of_persistence_vectors "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.vect" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.vect" ) + +add_test(NAME compute_scalar_product_of_persistence_vectors COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect" + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect") add_executable ( plot_persistence_vectors plot_persistence_vectors.cpp ) target_link_libraries(plot_persistence_vectors ${Boost_SYSTEM_LIBRARY}) -add_test ( plot_persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/plot_persistence_vectors "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt.vect" ) - +add_test(NAME plot_persistence_vectors COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect") -- cgit v1.2.3 From ca8474aa59374fc5f4266aa56196587685b86637 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Sat, 9 Dec 2017 12:47:11 +0000 Subject: CMake modification strategy as it was quite painful to maintain all these utilities git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/persistence_representation_integration_cmake_improvement@3062 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: c0eae764abe5c7076ae59027eeab2a7ad451463c --- .../include/gudhi/Persistence_heat_maps.h | 10 +-- .../include/gudhi/Persistence_landscape.h | 11 ++-- .../include/gudhi/Persistence_landscape_on_grid.h | 12 ++-- .../include/gudhi/Persistence_vectors.h | 3 +- .../utilities/CMakeLists.txt | 48 +++++++++++++++ .../utilities/persistence_heat_maps/CMakeLists.txt | 72 ++++------------------ .../average_persistence_heat_maps.cpp | 16 +++-- .../compute_distance_of_persistence_heat_maps.cpp | 13 ++-- ...ute_scalar_product_of_persistence_heat_maps.cpp | 14 +++-- ...h_m_weighted_by_arctan_of_their_persistence.cpp | 33 +++++----- ...te_p_h_m_weighted_by_distance_from_diagonal.cpp | 34 +++++----- ...ate_p_h_m_weighted_by_squared_diag_distance.cpp | 34 +++++----- .../create_persistence_heat_maps.cpp | 34 +++++----- .../persistence_heat_maps/create_pssk.cpp | 34 +++++----- .../plot_persistence_heat_map.cpp | 8 ++- .../utilities/persistence_intervals/CMakeLists.txt | 6 -- .../persistence_landscapes/CMakeLists.txt | 40 ++---------- .../persistence_landscapes/average_landscapes.cpp | 15 ++--- .../compute_distance_of_landscapes.cpp | 14 ++--- .../compute_scalar_product_of_landscapes.cpp | 15 +++-- .../persistence_landscapes/create_landscapes.cpp | 24 +++++--- .../persistence_landscapes/plot_landscapes.cpp | 16 ++--- .../persistence_landscapes_on_grid/CMakeLists.txt | 39 ++---------- .../average_landscapes_on_grid.cpp | 16 +++-- .../compute_distance_of_landscapes_on_grid.cpp | 13 ++-- ...ompute_scalar_product_of_landscapes_on_grid.cpp | 14 +++-- .../create_landscapes_on_grid.cpp | 27 ++++---- .../plot_landscapes_on_grid.cpp | 17 +++-- .../utilities/persistence_vectors/CMakeLists.txt | 38 ++---------- .../average_persistence_vectors.cpp | 13 ++-- .../compute_distance_of_persistence_vectors.cpp | 3 +- ...mpute_scalar_product_of_persistence_vectors.cpp | 15 +++-- .../create_persistence_vectors.cpp | 23 ++++--- .../modules/GUDHI_third_party_libraries.cmake | 5 +- 34 files changed, 332 insertions(+), 397 deletions(-) (limited to 'src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt') diff --git a/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h b/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h index 04dd78ad..ae1740a7 100644 --- a/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h +++ b/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h @@ -743,10 +743,10 @@ void Persistence_heat_maps::compute_percentage_of_active( template void Persistence_heat_maps::plot(const char* filename) const { std::ofstream out; - std::stringstream ss; - ss << filename << "_GnuplotScript"; + std::stringstream gnuplot_script; + gnuplot_script << filename << "_GnuplotScript"; - out.open(ss.str().c_str()); + out.open(gnuplot_script.str().c_str()); out << "plot '-' matrix with image" << std::endl; for (size_t i = 0; i != this->heat_map.size(); ++i) { for (size_t j = 0; j != this->heat_map[i].size(); ++j) { @@ -755,8 +755,8 @@ void Persistence_heat_maps::plot(const char* filename) cons out << std::endl; } out.close(); - std::cout << "Gnuplot script have been created. Open gnuplot and type load \'" << ss.str().c_str() - << "\' to see the picture." << std::endl; + std::cout << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'" + << gnuplot_script.str().c_str() << "\'\"" << std::endl; } template diff --git a/src/Persistence_representations/include/gudhi/Persistence_landscape.h b/src/Persistence_representations/include/gudhi/Persistence_landscape.h index 5c300112..72498edf 100644 --- a/src/Persistence_representations/include/gudhi/Persistence_landscape.h +++ b/src/Persistence_representations/include/gudhi/Persistence_landscape.h @@ -1340,10 +1340,9 @@ void Persistence_landscape::plot(const char* filename, double xRangeBegin, doubl // this program create a gnuplot script file that allows to plot persistence diagram. std::ofstream out; - std::ostringstream nameSS; - nameSS << filename << "_GnuplotScript"; - std::string nameStr = nameSS.str(); - out.open(nameStr); + std::ostringstream gnuplot_script; + gnuplot_script << filename << "_GnuplotScript"; + out.open(gnuplot_script.str().c_str()); if ((xRangeBegin != std::numeric_limits::max()) || (xRangeEnd != std::numeric_limits::max()) || (yRangeBegin != std::numeric_limits::max()) || (yRangeEnd != std::numeric_limits::max())) { @@ -1376,8 +1375,8 @@ void Persistence_landscape::plot(const char* filename, double xRangeBegin, doubl } out << "EOF" << std::endl; } - std::cout << "Gnuplot script to visualize persistence diagram written to the file: " << nameStr << ". Type load '" - << nameStr << "' in gnuplot to visualize." << std::endl; + std::cout << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'" + << gnuplot_script.str().c_str() << "\'\"" << std::endl; } } // namespace Persistence_representations diff --git a/src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h b/src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h index 4ceb9bf6..84fd22ed 100644 --- a/src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h +++ b/src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h @@ -1207,10 +1207,9 @@ void Persistence_landscape_on_grid::plot(const char* filename, double min_x, dou // this program create a gnuplot script file that allows to plot persistence diagram. std::ofstream out; - std::ostringstream nameSS; - nameSS << filename << "_GnuplotScript"; - std::string nameStr = nameSS.str(); - out.open(nameStr); + std::ostringstream gnuplot_script; + gnuplot_script << filename << "_GnuplotScript"; + out.open(gnuplot_script.str().c_str()); if (min_x == max_x) { std::pair min_max = compute_minimum_maximum(); @@ -1241,7 +1240,6 @@ void Persistence_landscape_on_grid::plot(const char* filename, double min_x, dou out << "plot "; for (size_t lambda = from; lambda != to; ++lambda) { - // out << " '-' using 1:2 title 'l" << lambda << "' with lp"; out << " '-' using 1:2 notitle with lp"; if (lambda + 1 != to) { out << ", \\"; @@ -1261,8 +1259,8 @@ void Persistence_landscape_on_grid::plot(const char* filename, double min_x, dou } out << "EOF" << std::endl; } - std::cout << "Gnuplot script to visualize persistence diagram written to the file: " << nameStr << ". Type load '" - << nameStr << "' in gnuplot to visualize." << std::endl; + std::cout << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'" + << gnuplot_script.str().c_str() << "\'\"" << std::endl; } template diff --git a/src/Persistence_representations/include/gudhi/Persistence_vectors.h b/src/Persistence_representations/include/gudhi/Persistence_vectors.h index 0fb49eee..39df37e0 100644 --- a/src/Persistence_representations/include/gudhi/Persistence_vectors.h +++ b/src/Persistence_representations/include/gudhi/Persistence_vectors.h @@ -201,7 +201,8 @@ class Vector_distances_in_diagram { } out << std::endl; out.close(); - std::cout << "To visualize, open gnuplot and type: load \'" << gnuplot_script.str().c_str() << "\'" << std::endl; + std::cout << "To visualize, install gnuplot and type the command: gnuplot -persist -e \"load \'" + << gnuplot_script.str().c_str() << "\'\"" << std::endl; } /** diff --git a/src/Persistence_representations/utilities/CMakeLists.txt b/src/Persistence_representations/utilities/CMakeLists.txt index 66524666..d0d93f9d 100644 --- a/src/Persistence_representations/utilities/CMakeLists.txt +++ b/src/Persistence_representations/utilities/CMakeLists.txt @@ -1,3 +1,51 @@ +# Copy files, otherwise result files are created in sources +file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/first.pers" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") +file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/second.pers" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") + +function(add_persistence_representation_creation_utility creation_utility) + add_executable ( ${creation_utility} ${creation_utility}.cpp ) + + # as the function is called in a subdirectory level, need to '../' to find persistence files + # ARGN will add all the other arguments (except creation_utility) sent to the CMake functions + add_test(NAME Persistence_representation_utilities_${creation_utility} COMMAND $ + ${ARGN} "${CMAKE_CURRENT_BINARY_DIR}/../first.pers" + "${CMAKE_CURRENT_BINARY_DIR}/../second.pers") +endfunction(add_persistence_representation_creation_utility) + +function(add_persistence_representation_plot_utility plot_utility tool_extension) + add_executable ( ${plot_utility} ${plot_utility}.cpp ) + + # as the function is called in a subdirectory level, need to '../' to find persistence heat maps files + add_test(NAME Persistence_representation_utilities_${plot_utility}_first COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}") + add_test(NAME Persistence_representation_utilities_${plot_utility}_second COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}") + if(GNUPLOT_PATH) + add_test(NAME Persistence_representation_utilities_${plot_utility}_first_gnuplot COMMAND ${GNUPLOT_PATH} + "-e" "load '${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}_GnuplotScript'") + add_test(NAME Persistence_representation_utilities_${plot_utility}_second_gnuplot COMMAND ${GNUPLOT_PATH} + "-e" "load '${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}_GnuplotScript'") + endif() +endfunction(add_persistence_representation_plot_utility) + +function(add_persistence_representation_function_utility function_utility tool_extension) + add_executable ( ${function_utility} ${function_utility}.cpp ) + + # ARGV2 is an optional argument + if (${ARGV2}) + # as the function is called in a subdirectory level, need to '../' to find persistence heat maps files + add_test(NAME Persistence_representation_utilities_${function_utility} COMMAND $ + "${ARGV2}" + "${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}" + "${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}") + else() + # as the function is called in a subdirectory level, need to '../' to find persistence heat maps files + add_test(NAME Persistence_representation_utilities_${function_utility} COMMAND $ + "${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}" + "${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}") + endif() +endfunction(add_persistence_representation_function_utility) + add_subdirectory(persistence_heat_maps) add_subdirectory(persistence_intervals) add_subdirectory(persistence_landscapes) diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt index 0dd63852..386e9fa5 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt @@ -1,63 +1,15 @@ cmake_minimum_required(VERSION 2.6) project(Persistence_representations_heat_maps_utilities) -file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") - -add_executable ( create_persistence_heat_maps create_persistence_heat_maps.cpp ) -target_link_libraries(create_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME create_persistence_heat_maps COMMAND $ - "10" "-1" "-1" "4" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") - - -add_executable ( create_pssk create_pssk.cpp ) -target_link_libraries(create_pssk ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME create_pssk COMMAND $ - "10" "-1" "-1" "4" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") - -add_executable ( create_p_h_m_weighted_by_distance_from_diagonal create_p_h_m_weighted_by_distance_from_diagonal.cpp ) -target_link_libraries(create_p_h_m_weighted_by_distance_from_diagonal ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME create_p_h_m_weighted_by_distance_from_diagonal COMMAND $ - "10" "-1" "-1" "4" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") - -add_executable ( create_p_h_m_weighted_by_squared_diag_distance create_p_h_m_weighted_by_squared_diag_distance.cpp ) -target_link_libraries(create_p_h_m_weighted_by_squared_diag_distance ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME create_p_h_m_weighted_by_squared_diag_distance COMMAND $ - "10" "-1" "-1" "4" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") - -add_executable ( create_p_h_m_weighted_by_arctan_of_their_persistence create_p_h_m_weighted_by_arctan_of_their_persistence.cpp ) -target_link_libraries(create_p_h_m_weighted_by_arctan_of_their_persistence ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME create_p_h_m_weighted_by_arctan_of_their_persistence COMMAND $ - "10" "-1" "-1" "4" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") - -add_executable ( average_persistence_heat_maps average_persistence_heat_maps.cpp ) -target_link_libraries(average_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME average_persistence_heat_maps COMMAND $ - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt" - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") - -add_executable ( plot_persistence_heat_map plot_persistence_heat_map.cpp ) -target_link_libraries(plot_persistence_heat_map ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME plot_persistence_heat_map COMMAND $ - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") - -add_executable ( compute_distance_of_persistence_heat_maps compute_distance_of_persistence_heat_maps.cpp ) -target_link_libraries(compute_distance_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME compute_distance_of_persistence_heat_maps COMMAND $ - "1" - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt" - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") - -add_executable ( compute_scalar_product_of_persistence_heat_maps compute_scalar_product_of_persistence_heat_maps.cpp ) -target_link_libraries(compute_scalar_product_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME compute_scalar_product_of_persistence_heat_maps COMMAND $ - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt" - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") +add_persistence_representation_creation_utility(create_pssk "10" "-1" "-1" "4" "-1") +add_persistence_representation_creation_utility(create_p_h_m_weighted_by_arctan_of_their_persistence "10" "-1" "-1" "4" "-1") +add_persistence_representation_creation_utility(create_p_h_m_weighted_by_distance_from_diagonal "10" "-1" "-1" "4" "-1") +add_persistence_representation_creation_utility(create_p_h_m_weighted_by_squared_diag_distance "10" "-1" "-1" "4" "-1") +# Need to set grid min and max for further average, distance and scalar_product +add_persistence_representation_creation_utility(create_persistence_heat_maps "10" "0" "35" "10" "-1") + +add_persistence_representation_plot_utility(plot_persistence_heat_map ".mps") + +add_persistence_representation_function_utility(average_persistence_heat_maps ".mps") +add_persistence_representation_function_utility(compute_distance_of_persistence_heat_maps ".mps" "1") +add_persistence_representation_function_utility(compute_scalar_product_of_persistence_heat_maps ".mps") diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp index 4e81375a..6739e0b6 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp @@ -29,21 +29,20 @@ using constant_scaling_function = Gudhi::Persistence_representations::constant_s using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps; int main(int argc, char** argv) { - std::cout << "This program computes average persistence landscape of persistence landscapes created based on " - "persistence diagrams provided as an input. Please call this program with the names of files with " - "persistence diagrams \n"; - std::vector filenames; + std::cout << "This program computes average of persistence heat maps stored in files (the files needs to be " + << "created beforehand).\n" + << "The parameters of this programs are names of files with persistence heat maps.\n"; - if (argc == 1) { - std::cout << "No input files given, the program will now terminate \n"; + if (argc < 3) { + std::cout << "Wrong number of parameters, the program will now terminate \n"; return 1; } + std::vector filenames; for (int i = 1; i < argc; ++i) { filenames.push_back(argv[i]); } - std::cout << "Creating persistence landscapes...\n"; std::vector maps; for (size_t i = 0; i != filenames.size(); ++i) { Persistence_heat_maps* l = new Persistence_heat_maps; @@ -53,13 +52,12 @@ int main(int argc, char** argv) { Persistence_heat_maps av; av.compute_average(maps); - av.print_to_file("average.mps"); for (size_t i = 0; i != filenames.size(); ++i) { delete maps[i]; } - std::cout << "Done \n"; + std::cout << "Average can be found in 'average.mps' file\n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp index befb0837..ed8278a2 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp @@ -31,11 +31,11 @@ using constant_scaling_function = Gudhi::Persistence_representations::constant_s using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps; int main(int argc, char** argv) { - std::cout << "This program computes distance of persistence heat maps stored in a file (the file needs to be created " - "beforehand). \n"; - std::cout << "The first parameter of a program is an integer p. The program compute L^p distance of the two heat " - "maps. For L^infty distance choose p = -1. \n"; - std::cout << "The remaining parameters of this program are names of files with persistence heat maps.\n"; + std::cout << "This program computes distance of persistence heat maps stored in files (the files needs to be " + << "created beforehand).\n" + << "The first parameter of a program is an integer p. The program compute L^p distance of the two heat " + << "maps. For L^infty distance choose p = -1. \n" + << "The remaining parameters of this program are names of files with persistence heat maps.\n"; if (argc < 3) { std::cout << "Wrong number of parameters, the program will now terminate \n"; @@ -78,7 +78,7 @@ int main(int argc, char** argv) { // and now output the result to the screen and a file: std::ofstream out; - out.open("distance"); + out.open("distance.mps"); for (size_t i = 0; i != distance.size(); ++i) { for (size_t j = 0; j != distance.size(); ++j) { std::cout << distance[i][j] << " "; @@ -89,5 +89,6 @@ int main(int argc, char** argv) { } out.close(); + std::cout << "Distance can be found in 'distance.mps' file\n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp index c684a336..63626853 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp @@ -30,9 +30,14 @@ using constant_scaling_function = Gudhi::Persistence_representations::constant_s using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps; int main(int argc, char** argv) { - std::cout << "This program computes scalar product of persistence landscapes stored in a file (the file needs to be " - "created beforehand). \n"; - std::cout << "The parameters of this programs are names of files with persistence landscapes.\n"; + std::cout << "This program computes scalar product of persistence heat maps stored in a file (the file needs to be " + << "created beforehand). \n" + << "The parameters of this programs are names of files with persistence heat maps.\n"; + + if (argc < 3) { + std::cout << "Wrong number of parameters, the program will now terminate \n"; + return 1; + } std::vector filenames; for (int i = 1; i < argc; ++i) { @@ -64,7 +69,7 @@ int main(int argc, char** argv) { // and now output the result to the screen and a file: std::ofstream out; - out.open("scalar_product"); + out.open("scalar_product.mps"); for (size_t i = 0; i != scalar_product.size(); ++i) { for (size_t j = 0; j != scalar_product.size(); ++j) { std::cout << scalar_product[i][j] << " "; @@ -75,5 +80,6 @@ int main(int argc, char** argv) { } out.close(); + std::cout << "Distance can be found in 'scalar_product.mps' file\n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_arctan_of_their_persistence.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_arctan_of_their_persistence.cpp index 2bf185a3..47c70484 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_arctan_of_their_persistence.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_arctan_of_their_persistence.cpp @@ -32,22 +32,22 @@ using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps; int main(int argc, char** argv) { - std::cout << "This program creates persistence heat map of diagrams provided as an input. The Gaussian kernels are " - "weighted by the arc tangential of their persistence.\n"; - std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; - std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed " - "based on the data, set them both to -1 \n"; - std::cerr << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number " - "of pixels \n"; - std::cout << "The fifth parameter of this program is a dimension of persistence that will be used in creation of the " - "persistence heat maps."; - std::cout << "If our input files contain persistence pairs of various dimension, as a fifth parameter of the " - "procedure please provide the dimension of persistence you want to use."; - std::cout << "If in your file there are only birth-death pairs of the same dimension, set the first parameter to -1." - << std::endl; - std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; + std::cout << "This program creates persistence heat map files (*.mps) of persistence diagrams files (*.pers) " + << "provided as an input.The Gaussian kernels are weighted by the arc tangential of their persistence.\n" + << "The first parameter of a program is an integer, a size of a grid.\n" + << "The second and third parameters are min and max of the grid. If you want those numbers to be computed " + << "based on the data, set them both to -1 \n" + << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number " + << "of pixels.\n" + << "The fifth parameter of this program is a dimension of persistence that will be used in creation of " + << "the persistence heat maps." + << "If your input files contains persistence pairs of various dimension, as a fifth parameter of the " + << "procedure please provide the dimension of persistence you want to use." + << "If in your files there are only birth-death pairs of the same dimension, set the fifth parameter to " + << "-1.\n" + << "The remaining parameters are the names of files with persistence diagrams. \n"; - if (argc < 5) { + if (argc < 7) { std::cout << "Wrong parameter list, the program will now terminate \n"; return 1; } @@ -68,9 +68,7 @@ int main(int argc, char** argv) { filenames.push_back(argv[i]); } - std::cout << "Creating persistence heat maps...\n"; std::vector > filter = Gudhi::Persistence_representations::create_Gaussian_filter(stdiv, 1); - for (size_t i = 0; i != filenames.size(); ++i) { std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; Persistence_heat_maps l(filenames[i], filter, false, size_of_grid, min_, max_, dimension); @@ -79,6 +77,5 @@ int main(int argc, char** argv) { ss << filenames[i] << ".mps"; l.print_to_file(ss.str().c_str()); } - std::cout << "Done \n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_distance_from_diagonal.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_distance_from_diagonal.cpp index ec9477f1..659a5105 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_distance_from_diagonal.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_distance_from_diagonal.cpp @@ -32,22 +32,23 @@ using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps; int main(int argc, char** argv) { - std::cout << "This program creates persistence heat map of diagrams provided as an input. The Gaussian kernels are " - "weighted by the distance of a center from the diagonal.\n"; - std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; - std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed " - "based on the data, set them both to -1 \n"; - std::cerr << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number " - "of pixels \n"; - std::cout << "The fifth parameter of this program is a dimension of persistence that will be used in creation of the " - "persistence heat maps."; - std::cout << "If our input files contain persistence pairs of various dimension, as a fifth parameter of the " - "procedure please provide the dimension of persistence you want to use."; - std::cout << "If in your file there are only birth-death pairs of the same dimension, set the first parameter to -1." - << std::endl; - std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; + std::cout << "This program creates persistence heat map files (*.mps) of persistence diagrams files (*.pers) " + << "provided as an input.The Gaussian kernels are weighted by the distance of a center from the " + << "diagonal.\n" + << "The first parameter of a program is an integer, a size of a grid.\n" + << "The second and third parameters are min and max of the grid. If you want those numbers to be computed " + << "based on the data, set them both to -1 \n" + << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number " + << "of pixels.\n" + << "The fifth parameter of this program is a dimension of persistence that will be used in creation of " + << "the persistence heat maps." + << "If your input files contains persistence pairs of various dimension, as a fifth parameter of the " + << "procedure please provide the dimension of persistence you want to use." + << "If in your files there are only birth-death pairs of the same dimension, set the fifth parameter to " + << "-1.\n" + << "The remaining parameters are the names of files with persistence diagrams. \n"; - if (argc < 5) { + if (argc < 7) { std::cout << "Wrong parameter list, the program will now terminate \n"; return 1; } @@ -68,9 +69,7 @@ int main(int argc, char** argv) { filenames.push_back(argv[i]); } - std::cout << "Creating persistence heat maps...\n"; std::vector > filter = Gudhi::Persistence_representations::create_Gaussian_filter(stdiv, 1); - for (size_t i = 0; i != filenames.size(); ++i) { std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; Persistence_heat_maps l(filenames[i], filter, false, size_of_grid, min_, max_, dimension); @@ -79,6 +78,5 @@ int main(int argc, char** argv) { ss << filenames[i] << ".mps"; l.print_to_file(ss.str().c_str()); } - std::cout << "Done \n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_squared_diag_distance.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_squared_diag_distance.cpp index ffec8b3d..9497b188 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_squared_diag_distance.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_squared_diag_distance.cpp @@ -33,22 +33,23 @@ using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps; int main(int argc, char** argv) { - std::cout << "This program creates persistence heat map of diagrams provided as an input. The Gaussian kernels are " - "weighted by the square of distance of a center from the diagonal.\n"; - std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; - std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed " - "based on the data, set them both to -1 \n"; - std::cerr << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number " - "of pixels \n"; - std::cout << "The fifth parameter of this program is a dimension of persistence that will be used in creation of the " - "persistence heat maps."; - std::cout << "If our input files contain persistence pairs of various dimension, as a fifth parameter of the " - "procedure please provide the dimension of persistence you want to use."; - std::cout << "If in your file there are only birth-death pairs of the same dimension, set the first parameter to -1." - << std::endl; - std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; + std::cout << "This program creates persistence heat map files (*.mps) of persistence diagrams files (*.pers) " + << "provided as an input.The Gaussian kernels are weighted by the square of distance of a center from the " + << "diagonal.\n" + << "The first parameter of a program is an integer, a size of a grid.\n" + << "The second and third parameters are min and max of the grid. If you want those numbers to be computed " + << "based on the data, set them both to -1 \n" + << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number " + << "of pixels.\n" + << "The fifth parameter of this program is a dimension of persistence that will be used in creation of " + << "the persistence heat maps." + << "If your input files contains persistence pairs of various dimension, as a fifth parameter of the " + << "procedure please provide the dimension of persistence you want to use." + << "If in your files there are only birth-death pairs of the same dimension, set the fifth parameter to " + << "-1.\n" + << "The remaining parameters are the names of files with persistence diagrams. \n"; - if (argc < 5) { + if (argc < 7) { std::cout << "Wrong parameter list, the program will now terminate \n"; return 1; } @@ -69,9 +70,7 @@ int main(int argc, char** argv) { filenames.push_back(argv[i]); } - std::cout << "Creating persistence heat maps...\n"; std::vector > filter = Gudhi::Persistence_representations::create_Gaussian_filter(stdiv, 1); - for (size_t i = 0; i != filenames.size(); ++i) { std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; Persistence_heat_maps l(filenames[i], filter, false, size_of_grid, min_, max_, dimension); @@ -80,6 +79,5 @@ int main(int argc, char** argv) { ss << filenames[i] << ".mps"; l.print_to_file(ss.str().c_str()); } - std::cout << "Done \n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp index db2f0008..25cd1067 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp @@ -31,21 +31,22 @@ using constant_scaling_function = Gudhi::Persistence_representations::constant_s using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps; int main(int argc, char** argv) { - std::cout << "This program creates persistence heat map of diagrams provided as an input.\n"; - std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; - std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed " - "based on the data, set them both to -1 \n"; - std::cerr << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number " - "of pixels \n"; + std::cout << "This program creates persistence heat map files (*.mps) of persistence diagrams files (*.pers) " + << "provided as an input.\n" + << "The first parameter of a program is an integer, a size of a grid.\n" + << "The second and third parameters are min and max of the grid. If you want those numbers to be computed " + << "based on the data, set them both to -1 \n" + << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number " + << "of pixels.\n" + << "The fifth parameter of this program is a dimension of persistence that will be used in creation of " + << "the persistence heat maps." + << "If your input files contains persistence pairs of various dimension, as a fifth parameter of the " + << "procedure please provide the dimension of persistence you want to use." + << "If in your files there are only birth-death pairs of the same dimension, set the fifth parameter to " + << "-1.\n" + << "The remaining parameters are the names of files with persistence diagrams. \n"; - std::cout << "The fifth parameter of this program is a dimension of persistence that will be used in creation of the " - "persistence heat maps."; - std::cout << "If your input file contains persistence pairs of various dimension, as a fifth parameter of the " - "procedure please provide the dimension of persistence you want to use."; - std::cout << "If in your file there are only birth-death pairs of the same dimension, set the first parameter to -1." - << std::endl; - std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; - if (argc < 5) { + if (argc < 7) { std::cout << "Wrong parameter list, the program will now terminate \n"; return 1; } @@ -64,17 +65,14 @@ int main(int argc, char** argv) { filenames.push_back(argv[i]); } - std::cout << "Creating persistence heat maps...\n"; std::vector > filter = Gudhi::Persistence_representations::create_Gaussian_filter(stdiv, 1); - for (size_t i = 0; i != filenames.size(); ++i) { - std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; + std::cout << "Creating a heat map based on file : " << filenames[i] << std::endl; Persistence_heat_maps l(filenames[i], filter, false, size_of_grid, min_, max_, dimension); std::stringstream ss; ss << filenames[i] << ".mps"; l.print_to_file(ss.str().c_str()); } - std::cout << "Done \n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/create_pssk.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/create_pssk.cpp index 6aefbb00..97ddb8f0 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/create_pssk.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/create_pssk.cpp @@ -30,21 +30,22 @@ using PSSK = Gudhi::Persistence_representations::PSSK; int main(int argc, char** argv) { - std::cout << "This program creates PSSK of diagrams provided as an input.\n"; - std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; - std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed " - "based on the data, set them both to -1 \n"; - std::cerr << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number " - "of pixels \n"; - std::cout << "The fifth parameter of this program is a dimension of persistence that will be used in creation of the " - "persistence heat maps."; - std::cout << "If our input files contain persistence pairs of various dimension, as a fifth parameter of the " - "procedure please provide the dimension of persistence you want to use."; - std::cout << "If in your file there are only birth-death pairs of the same dimension, set the first parameter to -1." - << std::endl; - std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; + std::cout << "This program creates PSSK files (*.pssk) of persistence diagrams files (*.pers) " + << "provided as an input.\n" + << "The first parameter of a program is an integer, a size of a grid.\n" + << "The second and third parameters are min and max of the grid. If you want those numbers to be computed " + << "based on the data, set them both to -1 \n" + << "The fourth parameter is an integer, the standard deviation of a Gaussian kernel expressed in a number " + << "of pixels.\n" + << "The fifth parameter of this program is a dimension of persistence that will be used in creation of " + << "the PSSK." + << "If your input files contains persistence pairs of various dimension, as a fifth parameter of the " + << "procedure please provide the dimension of persistence you want to use." + << "If in your files there are only birth-death pairs of the same dimension, set the first parameter to " + << "-1.\n" + << "The remaining parameters are the names of files with persistence diagrams. \n"; - if (argc < 5) { + if (argc < 7) { std::cout << "Wrong parameter list, the program will now terminate \n"; return 1; } @@ -65,17 +66,14 @@ int main(int argc, char** argv) { filenames.push_back(argv[i]); } - std::cout << "Creating persistence heat maps...\n"; std::vector > filter = Gudhi::Persistence_representations::create_Gaussian_filter(stdiv, 1); - for (size_t i = 0; i != filenames.size(); ++i) { - std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; + std::cout << "Creating a PSSK based on a file : " << filenames[i] << std::endl; PSSK l(filenames[i], filter, size_of_grid, min_, max_, dimension); std::stringstream ss; ss << filenames[i] << ".pssk"; l.print_to_file(ss.str().c_str()); } - std::cout << "Done \n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp index a7c9f2d8..63711d83 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp @@ -29,8 +29,12 @@ using constant_scaling_function = Gudhi::Persistence_representations::constant_s using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps; int main(int argc, char** argv) { - std::cout << "This program plot persistence landscape stored in a file (the file needs to be created beforehand). " - "Please call the code with the name of a landscape file \n"; + std::cout << "This program creates a gnuplot script from a persistence heat maps stored in a file (the file needs " + << "to be created beforehand). Please call the code with the name of a single heat maps file \n"; + if (argc != 2) { + std::cout << "Wrong parameter list, the program will now terminate \n"; + return 1; + } Persistence_heat_maps l; l.load_from_file(argv[1]); l.plot(argv[1]); diff --git a/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt index 105b7efb..2ba6efe5 100644 --- a/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt @@ -4,38 +4,32 @@ project(Persistence_representations_intervals_utilities) file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") add_executable ( plot_persistence_intervals plot_persistence_intervals.cpp ) -target_link_libraries( plot_persistence_intervals ${Boost_SYSTEM_LIBRARY}) add_test(NAME plot_persistence_intervals COMMAND $ "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") add_executable ( compute_birth_death_range_in_persistence_diagram compute_birth_death_range_in_persistence_diagram.cpp ) -target_link_libraries( compute_birth_death_range_in_persistence_diagram ${Boost_SYSTEM_LIBRARY}) add_test(NAME compute_birth_death_range_in_persistence_diagram COMMAND $ "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") add_executable ( compute_number_of_dominant_intervals compute_number_of_dominant_intervals.cpp ) -target_link_libraries( compute_number_of_dominant_intervals ${Boost_SYSTEM_LIBRARY}) add_test(NAME compute_number_of_dominant_intervals COMMAND $ "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt" "-1" "2") add_executable ( plot_histogram_of_intervals_lengths plot_histogram_of_intervals_lengths.cpp ) -target_link_libraries( plot_histogram_of_intervals_lengths ${Boost_SYSTEM_LIBRARY}) add_test(NAME plot_histogram_of_intervals_lengths COMMAND $ "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt" "2") add_executable ( plot_persistence_Betti_numbers plot_persistence_Betti_numbers.cpp ) -target_link_libraries( plot_persistence_Betti_numbers ${Boost_SYSTEM_LIBRARY}) add_test(NAME plot_persistence_Betti_numbers COMMAND $ "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) add_executable ( compute_bottleneck_distance compute_bottleneck_distance.cpp ) - target_link_libraries( compute_bottleneck_distance ${Boost_SYSTEM_LIBRARY}) if (TBB_FOUND) target_link_libraries(compute_bottleneck_distance ${TBB_LIBRARIES}) endif(TBB_FOUND) diff --git a/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt index baf8de3c..d7087ed8 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt @@ -1,38 +1,10 @@ cmake_minimum_required(VERSION 2.6) -project(Persistence_representations_lanscapes_utilities) +project(Persistence_representations_landscapes_utilities) -file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") +add_persistence_representation_creation_utility(create_landscapes "-1") -add_executable ( create_landscapes create_landscapes.cpp ) -target_link_libraries(create_landscapes ${Boost_SYSTEM_LIBRARY}) +add_persistence_representation_plot_utility(plot_landscapes ".land") -# Will create simple_diagram.txt.land -add_test(NAME create_landscapes COMMAND $ - "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") - -add_executable ( average_landscapes average_landscapes.cpp ) -target_link_libraries(average_landscapes ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME average_landscapes COMMAND $ - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt" - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") - -add_executable ( plot_landscapes plot_landscapes.cpp ) -target_link_libraries(plot_landscapes ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME plot_landscapes COMMAND $ - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") - -add_executable ( compute_distance_of_landscapes compute_distance_of_landscapes.cpp ) -target_link_libraries(compute_distance_of_landscapes ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME compute_distance_of_landscapes COMMAND $ - "1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.land" - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.land") - -add_executable ( compute_scalar_product_of_landscapes compute_scalar_product_of_landscapes.cpp ) -target_link_libraries(compute_scalar_product_of_landscapes ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME compute_scalar_product_of_landscapes COMMAND $ - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.land" - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.land") +add_persistence_representation_function_utility(average_landscapes ".land") +add_persistence_representation_function_utility(compute_distance_of_landscapes ".land" "1") +add_persistence_representation_function_utility(compute_scalar_product_of_landscapes ".land") diff --git a/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp b/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp index 526130e9..1a59be8c 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp +++ b/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp @@ -28,14 +28,13 @@ using Persistence_landscape = Gudhi::Persistence_representations::Persistence_landscape; int main(int argc, char** argv) { - std::cout << "This program computes average persistence landscape of persistence landscapes created based on " - "persistence diagrams provided as an input (you must create them first).\n"; - std::cout << "Please call this program with the names of files with persistence landscapes. The program will create " - "a persistence landscape which will be their average \n"; + std::cout << "This program computes average of persistence landscapes stored in files (the files needs to be " + << "created beforehand).\n" + << "The parameters of this programs are names of files with persistence landscapes.\n"; std::vector filenames; - if (argc == 1) { - std::cout << "No input files given, the program will now terminate \n"; + if (argc < 3) { + std::cout << "Wrong number of parameters, the program will now terminate \n"; return 1; } @@ -43,7 +42,6 @@ int main(int argc, char** argv) { filenames.push_back(argv[i]); } - std::cout << "Creating persistence landscapes...\n"; std::vector lands; for (size_t i = 0; i != filenames.size(); ++i) { Persistence_landscape* l = new Persistence_landscape; @@ -60,7 +58,6 @@ int main(int argc, char** argv) { delete lands[i]; } - std::cout << "Done \n"; - + std::cout << "Average can be found in 'average.land' file\n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp b/src/Persistence_representations/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp index b3881d6a..5062f521 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp +++ b/src/Persistence_representations/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp @@ -30,11 +30,11 @@ using Persistence_landscape = Gudhi::Persistence_representations::Persistence_landscape; int main(int argc, char** argv) { - std::cout << "This program compute distance of persistence landscapes stored in a file (the file needs to be created " - "beforehand). \n"; - std::cout << "The first parameter of a program is an integer p. The program compute L^p distance of the given " - "landscapes. For L^infty distance choose p = -1. \n"; - std::cout << "The remaining parameters of this programs are names of files with persistence landscapes."; + std::cout << "This program computes distance of persistence landscapes stored in files (the files needs to be " + << "created beforehand).\n" + << "The first parameter of a program is an integer p. The program compute L^p distance of the two heat " + << "maps. For L^infty distance choose p = -1. \n" + << "The remaining parameters of this program are names of files with persistence landscapes.\n"; if (argc < 3) { std::cout << "Wrong number of parameters, the program will now terminate \n"; @@ -54,7 +54,6 @@ int main(int argc, char** argv) { std::vector landscaspes; landscaspes.reserve(filenames.size()); for (size_t file_no = 0; file_no != filenames.size(); ++file_no) { - std::cout << "Loading persistence landscape from a file : " << filenames[file_no] << std::endl; Persistence_landscape l; l.load_landscape_from_file(filenames[file_no]); landscaspes.push_back(l); @@ -78,7 +77,7 @@ int main(int argc, char** argv) { // and now output the result to the screen and a file: std::ofstream out; - out.open("distance"); + out.open("distance.land"); for (size_t i = 0; i != distance.size(); ++i) { for (size_t j = 0; j != distance.size(); ++j) { std::cout << distance[i][j] << " "; @@ -89,5 +88,6 @@ int main(int argc, char** argv) { } out.close(); + std::cout << "Distance can be found in 'distance.land' file\n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp b/src/Persistence_representations/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp index 8dad7b4d..5b5e9fa3 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp +++ b/src/Persistence_representations/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp @@ -29,9 +29,14 @@ using Persistence_landscape = Gudhi::Persistence_representations::Persistence_landscape; int main(int argc, char** argv) { - std::cout << "This program compute scalar product of persistence landscapes stored in a file (the file needs to be " - "created beforehand). \n"; - std::cout << "The parameters of this programs are names of files with persistence landscapes.\n"; + std::cout << "This program computes scalar product of persistence landscapes stored in a file (the file needs to be " + << "created beforehand). \n" + << "The parameters of this programs are names of files with persistence landscapes.\n"; + + if (argc < 3) { + std::cout << "Wrong number of parameters, the program will now terminate \n"; + return 1; + } std::vector filenames; for (int i = 1; i < argc; ++i) { @@ -40,7 +45,6 @@ int main(int argc, char** argv) { std::vector landscaspes; landscaspes.reserve(filenames.size()); for (size_t file_no = 0; file_no != filenames.size(); ++file_no) { - std::cout << "Reading persistence landscape from a file : " << filenames[file_no] << std::endl; Persistence_landscape l; l.load_landscape_from_file(filenames[file_no]); landscaspes.push_back(l); @@ -64,7 +68,7 @@ int main(int argc, char** argv) { // and now output the result to the screen and a file: std::ofstream out; - out.open("scalar_product"); + out.open("scalar_product.land"); for (size_t i = 0; i != scalar_product.size(); ++i) { for (size_t j = 0; j != scalar_product.size(); ++j) { std::cout << scalar_product[i][j] << " "; @@ -75,5 +79,6 @@ int main(int argc, char** argv) { } out.close(); + std::cout << "Distance can be found in 'scalar_product.land' file\n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_landscapes/create_landscapes.cpp b/src/Persistence_representations/utilities/persistence_landscapes/create_landscapes.cpp index 325081d1..6030e994 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes/create_landscapes.cpp +++ b/src/Persistence_representations/utilities/persistence_landscapes/create_landscapes.cpp @@ -30,13 +30,20 @@ using Persistence_landscape = Gudhi::Persistence_representations::Persistence_landscape; int main(int argc, char** argv) { - std::cout << "This program creates persistence landscapes of diagrams provided as an input. \n"; - std::cout << "The first parameter of the program is the dimension of persistence to be used to construct persistence " - "landscapes. If your file contains "; - std::cout << "the information about dimension of persistence pairs, please provide here the dimension of persistence " - "pairs you want to use. If your input files consist only "; - std::cout << "of birth-death pairs, please set this first parameter to -1 \n"; - std::cout << "The remaining parameters of the program are the names of files with persistence diagrams. \n"; + std::cout << "This program creates persistence landscapes files (*.land) of persistence diagrams files (*.pers) " + << "provided as an input.\n" + << "The first parameter of this program is a dimension of persistence that will be used in creation of " + << "the persistence heat maps." + << "If your input files contains persistence pairs of various dimension, as a first parameter of the " + << "procedure please provide the dimension of persistence you want to use." + << "If in your files there are only birth-death pairs of the same dimension, set the first parameter to " + << "-1.\n" + << "The remaining parameters are the names of files with persistence diagrams. \n"; + + if (argc < 3) { + std::cout << "Wrong parameter list, the program will now terminate \n"; + return 1; + } std::vector filenames; int dim = atoi(argv[1]); unsigned dimension = std::numeric_limits::max(); @@ -47,13 +54,12 @@ int main(int argc, char** argv) { filenames.push_back(argv[i]); } - std::cout << "Creating persistence landscapes...\n"; for (size_t i = 0; i != filenames.size(); ++i) { + std::cout << "Creating a landscape based on file : " << filenames[i] << std::endl; Persistence_landscape l(filenames[i], dimension); std::stringstream ss; ss << filenames[i] << ".land"; l.print_to_file(ss.str().c_str()); } - std::cout << "Done \n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_landscapes/plot_landscapes.cpp b/src/Persistence_representations/utilities/persistence_landscapes/plot_landscapes.cpp index ebdb20a1..c797a7a8 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes/plot_landscapes.cpp +++ b/src/Persistence_representations/utilities/persistence_landscapes/plot_landscapes.cpp @@ -28,16 +28,16 @@ using Persistence_landscape = Gudhi::Persistence_representations::Persistence_landscape; int main(int argc, char** argv) { - std::cout << "This program plot persistence landscape stored in a file (the file needs to be created beforehand). " - "Please call the code with the name of a landscape file \n"; + std::cout << "This program creates a gnuplot script from a persistence landscape stored in a file (the file needs " + << "to be created beforehand). Please call the code with the name of a single landscape file.\n"; + if (argc != 2) { + std::cout << "Wrong parameter list, the program will now terminate \n"; + return 1; + } + Persistence_landscape l; l.load_landscape_from_file(argv[1]); - - std::stringstream ss; - ss << argv[1] << "_gnuplot_script"; - l.plot(ss.str().c_str()); - - std::cout << "Done \n"; + l.plot(argv[1]); return 0; } diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt index 55a4fd50..c5ea4bbf 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt @@ -1,38 +1,11 @@ cmake_minimum_required(VERSION 2.6) project(Persistence_representations_lanscapes_on_grid_utilities) -file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") +# Need to set grid min and max for further average, distance and scalar_product +add_persistence_representation_creation_utility(create_landscapes_on_grid "100" "0" "35" "-1") -add_executable ( create_landscapes_on_grid create_landscapes_on_grid.cpp ) -target_link_libraries(create_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) +add_persistence_representation_plot_utility(plot_landscapes_on_grid ".g_land") -# Will create simple_diagram.txt.land -add_test(NAME create_landscapes_on_grid COMMAND $ - "100" "-1" "-1" "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") - -add_executable ( average_landscapes_on_grid average_landscapes_on_grid.cpp ) -target_link_libraries(average_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME average_landscapes_on_grid COMMAND $ - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land" - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land") - -add_executable ( plot_landscapes_on_grid plot_landscapes_on_grid.cpp ) -target_link_libraries(plot_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME plot_landscapes_on_grid COMMAND $ - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land") - -add_executable ( compute_distance_of_landscapes_on_grid compute_distance_of_landscapes_on_grid.cpp ) -target_link_libraries(compute_distance_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME compute_distance_of_landscapes_on_grid COMMAND $ - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land" - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land") - -add_executable ( compute_scalar_product_of_landscapes_on_grid compute_scalar_product_of_landscapes_on_grid.cpp ) -target_link_libraries(compute_scalar_product_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME compute_scalar_product_of_landscapes_on_grid COMMAND $ - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land" - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.g_land") +add_persistence_representation_function_utility(average_landscapes_on_grid ".g_land") +add_persistence_representation_function_utility(compute_distance_of_landscapes_on_grid ".g_land" "1") +add_persistence_representation_function_utility(compute_scalar_product_of_landscapes_on_grid ".g_land") diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp index d50118a0..0b098d1a 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp +++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp @@ -28,21 +28,20 @@ using Persistence_landscape_on_grid = Gudhi::Persistence_representations::Persistence_landscape_on_grid; int main(int argc, char** argv) { - std::cout << "This program computes average persistence landscape on grid of persistence landscapes on grid created " - "based on persistence diagrams provided as an input. Please call this program with the names of files " - "with persistence diagrams \n"; - std::vector filenames; + std::cout << "This program computes average of persistence landscapes on grid stored in files (the files needs to " + << "be created beforehand).\n" + << "The parameters of this programs are names of files with persistence landscapes on grid.\n"; - if (argc == 1) { - std::cout << "No input files given, the program will now terminate \n"; + if (argc < 3) { + std::cout << "Wrong number of parameters, the program will now terminate \n"; return 1; } + std::vector filenames; for (int i = 1; i < argc; ++i) { filenames.push_back(argv[i]); } - std::cout << "Creating persistence landscapes...\n"; std::vector lands; for (size_t i = 0; i != filenames.size(); ++i) { Persistence_landscape_on_grid* l = new Persistence_landscape_on_grid; @@ -59,7 +58,6 @@ int main(int argc, char** argv) { delete lands[i]; } - std::cout << "Done \n"; - + std::cout << "Average can be found in 'average.g_land' file\n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp index 859c6991..fd0fcd15 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp +++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp @@ -30,11 +30,11 @@ using Persistence_landscape_on_grid = Gudhi::Persistence_representations::Persistence_landscape_on_grid; int main(int argc, char** argv) { - std::cout << "This program compute distance of persistence landscapes on grid stored in a file (the file needs to be " - "created beforehand). \n"; - std::cout << "The first parameter of a program is an integer p. The program compute L^p distance of the landscapes " - "on grid. For L^infty distance choose p = -1. \n"; - std::cout << "The remaining parameters of this programs are names of files with persistence landscapes on grid.\n"; + std::cout << "This program computes distance of persistence landscapes on grid stored in files (the files needs to " + << "be created beforehand).\n" + << "The first parameter of a program is an integer p. The program compute L^p distance of the two heat " + << "maps. For L^infty distance choose p = -1. \n" + << "The remaining parameters of this program are names of files with persistence landscapes on grid.\n"; if (argc < 3) { std::cout << "Wrong number of parameters, the program will now terminate \n"; @@ -77,7 +77,7 @@ int main(int argc, char** argv) { // and now output the result to the screen and a file: std::ofstream out; - out.open("distance"); + out.open("distance.g_land"); for (size_t i = 0; i != distance.size(); ++i) { for (size_t j = 0; j != distance.size(); ++j) { std::cout << distance[i][j] << " "; @@ -88,5 +88,6 @@ int main(int argc, char** argv) { } out.close(); + std::cout << "Distance can be found in 'distance.g_land' file\n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp index e95bf8ad..e2222487 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp +++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp @@ -29,9 +29,14 @@ using Persistence_landscape_on_grid = Gudhi::Persistence_representations::Persistence_landscape_on_grid; int main(int argc, char** argv) { - std::cout << "This program compute scalar product of persistence landscapes on grid stored in a file (the file needs " - "to be created beforehand). \n"; - std::cout << "The parameters of this programs are names of files with persistence landscapes on grid.\n"; + std::cout << "This program computes scalar product of persistence landscapes on grid stored in a file (the file needs to " + << "be created beforehand). \n" + << "The parameters of this programs are names of files with persistence landscapes on grid.\n"; + + if (argc < 3) { + std::cout << "Wrong number of parameters, the program will now terminate \n"; + return 1; + } std::vector filenames; for (int i = 1; i < argc; ++i) { @@ -63,7 +68,7 @@ int main(int argc, char** argv) { // and now output the result to the screen and a file: std::ofstream out; - out.open("scalar_product"); + out.open("scalar_product.g_land"); for (size_t i = 0; i != scalar_product.size(); ++i) { for (size_t j = 0; j != scalar_product.size(); ++j) { std::cout << scalar_product[i][j] << " "; @@ -74,5 +79,6 @@ int main(int argc, char** argv) { } out.close(); + std::cout << "Distance can be found in 'scalar_product.g_land' file\n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp index 8d747c14..2827f982 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp +++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp @@ -30,22 +30,25 @@ using Persistence_landscape_on_grid = Gudhi::Persistence_representations::Persistence_landscape_on_grid; int main(int argc, char** argv) { - std::cout << "This program creates persistence landscape on grid of diagrams provided as an input.\n"; - std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; - std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed " - "based on the data, set them both to -1 \n"; - std::cout << "The fourth parameter of the program is the dimension of persistence to be used to construct " - "persistence landscape on a grid. If your file contains "; - std::cout << "the information about dimension of birth-death pairs, please provide here the dimension of intervals " - "you want to use. If your input files consist only "; - std::cout << "of birth-death pairs, please set the fourth parameter to -1 \n"; - std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; + std::cout << "This program creates persistence landscapes on grid files (*.g_land) of persistence diagrams files " + << "(*.pers) provided as an input.\n" + << "The first parameter of a program is an integer, a size of a grid.\n" + << "The second and third parameters are min and max of the grid. If you want those numbers to be computed " + << "based on the data, set them both to -1 \n" + << "The fourth parameter of this program is a dimension of persistence that will be used in creation of " + << "the persistence heat maps." + << "If your input files contains persistence pairs of various dimension, as a fourth parameter of the " + << "procedure please provide the dimension of persistence you want to use." + << "If in your files there are only birth-death pairs of the same dimension, set the fourth parameter to " + << "-1.\n" + << "The remaining parameters are the names of files with persistence diagrams. \n"; - if (argc < 5) { + if (argc < 6) { std::cout << "Wrong parameter list, the program will now terminate \n"; return 1; } + size_t size_of_grid = (size_t)atoi(argv[1]); double min_ = atof(argv[2]); double max_ = atof(argv[3]); @@ -60,7 +63,6 @@ int main(int argc, char** argv) { filenames.push_back(argv[i]); } - std::cout << "Creating persistence landscapes...\n"; for (size_t i = 0; i != filenames.size(); ++i) { std::cout << "Creating persistence landscape on a grid based on a file : " << filenames[i] << std::endl; Persistence_landscape_on_grid l; @@ -74,6 +76,5 @@ int main(int argc, char** argv) { ss << filenames[i] << ".g_land"; l.print_to_file(ss.str().c_str()); } - std::cout << "Done \n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp index 42822a01..dddb3615 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp +++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp @@ -28,20 +28,17 @@ using Persistence_landscape_on_grid = Gudhi::Persistence_representations::Persistence_landscape_on_grid; int main(int argc, char** argv) { - std::cout << "This program plot persistence landscape on grid stored in a file (the file needs to be created " - "beforehand). Please call the code with the name of a landscape on grid file \n"; - if (argc == 1) { - std::cout << "Wrong parameters of a program call, the program will now terminate \n"; + std::cout << "This program creates a gnuplot script from a persistence landscape on grid stored in a file (the file " + << "needs to be created beforehand). Please call the code with the name of a single landscape on grid file" + << ".\n"; + if (argc != 2) { + std::cout << "Wrong parameter list, the program will now terminate \n"; return 1; } + Persistence_landscape_on_grid l; l.load_landscape_from_file(argv[1]); - - std::stringstream ss; - ss << argv[1] << "_gnuplot_script"; - l.plot(ss.str().c_str()); - - std::cout << "Done \n"; + l.plot(argv[1]); return 0; } diff --git a/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt index e3d1013b..a401c955 100644 --- a/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt @@ -1,38 +1,10 @@ cmake_minimum_required(VERSION 2.6) project(Persistence_vectors_utilities) -file(COPY "${CMAKE_SOURCE_DIR}/data/persistence_diagram/simple_diagram.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/") +add_persistence_representation_creation_utility(create_persistence_vectors "-1") -add_executable ( create_persistence_vectors create_persistence_vectors.cpp ) -target_link_libraries(create_persistence_vectors ${Boost_SYSTEM_LIBRARY}) +add_persistence_representation_plot_utility(plot_persistence_vectors ".vect") -# Will create simple_diagram.txt.vect -add_test(NAME create_persistence_vectors COMMAND $ - "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt") - -add_executable ( average_persistence_vectors average_persistence_vectors.cpp ) -target_link_libraries(average_persistence_vectors ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME average_persistence_vectors COMMAND $ - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect" - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect") - -add_executable ( compute_distance_of_persistence_vectors compute_distance_of_persistence_vectors.cpp ) -target_link_libraries(compute_distance_of_persistence_vectors ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME compute_distance_of_persistence_vectors COMMAND $ - "-1" "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect" - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect") - -add_executable ( compute_scalar_product_of_persistence_vectors compute_scalar_product_of_persistence_vectors.cpp ) -target_link_libraries(compute_scalar_product_of_persistence_vectors ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME compute_scalar_product_of_persistence_vectors COMMAND $ - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect" - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect") - -add_executable ( plot_persistence_vectors plot_persistence_vectors.cpp ) -target_link_libraries(plot_persistence_vectors ${Boost_SYSTEM_LIBRARY}) - -add_test(NAME plot_persistence_vectors COMMAND $ - "${CMAKE_CURRENT_BINARY_DIR}/simple_diagram.txt.vect") +add_persistence_representation_function_utility(average_persistence_vectors ".vect") +add_persistence_representation_function_utility(compute_distance_of_persistence_vectors ".vect" "1") +add_persistence_representation_function_utility(compute_scalar_product_of_persistence_vectors ".vect") diff --git a/src/Persistence_representations/utilities/persistence_vectors/average_persistence_vectors.cpp b/src/Persistence_representations/utilities/persistence_vectors/average_persistence_vectors.cpp index 366ee2bc..8de7725c 100644 --- a/src/Persistence_representations/utilities/persistence_vectors/average_persistence_vectors.cpp +++ b/src/Persistence_representations/utilities/persistence_vectors/average_persistence_vectors.cpp @@ -30,21 +30,20 @@ using Vector_distances_in_diagram = Gudhi::Persistence_representations::Vector_distances_in_diagram; int main(int argc, char** argv) { - std::cout << "This program computes average persistence vector of persistence vectors created based on persistence " - "diagrams provided as an input. \n"; - std::cout << "Please call this program with the names of files with persistence diagrams \n"; - std::vector filenames; + std::cout << "This program computes average of persistence vectors stored in files (the files needs to " + << "be created beforehand).\n" + << "The parameters of this programs are names of files with persistence vectors.\n"; - if (argc == 1) { - std::cout << "No input files given, the program will now terminate \n"; + if (argc < 3) { + std::cout << "Wrong number of parameters, the program will now terminate \n"; return 1; } + std::vector filenames; for (int i = 1; i < argc; ++i) { filenames.push_back(argv[i]); } - std::cout << "Reading persistence vectors...\n"; std::vector lands; for (size_t i = 0; i != filenames.size(); ++i) { Vector_distances_in_diagram* l = new Vector_distances_in_diagram; diff --git a/src/Persistence_representations/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp b/src/Persistence_representations/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp index 3aed297e..f8b71e5b 100644 --- a/src/Persistence_representations/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp +++ b/src/Persistence_representations/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp @@ -79,7 +79,7 @@ int main(int argc, char** argv) { // and now output the result to the screen and a file: std::ofstream out; - out.open("distance"); + out.open("distance.vect"); for (size_t i = 0; i != distance.size(); ++i) { for (size_t j = 0; j != distance.size(); ++j) { std::cout << distance[i][j] << " "; @@ -90,5 +90,6 @@ int main(int argc, char** argv) { } out.close(); + std::cout << "Distance can be found in 'distance.vect' file\n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp b/src/Persistence_representations/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp index d9ad4360..bda0b61b 100644 --- a/src/Persistence_representations/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp +++ b/src/Persistence_representations/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp @@ -32,9 +32,14 @@ using Vector_distances_in_diagram = Gudhi::Persistence_representations::Vector_distances_in_diagram; int main(int argc, char** argv) { - std::cout << "This program compute scalar product of persistence vectors stored in a file (the file needs to be " - "created beforehand). \n"; - std::cout << "The parameters of this programs are names of files with persistence vectors.\n"; + std::cout << "This program computes scalar product of persistence vectors stored in a file (the file needs to " + << "be created beforehand). \n" + << "The parameters of this programs are names of files with persistence vectors.\n"; + + if (argc < 3) { + std::cout << "Wrong number of parameters, the program will now terminate \n"; + return 1; + } std::vector filenames; for (int i = 1; i < argc; ++i) { @@ -66,7 +71,7 @@ int main(int argc, char** argv) { // and now output the result to the screen and a file: std::ofstream out; - out.open("scalar_product"); + out.open("scalar_product.vect"); for (size_t i = 0; i != scalar_product.size(); ++i) { for (size_t j = 0; j != scalar_product.size(); ++j) { std::cout << scalar_product[i][j] << " "; @@ -76,5 +81,7 @@ int main(int argc, char** argv) { out << std::endl; } out.close(); + + std::cout << "Distance can be found in 'scalar_product.vect' file\n"; return 0; } diff --git a/src/Persistence_representations/utilities/persistence_vectors/create_persistence_vectors.cpp b/src/Persistence_representations/utilities/persistence_vectors/create_persistence_vectors.cpp index b618ca67..753675cb 100644 --- a/src/Persistence_representations/utilities/persistence_vectors/create_persistence_vectors.cpp +++ b/src/Persistence_representations/utilities/persistence_vectors/create_persistence_vectors.cpp @@ -32,13 +32,21 @@ using Vector_distances_in_diagram = Gudhi::Persistence_representations::Vector_distances_in_diagram; int main(int argc, char** argv) { - std::cout << "This program creates persistence vectors of diagrams provided as an input. The first parameter of this " - "program is a dimension of persistence "; - std::cout << " that will be used in creation of the persistence vectors. If our input files contain persistence " - "pairs of various dimension, as a second parameter of the "; - std::cout << " procedure please provide the dimension of persistence you want to use. If in your file there are only " - "birth-death pairs of the same dimension, set the first parameter to -1." - << std::endl; + std::cout << "This program creates persistence vectors files (*.vect) of persistence diagrams files (*.pers) " + << "provided as an input.\n" + << "The first parameter of this program is a dimension of persistence that will be used in creation of " + << "the persistence heat maps." + << "If your input files contains persistence pairs of various dimension, as a first parameter of the " + << "procedure please provide the dimension of persistence you want to use." + << "If in your files there are only birth-death pairs of the same dimension, set the first parameter to " + << "-1.\n" + << "The remaining parameters are the names of files with persistence diagrams. \n"; + + if (argc < 3) { + std::cout << "Wrong parameter list, the program will now terminate \n"; + return 1; + } + std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; int dim = atoi(argv[1]); unsigned dimension = std::numeric_limits::max(); @@ -58,6 +66,5 @@ int main(int argc, char** argv) { ss << filenames[i] << ".vect"; l.print_to_file(ss.str().c_str()); } - std::cout << "Done \n"; return 0; } diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 8269c3bf..e44bbe04 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -85,7 +85,6 @@ 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}") @@ -94,6 +93,10 @@ FIND_PROGRAM( DIFF_PATH diff ) if (DIFF_PATH) message("diff found in ${DIFF_PATH}") endif() +FIND_PROGRAM( GNUPLOT_PATH gnuplot ) +if (GNUPLOT_PATH) + message("gnuplot found in ${GNUPLOT_PATH}") +endif() # BOOST ISSUE result_of vs C++11 add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE) -- cgit v1.2.3 From 00a3424bd68ced3e2d159acf8b2e73f515a3d88b Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 15 May 2018 19:55:31 +0000 Subject: CMake minimal version is now 3.1 Compilation flags are now externalized in cmake/modules Add NO_POLICY_SCOPE for GUDHI_third_parties to fix warnings Try to fix CGAL 4.12 that is no more setting CGAL_LIBRARIES git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cmake_v3_vincent@3445 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 0ac7613f016e28cc634606f76e85ecaf5bacb2d4 --- CMakeLists.txt | 29 ++++------------ src/Alpha_complex/example/CMakeLists.txt | 1 - src/Alpha_complex/test/CMakeLists.txt | 1 - src/Alpha_complex/utilities/CMakeLists.txt | 1 - src/Bitmap_cubical_complex/example/CMakeLists.txt | 1 - src/Bitmap_cubical_complex/test/CMakeLists.txt | 1 - .../utilities/CMakeLists.txt | 1 - src/Bottleneck_distance/benchmark/CMakeLists.txt | 1 - src/Bottleneck_distance/example/CMakeLists.txt | 1 - src/Bottleneck_distance/test/CMakeLists.txt | 1 - src/Bottleneck_distance/utilities/CMakeLists.txt | 1 - src/CMakeLists.txt | 39 ++++++---------------- src/Contraction/example/CMakeLists.txt | 1 - src/GudhUI/CMakeLists.txt | 3 +- src/Nerve_GIC/example/CMakeLists.txt | 7 ++-- src/Nerve_GIC/test/CMakeLists.txt | 1 - src/Nerve_GIC/utilities/CMakeLists.txt | 1 - .../example/CMakeLists.txt | 1 - .../test/CMakeLists.txt | 1 - .../utilities/persistence_heat_maps/CMakeLists.txt | 1 - .../utilities/persistence_intervals/CMakeLists.txt | 1 - .../persistence_landscapes/CMakeLists.txt | 1 - .../persistence_landscapes_on_grid/CMakeLists.txt | 1 - .../utilities/persistence_vectors/CMakeLists.txt | 1 - src/Persistent_cohomology/benchmark/CMakeLists.txt | 2 -- src/Persistent_cohomology/example/CMakeLists.txt | 1 - src/Persistent_cohomology/test/CMakeLists.txt | 1 - src/Rips_complex/example/CMakeLists.txt | 1 - src/Rips_complex/test/CMakeLists.txt | 1 - src/Rips_complex/utilities/CMakeLists.txt | 1 - src/Simplex_tree/example/CMakeLists.txt | 1 - src/Simplex_tree/test/CMakeLists.txt | 1 - src/Skeleton_blocker/example/CMakeLists.txt | 1 - src/Skeleton_blocker/test/CMakeLists.txt | 1 - src/Spatial_searching/example/CMakeLists.txt | 1 - src/Spatial_searching/test/CMakeLists.txt | 1 - src/Subsampling/example/CMakeLists.txt | 1 - src/Subsampling/test/CMakeLists.txt | 1 - src/Tangential_complex/benchmark/CMakeLists.txt | 1 - src/Tangential_complex/example/CMakeLists.txt | 1 - src/Tangential_complex/test/CMakeLists.txt | 1 - src/Witness_complex/example/CMakeLists.txt | 1 - src/Witness_complex/test/CMakeLists.txt | 1 - src/Witness_complex/utilities/CMakeLists.txt | 1 - src/cmake/modules/GUDHI_compilation_flags.cmake | 36 ++++++++++++++++++++ src/common/example/CMakeLists.txt | 1 - src/common/test/CMakeLists.txt | 1 - src/common/utilities/CMakeLists.txt | 1 - src/cython/CMakeLists.txt | 6 ++-- 49 files changed, 60 insertions(+), 104 deletions(-) create mode 100644 src/cmake/modules/GUDHI_compilation_flags.cmake (limited to 'src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 10373f75..08291b54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,35 +1,18 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 3.1) + project(GUDHIdev) include(CMakeGUDHIVersion.txt) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/cmake/modules/") -enable_testing() - -# This variable is used by Cython CMakeLists.txt to know its path +# This variable is used by Cython CMakeLists.txt and by GUDHI_third_party_libraries to know its path set(GUDHI_CYTHON_PATH "src/cython") -# For third parties libraries management - To be done last as CGAL updates CMAKE_MODULE_PATH -include(GUDHI_third_party_libraries) - -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() +# For third parties libraries management - To be done last as CGAL updates CMAKE_MODULE_PATH +include(GUDHI_third_party_libraries NO_POLICY_SCOPE) -if (DEBUG_TRACES) - # For programs to be more verbose - message(STATUS "DEBUG_TRACES are activated") - add_definitions(-DDEBUG_TRACES) -endif() +include(GUDHI_compilation_flags) # Add your new module in the list, order is not important include(GUDHI_modules) diff --git a/src/Alpha_complex/example/CMakeLists.txt b/src/Alpha_complex/example/CMakeLists.txt index 5bf553e9..2fc62452 100644 --- a/src/Alpha_complex/example/CMakeLists.txt +++ b/src/Alpha_complex/example/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Alpha_complex_examples) # need CGAL 4.7 diff --git a/src/Alpha_complex/test/CMakeLists.txt b/src/Alpha_complex/test/CMakeLists.txt index 9e0b3b3c..9255d3db 100644 --- a/src/Alpha_complex/test/CMakeLists.txt +++ b/src/Alpha_complex/test/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Alpha_complex_tests) if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) diff --git a/src/Alpha_complex/utilities/CMakeLists.txt b/src/Alpha_complex/utilities/CMakeLists.txt index a2dfac20..7ace6064 100644 --- a/src/Alpha_complex/utilities/CMakeLists.txt +++ b/src/Alpha_complex/utilities/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Alpha_complex_utilities) if(CGAL_FOUND) diff --git a/src/Bitmap_cubical_complex/example/CMakeLists.txt b/src/Bitmap_cubical_complex/example/CMakeLists.txt index 99304aa4..dc659f2d 100644 --- a/src/Bitmap_cubical_complex/example/CMakeLists.txt +++ b/src/Bitmap_cubical_complex/example/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Bitmap_cubical_complex_examples) add_executable ( Random_bitmap_cubical_complex Random_bitmap_cubical_complex.cpp ) diff --git a/src/Bitmap_cubical_complex/test/CMakeLists.txt b/src/Bitmap_cubical_complex/test/CMakeLists.txt index 02b026f2..8b43632a 100644 --- a/src/Bitmap_cubical_complex/test/CMakeLists.txt +++ b/src/Bitmap_cubical_complex/test/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Bitmap_cubical_complex_tests) include(GUDHI_test_coverage) diff --git a/src/Bitmap_cubical_complex/utilities/CMakeLists.txt b/src/Bitmap_cubical_complex/utilities/CMakeLists.txt index 676a730a..416db67f 100644 --- a/src/Bitmap_cubical_complex/utilities/CMakeLists.txt +++ b/src/Bitmap_cubical_complex/utilities/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Bitmap_cubical_complex_utilities) add_executable ( cubical_complex_persistence cubical_complex_persistence.cpp ) diff --git a/src/Bottleneck_distance/benchmark/CMakeLists.txt b/src/Bottleneck_distance/benchmark/CMakeLists.txt index 20a4e47b..3105a1d5 100644 --- a/src/Bottleneck_distance/benchmark/CMakeLists.txt +++ b/src/Bottleneck_distance/benchmark/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Bottleneck_distance_benchmark) if (NOT CGAL_VERSION VERSION_LESS 4.8.1) diff --git a/src/Bottleneck_distance/example/CMakeLists.txt b/src/Bottleneck_distance/example/CMakeLists.txt index 6095d6eb..c6f10127 100644 --- a/src/Bottleneck_distance/example/CMakeLists.txt +++ b/src/Bottleneck_distance/example/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Bottleneck_distance_examples) if (NOT CGAL_VERSION VERSION_LESS 4.8.1) diff --git a/src/Bottleneck_distance/test/CMakeLists.txt b/src/Bottleneck_distance/test/CMakeLists.txt index 2676b82c..bb739280 100644 --- a/src/Bottleneck_distance/test/CMakeLists.txt +++ b/src/Bottleneck_distance/test/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Bottleneck_distance_tests) if (NOT CGAL_VERSION VERSION_LESS 4.8.1) diff --git a/src/Bottleneck_distance/utilities/CMakeLists.txt b/src/Bottleneck_distance/utilities/CMakeLists.txt index d19e3b1c..2f35885c 100644 --- a/src/Bottleneck_distance/utilities/CMakeLists.txt +++ b/src/Bottleneck_distance/utilities/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Bottleneck_distance_utilities) if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 94587044..5d543018 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,12 +1,19 @@ -cmake_minimum_required(VERSION 2.6) -project(GUDHI) +cmake_minimum_required(VERSION 3.1) -include("CMakeGUDHIVersion.txt") +project(GUDHI) -enable_testing() +include(CMakeGUDHIVersion.txt) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/") +# This variable is used by Cython CMakeLists.txt and by GUDHI_third_party_libraries to know its path +set(GUDHI_CYTHON_PATH "cython") + +# For third parties libraries management - To be done last as CGAL updates CMAKE_MODULE_PATH +include(GUDHI_third_party_libraries NO_POLICY_SCOPE) + +include(GUDHI_compilation_flags) + # Add your new module in the list, order is not important include(GUDHI_modules) @@ -33,30 +40,6 @@ message("++ GUDHI_MODULES list is:\"${GUDHI_MODULES}\"") set(GUDHI_USER_VERSION_DIR ${CMAKE_SOURCE_DIR}) include(GUDHI_doxygen_target) -# This variable is used by Cython CMakeLists.txt to know its path -set(GUDHI_CYTHON_PATH "cython") -# For third parties libraries management - To be done last as CGAL updates CMAKE_MODULE_PATH -include(GUDHI_third_party_libraries) - -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() - -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) diff --git a/src/Contraction/example/CMakeLists.txt b/src/Contraction/example/CMakeLists.txt index a92d1685..582b7ab8 100644 --- a/src/Contraction/example/CMakeLists.txt +++ b/src/Contraction/example/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Contraction_examples) add_executable(RipsContraction Rips_contraction.cpp) diff --git a/src/GudhUI/CMakeLists.txt b/src/GudhUI/CMakeLists.txt index 2503a03e..b357b8f7 100644 --- a/src/GudhUI/CMakeLists.txt +++ b/src/GudhUI/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.8) project(GudhUI) # Need to find OpenGL first as find_package(Qt5) tries to #include"GL/gl.h" on some platforms @@ -38,4 +37,4 @@ if (OPENGL_FOUND) install(TARGETS GudhUI DESTINATION bin) endif() -endif(OPENGL_FOUND) \ No newline at end of file +endif(OPENGL_FOUND) diff --git a/src/Nerve_GIC/example/CMakeLists.txt b/src/Nerve_GIC/example/CMakeLists.txt index 542c6af4..fdecf86e 100644 --- a/src/Nerve_GIC/example/CMakeLists.txt +++ b/src/Nerve_GIC/example/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Nerve_GIC_examples) if (NOT CGAL_VERSION VERSION_LESS 4.8.1) @@ -17,11 +16,11 @@ if (NOT CGAL_VERSION VERSION_LESS 4.8.1) file(COPY "${CMAKE_SOURCE_DIR}/data/points/COIL_database/lucky_cat_PCA1" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) add_test(NAME Nerve_GIC_example_CoordGIC COMMAND $ - "tore3D_1307.off" "0") + "${CMAKE_CURRENT_BINARY_DIR}/tore3D_1307.off" "0") add_test(NAME Nerve_GIC_example_FuncGIC COMMAND $ - "lucky_cat.off" - "lucky_cat_PCA1") + "${CMAKE_CURRENT_BINARY_DIR}/lucky_cat.off" + "${CMAKE_CURRENT_BINARY_DIR}/lucky_cat_PCA1") install(TARGETS CoordGIC DESTINATION bin) install(TARGETS FuncGIC DESTINATION bin) diff --git a/src/Nerve_GIC/test/CMakeLists.txt b/src/Nerve_GIC/test/CMakeLists.txt index c35cdff7..99263ea0 100644 --- a/src/Nerve_GIC/test/CMakeLists.txt +++ b/src/Nerve_GIC/test/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Graph_induced_complex_tests) if (NOT CGAL_VERSION VERSION_LESS 4.8.1) diff --git a/src/Nerve_GIC/utilities/CMakeLists.txt b/src/Nerve_GIC/utilities/CMakeLists.txt index 7a838a8c..215f9dfd 100644 --- a/src/Nerve_GIC/utilities/CMakeLists.txt +++ b/src/Nerve_GIC/utilities/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Nerve_GIC_examples) if (NOT CGAL_VERSION VERSION_LESS 4.8.1) diff --git a/src/Persistence_representations/example/CMakeLists.txt b/src/Persistence_representations/example/CMakeLists.txt index 54d719ac..33558df3 100644 --- a/src/Persistence_representations/example/CMakeLists.txt +++ b/src/Persistence_representations/example/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Persistence_representations_example) add_executable ( Persistence_representations_example_landscape_on_grid persistence_landscape_on_grid.cpp ) diff --git a/src/Persistence_representations/test/CMakeLists.txt b/src/Persistence_representations/test/CMakeLists.txt index 335a71ef..5e2b6910 100644 --- a/src/Persistence_representations/test/CMakeLists.txt +++ b/src/Persistence_representations/test/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Persistence_representations_test) include(GUDHI_test_coverage) diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt index 386e9fa5..89ef232f 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Persistence_representations_heat_maps_utilities) add_persistence_representation_creation_utility(create_pssk "10" "-1" "-1" "4" "-1") diff --git a/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt index 875ff45e..649b72cb 100644 --- a/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Persistence_representations_intervals_utilities) diff --git a/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt index d7087ed8..6b24d032 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Persistence_representations_landscapes_utilities) add_persistence_representation_creation_utility(create_landscapes "-1") diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt index c5ea4bbf..36f3196b 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Persistence_representations_lanscapes_on_grid_utilities) # Need to set grid min and max for further average, distance and scalar_product diff --git a/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt index a401c955..bc982094 100644 --- a/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Persistence_vectors_utilities) add_persistence_representation_creation_utility(create_persistence_vectors "-1") diff --git a/src/Persistent_cohomology/benchmark/CMakeLists.txt b/src/Persistent_cohomology/benchmark/CMakeLists.txt index 8b135ba1..2bb3b0c7 100644 --- a/src/Persistent_cohomology/benchmark/CMakeLists.txt +++ b/src/Persistent_cohomology/benchmark/CMakeLists.txt @@ -1,6 +1,4 @@ -cmake_minimum_required(VERSION 2.6) project(Persistent_cohomology_benchmark) - if(GMP_FOUND) if(GMPXX_FOUND) diff --git a/src/Persistent_cohomology/example/CMakeLists.txt b/src/Persistent_cohomology/example/CMakeLists.txt index 18e2913b..0f731519 100644 --- a/src/Persistent_cohomology/example/CMakeLists.txt +++ b/src/Persistent_cohomology/example/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Persistent_cohomology_examples) add_executable(plain_homology plain_homology.cpp) diff --git a/src/Persistent_cohomology/test/CMakeLists.txt b/src/Persistent_cohomology/test/CMakeLists.txt index 45f53eb9..f8baf861 100644 --- a/src/Persistent_cohomology/test/CMakeLists.txt +++ b/src/Persistent_cohomology/test/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Persistent_cohomology_tests) include(GUDHI_test_coverage) diff --git a/src/Rips_complex/example/CMakeLists.txt b/src/Rips_complex/example/CMakeLists.txt index af86636b..e7772bdb 100644 --- a/src/Rips_complex/example/CMakeLists.txt +++ b/src/Rips_complex/example/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Rips_complex_examples) # Point cloud diff --git a/src/Rips_complex/test/CMakeLists.txt b/src/Rips_complex/test/CMakeLists.txt index 3da9c90d..745d953c 100644 --- a/src/Rips_complex/test/CMakeLists.txt +++ b/src/Rips_complex/test/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Rips_complex_tests) include(GUDHI_test_coverage) diff --git a/src/Rips_complex/utilities/CMakeLists.txt b/src/Rips_complex/utilities/CMakeLists.txt index deb73ff0..4b565628 100644 --- a/src/Rips_complex/utilities/CMakeLists.txt +++ b/src/Rips_complex/utilities/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Rips_complex_utilities) add_executable(rips_distance_matrix_persistence rips_distance_matrix_persistence.cpp) diff --git a/src/Simplex_tree/example/CMakeLists.txt b/src/Simplex_tree/example/CMakeLists.txt index b33b2d05..857e8518 100644 --- a/src/Simplex_tree/example/CMakeLists.txt +++ b/src/Simplex_tree/example/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Simplex_tree_examples) add_executable ( Simplex_tree_example_from_cliques_of_graph simplex_tree_from_cliques_of_graph.cpp ) diff --git a/src/Simplex_tree/test/CMakeLists.txt b/src/Simplex_tree/test/CMakeLists.txt index 8684ad2a..c63d8532 100644 --- a/src/Simplex_tree/test/CMakeLists.txt +++ b/src/Simplex_tree/test/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Simplex_tree_tests) include(GUDHI_test_coverage) diff --git a/src/Skeleton_blocker/example/CMakeLists.txt b/src/Skeleton_blocker/example/CMakeLists.txt index de70f089..0e5d2f11 100644 --- a/src/Skeleton_blocker/example/CMakeLists.txt +++ b/src/Skeleton_blocker/example/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Skeleton_blocker_examples) add_executable(Skeleton_blocker_example_from_simplices Skeleton_blocker_from_simplices.cpp) diff --git a/src/Skeleton_blocker/test/CMakeLists.txt b/src/Skeleton_blocker/test/CMakeLists.txt index 4a363294..19c65871 100644 --- a/src/Skeleton_blocker/test/CMakeLists.txt +++ b/src/Skeleton_blocker/test/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Skeleton_blocker_tests) include(GUDHI_test_coverage) diff --git a/src/Spatial_searching/example/CMakeLists.txt b/src/Spatial_searching/example/CMakeLists.txt index 4cf3d863..0f799987 100644 --- a/src/Spatial_searching/example/CMakeLists.txt +++ b/src/Spatial_searching/example/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Spatial_searching_examples) if(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Spatial_searching/test/CMakeLists.txt b/src/Spatial_searching/test/CMakeLists.txt index b9da7b4e..b60ab1e3 100644 --- a/src/Spatial_searching/test/CMakeLists.txt +++ b/src/Spatial_searching/test/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Spatial_searching_tests) if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Subsampling/example/CMakeLists.txt b/src/Subsampling/example/CMakeLists.txt index 34400b1e..f26d107f 100644 --- a/src/Subsampling/example/CMakeLists.txt +++ b/src/Subsampling/example/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Subsampling_examples) if (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 dbf97db3..924f0925 100644 --- a/src/Subsampling/test/CMakeLists.txt +++ b/src/Subsampling/test/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Subsampling_tests) if (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 8729e394..f136ab27 100644 --- a/src/Tangential_complex/benchmark/CMakeLists.txt +++ b/src/Tangential_complex/benchmark/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Tangential_complex_benchmark) if (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 16d1339d..af0dac51 100644 --- a/src/Tangential_complex/example/CMakeLists.txt +++ b/src/Tangential_complex/example/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Tangential_complex_examples) if (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 1948c8f6..902f19af 100644 --- a/src/Tangential_complex/test/CMakeLists.txt +++ b/src/Tangential_complex/test/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Tangential_complex_tests) if (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 a8231392..3d838c0d 100644 --- a/src/Witness_complex/example/CMakeLists.txt +++ b/src/Witness_complex/example/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Witness_complex_examples) add_executable ( Witness_complex_example_nearest_landmark_table example_nearest_landmark_table.cpp ) diff --git a/src/Witness_complex/test/CMakeLists.txt b/src/Witness_complex/test/CMakeLists.txt index 0b523eaf..58ac60c5 100644 --- a/src/Witness_complex/test/CMakeLists.txt +++ b/src/Witness_complex/test/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Witness_complex_tests) include(GUDHI_test_coverage) diff --git a/src/Witness_complex/utilities/CMakeLists.txt b/src/Witness_complex/utilities/CMakeLists.txt index 125a41ff..ce5e29f2 100644 --- a/src/Witness_complex/utilities/CMakeLists.txt +++ b/src/Witness_complex/utilities/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Witness_complex_utilities) # CGAL and Eigen3 are required for Euclidean version of Witness diff --git a/src/cmake/modules/GUDHI_compilation_flags.cmake b/src/cmake/modules/GUDHI_compilation_flags.cmake new file mode 100644 index 00000000..614d3812 --- /dev/null +++ b/src/cmake/modules/GUDHI_compilation_flags.cmake @@ -0,0 +1,36 @@ +# This files manage compilation flags required by GUDHI + +include(TestCXXAcceptsFlag) + +# add a compiler flag only if it is accepted +macro(add_cxx_compiler_flag _flag) + string(REPLACE "-" "_" _flag_var ${_flag}) + check_cxx_accepts_flag("${_flag}" CXX_COMPILER_${_flag_var}_OK) + if(CXX_COMPILER_${_flag_var}_OK) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flag}") + endif() +endmacro() + +set (CMAKE_CXX_STANDARD 11) + +enable_testing() + +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") +endif() + +add_cxx_compiler_flag("-Wall") +add_cxx_compiler_flag("-pedantic") + +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() diff --git a/src/common/example/CMakeLists.txt b/src/common/example/CMakeLists.txt index 1273c699..04015cdc 100644 --- a/src/common/example/CMakeLists.txt +++ b/src/common/example/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Common_examples) add_executable ( vector_double_off_reader example_vector_double_points_off_reader.cpp ) diff --git a/src/common/test/CMakeLists.txt b/src/common/test/CMakeLists.txt index de3e765a..0b49fa1e 100644 --- a/src/common/test/CMakeLists.txt +++ b/src/common/test/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Common_tests) include(GUDHI_test_coverage) diff --git a/src/common/utilities/CMakeLists.txt b/src/common/utilities/CMakeLists.txt index b3e4b436..7f1d1cd7 100644 --- a/src/common/utilities/CMakeLists.txt +++ b/src/common/utilities/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(off_file_from_shape_generator) if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0) diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index b19cc550..2c21d158 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.8) project(Cython) include(CheckCXXSourceCompiles) @@ -100,12 +99,13 @@ if(CYTHON_FOUND) add_gudhi_cython_lib(${Boost_THREAD_LIBRARY}) set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${Boost_LIBRARY_DIRS}', ") endif() - + message("*** ${CGAL_HEADER_ONLY}") # 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) - add_gudhi_cython_lib(${CGAL_LIBRARIES}) + message("*** ${CGAL_LIBRARY}") + add_gudhi_cython_lib(${CGAL_LIBRARY}) set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${CGAL_LIBRARIES_DIR}', ") # If CGAL is not header only, CGAL library may link with boost system, add_gudhi_cython_lib(${Boost_SYSTEM_LIBRARY}) -- cgit v1.2.3