My Project
GridDims.hpp
1 /*
2  Copyright 2016 Statoil 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_PARSER_GRIDDIMS_HPP
21 #define OPM_PARSER_GRIDDIMS_HPP
22 
23 #include <array>
24 #include <stdexcept>
25 #include <vector>
26 
27 namespace Opm {
28  class Deck;
29  class DeckKeyword;
30 
31  class GridDims
32  {
33  public:
34 
35  GridDims();
36  explicit GridDims(std::array<int, 3> xyz);
37  GridDims(size_t nx, size_t ny, size_t nz);
38 
39  static GridDims serializeObject();
40 
41  explicit GridDims(const Deck& deck);
42 
43  size_t getNX() const;
44 
45  size_t getNY() const;
46  size_t getNZ() const;
47  size_t operator[](int dim) const;
48 
49  const std::array<int, 3> getNXYZ() const;
50 
51  size_t getGlobalIndex(size_t i, size_t j, size_t k) const;
52 
53  const std::array<int, 3> getIJK(size_t globalIndex) const;
54 
55  size_t getCartesianSize() const;
56 
57  void assertGlobalIndex(size_t globalIndex) const;
58 
59  void assertIJK(size_t i, size_t j, size_t k) const;
60 
61  bool operator==(const GridDims& data) const;
62 
63  template<class Serializer>
64  void serializeOp(Serializer& serializer)
65  {
66  serializer(m_nx);
67  serializer(m_ny);
68  serializer(m_nz);
69  }
70 
71  protected:
72  size_t m_nx;
73  size_t m_ny;
74  size_t m_nz;
75 
76  private:
77  void init(const DeckKeyword& keyword);
78  void binary_init(const Deck& deck);
79  };
80 }
81 
82 #endif /* OPM_PARSER_GRIDDIMS_HPP */
Definition: DeckKeyword.hpp:36
Definition: Deck.hpp:119
Definition: GridDims.hpp:32
Definition: Serializer.hpp:38
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29