96 static MPICommunicator comm;
136 (void)argc; (void)argv;
145 int rank ()
const {
return 0; }
149 int size ()
const {
return 1; }
188 return MPI_COMM_WORLD;
199 return MPI_COMM_SELF;
232 int rank ()
const {
return rank_; }
236 int size ()
const {
return size_; }
241 bool initializedHere_;
242 void prevent_warning(
int){}
246 : initializedHere_(
false)
248 int wasInitialized = -1;
249 MPI_Initialized( &wasInitialized );
254 static int is_initialized = MPI_Init(&argc, &argv);
255 prevent_warning(is_initialized);
256 initializedHere_ =
true;
259 MPI_Comm_rank(MPI_COMM_WORLD,&rank_);
260 MPI_Comm_size(MPI_COMM_WORLD,&size_);
262 assert( rank_ >= 0 );
263 assert( size_ >= 1 );
265 dverb <<
"Called MPI_Init on p=" << rank_ <<
"!" << std::endl;
270 int wasFinalized = -1;
271 MPI_Finalized( &wasFinalized );
272 if(!wasFinalized && initializedHere_)
275 dverb <<
"Called MPI_Finalize on p=" << rank_ <<
"!" <<std::endl;
Definition of macros controlling symbol visibility at the ABI level.
Implements an utility class that provides collective communication methods for sequential programs...
static DUNE_EXPORT FakeMPIHelper & instance(int argc, char **argv)
Get the singleton instance of the helper.
Definition: mpihelper.hh:134
static MPICommunicator getCommunicator()
get the default communicator
Definition: mpihelper.hh:186
Are we fake (i.e. pretend to have MPI support but are compiled without.)
Definition: mpihelper.hh:80
DVerbType dverb(std::cout)
Singleton of verbose debug stream.
Definition: stdstreams.hh:114
static DUNE_EXPORT MPIHelper & instance(int &argc, char **&argv)
Get the singleton instance of the helper.
Definition: mpihelper.hh:222
int size() const
return rank of process, i.e. one
Definition: mpihelper.hh:149
static MPICommunicator getLocalCommunicator()
get a local communicator
Definition: mpihelper.hh:106
static DUNE_EXPORT MPICommunicator getCommunicator()
get the default communicator
Definition: mpihelper.hh:94
Collective communication interface and sequential default implementation.
Definition: collectivecommunication.hh:79
static MPICommunicator getLocalCommunicator()
get a local communicator
Definition: mpihelper.hh:197
Implements an utility class that provides MPI's collective communication methods. ...
#define DUNE_EXPORT
Export a symbol as part of the public ABI.
Definition: visibility.hh:18
A real mpi helper.This helper should be used for parallel programs.
Definition: mpihelper.hh:164
static CollectiveCommunication< MPICommunicator > getCollectiveCommunication()
Definition: mpihelper.hh:203
Dune namespace.
Definition: alignedallocator.hh:9
A fake mpi helper.
Definition: mpihelper.hh:72
Standard Dune debug streams.
Definition: collectivecommunication.hh:43
No_Comm MPICommunicator
The type of the mpi communicator.
Definition: mpihelper.hh:86
int size() const
return number of processes
Definition: mpihelper.hh:236
int rank() const
return rank of process, i.e. zero
Definition: mpihelper.hh:145
int rank() const
return rank of process
Definition: mpihelper.hh:232
static CollectiveCommunication< MPICommunicator > getCollectiveCommunication()
Definition: mpihelper.hh:114
MPI_Comm MPICommunicator
The type of the mpi communicator.
Definition: mpihelper.hh:178