diff options
author | salinasd <salinasd@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2014-12-18 13:29:14 +0000 |
---|---|---|
committer | salinasd <salinasd@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2014-12-18 13:29:14 +0000 |
commit | f3b0595a69340ca5fee47b8c5686f69262beaa58 (patch) | |
tree | 3f74420f1dfce588016f82ba138a4005d5cb4cd7 /src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h | |
parent | c685b05b2ed30d96554ec3271bbbb68f874c54e1 (diff) |
skbl add_simplex method
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@382 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 0d325bee25bf0f45741aadd29ffe9628dcabb413
Diffstat (limited to 'src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h')
-rw-r--r-- | src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h index 1a51e709..d254222d 100644 --- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h +++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h @@ -251,22 +251,56 @@ public: else if (sigma.dimension()==1) remove_star(sigma.first_vertex(),sigma.last_vertex()); + else{ + remove_blocker_containing_simplex(sigma); + this->add_blocker(sigma); + } + } + + /** + * @brief add the simplex plus all its cofaces + * @details in the case where sigma is a vertex, the simplex + * added has an id which is set to the number of vertices + */ + void add_simplex(const Simplex_handle& sigma){ + assert(!this->contains(sigma)); + if (sigma.dimension()==0) + this->add_vertex(); + else + if (sigma.dimension()==1) + this->add_edge(sigma.first_vertex(),sigma.last_vertex()); else - update_blockers_after_remove_star_of_simplex(sigma); + remove_blocker_include_in_simplex(sigma); } private: - void update_blockers_after_remove_star_of_simplex(const Simplex_handle& sigma){ - std::list <Blocker_handle> blockers_to_remove; + /** + * remove all blockers that contains sigma + */ + void remove_blocker_containing_simplex(const Simplex_handle& sigma){ + std::vector <Blocker_handle> blockers_to_remove; for (auto blocker : this->blocker_range(sigma.first_vertex())){ if(blocker->contains(sigma)) blockers_to_remove.push_back(blocker); } for(auto blocker_to_update : blockers_to_remove) this->delete_blocker(blocker_to_update); - this->add_blocker(sigma); } + /** + * remove all blockers that contains sigma + */ + void remove_blocker_include_in_simplex(const Simplex_handle& sigma){ + std::vector <Blocker_handle> blockers_to_remove; + for (auto blocker : this->blocker_range(sigma.first_vertex())){ + if(sigma.contains(*blocker)) + blockers_to_remove.push_back(blocker); + } + for(auto blocker_to_update : blockers_to_remove) + this->delete_blocker(blocker_to_update); + } + + public: enum simplifiable_status{ NOT_HOMOTOPY_EQ,MAYBE_HOMOTOPY_EQ,HOMOTOPY_EQ}; |