From bba727d258f650d591344fb2a17702f07d120b80 Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Fri, 13 Sep 2024 16:24:04 +0200 Subject: [PATCH] Generalize MGTransferMF so that it works for FE_DGP --- doc/news/changes/minor/20240924Munch | 3 + .../multigrid/mg_transfer_global_coarsening.h | 6 +- .../mg_transfer_global_coarsening.templates.h | 41 +++- .../mg_transfer_a_07.cc | 190 ++++++++++++++++++ ...nsfer_a_07.with_p4est=true.mpirun=1.output | 135 +++++++++++++ .../mg_transfer_util.h | 13 ++ 6 files changed, 374 insertions(+), 14 deletions(-) create mode 100644 doc/news/changes/minor/20240924Munch create mode 100644 tests/multigrid-global-coarsening/mg_transfer_a_07.cc create mode 100644 tests/multigrid-global-coarsening/mg_transfer_a_07.with_p4est=true.mpirun=1.output diff --git a/doc/news/changes/minor/20240924Munch b/doc/news/changes/minor/20240924Munch new file mode 100644 index 0000000000..825b6a79f5 --- /dev/null +++ b/doc/news/changes/minor/20240924Munch @@ -0,0 +1,3 @@ +Improved: MGTransferMF now also supports FE_DGP. +
+(Peter Munch, Nils Margenberg, 2024/09/24) diff --git a/include/deal.II/multigrid/mg_transfer_global_coarsening.h b/include/deal.II/multigrid/mg_transfer_global_coarsening.h index b12a18b58c..a1104f2bb2 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.h @@ -978,9 +978,9 @@ private: * refined meshes. * * This class currently only works for the tensor-product finite elements - * FE_Q and FE_DGQ and simplex elements FE_SimplexP and FE_SimplexDGP as well as - * for systems involving multiple components of one of these elements. Other - * elements are currently not implemented. + * FE_Q, FE_DGQ, and FE_DGP and simplex elements FE_SimplexP and FE_SimplexDGP + * as well as for systems involving multiple components of one of these + * elements. Other elements are currently not implemented. * * The implementation of this class is explained in detail in @cite munch2022gc. */ diff --git a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h index 078cfd8c57..87b04c4f31 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -1466,6 +1466,20 @@ namespace internal + template + bool + fe_has_tp_structure(const FiniteElement &fe) + { + return fe.n_base_elements() == 1 && + ((dynamic_cast *>(&fe.base_element(0)) != nullptr) || + (dynamic_cast *>(&fe.base_element(0)) != + nullptr) || + (dynamic_cast *>(&fe.base_element(0)) != + nullptr)); + } + + + class MGTwoLevelTransferImplementation { /** @@ -1767,6 +1781,8 @@ namespace internal ((dynamic_cast *>( &fe_fine.base_element(0)) != nullptr)); + const bool has_tp_structure = fe_has_tp_structure(fe_fine); + for (auto &scheme : transfer.schemes) { // number of dofs on coarse and fine cells @@ -1836,7 +1852,7 @@ namespace internal const auto cell_local_children_indices = - (reference_cell == ReferenceCells::get_hypercube()) ? + (has_tp_structure) ? get_child_offsets(transfer.schemes[0].n_dofs_per_cell_coarse, is_feq ? fe_fine.degree : (fe_fine.degree + 1), fe_fine.degree) : @@ -1870,7 +1886,7 @@ namespace internal // ---------------------- lexicographic_numbering ---------------------- std::vector lexicographic_numbering_fine; std::vector lexicographic_numbering_coarse; - if (reference_cell == ReferenceCells::get_hypercube()) + if (has_tp_structure) { const Quadrature<1> dummy_quadrature( std::vector>(1, Point<1>())); @@ -2031,7 +2047,7 @@ namespace internal transfer_scheme_index < transfer.schemes.size(); ++transfer_scheme_index) { - if (reference_cell == ReferenceCells::get_hypercube()) + if (has_tp_structure) { const auto fe = create_1D_fe(fe_fine.base_element(0)); @@ -2173,15 +2189,15 @@ namespace internal AssertDimension(fe_fine.n_base_elements(), 1); AssertDimension(fe_coarse.n_base_elements(), 1); + const bool has_tp_structure = fe_has_tp_structure(fe_fine); + const FiniteElement &fe_fine_scalar = fe_fine.base_element(0); const FiniteElement &fe_coarse_scalar = fe_coarse.base_element(0); - const auto reference_cell = fe_fine.reference_cell(); - - Assert(reference_cell == fe_coarse.reference_cell(), ExcNotImplemented()); + Assert(fe_fine.reference_cell() == fe_coarse.reference_cell(), + ExcNotImplemented()); - if (reference_cell == ReferenceCells::get_hypercube() && - (fe_coarse != fe_fine) && + if (has_tp_structure && (fe_coarse != fe_fine) && (fe_coarse.n_dofs_per_cell() != 0 && fe_fine.n_dofs_per_cell() != 0)) { const auto fe_fine_1d = create_1D_fe(fe_fine_scalar); @@ -2242,8 +2258,7 @@ namespace internal scheme.restriction_matrix[k] = matrix(renumbering_coarse[i], renumbering_fine[j]); } - else if (reference_cell != ReferenceCells::get_hypercube() && - (fe_fine != fe_coarse) && + else if ((!has_tp_structure) && (fe_fine != fe_coarse) && (fe_fine.n_dofs_per_cell() != 0 && fe_coarse.n_dofs_per_cell() != 0)) { @@ -2363,6 +2378,10 @@ namespace internal &fe.base_element(0)) != nullptr); }); + const bool has_tp_structure = + std::all_of(dof_handler_fine.get_fe_collection().begin(), + dof_handler_fine.get_fe_collection().end(), + [](const auto &fe) { return fe_has_tp_structure(fe); }); const auto process_cells = [&](const auto &fu) { loop_over_active_or_level_cells( @@ -2464,7 +2483,7 @@ namespace internal ExcNotImplemented()); // ------------------- lexicographic_numbering -------------------- - if (reference_cell == ReferenceCells::get_hypercube()) + if (has_tp_structure) { const Quadrature<1> dummy_quadrature( std::vector>(1, Point<1>())); diff --git a/tests/multigrid-global-coarsening/mg_transfer_a_07.cc b/tests/multigrid-global-coarsening/mg_transfer_a_07.cc new file mode 100644 index 0000000000..5da5666fde --- /dev/null +++ b/tests/multigrid-global-coarsening/mg_transfer_a_07.cc @@ -0,0 +1,190 @@ +// ------------------------------------------------------------------------ +// +// SPDX-License-Identifier: LGPL-2.1-or-later +// Copyright (C) 2020 - 2024 by the deal.II authors +// +// This file is part of the deal.II library. +// +// Part of the source code is dual licensed under Apache-2.0 WITH +// LLVM-exception OR LGPL-2.1-or-later. Detailed license information +// governing the source code and code contributions can be found in +// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II. +// +// ------------------------------------------------------------------------ + + +/** + * Test MGTwoLevelTransfer for FE_DGP. + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include "mg_transfer_util.h" + +using namespace dealii; + +template +class RightHandSideFunction : public Function +{ +public: + RightHandSideFunction() + : Function(1) + {} + + virtual double + value(const Point &p, const unsigned int component = 0) const + { + (void)component; + return p[0]; + } +}; + +template +void +test_interpolation( + const MGTwoLevelTransferBase> + &transfer, + const MeshType &dof_handler_fine, + const MeshType &dof_handler_coarse, + const Function &function, + const unsigned int mg_level_fine = numbers::invalid_unsigned_int, + const unsigned int mg_level_coarse = numbers::invalid_unsigned_int) +{ + AffineConstraints constraint_fine( + dof_handler_fine.locally_owned_dofs(), + DoFTools::extract_locally_relevant_dofs(dof_handler_fine)); + DoFTools::make_hanging_node_constraints(dof_handler_fine, constraint_fine); + constraint_fine.close(); + + // perform interpolation + LinearAlgebra::distributed::Vector src, dst; + + initialize_dof_vector(dst, dof_handler_fine, mg_level_fine); + initialize_dof_vector(src, dof_handler_coarse, mg_level_coarse); + + // test interpolate + AffineConstraints dummy; + dummy.close(); + VectorTools::project(dof_handler_fine, dummy, QGauss(4), function, dst); + + transfer.interpolate(src, dst); + print_if_non_zero(dst, 1e-7); + print_if_non_zero(src, 1e-7); + + // prolongate back + dst = 0.0; + transfer.prolongate_and_add(dst, src); + print_if_non_zero(dst, 1e-7); + deallog << std::endl; +} + +template +void +do_test(const FiniteElement &fe_fine, + const FiniteElement &fe_coarse, + const Function &function, + const bool refine_fine_mesh) +{ + // create coarse grid + Triangulation tria_coarse; + GridGenerator::hyper_cube(tria_coarse); + + // create fine grid + Triangulation tria_fine; + GridGenerator::hyper_cube(tria_fine); + + if (refine_fine_mesh) + tria_fine.refine_global(); + + // setup dof-handlers + DoFHandler dof_handler_fine(tria_fine); + dof_handler_fine.distribute_dofs(fe_fine); + + DoFHandler dof_handler_coarse(tria_coarse); + dof_handler_coarse.distribute_dofs(fe_coarse); + + // setup constraint matrix + AffineConstraints constraint_coarse; + constraint_coarse.close(); + + AffineConstraints constraint_fine; + constraint_fine.close(); + + // setup transfer operator + MGTwoLevelTransfer> transfer; + + transfer.reinit(dof_handler_fine, + dof_handler_coarse, + constraint_fine, + constraint_coarse); + + test_interpolation(transfer, dof_handler_fine, dof_handler_coarse, function); +} + +template +void +test(int fe_degree, const Function &function) +{ + const auto str_fine = std::to_string(fe_degree); + const auto str_coarse = std::to_string(fe_degree); + const auto str_dim = std::to_string(dim); + + deallog.push("FE_DGP<" + str_dim + ">(" + str_fine + ")"); + do_test(FE_DGP(fe_degree), + FE_DGP(fe_degree), + function, + true); + do_test(FE_DGP(fe_degree + 1), + FE_DGP(fe_degree), + function, + false); + deallog.pop(); +} + +template +void +test() +{ + for (unsigned int i = 0; i <= 3; ++i) + test(i, Functions::ConstantFunction(1.)); + + deallog << std::endl << std::endl << std::endl; + + for (unsigned int i = 0; i <= 3; ++i) + test(i, RightHandSideFunction()); +} + +int +main(int argc, char **argv) +{ + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); + MPILogInitAll all; + + deallog.precision(8); + + test<1>(); + test<2>(); +} diff --git a/tests/multigrid-global-coarsening/mg_transfer_a_07.with_p4est=true.mpirun=1.output b/tests/multigrid-global-coarsening/mg_transfer_a_07.with_p4est=true.mpirun=1.output new file mode 100644 index 0000000000..6c673fe828 --- /dev/null +++ b/tests/multigrid-global-coarsening/mg_transfer_a_07.with_p4est=true.mpirun=1.output @@ -0,0 +1,135 @@ + +DEAL:0:FE_DGP<1>(0)::1.0000000 1.0000000 +DEAL:0:FE_DGP<1>(0)::1.0000000 +DEAL:0:FE_DGP<1>(0)::1.0000000 1.0000000 +DEAL:0:FE_DGP<1>(0):: +DEAL:0:FE_DGP<1>(0)::1.0000000 0.0000000 +DEAL:0:FE_DGP<1>(0)::1.0000000 +DEAL:0:FE_DGP<1>(0)::1.0000000 0.0000000 +DEAL:0:FE_DGP<1>(0):: +DEAL:0:FE_DGP<1>(1)::1.0000000 0.0000000 1.0000000 0.0000000 +DEAL:0:FE_DGP<1>(1)::1.0000000 0.0000000 +DEAL:0:FE_DGP<1>(1)::1.0000000 0.0000000 1.0000000 0.0000000 +DEAL:0:FE_DGP<1>(1):: +DEAL:0:FE_DGP<1>(1)::1.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(1)::1.0000000 0.0000000 +DEAL:0:FE_DGP<1>(1)::1.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(1):: +DEAL:0:FE_DGP<1>(2)::1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(2)::1.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(2)::1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(2):: +DEAL:0:FE_DGP<1>(2)::1.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(2)::1.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(2)::1.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(2):: +DEAL:0:FE_DGP<1>(3)::1.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(3)::1.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(3)::1.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(3):: +DEAL:0:FE_DGP<1>(3)::1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(3)::1.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(3)::1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(3):: +DEAL:0:: +DEAL:0:: +DEAL:0:: +DEAL:0:FE_DGP<1>(0)::0.25000000 0.75000000 +DEAL:0:FE_DGP<1>(0)::0.50000000 +DEAL:0:FE_DGP<1>(0)::0.50000000 0.50000000 +DEAL:0:FE_DGP<1>(0):: +DEAL:0:FE_DGP<1>(0)::0.50000000 0.28867513 +DEAL:0:FE_DGP<1>(0)::0.50000000 +DEAL:0:FE_DGP<1>(0)::0.50000000 0.0000000 +DEAL:0:FE_DGP<1>(0):: +DEAL:0:FE_DGP<1>(1)::0.25000000 0.14433757 0.75000000 0.14433757 +DEAL:0:FE_DGP<1>(1)::0.50000000 0.28867513 +DEAL:0:FE_DGP<1>(1)::0.25000000 0.14433757 0.75000000 0.14433757 +DEAL:0:FE_DGP<1>(1):: +DEAL:0:FE_DGP<1>(1)::0.50000000 0.28867513 0.0000000 +DEAL:0:FE_DGP<1>(1)::0.50000000 0.28867513 +DEAL:0:FE_DGP<1>(1)::0.50000000 0.28867513 0.0000000 +DEAL:0:FE_DGP<1>(1):: +DEAL:0:FE_DGP<1>(2)::0.25000000 0.14433757 0.0000000 0.75000000 0.14433757 0.0000000 +DEAL:0:FE_DGP<1>(2)::0.50000000 0.28867513 0.0000000 +DEAL:0:FE_DGP<1>(2)::0.25000000 0.14433757 0.0000000 0.75000000 0.14433757 0.0000000 +DEAL:0:FE_DGP<1>(2):: +DEAL:0:FE_DGP<1>(2)::0.50000000 0.28867513 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(2)::0.50000000 0.28867513 0.0000000 +DEAL:0:FE_DGP<1>(2)::0.50000000 0.28867513 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(2):: +DEAL:0:FE_DGP<1>(3)::0.25000000 0.14433757 0.0000000 0.0000000 0.75000000 0.14433757 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(3)::0.50000000 0.28867513 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(3)::0.25000000 0.14433757 0.0000000 0.0000000 0.75000000 0.14433757 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(3):: +DEAL:0:FE_DGP<1>(3)::0.50000000 0.28867513 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(3)::0.50000000 0.28867513 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(3)::0.50000000 0.28867513 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<1>(3):: +DEAL:0:FE_DGP<2>(0)::1.0000000 1.0000000 1.0000000 1.0000000 +DEAL:0:FE_DGP<2>(0)::1.0000000 +DEAL:0:FE_DGP<2>(0)::1.0000000 1.0000000 1.0000000 1.0000000 +DEAL:0:FE_DGP<2>(0):: +DEAL:0:FE_DGP<2>(0)::1.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(0)::1.0000000 +DEAL:0:FE_DGP<2>(0)::1.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(0):: +DEAL:0:FE_DGP<2>(1)::1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(1)::1.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(1)::1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(1):: +DEAL:0:FE_DGP<2>(1)::1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(1)::1.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(1)::1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(1):: +DEAL:0:FE_DGP<2>(2)::1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(2)::1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(2)::1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(2):: +DEAL:0:FE_DGP<2>(2)::1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(2)::1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(2)::1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(2):: +DEAL:0:FE_DGP<2>(3)::1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(3)::1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(3)::1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(3):: +DEAL:0:FE_DGP<2>(3)::1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(3)::1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(3)::1.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(3):: +DEAL:0:: +DEAL:0:: +DEAL:0:: +DEAL:0:FE_DGP<2>(0)::0.25000000 0.75000000 0.25000000 0.75000000 +DEAL:0:FE_DGP<2>(0)::0.50000000 +DEAL:0:FE_DGP<2>(0)::0.50000000 0.50000000 0.50000000 0.50000000 +DEAL:0:FE_DGP<2>(0):: +DEAL:0:FE_DGP<2>(0)::0.50000000 0.28867513 0.0000000 +DEAL:0:FE_DGP<2>(0)::0.50000000 +DEAL:0:FE_DGP<2>(0)::0.50000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(0):: +DEAL:0:FE_DGP<2>(1)::0.25000000 0.14433757 0.0000000 0.75000000 0.14433757 0.0000000 0.25000000 0.14433757 0.0000000 0.75000000 0.14433757 0.0000000 +DEAL:0:FE_DGP<2>(1)::0.50000000 0.28867513 0.0000000 +DEAL:0:FE_DGP<2>(1)::0.25000000 0.14433757 0.0000000 0.75000000 0.14433757 0.0000000 0.25000000 0.14433757 0.0000000 0.75000000 0.14433757 0.0000000 +DEAL:0:FE_DGP<2>(1):: +DEAL:0:FE_DGP<2>(1)::0.50000000 0.28867513 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(1)::0.50000000 0.28867513 0.0000000 +DEAL:0:FE_DGP<2>(1)::0.50000000 0.28867513 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(1):: +DEAL:0:FE_DGP<2>(2)::0.25000000 0.14433757 0.0000000 0.0000000 0.0000000 0.0000000 0.75000000 0.14433757 0.0000000 0.0000000 0.0000000 0.0000000 0.25000000 0.14433757 0.0000000 0.0000000 0.0000000 0.0000000 0.75000000 0.14433757 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(2)::0.50000000 0.28867513 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(2)::0.25000000 0.14433757 0.0000000 0.0000000 0.0000000 0.0000000 0.75000000 0.14433757 0.0000000 0.0000000 0.0000000 0.0000000 0.25000000 0.14433757 0.0000000 0.0000000 0.0000000 0.0000000 0.75000000 0.14433757 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(2):: +DEAL:0:FE_DGP<2>(2)::0.50000000 0.28867513 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(2)::0.50000000 0.28867513 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(2)::0.50000000 0.28867513 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(2):: +DEAL:0:FE_DGP<2>(3)::0.25000000 0.14433757 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.75000000 0.14433757 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.25000000 0.14433757 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.75000000 0.14433757 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(3)::0.50000000 0.28867513 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(3)::0.25000000 0.14433757 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.75000000 0.14433757 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.25000000 0.14433757 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.75000000 0.14433757 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(3):: +DEAL:0:FE_DGP<2>(3)::0.50000000 0.28867513 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(3)::0.50000000 0.28867513 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(3)::0.50000000 0.28867513 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 +DEAL:0:FE_DGP<2>(3):: diff --git a/tests/multigrid-global-coarsening/mg_transfer_util.h b/tests/multigrid-global-coarsening/mg_transfer_util.h index 3e6cb212dc..b259537baa 100644 --- a/tests/multigrid-global-coarsening/mg_transfer_util.h +++ b/tests/multigrid-global-coarsening/mg_transfer_util.h @@ -65,6 +65,19 @@ print(const LinearAlgebra::distributed::Vector &vec) deallog << std::endl; } +template +void +print_if_non_zero(const LinearAlgebra::distributed::Vector &vec, + const Number tolerance) +{ + for (const auto &v : vec) + if (std::abs(v) > tolerance) + deallog << v << " "; + else + deallog << 0.0 << " "; + deallog << std::endl; +} + template void -- 2.39.5