OpenVolumeMesh
 All Classes Functions Variables Typedefs 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: 198 $ *
38  * $Date: 2012-05-16 12:52:10 +0200 (Wed, 16 May 2012) $ *
39  * $LastChangedBy: kremer $ *
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
135  return v_status_.begin();
136  }
138  return v_status_.begin();
139  }
141  return v_status_.end();
142  }
144  return v_status_.end();
145  }
146 
148  return e_status_.begin();
149  }
151  return e_status_.begin();
152  }
154  return e_status_.end();
155  }
157  return e_status_.end();
158  }
159 
161  return he_status_.begin();
162  }
164  return he_status_.begin();
165  }
167  return he_status_.end();
168  }
170  return he_status_.end();
171  }
172 
174  return f_status_.begin();
175  }
177  return f_status_.begin();
178  }
180  return f_status_.end();
181  }
183  return f_status_.end();
184  }
185 
187  return hf_status_.begin();
188  }
190  return hf_status_.begin();
191  }
193  return hf_status_.end();
194  }
196  return hf_status_.end();
197  }
198 
200  return c_status_.begin();
201  }
203  return c_status_.begin();
204  }
206  return c_status_.end();
207  }
209  return c_status_.end();
210  }
211 
228  void garbage_collection(bool _preserveManifoldness = false);
229 
230 private:
231 
232  void mark_higher_dim_entities();
233 
234  TopologyKernel& kernel_;
235 
243 };
244 
245 } // Namespace OpenVolumeMesh
246 
247 #endif /* STATUSATTRIB_HH_ */