Reference documentation for deal.II version 8.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
tria_levels.h
1 // ---------------------------------------------------------------------
2 // @f$Id: tria_levels.h 30036 2013-07-18 16:55:32Z maier @f$
3 //
4 // Copyright (C) 1998 - 2013 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // The deal.II library is free software; you can use it, redistribute
9 // it, and/or modify it under the terms of the GNU Lesser General
10 // Public License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 // The full text of the license can be found in the file LICENSE at
13 // the top level of the deal.II distribution.
14 //
15 // ---------------------------------------------------------------------
16 
17 #ifndef __deal2__tria_levels_h
18 #define __deal2__tria_levels_h
19 
20 
21 #include <deal.II/base/config.h>
22 #include <vector>
23 #include <deal.II/grid/tria_object.h>
24 #include <deal.II/base/point.h>
25 #include <deal.II/grid/tria_objects.h>
26 
27 #include <boost/serialization/utility.hpp>
28 
29 DEAL_II_NAMESPACE_OPEN
30 
31 namespace internal
32 {
33  namespace Triangulation
34  {
55  template <int dim>
56  class TriaLevel
57  {
58  public:
76  std::vector<unsigned char> refine_flags;
77 
83  std::vector<bool> coarsen_flags;
84 
134  std::vector<std::pair<int,int> > neighbors;
135 
146  std::vector<types::subdomain_id> subdomain_ids;
147 
151  std::vector<types::subdomain_id> level_subdomain_ids;
152 
158  std::vector<int> parents;
159 
170  std::vector<bool> direction_flags;
171 
177 
178 
195  void reserve_space (const unsigned int total_cells,
196  const unsigned int dimension,
197  const unsigned int space_dimension);
198 
207  void monitor_memory (const unsigned int true_dimension) const;
208 
214  std::size_t memory_consumption () const;
215 
220  template <class Archive>
221  void serialize(Archive &ar,
222  const unsigned int version);
223 
227  DeclException3 (ExcMemoryWasted,
228  char *, int, int,
229  << "The container " << arg1 << " contains "
230  << arg2 << " elements, but it`s capacity is "
231  << arg3 << ".");
235  DeclException2 (ExcMemoryInexact,
236  int, int,
237  << "The containers have sizes " << arg1 << " and "
238  << arg2 << ", which is not as expected.");
239  };
240 
241 //TODO: Replace TriaObjectsHex to avoid this specialization
242 
248  template<>
249  class TriaLevel<3>
250  {
251  public:
252  std::vector<unsigned char> refine_flags;
253  std::vector<bool> coarsen_flags;
254  std::vector<std::pair<int,int> > neighbors;
255  std::vector<types::subdomain_id> subdomain_ids;
256  std::vector<types::subdomain_id> level_subdomain_ids;
257  std::vector<int> parents;
258 
259  // The following is not used
260  // since we don't support
261  // codim=1 meshes in 3d; only
262  // needed to allow
263  // compilation
264  // TODO[TH]: this is no longer true and might be a bug.
265  std::vector<bool> direction_flags;
266 
268 
269 
270  void reserve_space (const unsigned int total_cells,
271  const unsigned int dimension,
272  const unsigned int space_dimension);
273  void monitor_memory (const unsigned int true_dimension) const;
274  std::size_t memory_consumption () const;
275 
280  template <class Archive>
281  void serialize(Archive &ar,
282  const unsigned int version);
283 
287  DeclException3 (ExcMemoryWasted,
288  char *, int, int,
289  << "The container " << arg1 << " contains "
290  << arg2 << " elements, but it`s capacity is "
291  << arg3 << ".");
295  DeclException2 (ExcMemoryInexact,
296  int, int,
297  << "The containers have sizes " << arg1 << " and "
298  << arg2 << ", which is not as expected.");
299  };
300 
301 
302 
303  template <int dim>
304  template <class Archive>
305  void TriaLevel<dim>::serialize(Archive &ar,
306  const unsigned int)
307  {
308  ar &refine_flags &coarsen_flags;
309  ar &neighbors;
310  ar &subdomain_ids;
311  ar &level_subdomain_ids;
312  ar &parents;
313  ar &direction_flags;
314  ar &cells;
315  }
316 
317 
318 
319  template <class Archive>
320  void TriaLevel<3>::serialize(Archive &ar,
321  const unsigned int)
322  {
324  ar &neighbors;
325  ar &subdomain_ids;
327  ar &parents;
328  ar &direction_flags;
329  ar &cells;
330  }
331 
332  }
333 }
334 
335 
336 
337 DEAL_II_NAMESPACE_CLOSE
338 
339 #endif
std::size_t memory_consumption() const
std::vector< bool > direction_flags
Definition: tria_levels.h:170
std::vector< unsigned char > refine_flags
Definition: tria_levels.h:76
std::vector< bool > coarsen_flags
Definition: tria_levels.h:83
void serialize(Archive &ar, const unsigned int version)
Definition: tria_levels.h:305
std::vector< types::subdomain_id > subdomain_ids
Definition: tria_levels.h:146
void monitor_memory(const unsigned int true_dimension) const
std::vector< std::pair< int, int > > neighbors
Definition: tria_levels.h:134
DeclException3(ExcMemoryWasted, char *, int, int,<< "The container "<< arg1<< " contains "<< arg2<< " elements, but it`s capacity is "<< arg3<< ".")
std::vector< types::subdomain_id > level_subdomain_ids
Definition: tria_levels.h:151
void reserve_space(const unsigned int total_cells, const unsigned int dimension, const unsigned int space_dimension)
DeclException2(ExcMemoryInexact, int, int,<< "The containers have sizes "<< arg1<< " and "<< arg2<< ", which is not as expected.")
TriaObjects< TriaObject< dim > > cells
Definition: tria_levels.h:176