Capture some variables in FlowMainEbos.

Make Opm::FlowMainEbos capture the variables argc, argv, outputCout, and
outputFiles. Passing the variables to the constructor and saving them as
class variables in Opm::FlowMainEbos makes the implementation of the
Python interface simpler. For example, the step_init() method does not
need to ask Opm::Main about the values of the variables when it needs to
run execute() in FlowMainEbos.

Another advantage of this refactoring could be that less variables needs
to be passed around from Opm::Main, to flow_ebos_xxx.cpp, and then again
to FlowMainEbos.
This commit is contained in:
Håkon Hægland
2020-06-25 20:04:19 +02:00
parent 8158e64351
commit f9d47b7c68
12 changed files with 70 additions and 52 deletions

View File

@@ -47,7 +47,7 @@ void flowEbosBlackoilSetDeck(double setupTime, Deck *deck, EclipseState& eclStat
}
std::unique_ptr<Opm::FlowMainEbos<TTAG(EclFlowProblem)>>
flowEbosBlackoilMainInit(int argc, char** argv)
flowEbosBlackoilMainInit(int argc, char** argv, bool outputCout, bool outputFiles)
{
// we always want to use the default locale, and thus spare us the trouble
// with incorrect locale settings.
@@ -59,14 +59,15 @@ flowEbosBlackoilMainInit(int argc, char** argv)
Dune::MPIHelper::instance(argc, argv);
#endif
return std::make_unique<Opm::FlowMainEbos<TTAG(EclFlowProblem)>>();
return std::make_unique<Opm::FlowMainEbos<TTAG(EclFlowProblem)>>(
argc, argv, outputCout, outputFiles);
}
// ----------------- Main program -----------------
int flowEbosBlackoilMain(int argc, char** argv, bool outputCout, bool outputFiles)
{
auto mainfunc = flowEbosBlackoilMainInit(argc, argv);
return mainfunc->execute(argc, argv, outputCout, outputFiles);
auto mainfunc = flowEbosBlackoilMainInit(argc, argv, outputCout, outputFiles);
return mainfunc->execute();
}
}