]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Better document MPILogInitAll. 5152/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 25 Sep 2017 23:48:12 +0000 (17:48 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 25 Sep 2017 23:48:12 +0000 (17:48 -0600)
tests/tests.h

index 6ad335ecfaec33cffb10b2b59d43307da2e1319e..82fefde5c692925775bcc13b0e2b6f2509ca960e 100644 (file)
@@ -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)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.