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