From 6d66260b62aa5c780e3ac2f0f191992aca016e24 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 9 Mar 2017 10:22:37 +0000 Subject: Strong witness cythonization Biblio for doc simplification git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2184 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: c191c6b79bb14f799d6cd08ac59a6b007a7874dc --- src/cython/include/Simplex_tree_interface.h | 7 +++ .../include/Strong_witness_complex_interface.h | 71 ++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 src/cython/include/Strong_witness_complex_interface.h (limited to 'src/cython/include') diff --git a/src/cython/include/Simplex_tree_interface.h b/src/cython/include/Simplex_tree_interface.h index 19e02ca4..4f3096c0 100644 --- a/src/cython/include/Simplex_tree_interface.h +++ b/src/cython/include/Simplex_tree_interface.h @@ -59,6 +59,13 @@ class Simplex_tree_interface : public Simplex_tree { return (result.second); } + // Do not interface this function, only used in strong witness interface for complex creation + bool insert_simplex_and_subfaces(const std::vector& complex, Filtration_value filtration = 0) { + Insertion_result result = Simplex_tree::insert_simplex_and_subfaces(complex, filtration); + Simplex_tree::initialize_filtration(); + return (result.second); + } + Filtration_value simplex_filtration(const Simplex& complex) { return Simplex_tree::filtration(Simplex_tree::find(complex)); } diff --git a/src/cython/include/Strong_witness_complex_interface.h b/src/cython/include/Strong_witness_complex_interface.h new file mode 100644 index 00000000..e59e58ea --- /dev/null +++ b/src/cython/include/Strong_witness_complex_interface.h @@ -0,0 +1,71 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Vincent Rouvreau + * + * Copyright (C) 2016 INRIA + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef STRONG_WITNESS_COMPLEX_INTERFACE_H +#define STRONG_WITNESS_COMPLEX_INTERFACE_H + +#include +#include + +#include "Simplex_tree_interface.h" + +#include +#include // std::pair +#include +#include + +namespace Gudhi { + +namespace witness_complex { + +class Strong_witness_complex_interface { + using Nearest_landmark_range = std::vector>; + using Nearest_landmark_table = std::vector; + + public: + Strong_witness_complex_interface(Nearest_landmark_table& nlt) { + witness_complex_ = new Strong_witness_complex(nlt); + } + + void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square, + std::size_t limit_dimension) { + witness_complex_->create_complex(*simplex_tree, max_alpha_square, limit_dimension); + simplex_tree->initialize_filtration(); + } + + void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, + double max_alpha_square) { + witness_complex_->create_complex(*simplex_tree, max_alpha_square, std::numeric_limits::max()); + simplex_tree->initialize_filtration(); + } + + private: + Strong_witness_complex* witness_complex_; + +}; + +} // namespace witness_complex + +} // namespace Gudhi + +#endif // STRONG_WITNESS_COMPLEX_INTERFACE_H + -- cgit v1.2.3