parser/eclipse/EclipseState/Tables/tabdims.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2015 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 TABDIMS_HPP
21#define TABDIMS_HPP
22
23/*
24 The Tabdims class is a small utility class designed to hold on to
25 the values from the TABDIMS keyword.
26*/
27
32
33namespace Opm {
34 class Tabdims {
35 public:
36
37 /*
38 The TABDIMS keyword has a total of 25 items; most of them
39 are ECLIPSE300 only and quite exotic. Here we only
40 internalize the most common items.
41 */
43 m_ntsfun( ParserKeywords::TABDIMS::NTSFUN::defaultValue ),
44 m_ntpvt( ParserKeywords::TABDIMS::NTPVT::defaultValue ),
45 m_nssfun( ParserKeywords::TABDIMS::NSSFUN::defaultValue ),
46 m_nppvt( ParserKeywords::TABDIMS::NPPVT::defaultValue ),
47 m_ntfip( ParserKeywords::TABDIMS::NTFIP::defaultValue ),
48 m_nrpvt( ParserKeywords::TABDIMS::NRPVT::defaultValue )
49 { }
50
51
52 explicit Tabdims(const Deck& deck) :
53 Tabdims()
54 {
55 if (deck.hasKeyword("TABDIMS")) {
56 const auto& record = deck.getKeyword( "TABDIMS" , 0 ).getRecord( 0 );
57 m_ntsfun = record.getItem("NTSFUN").get<int>(0);
58 m_ntpvt = record.getItem("NTPVT").get<int>(0);
59 m_nssfun = record.getItem("NSSFUN").get<int>(0);
60 m_nppvt = record.getItem("NPPVT").get<int>(0);
61 m_ntfip = record.getItem("NTFIP").get<int>(0);
62 m_nrpvt = record.getItem("NRPVT").get<int>(0);
63 }
64 }
65
67 {
68 Tabdims result;
69 result.m_ntsfun = 1;
70 result.m_ntpvt = 2;
71 result.m_nssfun = 3;
72 result.m_nppvt = 4;
73 result.m_ntfip = 5;
74 result.m_nrpvt = 6;
75
76 return result;
77 }
78
79 size_t getNumSatTables() const {
80 return m_ntsfun;
81 }
82
83 size_t getNumPVTTables() const {
84 return m_ntpvt;
85 }
86
87 size_t getNumSatNodes() const {
88 return m_nssfun;
89 }
90
91 size_t getNumPressureNodes() const {
92 return m_nppvt;
93 }
94
95 size_t getNumFIPRegions() const {
96 return m_ntfip;
97 }
98
99 size_t getNumRSNodes() const {
100 return m_nrpvt;
101 }
102
103 bool operator==(const Tabdims& data) const {
104 return this->getNumSatTables() == data.getNumSatTables() &&
105 this->getNumPVTTables() == data.getNumPVTTables() &&
106 this->getNumSatNodes() == data.getNumSatNodes() &&
107 this->getNumPressureNodes() == data.getNumPressureNodes() &&
108 this->getNumFIPRegions() == data.getNumFIPRegions() &&
109 this->getNumRSNodes() == data.getNumRSNodes();
110 }
111
112 template<class Serializer>
113 void serializeOp(Serializer& serializer)
114 {
115 serializer(m_ntsfun);
116 serializer(m_ntpvt);
117 serializer(m_nssfun);
118 serializer(m_nppvt);
119 serializer(m_ntfip);
120 serializer(m_nrpvt);
121 }
122
123 private:
124 size_t m_ntsfun,m_ntpvt,m_nssfun,m_nppvt,m_ntfip,m_nrpvt;
125 };
126}
127
128
129#endif
const DeckRecord & getRecord(size_t index) const
Definition: Deck.hpp:115
bool hasKeyword(const DeckKeyword &keyword) const
DeckKeyword & getKeyword(size_t)
Definition: Serializer.hpp:38
Definition: parser/eclipse/EclipseState/Tables/tabdims.hpp:34
size_t getNumSatTables() const
Definition: parser/eclipse/EclipseState/Tables/tabdims.hpp:79
size_t getNumPVTTables() const
Definition: parser/eclipse/EclipseState/Tables/tabdims.hpp:83
static Tabdims serializeObject()
Definition: parser/eclipse/EclipseState/Tables/tabdims.hpp:66
size_t getNumPressureNodes() const
Definition: parser/eclipse/EclipseState/Tables/tabdims.hpp:91
size_t getNumSatNodes() const
Definition: parser/eclipse/EclipseState/Tables/tabdims.hpp:87
Tabdims(const Deck &deck)
Definition: parser/eclipse/EclipseState/Tables/tabdims.hpp:52
Tabdims()
Definition: parser/eclipse/EclipseState/Tables/tabdims.hpp:42
bool operator==(const Tabdims &data) const
Definition: parser/eclipse/EclipseState/Tables/tabdims.hpp:103
size_t getNumFIPRegions() const
Definition: parser/eclipse/EclipseState/Tables/tabdims.hpp:95
size_t getNumRSNodes() const
Definition: parser/eclipse/EclipseState/Tables/tabdims.hpp:99
void serializeOp(Serializer &serializer)
Definition: parser/eclipse/EclipseState/Tables/tabdims.hpp:113
@ NTFIP
Definition: VectorItems/intehead.hpp:99
Definition: A.hpp:4
static std::string data()
Definition: exprtk.hpp:40022