From 1ec3e1ae82dab1109ce871f690df716fb05c6a16 Mon Sep 17 00:00:00 2001 From: skachano Date: Tue, 24 Mar 2015 12:31:43 +0000 Subject: Now at every loop curr_sibl to root() as it should git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/witness@502 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 618fbf7be18e0caa150132a63466d77205634479 --- src/Witness_complex/include/gudhi/Witness_complex1.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/Witness_complex/include/gudhi/Witness_complex1.h') diff --git a/src/Witness_complex/include/gudhi/Witness_complex1.h b/src/Witness_complex/include/gudhi/Witness_complex1.h index acb83647..6950c3bf 100644 --- a/src/Witness_complex/include/gudhi/Witness_complex1.h +++ b/src/Witness_complex/include/gudhi/Witness_complex1.h @@ -265,12 +265,12 @@ void witness_complex(KNearestNeighbours & knn) simplex_vector.push_back(knn[*it][i]); } returnValue = insert_simplex(simplex_vector,0.0); - it++ + it++; } else active_w.erase(it++); //First increase the iterator and then erase the previous element + print_sc(root()); std::cout << std::endl; } - print_sc(root()); k++; } } @@ -326,16 +326,28 @@ private: for (int i = 0; i != k+1; ++i) { curr_sh = sh_bup; + curr_sibl = root(); if (knn[witness_id][i] != inserted_vertex) { for (int j = 0; j != k+1; ++j) { if (j != i) { + std::cout << "+++ We are at vertex=" << knn[witness_id][j] << std::endl; if (curr_sibl->find(knn[witness_id][j]) == null_simplex()) return false; + std::cout << "++++ the simplex is there\n"; curr_sh = curr_sibl->find(knn[witness_id][j]); - curr_sibl = self_siblings(curr_sh); + 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; + } + std::cout << "++++ finished loop safely\n"; }//endif j!=i }//endfor }//endif -- cgit v1.2.3