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