23 #ifndef SKELETON_BLOCKER_SKELETON_BLOCKER_SIMPLEX_H_ 24 #define SKELETON_BLOCKER_SKELETON_BLOCKER_SIMPLEX_H_ 30 #include <initializer_list> 36 namespace skeleton_blocker {
52 std::set<T> simplex_set;
55 typedef typename T::boost_vertex_handle boost_vertex_handle;
57 typedef T Vertex_handle;
59 typedef typename std::set<T>::const_iterator Simplex_vertex_const_iterator;
60 typedef typename std::set<T>::iterator Simplex_vertex_iterator;
71 std::for_each(list.begin(), list.end(), [&] (T
const& elt) {
76 template<
typename ... Args>
78 add_vertices(args...);
81 template<
typename ... Args>
82 void add_vertices(T v, Args ... args) {
84 add_vertices(args...);
87 void add_vertices(T v) {
91 void add_vertices() { }
98 if ((token[0] ==
'{') && (token[token.size() - 1] ==
'}')) {
100 token.erase(token.size() - 1, 1);
101 while (token.size() != 0) {
102 int coma_position = token.find_first_of(
',');
104 std::string n = token.substr(0, coma_position);
106 token.erase(0, n.size() + 1);
123 simplex_set.insert(v);
130 simplex_set.erase(v);
138 v.reserve((std::min)(simplex_set.size(), a.simplex_set.size()));
140 set_intersection(simplex_set.begin(), simplex_set.end(),
141 a.simplex_set.begin(), a.simplex_set.end(),
142 std::back_inserter(v));
145 simplex_set.insert(i);
153 v.reserve(simplex_set.size());
155 set_difference(simplex_set.begin(), simplex_set.end(),
156 a.simplex_set.begin(), a.simplex_set.end(),
157 std::back_inserter(v));
161 simplex_set.insert(i);
169 v.reserve(simplex_set.size() + a.simplex_set.size());
171 set_union(simplex_set.begin(), simplex_set.end(), a.simplex_set.begin(),
172 a.simplex_set.end(), std::back_inserter(v));
174 simplex_set.insert(v.begin(), v.end());
177 typename std::set<T>::const_iterator begin()
const {
178 return simplex_set.cbegin();
181 typename std::set<T>::const_iterator end()
const {
182 return simplex_set.cend();
185 typename std::set<T>::const_reverse_iterator rbegin()
const {
186 return simplex_set.crbegin();
189 typename std::set<T>::const_reverse_iterator rend()
const {
190 return simplex_set.crend();
193 typename std::set<T>::iterator begin() {
194 return simplex_set.begin();
197 typename std::set<T>::iterator end() {
198 return simplex_set.end();
210 return (simplex_set.size() - 1);
214 return simplex_set.empty();
234 return *(simplex_set.rbegin());
241 return includes(simplex_set.cbegin(), simplex_set.cend(),
242 a.simplex_set.cbegin(), a.simplex_set.cend());
250 auto first1 = begin();
253 auto first2 = a.begin();
254 auto last2 = a.end();
256 while (first2 != last2) {
261 if ((first1 == last1) || (*first2 < *first1))
263 if (!(*first1 < *first2))
275 auto first1 = begin();
278 auto first2 = a.begin();
279 auto last2 = a.end();
281 while (first2 != last2) {
286 if ((first1 == last1) || (*first2 < *first1))
288 if (!(*first1 < *first2))
300 auto first1 = begin();
303 auto first2 = a.begin();
304 auto last2 = a.end();
306 while (first2 != last2) {
308 if (x == *first2 || y == *first2) {
311 if ((first1 == last1) || (*first2 < *first1))
313 if (!(*first1 < *first2))
322 return (simplex_set.find(v) != simplex_set.end());
327 v.reserve(std::min(simplex_set.size(), a.simplex_set.size()));
329 set_intersection(simplex_set.cbegin(), simplex_set.cend(),
330 a.simplex_set.cbegin(), a.simplex_set.cend(),
331 std::back_inserter(v));
333 return (v.size() == 0);
337 return (this->simplex_set == other.simplex_set);
341 return (this->simplex_set != other.simplex_set);
345 return (std::lexicographical_compare(this->simplex_set.begin(),
346 this->simplex_set.end(), other.begin(),
352 friend std::ostream& operator<<(std::ostream& o,
356 for (
auto i : sigma) {
370 namespace skbl = skeleton_blocker;
374 #endif // SKELETON_BLOCKER_SKELETON_BLOCKER_SIMPLEX_H_ T last_vertex() const
Definition: Skeleton_blocker_simplex.h:232
Abstract simplex used in Skeleton blockers data-structure.
Definition: Skeleton_blocker_simplex.h:50
void add_vertex(T v)
Definition: Skeleton_blocker_simplex.h:122
bool contains_difference(const Skeleton_blocker_simplex &a, const Skeleton_blocker_simplex &b) const
Definition: Skeleton_blocker_simplex.h:248
int dimension() const
Definition: Skeleton_blocker_simplex.h:209
void difference(const Skeleton_blocker_simplex &a)
Definition: Skeleton_blocker_simplex.h:151
void remove_vertex(T v)
Definition: Skeleton_blocker_simplex.h:129
bool contains_difference(const Skeleton_blocker_simplex &a, T x, T y) const
Definition: Skeleton_blocker_simplex.h:299
bool contains_difference(const Skeleton_blocker_simplex &a, T x) const
Definition: Skeleton_blocker_simplex.h:274
Definition: SimplicialComplexForAlpha.h:26
bool contains(const Skeleton_blocker_simplex &a) const
Definition: Skeleton_blocker_simplex.h:240
Skeleton_blocker_simplex(std::string token)
Definition: Skeleton_blocker_simplex.h:96
void intersection(const Skeleton_blocker_simplex &a)
Definition: Skeleton_blocker_simplex.h:136
void union_vertices(const Skeleton_blocker_simplex &a)
Definition: Skeleton_blocker_simplex.h:167
T first_vertex() const
Definition: Skeleton_blocker_simplex.h:222