-- cgit v1.2.3 From 9bd1ad1f36ceb729240cac67f4889645859a1b18 Mon Sep 17 00:00:00 2001 From: cjamin Date: Thu, 2 Mar 2017 16:06:41 +0000 Subject: Use parallel_sort to sort distances git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/botteleneck-parallel-sort@2134 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: b3a43683ab1d452845138605488a845a4b694432 --- src/Bottleneck_distance/include/gudhi/Persistence_graph.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Bottleneck_distance/include/gudhi/Persistence_graph.h b/src/Bottleneck_distance/include/gudhi/Persistence_graph.h index c7695112..44f4b827 100644 --- a/src/Bottleneck_distance/include/gudhi/Persistence_graph.h +++ b/src/Bottleneck_distance/include/gudhi/Persistence_graph.h @@ -25,6 +25,10 @@ #include +#ifdef GUDHI_USE_TBB +#include +#endif + #include #include #include // for numeric_limits @@ -144,7 +148,11 @@ inline std::vector Persistence_graph::sorted_distances() const { for (int v_point_index = 0; v_point_index < size(); ++v_point_index) distances.push_back(distance(u_point_index, v_point_index)); } +#ifdef GUDHI_USE_TBB + tbb::parallel_sort(distances.begin(), distances.end()); +#else std::sort(distances.begin(), distances.end()); +#endif return distances; } -- cgit v1.2.3 From 0023b64e6e3dba261902403931c93599d0d4360a Mon Sep 17 00:00:00 2001 From: cjamin Date: Fri, 3 Mar 2017 09:40:35 +0000 Subject: Link with TBB git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/botteleneck-parallel-sort@2141 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 80325216eace3cb1dbadbde3f4e5a3985b8feab0 --- src/Bottleneck_distance/benchmark/CMakeLists.txt | 3 +++ src/Bottleneck_distance/example/CMakeLists.txt | 2 ++ src/Bottleneck_distance/test/CMakeLists.txt | 3 +++ 3 files changed, 8 insertions(+) diff --git a/src/Bottleneck_distance/benchmark/CMakeLists.txt b/src/Bottleneck_distance/benchmark/CMakeLists.txt index 355e8d31..c99e0373 100644 --- a/src/Bottleneck_distance/benchmark/CMakeLists.txt +++ b/src/Bottleneck_distance/benchmark/CMakeLists.txt @@ -7,5 +7,8 @@ project(Bottleneck_distance_benchmark) if(CGAL_FOUND) if (NOT CGAL_VERSION VERSION_LESS 4.8.0) add_executable ( bottleneck_chrono bottleneck_chrono.cpp ) + if (TBB_FOUND) + target_link_libraries(bottleneck_chrono ${TBB_LIBRARIES}) + endif(TBB_FOUND) endif () endif() diff --git a/src/Bottleneck_distance/example/CMakeLists.txt b/src/Bottleneck_distance/example/CMakeLists.txt index b36d0f34..55f22c01 100644 --- a/src/Bottleneck_distance/example/CMakeLists.txt +++ b/src/Bottleneck_distance/example/CMakeLists.txt @@ -13,6 +13,8 @@ if(CGAL_FOUND) add_executable (alpha_rips_persistence_bottleneck_distance alpha_rips_persistence_bottleneck_distance.cpp) target_link_libraries(alpha_rips_persistence_bottleneck_distance ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}) if (TBB_FOUND) + target_link_libraries(bottleneck_read_file_example ${TBB_LIBRARIES}) + target_link_libraries(bottleneck_basic_example ${TBB_LIBRARIES}) target_link_libraries(alpha_rips_persistence_bottleneck_distance ${TBB_LIBRARIES}) endif(TBB_FOUND) add_test(alpha_rips_persistence_bottleneck_distance ${CMAKE_CURRENT_BINARY_DIR}/alpha_rips_persistence_bottleneck_distance diff --git a/src/Bottleneck_distance/test/CMakeLists.txt b/src/Bottleneck_distance/test/CMakeLists.txt index 6c8f112d..3e61f4cf 100644 --- a/src/Bottleneck_distance/test/CMakeLists.txt +++ b/src/Bottleneck_distance/test/CMakeLists.txt @@ -17,6 +17,9 @@ if(CGAL_FOUND) if (NOT CGAL_VERSION VERSION_LESS 4.8.0) add_executable ( bottleneckUT bottleneck_unit_test.cpp ) target_link_libraries(bottleneckUT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + if (TBB_FOUND) + target_link_libraries(bottleneckUT ${TBB_LIBRARIES}) + endif(TBB_FOUND) # Unitary tests add_test(NAME bottleneckUT COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bottleneckUT -- cgit v1.2.3 From bd9f1b2e9d21590288dc58980e991d2b687ce025 Mon Sep 17 00:00:00 2001 From: glisse Date: Sat, 4 Mar 2017 19:36:54 +0000 Subject: Missing includes and const for Euclidean_distance. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@2158 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 9f2243ec5c2a50b271031b6b8c8148afeb0bc1df --- src/common/include/gudhi/distance_functions.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/include/gudhi/distance_functions.h b/src/common/include/gudhi/distance_functions.h index 5891ef0e..7bf97c23 100644 --- a/src/common/include/gudhi/distance_functions.h +++ b/src/common/include/gudhi/distance_functions.h @@ -24,6 +24,8 @@ #define DISTANCE_FUNCTIONS_H_ #include // for std::sqrt +#include // for std::decay +#include // for std::begin, std::end /** @file * @brief Global distance functions @@ -34,7 +36,7 @@ class Euclidean_distance { public: template< typename Point > - auto operator()(const Point& p1, const Point& p2) -> typename std::decay::type { + auto operator()(const Point& p1, const Point& p2) const -> typename std::decay::type { auto it1 = p1.begin(); auto it2 = p2.begin(); typename Point::value_type dist = 0.; -- cgit v1.2.3 From 1566e2702deb978d6b04ee2add39a0245df3b477 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 7 Mar 2017 14:04:36 +0000 Subject: Remove Kdtree include in Witness_complex.h and Strong_witness_complex.h Seperate tests using euclidean witness (requires CGAL >= 4.6) and simple tests git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@2165 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: f5482e2331d59e60757e7b120e98cfcf97699f30 --- .../include/gudhi/Strong_witness_complex.h | 1 - .../include/gudhi/Witness_complex.h | 1 - src/Witness_complex/test/CMakeLists.txt | 23 ++- .../test/test_euclidean_simple_witness_complex.cpp | 135 ++++++++++++++++++ .../test/test_simple_witness_complex.cpp | 156 +++++---------------- 5 files changed, 194 insertions(+), 122 deletions(-) create mode 100644 src/Witness_complex/test/test_euclidean_simple_witness_complex.cpp diff --git a/src/Witness_complex/include/gudhi/Strong_witness_complex.h b/src/Witness_complex/include/gudhi/Strong_witness_complex.h index 6708ac29..a973ddb7 100644 --- a/src/Witness_complex/include/gudhi/Strong_witness_complex.h +++ b/src/Witness_complex/include/gudhi/Strong_witness_complex.h @@ -24,7 +24,6 @@ #define STRONG_WITNESS_COMPLEX_H_ #include -#include #include #include diff --git a/src/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h index e7adf80f..e2791f76 100644 --- a/src/Witness_complex/include/gudhi/Witness_complex.h +++ b/src/Witness_complex/include/gudhi/Witness_complex.h @@ -24,7 +24,6 @@ #define WITNESS_COMPLEX_H_ #include -#include #include #include diff --git a/src/Witness_complex/test/CMakeLists.txt b/src/Witness_complex/test/CMakeLists.txt index 084761e2..12b3be56 100644 --- a/src/Witness_complex/test/CMakeLists.txt +++ b/src/Witness_complex/test/CMakeLists.txt @@ -12,10 +12,31 @@ endif() add_executable ( Witness_complex_test_simple_witness_complex test_simple_witness_complex.cpp ) target_link_libraries(Witness_complex_test_simple_witness_complex ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) -target_link_libraries(Witness_complex_test_simple_witness_complex ${TBB_LIBRARIES}) +if (TBB_FOUND) + target_link_libraries(Witness_complex_test_simple_witness_complex ${TBB_LIBRARIES}) +endif(TBB_FOUND) # Unitary tests definition and xml result file generation add_test(NAME simple_witness_complex COMMAND ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_test_simple_witness_complex # XML format for Jenkins xUnit plugin --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Witness_complex_test_simple_witness_complexUT.xml --log_level=test_suite --report_level=no) + +# CGAL and Eigen3 are required for Euclidean version of Witness +if(CGAL_FOUND) + if (NOT CGAL_VERSION VERSION_LESS 4.6.0) + if (EIGEN3_FOUND) + add_executable ( Witness_complex_test_euclidean_simple_witness_complex test_euclidean_simple_witness_complex.cpp ) + target_link_libraries(Witness_complex_test_euclidean_simple_witness_complex ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) + if (TBB_FOUND) + target_link_libraries(Witness_complex_test_euclidean_simple_witness_complex ${TBB_LIBRARIES}) + endif(TBB_FOUND) + + # Unitary tests definition and xml result file generation + add_test(NAME euclidean_simple_witness_complex + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_test_euclidean_simple_witness_complex + # XML format for Jenkins xUnit plugin + --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Witness_complex_test_euclidean_simple_witness_complexUT.xml --log_level=test_suite --report_level=no) + endif(EIGEN3_FOUND) + endif (NOT CGAL_VERSION VERSION_LESS 4.6.0) +endif() diff --git a/src/Witness_complex/test/test_euclidean_simple_witness_complex.cpp b/src/Witness_complex/test/test_euclidean_simple_witness_complex.cpp new file mode 100644 index 00000000..62fd1157 --- /dev/null +++ b/src/Witness_complex/test/test_euclidean_simple_witness_complex.cpp @@ -0,0 +1,135 @@ +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE "euclidean_simple_witness_complex" +#include +#include + +#include + +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include + +typedef Gudhi::Simplex_tree<> Simplex_tree; +typedef typename Simplex_tree::Vertex_handle Vertex_handle; +typedef std::vector< Vertex_handle > typeVectorVertex; +typedef CGAL::Epick_d Kernel; +typedef typename Kernel::FT FT; +typedef typename Kernel::Point_d Point_d; +typedef Gudhi::witness_complex::Euclidean_witness_complex EuclideanWitnessComplex; +typedef Gudhi::witness_complex::Euclidean_strong_witness_complex EuclideanStrongWitnessComplex; + +typedef std::vector Point_range; +typedef Gudhi::spatial_searching::Kd_tree_search Kd_tree; +typedef Kd_tree::INS_range Nearest_landmark_range; +typedef std::vector Nearest_landmark_table; +typedef Gudhi::witness_complex::Witness_complex WitnessComplex; +typedef Gudhi::witness_complex::Strong_witness_complex StrongWitnessComplex; + + +/* All landmarks and witnesses are taken on the grid in the following manner. + LWLWL + WW.WW + L...L + WW.WW + LWLWL + + Witness complex consists of 8 vertices, 12 edges and 4 triangles + */ + +BOOST_AUTO_TEST_CASE(simple_witness_complex) { + Simplex_tree complex, relaxed_complex, strong_relaxed_complex, strong_relaxed_complex2; + Simplex_tree complex_ne, relaxed_complex_ne, strong_relaxed_complex_ne, strong_relaxed_complex2_ne; + + Point_range witnesses, landmarks; + + landmarks.push_back(Point_d(std::vector{-2,-2})); + landmarks.push_back(Point_d(std::vector{-2, 0})); + landmarks.push_back(Point_d(std::vector{-2, 2})); + landmarks.push_back(Point_d(std::vector{ 0,-2})); + landmarks.push_back(Point_d(std::vector{ 0, 2})); + landmarks.push_back(Point_d(std::vector{ 2,-2})); + landmarks.push_back(Point_d(std::vector{ 2, 0})); + landmarks.push_back(Point_d(std::vector{ 2, 2})); + witnesses.push_back(Point_d(std::vector{-2,-1})); + witnesses.push_back(Point_d(std::vector{-2, 1})); + witnesses.push_back(Point_d(std::vector{-1,-2})); + witnesses.push_back(Point_d(std::vector{-1,-1})); + witnesses.push_back(Point_d(std::vector{-1, 1})); + witnesses.push_back(Point_d(std::vector{-1, 2})); + witnesses.push_back(Point_d(std::vector{ 1,-2})); + witnesses.push_back(Point_d(std::vector{ 1,-1})); + witnesses.push_back(Point_d(std::vector{ 1, 1})); + witnesses.push_back(Point_d(std::vector{ 1, 2})); + witnesses.push_back(Point_d(std::vector{ 2,-1})); + witnesses.push_back(Point_d(std::vector{ 2, 1})); + + Kd_tree landmark_tree(landmarks); + Nearest_landmark_table nearest_landmark_table; + for (auto w: witnesses) + nearest_landmark_table.push_back(landmark_tree.query_incremental_nearest_neighbors(w)); + + // Weak witness complex: Euclidean version + EuclideanWitnessComplex eucl_witness_complex(landmarks, + witnesses); + eucl_witness_complex.create_complex(complex, 0); + + std::cout << "complex.num_simplices() = " << complex.num_simplices() << std::endl; + BOOST_CHECK(complex.num_simplices() == 24); + + eucl_witness_complex.create_complex(relaxed_complex, 8.01); + + std::cout << "relaxed_complex.num_simplices() = " << relaxed_complex.num_simplices() << std::endl; + BOOST_CHECK(relaxed_complex.num_simplices() == 239); + // The corner simplex {0,2,5,7} and its cofaces are missing. + + // Weak witness complex: non-Euclidean version + WitnessComplex witness_complex(nearest_landmark_table); + witness_complex.create_complex(complex_ne, 0); + + std::cout << "complex.num_simplices() = " << complex_ne.num_simplices() << std::endl; + BOOST_CHECK(complex_ne.num_simplices() == 24); + + witness_complex.create_complex(relaxed_complex_ne, 8.01); + + std::cout << "relaxed_complex.num_simplices() = " << relaxed_complex_ne.num_simplices() << std::endl; + BOOST_CHECK(relaxed_complex_ne.num_simplices() == 239); + + + // Strong complex : Euclidean version + EuclideanStrongWitnessComplex eucl_strong_witness_complex(landmarks, + witnesses); + + eucl_strong_witness_complex.create_complex(strong_relaxed_complex, 9.1); + eucl_strong_witness_complex.create_complex(strong_relaxed_complex2, 9.1, 2); + + std::cout << "strong_relaxed_complex.num_simplices() = " << strong_relaxed_complex.num_simplices() << std::endl; + BOOST_CHECK(strong_relaxed_complex.num_simplices() == 239); + + std::cout << "strong_relaxed_complex2.num_simplices() = " << strong_relaxed_complex2.num_simplices() << std::endl; + BOOST_CHECK(strong_relaxed_complex2.num_simplices() == 92); + + + // Strong complex : non-Euclidean version + StrongWitnessComplex strong_witness_complex(nearest_landmark_table); + + strong_witness_complex.create_complex(strong_relaxed_complex_ne, 9.1); + strong_witness_complex.create_complex(strong_relaxed_complex2_ne, 9.1, 2); + + std::cout << "strong_relaxed_complex.num_simplices() = " << strong_relaxed_complex_ne.num_simplices() << std::endl; + BOOST_CHECK(strong_relaxed_complex_ne.num_simplices() == 239); + + std::cout << "strong_relaxed_complex2.num_simplices() = " << strong_relaxed_complex2_ne.num_simplices() << std::endl; + BOOST_CHECK(strong_relaxed_complex2_ne.num_simplices() == 92); + + + // 8 vertices, 28 edges, 56 triangles +} diff --git a/src/Witness_complex/test/test_simple_witness_complex.cpp b/src/Witness_complex/test/test_simple_witness_complex.cpp index bb1df72d..9e3509d3 100644 --- a/src/Witness_complex/test/test_simple_witness_complex.cpp +++ b/src/Witness_complex/test/test_simple_witness_complex.cpp @@ -3,133 +3,51 @@ #include #include -#include - #include #include -#include -#include -#include - -#include #include -#include #include +#include -typedef Gudhi::Simplex_tree<> Simplex_tree; -typedef typename Simplex_tree::Vertex_handle Vertex_handle; -typedef std::vector< Vertex_handle > typeVectorVertex; -typedef CGAL::Epick_d Kernel; -typedef typename Kernel::FT FT; -typedef typename Kernel::Point_d Point_d; -typedef Gudhi::witness_complex::Euclidean_witness_complex EuclideanWitnessComplex; -typedef Gudhi::witness_complex::Euclidean_strong_witness_complex EuclideanStrongWitnessComplex; - -typedef std::vector Point_range; -typedef Gudhi::spatial_searching::Kd_tree_search Kd_tree; -typedef Kd_tree::INS_range Nearest_landmark_range; -typedef std::vector Nearest_landmark_table; -typedef Gudhi::witness_complex::Witness_complex WitnessComplex; -typedef Gudhi::witness_complex::Strong_witness_complex StrongWitnessComplex; - - -/* All landmarks and witnesses are taken on the grid in the following manner. - LWLWL - WW.WW - L...L - WW.WW - LWLWL - - Witness complex consists of 8 vertices, 12 edges and 4 triangles - */ BOOST_AUTO_TEST_CASE(simple_witness_complex) { - Simplex_tree complex, relaxed_complex, strong_relaxed_complex, strong_relaxed_complex2; - Simplex_tree complex_ne, relaxed_complex_ne, strong_relaxed_complex_ne, strong_relaxed_complex2_ne; - - Point_range witnesses, landmarks; - - landmarks.push_back(Point_d(std::vector{-2,-2})); - landmarks.push_back(Point_d(std::vector{-2, 0})); - landmarks.push_back(Point_d(std::vector{-2, 2})); - landmarks.push_back(Point_d(std::vector{ 0,-2})); - landmarks.push_back(Point_d(std::vector{ 0, 2})); - landmarks.push_back(Point_d(std::vector{ 2,-2})); - landmarks.push_back(Point_d(std::vector{ 2, 0})); - landmarks.push_back(Point_d(std::vector{ 2, 2})); - witnesses.push_back(Point_d(std::vector{-2,-1})); - witnesses.push_back(Point_d(std::vector{-2, 1})); - witnesses.push_back(Point_d(std::vector{-1,-2})); - witnesses.push_back(Point_d(std::vector{-1,-1})); - witnesses.push_back(Point_d(std::vector{-1, 1})); - witnesses.push_back(Point_d(std::vector{-1, 2})); - witnesses.push_back(Point_d(std::vector{ 1,-2})); - witnesses.push_back(Point_d(std::vector{ 1,-1})); - witnesses.push_back(Point_d(std::vector{ 1, 1})); - witnesses.push_back(Point_d(std::vector{ 1, 2})); - witnesses.push_back(Point_d(std::vector{ 2,-1})); - witnesses.push_back(Point_d(std::vector{ 2, 1})); - - Kd_tree landmark_tree(landmarks); - Nearest_landmark_table nearest_landmark_table; - for (auto w: witnesses) - nearest_landmark_table.push_back(landmark_tree.query_incremental_nearest_neighbors(w)); - - // Weak witness complex: Euclidean version - EuclideanWitnessComplex eucl_witness_complex(landmarks, - witnesses); - eucl_witness_complex.create_complex(complex, 0); - - std::cout << "complex.num_simplices() = " << complex.num_simplices() << std::endl; - BOOST_CHECK(complex.num_simplices() == 24); - - eucl_witness_complex.create_complex(relaxed_complex, 8.01); - - std::cout << "relaxed_complex.num_simplices() = " << relaxed_complex.num_simplices() << std::endl; - BOOST_CHECK(relaxed_complex.num_simplices() == 239); - // The corner simplex {0,2,5,7} and its cofaces are missing. - - // Weak witness complex: non-Euclidean version - WitnessComplex witness_complex(nearest_landmark_table); - witness_complex.create_complex(complex_ne, 0); - - std::cout << "complex.num_simplices() = " << complex_ne.num_simplices() << std::endl; - BOOST_CHECK(complex_ne.num_simplices() == 24); - - witness_complex.create_complex(relaxed_complex_ne, 8.01); - - std::cout << "relaxed_complex.num_simplices() = " << relaxed_complex_ne.num_simplices() << std::endl; - BOOST_CHECK(relaxed_complex_ne.num_simplices() == 239); - - - // Strong complex : Euclidean version - EuclideanStrongWitnessComplex eucl_strong_witness_complex(landmarks, - witnesses); - - eucl_strong_witness_complex.create_complex(strong_relaxed_complex, 9.1); - eucl_strong_witness_complex.create_complex(strong_relaxed_complex2, 9.1, 2); - - std::cout << "strong_relaxed_complex.num_simplices() = " << strong_relaxed_complex.num_simplices() << std::endl; - BOOST_CHECK(strong_relaxed_complex.num_simplices() == 239); - - std::cout << "strong_relaxed_complex2.num_simplices() = " << strong_relaxed_complex2.num_simplices() << std::endl; - BOOST_CHECK(strong_relaxed_complex2.num_simplices() == 92); - - - // Strong complex : non-Euclidean version - StrongWitnessComplex strong_witness_complex(nearest_landmark_table); - - strong_witness_complex.create_complex(strong_relaxed_complex_ne, 9.1); - strong_witness_complex.create_complex(strong_relaxed_complex2_ne, 9.1, 2); - - std::cout << "strong_relaxed_complex.num_simplices() = " << strong_relaxed_complex_ne.num_simplices() << std::endl; - BOOST_CHECK(strong_relaxed_complex_ne.num_simplices() == 239); - - std::cout << "strong_relaxed_complex2.num_simplices() = " << strong_relaxed_complex2_ne.num_simplices() << std::endl; - BOOST_CHECK(strong_relaxed_complex2_ne.num_simplices() == 92); - + using Nearest_landmark_range = std::vector>; + using Nearest_landmark_table = std::vector; + using Witness_complex = Gudhi::witness_complex::Witness_complex; + using Simplex_tree = Gudhi::Simplex_tree<>; + + Simplex_tree stree; + Nearest_landmark_table nlt; + + // Example contains 5 witnesses and 5 landmarks + Nearest_landmark_range w0 = {std::make_pair(0, 0), std::make_pair(1, 1), std::make_pair(2, 2), + std::make_pair(3, 3), std::make_pair(4, 4)}; nlt.push_back(w0); + Nearest_landmark_range w1 = {std::make_pair(1, 0), std::make_pair(2, 1), std::make_pair(3, 2), + std::make_pair(4, 3), std::make_pair(0, 4)}; nlt.push_back(w1); + Nearest_landmark_range w2 = {std::make_pair(2, 0), std::make_pair(3, 1), std::make_pair(4, 2), + std::make_pair(0, 3), std::make_pair(1, 4)}; nlt.push_back(w2); + Nearest_landmark_range w3 = {std::make_pair(3, 0), std::make_pair(4, 1), std::make_pair(0, 2), + std::make_pair(1, 3), std::make_pair(2, 4)}; nlt.push_back(w3); + Nearest_landmark_range w4 = {std::make_pair(4, 0), std::make_pair(0, 1), std::make_pair(1, 2), + std::make_pair(2, 3), std::make_pair(3, 4)}; nlt.push_back(w4); + + Witness_complex witness_complex(nlt); + BOOST_CHECK(witness_complex.create_complex(stree, 4.1)); + + std::cout << "Number of simplices: " << stree.num_simplices() << std::endl; + BOOST_CHECK(stree.num_simplices() == 31); + + // Check when complex not empty + BOOST_CHECK(!witness_complex.create_complex(stree, 4.1)); + + // Check when max_alpha_square negative + Simplex_tree stree2; + BOOST_CHECK(!witness_complex.create_complex(stree2, -0.02)); + + witness_complex.create_complex(stree2, 4.1, 2); + std::cout << "Number of simplices: " << stree2.num_simplices() << std::endl; + BOOST_CHECK(stree2.num_simplices() == 25); - // 8 vertices, 28 edges, 56 triangles } -- cgit v1.2.3