80 const VectorType &src)
const
82 Assert((to_level >= 1) && (to_level <= prolongation_matrices.size()),
83 ExcIndexRange(to_level, 1, prolongation_matrices.size() + 1));
85 if (this->mg_constrained_dofs !=
nullptr &&
86 this->mg_constrained_dofs->get_user_constraint_matrix(to_level - 1)
90 VectorType copy_src(src);
91 this->mg_constrained_dofs->get_user_constraint_matrix(to_level - 1)
92 .distribute(copy_src);
93 prolongation_matrices[to_level - 1]->vmult(dst, copy_src);
97 prolongation_matrices[to_level - 1]->vmult(dst, src);
153 "The underlying DoFHandler object has not had its "
154 "distribute_mg_dofs() function called, but this is a prerequisite "
155 "for multigrid transfers. You will need to call this function, "
156 "probably close to where you already call distribute_dofs()."));
158 const unsigned int n_levels =
162 this->sizes.resize(n_levels);
163 for (
unsigned int l = 0; l < n_levels; ++l)
164 this->sizes[l] = dof_handler.
n_dofs(l);
176 prolongation_matrices.resize(0);
177 prolongation_sparsities.resize(0);
178 prolongation_matrices.reserve(n_levels - 1);
179 prolongation_sparsities.reserve(n_levels - 1);
181 for (
unsigned int i = 0; i < n_levels - 1; ++i)
183 prolongation_sparsities.emplace_back(
185 prolongation_matrices.emplace_back(
192 std::vector<types::global_dof_index> dof_indices_parent(dofs_per_cell);
193 std::vector<types::global_dof_index> dof_indices_child(dofs_per_cell);
194 std::vector<types::global_dof_index> entries(dofs_per_cell);
210 const IndexSet level_p1_relevant_dofs =
214 level_p1_relevant_dofs);
216 if (cell->has_children() && cell->is_locally_owned_on_level())
218 cell->get_mg_dof_indices(dof_indices_parent);
220 replace(this->mg_constrained_dofs,
level, dof_indices_parent);
222 Assert(cell->n_children() ==
225 for (
unsigned int child = 0; child < cell->n_children(); ++child)
230 child, cell->refinement_case());
232 Assert(prolongation.
n() != 0, ExcNoProlongation());
234 cell->child(child)->get_mg_dof_indices(dof_indices_child);
236 replace(this->mg_constrained_dofs,
243 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
246 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
247 if (prolongation(i, j) != 0)
248 entries.push_back(dof_indices_parent[j]);
256#ifdef DEAL_II_WITH_MPI
258 VectorType>::requires_distributed_sparsity_pattern)
274 *prolongation_matrices[
level],
275 *prolongation_sparsities[
level],
293 if (cell->has_children() && cell->is_locally_owned_on_level())
295 cell->get_mg_dof_indices(dof_indices_parent);
297 replace(this->mg_constrained_dofs,
level, dof_indices_parent);
299 Assert(cell->n_children() ==
302 for (
unsigned int child = 0; child < cell->n_children(); ++child)
306 child, cell->refinement_case());
308 if (this->mg_constrained_dofs !=
nullptr &&
310 for (
unsigned int j = 0; j < dofs_per_cell; ++j)
312 level, dof_indices_parent[j]))
313 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
314 prolongation(i, j) = 0.;
316 cell->child(child)->get_mg_dof_indices(dof_indices_child);
318 replace(this->mg_constrained_dofs,
323 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
324 prolongation_matrices[
level]->
set(dof_indices_child[i],
326 dof_indices_parent.data(),
334 this->fill_and_communicate_copy_indices(dof_handler);