My Project
GConSale.hpp
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 GCONSALE_H
21 #define GCONSALE_H
22 
23 #include <map>
24 #include <string>
25 
26 #include <opm/input/eclipse/Deck/UDAValue.hpp>
27 #include <opm/input/eclipse/Units/UnitSystem.hpp>
28 
29 namespace Opm {
30 
31  class SummaryState;
32 
33  class GConSale {
34  public:
35 
36  enum class MaxProcedure {
37  NONE, CON, CON_P, WELL, PLUG, RATE, MAXR, END
38  };
39 
40  struct GCONSALEGroup {
41  UDAValue sales_target;
42  UDAValue max_sales_rate;
43  UDAValue min_sales_rate;
44  MaxProcedure max_proc;
45  double udq_undefined;
46  UnitSystem unit_system;
47 
48  bool operator==(const GCONSALEGroup& data) const {
49  return sales_target == data.sales_target &&
50  max_sales_rate == data.max_sales_rate &&
51  min_sales_rate == data.min_sales_rate &&
52  max_proc == data.max_proc &&
53  udq_undefined == data.udq_undefined &&
54  unit_system == data.unit_system;
55  }
56 
57  template<class Serializer>
58  void serializeOp(Serializer& serializer)
59  {
60  serializer(sales_target);
61  serializer(max_sales_rate);
62  serializer(min_sales_rate);
63  serializer(max_proc);
64  serializer(udq_undefined);
65  serializer(unit_system);
66  }
67  };
68 
70  double sales_target;
71  double max_sales_rate;
72  double min_sales_rate;
73  MaxProcedure max_proc;
74  };
75 
76  static GConSale serializationTestObject();
77 
78  bool has(const std::string& name) const;
79  const GCONSALEGroup& get(const std::string& name) const;
80  const GCONSALEGroupProp get(const std::string& name, const SummaryState& st) const;
81  static MaxProcedure stringToProcedure(const std::string& procedure);
82  void add(const std::string& name, const UDAValue& sales_target, const UDAValue& max_rate, const UDAValue& min_rate, const std::string& procedure, double udq_undefined_arg, const UnitSystem& unit_system);
83  size_t size() const;
84 
85  bool operator==(const GConSale& data) const;
86 
87  template<class Serializer>
88  void serializeOp(Serializer& serializer)
89  {
90  serializer(groups);
91  }
92 
93  private:
94  std::map<std::string, GCONSALEGroup> groups;
95  };
96 
97 }
98 
99 
100 #endif
Definition: GConSale.hpp:33
Class for (de-)serializing.
Definition: Serializer.hpp:75
Definition: SummaryState.hpp:69
Definition: UDAValue.hpp:32
Definition: UnitSystem.hpp:33
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29
Definition: GConSale.hpp:69
Definition: GConSale.hpp:40