Cech_complex_blocker.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) 2018 Inria
6  *
7  * Modification(s):
8  * - YYYY/MM Author: Description of the modification
9  */
10 
11 #ifndef CECH_COMPLEX_BLOCKER_H_
12 #define CECH_COMPLEX_BLOCKER_H_
13 
14 #include <gudhi/distance_functions.h> // for Gudhi::Minimal_enclosing_ball_radius
15 
16 #include <iostream>
17 #include <vector>
18 #include <cmath> // for std::sqrt
19 
20 namespace Gudhi {
21 
22 namespace cech_complex {
23 
38 template <typename SimplicialComplexForCech, typename Cech_complex>
39 class Cech_blocker {
40  private:
41  using Point_cloud = typename Cech_complex::Point_cloud;
42 
43  using Simplex_handle = typename SimplicialComplexForCech::Simplex_handle;
45 
46  public:
51  bool operator()(Simplex_handle sh) {
52  Point_cloud points;
53  for (auto vertex : sc_ptr_->simplex_vertex_range(sh)) {
54  points.push_back(cc_ptr_->get_point(vertex));
55 #ifdef DEBUG_TRACES
56  std::clog << "#(" << vertex << ")#";
57 #endif // DEBUG_TRACES
58  }
60 #ifdef DEBUG_TRACES
61  if (radius > cc_ptr_->max_radius()) std::clog << "radius > max_radius => expansion is blocked\n";
62 #endif // DEBUG_TRACES
63  sc_ptr_->assign_filtration(sh, radius);
64  return (radius > cc_ptr_->max_radius());
65  }
66 
68  Cech_blocker(SimplicialComplexForCech* sc_ptr, Cech_complex* cc_ptr) : sc_ptr_(sc_ptr), cc_ptr_(cc_ptr) {}
69 
70  private:
71  SimplicialComplexForCech* sc_ptr_;
72  Cech_complex* cc_ptr_;
73 };
74 
75 } // namespace cech_complex
76 
77 } // namespace Gudhi
78 
79 #endif // CECH_COMPLEX_BLOCKER_H_
Compute the radius of the minimal enclosing ball between Points given by a range of coordinates....
Definition: distance_functions.h:64
Cech complex data structure.
Definition: Cech_complex.h:44
Global distance functions.
Value type for a filtration function on a cell complex.
Definition: FiltrationValue.h:20
unspecified Filtration_value
Definition: SimplicialComplexForCech.h:27
unspecified Simplex_handle
Definition: SimplicialComplexForCech.h:23
GUDHI  Version 3.4.1  - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.  - Copyright : MIT Generated on Tue Oct 26 2021 14:06:04 for GUDHI by Doxygen 1.9.1