My Project
Loading...
Searching...
No Matches
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#ifndef UDQ_DEFINE_HPP
21#define UDQ_DEFINE_HPP
22
23#include <opm/input/eclipse/Schedule/UDQ/UDQContext.hpp>
24#include <opm/input/eclipse/Schedule/UDQ/UDQEnums.hpp>
25#include <opm/input/eclipse/Schedule/UDQ/UDQFunctionTable.hpp>
26#include <opm/input/eclipse/Schedule/UDQ/UDQSet.hpp>
27#include <opm/input/eclipse/Schedule/UDQ/UDQToken.hpp>
28
29#include <opm/common/OpmLog/KeywordLocation.hpp>
30
31#include <cstddef>
32#include <memory>
33#include <optional>
34#include <set>
35#include <string>
36#include <unordered_set>
37#include <utility>
38#include <vector>
39
40namespace Opm {
41
42class UDQASTNode;
43class ParseContext;
44class ErrorGuard;
45
46} // Namespace Opm
47
48namespace Opm {
49
51{
52public:
53 UDQDefine();
54
55 UDQDefine(const UDQParams& udq_params,
56 const std::string& keyword,
57 std::size_t report_step,
58 const KeywordLocation& location,
59 const std::vector<std::string>& deck_data);
60
61 UDQDefine(const UDQParams& udq_params,
62 const std::string& keyword,
63 std::size_t report_step,
64 const KeywordLocation& location,
65 const std::vector<std::string>& deck_data,
66 const ParseContext& parseContext,
67 ErrorGuard& errors);
68
69 template <typename T>
70 UDQDefine(const UDQParams& udq_params,
71 const std::string& keyword,
72 std::size_t report_step,
73 const KeywordLocation& location,
74 const std::vector<std::string>& deck_data,
75 const ParseContext& parseContext,
76 T&& errors);
77
78 static UDQDefine serializationTestObject();
79
80 UDQSet eval(const UDQContext& context) const;
81 const std::string& keyword() const;
82 const std::string& input_string() const;
83 const KeywordLocation& location() const;
84 UDQVarType var_type() const;
85 std::set<UDQTokenType> func_tokens() const;
86 void required_summary(std::unordered_set<std::string>& summary_keys) const;
87 void update_status(UDQUpdate update_status, std::size_t report_step);
88 std::pair<UDQUpdate, std::size_t> status() const;
89 const std::vector<Opm::UDQToken> tokens() const;
90
91 bool operator==(const UDQDefine& data) const;
92
93 template <class Serializer>
94 void serializeOp(Serializer& serializer)
95 {
96 serializer(m_keyword);
97 serializer(m_tokens);
98 serializer(ast);
99 serializer(m_var_type);
100 serializer(m_location);
101 serializer(string_data);
102 serializer(m_update_status);
103 serializer(m_report_step);
104 }
105
106private:
107 std::string m_keyword;
108 std::vector<Opm::UDQToken> m_tokens;
109 std::shared_ptr<UDQASTNode> ast;
110 UDQVarType m_var_type;
111 KeywordLocation m_location;
112 std::size_t m_report_step;
113 UDQUpdate m_update_status;
114 mutable std::optional<std::string> string_data;
115
116 UDQSet scatter_scalar_value(UDQSet&& res, const UDQContext& context) const;
117 UDQSet scatter_scalar_well_value(const UDQContext& context, const std::optional<double>& value) const;
118 UDQSet scatter_scalar_group_value(const UDQContext& context, const std::optional<double>& value) const;
119 UDQSet scatter_scalar_segment_value(const UDQContext& context, const std::optional<double>& value) const;
120};
121
122} // Namespace Opm
123
124#endif // UDQ_DEFINE_HPP
Definition ErrorGuard.hpp:29
Definition KeywordLocation.hpp:27
Definition ParseContext.hpp:84
Class for (de-)serializing.
Definition Serializer.hpp:84
Definition UDQContext.hpp:49
Definition UDQDefine.hpp:51
Definition UDQParams.hpp:31
Definition UDQSet.hpp:187
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30