* Create a duplicate of the given @p communicator.
*/
explicit DuplicatedCommunicator(const MPI_Comm &communicator)
- : comm (duplicate_communicator(communicator))
+ : comm(duplicate_communicator(communicator))
{}
/**
/**
* 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;
};
// ---------------------------------------------------------------------
//
-// 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.
//
#include "../tests.h"
-void test(const MPI_Comm comm)
+void
+test(const MPI_Comm comm)
{
int tag = 12345;
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)
// 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;
}