Started exposing deck
This commit is contained in:
@@ -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 )
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user