From ed8ae292df7b486b71f573431e17e3466a0a2ace Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 25 Jun 2015 09:01:59 +0000 Subject: coface removal - added but not needed git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alphashapes@644 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 3598444f908fd791b111c8ab8eb18a3c0a15fc16 --- src/Simplex_tree/include/gudhi/Simplex_tree.h | 87 --------------------------- 1 file changed, 87 deletions(-) (limited to 'src') diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 32fb2f43..9a06b262 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -837,92 +837,6 @@ class Simplex_tree { os << filtration(sh) << " \n"; } } - //---------------------------------------------------------------------------------------------- - //---------------------------------------------------------------------------------------------- - private: - - /** Recursive search of cofaces - */ - template - void rec_coface(RandomAccessVertexRange &vertices, Siblings *curr_sib, Dictionary *curr_res, std::vector& cofaces, unsigned int length, unsigned long codimension) { - for (auto sib = curr_sib->members().begin(); sib != curr_sib->members().end() && (vertices.empty() || sib->first <= vertices[vertices.size() - 1]); ++sib) { - bool continueRecursion = (codimension == length || curr_res->size() <= codimension); // dimension of actual simplex <= codimension - if (vertices.empty()) { - if (curr_res->size() >= length && continueRecursion) - // If we reached the end of the vertices, and the simplex has more vertices than the given simplex, we found a coface - { - curr_res->emplace(sib->first, sib->second); - bool egalDim = (codimension == length || curr_res->size() == codimension); // dimension of actual simplex == codimension - if (egalDim) - cofaces.push_back(*curr_res); - if (has_children(sib)) - rec_coface(vertices, sib->second.children(), curr_res, cofaces, length, codimension); - curr_res->erase(curr_res->end() - 1); - } - } else if (continueRecursion) { - if (sib->first == vertices[vertices.size() - 1]) // If curr_sib matches with the top vertex - { - curr_res->emplace(sib->first, sib->second); - bool egalDim = (codimension == length || curr_res->size() == codimension); // dimension of actual simplex == codimension - if (vertices.size() == 1 && curr_res->size() > length && egalDim) - cofaces.push_back(*curr_res); - if (has_children(sib)) { // Rec call - Vertex_handle tmp = vertices[vertices.size() - 1]; - vertices.pop_back(); - rec_coface(vertices, sib->second.children(), curr_res, cofaces, length, codimension); - vertices.push_back(tmp); - } - curr_res->erase(curr_res->end() - 1); - } else // (sib->first < vertices[vertices.size()-1]) - { - if (has_children(sib)) { - curr_res->emplace(sib->first, sib->second); - rec_coface(vertices, sib->second.children(), curr_res, cofaces, length, codimension); - curr_res->erase(curr_res->end() - 1); - } - } - } - } - } - - public: - - /** \brief Compute the cofaces of a n simplex - * \param vertices List of vertices which represent the n simplex. - * \param codimension The function returns the n+codimension-simplices. If codimension = 0, return all cofaces - * \return Vector of Dictionary, empty vector if no cofaces found. - * \warning n+codimension must be lower than Simplex_tree dimension, otherwise an an empty vector is returned. - */ - - template - std::vector coface(const RandomAccessVertexRange &vertices, int codimension) { - RandomAccessVertexRange copy = vertices; - std::vector cofaces; - std::sort(copy.begin(), copy.end(), std::greater()); // must be sorted in decreasing order - if (root_.members().empty()) { - std::cerr << "Simplex_tree::coface - empty Simplex_tree" << std::endl; - return cofaces; // ----->> - } - if (vertices.empty()) { - std::cerr << "Simplex_tree::coface - empty vertices list" << std::endl; - return cofaces; // ----->> - } - if (codimension < 0) { - std::cerr << "Simplex_tree::coface - codimension is empty" << std::endl; - return cofaces; // ----->> - } - if (codimension + vertices.size() >= (unsigned long) dimension_) { - std::cerr << "Simplex_tree::coface - codimension + vertices list size cannot be greater than Simplex_tree dimension" << std::endl; - return cofaces; // ----->> - } - std::sort(copy.begin(), copy.end(), std::greater()); // must be sorted in decreasing order - Dictionary res; - rec_coface(copy, &root_, &res, cofaces, vertices.size(), codimension + vertices.size()); - return cofaces; - } - - //---------------------------------------------------------------------------------------------- - //---------------------------------------------------------------------------------------------- private: Vertex_handle null_vertex_; @@ -950,7 +864,6 @@ std::ostream& operator<<(std::ostream & os, Simplex_tree & st) { } return os; } - template std::istream& operator>>(std::istream & is, Simplex_tree & st) { // assert(st.num_simplices() == 0); -- cgit v1.2.3