From: Denis Davydov Date: Thu, 21 Mar 2019 21:04:00 +0000 (+0100) Subject: make MPILogInitAll work without MPI X-Git-Tag: v9.1.0-rc1~263^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6fbe952eae8a71ef19066af2b1b1a6fb7a25a9fc;p=dealii.git make MPILogInitAll work without MPI --- diff --git a/tests/tests.h b/tests/tests.h index f585da1fc7..ee46c716d0 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -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 } };