Files
opm-common/python/cxx/table_manager.cpp
2019-09-13 09:40:13 +02:00

26 lines
658 B
C++

#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
#include "export.hpp"
namespace {
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 ) {
throw py::key_error( e.what() );
}
}
void python::common::export_TableManager(py::module& module) {
py::class_< TableManager >( module, "Tables")
.def( "__contains__", &TableManager::hasTables )
.def("_evaluate", &evaluate );
}