move ParseContext configuration to readDeck

this way we do not need to include InputErrorAction in Main.hpp
This commit is contained in:
Arne Morten Kvarving 2023-01-11 13:43:13 +01:00
parent fd94ca7031
commit 60b23e8bb1
3 changed files with 20 additions and 9 deletions

View File

@ -50,7 +50,6 @@
#include <flow/flow_ebos_micp.hpp>
#include <opm/input/eclipse/Parser/ErrorGuard.hpp>
#include <opm/input/eclipse/Parser/InputErrorAction.hpp>
#include <opm/input/eclipse/Parser/Parser.hpp>
#include <opm/input/eclipse/Parser/ParseContext.hpp>
#include <opm/input/eclipse/Python/Python.hpp>
@ -504,14 +503,8 @@ private:
outputDir,
EWOMS_GET_PARAM(PreTypeTag, std::string, OutputMode),
outputCout_, "STDOUT_LOGGER", allRanksDbgPrtLog);
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}});
if (EWOMS_GET_PARAM(PreTypeTag, bool, EclStrictParsing))
parseContext->update(InputErrorAction::DELAYED_EXIT1);
const bool strictParsing = EWOMS_GET_PARAM(PreTypeTag, bool, EclStrictParsing);
auto parseContext = setupParseContext(strictParsing);
FlowMainEbos<PreTypeTag>::printPRTHeader(outputCout_);

View File

@ -47,6 +47,8 @@
#include <opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/input/eclipse/Parser/ErrorGuard.hpp>
#include <opm/input/eclipse/Parser/InputErrorAction.hpp>
#include <opm/input/eclipse/Parser/ParseContext.hpp>
#include <opm/input/eclipse/Parser/Parser.hpp>
#include <opm/input/eclipse/Schedule/Action/State.hpp>
@ -574,3 +576,17 @@ void Opm::verifyValidCellGeometry(Parallel::Communication comm,
Please check geometry keywords, especially if grid is imported through GDFILE)"
};
}
std::unique_ptr<Opm::ParseContext> Opm::setupParseContext(const bool strictParsing)
{
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}});
if (strictParsing)
parseContext->update(InputErrorAction::DELAYED_EXIT1);
return parseContext;
}

View File

@ -60,6 +60,8 @@ enum class FileOutputMode {
void
ensureOutputDirExists(const std::string& cmdline_output_dir);
std::unique_ptr<ParseContext> setupParseContext(const bool strictParsing);
// Setup the OpmLog backends
FileOutputMode
setupLogging(int mpi_rank_,