Skip to content

Commit

Permalink
Simplify some more
Browse files Browse the repository at this point in the history
  • Loading branch information
tjhei committed May 7, 2024
1 parent f5edef7 commit d5aa9fc
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions examples/step-77/step-77.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -370,8 +373,6 @@ namespace Step77
residual);
}

zero_constraints.set_zero(residual);

std::cout << " norm=" << residual.l2_norm() << std::endl;
}

Expand Down Expand Up @@ -433,18 +434,15 @@ namespace Step77
triangulation.prepare_coarsening_and_refinement();

SolutionTransfer<dim> solution_transfer(dof_handler);
solution_transfer.prepare_for_coarsening_and_refinement(current_solution);
const Vector<double> coarse_solution = current_solution;
solution_transfer.prepare_for_coarsening_and_refinement(coarse_solution);

triangulation.execute_coarsening_and_refinement();

dof_handler.distribute_dofs(fe);

Vector<double> 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);
}

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit d5aa9fc

Please sign in to comment.