My Project
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 <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 GConSump {
34  public:
35  struct GCONSUMPGroup {
36  UDAValue consumption_rate;
37  UDAValue import_rate;
38  std::string network_node;
39  double udq_undefined;
40  UnitSystem unit_system;
41 
42  bool operator==(const GCONSUMPGroup& data) const {
43  return consumption_rate == data.consumption_rate &&
44  import_rate == data.import_rate &&
45  network_node == data.network_node &&
46  udq_undefined == data.udq_undefined &&
47  unit_system == data.unit_system;
48  }
49 
50  template<class Serializer>
51  void serializeOp(Serializer& serializer)
52  {
53  serializer(consumption_rate);
54  serializer(import_rate);
55  serializer(network_node);
56  serializer(udq_undefined);
57  serializer(unit_system);
58  }
59  };
60 
62  double consumption_rate;
63  double import_rate;
64  std::string network_node;
65  };
66 
67  static GConSump serializationTestObject();
68 
69  bool has(const std::string& name) const;
70  const GCONSUMPGroup& get(const std::string& name) const;
71  const GCONSUMPGroupProp get(const std::string& name, const SummaryState& st) const;
72  void add(const std::string& name, const UDAValue& consumption_rate, const UDAValue& import_rate, const std::string network_node, double udq_undefined_arg, const UnitSystem& unit_system);
73  size_t size() const;
74 
75  bool operator==(const GConSump& data) const;
76 
77  template<class Serializer>
78  void serializeOp(Serializer& serializer)
79  {
80  serializer(groups);
81  }
82 
83  private:
84  std::map<std::string, GCONSUMPGroup> groups;
85  };
86 
87 }
88 
89 #endif
Definition: GConSump.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: GConSump.hpp:61
Definition: GConSump.hpp:35