opm-common
PvtxTable.hpp
1 /*
2  Copyright 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 OPM_PARSER_PVTX_TABLE_HPP
21 #define OPM_PARSER_PVTX_TABLE_HPP
22 
23 #include <opm/input/eclipse/EclipseState/Tables/ColumnSchema.hpp>
24 #include <opm/input/eclipse/EclipseState/Tables/SimpleTable.hpp>
25 #include <opm/input/eclipse/EclipseState/Tables/TableColumn.hpp>
26 #include <opm/input/eclipse/EclipseState/Tables/TableSchema.hpp>
27 
28 #include <cstddef>
29 #include <string>
30 #include <utility>
31 #include <vector>
32 
33 namespace Opm {
34 
35  class DeckKeyword;
36 
37 } // namespace Opm
38 
39 namespace Opm {
40 
116  class PvtxTable
117  {
118  public:
128  static std::size_t numTables(const DeckKeyword& keyword);
129 
137  static std::vector<std::pair<std::size_t, std::size_t>>
138  recordRanges(const DeckKeyword& keyword);
139 
144  PvtxTable() = default;
145 
153  explicit PvtxTable(const std::string& columnName);
154 
159  virtual ~PvtxTable() = default;
160 
163 
168  const SimpleTable& getSaturatedTable() const;
169 
173  const SimpleTable& getUnderSaturatedTable(std::size_t tableNumber) const;
174 
181  double getArgValue(std::size_t index) const;
182 
187  std::size_t size() const;
188 
193  auto begin() const { return this->m_underSaturatedTables.begin(); }
194 
199  auto cbegin() const { return this->m_underSaturatedTables.cbegin(); }
200 
202  auto end() const { return this->m_underSaturatedTables.end(); }
203 
205  auto cend() const { return this->m_underSaturatedTables.cend(); }
206 
214  bool operator==(const PvtxTable& data) const;
215 
221  template <class Serializer>
222  void serializeOp(Serializer& serializer)
223  {
224  serializer(m_outerColumnSchema);
225  serializer(m_outerColumn);
226  serializer(m_underSaturatedSchema);
227  serializer(m_saturatedSchema);
228  serializer(m_underSaturatedTables);
229  serializer(m_saturatedTable);
230  }
231 
232  protected:
237 
240 
243 
246 
250  std::vector<SimpleTable> m_underSaturatedTables{};
251 
254 
268  void init(const DeckKeyword& keyword, std::size_t tableIdx);
269 
270  private:
287  void populateUndersaturatedTables(const DeckKeyword& keyword,
288  const std::size_t tableIdx,
289  const std::size_t first,
290  const std::size_t last);
291 
299  void populateSaturatedTable(const std::string& tableName);
300  };
301 
302 } // namespace Opm
303 
304 #endif // OPM_PARSER_PVTX_TABLE_HPP
auto cbegin() const
Start of sequence of sub-tables.
Definition: PvtxTable.hpp:199
Definition: TableSchema.hpp:32
virtual ~PvtxTable()=default
Virtual destructor.
bool operator==(const PvtxTable &data) const
Equality predicate.
Definition: PvtxTable.cpp:156
TableSchema m_saturatedSchema
Table description of saturated states.
Definition: PvtxTable.hpp:245
void init(const DeckKeyword &keyword, std::size_t tableIdx)
Populate internal data structures from PVTx input table data.
Definition: PvtxTable.cpp:170
TableSchema m_underSaturatedSchema
Table description of under-saturated states.
Definition: PvtxTable.hpp:242
PvtxTable()=default
Default constructor.
Definition: ColumnSchema.hpp:31
Base class for PVTG and PVTO tables.
Definition: PvtxTable.hpp:116
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition: PvtxTable.hpp:222
auto end() const
End of sequence of sub-tables.
Definition: PvtxTable.hpp:202
SimpleTable m_saturatedTable
Inferred table of saturated states.
Definition: PvtxTable.hpp:253
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: SimpleTable.hpp:35
const SimpleTable & getSaturatedTable() const
Retrieve derived table of saturated states.
Definition: PvtxTable.cpp:121
Definition: TableColumn.hpp:32
ColumnSchema m_outerColumnSchema
Table description of primary lookup key.
Definition: PvtxTable.hpp:236
auto cend() const
End of sequence of sub-tables.
Definition: PvtxTable.hpp:205
static std::vector< std::pair< std::size_t, std::size_t > > recordRanges(const DeckKeyword &keyword)
Identify which input records pertain to which PVT regions.
Definition: PvtxTable.cpp:79
TableColumn m_outerColumn
Primary lookup key values.
Definition: PvtxTable.hpp:239
static PvtxTable serializationTestObject()
Create a serialisation test object.
Definition: PvtxTable.cpp:105
double getArgValue(std::size_t index) const
Retrieve composition/pressure node value at input point.
Definition: PvtxTable.cpp:145
const SimpleTable & getUnderSaturatedTable(std::size_t tableNumber) const
Retrieve sub-table for a single composition or pressure node.
Definition: PvtxTable.cpp:127
std::size_t size() const
Number of sub-tables.
Definition: PvtxTable.cpp:140
static std::size_t numTables(const DeckKeyword &keyword)
Number of complete tables in input PVTx keyword.
Definition: PvtxTable.cpp:71
std::vector< SimpleTable > m_underSaturatedTables
Under-saturated sub-tables.
Definition: PvtxTable.hpp:250
auto begin() const
Start of sequence of sub-tables.
Definition: PvtxTable.hpp:193
Class for (de-)serializing.
Definition: Serializer.hpp:94
Definition: DeckKeyword.hpp:36