From: kronbichler Date: Tue, 31 Jan 2012 13:45:42 +0000 (+0000) Subject: Apply changes in branch on mainline. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58f856b077d41b87d9eae1ddf1bee6cd05b165cd;p=dealii-svn.git Apply changes in branch on mainline. git-svn-id: https://svn.dealii.org/trunk@24972 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/base/partitioner.h b/deal.II/include/deal.II/base/partitioner.h index c07d50e85c..cdda1843ca 100644 --- a/deal.II/include/deal.II/base/partitioner.h +++ b/deal.II/include/deal.II/base/partitioner.h @@ -236,6 +236,25 @@ namespace Utilities const std::vector >& 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 diff --git a/deal.II/include/deal.II/lac/parallel_vector.h b/deal.II/include/deal.II/lac/parallel_vector.h index 326a2cb47c..5ce6bd152c 100644 --- a/deal.II/include/deal.II/lac/parallel_vector.h +++ b/deal.II/include/deal.II/lac/parallel_vector.h @@ -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 + inline + bool + Vector::partitioners_are_compatible + (const Utilities::MPI::Partitioner &part) const + { + return partitioner->is_compatible (part); + } + #endif // ifndef DOXYGEN } // end of namespace distributed