Active_witness.h
1 /* This file is part of the Gudhi Library. The Gudhi library
2  * (Geometric Understanding in Higher Dimensions) is a generic C++
3  * library for computational topology.
4  *
5  * Author(s): Siargey Kachanovich
6  *
7  * Copyright (C) 2016 Inria
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef ACTIVE_WITNESS_ACTIVE_WITNESS_H_
24 #define ACTIVE_WITNESS_ACTIVE_WITNESS_H_
25 
26 #include <gudhi/Active_witness/Active_witness_iterator.h>
27 #include <list>
28 
29 namespace Gudhi {
30 
31 namespace witness_complex {
32 
33  /* \class Active_witness
34  * \brief Class representing a list of nearest neighbors to a given witness.
35  * \details Every element is a pair of a landmark identifier and the squared distance to it.
36  */
37 template< typename Id_distance_pair,
38  typename INS_range >
39 class Active_witness {
40  public:
41  typedef Active_witness<Id_distance_pair, INS_range> ActiveWitness;
42  typedef typename INS_range::iterator INS_iterator;
43  typedef Active_witness_iterator< ActiveWitness, Id_distance_pair, INS_iterator > iterator;
44  typedef typename std::list<Id_distance_pair> Table;
45 
46  Table nearest_landmark_table_;
47  INS_range search_range_;
48  INS_iterator iterator_next_;
49  INS_iterator iterator_end_;
50 
51  Active_witness(const INS_range& search_range)
52  : search_range_(search_range), iterator_next_(search_range_.begin()), iterator_end_(search_range_.end()) {
53  }
54 
55  iterator begin() {
56  return iterator(this, nearest_landmark_table_.begin());
57  }
58 
59  iterator end() {
60  return iterator(this);
61  }
62 };
63 
64 } // namespace witness_complex
65 } // namespace Gudhi
66 
67 #endif // ACTIVE_WITNESS_ACTIVE_WITNESS_H_
Definition: SimplicialComplexForAlpha.h:26
GUDHI  Version 2.2.0  - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.  - Copyright : GPL v3 Generated on Tue Aug 21 2018 01:41:05 for GUDHI by Doxygen 1.8.13