GridDims.hpp
Go to the documentation of this file.
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
29
30namespace Opm {
32 {
33 public:
34
36 explicit GridDims(std::array<int, 3> xyz);
37 GridDims(size_t nx, size_t ny, size_t nz);
38
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:38
Definition: Deck.hpp:115
Definition: GridDims.hpp:32
size_t m_nx
Definition: GridDims.hpp:72
bool operator==(const GridDims &data) const
size_t getNX() const
size_t m_nz
Definition: GridDims.hpp:74
size_t getNZ() const
void assertGlobalIndex(size_t globalIndex) const
GridDims(size_t nx, size_t ny, size_t nz)
void assertIJK(size_t i, size_t j, size_t k) const
size_t getGlobalIndex(size_t i, size_t j, size_t k) const
size_t m_ny
Definition: GridDims.hpp:73
static GridDims serializeObject()
GridDims(std::array< int, 3 > xyz)
GridDims(const Deck &deck)
size_t getCartesianSize() const
void serializeOp(Serializer &serializer)
Definition: GridDims.hpp:64
size_t operator[](int dim) const
const std::array< int, 3 > getNXYZ() const
size_t getNY() const
const std::array< int, 3 > getIJK(size_t globalIndex) const
Definition: Serializer.hpp:38
UDAKeyword keyword(UDAControl control)
Definition: A.hpp:4
static std::string data()
Definition: exprtk.hpp:40022