From 0d55fc06c82882327a8af82b20fc001b7cd71a66 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 1 Sep 2015 13:55:49 +0000 Subject: order was not correct in rec_insert_simplex_and_subfaces. + UT fix according to this fix git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alphashapes@767 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a6c7bcc3776e01c2247fbd862b4a3842b76aefe0 --- src/Simplex_tree/include/gudhi/Simplex_tree.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/Simplex_tree/include/gudhi/Simplex_tree.h') diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 4a75852e..279327f7 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -540,7 +540,7 @@ class Simplex_tree { insert_result = rec_insert_simplex_and_subfaces(the_simplex, to_be_inserted, to_be_propagated, filtration); // Concatenation of to_be_inserted and to_be_propagated - to_be_inserted.insert(to_be_inserted.end(), to_be_propagated.begin(), to_be_propagated.end()); + to_be_inserted.insert(to_be_inserted.begin(), to_be_propagated.begin(), to_be_propagated.end()); to_be_propagated = to_be_inserted; // to_be_inserted treatment @@ -548,8 +548,14 @@ class Simplex_tree { simplex_tbi.push_back(last_vertex); } std::vector last_simplex(1, last_vertex); - to_be_inserted.push_back(last_simplex); - + to_be_inserted.insert(to_be_inserted.begin(), last_simplex); + // i.e. (0,1,2) => + // [to_be_inserted | to_be_propagated] = [(1) (0,1) | (0)] + // [to_be_inserted | to_be_propagated] = [(2) (0,2) (1,2) (0,1,2) | (0) (1) (0,1)] + // N.B. : it is important the last inserted to be the highest in dimension + // in order to return the "last" insert_simplex result + + // insert all to_be_inserted for (auto& simplex_tbi : to_be_inserted) { insert_result = insert_simplex(simplex_tbi, filtration); } @@ -562,6 +568,7 @@ class Simplex_tree { exit(-1); } std::vector first_simplex(1, the_simplex.back()); + // i.e. (0,1,2) => [to_be_inserted | to_be_propagated] = [(0) | ] to_be_inserted.push_back(first_simplex); insert_result = insert_simplex(first_simplex, filtration); -- cgit v1.2.3