20#ifndef OPM_KEYWORDVALIDATION_HEADER_INCLUDED
21#define OPM_KEYWORDVALIDATION_HEADER_INCLUDED
23#include <opm/input/eclipse/Deck/DeckItem.hpp>
24#include <opm/common/OpmLog/KeywordLocation.hpp>
25#include <opm/simulators/flow/ValidationFunctions.hpp>
30#include <initializer_list>
34#include <unordered_map>
45namespace KeywordValidation
50 std::optional<std::string> message;
57 std::function<
bool(T)> validator;
58 std::optional<std::string> message;
62 using UnsupportedKeywords = std::map<std::string, UnsupportedKeywordProperties>;
66 using SupportedSingleKeywordItems = std::map<std::size_t, SupportedKeywordProperties<T>>;
70 using SupportedKeywordItems = std::map<std::string, SupportedSingleKeywordItems<T>>;
78 std::size_t record_number;
79 std::optional<std::size_t> item_number;
80 std::optional<std::string> item_value;
81 std::optional<std::string> user_message;
88 std::string get_error_report(
const std::vector<ValidationError>&
errors,
93 const SupportedKeywordItems<std::string> string_items;
94 const SupportedKeywordItems<int> int_items;
95 const SupportedKeywordItems<double> double_items;
127 template <
typename T>
131 const std::size_t record_number,
132 const std::size_t item_number,
134 std::vector<ValidationError>&
errors)
const;
138 std::vector<ValidationError>&
errors)
const;
140 template <
typename T>
143 std::vector<ValidationError>&
errors)
const;
145 const UnsupportedKeywords m_unsupported_keywords;
148 const std::unordered_map<std::string, ValidationFunction> m_special_validation;
153 template <
typename T>
160 m_allowed_values.push_back(
item);
164 bool operator()(
const T& value)
const
166 return std::find(m_allowed_values.begin(), m_allowed_values.end(), value) != m_allowed_values.end();
170 std::vector<T> m_allowed_values;
176 bool operator()(
const std::string& value)
const {
178 return DeckItem::to_bool(value) ||
true;
179 }
catch (
const std::invalid_argument&
e) {
Definition KeywordValidation.hpp:99
Definition KeywordValidation.hpp:155
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilboundaryratevector.hh:37
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242
Definition KeywordValidation.hpp:55
Definition KeywordValidation.hpp:92
Definition KeywordValidation.hpp:48
Definition KeywordValidation.hpp:75
Definition KeywordValidation.hpp:174