From: Martin Kronbichler Date: Sat, 10 Mar 2018 06:10:18 +0000 (+0100) Subject: Do not use MPI_COMM_WORLD. X-Git-Tag: v9.0.0-rc1~346^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f2e401ef77e4fbcc29d668f9d3a9280cde81754;p=dealii.git Do not use MPI_COMM_WORLD. --- diff --git a/include/deal.II/multigrid/mg_transfer.h b/include/deal.II/multigrid/mg_transfer.h index b13fb5fb2d..2608dedbf8 100644 --- a/include/deal.II/multigrid/mg_transfer.h +++ b/include/deal.II/multigrid/mg_transfer.h @@ -66,9 +66,16 @@ namespace internal template static void reinit(Matrix &matrix, Sparsity &, int level, const SparsityPatternType &sp, DoFHandlerType &dh) { + const parallel::Triangulation *dist_tria = + dynamic_cast*> + (&(dh.get_triangulation())); + MPI_Comm communicator = dist_tria != nullptr ? + dist_tria->get_communicator() : + MPI_COMM_SELF; + matrix.reinit(dh.locally_owned_mg_dofs(level+1), dh.locally_owned_mg_dofs(level), - sp, MPI_COMM_WORLD, true); + sp, communicator, true); } }; @@ -82,9 +89,15 @@ namespace internal template static void reinit(Matrix &matrix, Sparsity &, int level, const SparsityPatternType &sp, DoFHandlerType &dh) { + const parallel::Triangulation *dist_tria = + dynamic_cast*> + (&(dh.get_triangulation())); + MPI_Comm communicator = dist_tria != nullptr ? + dist_tria->get_communicator() : + MPI_COMM_SELF; matrix.reinit(dh.locally_owned_mg_dofs(level+1), dh.locally_owned_mg_dofs(level), - sp, MPI_COMM_WORLD, true); + sp, communicator, true); } }; @@ -99,9 +112,15 @@ namespace internal template static void reinit(Matrix &matrix, Sparsity &, int level, const SparsityPatternType &sp, DoFHandlerType &dh) { + const parallel::Triangulation *dist_tria = + dynamic_cast*> + (&(dh.get_triangulation())); + MPI_Comm communicator = dist_tria != nullptr ? + dist_tria->get_communicator() : + MPI_COMM_SELF; matrix.reinit(dh.locally_owned_mg_dofs(level+1), dh.locally_owned_mg_dofs(level), - sp, MPI_COMM_WORLD, true); + sp, communicator, true); } }; #endif