From: Timo Heister Date: Mon, 6 May 2024 13:25:24 +0000 (-0400) Subject: Simplify some more X-Git-Tag: v9.6.0-rc1~311^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5aa9fcd7d073fa14337a33b4ac398f100a1b431;p=dealii.git Simplify some more --- 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);