From e6992894cf4e9b76acee98e2c1ad840a3ebd7274 Mon Sep 17 00:00:00 2001 From: skachano Date: Tue, 4 Oct 2016 18:07:42 +0000 Subject: Fixed a major bug in the Active_witness_iterator git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1633 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: d4f474b44835b11e65a152f9d3fe87cc32b527f5 --- .../test/simple_witness_complex.cpp | 86 +++++++++++++++++----- 1 file changed, 66 insertions(+), 20 deletions(-) (limited to 'src/Witness_complex/test') diff --git a/src/Witness_complex/test/simple_witness_complex.cpp b/src/Witness_complex/test/simple_witness_complex.cpp index 03df78ee..30b168c1 100644 --- a/src/Witness_complex/test/simple_witness_complex.cpp +++ b/src/Witness_complex/test/simple_witness_complex.cpp @@ -25,6 +25,8 @@ #include #include +#include + #include #include @@ -34,26 +36,70 @@ typedef Gudhi::Simplex_tree<> Simplex_tree; typedef std::vector< Vertex_handle > typeVectorVertex; -typedef Gudhi::witness_complex::Witness_complex WitnessComplex; +typedef CGAL::Epick_d Kernel; +typedef typename Kernel::FT FT; +typedef typename Kernel::Point_d Point_d; +typedef Gudhi::witness_complex::Witness_complex WitnessComplex; + +/* All landmarks and witnesses are taken on the grid in the following manner. + LWLWL 2W4W7 + WW.WW WW.WW + L...L 1...6 + WW.WW WW.WW + LWLWL 0W3W5 + + Witness complex consists of 8 vertices, 12 edges and 4 triangles + */ BOOST_AUTO_TEST_CASE(simple_witness_complex) { - Simplex_tree complex; - std::vector< typeVectorVertex > knn; - - knn.push_back({1, 0, 5, 2, 6, 3, 4}); - knn.push_back({2, 6, 4, 5, 0, 1, 3}); - knn.push_back({3, 4, 2, 1, 5, 6, 0}); - knn.push_back({4, 2, 1, 3, 5, 6, 0}); - knn.push_back({5, 1, 6, 0, 2, 3, 4}); - knn.push_back({6, 0, 5, 2, 1, 3, 4}); - knn.push_back({0, 5, 6, 1, 2, 3, 4}); - knn.push_back({2, 6, 4, 5, 3, 1, 0}); - knn.push_back({1, 2, 5, 4, 3, 6, 0}); - knn.push_back({3, 4, 0, 6, 5, 1, 2}); - knn.push_back({5, 0, 1, 3, 6, 2, 4}); - knn.push_back({5, 6, 1, 0, 2, 3, 4}); - knn.push_back({1, 6, 0, 5, 2, 3, 4}); - WitnessComplex witnessComplex(knn, 7, 7, complex); - - BOOST_CHECK(witnessComplex.is_witness_complex(knn, false)); + Simplex_tree complex, relaxed_complex; + + std::vector 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})); + + // landmarks.push_back(Point_d(std::vector{1,0})); + // landmarks.push_back(Point_d(std::vector{0,0})); + // landmarks.push_back(Point_d(std::vector{0,1})); + // witnesses.push_back(Point_d(std::vector{1,0})); + + WitnessComplex witness_complex(landmarks.begin(), + landmarks.end(), + witnesses.begin(), + witnesses.end()); + // witness_complex.create_complex(complex, 0); + + //std::cout << complex << "\n"; + + // BOOST_CHECK(complex.num_simplices() == 24); + + witness_complex.create_complex(relaxed_complex, 8.01); + + std::cout << "Num_simplices: " << relaxed_complex.num_simplices() << "\n"; + std::cout << relaxed_complex << "\n"; + + //BOOST_CHECK(relaxed_complex.num_simplices() == 24); + + //BOOST_CHECK(witnessComplex.is_witness_complex(knn, false)); + + } -- cgit v1.2.3