2017-08-31 13:49:09 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
|
|
|
|
|
|
2019-09-13 09:40:13 +02:00
|
|
|
#include "export.hpp"
|
2017-08-31 13:49:09 +02:00
|
|
|
|
|
|
|
|
|
2017-09-07 14:38:31 +02:00
|
|
|
namespace {
|
2017-08-31 13:49:09 +02:00
|
|
|
|
|
|
|
|
double evaluate( const TableManager& tab,
|
|
|
|
|
std::string tab_name,
|
|
|
|
|
int tab_idx,
|
|
|
|
|
std::string col_name, double x ) try {
|
|
|
|
|
return tab[tab_name].getTable(tab_idx).evaluate(col_name, x);
|
|
|
|
|
} catch( std::invalid_argument& e ) {
|
2018-01-30 07:46:03 +01:00
|
|
|
throw py::key_error( e.what() );
|
2017-08-31 13:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2017-09-07 14:38:31 +02:00
|
|
|
}
|
2017-08-31 13:49:09 +02:00
|
|
|
|
2019-09-13 09:22:49 +02:00
|
|
|
void python::common::export_TableManager(py::module& module) {
|
2017-08-31 13:49:09 +02:00
|
|
|
|
2018-01-30 07:46:03 +01:00
|
|
|
py::class_< TableManager >( module, "Tables")
|
|
|
|
|
.def( "__contains__", &TableManager::hasTables )
|
|
|
|
|
.def("_evaluate", &evaluate );
|
2017-08-31 13:49:09 +02:00
|
|
|
|
|
|
|
|
}
|