From 36ffb65525fc1c8f21ffe1455b68eb603f1f82a8 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Tue, 14 Jun 2022 10:51:13 +0200 Subject: [PATCH] remove parsecontext in generic vanguard not used --- ebos/eclgenericvanguard.cc | 64 -------------------------------------- ebos/eclgenericvanguard.hh | 13 -------- 2 files changed, 77 deletions(-) diff --git a/ebos/eclgenericvanguard.cc b/ebos/eclgenericvanguard.cc index 0fb479c3d..d676c517e 100644 --- a/ebos/eclgenericvanguard.cc +++ b/ebos/eclgenericvanguard.cc @@ -36,7 +36,6 @@ #include #include #include -#include #include #include @@ -53,7 +52,6 @@ namespace Opm { double EclGenericVanguard::setupTime_ = 0.0; std::shared_ptr EclGenericVanguard::deck_; -std::unique_ptr EclGenericVanguard::externalParseContext_; std::shared_ptr EclGenericVanguard::eclState_; std::shared_ptr EclGenericVanguard::eclSchedule_; std::shared_ptr EclGenericVanguard::eclSummaryConfig_; @@ -69,11 +67,6 @@ EclGenericVanguard::EclGenericVanguard() EclGenericVanguard::~EclGenericVanguard() = default; -void EclGenericVanguard::setExternalParseContext(std::unique_ptr parseContext) -{ - externalParseContext_ = std::move(parseContext); -} - void EclGenericVanguard::setSchedule(std::shared_ptr schedule) { eclSchedule_ = std::move(schedule); @@ -156,40 +149,6 @@ std::string EclGenericVanguard::canonicalDeckPath(const std::string& caseName) throw std::invalid_argument("Cannot find input case '"+caseName+"'"); } -std::unique_ptr EclGenericVanguard::createParseContext(const std::string& ignoredKeywords, - bool eclStrictParsing) -{ - typedef std::pair ParseModePair; - typedef std::vector ParseModePairs; - ParseModePairs tmp; - tmp.emplace_back(ParseContext::PARSE_RANDOM_SLASH, InputError::IGNORE); - tmp.emplace_back(ParseContext::PARSE_MISSING_DIMS_KEYWORD, InputError::WARN); - tmp.emplace_back(ParseContext::SUMMARY_UNKNOWN_WELL, InputError::WARN); - tmp.emplace_back(ParseContext::SUMMARY_UNKNOWN_GROUP, InputError::WARN); - tmp.emplace_back(ParseContext::PARSE_EXTRA_RECORDS, InputError::WARN); - - auto parseContext = std::make_unique(tmp); - - if (!ignoredKeywords.empty()) { - size_t pos; - size_t offset = 0; - while (true) { - pos = ignoredKeywords.find(':', offset); - if (pos == std::string::npos) { - parseContext->ignoreKeyword(ignoredKeywords.substr(offset)); - break; - } - parseContext->ignoreKeyword(ignoredKeywords.substr(offset, pos - offset)); - offset = pos + 1; - } - } - - if (eclStrictParsing) - parseContext->update(InputError::DELAYED_EXIT1); - - return parseContext; -} - void EclGenericVanguard::updateOutputDir_(std::string outputDir, bool enableEclCompatFile) { @@ -251,29 +210,6 @@ void EclGenericVanguard::init() std::transform(caseName_.begin(), caseName_.end(), caseName_.begin(), ::toupper); } - // Check that we are in one of the known configurations for external variables - // and move them to internal - if (true) - { - if (externalParseContext_ ) - { - parseContext_ = std::move(externalParseContext_); - } - else - { - OPM_THROW(std::logic_error, "Either parse context and error guard or ECL state, schedule, and summary config need to be" - << " set externally."); - } - } - else if (externalParseContext_) - { - parseContext_ = std::move(externalParseContext_); - } - else - { - parseContext_ = createParseContext(ignoredKeywords_, eclStrictParsing_); - } - if (EclGenericVanguard::externalUDQState_) this->udqState_ = std::move(EclGenericVanguard::externalUDQState_); else diff --git a/ebos/eclgenericvanguard.hh b/ebos/eclgenericvanguard.hh index 21799539f..347d251f6 100644 --- a/ebos/eclgenericvanguard.hh +++ b/ebos/eclgenericvanguard.hh @@ -87,12 +87,6 @@ public: */ static std::string canonicalDeckPath(const std::string& caseName); - /*! - * \brief Creates an Opm::parseContext object assuming that the parameters are ready. - */ - static std::unique_ptr createParseContext(const std::string& ignoredKeywords, - bool eclStrictParsing); - /*! * \brief Set the wall time which was spend externally to set up the external data structures * @@ -107,11 +101,6 @@ public: static double setupTime() { return setupTime_; } - /*! - * \brief Set the Opm::ParseContext object which ought to be used for parsing the deck and creating the Opm::EclipseState object. - */ - static void setExternalParseContext(std::unique_ptr parseContext); - /*! * \brief Set the Opm::Deck object which ought to be used when the simulator vanguard * is instantiated. @@ -300,7 +289,6 @@ protected: void init(); static double setupTime_; - static std::unique_ptr externalParseContext_; // These variables may be owned by both Python and the simulator static std::unique_ptr externalUDQState_; @@ -338,7 +326,6 @@ protected: // these attributes point either to the internal or to the external version of the // parser objects. - std::unique_ptr parseContext_; std::shared_ptr python; // These variables may be owned by both Python and the simulator static std::shared_ptr deck_;