readDeck: make the ParseContext an internal detail

This commit is contained in:
Arne Morten Kvarving 2023-01-17 08:15:26 +01:00
parent 6eb97c0165
commit 56df430bd6
4 changed files with 8 additions and 16 deletions

View File

@ -30,7 +30,6 @@
#include <opm/input/eclipse/EclipseState/EclipseState.hpp> #include <opm/input/eclipse/EclipseState/EclipseState.hpp>
#include <opm/input/eclipse/Parser/ErrorGuard.hpp> #include <opm/input/eclipse/Parser/ErrorGuard.hpp>
#include <opm/input/eclipse/Parser/InputErrorAction.hpp> #include <opm/input/eclipse/Parser/InputErrorAction.hpp>
#include <opm/input/eclipse/Parser/ParseContext.hpp>
#include <opm/input/eclipse/Schedule/Action/State.hpp> #include <opm/input/eclipse/Schedule/Action/State.hpp>
#include <opm/input/eclipse/Schedule/OilVaporizationProperties.hpp> #include <opm/input/eclipse/Schedule/OilVaporizationProperties.hpp>
#include <opm/input/eclipse/Schedule/Schedule.hpp> #include <opm/input/eclipse/Schedule/Schedule.hpp>
@ -99,17 +98,10 @@ void EclGenericVanguard::readDeck(const std::string& filename)
std::unique_ptr<Opm::WellTestState> wtestState; std::unique_ptr<Opm::WellTestState> wtestState;
std::shared_ptr<Opm::SummaryConfig> summaryConfig; std::shared_ptr<Opm::SummaryConfig> summaryConfig;
auto parseContext =
std::make_unique<ParseContext>(std::vector<std::pair<std::string , InputErrorAction>>
{{ParseContext::PARSE_RANDOM_SLASH, InputErrorAction::IGNORE},
{ParseContext::PARSE_MISSING_DIMS_KEYWORD, InputErrorAction::WARN},
{ParseContext::SUMMARY_UNKNOWN_WELL, InputErrorAction::WARN},
{ParseContext::SUMMARY_UNKNOWN_GROUP, InputErrorAction::WARN}});
Opm::readDeck(EclGenericVanguard::comm(), Opm::readDeck(EclGenericVanguard::comm(),
filename, eclipseState, schedule, udqState, filename, eclipseState, schedule, udqState,
actionState, wtestState, actionState, wtestState,
summaryConfig, nullptr, nullptr, std::move(parseContext), summaryConfig, nullptr, nullptr, false,
false, false, {}); false, false, {});
EclGenericVanguard::setParams(setupTimer.elapsed(), EclGenericVanguard::setParams(setupTimer.elapsed(),

View File

@ -502,7 +502,6 @@ private:
EWOMS_GET_PARAM(PreTypeTag, std::string, OutputMode), EWOMS_GET_PARAM(PreTypeTag, std::string, OutputMode),
outputCout_, "STDOUT_LOGGER", allRanksDbgPrtLog); outputCout_, "STDOUT_LOGGER", allRanksDbgPrtLog);
const bool strictParsing = EWOMS_GET_PARAM(PreTypeTag, bool, EclStrictParsing); const bool strictParsing = EWOMS_GET_PARAM(PreTypeTag, bool, EclStrictParsing);
auto parseContext = setupParseContext(strictParsing);
FlowMainEbos<PreTypeTag>::printPRTHeader(outputCout_); FlowMainEbos<PreTypeTag>::printPRTHeader(outputCout_);
@ -517,7 +516,7 @@ private:
readDeck(EclGenericVanguard::comm(), deckFilename, eclipseState_, readDeck(EclGenericVanguard::comm(), deckFilename, eclipseState_,
schedule_, udqState_, actionState_, wtestState_, schedule_, udqState_, actionState_, wtestState_,
summaryConfig_, nullptr, python, std::move(parseContext), summaryConfig_, nullptr, python, strictParsing,
init_from_restart_file, outputCout_, outputInterval); init_from_restart_file, outputCout_, outputInterval);
verifyValidCellGeometry(EclGenericVanguard::comm(), *this->eclipseState_); verifyValidCellGeometry(EclGenericVanguard::comm(), *this->eclipseState_);
@ -718,7 +717,7 @@ private:
return flowEbosWaterOnlyMain(argc_, argv_, outputCout_, outputFiles_); return flowEbosWaterOnlyMain(argc_, argv_, outputCout_, outputFiles_);
} }
int runWaterOnlyEnergy(const Phases& phases) int runWaterOnlyEnergy(const Phases& phases)
{ {
if (!phases.active(Phase::WATER) || phases.size() != 2) { if (!phases.active(Phase::WATER) || phases.size() != 2) {
@ -742,7 +741,7 @@ private:
return EXIT_FAILURE; return EXIT_FAILURE;
} }
if (phases.size() == 3) { if (phases.size() == 3) {
if (phases.active(Phase::OIL)){ // oil water brine case if (phases.active(Phase::OIL)){ // oil water brine case
return flowEbosOilWaterBrineMain(argc_, argv_, outputCout_, outputFiles_); return flowEbosOilWaterBrineMain(argc_, argv_, outputCout_, outputFiles_);
@ -752,7 +751,7 @@ private:
eclipseState_->getSimulationConfig().hasVAPWAT()) { eclipseState_->getSimulationConfig().hasVAPWAT()) {
//case with water vaporization into gas phase and salt precipitation //case with water vaporization into gas phase and salt precipitation
return flowEbosGasWaterSaltprecVapwatMain(argc_, argv_, outputCout_, outputFiles_); return flowEbosGasWaterSaltprecVapwatMain(argc_, argv_, outputCout_, outputFiles_);
} }
else { else {
return flowEbosGasWaterBrineMain(argc_, argv_, outputCout_, outputFiles_); return flowEbosGasWaterBrineMain(argc_, argv_, outputCout_, outputFiles_);
} }

View File

@ -489,7 +489,7 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
std::shared_ptr<SummaryConfig>& summaryConfig, std::shared_ptr<SummaryConfig>& summaryConfig,
std::unique_ptr<ErrorGuard> errorGuard, std::unique_ptr<ErrorGuard> errorGuard,
std::shared_ptr<Python> python, std::shared_ptr<Python> python,
std::unique_ptr<ParseContext> parseContext, const bool strictParsing,
const bool initFromRestart, const bool initFromRestart,
const bool checkDeck, const bool checkDeck,
const std::optional<int>& outputInterval) const std::optional<int>& outputInterval)
@ -503,6 +503,7 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
if (comm.rank() == 0) { // Always true when !HAVE_MPI if (comm.rank() == 0) { // Always true when !HAVE_MPI
try { try {
auto parseContext = setupParseContext(strictParsing);
readOnIORank(comm, deckFilename, parseContext.get(), readOnIORank(comm, deckFilename, parseContext.get(),
eclipseState, schedule, udqState, actionState, wtestState, eclipseState, schedule, udqState, actionState, wtestState,
summaryConfig, std::move(python), initFromRestart, summaryConfig, std::move(python), initFromRestart,

View File

@ -86,7 +86,7 @@ void readDeck(Parallel::Communication comm,
std::shared_ptr<SummaryConfig>& summaryConfig, std::shared_ptr<SummaryConfig>& summaryConfig,
std::unique_ptr<ErrorGuard> errorGuard, std::unique_ptr<ErrorGuard> errorGuard,
std::shared_ptr<Python> python, std::shared_ptr<Python> python,
std::unique_ptr<ParseContext> parseContext, bool strictParsing,
bool initFromRestart, bool initFromRestart,
bool checkDeck, bool checkDeck,
const std::optional<int>& outputInterval); const std::optional<int>& outputInterval);