diff options
Diffstat (limited to 'src/Simplex_tree')
-rw-r--r-- | src/Simplex_tree/include/gudhi/Simplex_tree.h | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index d4a52113..fe2faf90 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -38,7 +38,6 @@ #include <functional> // for greater<> namespace Gudhi { - /** \defgroup simplex_tree Filtered Complexes * * A simplicial complex \f$\mathbf{K}\f$ @@ -73,7 +72,6 @@ namespace Gudhi { * \copyright GNU General Public License v3. * @{ */ - /** * \brief Simplex Tree data structure for representing simplicial complexes. * @@ -282,7 +280,8 @@ class Simplex_tree { threshold_(0), root_(NULL, null_vertex_), filtration_vect_(), - dimension_(-1) { } + dimension_(-1) { + } /** \brief Destructor; deallocates the whole tree structure. */ ~Simplex_tree() { @@ -330,6 +329,15 @@ class Simplex_tree { } } + /** \brief Sets the filtration value of a simplex. + * + * No action if called on the null_simplex*/ + void assign_filtration(Simplex_handle sh, Filtration_value fv) { + if (sh != null_simplex()) { + sh->second.assign_filtration(fv); + } + } + /** \brief Returns an upper bound of the filtration values of the simplices. */ Filtration_value filtration() const { return threshold_; @@ -442,8 +450,7 @@ class Simplex_tree { Simplex_handle find_vertex(Vertex_handle v) { return root_.members_.begin() + v; } - //{ return root_.members_.find(v); } - + /** \brief Insert a simplex, represented by a range of Vertex_handles, in the simplicial complex. * * @param[in] simplex range of Vertex_handles, representing the vertices of the new simplex @@ -508,8 +515,9 @@ class Simplex_tree { * @param[in] filtration the filtration value assigned to the new N-simplex. */ template<class RandomAccessVertexRange> - void insert_simplex_and_subfaces(RandomAccessVertexRange& Nsimplex, - Filtration_value filtration = 0.0) { + std::pair<Simplex_handle, bool> insert_simplex_and_subfaces(RandomAccessVertexRange& Nsimplex, + Filtration_value filtration = 0.0) { + std::pair<Simplex_handle, bool> returned; if (Nsimplex.size() > 1) { for (unsigned int NIndex = 0; NIndex < Nsimplex.size(); NIndex++) { // insert N (N-1)-Simplex @@ -519,22 +527,21 @@ class Simplex_tree { NsimplexMinusOne.push_back(Nsimplex[(NIndex + NListIter) % Nsimplex.size()]); } // (N-1)-Simplex recursive call - insert_simplex_and_subfaces(NsimplexMinusOne, filtration); + returned = insert_simplex_and_subfaces(NsimplexMinusOne, filtration); } // N-Simplex insert - std::pair<Simplex_handle, bool> returned = insert_simplex(Nsimplex, filtration); + returned = insert_simplex(Nsimplex, filtration); + if (returned.second == true) { + } } else if (Nsimplex.size() == 1) { // 1-Simplex insert - End of recursivity - std::pair<Simplex_handle, bool> returned = insert_simplex(Nsimplex, filtration); + returned = insert_simplex(Nsimplex, filtration); + if (returned.second == true) { + } } else { // Nothing to insert - empty vector } - } - - /** \brief Assign a value 'key' to the key of the simplex - * represented by the Simplex_handle 'sh'. */ - void assign_key(Simplex_handle sh, Simplex_key key) { - sh->second.assign_key(key); + return returned; } public: @@ -921,7 +928,6 @@ class Simplex_tree { }; // Print a Simplex_tree in os. - template<typename...T> std::ostream& operator<<(std::ostream & os, Simplex_tree<T...> & st) { for (auto sh : st.filtration_simplex_range()) { |