From 537baa0969be104465307613a3a882d5cd133010 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Sat, 22 May 2021 15:05:11 +0200 Subject: [PATCH] Extend test --- .../multigrid_p_02.cc | 27 ++++++++++++------- .../multigrid_util.h | 4 ++- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/tests/multigrid-global-coarsening/multigrid_p_02.cc b/tests/multigrid-global-coarsening/multigrid_p_02.cc index 3bdfca8875..2a3b197cff 100644 --- a/tests/multigrid-global-coarsening/multigrid_p_02.cc +++ b/tests/multigrid-global-coarsening/multigrid_p_02.cc @@ -72,17 +72,24 @@ test(const unsigned int n_refinements, const unsigned int fe_degree_fine) dof_handler.distribute_mg_dofs(); // set up constraints - IndexSet locally_relevant_dofs; - DoFTools::extract_locally_relevant_dofs(dof_handler, - locally_relevant_dofs); - constraint.reinit(locally_relevant_dofs); - VectorTools::interpolate_boundary_values( - *mapping, dof_handler, 0, Functions::ZeroFunction(), constraint); - DoFTools::make_hanging_node_constraints(dof_handler, constraint); + std::set dirichlet_boundary; + dirichlet_boundary.insert(0); + MGConstrainedDoFs mg_constrained_dofs; + mg_constrained_dofs.initialize(dof_handler); + mg_constrained_dofs.make_zero_boundary_constraints(dof_handler, + dirichlet_boundary); + + IndexSet relevant_dofs; + DoFTools::extract_locally_relevant_level_dofs(dof_handler, + 0 /*level*/, + relevant_dofs); + constraint.reinit(relevant_dofs); + constraint.add_lines( + mg_constrained_dofs.get_boundary_indices(0 /*level*/)); constraint.close(); // set up operator - op.reinit(*mapping, dof_handler, *quad, constraint); + op.reinit(*mapping, dof_handler, *quad, constraint, 0 /*level*/); } // set up transfer operator @@ -91,8 +98,8 @@ test(const unsigned int n_refinements, const unsigned int fe_degree_fine) dof_handlers[l], constraints[l + 1], constraints[l], - 0, - 0); + 0 /*level*/, + 0 /*level*/); MGTransferGlobalCoarsening transfer( transfers, diff --git a/tests/multigrid-global-coarsening/multigrid_util.h b/tests/multigrid-global-coarsening/multigrid_util.h index 91f56af076..a4168d07da 100644 --- a/tests/multigrid-global-coarsening/multigrid_util.h +++ b/tests/multigrid-global-coarsening/multigrid_util.h @@ -73,7 +73,8 @@ public: reinit(const Mapping & mapping, const DoFHandler & dof_handler, const Quadrature & quad, - const AffineConstraints &constraints) + const AffineConstraints &constraints, + const unsigned int mg_level = numbers::invalid_unsigned_int) { // Clear internal data structures (if operator is reused). this->system_matrix.clear(); @@ -87,6 +88,7 @@ public: // functions so that we only need to set the flag `update_gradients`. typename MatrixFree::AdditionalData data; data.mapping_update_flags = update_gradients; + data.mg_level = mg_level; matrix_free.reinit(mapping, dof_handler, constraints, quad, data); } -- 2.39.5