Reference documentation for deal.II version Git ede8f93e86 2020-12-03 14:59:20 -0700
\(\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.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2006 - 2020 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 
17 
18 #include <deal.II/grid/tria.h>
22 
23 #include <algorithm>
24 #include <functional>
25 
26 
27 
29 
30 namespace internal
31 {
32  namespace TriangulationImplementation
33  {
34  template <int dim, int spacedim>
35  typename ::Triangulation<dim, spacedim>::raw_hex_iterator
36  TriaObjects::next_free_hex(const ::Triangulation<dim, spacedim> &tria,
37  const unsigned int level)
38  {
39  AssertDimension(this->structdim, 3);
40 
41  // TODO: Think of a way to ensure that we are using the correct
42  // triangulation, i.e. the one containing *this.
43 
44  int pos = next_free_pair, last = used.size() - 1;
45  for (; pos < last; ++pos)
46  if (!used[pos])
47  {
48  // this should be a pair slot
49  Assert(!used[pos + 1], ExcInternalError());
50  break;
51  }
52  if (pos >= last)
53  // no free slot
54  return tria.end_hex();
55  else
56  next_free_pair = pos + 2;
57 
58  return
59  typename ::Triangulation<dim, spacedim>::raw_hex_iterator(&tria,
60  level,
61  pos);
62  }
63 
64 
65  std::size_t
67  {
75  user_data.capacity() * sizeof(UserData) + sizeof(user_data));
76  }
77 
78 
79 
80  // explicit instantiations
81 #ifndef DOXYGEN
82 # include "tria_objects.inst"
83 #endif
84  } // namespace TriangulationImplementation
85 } // namespace internal
86 
#define AssertDimension(dim1, dim2)
Definition: exceptions.h:1623
#define Assert(cond, exc)
Definition: exceptions.h:1466
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:372
unsigned int level
Definition: grid_out.cc:4343
std::vector< BoundaryOrMaterialId > boundary_or_material_id
Definition: tria_objects.h:178
std::vector< types::manifold_id > manifold_id
Definition: tria_objects.h:184
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:371
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)
Triangulation< dim, spacedim >::raw_hex_iterator next_free_hex(const Triangulation< dim, spacedim > &tria, const unsigned int level)
static ::ExceptionBase & ExcInternalError()