Developer Documentation
Loading...
Searching...
No Matches
StatusAttrib.hh
1#pragma once
2/*===========================================================================*\
3 * *
4 * OpenVolumeMesh *
5 * Copyright (C) 2011 by Computer Graphics Group, RWTH Aachen *
6 * www.openvolumemesh.org *
7 * *
8 *---------------------------------------------------------------------------*
9 * This file is part of OpenVolumeMesh. *
10 * *
11 * OpenVolumeMesh is free software: you can redistribute it and/or modify *
12 * it under the terms of the GNU Lesser General Public License as *
13 * published by the Free Software Foundation, either version 3 of *
14 * the License, or (at your option) any later version with the *
15 * following exceptions: *
16 * *
17 * If other files instantiate templates or use macros *
18 * or inline functions from this file, or you compile this file and *
19 * link it with other files to produce an executable, this file does *
20 * not by itself cause the resulting executable to be covered by the *
21 * GNU Lesser General Public License. This exception does not however *
22 * invalidate any other reasons why the executable file might be *
23 * covered by the GNU Lesser General Public License. *
24 * *
25 * OpenVolumeMesh is distributed in the hope that it will be useful, *
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
28 * GNU Lesser General Public License for more details. *
29 * *
30 * You should have received a copy of the GNU LesserGeneral Public *
31 * License along with OpenVolumeMesh. If not, *
32 * see <http://www.gnu.org/licenses/>. *
33 * *
34\*===========================================================================*/
35
36#include <cassert>
37
38#include <OpenVolumeMesh/Core/Handles.hh>
39#include <OpenVolumeMesh/Attribs/OpenVolumeMeshStatus.hh>
40#include <OpenVolumeMesh/Core/Properties/PropertyPtr.hh>
41#include <OpenVolumeMesh/Config/Export.hh>
42
43namespace OpenVolumeMesh {
44
45// Forward declaration
46class TopologyKernel;
47
48class OVM_EXPORT StatusAttrib {
49public:
50 explicit StatusAttrib(TopologyKernel& _kernel);
52
53 const OpenVolumeMeshStatus& operator[](const VertexHandle& _h) const {
54 return v_status_[_h];
55 }
56
57 OpenVolumeMeshStatus& operator[](const VertexHandle& _h) {
58 return v_status_[_h];
59 }
60
61 const OpenVolumeMeshStatus& operator[](const EdgeHandle& _h) const {
62 return e_status_[_h];
63 }
64
65 OpenVolumeMeshStatus& operator[](const EdgeHandle& _h) {
66 return e_status_[_h];
67 }
68
69 const OpenVolumeMeshStatus& operator[](const HalfEdgeHandle& _h) const {
70 return he_status_[_h];
71 }
72
73 OpenVolumeMeshStatus& operator[](const HalfEdgeHandle& _h) {
74 return he_status_[_h];
75 }
76
77 const OpenVolumeMeshStatus& operator[](const FaceHandle& _h) const {
78 return f_status_[_h];
79 }
80
81 OpenVolumeMeshStatus& operator[](const FaceHandle& _h) {
82 return f_status_[_h];
83 }
84
85 const OpenVolumeMeshStatus& operator[](const HalfFaceHandle& _h) const {
86 return hf_status_[_h];
87 }
88
89 OpenVolumeMeshStatus& operator[](const HalfFaceHandle& _h) {
90 return hf_status_[_h];
91 }
92
93 const OpenVolumeMeshStatus& operator[](const CellHandle& _h) const {
94 return c_status_[_h];
95 }
96
97 OpenVolumeMeshStatus& operator[](const CellHandle& _h) {
98 return c_status_[_h];
99 }
100
101 const OpenVolumeMeshStatus& mesh_status() const {
102 MeshHandle h(0);
103 return m_status_[h];
104 }
105
106 OpenVolumeMeshStatus& mesh_status() {
107 MeshHandle h(0);
108 return m_status_[h];
109 }
110
111 typedef VertexPropertyT<OpenVolumeMeshStatus>::const_iterator const_vstatus_iterator;
112 typedef VertexPropertyT<OpenVolumeMeshStatus>::iterator vstatus_iterator;
113 typedef EdgePropertyT<OpenVolumeMeshStatus>::const_iterator const_estatus_iterator;
114 typedef EdgePropertyT<OpenVolumeMeshStatus>::iterator estatus_iterator;
115 typedef HalfEdgePropertyT<OpenVolumeMeshStatus>::const_iterator const_hestatus_iterator;
116 typedef HalfEdgePropertyT<OpenVolumeMeshStatus>::iterator hestatus_iterator;
117 typedef FacePropertyT<OpenVolumeMeshStatus>::const_iterator const_fstatus_iterator;
118 typedef FacePropertyT<OpenVolumeMeshStatus>::iterator fstatus_iterator;
119 typedef HalfFacePropertyT<OpenVolumeMeshStatus>::const_iterator const_hfstatus_iterator;
120 typedef HalfFacePropertyT<OpenVolumeMeshStatus>::iterator hfstatus_iterator;
121 typedef CellPropertyT<OpenVolumeMeshStatus>::const_iterator const_cstatus_iterator;
122 typedef CellPropertyT<OpenVolumeMeshStatus>::iterator cstatus_iterator;
123
124 // Iterator access
125 VertexPropertyT<OpenVolumeMeshStatus>::const_iterator vstatus_begin() const {
126 return v_status_.begin();
127 }
128 VertexPropertyT<OpenVolumeMeshStatus>::iterator vstatus_begin() {
129 return v_status_.begin();
130 }
131 VertexPropertyT<OpenVolumeMeshStatus>::const_iterator vstatus_end() const {
132 return v_status_.end();
133 }
134 VertexPropertyT<OpenVolumeMeshStatus>::iterator vstatus_end() {
135 return v_status_.end();
136 }
137
138 EdgePropertyT<OpenVolumeMeshStatus>::const_iterator estatus_begin() const {
139 return e_status_.begin();
140 }
141 EdgePropertyT<OpenVolumeMeshStatus>::iterator estatus_begin() {
142 return e_status_.begin();
143 }
144 EdgePropertyT<OpenVolumeMeshStatus>::const_iterator estatus_end() const {
145 return e_status_.end();
146 }
147 EdgePropertyT<OpenVolumeMeshStatus>::iterator estatus_end() {
148 return e_status_.end();
149 }
150
151 HalfEdgePropertyT<OpenVolumeMeshStatus>::const_iterator hestatus_begin() const {
152 return he_status_.begin();
153 }
154 HalfEdgePropertyT<OpenVolumeMeshStatus>::iterator hestatus_begin() {
155 return he_status_.begin();
156 }
157 HalfEdgePropertyT<OpenVolumeMeshStatus>::const_iterator hestatus_end() const {
158 return he_status_.end();
159 }
160 HalfEdgePropertyT<OpenVolumeMeshStatus>::iterator hestatus_end() {
161 return he_status_.end();
162 }
163
164 FacePropertyT<OpenVolumeMeshStatus>::const_iterator fstatus_begin() const {
165 return f_status_.begin();
166 }
167 FacePropertyT<OpenVolumeMeshStatus>::iterator fstatus_begin() {
168 return f_status_.begin();
169 }
170 FacePropertyT<OpenVolumeMeshStatus>::const_iterator fstatus_end() const {
171 return f_status_.end();
172 }
173 FacePropertyT<OpenVolumeMeshStatus>::iterator fstatus_end() {
174 return f_status_.end();
175 }
176
177 HalfFacePropertyT<OpenVolumeMeshStatus>::const_iterator hfstatus_begin() const {
178 return hf_status_.begin();
179 }
180 HalfFacePropertyT<OpenVolumeMeshStatus>::iterator hfstatus_begin() {
181 return hf_status_.begin();
182 }
183 HalfFacePropertyT<OpenVolumeMeshStatus>::const_iterator hfstatus_end() const {
184 return hf_status_.end();
185 }
186 HalfFacePropertyT<OpenVolumeMeshStatus>::iterator hfstatus_end() {
187 return hf_status_.end();
188 }
189
190 CellPropertyT<OpenVolumeMeshStatus>::const_iterator cstatus_begin() const {
191 return c_status_.begin();
192 }
193 CellPropertyT<OpenVolumeMeshStatus>::iterator cstatus_begin() {
194 return c_status_.begin();
195 }
196 CellPropertyT<OpenVolumeMeshStatus>::const_iterator cstatus_end() const {
197 return c_status_.end();
198 }
199 CellPropertyT<OpenVolumeMeshStatus>::iterator cstatus_end() {
200 return c_status_.end();
201 }
202
219 void garbage_collection(bool _preserveManifoldness = false);
220
245 template<typename std_API_Container_VHandlePointer,
246 typename std_API_Container_HHandlePointer,
247 typename std_API_Container_HFHandlePointer,
248 typename std_API_Container_CHandlePointer>
249 void garbage_collection(
250 std_API_Container_VHandlePointer& vh_to_update,
251 std_API_Container_HHandlePointer& hh_to_update,
252 std_API_Container_HFHandlePointer& hfh_to_update,
253 std_API_Container_CHandlePointer& ch_to_update,
254 bool _preserveManifoldness = false);
255
256private:
257
258 void mark_higher_dim_entities();
259
260 TopologyKernel* kernel_;
261
269};
270
271} // Namespace OpenVolumeMesh
272
273#include <OpenVolumeMesh/Attribs/StatusAttribT_impl.hh>
Stores statuses like selected, tagged, deleted, hidden.