Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
FaceSet.h
Go to the documentation of this file.
1
32#pragma once
33
35#include <ogdf/basic/SList.h>
36
37namespace ogdf {
38
40
52template<bool SupportFastSizeQuery = true>
53class FaceSet {
54public:
55 using ListType =
56 typename std::conditional<SupportFastSizeQuery, List<face>, ListPure<face>>::type;
57
59 explicit FaceSet(const CombinatorialEmbedding& E) : m_it(E) { }
60
62
68 void insert(face f) {
69 OGDF_ASSERT(f->embeddingOf() == m_it.embeddingOf());
71
72 if (!itF.valid()) {
73 itF = m_faces.pushBack(f);
74 }
75 }
76
78
84 void remove(face f) {
85 OGDF_ASSERT(f->embeddingOf() == m_it.embeddingOf());
87
88 if (itF.valid()) {
89 m_faces.del(itF);
91 }
92 }
93
95
99 void clear() {
100 m_it.init(embeddingOf());
101 m_faces.clear();
102 }
103
105
110 bool isMember(face f) const {
111 OGDF_ASSERT(f->embeddingOf() == m_it.embeddingOf());
112 return m_it[f].valid();
113 }
114
116 const ListType& faces() const { return m_faces; }
117
119 const ConstCombinatorialEmbedding& embeddingOf() const { return *m_it.embeddingOf(); }
120
122
125 int size() const { return m_faces.size(); }
126
128 template<bool OtherSupportsFastSizeQuery>
132
134 template<bool OtherSupportsFastSizeQuery>
136 m_faces.clear();
137 m_it.init(other.embeddingOf());
138 for (face f : other.faces()) {
139 insert(f);
140 }
141 }
142
143private:
147
150};
151
152}
declaration and implementation of FaceArray class
Declaration of singly linked lists and iterators.
Combinatorial embeddings of planar graphs with modification functionality.
Combinatorial embeddings of planar graphs.
Dynamic arrays indexed with faces of a combinatorial embedding.
Definition FaceArray.h:126
Faces in a combinatorial embedding.
Face sets.
Definition FaceSet.h:53
ListType m_faces
The list of faces contained in this set.
Definition FaceSet.h:149
void remove(face f)
Removes face f from this set.
Definition FaceSet.h:84
FaceSet(const CombinatorialEmbedding &E)
Creates an empty face set associated with combinatorial embedding E.
Definition FaceSet.h:59
void insert(face f)
Inserts face f into this set.
Definition FaceSet.h:68
void clear()
Removes all faces from this set-.
Definition FaceSet.h:99
FaceSet(const FaceSet< OtherSupportsFastSizeQuery > &other)
Copy constructor.
Definition FaceSet.h:129
FaceArray< ListIterator< face > > m_it
m_it[f] contains the list iterator pointing to f if f is contained in S, or an invalid list iterator ...
Definition FaceSet.h:146
bool isMember(face f) const
Returns true iff face f is contained in this set.
Definition FaceSet.h:110
typename std::conditional< SupportFastSizeQuery, List< face >, ListPure< face > >::type ListType
Definition FaceSet.h:56
const ListType & faces() const
Returns a reference to the list of faces contained in this set.
Definition FaceSet.h:116
const ConstCombinatorialEmbedding & embeddingOf() const
Returns the associated combinatorial embedding.
Definition FaceSet.h:119
int size() const
Returns the number of faces in this set.
Definition FaceSet.h:125
FaceSet & operator=(const FaceSet< OtherSupportsFastSizeQuery > &other)
Assignment operator.
Definition FaceSet.h:135
Encapsulates a pointer to a list element.
Definition List.h:103
Doubly linked lists.
Definition List.h:217
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:41
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.