From a8ab7d167ba549f52927143ccd9409a695e9f8a6 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Sun, 6 Dec 2015 10:38:17 -0500 Subject: [PATCH] step-50: switch from deallog to pcout, cleanup --- examples/step-50/step-50.cc | 41 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/examples/step-50/step-50.cc b/examples/step-50/step-50.cc index d031751c10..a91498016f 100644 --- a/examples/step-50/step-50.cc +++ b/examples/step-50/step-50.cc @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -117,6 +118,8 @@ namespace Step50 void refine_grid (); void output_results (const unsigned int cycle) const; + ConditionalOStream pcout; + parallel::distributed::Triangulation triangulation; FE_Q fe; DoFHandler mg_dof_handler; @@ -229,16 +232,16 @@ namespace Step50 template LaplaceProblem::LaplaceProblem (const unsigned int degree) : + pcout (std::cout, + (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) + == 0)), triangulation (MPI_COMM_WORLD,Triangulation:: limit_level_difference_at_vertices, parallel::distributed::Triangulation::construct_multigrid_hierarchy), fe (degree), mg_dof_handler (triangulation), degree(degree) - { - if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD)!=0) - deallog.depth_console(0); - } + {} // @sect4{LaplaceProblem::setup_system} @@ -810,6 +813,7 @@ namespace Step50 solver.solve (system_matrix, solution, system_rhs, preconditioner); } + pcout << " CG converged in " << solver_control.last_step() << " iterations." << std::endl; constraints.distribute (solution); } @@ -916,7 +920,7 @@ namespace Step50 std::ofstream visit_master (visit_master_filename.c_str()); data_out.write_visit_record (visit_master, filenames); - std::cout << "wrote " << pvtu_master_filename << std::endl; + std::cout << " wrote " << pvtu_master_filename << std::endl; } } @@ -937,7 +941,7 @@ namespace Step50 { for (unsigned int cycle=0; cycle<15; ++cycle) { - deallog << "Cycle " << cycle << ':' << std::endl; + pcout << "Cycle " << cycle << ':' << std::endl; if (cycle == 0) { @@ -948,31 +952,26 @@ namespace Step50 else refine_grid (); - deallog << " Number of active cells: " - << triangulation.n_global_active_cells() - << std::endl; + pcout << " Number of active cells: " + << triangulation.n_global_active_cells() + << std::endl; setup_system (); - deallog << " Number of degrees of freedom: " - << mg_dof_handler.n_dofs() - << " (by level: "; + pcout << " Number of degrees of freedom: " + << mg_dof_handler.n_dofs() + << " (by level: "; for (unsigned int level=0; level