python: Schedule bound directly by pybind11.

python: exposes Schedule.

python: added constructor for Schedule.

test_schedule: reintroduced most tests.

python test_schedule: all test works.

python test_wells. opened up some tests.

test_wells: opened up most.

test_wells.py ok.
This commit is contained in:
Steinar Foss
2019-09-14 23:04:26 +02:00
parent ae75aa3255
commit 0bc150794d
12 changed files with 94 additions and 174 deletions

View File

@@ -1,5 +1,10 @@
#include <ctime>
#include <chrono>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <pybind11/stl.h>
@@ -83,24 +88,21 @@ namespace {
return sch.hasWell( wellName );
}
const Group2& get_group(const Schedule& sch, const std::string& group_name, std::size_t timestep) {
return sch.getGroup2(group_name, timestep);
}
}
void python::common::export_Schedule(py::module& module) {
py::class_< Schedule >( module, "Schedule")
.def(py::init<const Deck&, const EclipseState& >())
.def("_groups", &get_groups )
.def_property_readonly( "start", &get_start_time )
.def_property_readonly( "end", &get_end_time )
.def_property_readonly( "timesteps", &get_timesteps )
.def( "_get_wells", &Schedule::getWells2)
.def("_getwell", &get_well)
.def( "get_wells", &Schedule::getWells2)
.def( "get_well", &get_well)
.def( "__contains__", &has_well )
.def( "_group", &get_group, ref_internal)
.def( "group", &Schedule::getGroup2, ref_internal)
.def( "_group_tree", &get_grouptree, ref_internal);
}