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