From d5aa9fcd7d073fa14337a33b4ac398f100a1b431 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Mon, 6 May 2024 09:25:24 -0400 Subject: [PATCH] Simplify some more --- examples/step-77/step-77.cc | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/examples/step-77/step-77.cc b/examples/step-77/step-77.cc index 95cc12f236..30fc66af84 100644 --- a/examples/step-77/step-77.cc +++ b/examples/step-77/step-77.cc @@ -164,6 +164,9 @@ namespace Step77 { TimerOutput::Scope t(computing_timer, "set up"); + dof_handler.distribute_dofs(fe); + current_solution.reinit(dof_handler.n_dofs()); + zero_constraints.clear(); VectorTools::interpolate_boundary_values(dof_handler, 0, @@ -370,8 +373,6 @@ namespace Step77 residual); } - zero_constraints.set_zero(residual); - std::cout << " norm=" << residual.l2_norm() << std::endl; } @@ -433,18 +434,15 @@ namespace Step77 triangulation.prepare_coarsening_and_refinement(); SolutionTransfer solution_transfer(dof_handler); - solution_transfer.prepare_for_coarsening_and_refinement(current_solution); + const Vector coarse_solution = current_solution; + solution_transfer.prepare_for_coarsening_and_refinement(coarse_solution); triangulation.execute_coarsening_and_refinement(); - dof_handler.distribute_dofs(fe); - - Vector tmp(dof_handler.n_dofs()); - solution_transfer.interpolate(current_solution, tmp); - current_solution = std::move(tmp); - setup_system(); + solution_transfer.interpolate(coarse_solution, current_solution); + nonzero_constraints.distribute(current_solution); } @@ -494,9 +492,6 @@ namespace Step77 GridGenerator::hyper_ball(triangulation); triangulation.refine_global(2); - dof_handler.distribute_dofs(fe); - current_solution.reinit(dof_handler.n_dofs()); - setup_system(); nonzero_constraints.distribute(current_solution); -- 2.39.5