From 932b79f06816cf9425f9ff37e09ee5daf2c65597 Mon Sep 17 00:00:00 2001 From: skachano Date: Wed, 25 Mar 2015 15:36:42 +0000 Subject: witness_complex worked on a small example git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/witness@506 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 77a0284610e0376a827adfe516aeedfcd634348d --- .../include/gudhi/Witness_complex1.h | 47 +++++++++++++++++----- 1 file changed, 37 insertions(+), 10 deletions(-) (limited to 'src/Witness_complex/include/gudhi') diff --git a/src/Witness_complex/include/gudhi/Witness_complex1.h b/src/Witness_complex/include/gudhi/Witness_complex1.h index 49ba7529..5333e5a8 100644 --- a/src/Witness_complex/include/gudhi/Witness_complex1.h +++ b/src/Witness_complex/include/gudhi/Witness_complex1.h @@ -313,6 +313,8 @@ private: * The only purpose is to test if the witness is still active or not. * Assuming here that the list of the first k witnessed landmarks is sorted */ + + /* template< typename KNearestNeighbours > bool all_faces_in(KNearestNeighbours &knn, int witness_id, int k, VertexHandle inserted_vertex) { @@ -334,19 +336,17 @@ private: if (j != i) { std::cout << "+++ We are at vertex=" << knn[witness_id][j] << std::endl; - if (curr_sibl->members().find(knn[witness_id][j]) == null_simplex()) + if (curr_sibl->find(knn[witness_id][j]) == null_simplex()) return false; std::cout << "++++ the simplex is there\n"; - curr_sh = curr_sibl->members().find(knn[witness_id][j]); + curr_sh = curr_sibl->find(knn[witness_id][j]); std::cout << "++++ curr_sh affectation is OK\n"; - if (has_children(curr_sh)) - curr_sibl = curr_sh->second.children(); - else - if (j < k || (j < k-1 && i == k)) - { - std::cout << "++++ the values: j=" << j << ", k=" << k << std::endl; - return false; - } + if (!has_children(curr_sh) && (j < k || (j < k-1 && i == k))) + { + std::cout << "++++ the values: j=" << j << ", k=" << k << std::endl; + return false; + } + curr_sibl = curr_sh->second.children(); std::cout << "++++ finished loop safely\n"; }//endif j!=i }//endfor @@ -354,6 +354,33 @@ private: } //endfor return true; } + */ + template + bool all_faces_in(KNearestNeighbours &knn, int witness_id, int k, VertexHandle inserted_vertex) + { + std::cout << "All face in with the landmark " << inserted_vertex << std::endl; + std::vector< VertexHandle > facet; + //VertexHandle curr_vh = curr_sh->first; + // CHECK ALL THE FACETS + for (int i = 0; i != k+1; ++i) + { + if (knn[witness_id][i] != inserted_vertex) + { + facet = {}; + for (int j = 0; j != k+1; ++j) + { + if (j != i) + { + facet.push_back(knn[witness_id][j]); + } + }//endfor + if (find(facet) == null_simplex()) + return false; + std::cout << "++++ finished loop safely\n"; + }//endif + } //endfor + return true; + } /** * \brief Permutes the vector in such a way that the landmarks appear first -- cgit v1.2.3