2019-09-14 23:04:26 +02:00
|
|
|
#include <tuple>
|
|
|
|
|
|
2019-06-19 11:41:37 +02:00
|
|
|
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp>
|
2018-01-30 07:46:03 +01:00
|
|
|
#include <pybind11/stl.h>
|
2019-09-13 09:40:13 +02:00
|
|
|
#include "export.hpp"
|
2017-08-31 13:49:09 +02:00
|
|
|
|
|
|
|
|
|
2017-09-07 14:38:31 +02:00
|
|
|
namespace {
|
2017-08-31 13:49:09 +02:00
|
|
|
|
2019-06-19 11:41:37 +02:00
|
|
|
std::vector<Connection> connections( const Well2& w ) {
|
|
|
|
|
const auto& well_connections = w.getConnections();
|
2018-07-09 16:54:15 +02:00
|
|
|
return std::vector<Connection>(well_connections.begin(), well_connections.end());
|
2017-08-31 13:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2019-06-19 11:41:37 +02:00
|
|
|
std::string status( const Well2& w ) {
|
2019-08-23 13:58:39 +02:00
|
|
|
return Well2::Status2String( w.getStatus() );
|
2017-08-31 13:49:09 +02:00
|
|
|
}
|
|
|
|
|
|
2019-06-19 11:41:37 +02:00
|
|
|
std::string preferred_phase( const Well2& w ) {
|
2017-08-31 13:49:09 +02:00
|
|
|
switch( w.getPreferredPhase() ) {
|
|
|
|
|
case Phase::OIL: return "OIL";
|
|
|
|
|
case Phase::GAS: return "GAS";
|
|
|
|
|
case Phase::WATER: return "WATER";
|
|
|
|
|
default: throw std::logic_error( "Unhandled enum value" );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-14 23:04:26 +02:00
|
|
|
std::tuple<int, int, double> get_pos( const Well2& w ) {
|
|
|
|
|
return std::make_tuple(w.getHeadI(), w.getHeadJ(), w.getRefDepth());
|
|
|
|
|
}
|
2017-08-31 13:49:09 +02:00
|
|
|
|
2017-09-07 14:38:31 +02:00
|
|
|
}
|
2017-08-31 13:49:09 +02:00
|
|
|
|
2019-09-13 09:22:49 +02:00
|
|
|
void python::common::export_Well(py::module& module) {
|
2017-09-07 14:38:31 +02:00
|
|
|
|
2019-06-19 11:41:37 +02:00
|
|
|
py::class_< Well2 >( module, "Well")
|
|
|
|
|
.def_property_readonly( "name", &Well2::name )
|
2018-01-30 07:46:03 +01:00
|
|
|
.def_property_readonly( "preferred_phase", &preferred_phase )
|
2019-09-14 23:04:26 +02:00
|
|
|
.def( "pos", &get_pos )
|
2017-12-05 17:48:07 +01:00
|
|
|
.def( "status", &status )
|
2019-06-19 11:41:37 +02:00
|
|
|
.def( "isdefined", &Well2::hasBeenDefined )
|
|
|
|
|
.def( "isinjector", &Well2::isInjector )
|
|
|
|
|
.def( "isproducer", &Well2::isProducer )
|
|
|
|
|
.def( "group", &Well2::groupName )
|
|
|
|
|
.def( "guide_rate", &Well2::getGuideRate )
|
|
|
|
|
.def( "available_gctrl", &Well2::isAvailableForGroupControl )
|
2019-09-14 23:04:26 +02:00
|
|
|
.def( "connections", &connections );
|
2017-08-31 13:49:09 +02:00
|
|
|
|
|
|
|
|
}
|