Placed the Python cxx wrapping in namespace python::common

This commit is contained in:
Joakim Hove
2019-09-13 09:22:49 +02:00
parent ab51fce599
commit f264c358e7
16 changed files with 38 additions and 30 deletions

View File

@@ -2,20 +2,24 @@
#include "common.hpp"
PYBIND11_MODULE(libopmcommon_python, module) {
opmcommon_python::export_ParseContext(module);
opmcommon_python::export_Parser(module);
opmcommon_python::export_Deck(module);
opmcommon_python::export_DeckKeyword(module);
opmcommon_python::export_Schedule(module);
opmcommon_python::export_Well(module);
opmcommon_python::export_Group(module);
opmcommon_python::export_GroupTree(module);
opmcommon_python::export_Connection(module);
opmcommon_python::export_EclipseConfig(module);
opmcommon_python::export_Eclipse3DProperties(module);
opmcommon_python::export_EclipseState(module);
opmcommon_python::export_TableManager(module);
opmcommon_python::export_EclipseGrid(module);
void python::common::export_all(py::module& module) {
export_ParseContext(module);
export_Parser(module);
export_Deck(module);
export_DeckKeyword(module);
export_Schedule(module);
export_Well(module);
export_Group(module);
export_GroupTree(module);
export_Connection(module);
export_EclipseConfig(module);
export_Eclipse3DProperties(module);
export_EclipseState(module);
export_TableManager(module);
export_EclipseGrid(module);
}
PYBIND11_MODULE(libopmcommon_python, module) {
python::common::export_all(module);
}

View File

@@ -11,8 +11,10 @@ const py::return_value_policy ref_internal = py::return_value_policy::reference_
const py::return_value_policy python_owner = py::return_value_policy::take_ownership;
const py::return_value_policy move = py::return_value_policy::move;
namespace opmcommon_python {
namespace python {
namespace common {
void export_all(py::module& module);
void export_Connection(py::module& module);
void export_Deck(py::module& module);
void export_DeckKeyword(py::module& module);
@@ -27,6 +29,8 @@ namespace opmcommon_python {
void export_Schedule(py::module& module);
void export_TableManager(py::module& module);
void export_Well(py::module& module);
}
}
#endif //SUNBEAM_HPP

View File

@@ -15,7 +15,7 @@ std::string direction( const Connection& c ) {
}
void opmcommon_python::export_Connection(py::module& module) {
void python::common::export_Connection(py::module& module) {
py::class_< Connection >( module, "Connection")
.def_property_readonly("direction", &direction )

View File

@@ -37,7 +37,7 @@ namespace {
}
void opmcommon_python::export_Deck(py::module &module) {
void python::common::export_Deck(py::module &module) {
py::class_< Deck >(module, "Deck")
.def( "__len__", &size )

View File

@@ -56,7 +56,7 @@ struct DeckRecordIterator
}
void opmcommon_python::export_DeckKeyword(py::module& module) {
void python::common::export_DeckKeyword(py::module& module) {
py::class_< DeckKeyword >( module, "DeckKeyword")
.def( "__repr__", &DeckKeyword::name )
.def( "__str__", &str<DeckKeyword> )

View File

@@ -35,7 +35,7 @@ namespace {
}
void opmcommon_python::export_Eclipse3DProperties(py::module& module) {
void python::common::export_Eclipse3DProperties(py::module& module) {
py::class_< Eclipse3DProperties >( module, "Eclipse3DProperties")
.def( "getRegions", &regions )

View File

@@ -8,7 +8,7 @@
#include "common.hpp"
void opmcommon_python::export_EclipseConfig(py::module& module)
void python::common::export_EclipseConfig(py::module& module)
{
py::class_< EclipseConfig >( module, "EclipseConfig" )
.def( "init", &EclipseConfig::init, ref_internal)

View File

@@ -41,7 +41,7 @@ namespace {
}
void opmcommon_python::export_EclipseGrid(py::module& module) {
void python::common::export_EclipseGrid(py::module& module) {
py::class_< EclipseGrid >( module, "EclipseGrid")
.def( "_getXYZ", &getXYZ )

View File

@@ -85,7 +85,7 @@ namespace {
}
void opmcommon_python::export_EclipseState(py::module& module) {
void python::common::export_EclipseState(py::module& module) {
py::class_< EclipseState >( module, "EclipseState" )
.def_property_readonly( "title", &EclipseState::getTitle )

View File

@@ -14,7 +14,7 @@ namespace {
}
}
void opmcommon_python::export_Group(py::module& module) {
void python::common::export_Group(py::module& module) {
py::class_< Group2 >( module, "Group")
.def_property_readonly( "name", &Group2::name)

View File

@@ -15,7 +15,7 @@ namespace {
}
}
void opmcommon_python::export_GroupTree(py::module& module) {
void python::common::export_GroupTree(py::module& module) {
py::class_<GTNode>(module, "GroupTree")

View File

@@ -12,7 +12,7 @@ namespace {
}
void opmcommon_python::export_ParseContext(py::module& module) {
void python::common::export_ParseContext(py::module& module) {
py::class_< ParseContext >(module, "ParseContext" )
.def(py::init<>())

View File

@@ -51,7 +51,7 @@ namespace {
}
void opmcommon_python::export_Parser(py::module& module) {
void python::common::export_Parser(py::module& module) {
module.def( "parse", parse_file );
module.def( "parse_string", parse_string);

View File

@@ -90,7 +90,7 @@ namespace {
}
void opmcommon_python::export_Schedule(py::module& module) {
void python::common::export_Schedule(py::module& module) {
py::class_< Schedule >( module, "Schedule")
.def("_groups", &get_groups )

View File

@@ -16,7 +16,7 @@ namespace {
}
void opmcommon_python::export_TableManager(py::module& module) {
void python::common::export_TableManager(py::module& module) {
py::class_< TableManager >( module, "Tables")
.def( "__contains__", &TableManager::hasTables )

View File

@@ -33,7 +33,7 @@ namespace {
}
void opmcommon_python::export_Well(py::module& module) {
void python::common::export_Well(py::module& module) {
py::class_< Well2 >( module, "Well")
.def_property_readonly( "name", &Well2::name )