]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Implement duplicate_map.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 7 Aug 2009 16:45:16 +0000 (16:45 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 7 Aug 2009 16:45:16 +0000 (16:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@19196 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/include/base/utilities.h
deal.II/base/source/utilities.cc

index 5a9476aaeda9441c73650f7c9b380ed0cf1db37e..195e4eb79d93fb75fb7445e0ef90f72fdfbccbef 100644 (file)
@@ -29,6 +29,7 @@ typedef int MPI_Comm;
 #ifdef DEAL_II_USE_TRILINOS
 #  include <Teuchos_RCP.hpp>
 #  include <Epetra_Comm.h>
+#  include <Epetra_Map.h>
 #  ifdef DEAL_II_COMPILER_SUPPORTS_MPI
 #    include <Epetra_MpiComm.h>
 #  else
@@ -442,6 +443,25 @@ namespace Utilities
                                      * get_n_mpi_processes()).
                                      */
     unsigned int get_this_mpi_process (const Epetra_Comm &mpi_communicator);
+
+                                    /**
+                                     * Given a Trilinos Epetra map, create a
+                                     * new map that has the same subdivision
+                                     * of elements to processors but uses the
+                                     * given communicator object instead of
+                                     * the one stored in the first
+                                     * argument. In essence, this means that
+                                     * we create a map that communicates
+                                     * among the same processors in the same
+                                     * way, but using a separate channel.
+                                     *
+                                     * This function is typically used with a
+                                     * communicator that has been obtained by
+                                     * the duplicate_communicator() function.
+                                     */
+    Epetra_Map
+    duplicate_map (const Epetra_Map  &map,
+                  const Epetra_Comm &comm);
   }
 
 #endif
index 0d242560f29809ed2cee1eac4225213603ab0df4..1c0b7108b10ad70c66931807df207df840b61990 100644 (file)
@@ -645,6 +645,24 @@ namespace Utilities
     {
       return (unsigned int)mpi_communicator.MyPID();
     }
+
+
+    
+    Epetra_Map
+    duplicate_map (const Epetra_Map  &map,
+                  const Epetra_Comm &comm)
+    {
+                                      // assume that each processor stores a
+                                      // contiguous range of elements in the
+                                      // following constructor call
+      Assert (map.LinearMap() == true,
+             ExcNotImplemented());
+      return
+       Epetra_Map (map.NumGlobalElements(),
+                   map.NumMyElements(),
+                   map.IndexBase(),
+                   comm);
+    }
   }
   
 #endif

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.