From 1e2fc06243711a8fe0c2b34db5a8b5d28134863d Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Thu, 3 Jul 2025 11:02:15 +0200 Subject: [PATCH] Do not use deprecated p::d::SolutionTransfer in examples and tests. Follow-up to #15706. --- examples/step-32/step-32.cc | 21 ++++++------------- examples/step-42/step-42.cc | 6 +++--- examples/step-48/step-48.cc | 5 ++--- examples/step-70/step-70.cc | 5 ++--- examples/step-86/step-86.cc | 5 ++--- tests/distributed_grids/checkpointing_02.cc | 14 +++++-------- tests/distributed_grids/checkpointing_03.cc | 14 +++++-------- .../distributed_grids/solution_transfer_01.cc | 5 +++-- .../distributed_grids/solution_transfer_02.cc | 4 ++-- .../distributed_grids/solution_transfer_03.cc | 4 ++-- .../distributed_grids/solution_transfer_04.cc | 7 ++++--- .../solution_transfer_01.cc | 8 +++---- tests/mpi/p4est_2d_constraintmatrix_04.cc | 6 ++---- tests/mpi/p4est_3d_constraintmatrix_03.cc | 6 ++---- tests/mpi/p4est_save_02.cc | 9 ++++---- tests/mpi/p4est_save_03.cc | 15 ++++++------- tests/mpi/p4est_save_04.cc | 9 ++++---- tests/mpi/p4est_save_06.cc | 9 ++++---- tests/mpi/solution_transfer_01.cc | 5 ++--- tests/mpi/solution_transfer_04.cc | 6 +++--- tests/mpi/solution_transfer_06.cc | 10 ++++----- tests/non_matching/step-70.cc | 5 ++--- tests/petsc/step-77-snes.cc | 5 ++--- 23 files changed, 75 insertions(+), 108 deletions(-) diff --git a/examples/step-32/step-32.cc b/examples/step-32/step-32.cc index 878b80983f..e22b9b3287 100644 --- a/examples/step-32/step-32.cc +++ b/examples/step-32/step-32.cc @@ -71,13 +71,6 @@ #include #include -// This is the only include file that is new: It introduces the -// parallel::distributed::SolutionTransfer equivalent of the -// SolutionTransfer class to take a solution from on mesh to the next -// one upon mesh refinement, but in the case of parallel distributed -// triangulations: -#include - // The following classes are used in parallel distributed computations and // have all already been introduced in step-40: #include @@ -3249,11 +3242,10 @@ namespace Step32 void BoussinesqFlowProblem::refine_mesh(const unsigned int max_grid_level) { - parallel::distributed::SolutionTransfer - temperature_trans(temperature_dof_handler); - parallel::distributed::SolutionTransfer - stokes_trans(stokes_dof_handler); + SolutionTransfer temperature_trans( + temperature_dof_handler); + SolutionTransfer stokes_trans( + stokes_dof_handler); { TimerOutput::Scope timer_section(computing_timer, @@ -3283,9 +3275,8 @@ namespace Step32 cell->clear_refine_flag(); // With all flags marked as necessary, we can then tell the - // parallel::distributed::SolutionTransfer objects to get ready to - // transfer data from one mesh to the next, which they will do when - // notified by + // SolutionTransfer objects to get ready to transfer data from one mesh to + // the next, which they will do when notified by // Triangulation as part of the @p execute_coarsening_and_refinement() call. // The syntax is similar to the non-%parallel solution transfer (with the // exception that here a pointer to the vector entries is enough). The diff --git a/examples/step-42/step-42.cc b/examples/step-42/step-42.cc index cf15984858..bb6aeade33 100644 --- a/examples/step-42/step-42.cc +++ b/examples/step-42/step-42.cc @@ -50,7 +50,6 @@ #include #include -#include #include #include @@ -64,6 +63,7 @@ #include #include #include +#include #include #include @@ -1874,8 +1874,8 @@ namespace Step42 triangulation.prepare_coarsening_and_refinement(); - parallel::distributed::SolutionTransfer - solution_transfer(dof_handler); + SolutionTransfer solution_transfer( + dof_handler); if (transfer_solution) solution_transfer.prepare_for_coarsening_and_refinement(solution); diff --git a/examples/step-48/step-48.cc b/examples/step-48/step-48.cc index 6f8393a38b..cb25bec519 100644 --- a/examples/step-48/step-48.cc +++ b/examples/step-48/step-48.cc @@ -364,9 +364,8 @@ namespace Step48 // cells whose center is within a radius of 11, and then refine once more // for a radius 6. This simple ad hoc refinement could be done better by // adapting the mesh to the solution using error estimators during the time - // stepping as done in other example programs, and using - // parallel::distributed::SolutionTransfer to transfer the solution to the - // new mesh. + // stepping as done in other example programs, and using SolutionTransfer to + // transfer the solution to the new mesh. template void SineGordonProblem::make_grid_and_dofs() { diff --git a/examples/step-70/step-70.cc b/examples/step-70/step-70.cc index 80a4abb487..df4717af1e 100644 --- a/examples/step-70/step-70.cc +++ b/examples/step-70/step-70.cc @@ -52,7 +52,6 @@ namespace LA #include #include -#include #include #include @@ -87,6 +86,7 @@ namespace LA #include #include #include +#include // These are the only new include files with regard to step-60. In this // tutorial, the non-matching coupling between the solid and the fluid is @@ -1664,8 +1664,7 @@ namespace Step70 cell->clear_coarsen_flag(); } - parallel::distributed::SolutionTransfer - transfer(fluid_dh); + SolutionTransfer transfer(fluid_dh); fluid_tria.prepare_coarsening_and_refinement(); transfer.prepare_for_coarsening_and_refinement(locally_relevant_solution); diff --git a/examples/step-86/step-86.cc b/examples/step-86/step-86.cc index 3c94ac0b4f..47de4175fd 100644 --- a/examples/step-86/step-86.cc +++ b/examples/step-86/step-86.cc @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -864,8 +863,8 @@ namespace Step86 const std::vector &all_in, std::vector &all_out) { - parallel::distributed::SolutionTransfer - solution_trans(dof_handler); + SolutionTransfer solution_trans( + dof_handler); std::vector all_in_ghosted(all_in.size()); std::vector all_in_ghosted_ptr( diff --git a/tests/distributed_grids/checkpointing_02.cc b/tests/distributed_grids/checkpointing_02.cc index 1c76a1d1da..3595c39968 100644 --- a/tests/distributed_grids/checkpointing_02.cc +++ b/tests/distributed_grids/checkpointing_02.cc @@ -30,7 +30,6 @@ const bool run_big = false; #include #include -#include #include #include @@ -51,6 +50,7 @@ const bool run_big = false; #include #include +#include #include #include @@ -189,10 +189,8 @@ LaplaceProblem::run(unsigned int n_cycles_global, // To be sure, use two SolutionTransfer objects, because the second one // will get a large offset - parallel::distributed::SolutionTransfer system_trans( - dof_handler); - parallel::distributed::SolutionTransfer trans2( - dof_handler); + SolutionTransfer system_trans(dof_handler); + SolutionTransfer trans2(dof_handler); system_trans.prepare_for_serialization(x_system); trans2.prepare_for_serialization(y); @@ -218,10 +216,8 @@ LaplaceProblem::run(unsigned int n_cycles_global, triangulation.coarsen_global(99); triangulation.load("restart.mesh"); - parallel::distributed::SolutionTransfer system_trans( - dof_handler); - parallel::distributed::SolutionTransfer trans2( - dof_handler); + SolutionTransfer system_trans(dof_handler); + SolutionTransfer trans2(dof_handler); system_trans.deserialize(x_system); trans2.deserialize(y); diff --git a/tests/distributed_grids/checkpointing_03.cc b/tests/distributed_grids/checkpointing_03.cc index b83099ee56..4a42c3a030 100644 --- a/tests/distributed_grids/checkpointing_03.cc +++ b/tests/distributed_grids/checkpointing_03.cc @@ -27,7 +27,6 @@ const bool run_big = false; #include #include -#include #include #include @@ -48,6 +47,7 @@ const bool run_big = false; #include #include +#include #include #include @@ -188,10 +188,8 @@ LaplaceProblem::run(unsigned int n_cycles_global, // To be sure, use two SolutionTransfer objects, because the second one // will get a large offset - parallel::distributed::SolutionTransfer system_trans( - dof_handler); - parallel::distributed::SolutionTransfer trans2( - dof_handler); + SolutionTransfer system_trans(dof_handler); + SolutionTransfer trans2(dof_handler); dof_handler.prepare_for_serialization_of_active_fe_indices(); @@ -219,10 +217,8 @@ LaplaceProblem::run(unsigned int n_cycles_global, triangulation.coarsen_global(99); triangulation.load("restart.mesh"); - parallel::distributed::SolutionTransfer system_trans( - dof_handler); - parallel::distributed::SolutionTransfer trans2( - dof_handler); + SolutionTransfer system_trans(dof_handler); + SolutionTransfer trans2(dof_handler); dof_handler.deserialize_active_fe_indices(); system_trans.deserialize(x_system); diff --git a/tests/distributed_grids/solution_transfer_01.cc b/tests/distributed_grids/solution_transfer_01.cc index b95867dc5e..4d062ce797 100644 --- a/tests/distributed_grids/solution_transfer_01.cc +++ b/tests/distributed_grids/solution_transfer_01.cc @@ -18,7 +18,6 @@ #include -#include #include #include @@ -31,6 +30,8 @@ #include #include +#include + #include "../tests.h" @@ -46,7 +47,7 @@ test(std::ostream & /*out*/) static const FE_Q fe(2); dofh.distribute_dofs(fe); - parallel::distributed::SolutionTransfer> soltrans(dofh); + SolutionTransfer> soltrans(dofh); for (typename Triangulation::active_cell_iterator cell = tr.begin_active(); diff --git a/tests/distributed_grids/solution_transfer_02.cc b/tests/distributed_grids/solution_transfer_02.cc index 19bbfa38fb..2be41c3c17 100644 --- a/tests/distributed_grids/solution_transfer_02.cc +++ b/tests/distributed_grids/solution_transfer_02.cc @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -33,6 +32,7 @@ #include #include +#include #include #include "../tests.h" @@ -73,7 +73,7 @@ test(std::ostream & /*out*/) static const FE_Q fe(1); dofh.distribute_dofs(fe); - parallel::distributed::SolutionTransfer> soltrans(dofh); + SolutionTransfer> soltrans(dofh); for (typename Triangulation::active_cell_iterator cell = tr.begin_active(); diff --git a/tests/distributed_grids/solution_transfer_03.cc b/tests/distributed_grids/solution_transfer_03.cc index c5b83ec159..0cccef57c1 100644 --- a/tests/distributed_grids/solution_transfer_03.cc +++ b/tests/distributed_grids/solution_transfer_03.cc @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -33,6 +32,7 @@ #include #include +#include #include #include "../tests.h" @@ -72,7 +72,7 @@ test(std::ostream & /*out*/) static const FE_Q fe(1); dofh.distribute_dofs(fe); - parallel::distributed::SolutionTransfer> soltrans(dofh); + SolutionTransfer> soltrans(dofh); for (int i = 0; i < 4; ++i) { diff --git a/tests/distributed_grids/solution_transfer_04.cc b/tests/distributed_grids/solution_transfer_04.cc index 83268e6e45..2b5788cf79 100644 --- a/tests/distributed_grids/solution_transfer_04.cc +++ b/tests/distributed_grids/solution_transfer_04.cc @@ -18,7 +18,6 @@ #include -#include #include #include @@ -31,6 +30,8 @@ #include #include +#include + #include "../tests.h" #include "coarse_grid_common.h" @@ -49,8 +50,8 @@ test(std::ostream & /*out*/) static const FE_Q fe(2); dofh.distribute_dofs(fe); - parallel::distributed::SolutionTransfer> soltrans(dofh); - parallel::distributed::SolutionTransfer> soltrans2(dofh); + SolutionTransfer> soltrans(dofh); + SolutionTransfer> soltrans2(dofh); for (typename Triangulation::active_cell_iterator cell = tr.begin_active(); diff --git a/tests/fullydistributed_grids/solution_transfer_01.cc b/tests/fullydistributed_grids/solution_transfer_01.cc index f9027add34..71351a4e01 100644 --- a/tests/fullydistributed_grids/solution_transfer_01.cc +++ b/tests/fullydistributed_grids/solution_transfer_01.cc @@ -17,7 +17,6 @@ // Test distributed solution transfer with fullydistributed triangulations. #include -#include #include #include @@ -30,6 +29,7 @@ #include +#include #include #include "../grid/tests.h" @@ -77,8 +77,7 @@ test(TriangulationType &triangulation) "solution_transfer_" + std::to_string(dim) + "d_out"; { - parallel::distributed::SolutionTransfer solution_transfer( - dof_handler); + SolutionTransfer solution_transfer(dof_handler); solution_transfer.prepare_for_serialization(vector); triangulation.save(filename); @@ -90,8 +89,7 @@ test(TriangulationType &triangulation) triangulation.load(filename); dof_handler.distribute_dofs(FE_Q(2)); - parallel::distributed::SolutionTransfer solution_transfer( - dof_handler); + SolutionTransfer solution_transfer(dof_handler); solution_transfer.deserialize(vector_loaded); vector_loaded.update_ghost_values(); diff --git a/tests/mpi/p4est_2d_constraintmatrix_04.cc b/tests/mpi/p4est_2d_constraintmatrix_04.cc index bcf1e064b1..10cd178b85 100644 --- a/tests/mpi/p4est_2d_constraintmatrix_04.cc +++ b/tests/mpi/p4est_2d_constraintmatrix_04.cc @@ -21,7 +21,6 @@ #include #include -#include #include #include @@ -42,6 +41,7 @@ #include #include +#include #include #include "../tests.h" @@ -182,9 +182,7 @@ test() - parallel::distributed::SolutionTransfer - trans(dofh); + SolutionTransfer trans(dofh); tr.prepare_coarsening_and_refinement(); diff --git a/tests/mpi/p4est_3d_constraintmatrix_03.cc b/tests/mpi/p4est_3d_constraintmatrix_03.cc index 04a22c5f3b..828623a90d 100644 --- a/tests/mpi/p4est_3d_constraintmatrix_03.cc +++ b/tests/mpi/p4est_3d_constraintmatrix_03.cc @@ -21,7 +21,6 @@ #include #include -#include #include #include @@ -42,6 +41,7 @@ #include #include +#include #include #include "../tests.h" @@ -181,9 +181,7 @@ test() } } - parallel::distributed::SolutionTransfer - trans(dofh); + SolutionTransfer trans(dofh); tr.prepare_coarsening_and_refinement(); diff --git a/tests/mpi/p4est_save_02.cc b/tests/mpi/p4est_save_02.cc index ec9d55e70f..0c21bee7c9 100644 --- a/tests/mpi/p4est_save_02.cc +++ b/tests/mpi/p4est_save_02.cc @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -35,6 +34,8 @@ #include +#include + #include "../tests.h" @@ -81,8 +82,7 @@ test() locally_relevant_dofs, MPI_COMM_WORLD); - parallel::distributed::SolutionTransfer - soltrans(dh); + SolutionTransfer soltrans(dh); for (unsigned int i = 0; i < locally_owned_dofs.n_elements(); ++i) { @@ -123,8 +123,7 @@ test() DoFTools::extract_locally_relevant_dofs(dh); PETScWrappers::MPI::Vector solution(locally_owned_dofs, MPI_COMM_WORLD); - parallel::distributed::SolutionTransfer - soltrans(dh); + SolutionTransfer soltrans(dh); solution = 2; soltrans.deserialize(solution); diff --git a/tests/mpi/p4est_save_03.cc b/tests/mpi/p4est_save_03.cc index 5326c5044e..e8d41290be 100644 --- a/tests/mpi/p4est_save_03.cc +++ b/tests/mpi/p4est_save_03.cc @@ -20,7 +20,6 @@ #include #include -#include #include #include @@ -36,6 +35,8 @@ #include +#include + #include "../tests.h" @@ -86,10 +87,8 @@ test() locally_relevant_dofs, MPI_COMM_WORLD); - parallel::distributed::SolutionTransfer - soltrans(dh); - parallel::distributed::SolutionTransfer - soltrans2(dh); + SolutionTransfer soltrans(dh); + SolutionTransfer soltrans2(dh); for (unsigned int i = 0; i < locally_owned_dofs.n_elements(); ++i) { @@ -136,10 +135,8 @@ test() PETScWrappers::MPI::Vector solution(locally_owned_dofs, MPI_COMM_WORLD); PETScWrappers::MPI::Vector solution2(locally_owned_dofs, MPI_COMM_WORLD); - parallel::distributed::SolutionTransfer - soltrans(dh); - parallel::distributed::SolutionTransfer - soltrans2(dh); + SolutionTransfer soltrans(dh); + SolutionTransfer soltrans2(dh); solution = 2; soltrans.deserialize(solution); soltrans2.deserialize(solution2); diff --git a/tests/mpi/p4est_save_04.cc b/tests/mpi/p4est_save_04.cc index 91512b3e85..786851d43d 100644 --- a/tests/mpi/p4est_save_04.cc +++ b/tests/mpi/p4est_save_04.cc @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -35,6 +34,8 @@ #include +#include + #include "../tests.h" @@ -84,8 +85,7 @@ test() locally_relevant_dofs, com_small); - parallel::distributed::SolutionTransfer - soltrans(dh); + SolutionTransfer soltrans(dh); for (unsigned int i = 0; i < locally_owned_dofs.n_elements(); ++i) { @@ -129,8 +129,7 @@ test() PETScWrappers::MPI::Vector solution(locally_owned_dofs, com_all); solution = PetscScalar(); - parallel::distributed::SolutionTransfer - soltrans(dh); + SolutionTransfer soltrans(dh); soltrans.deserialize(solution); for (unsigned int i = 0; i < locally_owned_dofs.n_elements(); ++i) diff --git a/tests/mpi/p4est_save_06.cc b/tests/mpi/p4est_save_06.cc index f62c29cd06..47e54a3395 100644 --- a/tests/mpi/p4est_save_06.cc +++ b/tests/mpi/p4est_save_06.cc @@ -20,7 +20,6 @@ #include #include -#include #include #include @@ -36,6 +35,8 @@ #include +#include + #include "../tests.h" @@ -91,8 +92,7 @@ test() locally_relevant_dofs, com_small); - parallel::distributed::SolutionTransfer - soltrans(dh); + SolutionTransfer soltrans(dh); for (unsigned int i = 0; i < locally_owned_dofs.n_elements(); ++i) { @@ -143,8 +143,7 @@ test() PETScWrappers::MPI::Vector solution(locally_owned_dofs, com_all); solution = PetscScalar(); - parallel::distributed::SolutionTransfer - soltrans(dh); + SolutionTransfer soltrans(dh); soltrans.deserialize(solution); diff --git a/tests/mpi/solution_transfer_01.cc b/tests/mpi/solution_transfer_01.cc index 9ca404ae28..a9af4ac748 100644 --- a/tests/mpi/solution_transfer_01.cc +++ b/tests/mpi/solution_transfer_01.cc @@ -20,7 +20,6 @@ #include #include -#include #include #include @@ -41,6 +40,7 @@ #include #include +#include #include #include "../tests.h" @@ -70,8 +70,7 @@ test() locally_relevant_dofs, MPI_COMM_WORLD); - parallel::distributed::SolutionTransfer<2, PETScWrappers::MPI::Vector> - soltrans(dh); + SolutionTransfer<2, PETScWrappers::MPI::Vector> soltrans(dh); tria.set_all_refine_flags(); tria.prepare_coarsening_and_refinement(); diff --git a/tests/mpi/solution_transfer_04.cc b/tests/mpi/solution_transfer_04.cc index a8b8fe4c73..7a2723305b 100644 --- a/tests/mpi/solution_transfer_04.cc +++ b/tests/mpi/solution_transfer_04.cc @@ -18,7 +18,6 @@ // This tests is based on mpi/feindices_transfer.cc -#include #include #include @@ -30,6 +29,8 @@ #include +#include + #include "../tests.h" @@ -97,8 +98,7 @@ test() // ----- transfer ----- - parallel::distributed::SolutionTransfer - soltrans(dh); + SolutionTransfer soltrans(dh); soltrans.prepare_for_coarsening_and_refinement(old_solution); tria.execute_coarsening_and_refinement(); diff --git a/tests/mpi/solution_transfer_06.cc b/tests/mpi/solution_transfer_06.cc index 9364d251e5..d1574532a7 100644 --- a/tests/mpi/solution_transfer_06.cc +++ b/tests/mpi/solution_transfer_06.cc @@ -14,12 +14,11 @@ -// Test parallel::distributed::SolutionTransfer for FE_Nothing +// Test parallel distributed SolutionTransfer for FE_Nothing // (see also https://github.com/dealii/dealii/issues/10570). #include -#include #include #include @@ -37,6 +36,8 @@ #include +#include + #include #include @@ -76,9 +77,8 @@ transfer(const MPI_Comm comm) for (unsigned int i = 0; i < solution.size(); ++i) solution(i) = i; - parallel::distributed:: - SolutionTransfer> - soltrans(dof_handler); + SolutionTransfer> soltrans( + dof_handler); for (const auto &cell : tria.active_cell_iterators()) cell->set_refine_flag(); diff --git a/tests/non_matching/step-70.cc b/tests/non_matching/step-70.cc index 0a5726fcc3..de1d8bb5e7 100644 --- a/tests/non_matching/step-70.cc +++ b/tests/non_matching/step-70.cc @@ -55,7 +55,6 @@ namespace LA #include #include -#include #include #include @@ -89,6 +88,7 @@ namespace LA #include #include +#include #include // These are the only new include files with regard to step-60. In this @@ -1659,8 +1659,7 @@ namespace Step70 cell->clear_coarsen_flag(); } - parallel::distributed::SolutionTransfer - transfer(fluid_dh); + SolutionTransfer transfer(fluid_dh); fluid_tria.prepare_coarsening_and_refinement(); transfer.prepare_for_coarsening_and_refinement(locally_relevant_solution); diff --git a/tests/petsc/step-77-snes.cc b/tests/petsc/step-77-snes.cc index 4617d1cb2a..c4f1bcd785 100644 --- a/tests/petsc/step-77-snes.cc +++ b/tests/petsc/step-77-snes.cc @@ -54,7 +54,6 @@ #include #include -#include #include #include @@ -437,8 +436,8 @@ namespace Step77 triangulation.prepare_coarsening_and_refinement(); - parallel::distributed::SolutionTransfer - solution_transfer(dof_handler); + SolutionTransfer solution_transfer( + dof_handler); PETScWrappers::MPI::Vector current_solution_tmp(locally_relevant_solution); solution_transfer.prepare_for_coarsening_and_refinement( -- 2.39.5