Started exposing deck

This commit is contained in:
Jens Gåsemyr Magnus
2017-09-05 16:29:27 +02:00
parent 11fe32df4f
commit e1d860506a
6 changed files with 30 additions and 7 deletions

View File

@@ -1,5 +1,8 @@
#include <iostream>
#include <sstream>
#include <boost/python.hpp>
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
@@ -14,10 +17,18 @@ using copy = py::return_value_policy< py::copy_const_reference >;
namespace deck_keyword {
std::string write( const DeckKeyword& kw ) {
std::stringstream stream;
stream << kw;
return stream.str();
}
void export_DeckKeyword() {
py::class_< DeckKeyword >( "DeckKeyword", py::no_init )
.def( "__repr__", &DeckKeyword::name, copy() )
.def( "__str__", &write )
.def( "__len__", &DeckKeyword::size )
;
}