]> https://gitweb.dealii.org/ - dealii.git/commitdiff
make MPILogInitAll work without MPI
authorDenis Davydov <davydden@gmail.com>
Thu, 21 Mar 2019 21:04:00 +0000 (22:04 +0100)
committerDenis Davydov <davydden@gmail.com>
Fri, 22 Mar 2019 08:05:53 +0000 (09:05 +0100)
tests/tests.h

index f585da1fc761eb7b4ae74142c3cb26a99a92ed03..ee46c716d0a7dd4f42705b4ebd53cc52ae946da0 100644 (file)
@@ -527,6 +527,9 @@ struct MPILogInitAll
   {
 #ifdef DEAL_II_WITH_MPI
     const unsigned int myid = Utilities::MPI::this_mpi_process(MPI_COMM_WORLD);
+#else
+    constexpr unsigned int myid = 0;
+#endif
     if (myid == 0)
       {
         if (!deallog.has_file())
@@ -545,22 +548,17 @@ struct MPILogInitAll
     deallog.depth_console(console ? 10 : 0);
 
     deallog.push(Utilities::int_to_string(myid));
-#else
-    (void)console;
-    // can't use this function if not using MPI
-    Assert(false, ExcInternalError());
-#endif
   }
 
   ~MPILogInitAll()
   {
+    // pop the prefix for the MPI rank of the current process
+    deallog.pop();
+
 #ifdef DEAL_II_WITH_MPI
     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)
       {
         deallog.detach();
@@ -583,10 +581,6 @@ struct MPILogInitAll
           }
       }
     MPI_Barrier(MPI_COMM_WORLD);
-
-#else
-    // can't use this function if not using MPI
-    Assert(false, ExcInternalError());
 #endif
   }
 };

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.