From 07faa8ef38b4ffe8c9e8e5e4e70717ff2500e08f Mon Sep 17 00:00:00 2001 From: anmoreau Date: Thu, 25 Jun 2015 11:39:49 +0000 Subject: fix git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/coface@650 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: ad75901b33f5037cbb8234b5179cea436a46b23b --- src/Simplex_tree/include/gudhi/Simplex_tree.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 4dee1432..47a96303 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -625,20 +625,19 @@ private: */ void rec_coface(std::vector &vertices, Siblings *curr_sib, std::vector &curr_res, std::vector& cofaces, int length, int nbVertices) { - if (!(nbVertices == length || (int)curr_res.size() <= nbVertices)) // dimension of actual simplex <= nbVertices + bool star = nbVertices == length; + if (!(star || (int)curr_res.size() <= nbVertices)) // dimension of actual simplex <= nbVertices return; -// for (auto simplex = curr_sib->members().begin(); simplex != curr_sib->members().end(); ++simplex) for (auto& simplex : curr_sib->members()) { if (vertices.empty()) { - // if ((int)curr_res.size() >= length && continueRecursion) // If we reached the end of the vertices, and the simplex has more vertices than the given simplex, we found a coface curr_res.push_back(simplex.first); - bool equalDim = (nbVertices == length || (int)curr_res.size() == nbVertices); // dimension of actual simplex == nbVertices - if (equalDim) + bool addCoface = (star || (int)curr_res.size() == nbVertices); // dimension of actual simplex == nbVertices + if (addCoface) cofaces.push_back(curr_sib->members().find(simplex.first)); - if (has_children(simplex)) + if ((!addCoface || star) && has_children(simplex)) // Rec call rec_coface(vertices, simplex.second.children(), curr_res, cofaces, length, nbVertices); curr_res.pop_back(); } @@ -648,10 +647,11 @@ private: { curr_res.push_back(simplex.first); bool equalDim = (nbVertices == length || (int)curr_res.size() == nbVertices); // dimension of actual simplex == nbVertices - if (vertices.size() == 1 && (int)curr_res.size() > length && equalDim) + bool addCoface = vertices.size() == 1 && (int)curr_res.size() > length && equalDim; + if (addCoface) cofaces.push_back(curr_sib->members().find(simplex.first)); - if (has_children(simplex)) - { // Rec call + if ((!addCoface || star) && has_children(simplex)) + { // Rec call Vertex_handle tmp = vertices.back(); vertices.pop_back(); rec_coface(vertices, simplex.second.children(), curr_res, cofaces, length, nbVertices); -- cgit v1.2.3