Add method to check that table input spans [0,1]
This commit is contained in:
@@ -153,6 +153,16 @@ void SimpleTable::checkMonotonic(const std::string& columnName,
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleTable::checkRange(const std::string& columnName)
|
||||
{
|
||||
int columnIdx = m_columnNames.at(columnName);
|
||||
int nRows = numRows();
|
||||
if (m_columns[columnIdx][0] != 0.0 || m_columns[columnIdx][nRows-1] != 1.0) {
|
||||
throw std::invalid_argument("Column " + columnName + " must span range [0 1]");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SimpleTable::applyDefaultsConstant(const std::string& columnName, double value)
|
||||
{
|
||||
int columnIdx = m_columnNames.at(columnName);
|
||||
|
||||
@@ -79,6 +79,7 @@ namespace Opm {
|
||||
void checkMonotonic(const std::string& columnName,
|
||||
bool isAscending,
|
||||
bool isStrictlyMonotonic = true);
|
||||
void checkRange(const std::string& columnName);
|
||||
void applyDefaultsConstant(const std::string& columnName, double value);
|
||||
void applyDefaultsLinear(const std::string& columnName);
|
||||
void createColumns(const std::vector<std::string> &columnNames);
|
||||
|
||||
Reference in New Issue
Block a user