Expose the Parser class properly to Python
This commit is contained in:
27
python/cxx/parsecontext.cpp
Normal file
27
python/cxx/parsecontext.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
|
||||
#include <opm/parser/eclipse/Deck/Deck.hpp>
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
#include "common_state.hpp"
|
||||
#include "common.hpp"
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
void (ParseContext::*ctx_update)(const std::string&, InputError::Action) = &ParseContext::update;
|
||||
|
||||
}
|
||||
|
||||
void opmcommon_python::export_ParseContext(py::module& module) {
|
||||
|
||||
py::class_< ParseContext >(module, "ParseContext" )
|
||||
.def(py::init<>())
|
||||
.def(py::init<const std::vector<std::pair<std::string, InputError::Action>>>())
|
||||
.def( "update", ctx_update );
|
||||
|
||||
py::enum_< InputError::Action >( module, "action" )
|
||||
.value( "throw", InputError::Action::THROW_EXCEPTION )
|
||||
.value( "warn", InputError::Action::WARN )
|
||||
.value( "ignore", InputError::Action::IGNORE );
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user