Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
tria_levels.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1998 - 2018 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_levels_h
17 #define dealii_tria_levels_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #include <deal.II/base/point.h>
23 
24 #include <deal.II/grid/tria_object.h>
25 #include <deal.II/grid/tria_objects.h>
26 
27 #include <boost/serialization/utility.hpp>
28 
29 #include <cstdint>
30 #include <vector>
31 
32 DEAL_II_NAMESPACE_OPEN
33 
34 namespace internal
35 {
36  namespace TriangulationImplementation
37  {
57  template <int dim>
58  class TriaLevel
59  {
60  public:
69  std::vector<std::uint8_t> refine_flags;
70 
75  std::vector<bool> coarsen_flags;
76 
77 
83  std::vector<unsigned int> active_cell_indices;
84 
118  std::vector<std::pair<int, int>> neighbors;
119 
126  std::vector<types::subdomain_id> subdomain_ids;
127 
131  std::vector<types::subdomain_id> level_subdomain_ids;
132 
142  std::vector<int> parents;
143 
151  std::vector<bool> direction_flags;
152 
157 
158 
170  void
171  reserve_space(const unsigned int total_cells,
172  const unsigned int dimension,
173  const unsigned int space_dimension);
174 
180  void
181  monitor_memory(const unsigned int true_dimension) const;
182 
187  std::size_t
188  memory_consumption() const;
189 
194  template <class Archive>
195  void
196  serialize(Archive &ar, const unsigned int version);
197 
202  int,
203  int,
204  << "The containers have sizes " << arg1 << " and " << arg2
205  << ", which is not as expected.");
206  };
207 
208  // TODO: Replace TriaObjectsHex to avoid this specialization
209 
215  template <>
216  class TriaLevel<3>
217  {
218  public:
219  std::vector<std::uint8_t> refine_flags;
220  std::vector<bool> coarsen_flags;
221  std::vector<unsigned int> active_cell_indices;
222  std::vector<std::pair<int, int>> neighbors;
223  std::vector<types::subdomain_id> subdomain_ids;
224  std::vector<types::subdomain_id> level_subdomain_ids;
225  std::vector<int> parents;
226 
227  // The following is not used
228  // since we don't support
229  // codim=1 meshes in 3d; only
230  // needed to allow
231  // compilation
232  // TODO[TH]: this is no longer true and might be a bug.
233  std::vector<bool> direction_flags;
234 
236 
237 
238  void
239  reserve_space(const unsigned int total_cells,
240  const unsigned int dimension,
241  const unsigned int space_dimension);
242  void
243  monitor_memory(const unsigned int true_dimension) const;
244  std::size_t
245  memory_consumption() const;
246 
251  template <class Archive>
252  void
253  serialize(Archive &ar, const unsigned int version);
254 
259  int,
260  int,
261  << "The containers have sizes " << arg1 << " and " << arg2
262  << ", which is not as expected.");
263  };
264 
265 
266 
267  template <int dim>
268  template <class Archive>
269  void
270  TriaLevel<dim>::serialize(Archive &ar, const unsigned int)
271  {
272  ar &refine_flags &coarsen_flags;
273 
274  // do not serialize 'active_cell_indices' here. instead of storing them
275  // to the stream and re-reading them again later, we just rebuild them
276  // in Triangulation::load()
277 
278  ar &neighbors;
279  ar &subdomain_ids;
280  ar &level_subdomain_ids;
281  ar &parents;
282  ar &direction_flags;
283  ar &cells;
284  }
285 
286 
287 
288  template <class Archive>
289  void
290  TriaLevel<3>::serialize(Archive &ar, const unsigned int)
291  {
293 
294  // do not serialize 'active_cell_indices' here. instead of storing them
295  // to the stream and re-reading them again later, we just rebuild them
296  // in Triangulation::load()
297 
298  ar &neighbors;
299  ar &subdomain_ids;
301  ar &parents;
302  ar &direction_flags;
303  ar &cells;
304  }
305 
306  } // namespace TriangulationImplementation
307 } // namespace internal
308 
309 
310 
311 DEAL_II_NAMESPACE_CLOSE
312 
313 #endif
TriaObjects< TriaObject< dim > > cells
Definition: tria_levels.h:156
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:541
void serialize(Archive &ar, const unsigned int version)
Definition: tria_levels.h:270
void monitor_memory(const unsigned int true_dimension) const
Definition: tria_levels.cc:91
std::vector< std::pair< int, int > > neighbors
Definition: tria_levels.h:118
std::vector< types::subdomain_id > level_subdomain_ids
Definition: tria_levels.h:131
void reserve_space(const unsigned int total_cells, const unsigned int dimension, const unsigned int space_dimension)
Definition: tria_levels.cc:29
std::vector< std::uint8_t > refine_flags
Definition: tria_levels.h:69
std::vector< unsigned int > active_cell_indices
Definition: tria_levels.h:83
std::vector< types::subdomain_id > subdomain_ids
Definition: tria_levels.h:126
static ::ExceptionBase & ExcMemoryInexact(int arg1, int arg2)