Developer Documentation
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/OpenVolumeMeshProperty.hh"
49 #include "../Core/OpenVolumeMeshHandle.hh"
50 #include "OpenVolumeMeshStatus.hh"
51 #include "../Core/PropertyDefines.hh"
52 #include "OpenVolumeMesh/Config/Export.hh"
53 
54 namespace OpenVolumeMesh {
55 
56 // Forward declaration
57 class TopologyKernel;
58 
59 class OVM_EXPORT StatusAttrib {
60 public:
61  explicit StatusAttrib(TopologyKernel& _kernel);
62  ~StatusAttrib();
63 
64  const OpenVolumeMeshStatus& operator[](const VertexHandle& _h) const {
65  return v_status_[_h];
66  }
67 
68  OpenVolumeMeshStatus& operator[](const VertexHandle& _h) {
69  return v_status_[_h];
70  }
71 
72  const OpenVolumeMeshStatus& operator[](const EdgeHandle& _h) const {
73  return e_status_[_h];
74  }
75 
76  OpenVolumeMeshStatus& operator[](const EdgeHandle& _h) {
77  return e_status_[_h];
78  }
79 
80  const OpenVolumeMeshStatus& operator[](const HalfEdgeHandle& _h) const {
81  return he_status_[_h];
82  }
83 
84  OpenVolumeMeshStatus& operator[](const HalfEdgeHandle& _h) {
85  return he_status_[_h];
86  }
87 
88  const OpenVolumeMeshStatus& operator[](const FaceHandle& _h) const {
89  return f_status_[_h];
90  }
91 
92  OpenVolumeMeshStatus& operator[](const FaceHandle& _h) {
93  return f_status_[_h];
94  }
95 
96  const OpenVolumeMeshStatus& operator[](const HalfFaceHandle& _h) const {
97  return hf_status_[_h];
98  }
99 
100  OpenVolumeMeshStatus& operator[](const HalfFaceHandle& _h) {
101  return hf_status_[_h];
102  }
103 
104  const OpenVolumeMeshStatus& operator[](const CellHandle& _h) const {
105  return c_status_[_h];
106  }
107 
108  OpenVolumeMeshStatus& operator[](const CellHandle& _h) {
109  return c_status_[_h];
110  }
111 
112  const OpenVolumeMeshStatus& mesh_status() const {
113  MeshHandle h(0);
114  return m_status_[h];
115  }
116 
117  OpenVolumeMeshStatus& mesh_status() {
118  MeshHandle h(0);
119  return m_status_[h];
120  }
121 
122  typedef VertexPropertyT<OpenVolumeMeshStatus>::const_iterator const_vstatus_iterator;
123  typedef VertexPropertyT<OpenVolumeMeshStatus>::iterator vstatus_iterator;
124  typedef EdgePropertyT<OpenVolumeMeshStatus>::const_iterator const_estatus_iterator;
125  typedef EdgePropertyT<OpenVolumeMeshStatus>::iterator estatus_iterator;
126  typedef HalfEdgePropertyT<OpenVolumeMeshStatus>::const_iterator const_hestatus_iterator;
127  typedef HalfEdgePropertyT<OpenVolumeMeshStatus>::iterator hestatus_iterator;
128  typedef FacePropertyT<OpenVolumeMeshStatus>::const_iterator const_fstatus_iterator;
129  typedef FacePropertyT<OpenVolumeMeshStatus>::iterator fstatus_iterator;
130  typedef HalfFacePropertyT<OpenVolumeMeshStatus>::const_iterator const_hfstatus_iterator;
131  typedef HalfFacePropertyT<OpenVolumeMeshStatus>::iterator hfstatus_iterator;
132  typedef CellPropertyT<OpenVolumeMeshStatus>::const_iterator const_cstatus_iterator;
133  typedef CellPropertyT<OpenVolumeMeshStatus>::iterator cstatus_iterator;
134 
135  // Iterator access
136  VertexPropertyT<OpenVolumeMeshStatus>::const_iterator vstatus_begin() const {
137  return v_status_.begin();
138  }
139  VertexPropertyT<OpenVolumeMeshStatus>::iterator vstatus_begin() {
140  return v_status_.begin();
141  }
142  VertexPropertyT<OpenVolumeMeshStatus>::const_iterator vstatus_end() const {
143  return v_status_.end();
144  }
145  VertexPropertyT<OpenVolumeMeshStatus>::iterator vstatus_end() {
146  return v_status_.end();
147  }
148 
149  EdgePropertyT<OpenVolumeMeshStatus>::const_iterator estatus_begin() const {
150  return e_status_.begin();
151  }
152  EdgePropertyT<OpenVolumeMeshStatus>::iterator estatus_begin() {
153  return e_status_.begin();
154  }
155  EdgePropertyT<OpenVolumeMeshStatus>::const_iterator estatus_end() const {
156  return e_status_.end();
157  }
158  EdgePropertyT<OpenVolumeMeshStatus>::iterator estatus_end() {
159  return e_status_.end();
160  }
161 
162  HalfEdgePropertyT<OpenVolumeMeshStatus>::const_iterator hestatus_begin() const {
163  return he_status_.begin();
164  }
165  HalfEdgePropertyT<OpenVolumeMeshStatus>::iterator hestatus_begin() {
166  return he_status_.begin();
167  }
168  HalfEdgePropertyT<OpenVolumeMeshStatus>::const_iterator hestatus_end() const {
169  return he_status_.end();
170  }
171  HalfEdgePropertyT<OpenVolumeMeshStatus>::iterator hestatus_end() {
172  return he_status_.end();
173  }
174 
175  FacePropertyT<OpenVolumeMeshStatus>::const_iterator fstatus_begin() const {
176  return f_status_.begin();
177  }
178  FacePropertyT<OpenVolumeMeshStatus>::iterator fstatus_begin() {
179  return f_status_.begin();
180  }
181  FacePropertyT<OpenVolumeMeshStatus>::const_iterator fstatus_end() const {
182  return f_status_.end();
183  }
184  FacePropertyT<OpenVolumeMeshStatus>::iterator fstatus_end() {
185  return f_status_.end();
186  }
187 
188  HalfFacePropertyT<OpenVolumeMeshStatus>::const_iterator hfstatus_begin() const {
189  return hf_status_.begin();
190  }
191  HalfFacePropertyT<OpenVolumeMeshStatus>::iterator hfstatus_begin() {
192  return hf_status_.begin();
193  }
194  HalfFacePropertyT<OpenVolumeMeshStatus>::const_iterator hfstatus_end() const {
195  return hf_status_.end();
196  }
197  HalfFacePropertyT<OpenVolumeMeshStatus>::iterator hfstatus_end() {
198  return hf_status_.end();
199  }
200 
201  CellPropertyT<OpenVolumeMeshStatus>::const_iterator cstatus_begin() const {
202  return c_status_.begin();
203  }
204  CellPropertyT<OpenVolumeMeshStatus>::iterator cstatus_begin() {
205  return c_status_.begin();
206  }
207  CellPropertyT<OpenVolumeMeshStatus>::const_iterator cstatus_end() const {
208  return c_status_.end();
209  }
210  CellPropertyT<OpenVolumeMeshStatus>::iterator cstatus_end() {
211  return c_status_.end();
212  }
213 
230  void garbage_collection(bool _preserveManifoldness = false);
231 
256  template<typename std_API_Container_VHandlePointer,
257  typename std_API_Container_HHandlePointer,
258  typename std_API_Container_HFHandlePointer,
259  typename std_API_Container_CHandlePointer>
260  void garbage_collection(
261  std_API_Container_VHandlePointer& vh_to_update,
262  std_API_Container_HHandlePointer& hh_to_update,
263  std_API_Container_HFHandlePointer& hfh_to_update,
264  std_API_Container_CHandlePointer& ch_to_update,
265  bool _preserveManifoldness = false);
266 
267 private:
268 
269  void mark_higher_dim_entities();
270 
271  TopologyKernel& kernel_;
272 
280 };
281 
282 } // Namespace OpenVolumeMesh
283 
284 #if defined(INCLUDE_TEMPLATES) && !defined(STATUSATTRIBT_CC)
285 #include "StatusAttribT_impl.hh"
286 #endif
287 
288 #endif /* STATUSATTRIB_HH_ */
Stores statuses like selected, tagged, deleted, hidden.