opm-common
GConSump.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 GCONSUMP_H
21 #define GCONSUMP_H
22 
23 #include <opm/input/eclipse/Deck/UDAValue.hpp>
24 #include <opm/input/eclipse/Units/UnitSystem.hpp>
25 
26 #include <cstddef>
27 #include <map>
28 #include <string>
29 
30 namespace Opm {
31 
32  class SummaryState;
33 
34  class GConSump {
35  public:
36  struct GCONSUMPGroup {
37  UDAValue consumption_rate;
38  UDAValue import_rate;
39  std::string network_node;
40  double udq_undefined;
41  UnitSystem unit_system;
42 
43  bool operator==(const GCONSUMPGroup& data) const {
44  return consumption_rate == data.consumption_rate &&
45  import_rate == data.import_rate &&
46  network_node == data.network_node &&
47  udq_undefined == data.udq_undefined &&
48  unit_system == data.unit_system;
49  }
50 
51  template<class Serializer>
52  void serializeOp(Serializer& serializer)
53  {
54  serializer(consumption_rate);
55  serializer(import_rate);
56  serializer(network_node);
57  serializer(udq_undefined);
58  serializer(unit_system);
59  }
60  };
61 
63  double consumption_rate;
64  double import_rate;
65  std::string network_node;
66  };
67 
68  static GConSump serializationTestObject();
69 
70  bool has(const std::string& name) const;
71  const GCONSUMPGroup& get(const std::string& name) const;
72  const GCONSUMPGroupProp get(const std::string& name, const SummaryState& st) const;
73  void add(const std::string& name, const UDAValue& consumption_rate,
74  const UDAValue& import_rate, const std::string& network_node,
75  double udq_undefined_arg, const UnitSystem& unit_system);
76  std::size_t size() const;
77 
78  bool operator==(const GConSump& data) const;
79 
80  template<class Serializer>
81  void serializeOp(Serializer& serializer)
82  {
83  serializer(groups);
84  }
85 
86  private:
87  std::map<std::string, GCONSUMPGroup> groups;
88  };
89 
90 }
91 
92 #endif
Definition: GConSump.hpp:34
Definition: UDAValue.hpp:31
Definition: GConSump.hpp:36
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: GConSump.hpp:62
Definition: UnitSystem.hpp:34
Definition: SummaryState.hpp:72
Class for (de-)serializing.
Definition: Serializer.hpp:95