From bb9a101077e6da1ee09d2ee6e24fcb5bcd0fa9b9 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 25 Sep 2017 17:48:12 -0600 Subject: [PATCH] Better document MPILogInitAll. --- tests/tests.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/tests.h b/tests/tests.h index 6ad335ecfa..82fefde5c6 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -369,14 +369,18 @@ mpi_initlog(bool console=false) -/* helper class to include the deallogs of all processors - on proc 0 */ +/** + * A helper class that gives each MPI process its own output file + * for the `deallog` stream, and at the end of the program (or, + * more correctly, the end of the current object), concatenates them + * all into the output file used on processor 0. + */ struct MPILogInitAll { - MPILogInitAll(bool console=false) + MPILogInitAll(const bool console=false) { #ifdef DEAL_II_WITH_MPI - unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); + const unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); if (myid == 0) { if (!deallog.has_file()) @@ -392,7 +396,7 @@ struct MPILogInitAll deallog.attach(deallogfile); } - deallog.depth_console(console?10:0); + deallog.depth_console(console ? 10 : 0); deallog.push(Utilities::int_to_string(myid)); #else @@ -405,9 +409,10 @@ struct MPILogInitAll ~MPILogInitAll() { #ifdef DEAL_II_WITH_MPI - unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); - unsigned int nproc = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD); + const unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); + const unsigned int nproc = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD); + // pop the prefix for the MPI rank of the current process deallog.pop(); if (myid!=0) -- 2.39.5