Reference documentation for deal.II version GIT d6cf33b98c 2023-09-22 19:50: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\}}\)
tria_objects_orientations.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2022 - 2023 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_tria_objects_orientations_h
17 #define dealii_tria_objects_orientations_h
18 
19 #include <deal.II/base/config.h>
20 
23 #include <deal.II/base/utilities.h>
24 
26 
27 #include <vector>
28 
30 
31 namespace internal
32 {
33  namespace TriangulationImplementation
34  {
42  {
43  public:
48 
53  TriaObjectsOrientations(const unsigned int n_objects);
54 
58  unsigned int
59  n_objects() const;
60 
64  void
65  reinit(const unsigned int n_objects);
66 
71  void
72  resize(const unsigned int n_objects);
73 
77  std::size_t
78  memory_consumption() const;
79 
84  unsigned char
85  get_combined_orientation(const unsigned int object) const;
86 
90  bool
91  get_orientation(const unsigned int object) const;
92 
96  bool
97  get_rotation(const unsigned int object) const;
98 
102  bool
103  get_flip(const unsigned int object) const;
104 
109  void
110  set_combined_orientation(const unsigned int object,
111  const unsigned char value);
112 
116  void
117  set_orientation(const unsigned int object, const bool value);
118 
122  void
123  set_rotation(const unsigned int object, const bool value);
124 
128  void
129  set_flip(const unsigned int object, const bool value);
130 
136  template <class Archive>
137  void
138  serialize(Archive &ar, const unsigned int version);
139 
140  private:
144  unsigned int n_stored_objects;
145 
149  std::vector<unsigned char> flags;
150  };
151 
152  //----------------------------------------------------------------------//
153 
155  {
156  reinit(0);
157  }
158 
159 
160 
162  const unsigned int n_objects)
163  {
164  reinit(n_objects);
165  }
166 
167 
168 
169  inline void
170  TriaObjectsOrientations::reinit(const unsigned int n_objects)
171  {
173  // Assign to the default orientation
174  flags.assign(n_objects,
176  }
177 
178 
179 
180  inline void
181  TriaObjectsOrientations::resize(const unsigned int n_objects)
182  {
183  flags.resize(n_objects,
186  }
187 
188 
189 
190  inline std::size_t
192  {
195  }
196 
197 
198 
199  inline unsigned int
201  {
202  return n_stored_objects;
203  }
204 
205 
206 
207  inline unsigned char
209  const unsigned int object) const
210  {
212  return flags[object];
213  }
214 
215 
216 
217  inline bool
218  TriaObjectsOrientations::get_orientation(const unsigned int object) const
219  {
221  return Utilities::get_bit(flags[object], 0);
222  }
223 
224 
225 
226  inline bool
227  TriaObjectsOrientations::get_rotation(const unsigned int object) const
228  {
230  return Utilities::get_bit(flags[object], 1);
231  }
232 
233 
234 
235  inline bool
236  TriaObjectsOrientations::get_flip(const unsigned int object) const
237  {
239  return Utilities::get_bit(flags[object], 2);
240  }
241 
242 
243 
244  inline void
246  const unsigned char value)
247  {
249  flags[object] = value;
250  }
251 
252 
253 
254  inline void
255  TriaObjectsOrientations::set_orientation(const unsigned int object,
256  const bool value)
257  {
259  Utilities::set_bit(flags[object], 0, value);
260  }
261 
262 
263 
264  inline void
265  TriaObjectsOrientations::set_rotation(const unsigned int object,
266  const bool value)
267  {
269  Utilities::set_bit(flags[object], 1, value);
270  }
271 
272 
273 
274  inline void
275  TriaObjectsOrientations::set_flip(const unsigned int object,
276  const bool value)
277  {
279  Utilities::set_bit(flags[object], 2, value);
280  }
281 
282 
283 
284  template <class Archive>
285  void
286  TriaObjectsOrientations::serialize(Archive &ar, const unsigned int)
287  {
288  ar &n_stored_objects &flags;
289  }
290  } // namespace TriangulationImplementation
291 } // namespace internal
292 
294 
295 #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:477
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:478
#define AssertIndexRange(index, range)
Definition: exceptions.h:1857
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:1555
void set_bit(unsigned char &number, const unsigned int n, const bool x)
Definition: utilities.h:1568