]> https://gitweb.dealii.org/ - dealii.git/commitdiff
address comments
authorTimo Heister <timo.heister@gmail.com>
Tue, 22 Oct 2019 20:31:37 +0000 (22:31 +0200)
committerTimo Heister <timo.heister@gmail.com>
Tue, 22 Oct 2019 20:31:37 +0000 (22:31 +0200)
include/deal.II/base/mpi.h
tests/mpi/communicator_duplicated.cc

index 5f749a40e85d718fe0ca3b0b2cdb6c9b29e933be..a5e897bc6f6c593d595de1ec327e381b42d75bab 100644 (file)
@@ -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;
     };
 
index 10b408d00fe1d69a414c602bf097c391c1a7bf92..00b2c0729051ac968cef0901d81c80de0d1ef64f 100644 (file)
@@ -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;
     }

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.