Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/is savable #856

Merged
merged 7 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions bindings/python/src/basic/attribute_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@
const auto constant##suffix = \
std::string{ "find_or_create_attribute_constant_" } + #suffix; \
manager.def( constant##suffix.c_str(), \
( std::shared_ptr< ConstantAttribute< type > >( AttributeManager::* )( \
absl::string_view, type ) ) \
& AttributeManager::find_or_create_attribute< ConstantAttribute, \
type > ); \
static_cast< std::shared_ptr< ConstantAttribute< type > > ( \
AttributeManager::* )( absl::string_view, type ) >( \
&AttributeManager::find_or_create_attribute< ConstantAttribute, \
type > ) ); \
const auto variable##suffix = \
std::string{ "find_or_create_attribute_variable_" } + #suffix; \
manager.def( variable##suffix.c_str(), \
( std::shared_ptr< VariableAttribute< type > >( AttributeManager::* )( \
absl::string_view, type ) ) \
& AttributeManager::find_or_create_attribute< VariableAttribute, \
type > ); \
static_cast< std::shared_ptr< VariableAttribute< type > > ( \
AttributeManager::* )( absl::string_view, type ) >( \
&AttributeManager::find_or_create_attribute< VariableAttribute, \
type > ) ); \
const auto sparse##suffix = \
std::string{ "find_or_create_attribute_sparse_" } + #suffix; \
manager.def( sparse##suffix.c_str(), \
( std::shared_ptr< SparseAttribute< type > >( AttributeManager::* )( \
absl::string_view, type ) ) \
& AttributeManager::find_or_create_attribute< SparseAttribute, \
type > )
static_cast< std::shared_ptr< SparseAttribute< type > > ( \
AttributeManager::* )( absl::string_view, type ) >( \
&AttributeManager::find_or_create_attribute< SparseAttribute, \
type > ) )

namespace geode
{
Expand Down
10 changes: 5 additions & 5 deletions bindings/python/src/geometry/basic_objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ namespace geode
PYTHON_TRIANGLE( 2 );
PYTHON_TRIANGLE( 3 )
.def( "normal",
( absl::optional< Vector3D >( Triangle< 3 >::* )() const )
& Triangle3D::normal )
.def(
"plane", ( absl::optional< Plane >( Triangle< 3 >::* )() const )
& Triangle3D::plane );
static_cast< absl::optional< Vector3D > ( Triangle< 3 >::* )()
const >( &Triangle3D::normal ) )
.def( "plane",
static_cast< absl::optional< Plane > ( Triangle< 3 >::* )()
const >( &Triangle3D::plane ) );

