PvdsTable.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2015 IRIS AS
3 
4 
5  This file is part of the Open Porous Media project (OPM).
6 
7  OPM is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  OPM is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with OPM. If not, see <http://www.gnu.org/licenses/>.
19  */
20 #ifndef OPM_PARSER_PVDS_TABLE_HPP
21 #define OPM_PARSER_PVDS_TABLE_HPP
22 
23 #include "SimpleTable.hpp"
24 
25 namespace Opm {
26  // forward declaration
27  class TableManager;
28 
29  class PvdsTable : public SimpleTable {
30  public:
31  friend class TableManager;
32 
33  PvdsTable() = default;
34 
40  {
41  SimpleTable::init(item,
42  std::vector<std::string>{"P", "BG", "MUG"});
43 
45  SimpleTable::checkMonotonic("P", /*isAscending=*/true);
46 
48  SimpleTable::checkMonotonic("BG", /*isAscending=*/false);
49 
51  SimpleTable::checkMonotonic("MUG", /*isAscending=*/true, /*strictlyMonotonic=*/false);
52  }
53 
58 
59  const std::vector<double> &getPressureColumn() const
60  { return SimpleTable::getColumn(0); }
61 
62  const std::vector<double> &getFormationFactorColumn() const
63  { return SimpleTable::getColumn(1); }
64 
65  const std::vector<double> &getViscosityColumn() const
66  { return SimpleTable::getColumn(2); }
67  };
68 }
69 
70 #endif
size_t numColumns() const
void init(Opm::DeckItemConstPtr deckItem, const std::vector< std::string > &columnNames)
Read simple tables from keywords like SWOF.
Definition: Deck.hpp:29
const std::vector< double > & getFormationFactorColumn() const
Definition: PvdsTable.hpp:62
const std::vector< double > & getColumn(const std::string &name) const
void checkNonDefaultable(const std::string &columnName)
std::shared_ptr< const DeckItem > DeckItemConstPtr
Definition: DeckItem.hpp:127
void init(Opm::DeckItemConstPtr item)
Read the PVDS keyword and provide some convenience methods for it.
Definition: PvdsTable.hpp:39
Definition: TableManager.hpp:66
size_t numRows() const
static size_t numTables(Opm::DeckKeywordConstPtr keyword)
Returns the number of tables in a keyword.
double evaluate(const std::string &columnName, double xPos) const
Evaluate a column of the table at a given position.
void checkMonotonic(const std::string &columnName, bool isAscending, bool isStrictlyMonotonic=true)
Definition: SimpleTable.hpp:32
const std::vector< double > & getPressureColumn() const
Definition: PvdsTable.hpp:59
PvdsTable()=default
const std::vector< double > & getViscosityColumn() const
Definition: PvdsTable.hpp:65
void applyDefaultsLinear(const std::string &columnName)
Definition: PvdsTable.hpp:29