diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-11-25 16:00:19 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-11-25 16:00:19 +0000 |
commit | af146a2e48c16855355ac599cbc617250727d244 (patch) | |
tree | bab3117c6886f41ec9d2a1869bc70105ecdd63b3 /src/cython/include | |
parent | f843ef3f8e4ab4ce94a28ded6d8cafd37f2b2311 (diff) |
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
Diffstat (limited to 'src/cython/include')
-rw-r--r-- | src/cython/include/Alpha_complex_interface.h | 17 | ||||
-rw-r--r-- | src/cython/include/Simplex_tree_interface.h | 7 |
2 files changed, 15 insertions, 9 deletions
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 <CGAL/Epick_d.h> #include "Persistent_cohomology_interface.h" +#include "Simplex_tree_interface.h" #include <vector> #include <utility> // std::pair @@ -49,18 +50,14 @@ class Alpha_complex_interface { typedef typename Simplex_tree<>::Simplex_key Simplex_key; public: - Alpha_complex_interface(std::vector<std::vector<double>>&points, double max_alpha_square) + Alpha_complex_interface(std::vector<std::vector<double>>&points) : pcoh_(nullptr) { alpha_complex_ = new Alpha_complex<Dynamic_kernel>(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<Dynamic_kernel>(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<Simplex_tree<>>* 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<typename SimplexTreeOptions = Simplex_tree_options_full_featured> class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> { + public: typedef typename Simplex_tree<SimplexTreeOptions>::Simplex_handle Simplex_handle; typedef typename std::pair<Simplex_handle, bool> Insertion_result; using Simplex = std::vector<Vertex_handle>; @@ -50,6 +51,7 @@ class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> { bool insert_simplex_and_subfaces(const Simplex& complex, Filtration_value filtration = 0) { Insertion_result result = Simplex_tree<SimplexTreeOptions>::insert_simplex_and_subfaces(complex, filtration); + Simplex_tree<SimplexTreeOptions>::initialize_filtration(); return (result.second); } @@ -58,7 +60,8 @@ class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> { } void remove_maximal_simplex(const Simplex& complex) { - return Simplex_tree<SimplexTreeOptions>::remove_maximal_simplex(Simplex_tree<SimplexTreeOptions>::find(complex)); + Simplex_tree<SimplexTreeOptions>::remove_maximal_simplex(Simplex_tree<SimplexTreeOptions>::find(complex)); + Simplex_tree<SimplexTreeOptions>::initialize_filtration(); } Complex_tree get_filtered_tree() { @@ -66,8 +69,10 @@ class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> { for (auto f_simplex : Simplex_tree<SimplexTreeOptions>::filtration_simplex_range()) { Simplex simplex; for (auto vertex : Simplex_tree<SimplexTreeOptions>::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<SimplexTreeOptions>::filtration(f_simplex))); } return filtered_tree; |