summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoranmoreau <anmoreau@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-06-25 11:39:49 +0000
committeranmoreau <anmoreau@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-06-25 11:39:49 +0000
commit07faa8ef38b4ffe8c9e8e5e4e70717ff2500e08f (patch)
tree7784e23e1d83ae5a235e4667a66529ba7d75de90 /src
parenta602092b3437afb3271196f21dea4f4e944436c3 (diff)
fix
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/coface@650 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: ad75901b33f5037cbb8234b5179cea436a46b23b
Diffstat (limited to 'src')
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree.h18
1 files changed, 9 insertions, 9 deletions
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<Vertex_handle> &vertices, Siblings *curr_sib, std::vector<Vertex_handle> &curr_res, std::vector<Simplex_handle>& 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);