add utility classes for some common keywords
the idea is to create a lightweight wrapper objects around
DeckKeywords which allow more convenient and more readable access to
the data. E.g. instead of
std::vector outerColumnNames{"RV", "P", "BG", "MUG"};
std::vector innerColumnNames{"P", "BG", "MUG"};
Opm::FullTable pvtgTable(deck->getKeyword("PVTG"),
outerColumnNames, innerColumnNames);
pvtgTable->getOuterTable()->getColumn(1);
one now better uses
Opm::PvtgTable pvtgTable(deck->getKeyword("PVTG"));
pvtgTable->getOuterTable()->getPressureColumn();
the idea for the other keywords is similar.
This commit is contained in:
@@ -47,6 +47,15 @@ namespace Opm {
|
||||
int recordIdx = 0,
|
||||
int firstEntityOffset = 0);
|
||||
|
||||
// constructor to make the base class compatible with specialized table implementations
|
||||
SimpleTable(Opm::DeckKeywordConstPtr keyword,
|
||||
int recordIdx = 0,
|
||||
int firstEntityOffset = 0)
|
||||
{
|
||||
throw std::logic_error("The base class of simple tables can't be "
|
||||
"instantiated without specifying columns!");
|
||||
}
|
||||
|
||||
int numColumns() const
|
||||
{ return m_columns.size(); }
|
||||
|
||||
@@ -60,12 +69,12 @@ namespace Opm {
|
||||
throw std::runtime_error("Unknown column name \""+name+"\"");
|
||||
|
||||
int colIdx = colIt->second;
|
||||
assert(0 <= colIdx && colIdx < m_columns.size());
|
||||
assert(0 <= colIdx && colIdx < static_cast<int>(m_columns.size()));
|
||||
return m_columns[colIdx];
|
||||
}
|
||||
const std::vector<double> &getColumn(int colIdx) const
|
||||
{
|
||||
assert(0 <= colIdx && colIdx < m_columns.size());
|
||||
assert(0 <= colIdx && colIdx < static_cast<int>(m_columns.size()));
|
||||
return m_columns[colIdx];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user