36template <
class MeshType>
39 : source_grid(
nullptr, typeid(*this).name())
40 , destination_grid(
nullptr, typeid(*this).name())
45template <
class MeshType>
47void
InterGridMap<MeshType>::make_mapping(const MeshType &source_grid,
48 const MeshType &destination_grid)
54 this->source_grid = &source_grid;
55 this->destination_grid = &destination_grid;
59 const unsigned int n_levels = source_grid.get_triangulation().n_levels();
60 mapping.resize(n_levels);
70 unsigned int n_cells = 0;
72 endc = source_grid.end(
level);
73 for (; cell != endc; ++cell)
74 if (
static_cast<unsigned int>(cell->index()) > n_cells)
75 n_cells = cell->index();
80 mapping[
level].resize(n_cells + 1, destination_grid.end());
90 dst_cell = destination_grid.begin(0), endc = source_grid.end(0);
91 for (; src_cell != endc; ++src_cell, ++dst_cell)
92 set_mapping(src_cell, dst_cell);
96 Assert(dst_cell == destination_grid.end(0), ExcIncompatibleGrids());
101template <
class MeshType>
107 mapping[src_cell->level()][src_cell->index()] = dst_cell;
111 if (src_cell->has_children() && dst_cell->has_children())
113 Assert(src_cell->n_children() ==
116 Assert(dst_cell->n_children() ==
119 Assert(src_cell->refinement_case() == dst_cell->refinement_case(),
121 for (
unsigned int c = 0;
122 c < GeometryInfo<MeshType::dimension>::max_children_per_cell;
124 set_mapping(src_cell->child(c), dst_cell->child(c));
126 else if (src_cell->has_children() && !dst_cell->has_children())
131 for (
unsigned int c = 0; c < src_cell->n_children(); ++c)
132 set_entries_to_cell(src_cell->child(c), dst_cell);
140template <
class MeshType>
146 mapping[src_cell->level()][src_cell->index()] = dst_cell;
150 if (src_cell->has_children())
151 for (
unsigned int c = 0; c < src_cell->n_children(); ++c)
152 set_entries_to_cell(src_cell->child(c), dst_cell);
156template <
class MeshType>
162 ExcInvalidKey(source_cell));
163 Assert(source_cell->level() <=
static_cast<int>(mapping.size()),
164 ExcInvalidKey(source_cell));
165 Assert(source_cell->index() <=
166 static_cast<int>(mapping[source_cell->level()].size()),
167 ExcInvalidKey(source_cell));
169 return mapping[source_cell->level()][source_cell->index()];
174template <
class MeshType>
179 source_grid =
nullptr;
180 destination_grid =
nullptr;
185template <
class MeshType>
194template <
class MeshType>
198 return *destination_grid;
203template <
class MeshType>
215#include "intergrid_map.inst"
typename MeshType::cell_iterator cell_iterator
cell_iterator operator[](const cell_iterator &source_cell) const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_CXX20_REQUIRES(condition)
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
@ valid
Iterator points to a valid object.
std::enable_if_t< std::is_fundamental< T >::value, std::size_t > memory_consumption(const T &t)