]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Utilities::duplicate_communicator.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 13 May 2009 06:19:08 +0000 (06:19 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 13 May 2009 06:19:08 +0000 (06:19 +0000)
git-svn-id: https://svn.dealii.org/trunk@18840 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/utilities.h
deal.II/base/source/utilities.cc
deal.II/doc/news/changes.h

index 330e5b91502bd33288fbba8a6d88f21a341f8c6b..72b2a63fff8e49d94eef98a27289f2931d377ae0 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2005, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -248,6 +248,20 @@ namespace Utilities
                                      */
     unsigned int get_this_mpi_process (const MPI_Comm &mpi_communicator);
 
+                                    /**
+                                     * Given a communicator, generate a new
+                                     * communicator that contains the same
+                                     * set of processors but that has a
+                                     * different, unique identifier.
+                                     *
+                                     * This functionality can be used to
+                                     * ensure that different objects, such as
+                                     * distributed matrices, each have unique
+                                     * communicators over which they can
+                                     * interact without interfering with each
+                                     * other.
+                                     */
+    MPI_Comm duplicate_communicator (const MPI_Comm &mpi_communicator);
 
                                     /**
                                      * A class that is used to initialize the
index 339365f5e4923cde074d525a5777e09010972519..4b20cb5dd8079a067d9e4d3281ffc589887ed1e8 100644 (file)
@@ -2,7 +2,7 @@
 //      $Id$   
 //    Version: $Name$
 //
-//    Copyright (C) 2005, 2006, 2008 by the deal.II authors
+//    Copyright (C) 2005, 2006, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -485,6 +485,15 @@ namespace Utilities
       
       return rank;
     }
+
+
+    MPI_Comm duplicate_communicator (const MPI_Comm &mpi_communicator)
+    {
+      MPI_Comm new_communicator;
+      MPI_Comm_Dup (mpi_communicator, &new_communicator);
+      return new_communicator;
+    }
+    
     
 #else
     
@@ -493,10 +502,19 @@ namespace Utilities
       return 1;
     }
 
+
+    
     unsigned int get_this_mpi_process (const MPI_Comm &)
     {
       return 0;
     }
+
+
+    
+    MPI_Comm duplicate_communicator (const MPI_Comm &mpi_communicator)
+    {
+      return mpi_communicator;
+    }
 #endif
 
 
index 08a44b501caccf3597ec22e397ebb1877111aa0c..20c831f10cc9197aaa25cb7c52fac3184454753e 100644 (file)
@@ -55,6 +55,10 @@ inconvenience this causes.
 <ol>
   <li>
   <p>
+  New: The new function Utilities::duplicate_communicator can be used
+  to duplicate an MPI communicator to produce a unique duplicate.
+  <br>
+  (WB 2009/05/13)
   </p>
   </li>
 </ol>
@@ -67,7 +71,7 @@ inconvenience this causes.
 <ol>
   <li>
   <p>
-  New: The SparseMatrix class has now a function <code>mmult</code> that
+  New: The SparseMatrix class has now a function SparseMatrix::mmult that
   can multiply two sparse matrices with each other.
   <br>
   (Martin Kronbichler 2009/05/04)

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.