Reference documentation for deal.II version 9.0.0
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 at
12 // the top level of the deal.II distribution.
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 #include <vector>
22 #include <deal.II/grid/tria_object.h>
23 #include <deal.II/base/point.h>
24 #include <deal.II/grid/tria_objects.h>
25 
26 #include <boost/serialization/utility.hpp>
27 
28 #include <cstdint>
29 
30 DEAL_II_NAMESPACE_OPEN
31 
32 namespace internal
33 {
34  namespace TriangulationImplementation
35  {
55  template <int dim>
56  class TriaLevel
57  {
58  public:
67  std::vector<std::uint8_t> refine_flags;
68 
73  std::vector<bool> coarsen_flags;
74 
75 
81  std::vector<unsigned int> active_cell_indices;
82 
116  std::vector<std::pair<int,int> > neighbors;
117 
124  std::vector<types::subdomain_id> subdomain_ids;
125 
129  std::vector<types::subdomain_id> level_subdomain_ids;
130 
140  std::vector<int> parents;
141 
149  std::vector<bool> direction_flags;
150 
155 
156 
168  void reserve_space (const unsigned int total_cells,
169  const unsigned int dimension,
170  const unsigned int space_dimension);
171 
177  void monitor_memory (const unsigned int true_dimension) const;
178 
183  std::size_t memory_consumption () const;
184 
189  template <class Archive>
190  void serialize(Archive &ar,
191  const unsigned int version);
192 
197  int, int,
198  << "The containers have sizes " << arg1 << " and "
199  << arg2 << ", which is not as expected.");
200  };
201 
202 //TODO: Replace TriaObjectsHex to avoid this specialization
203 
209  template <>
210  class TriaLevel<3>
211  {
212  public:
213  std::vector<std::uint8_t> refine_flags;
214  std::vector<bool> coarsen_flags;
215  std::vector<unsigned int> active_cell_indices;
216  std::vector<std::pair<int,int> > neighbors;
217  std::vector<types::subdomain_id> subdomain_ids;
218  std::vector<types::subdomain_id> level_subdomain_ids;
219  std::vector<int> parents;
220 
221  // The following is not used
222  // since we don't support
223  // codim=1 meshes in 3d; only
224  // needed to allow
225  // compilation
226  // TODO[TH]: this is no longer true and might be a bug.
227  std::vector<bool> direction_flags;
228 
230 
231 
232  void reserve_space (const unsigned int total_cells,
233  const unsigned int dimension,
234  const unsigned int space_dimension);
235  void monitor_memory (const unsigned int true_dimension) const;
236  std::size_t memory_consumption () const;
237 
242  template <class Archive>
243  void serialize(Archive &ar,
244  const unsigned int version);
245 
250  int, int,
251  << "The containers have sizes " << arg1 << " and "
252  << arg2 << ", which is not as expected.");
253  };
254 
255 
256 
257  template <int dim>
258  template <class Archive>
259  void TriaLevel<dim>::serialize(Archive &ar,
260  const unsigned int)
261  {
262  ar &refine_flags &coarsen_flags;
263 
264  // do not serialize 'active_cell_indices' here. instead of storing them
265  // to the stream and re-reading them again later, we just rebuild them
266  // in Triangulation::load()
267 
268  ar &neighbors;
269  ar &subdomain_ids;
270  ar &level_subdomain_ids;
271  ar &parents;
272  ar &direction_flags;
273  ar &cells;
274  }
275 
276 
277 
278  template <class Archive>
279  void TriaLevel<3>::serialize(Archive &ar,
280  const unsigned int)
281  {
283 
284  // do not serialize 'active_cell_indices' here. instead of storing them
285  // to the stream and re-reading them again later, we just rebuild them
286  // in Triangulation::load()
287 
288  ar &neighbors;
289  ar &subdomain_ids;
291  ar &parents;
292  ar &direction_flags;
293  ar &cells;
294  }
295 
296  }
297 }
298 
299 
300 
301 DEAL_II_NAMESPACE_CLOSE
302 
303 #endif
TriaObjects< TriaObject< dim > > cells
Definition: tria_levels.h:154
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:358
void serialize(Archive &ar, const unsigned int version)
Definition: tria_levels.h:259
void monitor_memory(const unsigned int true_dimension) const
Definition: tria_levels.cc:90
std::vector< types::subdomain_id > level_subdomain_ids
Definition: tria_levels.h:129
void reserve_space(const unsigned int total_cells, const unsigned int dimension, const unsigned int space_dimension)
Definition: tria_levels.cc:28
std::vector< std::uint8_t > refine_flags
Definition: tria_levels.h:67
std::vector< unsigned int > active_cell_indices
Definition: tria_levels.h:81
std::vector< std::pair< int, int > > neighbors
Definition: tria_levels.h:116
std::vector< types::subdomain_id > subdomain_ids
Definition: tria_levels.h:124
static ::ExceptionBase & ExcMemoryInexact(int arg1, int arg2)