summaryrefslogtreecommitdiff
path: root/src/Skeleton_blocker/include
diff options
context:
space:
mode:
authorsalinasd <salinasd@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2014-12-18 13:29:14 +0000
committersalinasd <salinasd@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2014-12-18 13:29:14 +0000
commitf3b0595a69340ca5fee47b8c5686f69262beaa58 (patch)
tree3f74420f1dfce588016f82ba138a4005d5cb4cd7 /src/Skeleton_blocker/include
parentc685b05b2ed30d96554ec3271bbbb68f874c54e1 (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')
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h4
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h1
-rw-r--r--src/Skeleton_blocker/include/gudhi/Skeleton_blocker_simplifiable_complex.h42
3 files changed, 42 insertions, 5 deletions
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h
index 77f59e35..8f7e1590 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker.h
@@ -180,7 +180,9 @@ The Euler Characteristic is 1
\subsection Acknowledgements
The author wishes to thank Dominique Attali and André Lieutier for
-their collaboration to write the two initial papers (cite socg_blockers_2011,\cite blockers2012) about this data-structure
+their collaboration to write the two initial papers
+\cite socg_blockers_2011,\cite blockers2012
+ about this data-structure
and also Dominique for leaving him use a prototype.
diff --git a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h
index 81ff0231..02dffc15 100644
--- a/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h
+++ b/src/Skeleton_blocker/include/gudhi/Skeleton_blocker_complex.h
@@ -717,6 +717,7 @@ public:
* returns a Blocker_handle toward it if was not present before and 0 otherwise.
*/
Blocker_handle add_blocker(const Simplex_handle& blocker){
+ assert(blocker.dimension()>1);
if (contains_blocker(blocker))
{
//std::cerr << "ATTEMPT TO ADD A BLOCKER ALREADY THERE ---> BLOCKER IGNORED" << endl;
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};