diff --git a/.clang-tidy b/.clang-tidy index 20868d455..48ceeace8 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -10,7 +10,10 @@ Checks: > -llvm-header-guard, -llvm-prefer-static-over-anonymous-namespace, -misc-no-recursion, + -misc-include-cleaner, + -misc-const-correctness, -modernize-use-trailing-return-type, + -portability-avoid-pragma-once, -readability-redundant-access-specifiers, -readability-convert-member-functions-to-static, -cppcoreguidelines-avoid-const-or-ref-data-members @@ -59,5 +62,3 @@ CheckOptions: value: 10 - key: readability-function-size.ParameterThreshold value: 4 - - key: misc-include-cleaner.IgnoreHeaders - value: utility;cstddef;geode/.*_export\.h;geode/.*/common\.h;geode/basic/types\.h;geode/basic/assert\.h; diff --git a/bindings/python/src/basic/cell_array.cpp b/bindings/python/src/basic/cell_array.cpp index 98cbfce48..06191c797 100644 --- a/bindings/python/src/basic/cell_array.cpp +++ b/bindings/python/src/basic/cell_array.cpp @@ -28,7 +28,7 @@ #define PYTHON_ARRAY( dimension ) \ const auto name##dimension = \ "CellArray" + std::to_string( dimension ) + "D"; \ - pybind11::class_< CellArray##dimension##D >( \ + pybind11::class_< CellArray##dimension##D, pybind11::smart_holder >( \ module, name##dimension.c_str() ) \ .def( \ "nb_cell_neighbors", &CellArray##dimension##D::nb_cell_neighbors ) \ diff --git a/bindings/python/src/basic/identifier.cpp b/bindings/python/src/basic/identifier.cpp index e45439133..f1b72ff27 100644 --- a/bindings/python/src/basic/identifier.cpp +++ b/bindings/python/src/basic/identifier.cpp @@ -30,7 +30,8 @@ namespace geode { void define_identifier( pybind11::module& module ) { - pybind11::class_< Identifier >( module, "Identifier" ) + pybind11::class_< Identifier, pybind11::smart_holder >( + module, "Identifier" ) .def( "id", &Identifier::id ) .def( "name", &Identifier::name ); } diff --git a/bindings/python/src/geometry/coordinate_system.cpp b/bindings/python/src/geometry/coordinate_system.cpp index 8f8edccd9..44f2b5bdc 100644 --- a/bindings/python/src/geometry/coordinate_system.cpp +++ b/bindings/python/src/geometry/coordinate_system.cpp @@ -28,8 +28,8 @@ #define PYTHON_COORDINATE_SYSTEM( dimension ) \ const auto name##dimension = \ "CoordinateSystem" + std::to_string( dimension ) + "D"; \ - pybind11::class_< CoordinateSystem##dimension##D >( \ - module, name##dimension.c_str() ) \ + pybind11::class_< CoordinateSystem##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def( pybind11::init<>() ) \ .def( pybind11::init< std::array< Vector< dimension >, dimension >, \ Point< dimension > >() ) \ diff --git a/bindings/python/src/image/core/raster_image.cpp b/bindings/python/src/image/core/raster_image.cpp index a32fb08ee..75b50444c 100644 --- a/bindings/python/src/image/core/raster_image.cpp +++ b/bindings/python/src/image/core/raster_image.cpp @@ -30,7 +30,8 @@ const auto name##dimension = \ "RasterImage" + std::to_string( dimension ) + "D"; \ pybind11::class_< RasterImage##dimension##D, CellArray##dimension##D, \ - Identifier >( module, name##dimension.c_str() ) \ + Identifier, pybind11::smart_holder >( \ + module, name##dimension.c_str() ) \ .def( pybind11::init< std::array< index_t, dimension > >() ) \ .def( \ "native_extension", &RasterImage##dimension##D::native_extension ) \ diff --git a/bindings/python/src/mesh/core/crs_managers.cpp b/bindings/python/src/mesh/core/crs_managers.cpp index e796a8e7e..a6bb7a33b 100644 --- a/bindings/python/src/mesh/core/crs_managers.cpp +++ b/bindings/python/src/mesh/core/crs_managers.cpp @@ -31,8 +31,8 @@ #define PYTHON_CRS_MANAGERS( dimension ) \ const auto name##dimension = "CoordinateReferenceSystemManagers" \ + std::to_string( dimension ) + "D"; \ - pybind11::class_< CoordinateReferenceSystemManagers##dimension##D >( \ - module, name##dimension.c_str() ) \ + pybind11::class_< CoordinateReferenceSystemManagers##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def( "coordinate_reference_system_manager1D", \ static_cast< const CoordinateReferenceSystemManager1D& ( \ CoordinateReferenceSystemManagers##dimension##D::*) () \ diff --git a/bindings/python/src/mesh/core/edged_curve.cpp b/bindings/python/src/mesh/core/edged_curve.cpp index 2579e2bb6..0c34efd12 100644 --- a/bindings/python/src/mesh/core/edged_curve.cpp +++ b/bindings/python/src/mesh/core/edged_curve.cpp @@ -32,8 +32,8 @@ const auto name##dimension = \ "EdgedCurve" + std::to_string( dimension ) + "D"; \ pybind11::class_< EdgedCurve##dimension##D, Graph, \ - CoordinateReferenceSystemManagers##dimension##D >( \ - module, name##dimension.c_str() ) \ + CoordinateReferenceSystemManagers##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def_static( "create", \ static_cast< \ std::unique_ptr< EdgedCurve##dimension##D > ( * )() >( \ diff --git a/bindings/python/src/mesh/core/graph.cpp b/bindings/python/src/mesh/core/graph.cpp index 389107c03..eb50094d3 100644 --- a/bindings/python/src/mesh/core/graph.cpp +++ b/bindings/python/src/mesh/core/graph.cpp @@ -31,7 +31,8 @@ namespace geode { void define_graph( pybind11::module& module ) { - pybind11::class_< Graph, VertexSet >( module, "Graph" ) + pybind11::class_< Graph, VertexSet, pybind11::smart_holder >( + module, "Graph" ) .def_static( "create", static_cast< std::unique_ptr< Graph > ( * )() >( &Graph::create ) ) diff --git a/bindings/python/src/mesh/core/grid.cpp b/bindings/python/src/mesh/core/grid.cpp index 6b66246f7..04aa4aa23 100644 --- a/bindings/python/src/mesh/core/grid.cpp +++ b/bindings/python/src/mesh/core/grid.cpp @@ -34,8 +34,8 @@ #define PYTHON_GRID( dimension ) \ const auto name##dimension = "Grid" + std::to_string( dimension ) + "D"; \ - pybind11::class_< Grid##dimension##D, CellArray##dimension##D >( \ - module, name##dimension.c_str() ) \ + pybind11::class_< Grid##dimension##D, CellArray##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def( "grid_coordinate_system", \ &Grid##dimension##D::grid_coordinate_system ) \ .def( "nb_cell_vertices", &Grid##dimension##D::nb_cell_vertices ) \ diff --git a/bindings/python/src/mesh/core/hybrid_solid.cpp b/bindings/python/src/mesh/core/hybrid_solid.cpp index 5a7a1b24e..395ec894f 100644 --- a/bindings/python/src/mesh/core/hybrid_solid.cpp +++ b/bindings/python/src/mesh/core/hybrid_solid.cpp @@ -28,8 +28,8 @@ #define PYTHON_HYBRID_SOLID( dimension ) \ const auto name##dimension = \ "HybridSolid" + std::to_string( dimension ) + "D"; \ - pybind11::class_< HybridSolid##dimension##D, SolidMesh##dimension##D >( \ - module, name##dimension.c_str() ) \ + pybind11::class_< HybridSolid##dimension##D, SolidMesh##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def_static( "create", \ static_cast< \ std::unique_ptr< HybridSolid##dimension##D > ( * )() >( \ diff --git a/bindings/python/src/mesh/core/light_regular_grid.cpp b/bindings/python/src/mesh/core/light_regular_grid.cpp index ac3ebdba2..437973815 100644 --- a/bindings/python/src/mesh/core/light_regular_grid.cpp +++ b/bindings/python/src/mesh/core/light_regular_grid.cpp @@ -38,8 +38,8 @@ namespace const auto class_name = absl::StrCat( "LightRegularGrid", dimension, "D" ); pybind11::class_< geode::LightRegularGrid< dimension >, - geode::Grid< dimension >, geode::Identifier >( - module, class_name.c_str() ) + geode::Grid< dimension >, geode::Identifier, + pybind11::smart_holder >( module, class_name.c_str() ) .def( pybind11::init< geode::Point< dimension >, std::array< geode::index_t, dimension >, std::array< double, dimension > >() ) diff --git a/bindings/python/src/mesh/core/point_set.cpp b/bindings/python/src/mesh/core/point_set.cpp index 24a83db02..3574214fa 100644 --- a/bindings/python/src/mesh/core/point_set.cpp +++ b/bindings/python/src/mesh/core/point_set.cpp @@ -32,8 +32,8 @@ const auto name##dimension = \ "PointSet" + std::to_string( dimension ) + "D"; \ pybind11::class_< PointSet##dimension##D, VertexSet, \ - CoordinateReferenceSystemManagers##dimension##D >( \ - module, name##dimension.c_str() ) \ + CoordinateReferenceSystemManagers##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def_static( "create", \ static_cast< std::unique_ptr< PointSet##dimension##D > ( * )() >( \ &PointSet##dimension##D::create ) ) \ diff --git a/bindings/python/src/mesh/core/polygonal_surface.cpp b/bindings/python/src/mesh/core/polygonal_surface.cpp index b4ff1045d..037f083b2 100644 --- a/bindings/python/src/mesh/core/polygonal_surface.cpp +++ b/bindings/python/src/mesh/core/polygonal_surface.cpp @@ -29,7 +29,8 @@ const auto name##dimension = \ "PolygonalSurface" + std::to_string( dimension ) + "D"; \ pybind11::class_< PolygonalSurface##dimension##D, \ - SurfaceMesh##dimension##D >( module, name##dimension.c_str() ) \ + SurfaceMesh##dimension##D, pybind11::smart_holder >( \ + module, name##dimension.c_str() ) \ .def_static( "create", \ static_cast< \ std::unique_ptr< PolygonalSurface##dimension##D > ( * )() >( \ diff --git a/bindings/python/src/mesh/core/polyhedral_solid.cpp b/bindings/python/src/mesh/core/polyhedral_solid.cpp index e10d5746a..c64d8edc9 100644 --- a/bindings/python/src/mesh/core/polyhedral_solid.cpp +++ b/bindings/python/src/mesh/core/polyhedral_solid.cpp @@ -28,8 +28,8 @@ #define PYTHON_POLYHEDRAL_SOLID( dimension ) \ const auto name##dimension = \ "PolyhedralSolid" + std::to_string( dimension ) + "D"; \ - pybind11::class_< PolyhedralSolid##dimension##D, \ - SolidMesh##dimension##D >( module, name##dimension.c_str() ) \ + pybind11::class_< PolyhedralSolid##dimension##D, SolidMesh##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def_static( "create", \ static_cast< \ std::unique_ptr< PolyhedralSolid##dimension##D > ( * )() >( \ diff --git a/bindings/python/src/mesh/core/regular_grid.cpp b/bindings/python/src/mesh/core/regular_grid.cpp index 60668f775..2bfc47e68 100644 --- a/bindings/python/src/mesh/core/regular_grid.cpp +++ b/bindings/python/src/mesh/core/regular_grid.cpp @@ -33,7 +33,8 @@ const auto name##dimension = \ "RegularGrid" + std::to_string( dimension ) + "D"; \ pybind11::class_< RegularGrid##dimension##D, Base##dimension##D, \ - Grid##dimension##D >( module, name##dimension.c_str() ) \ + Grid##dimension##D, pybind11::smart_holder >( \ + module, name##dimension.c_str() ) \ .def_static( "create", \ static_cast< \ std::unique_ptr< RegularGrid##dimension##D > ( * )() >( \ diff --git a/bindings/python/src/mesh/core/solid_mesh.cpp b/bindings/python/src/mesh/core/solid_mesh.cpp index 05c16ab6c..aeec52dcd 100644 --- a/bindings/python/src/mesh/core/solid_mesh.cpp +++ b/bindings/python/src/mesh/core/solid_mesh.cpp @@ -39,8 +39,8 @@ const auto name##dimension = \ "SolidMesh" + std::to_string( dimension ) + "D"; \ pybind11::class_< SolidMesh##dimension##D, VertexSet, \ - CoordinateReferenceSystemManagers##dimension##D >( \ - module, name##dimension.c_str() ) \ + CoordinateReferenceSystemManagers##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def_static( "create", \ static_cast< std::unique_ptr< SolidMesh##dimension##D > ( * )() >( \ &SolidMesh##dimension##D::create ) ) \ diff --git a/bindings/python/src/mesh/core/surface_mesh.cpp b/bindings/python/src/mesh/core/surface_mesh.cpp index f84fabf97..92b6c8a34 100644 --- a/bindings/python/src/mesh/core/surface_mesh.cpp +++ b/bindings/python/src/mesh/core/surface_mesh.cpp @@ -37,8 +37,8 @@ const auto name##dimension = \ "SurfaceMesh" + std::to_string( dimension ) + "D"; \ pybind11::class_< SurfaceMesh##dimension##D, VertexSet, \ - CoordinateReferenceSystemManagers##dimension##D >( \ - module, name##dimension.c_str() ) \ + CoordinateReferenceSystemManagers##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def( "are_edges_enabled", \ &SurfaceMesh##dimension##D::are_edges_enabled ) \ .def( "enable_edges", &SurfaceMesh##dimension##D::enable_edges ) \ diff --git a/bindings/python/src/mesh/core/tetrahedral_solid.cpp b/bindings/python/src/mesh/core/tetrahedral_solid.cpp index e95029411..4560b365e 100644 --- a/bindings/python/src/mesh/core/tetrahedral_solid.cpp +++ b/bindings/python/src/mesh/core/tetrahedral_solid.cpp @@ -30,8 +30,8 @@ #define PYTHON_TETRAHEDRAL_SOLID( dimension ) \ const auto name##dimension = \ "TetrahedralSolid" + std::to_string( dimension ) + "D"; \ - pybind11::class_< TetrahedralSolid##dimension##D, \ - SolidMesh##dimension##D >( module, name##dimension.c_str() ) \ + pybind11::class_< TetrahedralSolid##dimension##D, SolidMesh##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def_static( "create", \ static_cast< \ std::unique_ptr< TetrahedralSolid##dimension##D > ( * )() >( \ diff --git a/bindings/python/src/mesh/core/triangulated_surface.cpp b/bindings/python/src/mesh/core/triangulated_surface.cpp index 2ee1da71f..1cb85b959 100644 --- a/bindings/python/src/mesh/core/triangulated_surface.cpp +++ b/bindings/python/src/mesh/core/triangulated_surface.cpp @@ -30,7 +30,8 @@ const auto name##dimension = \ "TriangulatedSurface" + std::to_string( dimension ) + "D"; \ pybind11::class_< TriangulatedSurface##dimension##D, \ - SurfaceMesh##dimension##D >( module, name##dimension.c_str() ) \ + SurfaceMesh##dimension##D, pybind11::smart_holder >( \ + module, name##dimension.c_str() ) \ .def_static( \ "create", static_cast< std::unique_ptr< \ TriangulatedSurface##dimension##D > ( * )() >( \ diff --git a/bindings/python/src/mesh/core/vertex_set.cpp b/bindings/python/src/mesh/core/vertex_set.cpp index 597cc3f62..fe294f2ba 100644 --- a/bindings/python/src/mesh/core/vertex_set.cpp +++ b/bindings/python/src/mesh/core/vertex_set.cpp @@ -31,7 +31,8 @@ namespace geode { void define_vertex_set( pybind11::module& module ) { - pybind11::class_< VertexSet, Identifier >( module, "VertexSet" ) + pybind11::class_< VertexSet, Identifier, pybind11::smart_holder >( + module, "VertexSet" ) .def_static( "create", static_cast< std::unique_ptr< VertexSet > ( * )() >( &VertexSet::create ) ) diff --git a/bindings/python/src/model/mixin/core/block.cpp b/bindings/python/src/model/mixin/core/block.cpp index 4541f3f66..d1d995676 100644 --- a/bindings/python/src/model/mixin/core/block.cpp +++ b/bindings/python/src/model/mixin/core/block.cpp @@ -31,8 +31,8 @@ #define PYTHON_BLOCK( dimension ) \ const auto name##dimension = "Block" + std::to_string( dimension ) + "D"; \ - pybind11::class_< Block##dimension##D, Component##dimension##D >( \ - module, name##dimension.c_str() ) \ + pybind11::class_< Block##dimension##D, Component##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def( "mesh", &Block##dimension##D::mesh< SolidMesh##dimension##D >, \ pybind11::return_value_policy::reference ) \ .def( "polyhedral_mesh", \ diff --git a/bindings/python/src/model/mixin/core/block_collection.cpp b/bindings/python/src/model/mixin/core/block_collection.cpp index d9c87fe20..5a1852ef5 100644 --- a/bindings/python/src/model/mixin/core/block_collection.cpp +++ b/bindings/python/src/model/mixin/core/block_collection.cpp @@ -28,8 +28,8 @@ #define PYTHON_BLOCK_COLLECTION( dimension ) \ const auto name##dimension = \ "BlockCollection" + std::to_string( dimension ) + "D"; \ - pybind11::class_< BlockCollection##dimension##D, \ - Component##dimension##D >( module, name##dimension.c_str() ) \ + pybind11::class_< BlockCollection##dimension##D, Component##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def( "component_id", &BlockCollection##dimension##D::component_id ) \ .def_static( "component_type_static", \ &BlockCollection##dimension##D::component_type_static ) diff --git a/bindings/python/src/model/mixin/core/block_collections.cpp b/bindings/python/src/model/mixin/core/block_collections.cpp index 4cce82cfe..2b7c85c9b 100644 --- a/bindings/python/src/model/mixin/core/block_collections.cpp +++ b/bindings/python/src/model/mixin/core/block_collections.cpp @@ -29,8 +29,8 @@ #define PYTHON_BLOCK_COLLECTIONS( dimension ) \ const auto name##dimension = \ "BlockCollections" + std::to_string( dimension ) + "D"; \ - pybind11::class_< BlockCollections##dimension##D >( \ - module, name##dimension.c_str() ) \ + pybind11::class_< BlockCollections##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def( "nb_block_collections", \ &BlockCollections##dimension##D::nb_block_collections ) \ .def( "block_collection", \ diff --git a/bindings/python/src/model/mixin/core/blocks.cpp b/bindings/python/src/model/mixin/core/blocks.cpp index 4f8b9a755..3266f6c15 100644 --- a/bindings/python/src/model/mixin/core/blocks.cpp +++ b/bindings/python/src/model/mixin/core/blocks.cpp @@ -28,7 +28,7 @@ #define PYTHON_BLOCKS( dimension ) \ const auto name##dimension = "Blocks" + std::to_string( dimension ) + "D"; \ - pybind11::class_< Blocks##dimension##D >( \ + pybind11::class_< Blocks##dimension##D, pybind11::smart_holder >( \ module, name##dimension.c_str() ) \ .def( "nb_blocks", &Blocks##dimension##D::nb_blocks ) \ .def( "block", &Blocks##dimension##D::block, \ diff --git a/bindings/python/src/model/mixin/core/component.cpp b/bindings/python/src/model/mixin/core/component.cpp index d5efdebdd..efc2c6984 100644 --- a/bindings/python/src/model/mixin/core/component.cpp +++ b/bindings/python/src/model/mixin/core/component.cpp @@ -28,8 +28,8 @@ #define PYTHON_COMPONENT( dimension ) \ const auto name##dimension = \ "Component" + std::to_string( dimension ) + "D"; \ - pybind11::class_< Component##dimension##D, Identifier >( \ - module, name##dimension.c_str() ) \ + pybind11::class_< Component##dimension##D, Identifier, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def( "component_type", &Component##dimension##D::component_type ) namespace geode diff --git a/bindings/python/src/model/mixin/core/component_registry.cpp b/bindings/python/src/model/mixin/core/component_registry.cpp index ed3cf00d8..fb17ebafc 100644 --- a/bindings/python/src/model/mixin/core/component_registry.cpp +++ b/bindings/python/src/model/mixin/core/component_registry.cpp @@ -29,7 +29,8 @@ namespace geode { void define_component_registry( pybind11::module& module ) { - pybind11::class_< ComponentRegistry >( module, "ComponentRegistry" ) + pybind11::class_< ComponentRegistry, pybind11::smart_holder >( + module, "ComponentRegistry" ) .def( pybind11::init<>() ) .def( "mesh_components", &ComponentRegistry::mesh_components ) .def( "collection_components", diff --git a/bindings/python/src/model/mixin/core/corner.cpp b/bindings/python/src/model/mixin/core/corner.cpp index fa5afe843..42eaf4438 100644 --- a/bindings/python/src/model/mixin/core/corner.cpp +++ b/bindings/python/src/model/mixin/core/corner.cpp @@ -29,8 +29,8 @@ #define PYTHON_CORNER( dimension ) \ const auto name##dimension = "Corner" + std::to_string( dimension ) + "D"; \ - pybind11::class_< Corner##dimension##D, Component##dimension##D >( \ - module, name##dimension.c_str() ) \ + pybind11::class_< Corner##dimension##D, Component##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def( "mesh", &Corner##dimension##D::mesh, \ pybind11::return_value_policy::reference ) \ .def( "component_id", &Corner##dimension##D::component_id ) \ diff --git a/bindings/python/src/model/mixin/core/corner_collection.cpp b/bindings/python/src/model/mixin/core/corner_collection.cpp index 84a771f15..a3d0eaa55 100644 --- a/bindings/python/src/model/mixin/core/corner_collection.cpp +++ b/bindings/python/src/model/mixin/core/corner_collection.cpp @@ -28,8 +28,8 @@ #define PYTHON_CORNER_COLLECTION( dimension ) \ const auto name##dimension = \ "CornerCollection" + std::to_string( dimension ) + "D"; \ - pybind11::class_< CornerCollection##dimension##D, \ - Component##dimension##D >( module, name##dimension.c_str() ) \ + pybind11::class_< CornerCollection##dimension##D, Component##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def( "component_id", &CornerCollection##dimension##D::component_id ) \ .def_static( "component_type_static", \ &CornerCollection##dimension##D::component_type_static ) diff --git a/bindings/python/src/model/mixin/core/corner_collections.cpp b/bindings/python/src/model/mixin/core/corner_collections.cpp index a3bc2cbc3..41e817529 100644 --- a/bindings/python/src/model/mixin/core/corner_collections.cpp +++ b/bindings/python/src/model/mixin/core/corner_collections.cpp @@ -29,8 +29,8 @@ #define PYTHON_CORNER_COLLECTIONS( dimension ) \ const auto name##dimension = \ "CornerCollections" + std::to_string( dimension ) + "D"; \ - pybind11::class_< CornerCollections##dimension##D >( \ - module, name##dimension.c_str() ) \ + pybind11::class_< CornerCollections##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def( "nb_corner_collections", \ &CornerCollections##dimension##D::nb_corner_collections ) \ .def( "corner_collection", \ diff --git a/bindings/python/src/model/mixin/core/corners.cpp b/bindings/python/src/model/mixin/core/corners.cpp index 70c032af2..8350368ca 100644 --- a/bindings/python/src/model/mixin/core/corners.cpp +++ b/bindings/python/src/model/mixin/core/corners.cpp @@ -29,7 +29,7 @@ #define PYTHON_CORNERS( dimension ) \ const auto name##dimension = \ "Corners" + std::to_string( dimension ) + "D"; \ - pybind11::class_< Corners##dimension##D >( \ + pybind11::class_< Corners##dimension##D, pybind11::smart_holder >( \ module, name##dimension.c_str() ) \ .def( "nb_corners", &Corners##dimension##D::nb_corners ) \ .def( "corner", &Corners##dimension##D::corner, \ diff --git a/bindings/python/src/model/mixin/core/line.cpp b/bindings/python/src/model/mixin/core/line.cpp index 71f329684..818862097 100644 --- a/bindings/python/src/model/mixin/core/line.cpp +++ b/bindings/python/src/model/mixin/core/line.cpp @@ -29,8 +29,8 @@ #define PYTHON_LINE( dimension ) \ const auto name##dimension = "Line" + std::to_string( dimension ) + "D"; \ - pybind11::class_< Line##dimension##D, Component##dimension##D >( \ - module, name##dimension.c_str() ) \ + pybind11::class_< Line##dimension##D, Component##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def( "mesh", &Line##dimension##D::mesh, \ pybind11::return_value_policy::reference ) \ .def( "component_id", &Line##dimension##D::component_id ) \ diff --git a/bindings/python/src/model/mixin/core/line_collection.cpp b/bindings/python/src/model/mixin/core/line_collection.cpp index 0635ae266..37aa80a0a 100644 --- a/bindings/python/src/model/mixin/core/line_collection.cpp +++ b/bindings/python/src/model/mixin/core/line_collection.cpp @@ -28,8 +28,8 @@ #define PYTHON_LINE_COLLECTION( dimension ) \ const auto name##dimension = \ "LineCollection" + std::to_string( dimension ) + "D"; \ - pybind11::class_< LineCollection##dimension##D, Component##dimension##D >( \ - module, name##dimension.c_str() ) \ + pybind11::class_< LineCollection##dimension##D, Component##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def( "component_id", &LineCollection##dimension##D::component_id ) \ .def_static( "component_type_static", \ &LineCollection##dimension##D::component_type_static ) diff --git a/bindings/python/src/model/mixin/core/line_collections.cpp b/bindings/python/src/model/mixin/core/line_collections.cpp index af5e3c1ae..1fb80c0f9 100644 --- a/bindings/python/src/model/mixin/core/line_collections.cpp +++ b/bindings/python/src/model/mixin/core/line_collections.cpp @@ -29,7 +29,7 @@ #define PYTHON_LINE_COLLECTIONS( dimension ) \ const auto name##dimension = \ "LineCollections" + std::to_string( dimension ) + "D"; \ - pybind11::class_< LineCollections##dimension##D >( \ + pybind11::class_< LineCollections##dimension##D, pybind11::smart_holder >( \ module, name##dimension.c_str() ) \ .def( "nb_line_collections", \ &LineCollections##dimension##D::nb_line_collections ) \ diff --git a/bindings/python/src/model/mixin/core/lines.cpp b/bindings/python/src/model/mixin/core/lines.cpp index ef9de7877..73be9821b 100644 --- a/bindings/python/src/model/mixin/core/lines.cpp +++ b/bindings/python/src/model/mixin/core/lines.cpp @@ -28,7 +28,8 @@ #define PYTHON_LINES( dimension ) \ const auto name##dimension = "Lines" + std::to_string( dimension ) + "D"; \ - pybind11::class_< Lines##dimension##D >( module, name##dimension.c_str() ) \ + pybind11::class_< Lines##dimension##D, pybind11::smart_holder >( \ + module, name##dimension.c_str() ) \ .def( "nb_lines", &Lines##dimension##D::nb_lines ) \ .def( "line", &Lines##dimension##D::line, \ pybind11::return_value_policy::reference ) \ diff --git a/bindings/python/src/model/mixin/core/model_boundaries.cpp b/bindings/python/src/model/mixin/core/model_boundaries.cpp index 0d4807ddf..66222e8e3 100644 --- a/bindings/python/src/model/mixin/core/model_boundaries.cpp +++ b/bindings/python/src/model/mixin/core/model_boundaries.cpp @@ -29,7 +29,7 @@ #define PYTHON_MODEL_BOUNDARIES( dimension ) \ const auto name##dimension = \ "ModelBoundaries" + std::to_string( dimension ) + "D"; \ - pybind11::class_< ModelBoundaries##dimension##D >( \ + pybind11::class_< ModelBoundaries##dimension##D, pybind11::smart_holder >( \ module, name##dimension.c_str() ) \ .def( "nb_model_boundaries", \ &ModelBoundaries##dimension##D::nb_model_boundaries ) \ diff --git a/bindings/python/src/model/mixin/core/model_boundary.cpp b/bindings/python/src/model/mixin/core/model_boundary.cpp index 6480a7afd..d243f366a 100644 --- a/bindings/python/src/model/mixin/core/model_boundary.cpp +++ b/bindings/python/src/model/mixin/core/model_boundary.cpp @@ -28,8 +28,8 @@ #define PYTHON_MODEL_BOUNDARY( dimension ) \ const auto name##dimension = \ "ModelBoundary" + std::to_string( dimension ) + "D"; \ - pybind11::class_< ModelBoundary##dimension##D, Component##dimension##D >( \ - module, name##dimension.c_str() ) \ + pybind11::class_< ModelBoundary##dimension##D, Component##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def( "component_id", &ModelBoundary##dimension##D::component_id ) \ .def_static( "component_type_static", \ &ModelBoundary##dimension##D::component_type_static ) diff --git a/bindings/python/src/model/mixin/core/relationships.cpp b/bindings/python/src/model/mixin/core/relationships.cpp index 76be7e148..9ed92432c 100644 --- a/bindings/python/src/model/mixin/core/relationships.cpp +++ b/bindings/python/src/model/mixin/core/relationships.cpp @@ -29,7 +29,8 @@ namespace geode { void define_relationships( pybind11::module& module ) { - pybind11::class_< Relationships >( module, "Relationships" ) + pybind11::class_< Relationships, pybind11::smart_holder >( + module, "Relationships" ) .def( pybind11::init<>() ) .def( "nb_boundaries", &Relationships::nb_boundaries ) .def( diff --git a/bindings/python/src/model/mixin/core/surface.cpp b/bindings/python/src/model/mixin/core/surface.cpp index 316427128..9ef3e23fe 100644 --- a/bindings/python/src/model/mixin/core/surface.cpp +++ b/bindings/python/src/model/mixin/core/surface.cpp @@ -31,8 +31,8 @@ #define PYTHON_SURFACE( dimension ) \ const auto name##dimension = \ "Surface" + std::to_string( dimension ) + "D"; \ - pybind11::class_< Surface##dimension##D, Component##dimension##D >( \ - module, name##dimension.c_str() ) \ + pybind11::class_< Surface##dimension##D, Component##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def( "mesh", \ &Surface##dimension##D::mesh< SurfaceMesh##dimension##D >, \ pybind11::return_value_policy::reference ) \ diff --git a/bindings/python/src/model/mixin/core/surface_collection.cpp b/bindings/python/src/model/mixin/core/surface_collection.cpp index 7cf8c9da2..3158a1585 100644 --- a/bindings/python/src/model/mixin/core/surface_collection.cpp +++ b/bindings/python/src/model/mixin/core/surface_collection.cpp @@ -29,7 +29,8 @@ const auto name##dimension = \ "SurfaceCollection" + std::to_string( dimension ) + "D"; \ pybind11::class_< SurfaceCollection##dimension##D, \ - Component##dimension##D >( module, name##dimension.c_str() ) \ + Component##dimension##D, pybind11::smart_holder >( \ + module, name##dimension.c_str() ) \ .def( "component_id", &SurfaceCollection##dimension##D::component_id ) \ .def_static( "component_type_static", \ &SurfaceCollection##dimension##D::component_type_static ) diff --git a/bindings/python/src/model/mixin/core/surface_collections.cpp b/bindings/python/src/model/mixin/core/surface_collections.cpp index 29d1bff8a..bc31ec6d4 100644 --- a/bindings/python/src/model/mixin/core/surface_collections.cpp +++ b/bindings/python/src/model/mixin/core/surface_collections.cpp @@ -29,8 +29,8 @@ #define PYTHON_SURFACE_COLLECTIONS( dimension ) \ const auto name##dimension = \ "SurfaceCollections" + std::to_string( dimension ) + "D"; \ - pybind11::class_< SurfaceCollections##dimension##D >( \ - module, name##dimension.c_str() ) \ + pybind11::class_< SurfaceCollections##dimension##D, \ + pybind11::smart_holder >( module, name##dimension.c_str() ) \ .def( "nb_surface_collections", \ &SurfaceCollections##dimension##D::nb_surface_collections ) \ .def( "surface_collection", \ diff --git a/bindings/python/src/model/mixin/core/surfaces.cpp b/bindings/python/src/model/mixin/core/surfaces.cpp index c80a65533..0994d80e3 100644 --- a/bindings/python/src/model/mixin/core/surfaces.cpp +++ b/bindings/python/src/model/mixin/core/surfaces.cpp @@ -29,7 +29,7 @@ #define PYTHON_SURFACES( dimension ) \ const auto name##dimension = \ "Surfaces" + std::to_string( dimension ) + "D"; \ - pybind11::class_< Surfaces##dimension##D >( \ + pybind11::class_< Surfaces##dimension##D, pybind11::smart_holder >( \ module, name##dimension.c_str() ) \ .def( "nb_surfaces", &Surfaces##dimension##D::nb_surfaces ) \ .def( "surface", &Surfaces##dimension##D::surface, \ diff --git a/bindings/python/src/model/mixin/core/topology.cpp b/bindings/python/src/model/mixin/core/topology.cpp index 2beb60ea0..a5a28a724 100644 --- a/bindings/python/src/model/mixin/core/topology.cpp +++ b/bindings/python/src/model/mixin/core/topology.cpp @@ -30,6 +30,6 @@ namespace geode void define_topology( pybind11::module& module ) { pybind11::class_< Topology, Relationships, VertexIdentifier, - ComponentRegistry >( module, "Topology" ); + ComponentRegistry, pybind11::smart_holder >( module, "Topology" ); } } // namespace geode diff --git a/bindings/python/src/model/mixin/core/vertex_identifier.cpp b/bindings/python/src/model/mixin/core/vertex_identifier.cpp index 3b6767a44..1d73dde53 100644 --- a/bindings/python/src/model/mixin/core/vertex_identifier.cpp +++ b/bindings/python/src/model/mixin/core/vertex_identifier.cpp @@ -36,7 +36,8 @@ namespace geode .def_readwrite( "component_id", &ComponentMeshVertex::component_id ) .def_readwrite( "vertex", &ComponentMeshVertex::vertex ); - pybind11::class_< VertexIdentifier >( module, "VertexIdentifier" ) + pybind11::class_< VertexIdentifier, pybind11::smart_holder >( + module, "VertexIdentifier" ) .def( pybind11::init<>() ) .def( "nb_unique_vertices", &VertexIdentifier::nb_unique_vertices ) .def( "component_mesh_vertices", diff --git a/bindings/python/src/model/representation/core/brep.cpp b/bindings/python/src/model/representation/core/brep.cpp index a0e38dacc..c23d8e5fb 100644 --- a/bindings/python/src/model/representation/core/brep.cpp +++ b/bindings/python/src/model/representation/core/brep.cpp @@ -42,8 +42,8 @@ namespace geode { pybind11::class_< BRep, Topology, Corners3D, Lines3D, Surfaces3D, Blocks3D, ModelBoundaries3D, CornerCollections3D, LineCollections3D, - SurfaceCollections3D, BlockCollections3D, Identifier >( - module, "BRep" ) + SurfaceCollections3D, BlockCollections3D, Identifier, + pybind11::smart_holder >( module, "BRep" ) .def( pybind11::init<>() ) .def( "boundary_corners", diff --git a/bindings/python/src/model/representation/core/section.cpp b/bindings/python/src/model/representation/core/section.cpp index 4b801683d..825611e80 100644 --- a/bindings/python/src/model/representation/core/section.cpp +++ b/bindings/python/src/model/representation/core/section.cpp @@ -40,7 +40,8 @@ namespace geode { pybind11::class_< Section, Topology, Corners2D, Lines2D, Surfaces2D, ModelBoundaries2D, CornerCollections2D, LineCollections2D, - SurfaceCollections2D, Identifier >( module, "Section" ) + SurfaceCollections2D, Identifier, pybind11::smart_holder >( + module, "Section" ) .def( pybind11::init<>() ) .def( "boundary_corners",