Gudhi  1.1.0
 All Classes Functions Typedefs Friends Groups Pages
Simplex_tree_node_explicit_storage.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): Clément Maria
6  *
7  * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (France)
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 SRC_SIMPLEX_TREE_INCLUDE_GUDHI_SIMPLEX_TREE_SIMPLEX_TREE_NODE_EXPLICIT_STORAGE_H_
24 #define SRC_SIMPLEX_TREE_INCLUDE_GUDHI_SIMPLEX_TREE_SIMPLEX_TREE_NODE_EXPLICIT_STORAGE_H_
25 
26 #include <vector>
27 
28 namespace Gudhi {
29 
30 /* \addtogroup simplex_tree
31  * Represents a node of a Simplex_tree.
32  * @{
33  */
34 
35 /*
36  * \brief Node of a simplex tree with filtration value
37  * and simplex key.
38  *
39  * It stores explicitely its own filtration value and its own Simplex_key.
40  */
41 template<class SimplexTree>
42 class Simplex_tree_node_explicit_storage {
43  public:
44  typedef typename SimplexTree::Siblings Siblings;
45  typedef typename SimplexTree::Filtration_value Filtration_value;
46  typedef typename SimplexTree::Simplex_key Simplex_key;
47 
48  // Default constructor.
49  Simplex_tree_node_explicit_storage()
50  : children_(NULL),
51  simplex_key_(-1),
52  filtration_(0) {
53  }
54 
55  Simplex_tree_node_explicit_storage(Siblings * sib,
56  Filtration_value filtration)
57  : children_(sib),
58  simplex_key_(-1),
59  filtration_(filtration) {
60  }
61 
62  void assign_key(Simplex_key key) {
63  simplex_key_ = key;
64  }
65 
66  /*
67  * Assign a children to the node
68  */
69  void assign_children(Siblings * children) {
70  children_ = children;
71  }
72  /*
73  *
74  */
75  void assign_filtration(double filtration_value) {
76  filtration_ = filtration_value;
77  }
78 
79  Filtration_value filtration() {
80  return filtration_;
81  }
82 
83  /* Careful -> children_ can be NULL*/
84  Siblings * children() {
85  return children_;
86  }
87 
88  Simplex_key key() {
89  return simplex_key_;
90  }
91 
92  private:
93  Siblings * children_;
94 
95  // Data attached to simplex, explicit storage
96  Simplex_key simplex_key_;
97  Filtration_value filtration_; // value in the filtration
98 };
99 
100 /* @} */ // end addtogroup simplex_tree
101 } // namespace Gudhi
102 
103 #endif // SRC_SIMPLEX_TREE_INCLUDE_GUDHI_SIMPLEX_TREE_SIMPLEX_TREE_NODE_EXPLICIT_STORAGE_H_