From 6fbe952eae8a71ef19066af2b1b1a6fb7a25a9fc Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Thu, 21 Mar 2019 22:04:00 +0100 Subject: [PATCH] make MPILogInitAll work without MPI --- tests/tests.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) 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 } }; -- 2.39.5