summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-03-24 12:40:15 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-03-24 12:40:15 +0000
commiteefb9628f71cd74127cfc9ffa4f8db0803d82ad9 (patch)
tree2f8b53b3a6c90380f1fdd6c15b83e0552f3f2b67 /src
parent73d8be19b7834f500e38f7304fd01e0e641ef018 (diff)
prune_above_filtration version that is no more using filtration vector.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alphashapes@1073 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 95dca83fa459abd902624bf2a5f631925e4cf9b0
Diffstat (limited to 'src')
-rw-r--r--src/Alpha_complex/include/gudhi/Alpha_complex.h8
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree.h35
2 files changed, 6 insertions, 37 deletions
diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h
index 33830175..2b27a459 100644
--- a/src/Alpha_complex/include/gudhi/Alpha_complex.h
+++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h
@@ -317,11 +317,11 @@ class Alpha_complex : public Simplex_tree<> {
// --------------------------------------------------------------------------------------------
// As Alpha value is an approximation, we have to make filtration non decreasing while increasing the dimension
- if (make_filtration_non_decreasing()) {
- initialize_filtration();
- }
+ bool modified_filt = make_filtration_non_decreasing();
// Remove all simplices that have a filtration value greater than max_alpha_square
- if (prune_above_filtration(max_alpha_square)) {
+ // Remark: prune_above_filtration does not require initialize_filtration to be done before.
+ modified_filt |= prune_above_filtration(max_alpha_square);
+ if (modified_filt) {
initialize_filtration();
}
// --------------------------------------------------------------------------------------------
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h
index 1bad8d7d..f5bc0a11 100644
--- a/src/Simplex_tree/include/gudhi/Simplex_tree.h
+++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h
@@ -1187,42 +1187,11 @@ class Simplex_tree {
/** \brief Prune above filtration value given as parameter.
* @param[in] filtration Maximum threshold value.
* @return The filtration modification information.
- * \pre The filtration must be valid. If the filtration has not been initialized yet, the method initializes it
- * (i.e. order the simplices).
* \post Some simplex tree functions require the filtration to be valid. `prune_above_filtration()`
* function is not launching `initialize_filtration()` but returns the filtration modification information. If the
* complex has changed , please call `initialize_filtration()` to recompute it.
*/
- bool prune_above_filtration(Filtration_value filtration) {
- // Initialize filtration_vect_ if required
- if (filtration_vect_.empty()) {
- initialize_filtration();
- }
-
- std::vector<std::vector<Vertex_handle>> simplex_list_to_removed;
- // Loop in reverse mode until threshold is reached
- // Do not erase while looping, because removing is shifting data in a flat_map
- for (auto f_simplex = filtration_vect_.rbegin();
- (f_simplex != filtration_vect_.rend()) && ((*f_simplex)->second.filtration() > filtration);
- f_simplex++) {
- std::vector<Vertex_handle> simplex_to_remove;
- for (auto vertex : simplex_vertex_range(*f_simplex))
- simplex_to_remove.insert(simplex_to_remove.begin(), vertex);
- simplex_list_to_removed.push_back(simplex_to_remove);
- }
- for (auto simplex_to_remove : simplex_list_to_removed) {
- Simplex_handle sh = find_simplex(simplex_to_remove);
- if (sh != null_simplex())
- remove_maximal_simplex(sh);
- }
- // Re-initialize filtration_vect_ if dta were removed, because removing is shifting data in a flat_map
- return (simplex_list_to_removed.size() > 0);
- }
-
-
- // Another alternative for prune_above_filtration
- // UT are passed and performance are similar.
- /*bool prune_above_filtration(Filtration_value filt) {
+ bool prune_above_filtration(Filtration_value filt) {
return rec_prune_above_filtration(root(), filt);
}
@@ -1249,7 +1218,7 @@ class Simplex_tree {
modified |= rec_prune_above_filtration(simplex.second.children(), filt);
}
return modified;
- }*/
+ }
public:
/** \brief Remove a maximal simplex.