python: DeckKeyword constructor, w/ ParserKeyword arg.

parserkeyword can create deckkeyword.

python parserkeyword: removed create_deckkeyword.

DeckKeyword: member parser_keyword is shared_ptr.

python DeckKeyword constructor.

python: no exposure of ParserKeyword.

DeckKeyword: shared_ptr<ParserKeyword> -> ParskerKeyword.

python/cxx/deck_keyword.cpp: cosntructor takes arg const ParskerKeyword&.

test_parser.py: simplified test_pyinut.

...
This commit is contained in:
Steinar Foss
2019-09-11 11:46:46 +02:00
committed by Joakim Hove
parent 3229c343f7
commit 11d1c7d634
13 changed files with 88 additions and 96 deletions

View File

@@ -1,5 +1,7 @@
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include <opm/parser/eclipse/Parser/ParserKeyword.hpp>
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
@@ -58,6 +60,7 @@ struct DeckRecordIterator
void python::common::export_DeckKeyword(py::module& module) {
py::class_< DeckKeyword >( module, "DeckKeyword")
.def(py::init<const ParserKeyword& >())
.def( "__repr__", &DeckKeyword::name )
.def( "__str__", &str<DeckKeyword> )
.def("__iter__", [] (const DeckKeyword &keyword) { return py::make_iterator(keyword.begin(), keyword.end()); }, py::keep_alive<0,1>())