Euclidean_strong_witness_complex_interface.h
1/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
2 * See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
3 * Author(s): Vincent Rouvreau
4 *
5 * Copyright (C) 2016 Inria
6 *
7 * Modification(s):
8 * - YYYY/MM Author: Description of the modification
9 */
10
11#ifndef INCLUDE_EUCLIDEAN_STRONG_WITNESS_COMPLEX_INTERFACE_H_
12#define INCLUDE_EUCLIDEAN_STRONG_WITNESS_COMPLEX_INTERFACE_H_
13
14#include <gudhi/Simplex_tree.h>
15#include <gudhi/Euclidean_strong_witness_complex.h>
16
17#include "Simplex_tree_interface.h"
18
19#include <CGAL/Epick_d.h>
20
21#include <vector>
22#include <utility> // std::pair
23#include <iostream>
24#include <cstddef>
25
26namespace Gudhi {
27
28namespace witness_complex {
29
30
31class Euclidean_strong_witness_complex_interface {
32 using Dynamic_kernel = CGAL::Epick_d< CGAL::Dynamic_dimension_tag >;
33 using Point_d = Dynamic_kernel::Point_d;
34
35 typedef typename Simplex_tree<>::Simplex_key Simplex_key;
36
37 public:
38 Euclidean_strong_witness_complex_interface(const std::vector<std::vector<double>>& landmarks,
39 const std::vector<std::vector<double>>& witnesses) {
40 landmarks_.reserve(landmarks.size());
41 for (auto& landmark : landmarks)
42 landmarks_.emplace_back(landmark.begin(), landmark.end());
43 witness_complex_ = new Euclidean_strong_witness_complex<Dynamic_kernel>(landmarks_, witnesses);
44 }
45
46 ~Euclidean_strong_witness_complex_interface() {
47 delete witness_complex_;
48 }
49
50 void create_simplex_tree(Gudhi::Simplex_tree<>* simplex_tree, double max_alpha_square,
51 std::size_t limit_dimension) {
52 witness_complex_->create_complex(*simplex_tree, max_alpha_square, limit_dimension);
53 }
54
55 void create_simplex_tree(Gudhi::Simplex_tree<>* simplex_tree, double max_alpha_square) {
56 witness_complex_->create_complex(*simplex_tree, max_alpha_square);
57 }
58
59 std::vector<double> get_point(unsigned vh) {
60 std::vector<double> vd;
61 if (vh < landmarks_.size()) {
62 Point_d ph = witness_complex_->get_point(vh);
63 for (auto coord = ph.cartesian_begin(); coord < ph.cartesian_end(); coord++)
64 vd.push_back(*coord);
65 }
66 return vd;
67 }
68
69 private:
70 std::vector<Point_d> landmarks_;
71 Euclidean_strong_witness_complex<Dynamic_kernel>* witness_complex_;
72};
73
74} // namespace witness_complex
75
76} // namespace Gudhi
77
78#endif // INCLUDE_EUCLIDEAN_STRONG_WITNESS_COMPLEX_INTERFACE_H_
79
Simplex Tree data structure for representing simplicial complexes.
Definition: Simplex_tree.h:75
Options::Simplex_key Simplex_key
Key associated to each simplex.
Definition: Simplex_tree.h:86
GUDHIdev  Version 3.5.0  - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.  - Copyright : MIT Generated on Tue Aug 16 2022 14:01:50 for GUDHIdev by Doxygen 1.9.4