mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
added: bool param to flag that Main.hpp should not initialize/finalize MPI
needed for tests
This commit is contained in:
parent
093b346426
commit
c95cd5b147
@ -40,10 +40,12 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
Main::Main(int argc, char** argv)
|
||||
: argc_(argc), argv_(argv)
|
||||
Main::Main(int argc, char** argv, bool ownMPI)
|
||||
: argc_(argc), argv_(argv), ownMPI_(ownMPI)
|
||||
{
|
||||
initMPI();
|
||||
if (ownMPI_) {
|
||||
initMPI();
|
||||
}
|
||||
}
|
||||
|
||||
Main::Main(const std::string& filename)
|
||||
@ -83,7 +85,9 @@ Main::~Main()
|
||||
}
|
||||
#endif // HAVE_MPI
|
||||
|
||||
EclGenericVanguard::setCommunication(nullptr);
|
||||
if (ownMPI_) {
|
||||
EclGenericVanguard::setCommunication(nullptr);
|
||||
}
|
||||
|
||||
#if HAVE_DAMARIS
|
||||
if (enableDamarisOutput_) {
|
||||
@ -102,7 +106,9 @@ Main::~Main()
|
||||
#endif // HAVE_DAMARIS
|
||||
|
||||
#if HAVE_MPI && !HAVE_DUNE_FEM
|
||||
MPI_Finalize();
|
||||
if (ownMPI_) {
|
||||
MPI_Finalize();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ int flowEbosMain(int argc, char** argv, bool outputCout, bool outputFiles)
|
||||
class Main
|
||||
{
|
||||
public:
|
||||
Main(int argc, char** argv);
|
||||
Main(int argc, char** argv, bool ownMPI = true);
|
||||
|
||||
// This constructor can be called from Python
|
||||
Main(const std::string& filename);
|
||||
@ -727,6 +727,7 @@ private:
|
||||
|
||||
int argc_{0};
|
||||
char** argv_{nullptr};
|
||||
bool ownMPI_{true}; //!< True if we "own" MPI and should init / finalize
|
||||
bool outputCout_{false};
|
||||
bool outputFiles_{false};
|
||||
double setupTime_{0.0};
|
||||
|
Loading…
Reference in New Issue
Block a user