From 5f2e401ef77e4fbcc29d668f9d3a9280cde81754 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Sat, 10 Mar 2018 07:10:18 +0100 Subject: [PATCH] Do not use MPI_COMM_WORLD. --- include/deal.II/multigrid/mg_transfer.h | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) 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 -- 2.39.5