Reference documentation for deal.II version GIT relicensing-233-g802318d791 2024-03-28 20:20:02+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
tria_objects_orientations.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2023 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_objects_orientations_h
16#define dealii_tria_objects_orientations_h
17
18#include <deal.II/base/config.h>
19
23
25
26#include <vector>
27
29
30namespace internal
31{
32 namespace TriangulationImplementation
33 {
41 {
42 public:
47
52 TriaObjectsOrientations(const unsigned int n_objects);
53
57 unsigned int
58 n_objects() const;
59
63 void
64 reinit(const unsigned int n_objects);
65
70 void
71 resize(const unsigned int n_objects);
72
76 std::size_t
77 memory_consumption() const;
78
83 unsigned char
84 get_combined_orientation(const unsigned int object) const;
85
89 bool
90 get_orientation(const unsigned int object) const;
91
95 bool
96 get_rotation(const unsigned int object) const;
97
101 bool
102 get_flip(const unsigned int object) const;
103
108 void
109 set_combined_orientation(const unsigned int object,
110 const unsigned char value);
111
115 void
116 set_orientation(const unsigned int object, const bool value);
117
121 void
122 set_rotation(const unsigned int object, const bool value);
123
127 void
128 set_flip(const unsigned int object, const bool value);
129
135 template <class Archive>
136 void
137 serialize(Archive &ar, const unsigned int version);
138
139 private:
143 unsigned int n_stored_objects;
144
148 std::vector<unsigned char> flags;
149 };
150
151 //----------------------------------------------------------------------//
152
157
158
159
161 const unsigned int n_objects)
162 {
164 }
165
166
167
168 inline void
169 TriaObjectsOrientations::reinit(const unsigned int n_objects)
170 {
172 // Assign to the default orientation
173 flags.assign(n_objects,
175 }
176
177
178
179 inline void
186
187
188
189 inline std::size_t
195
196
197
198 inline unsigned int
203
204
205
206 inline unsigned char
208 const unsigned int object) const
209 {
211 return flags[object];
212 }
213
214
215
216 inline bool
217 TriaObjectsOrientations::get_orientation(const unsigned int object) const
218 {
220 return Utilities::get_bit(flags[object], 0);
221 }
222
223
224
225 inline bool
226 TriaObjectsOrientations::get_rotation(const unsigned int object) const
227 {
229 return Utilities::get_bit(flags[object], 1);
230 }
231
232
233
234 inline bool
235 TriaObjectsOrientations::get_flip(const unsigned int object) const
236 {
238 return Utilities::get_bit(flags[object], 2);
239 }
240
241
242
243 inline void
245 const unsigned char value)
246 {
248 flags[object] = value;
249 }
250
251
252
253 inline void
255 const bool value)
256 {
258 Utilities::set_bit(flags[object], 0, value);
259 }
260
261
262
263 inline void
264 TriaObjectsOrientations::set_rotation(const unsigned int object,
265 const bool value)
266 {
268 Utilities::set_bit(flags[object], 1, value);
269 }
270
271
272
273 inline void
274 TriaObjectsOrientations::set_flip(const unsigned int object,
275 const bool value)
276 {
278 Utilities::set_bit(flags[object], 2, value);
279 }
280
281
282
283 template <class Archive>
284 void
285 TriaObjectsOrientations::serialize(Archive &ar, const unsigned int)
286 {
288 }
289 } // namespace TriangulationImplementation
290} // namespace internal
291
293
294#endif
static constexpr unsigned char default_combined_face_orientation()
void set_combined_orientation(const unsigned int object, const unsigned char value)
unsigned char get_combined_orientation(const unsigned int object) const
void set_orientation(const unsigned int object, const bool value)
void set_rotation(const unsigned int object, const bool value)
void set_flip(const unsigned int object, const bool value)
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
#define AssertIndexRange(index, range)
std::enable_if_t< std::is_fundamental_v< T >, std::size_t > memory_consumption(const T &t)
bool get_bit(const unsigned char number, const unsigned int n)
Definition utilities.h:1590
void set_bit(unsigned char &number, const unsigned int n, const bool x)
Definition utilities.h:1603