diff --git a/dune/common/parallel/mpicollectivecommunication.hh b/dune/common/parallel/mpicollectivecommunication.hh index 6e8590373e45005aec0ad256d532ca0dcfbfbf7b..b8b54fff7bcb4bd06d28fb15780b4b30b57d931c 100644 --- a/dune/common/parallel/mpicollectivecommunication.hh +++ b/dune/common/parallel/mpicollectivecommunication.hh @@ -150,6 +150,10 @@ namespace Dune : communicator(c) { if(communicator!=MPI_COMM_NULL) { + int initialized = 0; + MPI_Initialized(&initialized); + if (!initialized) + DUNE_THROW(ParallelError,"You must call MPIHelper::instance(argc,argv) in your main() function before using the MPI CollectiveCommunication!"); MPI_Comm_rank(communicator,&me); MPI_Comm_size(communicator,&procs); }else{