From b9399afabe3f2074b5b4c73a8669d76875076d63 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 27 Jun 2013 16:09:46 +0000 Subject: [PATCH] Disable some MPI-only code if we haven't configured to use MPI. git-svn-id: https://svn.dealii.org/trunk@29893 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/tests.h | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/tests/tests.h b/tests/tests.h index 4dfffcbe91..b2feb8cb05 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -73,10 +73,12 @@ output_file_for_mpi (const std::string &directory) #endif } + inline void mpi_initlog(const char* filename, bool console=false) { +#ifdef DEAL_II_WITH_MPI unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); if (myid == 0) { @@ -89,8 +91,12 @@ mpi_initlog(const char* filename, bool console=false) //TODO: Remove this line and replace by test_mode() deallog.threshold_float(1.e-8); } +#else + // can't use this function if not using MPI + Assert (false, ExcInternalError()); +#endif } - + /* helper class to include the deallogs of all processors @@ -101,6 +107,7 @@ class MPILogInitAll MPILogInitAll(const char* filename, bool console=false) : m_filename(filename) { +#ifdef DEAL_II_WITH_MPI unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); deallogname = output_file_for_mpi(JobIdentifier::base_name(filename)); if (myid != 0) @@ -113,46 +120,55 @@ class MPILogInitAll //TODO: Remove this line and replace by test_mode() deallog.threshold_float(1.e-8); deallog.push(Utilities::int_to_string(myid)); +#else + // can't use this function if not using MPI + Assert (false, ExcInternalError()); +#endif } ~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); - + deallog.pop(); if (myid!=0) { deallog.detach(); deallogfile.close(); } - + MPI_Barrier(MPI_COMM_WORLD); if (myid==0) - { + { for (unsigned int i=1;i