GuideRateConfig.hpp
Go to the documentation of this file.
1/*
2 Copyright 2019 Equinor 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 GUIDE_RATE_CONFIG_HPP
21#define GUIDE_RATE_CONFIG_HPP
22
23#include <string>
24#include <unordered_map>
25#include <memory>
26
30
31namespace Opm {
32
33
35public:
36
37 struct WellTarget {
38 double guide_rate;
41
42 bool operator==(const WellTarget& data) const {
43 return guide_rate == data.guide_rate &&
44 target == data.target &&
45 scaling_factor == data.scaling_factor;
46 }
47
48 template<class Serializer>
49 void serializeOp(Serializer& serializer)
50 {
51 serializer(guide_rate);
52 serializer(target);
53 serializer(scaling_factor);
54 }
55};
56
58 double guide_rate;
60
61 bool operator==(const GroupTarget& data) const {
62 return guide_rate == data.guide_rate &&
63 target == data.target;
64 }
65
66 template<class Serializer>
67 void serializeOp(Serializer& serializer)
68 {
69 serializer(guide_rate);
70 serializer(target);
71 }
72};
73
75
76 const GuideRateModel& model() const;
77 bool has_model() const;
79 void update_well(const Well& well);
80 void update_group(const Group& group);
81 const WellTarget& well(const std::string& well) const;
82 const GroupTarget& group(const std::string& group) const;
83 bool has_well(const std::string& well) const;
84 bool has_group(const std::string& group) const;
85
86 bool operator==(const GuideRateConfig& data) const;
87
88 template<class Serializer>
89 void serializeOp(Serializer& serializer)
90 {
91 serializer(m_model);
92 serializer.map(wells);
93 serializer.map(groups);
94 }
95
96private:
97 std::shared_ptr<GuideRateModel> m_model;
98 std::unordered_map<std::string, WellTarget> wells;
99 std::unordered_map<std::string, GroupTarget> groups;
100};
101
102}
103
104#endif
const char *const string
Definition: cJSON.h:170
Definition: parser/eclipse/EclipseState/Schedule/Group/group.hpp:36
GuideRateTarget
Definition: parser/eclipse/EclipseState/Schedule/Group/group.hpp:90
Definition: GuideRateConfig.hpp:34
const WellTarget & well(const std::string &well) const
void update_well(const Well &well)
static GuideRateConfig serializeObject()
bool has_group(const std::string &group) const
void serializeOp(Serializer &serializer)
Definition: GuideRateConfig.hpp:89
bool update_model(const GuideRateModel &model)
bool has_well(const std::string &well) const
bool has_model() const
void update_group(const Group &group)
const GuideRateModel & model() const
const GroupTarget & group(const std::string &group) const
bool operator==(const GuideRateConfig &data) const
Definition: GuideRateModel.hpp:29
Definition: Serializer.hpp:38
Definition: custom-opm-common/opm-common/opm/parser/eclipse/EclipseState/Schedule/Well/well.hpp:58
GuideRateTarget
Definition: custom-opm-common/opm-common/opm/parser/eclipse/EclipseState/Schedule/Well/well.hpp:136
Definition: A.hpp:4
static std::string data()
Definition: exprtk.hpp:40022
Definition: GuideRateConfig.hpp:57
double guide_rate
Definition: GuideRateConfig.hpp:58
bool operator==(const GroupTarget &data) const
Definition: GuideRateConfig.hpp:61
Group::GuideRateTarget target
Definition: GuideRateConfig.hpp:59
void serializeOp(Serializer &serializer)
Definition: GuideRateConfig.hpp:67
Definition: GuideRateConfig.hpp:37
void serializeOp(Serializer &serializer)
Definition: GuideRateConfig.hpp:49
Well::GuideRateTarget target
Definition: GuideRateConfig.hpp:39
double guide_rate
Definition: GuideRateConfig.hpp:38
double scaling_factor
Definition: GuideRateConfig.hpp:40
bool operator==(const WellTarget &data) const
Definition: GuideRateConfig.hpp:42