summaryrefslogtreecommitdiff
path: root/src/Simplex_tree/include/gudhi/Simplex_tree.h
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-08-25 12:50:22 +0200
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-08-25 12:50:22 +0200
commit723252b311a7989ef1d4271b3a812ec7d0be05f2 (patch)
tree366b9798c0c7530cce2363d9846cd0c090101cad /src/Simplex_tree/include/gudhi/Simplex_tree.h
parent12371aa8ec7693f97200c5b3df3aa20add4ad621 (diff)
Code review: use minimal depth recursively instead of computing dimension on each loop
Diffstat (limited to 'src/Simplex_tree/include/gudhi/Simplex_tree.h')
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h
index 9cd51081..70ef4c66 100644
--- a/src/Simplex_tree/include/gudhi/Simplex_tree.h
+++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h
@@ -1682,25 +1682,25 @@ class Simplex_tree {
simplex.second.assign_filtration(filt_value);
}
if (has_children(&simplex)) {
- rec_reset_filtration(simplex.second.children(), filt_value, min_dim);
+ rec_reset_filtration(simplex.second.children(), filt_value, min_dim - 1);
}
}
clear_filtration(); // Drop the cache.
}
private:
- /** \brief Recursively resets filtration value from a given dimension.
+ /** \brief Recursively resets filtration value when minimal depth <= 0.
* @param[in] sib Siblings to be parsed.
* @param[in] filt_value The new filtration value.
- * @param[in] min_dim The minimal dimension.
+ * @param[in] min_depth The minimal depth.
*/
- void rec_reset_filtration(Siblings * sib, Filtration_value filt_value, int min_dim) {
+ void rec_reset_filtration(Siblings * sib, Filtration_value filt_value, int min_depth) {
for (auto sh = sib->members().begin(); sh != sib->members().end(); ++sh) {
- if (min_dim <= dimension(sh)) {
+ if (min_depth <= 0) {
sh->second.assign_filtration(filt_value);
}
if (has_children(sh)) {
- rec_reset_filtration(sh->second.children(), filt_value, min_dim);
+ rec_reset_filtration(sh->second.children(), filt_value, min_depth - 1);
}
}
}