opm-common
BCConfig.hpp
1 /*
2  Copyright 2020 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 OPM_BCCONFIG_HPP
21 #define OPM_BCCONFIG_HPP
22 
23 #include <vector>
24 #include <cstddef>
25 
26 #include <opm/input/eclipse/EclipseState/Grid/FaceDir.hpp>
27 #include <opm/input/eclipse/EclipseState/Grid/GridDims.hpp>
28 
29 namespace Opm {
30 
31 class Deck;
32 class DeckRecord;
33 
34 class BCConfig
35 {
36 public:
37  struct BCRegion
38  {
39  int index{};
40  int i1{}, i2{};
41  int j1{}, j2{};
42  int k1 {}, k2{};
43  FaceDir::DirEnum dir{FaceDir::Unknown};
44 
45  BCRegion() = default;
46  explicit BCRegion(const DeckRecord& record, const GridDims& grid);
47 
48  static BCRegion serializationTestObject();
49 
50  bool operator==(const BCRegion& other) const;
51 
52  template<class Serializer>
53  void serializeOp(Serializer& serializer)
54  {
55  serializer(index);
56  serializer(i1);
57  serializer(i2);
58  serializer(j1);
59  serializer(j2);
60  serializer(k1);
61  serializer(k2);
62  serializer(dir);
63  }
64  };
65 
66  BCConfig() = default;
67  explicit BCConfig(const Deck& deck);
68 
69  static BCConfig serializationTestObject();
70 
71  std::size_t size() const;
72  std::vector<BCRegion>::const_iterator begin() const;
73  std::vector<BCRegion>::const_iterator end() const;
74  bool operator==(const BCConfig& other) const;
75 
76  template<class Serializer>
77  void serializeOp(Serializer& serializer)
78  {
79  serializer(m_faces);
80  }
81 
82 private:
83  std::vector<BCRegion> m_faces;
84 };
85 
86 } //namespace Opm
87 
88 #endif
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: BCConfig.hpp:37
Definition: GridDims.hpp:30
Definition: Deck.hpp:46
Definition: DeckRecord.hpp:32
Class for (de-)serializing.
Definition: Serializer.hpp:94
Definition: BCConfig.hpp:34