36 template <
class MeshType>
38 : source_grid(nullptr, typeid(*this).name())
39 , destination_grid(nullptr, typeid(*this).name())
44 template <
class MeshType>
47 const MeshType &destination_grid)
53 this->source_grid = &source_grid;
54 this->destination_grid = &destination_grid;
58 const unsigned int n_levels = source_grid.get_triangulation().n_levels();
59 mapping.resize(n_levels);
71 endc = source_grid.end(
level);
72 for (; cell != endc; ++cell)
73 if (
static_cast<unsigned int>(cell->index()) >
n_cells)
79 mapping[
level].resize(
n_cells + 1, destination_grid.end());
89 dst_cell = destination_grid.begin(0), endc = source_grid.end(0);
90 for (; src_cell != endc; ++src_cell, ++dst_cell)
91 set_mapping(src_cell, dst_cell);
95 Assert(dst_cell == destination_grid.end(0), ExcIncompatibleGrids());
100 template <
class MeshType>
106 mapping[src_cell->level()][src_cell->index()] = dst_cell;
110 if (src_cell->has_children() && dst_cell->has_children())
112 Assert(src_cell->n_children() ==
115 Assert(dst_cell->n_children() ==
118 Assert(src_cell->refinement_case() == dst_cell->refinement_case(),
120 for (
unsigned int c = 0;
121 c < GeometryInfo<MeshType::dimension>::max_children_per_cell;
123 set_mapping(src_cell->child(c), dst_cell->child(c));
125 else if (src_cell->has_children() && !dst_cell->has_children())
130 for (
unsigned int c = 0; c < src_cell->n_children(); ++c)
131 set_entries_to_cell(src_cell->child(c), dst_cell);
139 template <
class MeshType>
145 mapping[src_cell->level()][src_cell->index()] = dst_cell;
149 if (src_cell->has_children())
150 for (
unsigned int c = 0; c < src_cell->n_children(); ++c)
151 set_entries_to_cell(src_cell->child(c), dst_cell);
155 template <
class MeshType>
160 ExcInvalidKey(source_cell));
161 Assert(source_cell->level() <=
static_cast<int>(mapping.size()),
162 ExcInvalidKey(source_cell));
163 Assert(source_cell->index() <=
164 static_cast<int>(mapping[source_cell->level()].size()),
165 ExcInvalidKey(source_cell));
167 return mapping[source_cell->level()][source_cell->index()];
172 template <
class MeshType>
177 source_grid =
nullptr;
178 destination_grid =
nullptr;
183 template <
class MeshType>
192 template <
class MeshType>
196 return *destination_grid;
201 template <
class MeshType>
213 #include "intergrid_map.inst"