File: table_manager.cpp

package info (click to toggle)
opm-common 2022.10%2Bds-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 78,468 kB
  • sloc: cpp: 164,554; python: 2,872; sh: 216; xml: 174; ansic: 149; pascal: 136; makefile: 12
file content (24 lines) | stat: -rw-r--r-- 614 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <opm/input/eclipse/EclipseState/Tables/TableManager.hpp>

#include "export.hpp"


namespace {

    double eval( 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", &eval);

}