Skip to content

Commit 343cdd8

Browse files
committed
fix(Python): add smart holder on Identified objects
1 parent dc8c0b4 commit 343cdd8

16 files changed

Lines changed: 28 additions & 23 deletions

bindings/python/src/explicit/mixin/core/fault.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525

2626
#define PYTHON_FAULT( dimension ) \
2727
const auto name##dimension = "Fault" + std::to_string( dimension ) + "D"; \
28-
pybind11::class_< Fault##dimension##D, Component##dimension##D > \
28+
pybind11::class_< Fault##dimension##D, Component##dimension##D, \
29+
pybind11::smart_holder > \
2930
fault##dimension##D( module, name##dimension.c_str() ); \
3031
\
3132
pybind11::enum_< Fault##dimension##D::FAULT_TYPE >( \

bindings/python/src/explicit/mixin/core/fault_block.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#define PYTHON_FAULT_BLOCK( dimension ) \
2727
const auto name##dimension = \
2828
"FaultBlock" + std::to_string( dimension ) + "D"; \
29-
pybind11::class_< FaultBlock##dimension##D, Component##dimension##D >( \
30-
module, name##dimension.c_str() ) \
29+
pybind11::class_< FaultBlock##dimension##D, Component##dimension##D, \
30+
pybind11::smart_holder >( module, name##dimension.c_str() ) \
3131
.def( "component_id", &FaultBlock##dimension##D::component_id )
3232

3333
namespace geode

bindings/python/src/explicit/mixin/core/fault_blocks.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#define PYTHON_FAULT_BLOCKS( dimension ) \
2828
const auto name##dimension = \
2929
"FaultBlocks" + std::to_string( dimension ) + "D"; \
30-
pybind11::class_< FaultBlocks##dimension##D >( \
30+
pybind11::class_< FaultBlocks##dimension##D, pybind11::smart_holder >( \
3131
module, name##dimension.c_str() ) \
3232
.def( "nb_fault_blocks", &FaultBlocks##dimension##D::nb_fault_blocks ) \
3333
.def( "fault_block", &FaultBlocks##dimension##D::fault_block, \

bindings/python/src/explicit/mixin/core/faults.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#define PYTHON_FAULTS( dimension ) \
2828
const auto name##dimension = "Faults" + std::to_string( dimension ) + "D"; \
29-
pybind11::class_< Faults##dimension##D >( \
29+
pybind11::class_< Faults##dimension##D, pybind11::smart_holder >( \
3030
module, name##dimension.c_str() ) \
3131
.def( "nb_faults", &Faults##dimension##D::nb_faults ) \
3232
.def( "fault", &Faults##dimension##D::fault, \

bindings/python/src/explicit/mixin/core/horizon.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
#define PYTHON_HORIZON( dimension ) \
2727
const auto name##dimension = \
2828
"Horizon" + std::to_string( dimension ) + "D"; \
29-
pybind11::class_< Horizon##dimension##D, Component##dimension##D > \
29+
pybind11::class_< Horizon##dimension##D, Component##dimension##D, \
30+
pybind11::smart_holder > \
3031
horizon##dimension##D( module, name##dimension.c_str() ); \
3132
\
3233
pybind11::enum_< Horizon##dimension##D::CONTACT_TYPE >( \

bindings/python/src/explicit/mixin/core/horizons.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#define PYTHON_HORIZONS( dimension ) \
2828
const auto name##dimension = \
2929
"Horizons" + std::to_string( dimension ) + "D"; \
30-
pybind11::class_< Horizons##dimension##D >( \
30+
pybind11::class_< Horizons##dimension##D, pybind11::smart_holder >( \
3131
module, name##dimension.c_str() ) \
3232
.def( "nb_horizons", &Horizons##dimension##D::nb_horizons ) \
3333
.def( "horizon", &Horizons##dimension##D::horizon, \

bindings/python/src/explicit/mixin/core/stratigraphic_unit.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
const auto name##dimension = \
2828
"StratigraphicUnit" + std::to_string( dimension ) + "D"; \
2929
pybind11::class_< StratigraphicUnit##dimension##D, \
30-
Component##dimension##D >( module, name##dimension.c_str() ) \
30+
Component##dimension##D, pybind11::smart_holder >( \
31+
module, name##dimension.c_str() ) \
3132
.def( "component_id", &StratigraphicUnit##dimension##D::component_id )
3233

3334
namespace geode

bindings/python/src/explicit/mixin/core/stratigraphic_units.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
#define PYTHON_STRATIGRAPHIC_UNITS( dimension ) \
2828
const auto name##dimension = \
2929
"StratigraphicUnits" + std::to_string( dimension ) + "D"; \
30-
pybind11::class_< StratigraphicUnits##dimension##D >( \
31-
module, name##dimension.c_str() ) \
30+
pybind11::class_< StratigraphicUnits##dimension##D, \
31+
pybind11::smart_holder >( module, name##dimension.c_str() ) \
3232
.def( "nb_stratigraphic_units", \
3333
&StratigraphicUnits##dimension##D::nb_stratigraphic_units ) \
3434
.def( "stratigraphic_unit", \

bindings/python/src/explicit/representation/core/cross_section.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ namespace geode
3030
void define_cross_section( pybind11::module& module )
3131
{
3232
pybind11::class_< CrossSection, Section, Faults2D, Horizons2D,
33-
FaultBlocks2D, StratigraphicUnits2D >( module, "CrossSection" )
33+
FaultBlocks2D, StratigraphicUnits2D, pybind11::smart_holder >(
34+
module, "CrossSection" )
3435
.def( pybind11::init<>() )
3536
.def( pybind11::init( []( Section& section ) {
3637
return CrossSection{ section.clone() };

bindings/python/src/explicit/representation/core/structural_model.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ namespace geode
3030
void define_structural_model( pybind11::module& module )
3131
{
3232
pybind11::class_< StructuralModel, BRep, Faults3D, Horizons3D,
33-
FaultBlocks3D, StratigraphicUnits3D >( module, "StructuralModel" )
33+
FaultBlocks3D, StratigraphicUnits3D, pybind11::smart_holder >(
34+
module, "StructuralModel" )
3435
.def( pybind11::init<>() )
3536
.def( pybind11::init( []( BRep& model ) {
3637
return StructuralModel{ model.clone() };

0 commit comments

Comments
 (0)