pybind11::class_< Plane >( module, "Plane" )
.def( pybind11::init< const Vector3D&, const Point3D& >() )
Expand Down
14 changes: 8 additions & 6 deletions bindings/python/src/geometry/bounding_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@
.def( "add_box", &BoundingBox##dimension##D::add_box ) \
.def( "add_point", &BoundingBox##dimension##D::add_point ) \
.def( "contains", &BoundingBox##dimension##D::contains ) \
.def( "intersects_bbox", ( bool( BoundingBox##dimension##D::* )( \
const BoundingBox< dimension >& ) const ) \
& BoundingBox##dimension##D::intersects ) \
.def( "intersects_ray", ( bool( BoundingBox##dimension##D::* )( \
const Ray< dimension >& ) const ) \
& BoundingBox##dimension##D::intersects ) \
.def( "intersects_bbox", \
static_cast< bool ( BoundingBox##dimension##D::* )( \
const BoundingBox< dimension >& ) const >( \
&BoundingBox##dimension##D::intersects ) ) \
.def( "intersects_ray", \
static_cast< bool ( BoundingBox##dimension##D::* )( \
const Ray< dimension >& ) const >( \
&BoundingBox##dimension##D::intersects ) ) \
.def( "min", &BoundingBox##dimension##D::min ) \
.def( "max", &BoundingBox##dimension##D::max ) \
.def( "center", &BoundingBox##dimension##D::center ) \
Expand Down
16 changes: 8 additions & 8 deletions bindings/python/src/geometry/intersection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@
const auto line_sphere##dimension = \
"line_sphere_intersection" + std::to_string( dimension ) + "D"; \
module.def( line_sphere##dimension.c_str(), \
( IntersectionResult< \
absl::InlinedVector< Point< dimension >, 2 > >( * )( \
const InfiniteLine< dimension >&, const Sphere< dimension >& ) ) \
& line_sphere_intersection ); \
static_cast< IntersectionResult< \
absl::InlinedVector< Point< dimension >, 2 > > ( * )( \
const InfiniteLine< dimension >&, const Sphere< dimension >& ) >( \
&line_sphere_intersection ) ); \
const auto segment_sphere##dimension = \
"segment_sphere_intersection" + std::to_string( dimension ) + "D"; \
module.def( segment_sphere##dimension.c_str(), \
( IntersectionResult< \
absl::InlinedVector< Point< dimension >, 2 > >( * )( \
const Segment< dimension >&, const Sphere< dimension >& ) ) \
& segment_sphere_intersection )
static_cast< IntersectionResult< \
absl::InlinedVector< Point< dimension >, 2 > > ( * )( \
const Segment< dimension >&, const Sphere< dimension >& ) >( \
&segment_sphere_intersection ) )

#define PYTHON_INTERSECTION_RESULT( Type ) \
const auto result##Type = std::string( "IntersectionResult" ) + #Type; \
Expand Down
10 changes: 4 additions & 6 deletions bindings/python/src/geometry/position.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,13 @@
const auto point_segment##dimension = \
"point_segment_position" + std::to_string( dimension ) + "D"; \
module.def( point_segment##dimension.c_str(), \
( Position( * )( \
const Point< dimension >&, const Segment< dimension >& ) ) \
& point_segment_position ); \
static_cast< Position ( * )( const Point< dimension >&, \
const Segment< dimension >& ) >( &point_segment_position ) ); \
const auto point_triangle##dimension = \
"point_triangle_position" + std::to_string( dimension ) + "D"; \
module.def( point_triangle##dimension.c_str(), \
( Position( * )( \
const Point< dimension >&, const Triangle< dimension >& ) ) \
& point_triangle_position )
static_cast< Position ( * )( const Point< dimension >&, \
const Triangle< dimension >& ) >( &point_triangle_position ) )

namespace geode
{
Expand Down
7 changes: 4 additions & 3 deletions bindings/python/src/geometry/sign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ namespace geode
{
module.def( "tetrahedron_volume_sign", &tetrahedron_volume_sign );
module.def( "triangle_area_sign2D",
( Sign( * )( const Triangle2D& ) ) & triangle_area_sign );
static_cast< Sign ( * )( const Triangle2D& ) >(
&triangle_area_sign ) );
module.def( "triangle_area_sign3D",
( Sign( * )( const Triangle3D&, local_index_t ) )
& triangle_area_sign );
static_cast< Sign ( * )( const Triangle3D&, local_index_t ) >(
&triangle_area_sign ) );
}
} // namespace geode
6 changes: 6 additions & 0 deletions bindings/python/src/image/io/raster_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
*
*/

#include <string>

#include "../../common.h"

#include "../../basic/factory.h"
Expand All @@ -43,6 +45,10 @@
&check_raster_image_missing_files< dimension > ); \
PYTHON_INPUT_CLASS( RasterImage##dimension##D, \
"RasterImage" + std::to_string( dimension ) + "D" ); \
const auto saveable##dimension = \
"is_raster_image_saveable" + std::to_string( dimension ) + "D"; \
BotellaA marked this conversation as resolved.
Show resolved Hide resolved
module.def( \
saveable##dimension.c_str(), &is_raster_image_saveable< dimension > ); \
PYTHON_FACTORY_CLASS( RasterImageInputFactory##dimension##D ); \
PYTHON_FACTORY_CLASS( RasterImageOutputFactory##dimension##D )

Expand Down
7 changes: 4 additions & 3 deletions bindings/python/src/mesh/builder/edged_curve_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@
CoordinateReferenceSystemManagersBuilder##dimension##D >( \
module, name##dimension.c_str() ) \
.def_static( "create", \
( std::unique_ptr< EdgedCurveBuilder##dimension##D >( * )( \
EdgedCurve< dimension >& ) ) \
& EdgedCurveBuilder##dimension##D::create ) \
static_cast< \
std::unique_ptr< EdgedCurveBuilder##dimension##D > ( * )( \
EdgedCurve< dimension >& ) >( \
&EdgedCurveBuilder##dimension##D::create ) ) \
.def( "create_point", &EdgedCurveBuilder##dimension##D::create_point )

namespace geode
Expand Down
14 changes: 7 additions & 7 deletions bindings/python/src/mesh/builder/graph_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ namespace geode
{
pybind11::class_< GraphBuilder, VertexSetBuilder >(
module, "GraphBuilder" )
.def_static(
"create", ( std::unique_ptr< GraphBuilder >( * )( Graph& ) )
& GraphBuilder::create )
.def( "create_edge",
( index_t( GraphBuilder::* )() ) & GraphBuilder::create_edge )
.def_static( "create",
static_cast< std::unique_ptr< GraphBuilder > ( * )( Graph& ) >(
&GraphBuilder::create ) )
.def( "create_edge", static_cast< index_t ( GraphBuilder::* )() >(
&GraphBuilder::create_edge ) )
.def( "create_edge_with_vertices",
( index_t( GraphBuilder::* )( index_t, index_t ) )
& GraphBuilder::create_edge )
static_cast< index_t ( GraphBuilder::* )( index_t, index_t ) >(
&GraphBuilder::create_edge ) )
.def( "create_edges", &GraphBuilder::create_edges )
.def( "set_edge_vertex", &GraphBuilder::set_edge_vertex )
.def( "delete_edges", &GraphBuilder::delete_edges )
Expand Down
7 changes: 4 additions & 3 deletions bindings/python/src/mesh/builder/hybrid_solid_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
pybind11::class_< HybridSolidBuilder##dimension##D, \
SolidMeshBuilder##dimension##D >( module, name##dimension.c_str() ) \
.def_static( "create", \
( std::unique_ptr< HybridSolidBuilder##dimension##D >( * )( \
HybridSolid< dimension >& ) ) \
& HybridSolidBuilder##dimension##D::create ) \
static_cast< \
std::unique_ptr< HybridSolidBuilder##dimension##D > ( * )( \
HybridSolid< dimension >& ) >( \
&HybridSolidBuilder##dimension##D::create ) ) \
.def( "create_tetrahedron", \
&HybridSolidBuilder##dimension##D::create_tetrahedron ) \
.def( "create_hexahedron", \
Expand Down
9 changes: 5 additions & 4 deletions bindings/python/src/mesh/builder/point_set_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@
pybind11::class_< PointSetBuilder##dimension##D, VertexSetBuilder, \
CoordinateReferenceSystemManagersBuilder##dimension##D >( \
module, name##dimension.c_str() ) \
.def_static( \
"create", ( std::unique_ptr< PointSetBuilder##dimension##D >( * )( \
PointSet< dimension >& ) ) \
& PointSetBuilder##dimension##D::create ) \
.def_static( "create", \
static_cast< \
std::unique_ptr< PointSetBuilder##dimension##D > ( * )( \
PointSet< dimension >& ) >( \
&PointSetBuilder##dimension##D::create ) ) \
.def( "create_point", &PointSetBuilder##dimension##D::create_point )

namespace geode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
"PolygonalSurfaceBuilder" + std::to_string( dimension ) + "D"; \
pybind11::class_< PolygonalSurfaceBuilder##dimension##D, \
SurfaceMeshBuilder##dimension##D >( module, name##dimension.c_str() ) \
.def_static( "create", \
( std::unique_ptr< PolygonalSurfaceBuilder##dimension##D >( * )( \
PolygonalSurface< dimension >& ) ) \
& PolygonalSurfaceBuilder##dimension##D::create )
.def_static( \
"create", static_cast< std::unique_ptr< \
PolygonalSurfaceBuilder##dimension##D > ( * )( \
PolygonalSurface< dimension >& ) >( \
&PolygonalSurfaceBuilder##dimension##D::create ) )

namespace geode
{
Expand Down
7 changes: 4 additions & 3 deletions bindings/python/src/mesh/builder/polyhedral_solid_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
pybind11::class_< PolyhedralSolidBuilder##dimension##D, \
SolidMeshBuilder##dimension##D >( module, name##dimension.c_str() ) \
.def_static( "create", \
( std::unique_ptr< PolyhedralSolidBuilder##dimension##D >( * )( \
PolyhedralSolid< dimension >& ) ) \
& PolyhedralSolidBuilder##dimension##D::create )
static_cast< \
std::unique_ptr< PolyhedralSolidBuilder##dimension##D > ( * )( \
PolyhedralSolid< dimension >& ) >( \
&PolyhedralSolidBuilder##dimension##D::create ) )

namespace geode
{
Expand Down
13 changes: 7 additions & 6 deletions bindings/python/src/mesh/builder/solid_mesh_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
CoordinateReferenceSystemManagersBuilder##dimension##D >( \
module, name##dimension.c_str() ) \
.def_static( "create", \
( std::unique_ptr< SolidMeshBuilder##dimension##D >( * )( \
SolidMesh< dimension >& ) ) \
& SolidMeshBuilder##dimension##D::create ) \
static_cast< \
std::unique_ptr< SolidMeshBuilder##dimension##D > ( * )( \
SolidMesh< dimension >& ) >( \
&SolidMeshBuilder##dimension##D::create ) ) \
.def( "create_point", &SolidMeshBuilder##dimension##D::create_point ) \
.def( "create_polyhedron", \
&SolidMeshBuilder##dimension##D::create_polyhedron ) \
Expand All @@ -47,9 +48,9 @@
.def( "set_polyhedron_adjacent", \
&SolidMeshBuilder##dimension##D::set_polyhedron_adjacent ) \
.def( "compute_polyhedron_adjacencies", \
( void( SolidMeshBuilder##dimension##D::* )() ) \
& SolidMeshBuilder##dimension##D:: \
compute_polyhedron_adjacencies ) \
static_cast< void ( SolidMeshBuilder##dimension##D::* )() >( \
&SolidMeshBuilder##dimension##D:: \
compute_polyhedron_adjacencies ) ) \
.def( "delete_polyhedra", \
&SolidMeshBuilder##dimension##D::delete_polyhedra ) \
.def( "permute_polyhedra", \
Expand Down
13 changes: 7 additions & 6 deletions bindings/python/src/mesh/builder/surface_mesh_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
CoordinateReferenceSystemManagersBuilder##dimension##D >( \
module, name##dimension.c_str() ) \
.def_static( "create", \
( std::unique_ptr< SurfaceMeshBuilder##dimension##D >( * )( \
SurfaceMesh< dimension >& ) ) \
& SurfaceMeshBuilder##dimension##D::create ) \
static_cast< \
std::unique_ptr< SurfaceMeshBuilder##dimension##D > ( * )( \
SurfaceMesh< dimension >& ) >( \
&SurfaceMeshBuilder##dimension##D::create ) ) \
.def( \
"create_point", &SurfaceMeshBuilder##dimension##D::create_point ) \
.def( "create_polygon", \
Expand All @@ -48,9 +49,9 @@
.def( "set_polygon_adjacent", \
&SurfaceMeshBuilder##dimension##D::set_polygon_adjacent ) \
.def( "compute_polygon_adjacencies", \
( void( SurfaceMeshBuilder##dimension##D::* )() ) \
& SurfaceMeshBuilder##dimension##D:: \
compute_polygon_adjacencies ) \
static_cast< void ( SurfaceMeshBuilder##dimension##D::* )() >( \
&SurfaceMeshBuilder##dimension##D:: \
compute_polygon_adjacencies ) ) \
.def( "delete_polygons", \
&SurfaceMeshBuilder##dimension##D::delete_polygons ) \
.def( "permute_polygons", \
Expand Down
Loading