Can extract parserkw's in python.

added keyword PYINPUT.

added pythonclass ParserKW.

python acces to ParserKW.

removed wrong kw PYINPUT.

...
This commit is contained in:
Steinar Foss
2019-09-06 10:45:33 +02:00
parent 7577e6d851
commit ff79a404be
4 changed files with 40 additions and 2 deletions

View File

@@ -1,5 +1,9 @@
#include <string>
#include <exception>
#include <opm/json/JsonObject.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParserKeyword.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <pybind11/stl.h>
@@ -42,6 +46,9 @@ namespace {
const Json::JsonObject keyword(json_string);
parser->addParserKeyword(keyword);
}
}
void opmcommon_python::export_Parser(py::module& module) {
@@ -52,6 +59,10 @@ void opmcommon_python::export_Parser(py::module& module) {
module.def( "create_deck_string", &create_deck_string);
py::class_<ParserKeyword>(module, "ParserKeyword")
.def_property_readonly("Name", &ParserKeyword::getName);
py::class_<SunbeamState>(module, "SunbeamState")
.def("_schedule", &SunbeamState::getSchedule, ref_internal)
.def("_state", &SunbeamState::getEclipseState, ref_internal)
@@ -65,5 +76,8 @@ void opmcommon_python::export_Parser(py::module& module) {
.def("parse" , py::overload_cast<const std::string&, const ParseContext&>(&Parser::parseFile, py::const_))
.def("parse_string", py::overload_cast<const std::string&>(&Parser::parseString, py::const_))
.def("parse_string", py::overload_cast<const std::string&, const ParseContext&>(&Parser::parseString, py::const_))
.def("add_keyword", add_keyword);
.def("add_keyword", add_keyword)
.def("__getitem__", &Parser::getKeyword, ref_internal);
}