Developer Documentation
HexahedralMeshIterators.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
37#include <OpenVolumeMesh/Core/Iterators.hh>
38#include <OpenVolumeMesh/Config/Export.hh>
39
40namespace OpenVolumeMesh {
41
43
44
45class OVM_EXPORT CellSheetCellIter : public BaseCirculator<CellHandle, CellHandle> {
46private:
48public:
49 CellSheetCellIter(const CellHandle& _ref_h, const unsigned char _orthDir,
50 const HexahedralMeshTopologyKernel* _mesh, int _max_laps = 1);
51
52 // Post increment/decrement operator
53 CellSheetCellIter operator++(int) {
54 CellSheetCellIter cpy = *this;
55 ++(*this);
56 return cpy;
57 }
58 CellSheetCellIter operator--(int) {
59 CellSheetCellIter cpy = *this;
60 --(*this);
61 return cpy;
62 }
63 CellSheetCellIter operator+(int _n) {
64 CellSheetCellIter cpy = *this;
65 for(int i = 0; i < _n; ++i) {
66 ++cpy;
67 }
68 return cpy;
69 }
70 CellSheetCellIter operator-(int _n) {
71 CellSheetCellIter cpy = *this;
72 for(int i = 0; i < _n; ++i) {
73 --cpy;
74 }
75 return cpy;
76 }
77 CellSheetCellIter& operator+=(int _n) {
78 for(int i = 0; i < _n; ++i) {
79 ++(*this);
80 }
81 return *this;
82 }
83 CellSheetCellIter& operator-=(int _n) {
84 for(int i = 0; i < _n; ++i) {
85 --(*this);
86 }
87 return *this;
88 }
89
90 CellSheetCellIter& operator++();
91 CellSheetCellIter& operator--();
92
93private:
94 std::vector<CellHandle> neighb_sheet_cell_hs_;
95 size_t cur_index_;
96};
97
98
99class OVM_EXPORT HalfFaceSheetHalfFaceIter : public BaseCirculator<HalfFaceHandle,HalfFaceHandle> {
100private:
102public:
104 const HexahedralMeshTopologyKernel* _mesh, int _max_laps = 1);
105
106 // Post increment/decrement operator
107 HalfFaceSheetHalfFaceIter operator++(int) {
108 HalfFaceSheetHalfFaceIter cpy = *this;
109 ++(*this);
110 return cpy;
111 }
112 HalfFaceSheetHalfFaceIter operator--(int) {
113 HalfFaceSheetHalfFaceIter cpy = *this;
114 --(*this);
115 return cpy;
116 }
117 HalfFaceSheetHalfFaceIter operator+(int _n) {
118 HalfFaceSheetHalfFaceIter cpy = *this;
119 for(int i = 0; i < _n; ++i) {
120 ++cpy;
121 }
122 return cpy;
123 }
124 HalfFaceSheetHalfFaceIter operator-(int _n) {
125 HalfFaceSheetHalfFaceIter cpy = *this;
126 for(int i = 0; i < _n; ++i) {
127 --cpy;
128 }
129 return cpy;
130 }
131 HalfFaceSheetHalfFaceIter& operator+=(int _n) {
132 for(int i = 0; i < _n; ++i) {
133 ++(*this);
134 }
135 return *this;
136 }
137 HalfFaceSheetHalfFaceIter& operator-=(int _n) {
138 for(int i = 0; i < _n; ++i) {
139 --(*this);
140 }
141 return *this;
142 }
143
144 HalfFaceSheetHalfFaceIter& operator++();
145 HalfFaceSheetHalfFaceIter& operator--();
146
147 const EdgeHandle& common_edge() const { return common_edges_[cur_index_]; }
148
149private:
150 std::vector<HalfFaceHandle> adjacent_halffaces_;
151 std::vector<EdgeHandle> common_edges_;
152 size_t cur_index_;
153};
154
169class OVM_EXPORT HexVertexIter : public BaseCirculator<CellHandle,
170 VertexHandle> {
171private:
174public:
175 HexVertexIter(const CellHandle& _ref_h,
176 const HexahedralMeshTopologyKernel* _mesh,
177 int _max_laps = 1);
178
179 // Post increment/decrement operator
180 HexVertexIter operator++(int) {
181 HexVertexIter cpy = *this;
182 ++(*this);
183 return cpy;
184 }
185 HexVertexIter operator--(int) {
186 HexVertexIter cpy = *this;
187 --(*this);
188 return cpy;
189 }
190 HexVertexIter operator+(int _n) {
191 HexVertexIter cpy = *this;
192 for(int i = 0; i < _n; ++i) {
193 ++cpy;
194 }
195 return cpy;
196 }
197 HexVertexIter operator-(int _n) {
198 HexVertexIter cpy = *this;
199 for(int i = 0; i < _n; ++i) {
200 --cpy;
201 }
202 return cpy;
203 }
204 HexVertexIter& operator+=(int _n) {
205 for(int i = 0; i < _n; ++i) {
206 ++(*this);
207 }
208 return *this;
209 }
210 HexVertexIter& operator-=(int _n) {
211 for(int i = 0; i < _n; ++i) {
212 --(*this);
213 }
214 return *this;
215 }
216
217 HexVertexIter& operator++();
218 HexVertexIter& operator--();
219
220private:
221 std::vector<VertexHandle> vertices_;
222 size_t cur_index_;
223};
224
225} // Namespace OpenVolumeMesh
226
Iterate over all vertices of a hexahedron in a specific order.
A data structure basing on PolyhedralMesh with specializations for hexahedra.