Merge pull request #5866 from vkip/fully_supported_validation

Separate keyword validation for fully supported keywords
This commit is contained in:
Kai Bao 2025-02-06 10:06:46 +01:00 committed by GitHub
commit a799f463fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 245 additions and 78 deletions

View File

@ -153,6 +153,7 @@ list (APPEND MAIN_SOURCE_FILES
opm/simulators/utils/BlackoilPhases.cpp opm/simulators/utils/BlackoilPhases.cpp
opm/simulators/utils/ComponentName.cpp opm/simulators/utils/ComponentName.cpp
opm/simulators/utils/DeferredLogger.cpp opm/simulators/utils/DeferredLogger.cpp
opm/simulators/utils/FullySupportedFlowKeywords.cpp
opm/simulators/utils/ParallelFileMerger.cpp opm/simulators/utils/ParallelFileMerger.cpp
opm/simulators/utils/ParallelRestart.cpp opm/simulators/utils/ParallelRestart.cpp
opm/simulators/utils/PartiallySupportedFlowKeywords.cpp opm/simulators/utils/PartiallySupportedFlowKeywords.cpp

View File

@ -123,29 +123,36 @@ namespace Opm::KeywordValidation {
void KeywordValidator::validateDeckKeyword(const DeckKeyword& keyword, std::vector<ValidationError>& errors) const void KeywordValidator::validateDeckKeyword(const DeckKeyword& keyword, std::vector<ValidationError>& errors) const
{ {
const auto& it = m_keywords.find(keyword.name()); const auto& it = m_unsupported_keywords.find(keyword.name());
if (it != m_keywords.end()) { if (it != m_unsupported_keywords.end()) {
// If the keyword is not supported, add an error for that. // If the keyword is not supported, add an error for that.
const auto& properties = it->second; const auto& properties = it->second;
errors.push_back(ValidationError { errors.push_back(ValidationError {
properties.critical, keyword.location(), 1, std::nullopt, std::nullopt, properties.message}); properties.critical, keyword.location(), 1, std::nullopt, std::nullopt, properties.message});
} else { } else {
// Otherwise, check all its items. // Otherwise, check all its items.
validateKeywordItems(keyword, m_string_items, errors); validateKeywordItems(keyword, m_partially_supported_keywords, errors);
validateKeywordItems(keyword, m_int_items, errors); validateKeywordItems(keyword, m_fully_supported_keywords, errors);
validateKeywordItems(keyword, m_double_items, errors);
} }
} }
void KeywordValidator::validateKeywordItems(const DeckKeyword& keyword,
const SupportedKeywords& keyword_items,
std::vector<ValidationError>& errors) const
{
validateKeywordItems(keyword, keyword_items.string_items, errors);
validateKeywordItems(keyword, keyword_items.int_items, errors);
validateKeywordItems(keyword, keyword_items.double_items, errors);
}
template <typename T> template <typename T>
void KeywordValidator::validateKeywordItems(const DeckKeyword& keyword, void KeywordValidator::validateKeywordItems(const DeckKeyword& keyword,
const PartiallySupportedKeywords<T>& partially_supported_items, const SupportedKeywordItems<T>& partially_or_fully_supported_items,
std::vector<ValidationError>& errors) const std::vector<ValidationError>& errors) const
{ {
const auto& keyword_properties = partially_supported_items.find(keyword.name()); const auto& keyword_properties = partially_or_fully_supported_items.find(keyword.name());
if (keyword_properties != partially_supported_items.end()) { if (keyword_properties != partially_or_fully_supported_items.end()) {
// If this keyworcs has partially supported items, iterate over all of them. // 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++) { for (std::size_t record_index = 0; record_index < keyword.size(); record_index++) {
const auto& record = keyword.getRecord(record_index); const auto& record = keyword.getRecord(record_index);
for (std::size_t item_index = 0; item_index < record.size(); item_index++) { for (std::size_t item_index = 0; item_index < record.size(); item_index++) {
@ -154,7 +161,7 @@ namespace Opm::KeywordValidation {
const auto& item_properties = keyword_properties->second.find(item_index + 1); const auto& item_properties = keyword_properties->second.find(item_index + 1);
if (item_properties != keyword_properties->second.end()) { if (item_properties != keyword_properties->second.end()) {
if (item.hasValue(0)) { if (item.hasValue(0)) {
// Validate the item, if it is partially supported. // Validate the item
validateKeywordItem<T>(keyword, validateKeywordItem<T>(keyword,
item_properties->second, item_properties->second,
keyword.size() > 1, keyword.size() > 1,
@ -172,7 +179,7 @@ namespace Opm::KeywordValidation {
template <typename T> template <typename T>
void KeywordValidator::validateKeywordItem(const DeckKeyword& keyword, void KeywordValidator::validateKeywordItem(const DeckKeyword& keyword,
const PartiallySupportedKeywordProperties<T>& properties, const SupportedKeywordProperties<T>& properties,
const bool multiple_records, const bool multiple_records,
const std::size_t record_index, const std::size_t record_index,
const std::size_t item_index, const std::size_t item_index,

View File

@ -20,6 +20,7 @@
#ifndef OPM_KEYWORDVALIDATION_HEADER_INCLUDED #ifndef OPM_KEYWORDVALIDATION_HEADER_INCLUDED
#define OPM_KEYWORDVALIDATION_HEADER_INCLUDED #define OPM_KEYWORDVALIDATION_HEADER_INCLUDED
#include <opm/input/eclipse/Deck/DeckItem.hpp>
#include <opm/common/OpmLog/KeywordLocation.hpp> #include <opm/common/OpmLog/KeywordLocation.hpp>
#include <opm/simulators/flow/ValidationFunctions.hpp> #include <opm/simulators/flow/ValidationFunctions.hpp>
@ -49,10 +50,10 @@ namespace KeywordValidation
std::optional<std::string> message; // An optional message to show if the keyword is present std::optional<std::string> 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 <typename T> template <typename T>
struct PartiallySupportedKeywordProperties { struct SupportedKeywordProperties {
bool critical; // Set to true if the unsupported item value should be an error bool critical; // Set to true if an unsupported or invalid item value should be an error
std::function<bool(T)> validator; // Predicate function to test values std::function<bool(T)> validator; // Predicate function to test values
std::optional<std::string> message; // An optional message to show if an illegal item is encountered std::optional<std::string> 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: // This is used to list the partially supported items of a keyword:
template <typename T> template <typename T>
using PartiallySupportedKeywordItems = std::map<std::size_t, PartiallySupportedKeywordProperties<T>>; using SupportedSingleKeywordItems = std::map<std::size_t, SupportedKeywordProperties<T>>;
// 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 <typename T> template <typename T>
using PartiallySupportedKeywords = std::map<std::string, PartiallySupportedKeywordItems<T>>; using SupportedKeywordItems = std::map<std::string, SupportedSingleKeywordItems<T>>;
// This contains the information needed to report a single error occurence. // This contains the information needed to report a single error occurence.
// The validator will construct a vector of these, copying the relevant // The validator will construct a vector of these, copying the relevant
@ -88,18 +89,22 @@ namespace KeywordValidation
const bool include_noncritical, const bool include_noncritical,
const bool include_critical); const bool include_critical);
struct SupportedKeywords {
const SupportedKeywordItems<std::string> string_items;
const SupportedKeywordItems<int> int_items;
const SupportedKeywordItems<double> double_items;
};
class KeywordValidator class KeywordValidator
{ {
public: public:
KeywordValidator(const UnsupportedKeywords& keywords, KeywordValidator(const UnsupportedKeywords& unsupported_keywords,
const PartiallySupportedKeywords<std::string>& string_items, const SupportedKeywords& partially_supported_keywords,
const PartiallySupportedKeywords<int>& int_items, const SupportedKeywords& fully_supported_keywords,
const PartiallySupportedKeywords<double>& double_items,
const std::unordered_map<std::string, ValidationFunction>& special_validation) const std::unordered_map<std::string, ValidationFunction>& special_validation)
: m_keywords(keywords) : m_unsupported_keywords(unsupported_keywords)
, m_string_items(string_items) , m_partially_supported_keywords(partially_supported_keywords)
, m_int_items(int_items) , m_fully_supported_keywords(fully_supported_keywords)
, m_double_items(double_items)
, m_special_validation(special_validation) , m_special_validation(special_validation)
{ {
} }
@ -121,23 +126,25 @@ namespace KeywordValidation
private: private:
template <typename T> template <typename T>
void validateKeywordItem(const DeckKeyword& keyword, void validateKeywordItem(const DeckKeyword& keyword,
const PartiallySupportedKeywordProperties<T>& properties, const SupportedKeywordProperties<T>& properties,
const bool multiple_records, const bool multiple_records,
const std::size_t record_number, const std::size_t record_number,
const std::size_t item_number, const std::size_t item_number,
const T& item_value, const T& item_value,
std::vector<ValidationError>& errors) const; std::vector<ValidationError>& errors) const;
void validateKeywordItems(const DeckKeyword& keyword,
const SupportedKeywords& keyword_items,
std::vector<ValidationError>& errors) const;
template <typename T> template <typename T>
void validateKeywordItems(const DeckKeyword& keyword, void validateKeywordItems(const DeckKeyword& keyword,
const PartiallySupportedKeywords<T>& partially_supported_options, const SupportedKeywordItems<T>& supported_options,
std::vector<ValidationError>& errors) const; std::vector<ValidationError>& errors) const;
const UnsupportedKeywords m_keywords; const UnsupportedKeywords m_unsupported_keywords;
const PartiallySupportedKeywords<std::string> m_string_items; const SupportedKeywords m_partially_supported_keywords;
const PartiallySupportedKeywords<int> m_int_items; const SupportedKeywords m_fully_supported_keywords;
const PartiallySupportedKeywords<double> m_double_items;
const std::unordered_map<std::string, ValidationFunction> m_special_validation; const std::unordered_map<std::string, ValidationFunction> m_special_validation;
}; };
@ -163,6 +170,17 @@ namespace KeywordValidation
std::vector<T> m_allowed_values; std::vector<T> 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 } // namespace KeywordValidation

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
#include <opm/simulators/utils/FullySupportedFlowKeywords.hpp>
using namespace Opm::KeywordValidation;
namespace Opm::FlowKeywordValidation
{
template <>
const SupportedKeywordItems<std::string>&
fullySupported()
{
static const SupportedKeywordItems<std::string> 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<std::string> {"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 SupportedKeywordItems<int>&
fullySupported()
{
static const SupportedKeywordItems<int> fully_supported_keywords_int = {
};
return fully_supported_keywords_int;
}
template <>
const SupportedKeywordItems<double>&
fullySupported()
{
static const SupportedKeywordItems<double> 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

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef OPM_FULLYSUPPORTEDFLOWKEYWORDS_HEADER_INCLUDED
#define OPM_FULLYSUPPORTEDFLOWKEYWORDS_HEADER_INCLUDED
#include <opm/simulators/flow/KeywordValidation.hpp>
#include <string>
/*
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 <typename T>
const KeywordValidation::SupportedKeywordItems<T>& fullySupported();
} // namespace Opm::FlowKeywordValidation
#endif

View File

@ -28,10 +28,10 @@ namespace Opm::FlowKeywordValidation
{ {
template <> template <>
const PartiallySupportedKeywords<std::string>& const SupportedKeywordItems<std::string>&
partiallySupported() partiallySupported()
{ {
static const PartiallySupportedKeywords<std::string> partially_supported_keywords_strings = { static const SupportedKeywordItems<std::string> partially_supported_keywords_strings = {
{ {
"BRANPROP", "BRANPROP",
{ {
@ -273,13 +273,6 @@ partiallySupported()
{5,{true, allow_values<std::string> {"NO"}, "WAGHYSTR(WATER_MODEL): only the NO option is supported will STOP"}}, // WATER_MODEL {5,{true, allow_values<std::string> {"NO"}, "WAGHYSTR(WATER_MODEL): only the NO option is supported will STOP"}}, // WATER_MODEL
}, },
}, },
{
"WCONHIST",
{
{3,{true, allow_values<std::string> {"ORAT", "WRAT", "GRAT", "LRAT", "RESV", "BHP"}, "WCONHIST(TARGET): should be set to ORAT/WRAT/GRAT/LRAT/RESV or BHP"}}, // CMODE
},
},
{ {
"WEFAC", "WEFAC",
{ {
@ -351,10 +344,10 @@ partiallySupported()
} }
template <> template <>
const KeywordValidation::PartiallySupportedKeywords<int>& const KeywordValidation::SupportedKeywordItems<int>&
partiallySupported() partiallySupported()
{ {
static const KeywordValidation::PartiallySupportedKeywords<int>partially_supported_keywords_int = { static const KeywordValidation::SupportedKeywordItems<int>partially_supported_keywords_int = {
{ {
"EDITNNC", "EDITNNC",
{ {
@ -535,10 +528,10 @@ partiallySupported()
} }
template <> template <>
const KeywordValidation::PartiallySupportedKeywords<double>& const KeywordValidation::SupportedKeywordItems<double>&
partiallySupported() partiallySupported()
{ {
static const KeywordValidation::PartiallySupportedKeywords<double> partially_supported_keywords_double = { static const KeywordValidation::SupportedKeywordItems<double> partially_supported_keywords_double = {
{ {
"AQUCON", "AQUCON",
{ {

View File

@ -47,7 +47,7 @@ namespace Opm::FlowKeywordValidation
{ {
template <typename T> template <typename T>
const KeywordValidation::PartiallySupportedKeywords<T>& partiallySupported(); const KeywordValidation::SupportedKeywordItems<T>& partiallySupported();
} // namespace Opm::FlowKeywordValidation } // namespace Opm::FlowKeywordValidation

View File

@ -67,6 +67,7 @@
#include <opm/simulators/flow/KeywordValidation.hpp> #include <opm/simulators/flow/KeywordValidation.hpp>
#include <opm/simulators/flow/ValidationFunctions.hpp> #include <opm/simulators/flow/ValidationFunctions.hpp>
#include <opm/simulators/utils/FullySupportedFlowKeywords.hpp>
#include <opm/simulators/utils/ParallelEclipseState.hpp> #include <opm/simulators/utils/ParallelEclipseState.hpp>
#include <opm/simulators/utils/ParallelSerialization.hpp> #include <opm/simulators/utils/ParallelSerialization.hpp>
#include <opm/simulators/utils/PartiallySupportedFlowKeywords.hpp> #include <opm/simulators/utils/PartiallySupportedFlowKeywords.hpp>
@ -209,11 +210,22 @@ namespace {
{ {
Opm::Deck deck(parser.parseFile(deckFilename, parseContext, errorGuard)); Opm::Deck deck(parser.parseFile(deckFilename, parseContext, errorGuard));
auto keyword_validator = Opm::KeywordValidation::KeywordValidator { Opm::KeywordValidation::SupportedKeywords partiallySupported {
Opm::FlowKeywordValidation::unsupportedKeywords(),
Opm::FlowKeywordValidation::partiallySupported<std::string>(), Opm::FlowKeywordValidation::partiallySupported<std::string>(),
Opm::FlowKeywordValidation::partiallySupported<int>(), Opm::FlowKeywordValidation::partiallySupported<int>(),
Opm::FlowKeywordValidation::partiallySupported<double>(), Opm::FlowKeywordValidation::partiallySupported<double>()
};
Opm::KeywordValidation::SupportedKeywords fullySupported {
Opm::FlowKeywordValidation::fullySupported<std::string>(),
Opm::FlowKeywordValidation::fullySupported<int>(),
Opm::FlowKeywordValidation::fullySupported<double>()
};
auto keyword_validator = Opm::KeywordValidation::KeywordValidator {
Opm::FlowKeywordValidation::unsupportedKeywords(),
partiallySupported,
fullySupported,
Opm::KeywordValidation::specialValidation() Opm::KeywordValidation::specialValidation()
}; };

View File

@ -40,7 +40,7 @@ const UnsupportedKeywords test_unsupported_keywords = {
}; };
const PartiallySupportedKeywords<std::string> test_string_items = { const SupportedKeywordItems<std::string> test_string_items = {
{ {
"PINCH", "PINCH",
{ {
@ -58,7 +58,7 @@ const PartiallySupportedKeywords<std::string> test_string_items = {
}; };
const PartiallySupportedKeywords<int> test_int_items = { const SupportedKeywordItems<int> test_int_items = {
{ {
"ENDSCALE", "ENDSCALE",
{ {
@ -76,7 +76,7 @@ const PartiallySupportedKeywords<int> test_int_items = {
}; };
const PartiallySupportedKeywords<double> test_double_items = { const SupportedKeywordItems<double> test_double_items = {
{ {
"EHYSTR", "EHYSTR",
{ {
@ -86,7 +86,8 @@ const PartiallySupportedKeywords<double> 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) BOOST_AUTO_TEST_CASE(non_critical_keyword)
{ {
@ -95,7 +96,7 @@ ECHO
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["ECHO"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
BOOST_CHECK(!errors[0].critical); BOOST_CHECK(!errors[0].critical);
@ -112,7 +113,7 @@ NOECHO
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["NOECHO"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
BOOST_CHECK(errors[0].critical); BOOST_CHECK(errors[0].critical);
@ -130,7 +131,7 @@ PINCH
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["PINCH"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
BOOST_CHECK(!errors[0].critical); BOOST_CHECK(!errors[0].critical);
@ -148,7 +149,7 @@ PINCH
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["PINCH"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
BOOST_CHECK(errors[0].critical); BOOST_CHECK(errors[0].critical);
@ -166,7 +167,7 @@ ENDSCALE
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["ENDSCALE"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
BOOST_CHECK(!errors[0].critical); BOOST_CHECK(!errors[0].critical);
@ -184,7 +185,7 @@ ENDSCALE
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["ENDSCALE"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
BOOST_CHECK(errors[0].critical); BOOST_CHECK(errors[0].critical);
@ -201,7 +202,7 @@ EHYSTR
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["EHYSTR"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
BOOST_CHECK(errors.size() == 0); BOOST_CHECK(errors.size() == 0);
@ -215,7 +216,7 @@ EHYSTR
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["EHYSTR"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
BOOST_CHECK(!errors[0].critical); BOOST_CHECK(!errors[0].critical);
@ -232,7 +233,7 @@ EHYSTR
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["EHYSTR"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
BOOST_CHECK(!errors[0].critical); BOOST_CHECK(!errors[0].critical);
@ -252,7 +253,7 @@ ENDSCALE
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword1 = deck["PINCH"].back(); const auto& test_keyword1 = deck["PINCH"].back();
const auto& test_keyword2 = deck["ENDSCALE"].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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword1, errors); validator.validateDeckKeyword(test_keyword1, errors);
validator.validateDeckKeyword(test_keyword2, errors); validator.validateDeckKeyword(test_keyword2, errors);
@ -274,7 +275,7 @@ ECHO
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["ECHO"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
const auto report = get_error_report(errors, true, false); const auto report = get_error_report(errors, true, false);
@ -293,7 +294,7 @@ ECHO
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["ECHO"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
const auto report = get_error_report(errors, false, true); const auto report = get_error_report(errors, false, true);
@ -308,7 +309,7 @@ NOECHO
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["NOECHO"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
const auto report = get_error_report(errors, false, true); const auto report = get_error_report(errors, false, true);
@ -326,7 +327,7 @@ NOECHO
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["NOECHO"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
const auto report = get_error_report(errors, true, false); const auto report = get_error_report(errors, true, false);
@ -342,7 +343,7 @@ PINCH
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["PINCH"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
const auto report = get_error_report(errors, true, false); const auto report = get_error_report(errors, true, false);
@ -365,7 +366,7 @@ COMPDAT
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["COMPDAT"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
const auto report = get_error_report(errors, true, false); const auto report = get_error_report(errors, true, false);
@ -386,7 +387,7 @@ PINCH
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["PINCH"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
const auto report = get_error_report(errors, false, true); const auto report = get_error_report(errors, false, true);
@ -402,7 +403,7 @@ ENDSCALE
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["ENDSCALE"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
const auto report = get_error_report(errors, true, false); const auto report = get_error_report(errors, true, false);
@ -421,7 +422,7 @@ ENDSCALE
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["ENDSCALE"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
const auto report = get_error_report(errors, false, true); const auto report = get_error_report(errors, false, true);
@ -437,7 +438,7 @@ ENDSCALE
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["ENDSCALE"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
const auto report = get_error_report(errors, false, true); const auto report = get_error_report(errors, false, true);
@ -456,7 +457,7 @@ ENDSCALE
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["ENDSCALE"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
const auto report = get_error_report(errors, true, false); const auto report = get_error_report(errors, true, false);
@ -479,7 +480,7 @@ ENDSCALE
const auto& test_keyword2 = deck["NOECHO"].back(); const auto& test_keyword2 = deck["NOECHO"].back();
const auto& test_keyword3 = deck["PINCH"].back(); const auto& test_keyword3 = deck["PINCH"].back();
const auto& test_keyword4 = deck["ENDSCALE"].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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword1, errors); validator.validateDeckKeyword(test_keyword1, errors);
validator.validateDeckKeyword(test_keyword2, errors); validator.validateDeckKeyword(test_keyword2, errors);
@ -510,7 +511,7 @@ ENDSCALE
const auto& test_keyword2 = deck["NOECHO"].back(); const auto& test_keyword2 = deck["NOECHO"].back();
const auto& test_keyword3 = deck["PINCH"].back(); const auto& test_keyword3 = deck["PINCH"].back();
const auto& test_keyword4 = deck["ENDSCALE"].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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword1, errors); validator.validateDeckKeyword(test_keyword1, errors);
validator.validateDeckKeyword(test_keyword2, errors); validator.validateDeckKeyword(test_keyword2, errors);
@ -535,7 +536,7 @@ EQLOPTS
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["EQLOPTS"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
BOOST_CHECK(errors.size() == 0); BOOST_CHECK(errors.size() == 0);
@ -551,7 +552,7 @@ EQLOPTS
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["EQLOPTS"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
BOOST_CHECK(errors.size() == 1); BOOST_CHECK(errors.size() == 1);
@ -570,7 +571,7 @@ EQLOPTS
)"}; )"};
const auto deck = Parser {}.parseString(keywords_string); const auto deck = Parser {}.parseString(keywords_string);
const auto& test_keyword = deck["EQLOPTS"].back(); 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<ValidationError> errors; std::vector<ValidationError> errors;
validator.validateDeckKeyword(test_keyword, errors); validator.validateDeckKeyword(test_keyword, errors);
BOOST_CHECK(errors.size() == 0); BOOST_CHECK(errors.size() == 0);