]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Apply changes in branch on mainline.
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 31 Jan 2012 13:45:42 +0000 (13:45 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 31 Jan 2012 13:45:42 +0000 (13:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@24972 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/base/partitioner.h
deal.II/include/deal.II/lac/parallel_vector.h

index c07d50e85c7f6ef0254e615b32e9f7e5da76f0fc..cdda1843ca58920c2a8ab093b1245a5f97df2cfc 100644 (file)
@@ -236,6 +236,25 @@ namespace Utilities
     const std::vector<std::pair<unsigned int,unsigned int> >&
     import_targets() const;
 
+                               /**
+                                * Checks whether the given
+                                * partitioner is compatible with the
+                                * partitioner used for this
+                                * vector. Two partitioners are
+                                * compatible if the have the same
+                                * local size and the same ghost
+                                * indices. They do not necessarily
+                                * need to be the same data
+                                * field. This is a local operation
+                                * only, i.e., if only some
+                                * processors decide that the
+                                * partitioning is not compatible,
+                                * only these processors will return
+                                * @p false, whereas the other
+                                * processors will return @p true.
+                                */
+    bool is_compatible (const Partitioner &part) const;
+
                                /**
                                 * Returns the MPI ID of the calling
                                 * processor. Cached to have simple access.
@@ -502,6 +521,21 @@ namespace Utilities
 
 
 
+    inline
+    bool
+    Partitioner::is_compatible (const Partitioner &part) const
+    {
+                               // is the partitioner points to the same
+                               // memory location as the calling processor
+      if (&part == this)
+       return true;
+      else
+       return (global_size == part.global_size &&
+               local_range_data == part.local_range_data &&
+               ghost_indices_data == part.ghost_indices_data);
+    }
+
+
     inline
     unsigned int
     Partitioner::this_mpi_process() const
index 326a2cb47ca4a43c0bc02cfa5221d453cd8d5389..5ce6bd152c39f1d3d6014eb4cdbcd848249c8125 100644 (file)
@@ -823,6 +823,27 @@ namespace parallel
                                          * @name 4: Mixed stuff
                                          */
                                         //@{
+                                        /**
+                                         * Checks whether the given
+                                         * partitioner is compatible with the
+                                         * partitioner used for this
+                                         * vector. Two partitioners are
+                                         * compatible if the have the same
+                                         * local size and the same ghost
+                                         * indices. They do not necessarily
+                                         * need to be the same data
+                                         * field. This is a local operation
+                                         * only, i.e., if only some
+                                         * processors decide that the
+                                         * partitioning is not compatible,
+                                         * only these processors will return
+                                         * @p false, whereas the other
+                                         * processors will return @p true.
+                                         */
+      bool
+      partitioners_are_compatible (const Utilities::MPI::Partitioner &part) const;
+
+
                                         /**
                                          * Prints the vector to the output stream @p
                                          * out.
@@ -1828,6 +1849,17 @@ namespace parallel
 #endif
     }
 
+
+
+    template <typename Number>
+    inline
+    bool
+    Vector<Number>::partitioners_are_compatible 
+    (const Utilities::MPI::Partitioner &part) const
+    {
+      return partitioner->is_compatible (part);
+    }
+
 #endif  // ifndef DOXYGEN
 
   } // end of namespace distributed

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.