Debian Codegraph @

include/deal.II/grid/tria_iterator_selector.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2004 - 2024 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // Part of the source code is dual licensed under Apache-2.0 WITH
9 // LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10 // governing the source code and code contributions can be found in
11 // LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12 //
13 // ------------------------------------------------------------------------
14
15 #ifndef dealii_tria_iterator_selector_h
16 #define dealii_tria_iterator_selector_h
17
18
19 #include <deal.II/base/config.h>
20
21 DEAL_II_NAMESPACE_OPEN
22
23 // Forward declarations
24 #ifndef DOXYGEN
25 template <int dim, int spacedim>
26 class CellAccessor;
27 template <int, int, int>
28 class InvalidAccessor;
29 template <int, int, int>
30 class TriaAccessor;
31 template <int dim, int spacedim>
32 class TriaAccessor<0, dim, spacedim>;
33 template <typename Accessor>
34 class TriaRawIterator;
35 template <typename Accessor>
36 class TriaIterator;
37 template <typename Accessor>
38 class TriaActiveIterator;
39 #endif
40
41 namespace internal
42 {
43 namespace TriangulationImplementation
44 {
45 template <int dim, int spacedim>
46 struct Iterators;
47
48 /**
49 * This class implements some types which differ between the dimensions.
50 * These are the declarations for the 1d case only. See the
51 * @ref Iterators
52 * topic for more information.
53 *
54 * A @p line_iterator is aliased to an iterator operating on the @p
55 * lines member variable of a <tt>Triangulation<1></tt> object. An @p
56 * active_line_iterator only operates on the active lines. @p
57 * raw_line_iterator objects operate on all lines, used or not.
58 *
59 * Since we are in one dimension, the following identities are declared:
60 * @code
61 * using raw_cell_iterator = raw_line_iterator;
62 * using cell_iterator = line_iterator;
63 * using active_cell_iterator = active_line_iterator;
64 * @endcode
65 *
66 * To enable the declaration of @p begin_quad and the like in
67 * <tt>Triangulation<1></tt>, the @p quad_iterators are declared as
68 * iterators over InvalidAccessor. Thus these types exist, but are useless
69 * and will certainly make any involuntary use visible. The same holds for
70 * hexahedron iterators.
71 *
72 * The same applies for the @p face_iterator types, since lines have no
73 * substructures apart from vertices, which are handled in a different
74 * way, however.
75 */
76 template <int spacedim>
77 struct Iterators<1, spacedim>
78 {
79 using raw_line_iterator =
80 TriaRawIterator<dealii::CellAccessor<1, spacedim>>;
81 using line_iterator = TriaIterator<dealii::CellAccessor<1, spacedim>>;
82 using active_line_iterator =
83 TriaActiveIterator<dealii::CellAccessor<1, spacedim>>;
84
85 using raw_quad_iterator =
86 TriaRawIterator<dealii::InvalidAccessor<2, 1, spacedim>>;
87 using quad_iterator =
88 TriaIterator<dealii::InvalidAccessor<2, 1, spacedim>>;
89 using active_quad_iterator =
90 TriaActiveIterator<dealii::InvalidAccessor<2, 1, spacedim>>;
91
92 using raw_hex_iterator =
93 TriaRawIterator<dealii::InvalidAccessor<3, 1, spacedim>>;
94 using hex_iterator =
95 TriaIterator<dealii::InvalidAccessor<3, 1, spacedim>>;
96 using active_hex_iterator =
97 TriaActiveIterator<dealii::InvalidAccessor<3, 1, spacedim>>;
98 };
99
100
101
102 /**
103 * This class implements some types which differ between the dimensions.
104 * These are the declarations for the 2d case only. See the
105 * @ref Iterators
106 * topic for more information.
107 *
108 * A @p line_iterator is aliased to an iterator operating on the @p
109 * lines member variable of a <tt>Triangulation<2></tt> object. An @p
110 * active_line_iterator only operates on the active lines. @p
111 * raw_line_iterator objects operate on all lines, used or not. Using @p
112 * active_line_iterators may not be particularly in 2d useful since it
113 * only operates on unrefined lines. However, also refined lines may bound
114 * unrefined cells if the neighboring cell is refined once more than the
115 * present one.
116 *
117 * Similarly to line iterators, @p quad_iterator, @p raw_quad_iterator and
118 * @p active_quad_iterator are declared.
119 *
120 * To enable the declaration of @p begin_hex and the like in
121 * <tt>Triangulation<[12]></tt>, the @p hex_iterators are declared as
122 * iterators over InvalidAccessor. Thus these types exist, but are useless
123 * and will certainly make any involuntary use visible.
124 *
125 * Since we are in two dimension, the following identities are declared:
126 * @code
127 * using raw_cell_iterator = raw_quad_iterator;
128 * using cell_iterator = quad_iterator;
129 * using active_cell_iterator = active_quad_iterator;
130 *
131 * using raw_face_iterator = raw_line_iterator;
132 * using face_iterator = line_iterator;
133 * using active_face_iterator = active_line_iterator;
134 * @endcode
135 */
136 template <int spacedim>
137 struct Iterators<2, spacedim>
138 {
139 using raw_line_iterator =
140 TriaRawIterator<dealii::TriaAccessor<1, 2, spacedim>>;
141 using line_iterator = TriaIterator<dealii::TriaAccessor<1, 2, spacedim>>;
142 using active_line_iterator =
143 TriaActiveIterator<dealii::TriaAccessor<1, 2, spacedim>>;
144
145 using raw_quad_iterator =
146 TriaRawIterator<dealii::CellAccessor<2, spacedim>>;
147 using quad_iterator = TriaIterator<dealii::CellAccessor<2, spacedim>>;
148 using active_quad_iterator =
149 TriaActiveIterator<dealii::CellAccessor<2, spacedim>>;
150
151 using raw_hex_iterator =
152 TriaRawIterator<dealii::InvalidAccessor<3, 2, spacedim>>;
153 using hex_iterator =
154 TriaIterator<dealii::InvalidAccessor<3, 2, spacedim>>;
155 using active_hex_iterator =
156 TriaActiveIterator<dealii::InvalidAccessor<3, 2, spacedim>>;
157 };
158
159
160 /**
161 * This class implements some types which differ between the dimensions.
162 * These are the declarations for the 3d case only. See the
163 * @ref Iterators
164 * topic for more information.
165 *
166 * For the declarations of the data types, more or less the same holds as
167 * for lower dimensions (see <tt>Iterators<[12]></tt>). The dimension
168 * specific data types are here, since we are in three dimensions:
169 * @code
170 * using raw_cell_iterator = raw_hex_iterator;
171 * using cell_iterator = hex_iterator;
172 * using active_cell_iterator = active_hex_iterator;
173 *
174 * using raw_face_iterator = raw_quad_iterator;
175 * using face_iterator = quad_iterator;
176 * using active_face_iterator = active_quad_iterator;
177 * @endcode
178 */
179 template <int spacedim>
180 struct Iterators<3, spacedim>
181 {
182 using raw_line_iterator =
183 TriaRawIterator<dealii::TriaAccessor<1, 3, spacedim>>;
184 using line_iterator = TriaIterator<dealii::TriaAccessor<1, 3, spacedim>>;
185 using active_line_iterator =
186 TriaActiveIterator<dealii::TriaAccessor<1, 3, spacedim>>;
187
188 using raw_quad_iterator =
189 TriaRawIterator<dealii::TriaAccessor<2, 3, spacedim>>;
190 using quad_iterator = TriaIterator<dealii::TriaAccessor<2, 3, spacedim>>;
191 using active_quad_iterator =
192 TriaActiveIterator<dealii::TriaAccessor<2, 3, spacedim>>;
193
194 using raw_hex_iterator =
195 TriaRawIterator<dealii::CellAccessor<3, spacedim>>;
196 using hex_iterator = TriaIterator<dealii::CellAccessor<3, spacedim>>;
197 using active_hex_iterator =
198 TriaActiveIterator<dealii::CellAccessor<3, spacedim>>;
199 };
200
201 } // namespace TriangulationImplementation
202
203 } // namespace internal
204
205 DEAL_II_NAMESPACE_CLOSE
206
207 #endif // dealii_tria_iterator_selector_h