From: Wolfgang Bangerth Date: Sat, 6 Apr 2024 16:19:39 +0000 (-0600) Subject: In step-40, move timer section into the function being timed. X-Git-Tag: v9.6.0-rc1~396^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a98b70200e5bb0921f5a1e76902799384688e3bd;p=dealii.git In step-40, move timer section into the function being timed. --- diff --git a/examples/step-40/step-40.cc b/examples/step-40/step-40.cc index 2b353a75c1..5291257e07 100644 --- a/examples/step-40/step-40.cc +++ b/examples/step-40/step-40.cc @@ -166,7 +166,7 @@ namespace Step40 void assemble_system(); void solve(); void refine_grid(); - void output_results(const unsigned int cycle) const; + void output_results(const unsigned int cycle); MPI_Comm mpi_communicator; @@ -483,7 +483,8 @@ namespace Step40 void LaplaceProblem::solve() { TimerOutput::Scope t(computing_timer, "solve"); - LA::MPI::Vector completely_distributed_solution(locally_owned_dofs, + + LA::MPI::Vector completely_distributed_solution(locally_owned_dofs, mpi_communicator); SolverControl solver_control(dof_handler.n_dofs(), 1e-12); @@ -584,8 +585,10 @@ namespace Step40 // to locally owned cells, while providing the wrong value for all other // elements -- but these are then ignored anyway. template - void LaplaceProblem::output_results(const unsigned int cycle) const + void LaplaceProblem::output_results(const unsigned int cycle) { + TimerOutput::Scope t(computing_timer, "output"); + DataOut data_out; data_out.attach_dof_handler(dof_handler); data_out.add_data_vector(locally_relevant_solution, "u"); @@ -652,11 +655,7 @@ namespace Step40 assemble_system(); solve(); - - { - TimerOutput::Scope t(computing_timer, "output"); - output_results(cycle); - } + output_results(cycle); computing_timer.print_summary(); computing_timer.reset();