diff --git a/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp b/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp index fbe1c493e..c6e5cc3e2 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQConfig.hpp @@ -33,6 +33,7 @@ #include #include #include +#include namespace Opm { diff --git a/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.hpp b/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.hpp index e93e2b9d2..e8662701f 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.hpp @@ -30,13 +30,13 @@ #include #include #include +#include namespace Opm { class UDQASTNode; class ParseContext; class ErrorGuard; -class KeywordLocation; class UDQDefine{ public: @@ -63,6 +63,7 @@ public: T&& errors); UDQDefine(const std::string& keyword, + const KeywordLocation& location, std::shared_ptr astPtr, UDQVarType type, const std::string& string_data); @@ -72,6 +73,7 @@ public: UDQSet eval(const UDQContext& context) const; const std::string& keyword() const; const std::string& input_string() const; + const KeywordLocation& location() const; UDQVarType var_type() const; std::set func_tokens() const; void required_summary(std::unordered_set& summary_keys) const; @@ -84,6 +86,7 @@ public: serializer(m_keyword); serializer(ast); serializer(m_var_type); + m_location.serializeOp(serializer); serializer(string_data); } @@ -91,6 +94,7 @@ private: std::string m_keyword; std::shared_ptr ast; UDQVarType m_var_type; + KeywordLocation m_location; std::string string_data; }; } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.cpp index 78db3c9f3..d2a9583fc 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQDefine.cpp @@ -166,7 +166,8 @@ UDQDefine::UDQDefine(const UDQParams& udq_params, const ParseContext& parseContext, ErrorGuard& errors) : m_keyword(keyword), - m_var_type(UDQ::varType(keyword)) + m_var_type(UDQ::varType(keyword)), + m_location(location) { std::vector string_tokens; for (const std::string& deck_item : deck_data) { @@ -198,7 +199,7 @@ UDQDefine::UDQDefine(const UDQParams& udq_params, std::vector tokens = make_tokens(string_tokens); - this->ast = std::make_shared( UDQParser::parse(udq_params, this->m_var_type, this->m_keyword, location, tokens, parseContext, errors) ); + this->ast = std::make_shared( UDQParser::parse(udq_params, this->m_var_type, this->m_keyword, this->m_location, tokens, parseContext, errors) ); this->string_data = ""; for (std::size_t index = 0; index < deck_data.size(); index++) { this->string_data += deck_data[index]; @@ -209,16 +210,19 @@ UDQDefine::UDQDefine(const UDQParams& udq_params, UDQDefine::UDQDefine(const std::string& keyword, + const KeywordLocation& location, std::shared_ptr astPtr, UDQVarType type, const std::string& stringData) : m_keyword(keyword) , ast(astPtr) , m_var_type(type) + , m_location(location) , string_data(stringData) {} + UDQDefine UDQDefine::serializeObject() { UDQDefine result; @@ -226,6 +230,7 @@ UDQDefine UDQDefine::serializeObject() result.ast = std::make_shared(UDQASTNode::serializeObject()); result.m_var_type = UDQVarType::SEGMENT_VAR; result.string_data = "test2"; + result.m_location = KeywordLocation{"KEYWOR", "file", 100}; return result; } @@ -307,6 +312,9 @@ UDQSet UDQDefine::eval(const UDQContext& context) const { return res; } +const KeywordLocation& UDQDefine::location() const { + return this->m_location; +} UDQVarType UDQDefine::var_type() const { return this->m_var_type; @@ -332,6 +340,7 @@ bool UDQDefine::operator==(const UDQDefine& data) const { return false; return this->keyword() == data.keyword() && + this->m_location == data.location() && this->var_type() == data.var_type() && this->input_string() == data.input_string(); }