7#include <dune/common/parallel/mpihelper.hh>
24 static Mpi& instance()
30 void registerMpiHelper(Dune::MPIHelper&
mpiHelper)
37 assert(mpiHelper_ !=
nullptr);
38 return mpiHelper_->rank();
43 assert(mpiHelper_ !=
nullptr);
44 return mpiHelper_->size();
53 Dune::MPIHelper* mpiHelper_ =
nullptr;
62 Environment(
int& argc,
char**& argv, std::string
const& initFileName =
"");
70 return Mpi::instance().rank();
76 return Mpi::instance().size();
82 return Mpi::instance().mpiHelper();
86 static typename Dune::MPIHelper::MPICommunicator
comm()
88 return Dune::MPIHelper::getCommunicator();
99 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:86
static Dune::MPIHelper & mpiHelper()
Return a reference to the stored MPIHelper.
Definition: Environment.hpp:80
Environment(std::string const &initFileName="")
Create an environment without mpi initialization, with a fixed initfile given as string.
Definition: Environment.cpp:25
~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:74
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:68
static bool msgAllRanks()
Return whether all ranks print msg()
Definition: Environment.cpp:71