Loading...
Searching...
No Matches
Simplex_tree_siblings.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): Clément Maria
4 *
5 * Copyright (C) 2014 Inria
6 *
7 * Modification(s):
8 * - YYYY/MM Author: Description of the modification
9 */
10
11#ifndef SIMPLEX_TREE_SIMPLEX_TREE_SIBLINGS_H_
12#define SIMPLEX_TREE_SIMPLEX_TREE_SIBLINGS_H_
13
14#include <gudhi/Simplex_tree/simplex_tree_options.h>
15#include <gudhi/Simplex_tree/Simplex_tree_node_explicit_storage.h>
16
17#include <boost/container/flat_map.hpp>
18
19namespace Gudhi {
20
25
28template<class SimplexTree, class MapContainer>
29class Simplex_tree_siblings {
30// private:
31// friend SimplexTree;
32 public:
33 template<class T> friend class Simplex_tree_simplex_vertex_iterator;
34 template<class T> friend class Simplex_tree_boundary_simplex_iterator;
35 template<class T> friend class Simplex_tree_complex_simplex_iterator;
36 template<class T> friend class Simplex_tree_skeleton_simplex_iterator;
37 template<class T> friend class Simplex_tree_boundary_opposite_vertex_simplex_iterator;
38
39 typedef typename SimplexTree::Vertex_handle Vertex_handle;
40 typedef typename SimplexTree::Filtration_value Filtration_value;
41 typedef typename SimplexTree::Node Node;
42 typedef MapContainer Dictionary;
43 typedef typename MapContainer::iterator Dictionary_it;
44 typedef typename MapContainer::const_iterator Dictionary_const_it;
45
46 /* Default constructor.*/
47 Simplex_tree_siblings()
48 : oncles_(nullptr),
49 parent_(-1),
50 members_() {
51 }
52
53 /* Constructor with values.*/
54 Simplex_tree_siblings(Simplex_tree_siblings * oncles, Vertex_handle parent)
55 : oncles_(oncles),
56 parent_(parent),
57 members_() {
58 }
59
63 template<typename RandomAccessVertexRange>
64 Simplex_tree_siblings(Simplex_tree_siblings * oncles, Vertex_handle parent, const RandomAccessVertexRange & members)
65 : oncles_(oncles),
66 parent_(parent),
67 members_(boost::container::ordered_unique_range, members.begin(),
68 members.end()) {
69 for (auto& map_el : members_) {
70 map_el.second.assign_children(this);
71 }
72 }
73
74 Dictionary_it find(Vertex_handle v) {
75 return members_.find(v);
76 }
77 Dictionary_const_it find(Vertex_handle v) const {
78 return members_.find(v);
79 }
80
81 Simplex_tree_siblings * oncles() {
82 return oncles_;
83 }
84 const Simplex_tree_siblings * oncles() const {
85 return oncles_;
86 }
87
88 Vertex_handle parent() const {
89 return parent_;
90 }
91
92 Dictionary & members() {
93 return members_;
94 }
95
96 const Dictionary & members() const {
97 return members_;
98 }
99
100 size_t size() const {
101 return members_.size();
102 }
103
104 void erase(const Dictionary_it iterator) {
105 members_.erase(iterator);
106 }
107
108 Dictionary_it to_non_const_it(Dictionary_const_it it) {
109 return members_.erase(it, it);
110 }
111
112 Simplex_tree_siblings * oncles_;
113 Vertex_handle parent_;
114 Dictionary members_;
115};
116 // end addtogroup simplex_tree
118
119} // namespace Gudhi
120
121#endif // SIMPLEX_TREE_SIMPLEX_TREE_SIBLINGS_H_
Simplex_tree_siblings(Simplex_tree_siblings *oncles, Vertex_handle parent, const RandomAccessVertexRange &members)
Constructor with initialized set of members.
Definition Simplex_tree_siblings.h:64
Options::Filtration_value Filtration_value
Type for the value of the filtration function.
Definition Simplex_tree.h:108
Options::Vertex_handle Vertex_handle
Type for the vertex handle.
Definition Simplex_tree.h:122
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14