7#include <dune/common/parallel/mpihelper.hh>
24 static Mpi& instance()
30 void registerMpiHelper(Dune::MPIHelper& mpiHelper)
32 mpiHelper_ = &mpiHelper;
37 assert(mpiHelper_ !=
nullptr);
38 return mpiHelper_->rank();
43 assert(mpiHelper_ !=
nullptr);
44 return mpiHelper_->size();
47 Dune::MPIHelper& mpiHelper()
53 Dune::MPIHelper* mpiHelper_ =
nullptr;
62 Environment(
int& argc,
char**& argv, std::string
const& initFileName =
"");
73 return Mpi::instance().rank();
79 return Mpi::instance().size();
85 return Mpi::instance().mpiHelper();
89 static typename Dune::MPIHelper::MPICommunicator
comm()
91 return Dune::MPIHelper::getCommunicator();
102 bool petscInitialized_ =
false;
Establishes an environment for sequential and parallel AMDiS programs.
Definition Environment.hpp:20
static Dune::MPIHelper::MPICommunicator comm()
Return the MPI_Comm object (or a fake communicator)
Definition Environment.hpp:89
static Dune::MPIHelper & mpiHelper()
Return a reference to the stored MPIHelper.
Definition Environment.hpp:83
~Environment()
Finishes MPI and PETSc.
Definition Environment.cpp:54
static int mpiSize()
Return the MPI_Size of the group created by Dune::MPIHelper.
Definition Environment.hpp:77
static int infoLevel()
Return the info level for messages in info()
Definition Environment.cpp:63
static int mpiRank()
Return the MPI_Rank of the current processor.
Definition Environment.hpp:71
static bool msgAllRanks()
Return whether all ranks print msg()
Definition Environment.cpp:71