From 495831c090efeb067a3eedc4fabcfac79badbbfc Mon Sep 17 00:00:00 2001 From: Vegard Kippe Date: Mon, 13 Jan 2025 13:31:09 +0100 Subject: [PATCH 1/3] Separate keyword validation for fully supported keywords --- CMakeLists_files.cmake | 1 + opm/simulators/flow/KeywordValidation.cpp | 25 +++--- opm/simulators/flow/KeywordValidation.hpp | 61 +++++++++----- .../utils/FullySupportedFlowKeywords.cpp | 80 +++++++++++++++++++ .../utils/FullySupportedFlowKeywords.hpp | 55 +++++++++++++ .../utils/PartiallySupportedFlowKeywords.cpp | 19 ++--- .../utils/PartiallySupportedFlowKeywords.hpp | 2 +- opm/simulators/utils/readDeck.cpp | 4 + 8 files changed, 202 insertions(+), 45 deletions(-) create mode 100644 opm/simulators/utils/FullySupportedFlowKeywords.cpp create mode 100644 opm/simulators/utils/FullySupportedFlowKeywords.hpp diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 1aaf0875b22..8b0f2b0fd7e 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -148,6 +148,7 @@ list (APPEND MAIN_SOURCE_FILES opm/simulators/utils/BlackoilPhases.cpp opm/simulators/utils/ComponentName.cpp opm/simulators/utils/DeferredLogger.cpp + opm/simulators/utils/FullySupportedFlowKeywords.cpp opm/simulators/utils/ParallelFileMerger.cpp opm/simulators/utils/ParallelRestart.cpp opm/simulators/utils/PartiallySupportedFlowKeywords.cpp diff --git a/opm/simulators/flow/KeywordValidation.cpp b/opm/simulators/flow/KeywordValidation.cpp index 49aaec4bbf3..5cddfcc9d5b 100644 --- a/opm/simulators/flow/KeywordValidation.cpp +++ b/opm/simulators/flow/KeywordValidation.cpp @@ -123,29 +123,32 @@ namespace Opm::KeywordValidation { void KeywordValidator::validateDeckKeyword(const DeckKeyword& keyword, std::vector& errors) const { - const auto& it = m_keywords.find(keyword.name()); - if (it != m_keywords.end()) { + const auto& it = m_unsupported_keywords.find(keyword.name()); + if (it != m_unsupported_keywords.end()) { // If the keyword is not supported, add an error for that. const auto& properties = it->second; errors.push_back(ValidationError { properties.critical, keyword.location(), 1, std::nullopt, std::nullopt, properties.message}); } else { // Otherwise, check all its items. - validateKeywordItems(keyword, m_string_items, errors); - validateKeywordItems(keyword, m_int_items, errors); - validateKeywordItems(keyword, m_double_items, errors); + validateKeywordItems(keyword, m_partially_supported_string_items, errors); + validateKeywordItems(keyword, m_partially_supported_int_items, errors); + validateKeywordItems(keyword, m_partially_supported_double_items, errors); + validateKeywordItems(keyword, m_fully_supported_string_items, errors); + validateKeywordItems(keyword, m_fully_supported_int_items, errors); + validateKeywordItems(keyword, m_fully_supported_double_items, errors); } } template void KeywordValidator::validateKeywordItems(const DeckKeyword& keyword, - const PartiallySupportedKeywords& partially_supported_items, + const SupportedKeywords& partially_or_fully_supported_items, std::vector& errors) const { - const auto& keyword_properties = partially_supported_items.find(keyword.name()); - if (keyword_properties != partially_supported_items.end()) { - // If this keyworcs has partially supported items, iterate over all of them. + const auto& keyword_properties = partially_or_fully_supported_items.find(keyword.name()); + if (keyword_properties != partially_or_fully_supported_items.end()) { + // If this keywords has partially or fully supported items to validate, iterate over all of them. for (std::size_t record_index = 0; record_index < keyword.size(); record_index++) { const auto& record = keyword.getRecord(record_index); for (std::size_t item_index = 0; item_index < record.size(); item_index++) { @@ -154,7 +157,7 @@ namespace Opm::KeywordValidation { const auto& item_properties = keyword_properties->second.find(item_index + 1); if (item_properties != keyword_properties->second.end()) { if (item.hasValue(0)) { - // Validate the item, if it is partially supported. + // Validate the item validateKeywordItem(keyword, item_properties->second, keyword.size() > 1, @@ -172,7 +175,7 @@ namespace Opm::KeywordValidation { template void KeywordValidator::validateKeywordItem(const DeckKeyword& keyword, - const PartiallySupportedKeywordProperties& properties, + const SupportedKeywordProperties& properties, const bool multiple_records, const std::size_t record_index, const std::size_t item_index, diff --git a/opm/simulators/flow/KeywordValidation.hpp b/opm/simulators/flow/KeywordValidation.hpp index c160f2abb03..0a66fa6e1bd 100644 --- a/opm/simulators/flow/KeywordValidation.hpp +++ b/opm/simulators/flow/KeywordValidation.hpp @@ -20,6 +20,7 @@ #ifndef OPM_KEYWORDVALIDATION_HEADER_INCLUDED #define OPM_KEYWORDVALIDATION_HEADER_INCLUDED +#include #include #include @@ -49,10 +50,10 @@ namespace KeywordValidation std::optional message; // An optional message to show if the keyword is present }; - // Describe a partially supported keyword item, by listing legal values: + // Describe a partially or fully supported keyword item, by listing legal values: template - struct PartiallySupportedKeywordProperties { - bool critical; // Set to true if the unsupported item value should be an error + struct SupportedKeywordProperties { + bool critical; // Set to true if an unsupported or invalid item value should be an error std::function validator; // Predicate function to test values std::optional message; // An optional message to show if an illegal item is encountered }; @@ -62,11 +63,11 @@ namespace KeywordValidation // This is used to list the partially supported items of a keyword: template - using PartiallySupportedKeywordItems = std::map>; + using SupportedKeywordItems = std::map>; - // This is used to list the keywords that have partially supported items: + // This is used to list the keywords that have partially supported items or items that benefit from early validation: template - using PartiallySupportedKeywords = std::map>; + using SupportedKeywords = std::map>; // This contains the information needed to report a single error occurence. // The validator will construct a vector of these, copying the relevant @@ -91,15 +92,21 @@ namespace KeywordValidation class KeywordValidator { public: - KeywordValidator(const UnsupportedKeywords& keywords, - const PartiallySupportedKeywords& string_items, - const PartiallySupportedKeywords& int_items, - const PartiallySupportedKeywords& double_items, + KeywordValidator(const UnsupportedKeywords& unsupported_keywords, + const SupportedKeywords& partially_supported_string_items, + const SupportedKeywords& partially_supported_int_items, + const SupportedKeywords& partially_supported_double_items, + const SupportedKeywords& fully_supported_string_items, + const SupportedKeywords& fully_supported_int_items, + const SupportedKeywords& fully_supported_double_items, const std::unordered_map& special_validation) - : m_keywords(keywords) - , m_string_items(string_items) - , m_int_items(int_items) - , m_double_items(double_items) + : m_unsupported_keywords(unsupported_keywords) + , m_partially_supported_string_items(partially_supported_string_items) + , m_partially_supported_int_items(partially_supported_int_items) + , m_partially_supported_double_items(partially_supported_double_items) + , m_fully_supported_string_items(fully_supported_string_items) + , m_fully_supported_int_items(fully_supported_int_items) + , m_fully_supported_double_items(fully_supported_double_items) , m_special_validation(special_validation) { } @@ -121,7 +128,7 @@ namespace KeywordValidation private: template void validateKeywordItem(const DeckKeyword& keyword, - const PartiallySupportedKeywordProperties& properties, + const SupportedKeywordProperties& properties, const bool multiple_records, const std::size_t record_number, const std::size_t item_number, @@ -131,13 +138,16 @@ namespace KeywordValidation template void validateKeywordItems(const DeckKeyword& keyword, - const PartiallySupportedKeywords& partially_supported_options, + const SupportedKeywords& supported_options, std::vector& errors) const; - const UnsupportedKeywords m_keywords; - const PartiallySupportedKeywords m_string_items; - const PartiallySupportedKeywords m_int_items; - const PartiallySupportedKeywords m_double_items; + const UnsupportedKeywords m_unsupported_keywords; + const SupportedKeywords m_partially_supported_string_items; + const SupportedKeywords m_partially_supported_int_items; + const SupportedKeywords m_partially_supported_double_items; + const SupportedKeywords m_fully_supported_string_items; + const SupportedKeywords m_fully_supported_int_items; + const SupportedKeywords m_fully_supported_double_items; const std::unordered_map m_special_validation; }; @@ -163,6 +173,17 @@ namespace KeywordValidation std::vector m_allowed_values; }; + // Helper to test if given string value is convertible to bool (see DeckItem::to_bool) + struct is_bool_convertible { + is_bool_convertible() {} + bool operator()(const std::string& value) const { + try { + return DeckItem::to_bool(value) || true; + } catch (const std::invalid_argument& e) { + return false; + } + } + }; } // namespace KeywordValidation diff --git a/opm/simulators/utils/FullySupportedFlowKeywords.cpp b/opm/simulators/utils/FullySupportedFlowKeywords.cpp new file mode 100644 index 00000000000..3588b663405 --- /dev/null +++ b/opm/simulators/utils/FullySupportedFlowKeywords.cpp @@ -0,0 +1,80 @@ +/* + Copyright 2021 Equinor. + + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . +*/ + +#if HAVE_CONFIG_H +#include "config.h" +#endif // HAVE_CONFIG_H + +#include + +using namespace Opm::KeywordValidation; +namespace Opm::FlowKeywordValidation +{ + +template <> +const SupportedKeywords& +fullySupported() +{ + static const SupportedKeywords fully_supported_keywords_strings = { + { + "NEXTSTEP", + { + {2,{true, is_bool_convertible {}, "NEXTSTEP(NSTEP2): String value must be convertible to bool."}}, // APPLY_TO_FUTURE_REPORT_STEPS + }, + }, + { + "WCONHIST", + { + {3,{true, allow_values {"ORAT", "WRAT", "GRAT", "LRAT", "RESV", "BHP"}, "WCONHIST(TARGET): should be set to ORAT/WRAT/GRAT/LRAT/RESV or BHP"}}, // CMODE + }, + }, + }; + + return fully_supported_keywords_strings; +} + + + +template <> +const SupportedKeywords& +fullySupported() +{ + static const SupportedKeywords fully_supported_keywords_int = { + }; + + return fully_supported_keywords_int; +} + +template <> +const SupportedKeywords& +fullySupported() +{ + static const SupportedKeywords fully_supported_keywords_double = { + { + "WPIMULT", + { + {2,{true, [](double x) { return x > 0; }, "WPIMULT(PIMULT): Well PI multiplier must be a positive number."}}, // PI_MULTIPLIER + }, + }, + }; + + return fully_supported_keywords_double; +} + +} // namespace Opm::FlowKeywordValidation diff --git a/opm/simulators/utils/FullySupportedFlowKeywords.hpp b/opm/simulators/utils/FullySupportedFlowKeywords.hpp new file mode 100644 index 00000000000..43c7e3c526c --- /dev/null +++ b/opm/simulators/utils/FullySupportedFlowKeywords.hpp @@ -0,0 +1,55 @@ +/* + Copyright 2024 Equinor. + + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . +*/ + +#ifndef OPM_FULLYSUPPORTEDFLOWKEYWORDS_HEADER_INCLUDED +#define OPM_FULLYSUPPORTEDFLOWKEYWORDS_HEADER_INCLUDED + + +#include + +#include + +/* + Here keywords are defined that are fully supported by flow, but nevertheless + can benefit from a preliminary high-level non-contextual verification. + + The keywords are specified in a mapping with the keyword names as keys, and + values that describe the set of supported items. These are described by a + mapping from the item name to a struct of properties, defined in KeywordValidation.hpp. + + This struct has the following fields: + + critical (bool) : if this is a critical error. + validator (function wrapper) : A function wrapper object that is used to test values. + message (itemal string): an optional message to add to the error reported by flow. + + For convenience there is a small class KeywordValidation::allow_values which + can be initialized with a list of permitted values, and used as a validator. +*/ + +namespace Opm::FlowKeywordValidation +{ + +template +const KeywordValidation::SupportedKeywords& fullySupported(); + +} // namespace Opm::FlowKeywordValidation + + +#endif diff --git a/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp b/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp index 96b4595c8b4..d330735433d 100644 --- a/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp +++ b/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp @@ -28,10 +28,10 @@ namespace Opm::FlowKeywordValidation { template <> -const PartiallySupportedKeywords& +const SupportedKeywords& partiallySupported() { - static const PartiallySupportedKeywords partially_supported_keywords_strings = { + static const SupportedKeywords partially_supported_keywords_strings = { { "BRANPROP", { @@ -273,13 +273,6 @@ partiallySupported() {5,{true, allow_values {"NO"}, "WAGHYSTR(WATER_MODEL): only the NO option is supported – will STOP"}}, // WATER_MODEL }, }, - - { - "WCONHIST", - { - {3,{true, allow_values {"ORAT", "WRAT", "GRAT", "LRAT", "RESV", "BHP"}, "WCONHIST(TARGET): should be set to ORAT/WRAT/GRAT/LRAT/RESV or BHP"}}, // CMODE - }, - }, { "WEFAC", { @@ -351,10 +344,10 @@ partiallySupported() } template <> -const KeywordValidation::PartiallySupportedKeywords& +const KeywordValidation::SupportedKeywords& partiallySupported() { - static const KeywordValidation::PartiallySupportedKeywordspartially_supported_keywords_int = { + static const KeywordValidation::SupportedKeywordspartially_supported_keywords_int = { { "EDITNNC", { @@ -535,10 +528,10 @@ partiallySupported() } template <> -const KeywordValidation::PartiallySupportedKeywords& +const KeywordValidation::SupportedKeywords& partiallySupported() { - static const KeywordValidation::PartiallySupportedKeywords partially_supported_keywords_double = { + static const KeywordValidation::SupportedKeywords partially_supported_keywords_double = { { "AQUCON", { diff --git a/opm/simulators/utils/PartiallySupportedFlowKeywords.hpp b/opm/simulators/utils/PartiallySupportedFlowKeywords.hpp index 338726abdf0..98c460bf5ab 100644 --- a/opm/simulators/utils/PartiallySupportedFlowKeywords.hpp +++ b/opm/simulators/utils/PartiallySupportedFlowKeywords.hpp @@ -47,7 +47,7 @@ namespace Opm::FlowKeywordValidation { template -const KeywordValidation::PartiallySupportedKeywords& partiallySupported(); +const KeywordValidation::SupportedKeywords& partiallySupported(); } // namespace Opm::FlowKeywordValidation diff --git a/opm/simulators/utils/readDeck.cpp b/opm/simulators/utils/readDeck.cpp index bdb16c75a7c..01a4d74b25f 100644 --- a/opm/simulators/utils/readDeck.cpp +++ b/opm/simulators/utils/readDeck.cpp @@ -63,6 +63,7 @@ #include #include +#include #include #include #include @@ -210,6 +211,9 @@ namespace { Opm::FlowKeywordValidation::partiallySupported(), Opm::FlowKeywordValidation::partiallySupported(), Opm::FlowKeywordValidation::partiallySupported(), + Opm::FlowKeywordValidation::fullySupported(), + Opm::FlowKeywordValidation::fullySupported(), + Opm::FlowKeywordValidation::fullySupported(), Opm::KeywordValidation::specialValidation() }; From 2cd0d63fe44d8c1625e2aedc15df8f9c373f7749 Mon Sep 17 00:00:00 2001 From: Vegard Kippe Date: Mon, 13 Jan 2025 14:34:30 +0100 Subject: [PATCH 2/3] Update KeywordValidator tests to new constructor signature --- tests/test_keyword_validator.cpp | 58 ++++++++++++++++---------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/tests/test_keyword_validator.cpp b/tests/test_keyword_validator.cpp index feeaa6b329a..a31f02a39ba 100644 --- a/tests/test_keyword_validator.cpp +++ b/tests/test_keyword_validator.cpp @@ -40,7 +40,7 @@ const UnsupportedKeywords test_unsupported_keywords = { }; -const PartiallySupportedKeywords test_string_items = { +const SupportedKeywords test_string_items = { { "PINCH", { @@ -58,7 +58,7 @@ const PartiallySupportedKeywords test_string_items = { }; -const PartiallySupportedKeywords test_int_items = { +const SupportedKeywords test_int_items = { { "ENDSCALE", { @@ -76,7 +76,7 @@ const PartiallySupportedKeywords test_int_items = { }; -const PartiallySupportedKeywords test_double_items = { +const SupportedKeywords test_double_items = { { "EHYSTR", { @@ -95,7 +95,7 @@ ECHO )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ECHO"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(!errors[0].critical); @@ -112,7 +112,7 @@ NOECHO )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["NOECHO"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(errors[0].critical); @@ -130,7 +130,7 @@ PINCH )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["PINCH"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(!errors[0].critical); @@ -148,7 +148,7 @@ PINCH )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["PINCH"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(errors[0].critical); @@ -166,7 +166,7 @@ ENDSCALE )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(!errors[0].critical); @@ -184,7 +184,7 @@ ENDSCALE )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(errors[0].critical); @@ -201,7 +201,7 @@ EHYSTR )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["EHYSTR"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(errors.size() == 0); @@ -215,7 +215,7 @@ EHYSTR )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["EHYSTR"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(!errors[0].critical); @@ -232,7 +232,7 @@ EHYSTR )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["EHYSTR"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(!errors[0].critical); @@ -252,7 +252,7 @@ ENDSCALE const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword1 = deck["PINCH"].back(); const auto& test_keyword2 = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword1, errors); validator.validateDeckKeyword(test_keyword2, errors); @@ -274,7 +274,7 @@ ECHO )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ECHO"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, true, false); @@ -293,7 +293,7 @@ ECHO )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ECHO"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, false, true); @@ -308,7 +308,7 @@ NOECHO )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["NOECHO"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, false, true); @@ -326,7 +326,7 @@ NOECHO )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["NOECHO"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, true, false); @@ -342,7 +342,7 @@ PINCH )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["PINCH"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, true, false); @@ -365,7 +365,7 @@ COMPDAT )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["COMPDAT"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, true, false); @@ -386,7 +386,7 @@ PINCH )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["PINCH"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, false, true); @@ -402,7 +402,7 @@ ENDSCALE )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, true, false); @@ -421,7 +421,7 @@ ENDSCALE )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, false, true); @@ -437,7 +437,7 @@ ENDSCALE )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, false, true); @@ -456,7 +456,7 @@ ENDSCALE )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, true, false); @@ -479,7 +479,7 @@ ENDSCALE const auto& test_keyword2 = deck["NOECHO"].back(); const auto& test_keyword3 = deck["PINCH"].back(); const auto& test_keyword4 = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword1, errors); validator.validateDeckKeyword(test_keyword2, errors); @@ -510,7 +510,7 @@ ENDSCALE const auto& test_keyword2 = deck["NOECHO"].back(); const auto& test_keyword3 = deck["PINCH"].back(); const auto& test_keyword4 = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword1, errors); validator.validateDeckKeyword(test_keyword2, errors); @@ -535,7 +535,7 @@ EQLOPTS )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["EQLOPTS"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(errors.size() == 0); @@ -551,7 +551,7 @@ EQLOPTS )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["EQLOPTS"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(errors.size() == 1); @@ -570,7 +570,7 @@ EQLOPTS )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["EQLOPTS"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}); + KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(errors.size() == 0); From 76667d613b9b4e6583a3fb1c06efde5be74ec34e Mon Sep 17 00:00:00 2001 From: Vegard Kippe Date: Wed, 15 Jan 2025 13:34:05 +0100 Subject: [PATCH 3/3] Introduce struct to reduce number of constructor params --- opm/simulators/flow/KeywordValidation.cpp | 18 +++--- opm/simulators/flow/KeywordValidation.hpp | 39 ++++++------ .../utils/FullySupportedFlowKeywords.cpp | 12 ++-- .../utils/FullySupportedFlowKeywords.hpp | 2 +- .../utils/PartiallySupportedFlowKeywords.cpp | 12 ++-- .../utils/PartiallySupportedFlowKeywords.hpp | 2 +- opm/simulators/utils/readDeck.cpp | 16 +++-- tests/test_keyword_validator.cpp | 61 ++++++++++--------- 8 files changed, 86 insertions(+), 76 deletions(-) diff --git a/opm/simulators/flow/KeywordValidation.cpp b/opm/simulators/flow/KeywordValidation.cpp index 5cddfcc9d5b..6a0df370904 100644 --- a/opm/simulators/flow/KeywordValidation.cpp +++ b/opm/simulators/flow/KeywordValidation.cpp @@ -131,19 +131,23 @@ namespace Opm::KeywordValidation { properties.critical, keyword.location(), 1, std::nullopt, std::nullopt, properties.message}); } else { // Otherwise, check all its items. - validateKeywordItems(keyword, m_partially_supported_string_items, errors); - validateKeywordItems(keyword, m_partially_supported_int_items, errors); - validateKeywordItems(keyword, m_partially_supported_double_items, errors); - validateKeywordItems(keyword, m_fully_supported_string_items, errors); - validateKeywordItems(keyword, m_fully_supported_int_items, errors); - validateKeywordItems(keyword, m_fully_supported_double_items, errors); + validateKeywordItems(keyword, m_partially_supported_keywords, errors); + validateKeywordItems(keyword, m_fully_supported_keywords, errors); } } + void KeywordValidator::validateKeywordItems(const DeckKeyword& keyword, + const SupportedKeywords& keyword_items, + std::vector& errors) const + { + validateKeywordItems(keyword, keyword_items.string_items, errors); + validateKeywordItems(keyword, keyword_items.int_items, errors); + validateKeywordItems(keyword, keyword_items.double_items, errors); + } template void KeywordValidator::validateKeywordItems(const DeckKeyword& keyword, - const SupportedKeywords& partially_or_fully_supported_items, + const SupportedKeywordItems& partially_or_fully_supported_items, std::vector& errors) const { const auto& keyword_properties = partially_or_fully_supported_items.find(keyword.name()); diff --git a/opm/simulators/flow/KeywordValidation.hpp b/opm/simulators/flow/KeywordValidation.hpp index 0a66fa6e1bd..cff1210a589 100644 --- a/opm/simulators/flow/KeywordValidation.hpp +++ b/opm/simulators/flow/KeywordValidation.hpp @@ -63,11 +63,11 @@ namespace KeywordValidation // This is used to list the partially supported items of a keyword: template - using SupportedKeywordItems = std::map>; + using SupportedSingleKeywordItems = std::map>; // This is used to list the keywords that have partially supported items or items that benefit from early validation: template - using SupportedKeywords = std::map>; + using SupportedKeywordItems = std::map>; // This contains the information needed to report a single error occurence. // The validator will construct a vector of these, copying the relevant @@ -89,24 +89,22 @@ namespace KeywordValidation const bool include_noncritical, const bool include_critical); +struct SupportedKeywords { + const SupportedKeywordItems string_items; + const SupportedKeywordItems int_items; + const SupportedKeywordItems double_items; +}; + class KeywordValidator { public: KeywordValidator(const UnsupportedKeywords& unsupported_keywords, - const SupportedKeywords& partially_supported_string_items, - const SupportedKeywords& partially_supported_int_items, - const SupportedKeywords& partially_supported_double_items, - const SupportedKeywords& fully_supported_string_items, - const SupportedKeywords& fully_supported_int_items, - const SupportedKeywords& fully_supported_double_items, + const SupportedKeywords& partially_supported_keywords, + const SupportedKeywords& fully_supported_keywords, const std::unordered_map& special_validation) : m_unsupported_keywords(unsupported_keywords) - , m_partially_supported_string_items(partially_supported_string_items) - , m_partially_supported_int_items(partially_supported_int_items) - , m_partially_supported_double_items(partially_supported_double_items) - , m_fully_supported_string_items(fully_supported_string_items) - , m_fully_supported_int_items(fully_supported_int_items) - , m_fully_supported_double_items(fully_supported_double_items) + , m_partially_supported_keywords(partially_supported_keywords) + , m_fully_supported_keywords(fully_supported_keywords) , m_special_validation(special_validation) { } @@ -135,19 +133,18 @@ namespace KeywordValidation const T& item_value, std::vector& errors) const; + void validateKeywordItems(const DeckKeyword& keyword, + const SupportedKeywords& keyword_items, + std::vector& errors) const; template void validateKeywordItems(const DeckKeyword& keyword, - const SupportedKeywords& supported_options, + const SupportedKeywordItems& supported_options, std::vector& errors) const; const UnsupportedKeywords m_unsupported_keywords; - const SupportedKeywords m_partially_supported_string_items; - const SupportedKeywords m_partially_supported_int_items; - const SupportedKeywords m_partially_supported_double_items; - const SupportedKeywords m_fully_supported_string_items; - const SupportedKeywords m_fully_supported_int_items; - const SupportedKeywords m_fully_supported_double_items; + const SupportedKeywords m_partially_supported_keywords; + const SupportedKeywords m_fully_supported_keywords; const std::unordered_map m_special_validation; }; diff --git a/opm/simulators/utils/FullySupportedFlowKeywords.cpp b/opm/simulators/utils/FullySupportedFlowKeywords.cpp index 3588b663405..ea13034b692 100644 --- a/opm/simulators/utils/FullySupportedFlowKeywords.cpp +++ b/opm/simulators/utils/FullySupportedFlowKeywords.cpp @@ -28,10 +28,10 @@ namespace Opm::FlowKeywordValidation { template <> -const SupportedKeywords& +const SupportedKeywordItems& fullySupported() { - static const SupportedKeywords fully_supported_keywords_strings = { + static const SupportedKeywordItems fully_supported_keywords_strings = { { "NEXTSTEP", { @@ -52,20 +52,20 @@ fullySupported() template <> -const SupportedKeywords& +const SupportedKeywordItems& fullySupported() { - static const SupportedKeywords fully_supported_keywords_int = { + static const SupportedKeywordItems fully_supported_keywords_int = { }; return fully_supported_keywords_int; } template <> -const SupportedKeywords& +const SupportedKeywordItems& fullySupported() { - static const SupportedKeywords fully_supported_keywords_double = { + static const SupportedKeywordItems fully_supported_keywords_double = { { "WPIMULT", { diff --git a/opm/simulators/utils/FullySupportedFlowKeywords.hpp b/opm/simulators/utils/FullySupportedFlowKeywords.hpp index 43c7e3c526c..d1015c17c93 100644 --- a/opm/simulators/utils/FullySupportedFlowKeywords.hpp +++ b/opm/simulators/utils/FullySupportedFlowKeywords.hpp @@ -47,7 +47,7 @@ namespace Opm::FlowKeywordValidation { template -const KeywordValidation::SupportedKeywords& fullySupported(); +const KeywordValidation::SupportedKeywordItems& fullySupported(); } // namespace Opm::FlowKeywordValidation diff --git a/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp b/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp index d330735433d..af5860b00df 100644 --- a/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp +++ b/opm/simulators/utils/PartiallySupportedFlowKeywords.cpp @@ -28,10 +28,10 @@ namespace Opm::FlowKeywordValidation { template <> -const SupportedKeywords& +const SupportedKeywordItems& partiallySupported() { - static const SupportedKeywords partially_supported_keywords_strings = { + static const SupportedKeywordItems partially_supported_keywords_strings = { { "BRANPROP", { @@ -344,10 +344,10 @@ partiallySupported() } template <> -const KeywordValidation::SupportedKeywords& +const KeywordValidation::SupportedKeywordItems& partiallySupported() { - static const KeywordValidation::SupportedKeywordspartially_supported_keywords_int = { + static const KeywordValidation::SupportedKeywordItemspartially_supported_keywords_int = { { "EDITNNC", { @@ -528,10 +528,10 @@ partiallySupported() } template <> -const KeywordValidation::SupportedKeywords& +const KeywordValidation::SupportedKeywordItems& partiallySupported() { - static const KeywordValidation::SupportedKeywords partially_supported_keywords_double = { + static const KeywordValidation::SupportedKeywordItems partially_supported_keywords_double = { { "AQUCON", { diff --git a/opm/simulators/utils/PartiallySupportedFlowKeywords.hpp b/opm/simulators/utils/PartiallySupportedFlowKeywords.hpp index 98c460bf5ab..5b8bb6cb8eb 100644 --- a/opm/simulators/utils/PartiallySupportedFlowKeywords.hpp +++ b/opm/simulators/utils/PartiallySupportedFlowKeywords.hpp @@ -47,7 +47,7 @@ namespace Opm::FlowKeywordValidation { template -const KeywordValidation::SupportedKeywords& partiallySupported(); +const KeywordValidation::SupportedKeywordItems& partiallySupported(); } // namespace Opm::FlowKeywordValidation diff --git a/opm/simulators/utils/readDeck.cpp b/opm/simulators/utils/readDeck.cpp index 01a4d74b25f..81bd58fa263 100644 --- a/opm/simulators/utils/readDeck.cpp +++ b/opm/simulators/utils/readDeck.cpp @@ -206,14 +206,22 @@ namespace { { Opm::Deck deck(parser.parseFile(deckFilename, parseContext, errorGuard)); - auto keyword_validator = Opm::KeywordValidation::KeywordValidator { - Opm::FlowKeywordValidation::unsupportedKeywords(), + Opm::KeywordValidation::SupportedKeywords partiallySupported { Opm::FlowKeywordValidation::partiallySupported(), Opm::FlowKeywordValidation::partiallySupported(), - Opm::FlowKeywordValidation::partiallySupported(), + Opm::FlowKeywordValidation::partiallySupported() + }; + + Opm::KeywordValidation::SupportedKeywords fullySupported { Opm::FlowKeywordValidation::fullySupported(), Opm::FlowKeywordValidation::fullySupported(), - Opm::FlowKeywordValidation::fullySupported(), + Opm::FlowKeywordValidation::fullySupported() + }; + + auto keyword_validator = Opm::KeywordValidation::KeywordValidator { + Opm::FlowKeywordValidation::unsupportedKeywords(), + partiallySupported, + fullySupported, Opm::KeywordValidation::specialValidation() }; diff --git a/tests/test_keyword_validator.cpp b/tests/test_keyword_validator.cpp index a31f02a39ba..4f43a15b3b8 100644 --- a/tests/test_keyword_validator.cpp +++ b/tests/test_keyword_validator.cpp @@ -40,7 +40,7 @@ const UnsupportedKeywords test_unsupported_keywords = { }; -const SupportedKeywords test_string_items = { +const SupportedKeywordItems test_string_items = { { "PINCH", { @@ -58,7 +58,7 @@ const SupportedKeywords test_string_items = { }; -const SupportedKeywords test_int_items = { +const SupportedKeywordItems test_int_items = { { "ENDSCALE", { @@ -76,7 +76,7 @@ const SupportedKeywords test_int_items = { }; -const SupportedKeywords test_double_items = { +const SupportedKeywordItems test_double_items = { { "EHYSTR", { @@ -86,7 +86,8 @@ const SupportedKeywords test_double_items = { }, }; - +const SupportedKeywords partiallySupported { test_string_items, test_int_items, test_double_items }; +const SupportedKeywords fullySupported { {}, {}, {} }; BOOST_AUTO_TEST_CASE(non_critical_keyword) { @@ -95,7 +96,7 @@ ECHO )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ECHO"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(!errors[0].critical); @@ -112,7 +113,7 @@ NOECHO )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["NOECHO"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(errors[0].critical); @@ -130,7 +131,7 @@ PINCH )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["PINCH"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(!errors[0].critical); @@ -148,7 +149,7 @@ PINCH )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["PINCH"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(errors[0].critical); @@ -166,7 +167,7 @@ ENDSCALE )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(!errors[0].critical); @@ -184,7 +185,7 @@ ENDSCALE )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(errors[0].critical); @@ -201,7 +202,7 @@ EHYSTR )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["EHYSTR"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(errors.size() == 0); @@ -215,7 +216,7 @@ EHYSTR )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["EHYSTR"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(!errors[0].critical); @@ -232,7 +233,7 @@ EHYSTR )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["EHYSTR"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(!errors[0].critical); @@ -252,7 +253,7 @@ ENDSCALE const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword1 = deck["PINCH"].back(); const auto& test_keyword2 = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword1, errors); validator.validateDeckKeyword(test_keyword2, errors); @@ -274,7 +275,7 @@ ECHO )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ECHO"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, true, false); @@ -293,7 +294,7 @@ ECHO )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ECHO"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, false, true); @@ -308,7 +309,7 @@ NOECHO )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["NOECHO"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, false, true); @@ -326,7 +327,7 @@ NOECHO )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["NOECHO"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, true, false); @@ -342,7 +343,7 @@ PINCH )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["PINCH"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, true, false); @@ -365,7 +366,7 @@ COMPDAT )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["COMPDAT"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, true, false); @@ -386,7 +387,7 @@ PINCH )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["PINCH"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, false, true); @@ -402,7 +403,7 @@ ENDSCALE )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, true, false); @@ -421,7 +422,7 @@ ENDSCALE )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, false, true); @@ -437,7 +438,7 @@ ENDSCALE )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, false, true); @@ -456,7 +457,7 @@ ENDSCALE )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); const auto report = get_error_report(errors, true, false); @@ -479,7 +480,7 @@ ENDSCALE const auto& test_keyword2 = deck["NOECHO"].back(); const auto& test_keyword3 = deck["PINCH"].back(); const auto& test_keyword4 = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword1, errors); validator.validateDeckKeyword(test_keyword2, errors); @@ -510,7 +511,7 @@ ENDSCALE const auto& test_keyword2 = deck["NOECHO"].back(); const auto& test_keyword3 = deck["PINCH"].back(); const auto& test_keyword4 = deck["ENDSCALE"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword1, errors); validator.validateDeckKeyword(test_keyword2, errors); @@ -535,7 +536,7 @@ EQLOPTS )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["EQLOPTS"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(errors.size() == 0); @@ -551,7 +552,7 @@ EQLOPTS )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["EQLOPTS"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(errors.size() == 1); @@ -570,7 +571,7 @@ EQLOPTS )"}; const auto deck = Parser {}.parseString(keywords_string); const auto& test_keyword = deck["EQLOPTS"].back(); - KeywordValidator validator(test_unsupported_keywords, test_string_items, test_int_items, test_double_items, {}, {}, {}, {}); + KeywordValidator validator(test_unsupported_keywords, partiallySupported, fullySupported, {}); std::vector errors; validator.validateDeckKeyword(test_keyword, errors); BOOST_CHECK(errors.size() == 0);