opm-common
Ppcwmax.hpp
1 /*
2  Copyright (C) 2023 Equinor
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 #ifndef PPCWMAX_HPP
20 #define PPCWMAX_HPP
21 
22 #include <cstddef>
23 #include <vector>
24 
25 namespace Opm {
26 class Deck;
27 
28 struct PpcwmaxRecord {
29  double max_cap_pres{};
30  bool option{false};
31 
32  PpcwmaxRecord() = default;
33  PpcwmaxRecord(double pres, bool optn) :
34  max_cap_pres(pres),
35  option(optn)
36  {};
37 
38  bool operator==(const PpcwmaxRecord& other) const {
39  return this->max_cap_pres == other.max_cap_pres &&
40  this->option == other.option;
41  }
42 
43  template<class Serializer>
44  void serializeOp(Serializer& serializer)
45  {
46  serializer(max_cap_pres);
47  serializer(option);
48  }
49 };
50 
51 class Ppcwmax {
52 public:
53  Ppcwmax() = default;
54  explicit Ppcwmax(const Deck& deck);
55  explicit Ppcwmax(std::initializer_list<PpcwmaxRecord> records);
56  static Ppcwmax serializationTestObject();
57  std::size_t size() const;
58  bool empty() const;
59  std::vector< PpcwmaxRecord >::const_iterator begin() const;
60  std::vector< PpcwmaxRecord >::const_iterator end() const;
61  const PpcwmaxRecord& operator[](const std::size_t index) const;
62 
63  bool operator==(const Ppcwmax& other) const {
64  return this->data == other.data;
65  }
66 
67  template<class Serializer>
68  void serializeOp(Serializer& serializer)
69  {
70  serializer(data);
71  }
72 
73 private:
74  std::vector<PpcwmaxRecord> data;
75 
76 };
77 }
78 
79 #endif
Definition: Ppcwmax.hpp:28
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: Ppcwmax.hpp:51
Definition: Deck.hpp:46
Class for (de-)serializing.
Definition: Serializer.hpp:94