Files
opm-common/python/cxx/group_tree.cpp

28 lines
814 B
C++
Raw Normal View History

2019-08-09 10:48:43 +02:00
#include <opm/parser/eclipse/EclipseState/Schedule/Group/GTNode.hpp>
2019-06-27 14:08:22 +02:00
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include "sunbeam.hpp"
#include "converters.hpp"
namespace {
2019-08-09 10:48:43 +02:00
GTNode parent( const GTNode & gt ) {
return gt.parent();
2019-06-27 14:08:22 +02:00
}
2019-08-09 10:48:43 +02:00
py::list children( const GTNode & gt ) {
return iterable_to_pylist(gt.groups()) ;
2019-06-27 14:08:22 +02:00
}
}
void sunbeam::export_GroupTree(py::module& module) {
2019-08-09 10:48:43 +02:00
py::class_<GTNode>(module, "GroupTree")
2019-06-27 14:08:22 +02:00
2019-08-09 10:48:43 +02:00
.def( "name", &GTNode::name)
2019-06-27 14:08:22 +02:00
.def( "_parent", &parent, "parent function returning parent of a group")
.def( "_children", &children, "children function returning python"
" list containing children of a group")
;
}