Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In step-40, move timer section into the function being timed. #16862

Merged
merged 1 commit into from
Apr 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 7 additions & 8 deletions examples/step-40/step-40.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -483,7 +483,8 @@ namespace Step40
void LaplaceProblem<dim>::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);
Expand Down Expand Up @@ -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 <int dim>
void LaplaceProblem<dim>::output_results(const unsigned int cycle) const
void LaplaceProblem<dim>::output_results(const unsigned int cycle)
{
TimerOutput::Scope t(computing_timer, "output");

DataOut<dim> data_out;
data_out.attach_dof_handler(dof_handler);
data_out.add_data_vector(locally_relevant_solution, "u");
Expand Down Expand Up @@ -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();
Expand Down