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 { return this->input_string_; }
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 void clear_next() const
91 {
92 if (this->m_update_status == UDQUpdate::NEXT) {
93 this->m_update_status = UDQUpdate::OFF;
94 }
95 }
96
97 bool operator==(const UDQDefine& data) const;
98
99 template <class Serializer>
100 void serializeOp(Serializer& serializer)
101 {
102 serializer(m_keyword);
103 serializer(input_string_);
104 serializer(m_tokens);
105 serializer(ast);
106 serializer(m_var_type);
107 serializer(m_location);
108 serializer(m_update_status);
109 serializer(m_report_step);
110 }
111
112private:
113 std::string m_keyword{};
114 std::string input_string_{};
115 std::vector<Opm::UDQToken> m_tokens{};
116 std::shared_ptr<UDQASTNode> ast{};
117 UDQVarType m_var_type{UDQVarType::NONE};
118 KeywordLocation m_location{};
119 std::size_t m_report_step{};
120 mutable UDQUpdate m_update_status{UDQUpdate::NEXT};
121
122 UDQSet scatter_scalar_value(UDQSet&& res, const UDQContext& context) const;
123 UDQSet scatter_scalar_well_value(const UDQContext& context, const std::optional<double>& value) const;
124 UDQSet scatter_scalar_group_value(const UDQContext& context, const std::optional<double>& value) const;
125 UDQSet scatter_scalar_segment_value(const UDQContext& context, const std::optional<double>& value) const;
126};
127
128} // Namespace Opm
129
130#endif // UDQ_DEFINE_HPP
Definition ErrorGuard.hpp:30
Definition KeywordLocation.hpp:27
Definition ParseContext.hpp:84
Class for (de-)serializing.
Definition Serializer.hpp:94
Definition UDQContext.hpp:50
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