Files
opm-common/python/sunbeam/table_manager.cpp
Joakim Hove 77795b5005 Add 'python/' from commit '278373703455ea6562a0f8e5278b4db46eb1fc7e'
git-subtree-dir: python
git-subtree-mainline: e8dbf7d8ee
git-subtree-split: 2783737034
2019-05-08 07:20:29 +02:00

26 lines
652 B
C++

#include <opm/parser/eclipse/EclipseState/Tables/TableManager.hpp>
#include "sunbeam.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 sunbeam::export_TableManager(py::module& module) {
py::class_< TableManager >( module, "Tables")
.def( "__contains__", &TableManager::hasTables )
.def("_evaluate", &evaluate );
}