eclbasevanguard: pass parameters to createParseContext

to avoid typetag dependence in the code
This commit is contained in:
Arne Morten Kvarving 2021-05-04 09:23:43 +02:00
parent 86bc095e3a
commit dbf834518e
2 changed files with 9 additions and 5 deletions

View File

@ -83,7 +83,9 @@ std::unique_ptr<ParseContext> ebosBlackOilCreateParseContext(int argc, char** ar
/*doRegistration=*/true,
/*allowUnused=*/true,
/*handleHelp=*/false);
std::unique_ptr<ParseContext> result = Vanguard::createParseContext();
const std::string ignoredKeywords = EWOMS_GET_PARAM(ProblemTypeTag, std::string, IgnoreKeywords);
bool eclStrictParsing = EWOMS_GET_PARAM(ProblemTypeTag, bool, EclStrictParsing);
std::unique_ptr<ParseContext> result = Vanguard::createParseContext(ignoredKeywords, eclStrictParsing);
Parameters::reset<ProblemTypeTag>();
return result;

View File

@ -280,7 +280,8 @@ public:
/*!
* \brief Creates an Opm::parseContext object assuming that the parameters are ready.
*/
static std::unique_ptr<ParseContext> createParseContext()
static std::unique_ptr<ParseContext> createParseContext(const std::string& ignoredKeywords,
bool eclStrictParsing)
{
typedef std::pair<std::string, InputError::Action> ParseModePair;
typedef std::vector<ParseModePair> ParseModePairs;
@ -293,7 +294,6 @@ public:
auto parseContext = std::make_unique<ParseContext>(tmp);
const std::string ignoredKeywords = EWOMS_GET_PARAM(TypeTag, std::string, IgnoreKeywords);
if (ignoredKeywords.size() > 0) {
size_t pos;
size_t offset = 0;
@ -308,7 +308,7 @@ public:
}
}
if (EWOMS_GET_PARAM(TypeTag, bool, EclStrictParsing))
if (eclStrictParsing)
parseContext->update(InputError::DELAYED_EXIT1);
return parseContext;
@ -442,7 +442,9 @@ public:
}
else
{
parseContext_ = createParseContext();
const std::string ignoredKeywords = EWOMS_GET_PARAM(TypeTag, std::string, IgnoreKeywords);
bool eclStrictParsing = EWOMS_GET_PARAM(TypeTag, bool, EclStrictParsing);
parseContext_ = createParseContext(ignoredKeywords, eclStrictParsing);
}
std::optional<int> outputInterval;