diff --git a/dune/common/mpihelper.hh b/dune/common/mpihelper.hh index 8d7d8e80e012e02b192c48c6c721f079793fa84c..bf64601256f65ea3630f00fb40e1661297b8a99a 100644 --- a/dune/common/mpihelper.hh +++ b/dune/common/mpihelper.hh @@ -77,7 +77,7 @@ namespace Dune /** * @brief The type of the mpi communicator. */ - typedef int MPICommunicator; + struct MPICommunicator {}; /** * @brief Get the default communicator. @@ -86,7 +86,8 @@ namespace Dune */ static MPICommunicator getCommunicator() { - return -1; + static MPICommunicator comm(); + return comm; } static CollectiveCommunication<MPICommunicator> @@ -208,7 +209,7 @@ namespace Dune { rank_ = -1; size_ = -1; - MPI_Init(&argc, &argv); + static int is_initialized = MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD,&rank_); MPI_Comm_size(MPI_COMM_WORLD,&size_);