My Project
UDQDefine.hpp
1/*
2 Copyright 2018 Statoil ASA.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20
21#ifndef UDQ_DEFINE_HPP
22#define UDQ_DEFINE_HPP
23
24#include <optional>
25#include <set>
26#include <string>
27#include <unordered_set>
28#include <vector>
29
30#include <opm/input/eclipse/Schedule/UDQ/UDQEnums.hpp>
31#include <opm/input/eclipse/Schedule/UDQ/UDQSet.hpp>
32#include <opm/input/eclipse/Schedule/UDQ/UDQContext.hpp>
33#include <opm/input/eclipse/Schedule/UDQ/UDQFunctionTable.hpp>
34#include <opm/common/OpmLog/KeywordLocation.hpp>
35#include <opm/input/eclipse/Schedule/UDQ/UDQToken.hpp>
36
37namespace Opm {
38
39class UDQASTNode;
40class ParseContext;
41class ErrorGuard;
42
44public:
45 UDQDefine();
46
47 UDQDefine(const UDQParams& udq_params,
48 const std::string& keyword,
49 std::size_t report_step,
50 const KeywordLocation& location,
51 const std::vector<std::string>& deck_data);
52
53 UDQDefine(const UDQParams& udq_params,
54 const std::string& keyword,
55 std::size_t report_step,
56 const KeywordLocation& location,
57 const std::vector<std::string>& deck_data,
58 const ParseContext& parseContext,
59 ErrorGuard& errors);
60
61 template <typename T>
62 UDQDefine(const UDQParams& udq_params,
63 const std::string& keyword,
64 std::size_t report_step,
65 const KeywordLocation& location,
66 const std::vector<std::string>& deck_data,
67 const ParseContext& parseContext,
68 T&& errors);
69
70 static UDQDefine serializationTestObject();
71
72 UDQSet eval(const UDQContext& context) const;
73 const std::string& keyword() const;
74 const std::string& input_string() const;
75 const KeywordLocation& location() const;
76 UDQVarType var_type() const;
77 std::set<UDQTokenType> func_tokens() const;
78 void required_summary(std::unordered_set<std::string>& summary_keys) const;
79 void update_status(UDQUpdate update_status, std::size_t report_step);
80 std::pair<UDQUpdate, std::size_t> status() const;
81 const std::vector<Opm::UDQToken> tokens() const;
82
83 bool operator==(const UDQDefine& data) const;
84
85 template<class Serializer>
86 void serializeOp(Serializer& serializer)
87 {
88 serializer(m_keyword);
89 serializer(ast);
90 serializer(m_var_type);
91 serializer(m_location);
92 serializer(string_data);
93 serializer(m_update_status);
94 serializer(m_report_step);
95 }
96
97private:
98 std::string m_keyword;
99 std::vector<Opm::UDQToken> m_tokens;
100 std::shared_ptr<UDQASTNode> ast;
101 UDQVarType m_var_type;
102 KeywordLocation m_location;
103 std::size_t m_report_step;
104 UDQUpdate m_update_status;
105 mutable std::optional<std::string> string_data;
106};
107}
108
109
110
111#endif
Definition: ErrorGuard.hpp:29
Definition: KeywordLocation.hpp:27
Definition: ParseContext.hpp:88
Class for (de-)serializing.
Definition: Serializer.hpp:75
Definition: UDQContext.hpp:39
Definition: UDQDefine.hpp:43
Definition: UDQParams.hpp:31
Definition: UDQSet.hpp:63
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29