From af146a2e48c16855355ac599cbc617250727d244 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 25 Nov 2016 16:00:19 +0000 Subject: Add of tangential complex doc Separate simplex tree from alpha complex git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@1788 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 1cf4a35e0a099501eb1cb6b9809041dd1a1e2617 --- src/cython/include/Alpha_complex_interface.h | 17 +++++++++-------- src/cython/include/Simplex_tree_interface.h | 7 ++++++- 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'src/cython/include') diff --git a/src/cython/include/Alpha_complex_interface.h b/src/cython/include/Alpha_complex_interface.h index 13412994..07f5b5b4 100644 --- a/src/cython/include/Alpha_complex_interface.h +++ b/src/cython/include/Alpha_complex_interface.h @@ -28,6 +28,7 @@ #include #include "Persistent_cohomology_interface.h" +#include "Simplex_tree_interface.h" #include #include // std::pair @@ -49,18 +50,14 @@ class Alpha_complex_interface { typedef typename Simplex_tree<>::Simplex_key Simplex_key; public: - Alpha_complex_interface(std::vector>&points, double max_alpha_square) + Alpha_complex_interface(std::vector>&points) : pcoh_(nullptr) { alpha_complex_ = new Alpha_complex(points); - alpha_complex_->create_complex(simplex_tree_, max_alpha_square); - simplex_tree_.initialize_filtration(); } - Alpha_complex_interface(std::string off_file_name, double max_alpha_square, bool from_file = true) + Alpha_complex_interface(std::string off_file_name, bool from_file = true) : pcoh_(nullptr) { alpha_complex_ = new Alpha_complex(off_file_name); - alpha_complex_->create_complex(simplex_tree_, max_alpha_square); - simplex_tree_.initialize_filtration(); } bool find_simplex(const Simplex& vh) { @@ -194,6 +191,11 @@ class Alpha_complex_interface { return persistent_betti_numbers; } + void create_simplex_tree(Simplex_tree_interface<>& simplex_tree, double max_alpha_square) { + alpha_complex_->create_complex(simplex_tree, max_alpha_square); + simplex_tree.initialize_filtration(); + } + private: Simplex_tree<> simplex_tree_; Persistent_cohomology_interface>* pcoh_; @@ -202,7 +204,6 @@ class Alpha_complex_interface { } // namespace alpha_complex -} // namespace Gudhi +} // namespace Gudhi #endif // ALPHA_COMPLEX_INTERFACE_H - diff --git a/src/cython/include/Simplex_tree_interface.h b/src/cython/include/Simplex_tree_interface.h index ad7be1a8..06ec6d40 100644 --- a/src/cython/include/Simplex_tree_interface.h +++ b/src/cython/include/Simplex_tree_interface.h @@ -36,6 +36,7 @@ namespace Gudhi { template class Simplex_tree_interface : public Simplex_tree { + public: typedef typename Simplex_tree::Simplex_handle Simplex_handle; typedef typename std::pair Insertion_result; using Simplex = std::vector; @@ -50,6 +51,7 @@ class Simplex_tree_interface : public Simplex_tree { bool insert_simplex_and_subfaces(const Simplex& complex, Filtration_value filtration = 0) { Insertion_result result = Simplex_tree::insert_simplex_and_subfaces(complex, filtration); + Simplex_tree::initialize_filtration(); return (result.second); } @@ -58,7 +60,8 @@ class Simplex_tree_interface : public Simplex_tree { } void remove_maximal_simplex(const Simplex& complex) { - return Simplex_tree::remove_maximal_simplex(Simplex_tree::find(complex)); + Simplex_tree::remove_maximal_simplex(Simplex_tree::find(complex)); + Simplex_tree::initialize_filtration(); } Complex_tree get_filtered_tree() { @@ -66,8 +69,10 @@ class Simplex_tree_interface : public Simplex_tree { for (auto f_simplex : Simplex_tree::filtration_simplex_range()) { Simplex simplex; for (auto vertex : Simplex_tree::simplex_vertex_range(f_simplex)) { + std::cout << " " << vertex; simplex.insert(simplex.begin(), vertex); } + std::cout << std::endl; filtered_tree.push_back(std::make_pair(simplex, Simplex_tree::filtration(f_simplex))); } return filtered_tree; -- cgit v1.2.3