From 4daee3e202d402e645d34edf6abefd990bc1d63c Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Tue, 22 Oct 2019 22:31:37 +0200 Subject: [PATCH] address comments --- include/deal.II/base/mpi.h | 11 +++---- tests/mpi/communicator_duplicated.cc | 44 +++++++++------------------- 2 files changed, 20 insertions(+), 35 deletions(-) diff --git a/include/deal.II/base/mpi.h b/include/deal.II/base/mpi.h index 5f749a40e8..a5e897bc6f 100644 --- a/include/deal.II/base/mpi.h +++ b/include/deal.II/base/mpi.h @@ -230,7 +230,7 @@ namespace Utilities * Create a duplicate of the given @p communicator. */ explicit DuplicatedCommunicator(const MPI_Comm &communicator) - : comm (duplicate_communicator(communicator)) + : comm(duplicate_communicator(communicator)) {} /** @@ -257,12 +257,13 @@ namespace Utilities /** * Do not allow assignment of this class. */ - DuplicatedCommunicator& operator=(const DuplicatedCommunicator &) = delete; + DuplicatedCommunicator & + operator=(const DuplicatedCommunicator &) = delete; private: - /** - * The communicator of course. - */ + /** + * The communicator of course. + */ MPI_Comm comm; }; diff --git a/tests/mpi/communicator_duplicated.cc b/tests/mpi/communicator_duplicated.cc index 10b408d00f..00b2c07290 100644 --- a/tests/mpi/communicator_duplicated.cc +++ b/tests/mpi/communicator_duplicated.cc @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2017 - 2018 by the deal.II authors +// Copyright (C) 2019 by the deal.II authors // // This file is part of the deal.II library. // @@ -23,7 +23,8 @@ #include "../tests.h" -void test(const MPI_Comm comm) +void +test(const MPI_Comm comm) { int tag = 12345; @@ -32,29 +33,14 @@ void test(const MPI_Comm comm) MPI_Comm comm2 = Utilities::MPI::duplicate_communicator(comm); Utilities::MPI::DuplicatedCommunicator pcomm3(comm); - if (my_rank==1) + if (my_rank == 1) { - int value[3]={1,2,3}; - int dest = 0; - - MPI_Send(&value[0], - 1, - MPI_UNSIGNED, - dest, - tag, - comm); - MPI_Send(&value[1], - 1, - MPI_UNSIGNED, - dest, - tag, - comm2); - MPI_Send(&value[2], - 1, - MPI_UNSIGNED, - dest, - tag, - *pcomm3); + int value[3] = {1, 2, 3}; + int dest = 0; + + MPI_Send(&value[0], 1, MPI_UNSIGNED, dest, tag, comm); + MPI_Send(&value[1], 1, MPI_UNSIGNED, dest, tag, comm2); + MPI_Send(&value[2], 1, MPI_UNSIGNED, dest, tag, *pcomm3); } if (my_rank == 0) @@ -64,12 +50,10 @@ void test(const MPI_Comm comm) // receive in reverse order, if duplication of communicators worked, // these won't be mixed up! - MPI_Recv(&value[2], 1, MPI_UNSIGNED, - src, tag, *pcomm3, MPI_STATUS_IGNORE); - MPI_Recv(&value[1], 1, MPI_UNSIGNED, - src, tag, comm2, MPI_STATUS_IGNORE); - MPI_Recv(&value[0], 1, MPI_UNSIGNED, - src, tag, comm, MPI_STATUS_IGNORE); + MPI_Recv( + &value[2], 1, MPI_UNSIGNED, src, tag, *pcomm3, MPI_STATUS_IGNORE); + MPI_Recv(&value[1], 1, MPI_UNSIGNED, src, tag, comm2, MPI_STATUS_IGNORE); + MPI_Recv(&value[0], 1, MPI_UNSIGNED, src, tag, comm, MPI_STATUS_IGNORE); deallog << value[0] << " " << value[1] << " " << value[2] << std::endl; } -- 2.39.5