From f04f7af6a4b5d8eb992aede81f6e4fa4c3e92192 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Sun, 13 Aug 2017 16:23:52 -0600 Subject: [PATCH] allow MPILogInitAll to be used more than once --- tests/tests.h | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/tests/tests.h b/tests/tests.h index 64d6811538..e4b0cf2e85 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -377,11 +377,21 @@ struct MPILogInitAll { #ifdef DEAL_II_WITH_MPI unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD); - deallogname = "output"; - if (myid != 0) - deallogname = deallogname + Utilities::int_to_string(myid); - deallogfile.open(deallogname.c_str()); - deallog.attach(deallogfile); + if (myid == 0) + { + if (!deallog.has_file()) + { + deallogfile.open("output"); + deallog.attach(deallogfile); + } + } + else + { + deallogname = "output" + Utilities::int_to_string(myid); + deallogfile.open(deallogname.c_str()); + deallog.attach(deallogfile); + } + deallog.depth_console(console?10:0); deallog.push(Utilities::int_to_string(myid)); @@ -418,19 +428,11 @@ struct MPILogInitAll for (unsigned int i=1; i