diff --git a/bindings/python/src/basic/attribute_manager.cpp b/bindings/python/src/basic/attribute_manager.cpp index 0ef4d56fc..c56128a7d 100644 --- a/bindings/python/src/basic/attribute_manager.cpp +++ b/bindings/python/src/basic/attribute_manager.cpp @@ -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 { diff --git a/bindings/python/src/geometry/basic_objects.cpp b/bindings/python/src/geometry/basic_objects.cpp index f55e323f1..152eebc8c 100644 --- a/bindings/python/src/geometry/basic_objects.cpp +++ b/bindings/python/src/geometry/basic_objects.cpp @@ -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& >() ) diff --git a/bindings/python/src/geometry/bounding_box.cpp b/bindings/python/src/geometry/bounding_box.cpp index 554e448db..3d658251b 100644 --- a/bindings/python/src/geometry/bounding_box.cpp +++ b/bindings/python/src/geometry/bounding_box.cpp @@ -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 ) \ diff --git a/bindings/python/src/geometry/intersection.cpp b/bindings/python/src/geometry/intersection.cpp index 42a41745d..c4fdaa94e 100644 --- a/bindings/python/src/geometry/intersection.cpp +++ b/bindings/python/src/geometry/intersection.cpp @@ -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; \ diff --git a/bindings/python/src/geometry/position.cpp b/bindings/python/src/geometry/position.cpp index c2b45cb13..8dfb5db88 100644 --- a/bindings/python/src/geometry/position.cpp +++ b/bindings/python/src/geometry/position.cpp @@ -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 { diff --git a/bindings/python/src/geometry/sign.cpp b/bindings/python/src/geometry/sign.cpp index 34675e8ba..c3da9e9ff 100644 --- a/bindings/python/src/geometry/sign.cpp +++ b/bindings/python/src/geometry/sign.cpp @@ -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 diff --git a/bindings/python/src/image/io/raster_image.cpp b/bindings/python/src/image/io/raster_image.cpp index 6032dfe4d..1db8a5062 100644 --- a/bindings/python/src/image/io/raster_image.cpp +++ b/bindings/python/src/image/io/raster_image.cpp @@ -21,6 +21,8 @@ * */ +#include + #include "../../common.h" #include "../../basic/factory.h" @@ -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"; \ + module.def( \ + saveable##dimension.c_str(), &is_raster_image_saveable< dimension > ); \ PYTHON_FACTORY_CLASS( RasterImageInputFactory##dimension##D ); \ PYTHON_FACTORY_CLASS( RasterImageOutputFactory##dimension##D ) diff --git a/bindings/python/src/mesh/builder/edged_curve_builder.cpp b/bindings/python/src/mesh/builder/edged_curve_builder.cpp index 59f714b78..ef40e7602 100644 --- a/bindings/python/src/mesh/builder/edged_curve_builder.cpp +++ b/bindings/python/src/mesh/builder/edged_curve_builder.cpp @@ -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 diff --git a/bindings/python/src/mesh/builder/graph_builder.cpp b/bindings/python/src/mesh/builder/graph_builder.cpp index 1a8827835..a557521bc 100644 --- a/bindings/python/src/mesh/builder/graph_builder.cpp +++ b/bindings/python/src/mesh/builder/graph_builder.cpp @@ -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 ) diff --git a/bindings/python/src/mesh/builder/hybrid_solid_builder.cpp b/bindings/python/src/mesh/builder/hybrid_solid_builder.cpp index 25cdec7b6..72d959556 100644 --- a/bindings/python/src/mesh/builder/hybrid_solid_builder.cpp +++ b/bindings/python/src/mesh/builder/hybrid_solid_builder.cpp @@ -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", \ diff --git a/bindings/python/src/mesh/builder/point_set_builder.cpp b/bindings/python/src/mesh/builder/point_set_builder.cpp index 4851bce86..5b53745d6 100644 --- a/bindings/python/src/mesh/builder/point_set_builder.cpp +++ b/bindings/python/src/mesh/builder/point_set_builder.cpp @@ -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 diff --git a/bindings/python/src/mesh/builder/polygonal_surface_builder.cpp b/bindings/python/src/mesh/builder/polygonal_surface_builder.cpp index 20edad135..aec4ce76a 100644 --- a/bindings/python/src/mesh/builder/polygonal_surface_builder.cpp +++ b/bindings/python/src/mesh/builder/polygonal_surface_builder.cpp @@ -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 { diff --git a/bindings/python/src/mesh/builder/polyhedral_solid_builder.cpp b/bindings/python/src/mesh/builder/polyhedral_solid_builder.cpp index fcbefe18e..90666ad57 100644 --- a/bindings/python/src/mesh/builder/polyhedral_solid_builder.cpp +++ b/bindings/python/src/mesh/builder/polyhedral_solid_builder.cpp @@ -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 { diff --git a/bindings/python/src/mesh/builder/solid_mesh_builder.cpp b/bindings/python/src/mesh/builder/solid_mesh_builder.cpp index b3ff39a69..9963b8d21 100644 --- a/bindings/python/src/mesh/builder/solid_mesh_builder.cpp +++ b/bindings/python/src/mesh/builder/solid_mesh_builder.cpp @@ -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 ) \ @@ -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", \ diff --git a/bindings/python/src/mesh/builder/surface_mesh_builder.cpp b/bindings/python/src/mesh/builder/surface_mesh_builder.cpp index eea524d59..615443c27 100644 --- a/bindings/python/src/mesh/builder/surface_mesh_builder.cpp +++ b/bindings/python/src/mesh/builder/surface_mesh_builder.cpp @@ -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", \ @@ -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", \ diff --git a/bindings/python/src/mesh/builder/tetrahedral_solid_builder.cpp b/bindings/python/src/mesh/builder/tetrahedral_solid_builder.cpp index 32338f0c9..5cdbeb05a 100644 --- a/bindings/python/src/mesh/builder/tetrahedral_solid_builder.cpp +++ b/bindings/python/src/mesh/builder/tetrahedral_solid_builder.cpp @@ -31,10 +31,11 @@ "TetrahedralSolidBuilder" + std::to_string( dimension ) + "D"; \ pybind11::class_< TetrahedralSolidBuilder##dimension##D, \ SolidMeshBuilder##dimension##D >( module, name##dimension.c_str() ) \ - .def_static( "create", \ - ( std::unique_ptr< TetrahedralSolidBuilder##dimension##D >( * )( \ - TetrahedralSolid< dimension >& ) ) \ - & TetrahedralSolidBuilder##dimension##D::create ) \ + .def_static( \ + "create", static_cast< std::unique_ptr< \ + TetrahedralSolidBuilder##dimension##D > ( * )( \ + TetrahedralSolid< dimension >& ) >( \ + &TetrahedralSolidBuilder##dimension##D::create ) ) \ .def( "create_tetrahedron", \ &TetrahedralSolidBuilder##dimension##D::create_tetrahedron ) diff --git a/bindings/python/src/mesh/builder/triangulated_surface_builder.cpp b/bindings/python/src/mesh/builder/triangulated_surface_builder.cpp index d661c3a36..7e11e339f 100644 --- a/bindings/python/src/mesh/builder/triangulated_surface_builder.cpp +++ b/bindings/python/src/mesh/builder/triangulated_surface_builder.cpp @@ -31,11 +31,11 @@ "TriangulatedSurfaceBuilder" + std::to_string( dimension ) + "D"; \ pybind11::class_< TriangulatedSurfaceBuilder##dimension##D, \ SurfaceMeshBuilder##dimension##D >( module, name##dimension.c_str() ) \ - .def_static( \ - "create", ( std::unique_ptr< \ - TriangulatedSurfaceBuilder##dimension##D >( * )( \ - TriangulatedSurface< dimension >& ) ) \ - & TriangulatedSurfaceBuilder##dimension##D::create ) \ + .def_static( "create", \ + static_cast< std::unique_ptr< \ + TriangulatedSurfaceBuilder##dimension##D > ( * )( \ + TriangulatedSurface< dimension >& ) >( \ + &TriangulatedSurfaceBuilder##dimension##D::create ) ) \ .def( "create_triangle", \ &TriangulatedSurfaceBuilder##dimension##D::create_triangle ) diff --git a/bindings/python/src/mesh/builder/vertex_set_builder.cpp b/bindings/python/src/mesh/builder/vertex_set_builder.cpp index 785544c18..70bed8fcf 100644 --- a/bindings/python/src/mesh/builder/vertex_set_builder.cpp +++ b/bindings/python/src/mesh/builder/vertex_set_builder.cpp @@ -33,8 +33,8 @@ namespace geode pybind11::class_< VertexSetBuilder, IdentifierBuilder >( module, "VertexSetBuilder" ) .def_static( "create", - ( std::unique_ptr< VertexSetBuilder >( * )( VertexSet& ) ) - & VertexSetBuilder::create ) + static_cast< std::unique_ptr< VertexSetBuilder > ( * )( + VertexSet& ) >( &VertexSetBuilder::create ) ) .def( "create_vertex", &VertexSetBuilder::create_vertex ) .def( "create_vertices", &VertexSetBuilder::create_vertices ) .def( "delete_vertices", &VertexSetBuilder::delete_vertices ) diff --git a/bindings/python/src/mesh/core/crs_managers.cpp b/bindings/python/src/mesh/core/crs_managers.cpp index 5a8ace1d9..9bb7028c8 100644 --- a/bindings/python/src/mesh/core/crs_managers.cpp +++ b/bindings/python/src/mesh/core/crs_managers.cpp @@ -34,28 +34,33 @@ pybind11::class_< CoordinateReferenceSystemManagers##dimension##D >( \ module, name##dimension.c_str() ) \ .def( "coordinate_reference_system_manager1D", \ - ( const CoordinateReferenceSystemManager1D& ( \ - CoordinateReferenceSystemManagers##dimension##D::*) () const ) \ - & CoordinateReferenceSystemManagers##dimension##D:: \ - coordinate_reference_system_manager1D, \ + static_cast< const CoordinateReferenceSystemManager1D& ( \ + CoordinateReferenceSystemManagers##dimension##D::*) () \ + const >( \ + &CoordinateReferenceSystemManagers##dimension##D:: \ + coordinate_reference_system_manager1D ), \ pybind11::return_value_policy::reference ) \ .def( "coordinate_reference_system_manager2D", \ - ( const CoordinateReferenceSystemManager2D& ( \ - CoordinateReferenceSystemManagers##dimension##D::*) () const ) \ - & CoordinateReferenceSystemManagers##dimension##D:: \ - coordinate_reference_system_manager2D, \ + static_cast< const CoordinateReferenceSystemManager2D& ( \ + CoordinateReferenceSystemManagers##dimension##D::*) () \ + const >( \ + &CoordinateReferenceSystemManagers##dimension##D:: \ + coordinate_reference_system_manager2D ), \ pybind11::return_value_policy::reference ) \ .def( "coordinate_reference_system_manager3D", \ - ( const CoordinateReferenceSystemManager3D& ( \ - CoordinateReferenceSystemManagers##dimension##D::*) () const ) \ - & CoordinateReferenceSystemManagers##dimension##D:: \ - coordinate_reference_system_manager3D, \ + static_cast< const CoordinateReferenceSystemManager3D& ( \ + CoordinateReferenceSystemManagers##dimension##D::*) () \ + const >( \ + &CoordinateReferenceSystemManagers##dimension##D:: \ + coordinate_reference_system_manager3D ), \ pybind11::return_value_policy::reference ) \ .def( "main_coordinate_reference_system_manager", \ - ( const CoordinateReferenceSystemManager##dimension##D& ( \ - CoordinateReferenceSystemManagers##dimension##D::*) () const ) \ - & CoordinateReferenceSystemManagers##dimension##D:: \ - main_coordinate_reference_system_manager, \ + static_cast< \ + const CoordinateReferenceSystemManager##dimension##D& ( \ + CoordinateReferenceSystemManagers##dimension##D::*) () \ + const >( \ + &CoordinateReferenceSystemManagers##dimension##D:: \ + main_coordinate_reference_system_manager ), \ pybind11::return_value_policy::reference ) \ .def( \ "point", &CoordinateReferenceSystemManagers##dimension##D::point ) diff --git a/bindings/python/src/mesh/core/edged_curve.cpp b/bindings/python/src/mesh/core/edged_curve.cpp index 45d832abb..a4bd4bd39 100644 --- a/bindings/python/src/mesh/core/edged_curve.cpp +++ b/bindings/python/src/mesh/core/edged_curve.cpp @@ -34,9 +34,10 @@ pybind11::class_< EdgedCurve##dimension##D, Graph, \ CoordinateReferenceSystemManagers##dimension##D >( \ module, name##dimension.c_str() ) \ - .def_static( \ - "create", ( std::unique_ptr< EdgedCurve##dimension##D >( * )() ) \ - & EdgedCurve##dimension##D::create ) \ + .def_static( "create", \ + static_cast< \ + std::unique_ptr< EdgedCurve##dimension##D > ( * )() >( \ + &EdgedCurve##dimension##D::create ) ) \ .def( "clone", &EdgedCurve##dimension##D::clone ) \ .def( "edge_length", &EdgedCurve##dimension##D::edge_length ) \ .def( "edge_barycenter", &EdgedCurve##dimension##D::edge_barycenter ) \ diff --git a/bindings/python/src/mesh/core/graph.cpp b/bindings/python/src/mesh/core/graph.cpp index df8b3fa1a..b6f99cfa3 100644 --- a/bindings/python/src/mesh/core/graph.cpp +++ b/bindings/python/src/mesh/core/graph.cpp @@ -33,7 +33,8 @@ namespace geode { pybind11::class_< Graph, VertexSet >( module, "Graph" ) .def_static( - "create", ( std::unique_ptr< Graph >( * )() ) & Graph::create ) + "create", static_cast< std::unique_ptr< Graph > ( * )() >( + &Graph::create ) ) .def( "clone", &Graph::clone ) .def( "edge_vertex", &Graph::edge_vertex ) .def( "edge_vertices", &Graph::edge_vertices ) diff --git a/bindings/python/src/mesh/core/hybrid_solid.cpp b/bindings/python/src/mesh/core/hybrid_solid.cpp index 1473eb512..117a9d49c 100644 --- a/bindings/python/src/mesh/core/hybrid_solid.cpp +++ b/bindings/python/src/mesh/core/hybrid_solid.cpp @@ -30,9 +30,10 @@ "HybridSolid" + std::to_string( dimension ) + "D"; \ pybind11::class_< HybridSolid##dimension##D, SolidMesh##dimension##D >( \ module, name##dimension.c_str() ) \ - .def_static( \ - "create", ( std::unique_ptr< HybridSolid##dimension##D >( * )() ) \ - & HybridSolid##dimension##D::create ) \ + .def_static( "create", \ + static_cast< \ + std::unique_ptr< HybridSolid##dimension##D > ( * )() >( \ + &HybridSolid##dimension##D::create ) ) \ .def( "clone", &HybridSolid##dimension##D::clone ) namespace geode diff --git a/bindings/python/src/mesh/core/point_set.cpp b/bindings/python/src/mesh/core/point_set.cpp index f277729c4..f124bb625 100644 --- a/bindings/python/src/mesh/core/point_set.cpp +++ b/bindings/python/src/mesh/core/point_set.cpp @@ -34,9 +34,9 @@ pybind11::class_< PointSet##dimension##D, VertexSet, \ CoordinateReferenceSystemManagers##dimension##D >( \ module, name##dimension.c_str() ) \ - .def_static( \ - "create", ( std::unique_ptr< PointSet##dimension##D >( * )() ) \ - & PointSet##dimension##D::create ) \ + .def_static( "create", \ + static_cast< std::unique_ptr< PointSet##dimension##D > ( * )() >( \ + &PointSet##dimension##D::create ) ) \ .def( "clone", &PointSet##dimension##D::clone ) \ .def( "bounding_box", &PointSet##dimension##D::bounding_box ) diff --git a/bindings/python/src/mesh/core/polygonal_surface.cpp b/bindings/python/src/mesh/core/polygonal_surface.cpp index 2852f9116..411f24b30 100644 --- a/bindings/python/src/mesh/core/polygonal_surface.cpp +++ b/bindings/python/src/mesh/core/polygonal_surface.cpp @@ -31,8 +31,9 @@ pybind11::class_< PolygonalSurface##dimension##D, \ SurfaceMesh##dimension##D >( module, name##dimension.c_str() ) \ .def_static( "create", \ - ( std::unique_ptr< PolygonalSurface##dimension##D >( * )() ) \ - & PolygonalSurface##dimension##D::create ) \ + static_cast< \ + std::unique_ptr< PolygonalSurface##dimension##D > ( * )() >( \ + &PolygonalSurface##dimension##D::create ) ) \ .def( "clone", &PolygonalSurface##dimension##D::clone ) namespace geode diff --git a/bindings/python/src/mesh/core/polyhedral_solid.cpp b/bindings/python/src/mesh/core/polyhedral_solid.cpp index 7b5b28ad5..2c689b0db 100644 --- a/bindings/python/src/mesh/core/polyhedral_solid.cpp +++ b/bindings/python/src/mesh/core/polyhedral_solid.cpp @@ -31,8 +31,9 @@ pybind11::class_< PolyhedralSolid##dimension##D, \ SolidMesh##dimension##D >( module, name##dimension.c_str() ) \ .def_static( "create", \ - ( std::unique_ptr< PolyhedralSolid##dimension##D >( * )() ) \ - & PolyhedralSolid##dimension##D::create ) \ + static_cast< \ + std::unique_ptr< PolyhedralSolid##dimension##D > ( * )() >( \ + &PolyhedralSolid##dimension##D::create ) ) \ .def( "clone", &PolyhedralSolid##dimension##D::clone ) namespace geode diff --git a/bindings/python/src/mesh/core/solid_mesh.cpp b/bindings/python/src/mesh/core/solid_mesh.cpp index 2f5e9555c..d5768c70f 100644 --- a/bindings/python/src/mesh/core/solid_mesh.cpp +++ b/bindings/python/src/mesh/core/solid_mesh.cpp @@ -41,9 +41,9 @@ pybind11::class_< SolidMesh##dimension##D, VertexSet, \ CoordinateReferenceSystemManagers##dimension##D >( \ module, name##dimension.c_str() ) \ - .def_static( \ - "create", ( std::unique_ptr< SolidMesh##dimension##D >( * )() ) \ - & SolidMesh##dimension##D::create ) \ + .def_static( "create", \ + static_cast< std::unique_ptr< SolidMesh##dimension##D > ( * )() >( \ + &SolidMesh##dimension##D::create ) ) \ .def( "clone", &SolidMesh##dimension##D::clone ) \ .def( "nb_polyhedra", &SolidMesh##dimension##D::nb_polyhedra ) \ .def( \ @@ -51,18 +51,18 @@ .def( "enable_edges", &SolidMesh##dimension##D::enable_edges ) \ .def( "disable_edges", &SolidMesh##dimension##D::disable_edges ) \ .def( "edges", \ - ( const SolidEdges##dimension##D& (SolidMesh##dimension##D::*) () \ - const ) \ - & SolidMesh##dimension##D::edges, \ + static_cast< const SolidEdges##dimension##D& ( \ + SolidMesh##dimension##D::*) () const >( \ + &SolidMesh##dimension##D::edges ), \ pybind11::return_value_policy::reference ) \ .def( "are_facets_enabled", \ &SolidMesh##dimension##D::are_facets_enabled ) \ .def( "enable_facets", &SolidMesh##dimension##D::enable_facets ) \ .def( "disable_facets", &SolidMesh##dimension##D::disable_facets ) \ .def( "facets", \ - ( const SolidFacets##dimension##D& (SolidMesh##dimension##D::*) () \ - const ) \ - & SolidMesh##dimension##D::facets, \ + static_cast< const SolidFacets##dimension##D& ( \ + SolidMesh##dimension##D::*) () const >( \ + &SolidMesh##dimension##D::facets ), \ pybind11::return_value_policy::reference ) \ .def( "nb_polyhedron_vertices", \ &SolidMesh##dimension##D::nb_polyhedron_vertices ) \ @@ -100,22 +100,22 @@ .def( "polyhedron_around_vertex", \ &SolidMesh##dimension##D::polyhedron_around_vertex ) \ .def( "polyhedra_around_vertex", \ - ( const PolyhedraAroundVertex& ( \ - SolidMesh##dimension##D::*) ( index_t ) const ) \ - & SolidMesh##dimension##D::polyhedra_around_vertex ) \ + static_cast< const PolyhedraAroundVertex& ( \ + SolidMesh##dimension##D::*) ( index_t ) const >( \ + &SolidMesh##dimension##D::polyhedra_around_vertex ) ) \ .def( "polyhedra_around_polyhedron_vertex", \ - ( const PolyhedraAroundVertex& ( \ + static_cast< const PolyhedraAroundVertex& ( \ SolidMesh##dimension##D::*) ( const PolyhedronVertex& ) \ - const ) \ - & SolidMesh##dimension##D::polyhedra_around_vertex ) \ + const >( \ + &SolidMesh##dimension##D::polyhedra_around_vertex ) ) \ .def( "polyhedra_around_edge", \ - ( PolyhedraAroundEdge( SolidMesh##dimension##D::* )( \ - const std::array< index_t, 2 >& ) const ) \ - & SolidMesh##dimension##D::polyhedra_around_edge ) \ + static_cast< PolyhedraAroundEdge ( SolidMesh##dimension##D::* )( \ + const std::array< index_t, 2 >& ) const >( \ + &SolidMesh##dimension##D::polyhedra_around_edge ) ) \ .def( "polyhedra_around_edge_with_hint", \ - ( PolyhedraAroundEdge( SolidMesh##dimension##D::* )( \ - const std::array< index_t, 2 >&, index_t ) const ) \ - & SolidMesh##dimension##D::polyhedra_around_edge ) \ + static_cast< PolyhedraAroundEdge ( SolidMesh##dimension##D::* )( \ + const std::array< index_t, 2 >&, index_t ) const >( \ + &SolidMesh##dimension##D::polyhedra_around_edge ) ) \ .def( "polyhedra_from_facet_vertices", \ &SolidMesh##dimension##D::polyhedra_from_facet_vertices ) \ .def( "polyhedron_attribute_manager", \ diff --git a/bindings/python/src/mesh/core/surface_mesh.cpp b/bindings/python/src/mesh/core/surface_mesh.cpp index 2f04d21a4..48e3838cb 100644 --- a/bindings/python/src/mesh/core/surface_mesh.cpp +++ b/bindings/python/src/mesh/core/surface_mesh.cpp @@ -44,9 +44,9 @@ .def( "enable_edges", &SurfaceMesh##dimension##D::enable_edges ) \ .def( "disable_edges", &SurfaceMesh##dimension##D::disable_edges ) \ .def( "edges", \ - ( const SurfaceEdges##dimension##D& ( \ - SurfaceMesh##dimension##D::*) () const ) \ - & SurfaceMesh##dimension##D::edges, \ + static_cast< const SurfaceEdges##dimension##D& ( \ + SurfaceMesh##dimension##D::*) () const >( \ + &SurfaceMesh##dimension##D::edges ), \ pybind11::return_value_policy::reference ) \ .def( "nb_polygons", &SurfaceMesh##dimension##D::nb_polygons ) \ .def( "nb_polygon_vertices", \ @@ -76,33 +76,34 @@ .def( "previous_on_border", \ &SurfaceMesh##dimension##D::previous_on_border ) \ .def( "polygon_edge_length", \ - ( double( SurfaceMesh##dimension##D::* )( const PolygonEdge& ) \ - const ) \ - & SurfaceMesh##dimension##D::edge_length ) \ + static_cast< double ( SurfaceMesh##dimension##D::* )( \ + const PolygonEdge& ) const >( \ + &SurfaceMesh##dimension##D::edge_length ) ) \ .def( "edge_length", ( double( SurfaceMesh##dimension##D::* )( \ const std::array< index_t, 2 >& ) const ) \ & SurfaceMesh##dimension##D::edge_length ) \ .def( "polygon_edge_barycenter", \ - ( Point< dimension >( SurfaceMesh##dimension##D::* )( \ - const PolygonEdge& ) const ) \ - & SurfaceMesh##dimension##D::edge_barycenter ) \ + static_cast< Point< dimension > ( SurfaceMesh##dimension##D::* )( \ + const PolygonEdge& ) const >( \ + &SurfaceMesh##dimension##D::edge_barycenter ) ) \ .def( "edge_barycenter", \ - ( Point< dimension >( SurfaceMesh##dimension##D::* )( \ - const std::array< index_t, 2 >& ) const ) \ - & SurfaceMesh##dimension##D::edge_barycenter ) \ + static_cast< Point< dimension > ( SurfaceMesh##dimension##D::* )( \ + const std::array< index_t, 2 >& ) const >( \ + &SurfaceMesh##dimension##D::edge_barycenter ) ) \ .def( "polygon_barycenter", \ &SurfaceMesh##dimension##D::polygon_barycenter ) \ .def( "polygon_area", &SurfaceMesh##dimension##D::polygon_area ) \ .def( "polygon_around_vertex", \ &SurfaceMesh##dimension##D::polygon_around_vertex ) \ .def( "polygons_around_vertex", \ - ( const PolygonsAroundVertex& ( \ - SurfaceMesh##dimension##D::*) ( index_t ) const ) \ - & SurfaceMesh##dimension##D::polygons_around_vertex ) \ + static_cast< const PolygonsAroundVertex& ( \ + SurfaceMesh##dimension##D::*) ( index_t ) const >( \ + &SurfaceMesh##dimension##D::polygons_around_vertex ) ) \ .def( "polygons_around_polygon_vertex", \ - ( const PolygonsAroundVertex& ( \ - SurfaceMesh##dimension##D::*) ( const PolygonVertex& ) const ) \ - & SurfaceMesh##dimension##D::polygons_around_vertex ) \ + static_cast< const PolygonsAroundVertex& ( \ + SurfaceMesh##dimension##D::*) ( const PolygonVertex& ) \ + const >( \ + &SurfaceMesh##dimension##D::polygons_around_vertex ) ) \ .def( "polygon_edge_from_vertices", \ &SurfaceMesh##dimension##D::polygon_edge_from_vertices ) \ .def( "polygons_from_edge_vertices", \ @@ -114,9 +115,10 @@ &SurfaceMesh##dimension##D::is_vertex_on_border ) \ .def( "texture_manager", &SurfaceMesh##dimension##D::texture_manager ) \ .def( "bounding_box", &SurfaceMesh##dimension##D::bounding_box ) \ - .def_static( \ - "create", ( std::unique_ptr< SurfaceMesh##dimension##D >( * )() ) \ - & SurfaceMesh##dimension##D::create ) \ + .def_static( "create", \ + static_cast< \ + std::unique_ptr< SurfaceMesh##dimension##D > ( * )() >( \ + &SurfaceMesh##dimension##D::create ) ) \ .def( "clone", &SurfaceMesh##dimension##D::clone ) \ .def( "is_triangulated_type", \ []( const SurfaceMesh< dimension >& surface ) { \ diff --git a/bindings/python/src/mesh/core/tetrahedral_solid.cpp b/bindings/python/src/mesh/core/tetrahedral_solid.cpp index 9d138412b..4ff216eca 100644 --- a/bindings/python/src/mesh/core/tetrahedral_solid.cpp +++ b/bindings/python/src/mesh/core/tetrahedral_solid.cpp @@ -33,8 +33,9 @@ pybind11::class_< TetrahedralSolid##dimension##D, \ SolidMesh##dimension##D >( module, name##dimension.c_str() ) \ .def_static( "create", \ - ( std::unique_ptr< TetrahedralSolid##dimension##D >( * )() ) \ - & TetrahedralSolid##dimension##D::create ) \ + static_cast< \ + std::unique_ptr< TetrahedralSolid##dimension##D > ( * )() >( \ + &TetrahedralSolid##dimension##D::create ) ) \ .def( "clone", &TetrahedralSolid##dimension##D::clone ) \ .def( "tetrahedron", &TetrahedralSolid##dimension##D::tetrahedron ) \ .def( "triangle", &TetrahedralSolid##dimension##D::triangle ) diff --git a/bindings/python/src/mesh/core/triangulated_surface.cpp b/bindings/python/src/mesh/core/triangulated_surface.cpp index 4fb2f3de1..43f088d03 100644 --- a/bindings/python/src/mesh/core/triangulated_surface.cpp +++ b/bindings/python/src/mesh/core/triangulated_surface.cpp @@ -31,9 +31,10 @@ "TriangulatedSurface" + std::to_string( dimension ) + "D"; \ pybind11::class_< TriangulatedSurface##dimension##D, \ SurfaceMesh##dimension##D >( module, name##dimension.c_str() ) \ - .def_static( "create", \ - ( std::unique_ptr< TriangulatedSurface##dimension##D >( * )() ) \ - & TriangulatedSurface##dimension##D::create ) \ + .def_static( \ + "create", static_cast< std::unique_ptr< \ + TriangulatedSurface##dimension##D > ( * )() >( \ + &TriangulatedSurface##dimension##D::create ) ) \ .def( "clone", &TriangulatedSurface##dimension##D::clone ) \ .def( "triangle", &TriangulatedSurface##dimension##D::triangle ) diff --git a/bindings/python/src/mesh/core/vertex_set.cpp b/bindings/python/src/mesh/core/vertex_set.cpp index 24cb56d67..c3f605015 100644 --- a/bindings/python/src/mesh/core/vertex_set.cpp +++ b/bindings/python/src/mesh/core/vertex_set.cpp @@ -32,8 +32,9 @@ namespace geode void define_vertex_set( pybind11::module& module ) { pybind11::class_< VertexSet, Identifier >( module, "VertexSet" ) - .def_static( "create", - ( std::unique_ptr< VertexSet >( * )() ) & VertexSet::create ) + .def_static( + "create", static_cast< std::unique_ptr< VertexSet > ( * )() >( + &VertexSet::create ) ) .def( "clone", &VertexSet::clone ) .def( "native_extension", &VertexSet::native_extension ) .def( "nb_vertices", &VertexSet::nb_vertices ) diff --git a/bindings/python/src/mesh/helpers/repair_polygon_orientations.cpp b/bindings/python/src/mesh/helpers/repair_polygon_orientations.cpp index e462a5daf..24b697e47 100644 --- a/bindings/python/src/mesh/helpers/repair_polygon_orientations.cpp +++ b/bindings/python/src/mesh/helpers/repair_polygon_orientations.cpp @@ -31,10 +31,10 @@ namespace geode void define_repair_polygon_orientations( pybind11::module& module ) { module.def( "repair_polygon_orientations2D", - ( void ( * )( SurfaceMesh< 2 >& ) ) - & repair_polygon_orientations< 2 > ); + static_cast< void ( * )( SurfaceMesh< 2 >& ) >( + &repair_polygon_orientations< 2 > ) ); module.def( "repair_polygon_orientations3D", - ( void ( * )( SurfaceMesh< 3 >& ) ) - & repair_polygon_orientations< 3 > ); + static_cast< void ( * )( SurfaceMesh< 3 >& ) >( + &repair_polygon_orientations< 3 > ) ); } } // namespace geode diff --git a/bindings/python/src/mesh/io/edged_curve.cpp b/bindings/python/src/mesh/io/edged_curve.cpp index e47c1cfce..67fb90e0d 100644 --- a/bindings/python/src/mesh/io/edged_curve.cpp +++ b/bindings/python/src/mesh/io/edged_curve.cpp @@ -21,6 +21,8 @@ * */ +#include + #include "../../basic/factory.h" #include "../../basic/input.h" #include "../../common.h" @@ -44,6 +46,10 @@ &check_edged_curve_missing_files< dimension > ); \ PYTHON_INPUT_MESH_CLASS( std::unique_ptr< EdgedCurve< dimension > >, \ "EdgedCurve" + std::to_string( dimension ) + "D" ); \ + const auto saveable##dimension = \ + "is_edged_curve_saveable" + std::to_string( dimension ) + "D"; \ + module.def( \ + saveable##dimension.c_str(), &is_edged_curve_saveable< dimension > ); \ PYTHON_FACTORY_CLASS( EdgedCurveInputFactory##dimension##D ); \ PYTHON_FACTORY_CLASS( EdgedCurveOutputFactory##dimension##D ) diff --git a/bindings/python/src/mesh/io/graph.cpp b/bindings/python/src/mesh/io/graph.cpp index 7122b47c9..cf53c8a8b 100644 --- a/bindings/python/src/mesh/io/graph.cpp +++ b/bindings/python/src/mesh/io/graph.cpp @@ -38,6 +38,7 @@ namespace geode static_cast< std::unique_ptr< Graph > ( * )( absl::string_view ) >( &load_graph ) ); module.def( "check_graph_missing_files", &check_graph_missing_files ); + module.def( "is_graph_saveable", &is_graph_saveable ); PYTHON_INPUT_MESH_CLASS( std::unique_ptr< Graph >, "Graph" ); PYTHON_FACTORY_CLASS( GraphInputFactory ); PYTHON_FACTORY_CLASS( GraphOutputFactory ); diff --git a/bindings/python/src/mesh/io/hybrid_solid.cpp b/bindings/python/src/mesh/io/hybrid_solid.cpp index c44c0ed9a..c21de6c00 100644 --- a/bindings/python/src/mesh/io/hybrid_solid.cpp +++ b/bindings/python/src/mesh/io/hybrid_solid.cpp @@ -21,6 +21,8 @@ * */ +#include + #include "../../basic/factory.h" #include "../../basic/input.h" #include "../../common.h" @@ -44,6 +46,10 @@ &check_hybrid_solid_missing_files< dimension > ); \ PYTHON_INPUT_MESH_CLASS( std::unique_ptr< HybridSolid< dimension > >, \ "HybridSolid" + std::to_string( dimension ) + "D" ); \ + const auto saveable##dimension = \ + "is_hybrid_solid_saveable" + std::to_string( dimension ) + "D"; \ + module.def( \ + saveable##dimension.c_str(), &is_hybrid_solid_saveable< dimension > ); \ PYTHON_FACTORY_CLASS( HybridSolidInputFactory##dimension##D ); \ PYTHON_FACTORY_CLASS( HybridSolidOutputFactory##dimension##D ) diff --git a/bindings/python/src/mesh/io/point_set.cpp b/bindings/python/src/mesh/io/point_set.cpp index 3d6a350da..e44c2abe1 100644 --- a/bindings/python/src/mesh/io/point_set.cpp +++ b/bindings/python/src/mesh/io/point_set.cpp @@ -21,6 +21,8 @@ * */ +#include + #include "../../basic/factory.h" #include "../../basic/input.h" #include "../../common.h" @@ -44,6 +46,10 @@ &check_point_set_missing_files< dimension > ); \ PYTHON_INPUT_MESH_CLASS( std::unique_ptr< PointSet< dimension > >, \ "PointSet" + std::to_string( dimension ) + "D" ); \ + const auto saveable##dimension = \ + "is_point_set_saveable" + std::to_string( dimension ) + "D"; \ + module.def( \ + saveable##dimension.c_str(), &is_point_set_saveable< dimension > ); \ PYTHON_FACTORY_CLASS( PointSetInputFactory##dimension##D ); \ PYTHON_FACTORY_CLASS( PointSetOutputFactory##dimension##D ) diff --git a/bindings/python/src/mesh/io/polygonal_surface.cpp b/bindings/python/src/mesh/io/polygonal_surface.cpp index b6787a794..a7b86d72e 100644 --- a/bindings/python/src/mesh/io/polygonal_surface.cpp +++ b/bindings/python/src/mesh/io/polygonal_surface.cpp @@ -21,6 +21,8 @@ * */ +#include + #include "../../basic/factory.h" #include "../../basic/input.h" #include "../../common.h" @@ -45,6 +47,10 @@ &check_polygonal_surface_missing_files< dimension > ); \ PYTHON_INPUT_MESH_CLASS( std::unique_ptr< PolygonalSurface< dimension > >, \ "PolygonalSurface" + std::to_string( dimension ) + "D" ); \ + const auto saveable##dimension = \ + "is_polygonal_surface_saveable" + std::to_string( dimension ) + "D"; \ + module.def( saveable##dimension.c_str(), \ + &is_polygonal_surface_saveable< dimension > ); \ PYTHON_FACTORY_CLASS( PolygonalSurfaceInputFactory##dimension##D ); \ PYTHON_FACTORY_CLASS( PolygonalSurfaceOutputFactory##dimension##D ) diff --git a/bindings/python/src/mesh/io/polyhedral_solid.cpp b/bindings/python/src/mesh/io/polyhedral_solid.cpp index 838fdba0e..eca76409f 100644 --- a/bindings/python/src/mesh/io/polyhedral_solid.cpp +++ b/bindings/python/src/mesh/io/polyhedral_solid.cpp @@ -21,6 +21,8 @@ * */ +#include + #include "../../basic/factory.h" #include "../../basic/input.h" #include "../../common.h" @@ -45,6 +47,10 @@ &check_polyhedral_solid_missing_files< dimension > ); \ PYTHON_INPUT_MESH_CLASS( std::unique_ptr< PolyhedralSolid< dimension > >, \ "PolyhedralSolid" + std::to_string( dimension ) + "D" ); \ + const auto saveable##dimension = \ + "is_polyhedral_solid_saveable" + std::to_string( dimension ) + "D"; \ + module.def( saveable##dimension.c_str(), \ + &is_polyhedral_solid_saveable< dimension > ); \ PYTHON_FACTORY_CLASS( PolyhedralSolidInputFactory##dimension##D ); \ PYTHON_FACTORY_CLASS( PolyhedralSolidOutputFactory##dimension##D ) diff --git a/bindings/python/src/mesh/io/regular_grid.cpp b/bindings/python/src/mesh/io/regular_grid.cpp index 985d4f39a..b4ee9424b 100644 --- a/bindings/python/src/mesh/io/regular_grid.cpp +++ b/bindings/python/src/mesh/io/regular_grid.cpp @@ -21,6 +21,8 @@ * */ +#include + #include "../../basic/factory.h" #include "../../basic/input.h" #include "../../common.h" @@ -45,6 +47,10 @@ &check_regular_grid_missing_files< dimension > ); \ PYTHON_INPUT_MESH_CLASS( std::unique_ptr< RegularGrid< dimension > >, \ "RegularGrid" + std::to_string( dimension ) + "D" ); \ + const auto saveable##dimension = \ + "is_regular_grid_saveable" + std::to_string( dimension ) + "D"; \ + module.def( \ + saveable##dimension.c_str(), &is_regular_grid_saveable< dimension > ); \ PYTHON_FACTORY_CLASS( RegularGridInputFactory##dimension##D ); \ PYTHON_FACTORY_CLASS( RegularGridOutputFactory##dimension##D ) diff --git a/bindings/python/src/mesh/io/tetrahedral_solid.cpp b/bindings/python/src/mesh/io/tetrahedral_solid.cpp index 2f587cc8e..d25519b02 100644 --- a/bindings/python/src/mesh/io/tetrahedral_solid.cpp +++ b/bindings/python/src/mesh/io/tetrahedral_solid.cpp @@ -21,6 +21,8 @@ * */ +#include + #include "../../basic/factory.h" #include "../../basic/input.h" #include "../../common.h" @@ -45,6 +47,10 @@ &check_tetrahedral_solid_missing_files< dimension > ); \ PYTHON_INPUT_MESH_CLASS( std::unique_ptr< TetrahedralSolid< dimension > >, \ "TetrahedralSolid" + std::to_string( dimension ) + "D" ); \ + const auto saveable##dimension = \ + "is_tetrahedral_solid_saveable" + std::to_string( dimension ) + "D"; \ + module.def( saveable##dimension.c_str(), \ + &is_tetrahedral_solid_saveable< dimension > ); \ PYTHON_FACTORY_CLASS( TetrahedralSolidInputFactory##dimension##D ); \ PYTHON_FACTORY_CLASS( TetrahedralSolidOutputFactory##dimension##D ) diff --git a/bindings/python/src/mesh/io/triangulated_surface.cpp b/bindings/python/src/mesh/io/triangulated_surface.cpp index e756c03c5..396e7869f 100644 --- a/bindings/python/src/mesh/io/triangulated_surface.cpp +++ b/bindings/python/src/mesh/io/triangulated_surface.cpp @@ -21,6 +21,8 @@ * */ +#include + #include "../../basic/factory.h" #include "../../basic/input.h" #include "../../common.h" @@ -47,6 +49,10 @@ PYTHON_INPUT_MESH_CLASS( \ std::unique_ptr< TriangulatedSurface< dimension > >, \ "TriangulatedSurface" + std::to_string( dimension ) + "D" ); \ + const auto saveable##dimension = "is_triangulated_surface_saveable" \ + + std::to_string( dimension ) + "D"; \ + module.def( saveable##dimension.c_str(), \ + &is_triangulated_surface_saveable< dimension > ); \ PYTHON_FACTORY_CLASS( TriangulatedSurfaceInputFactory##dimension##D ); \ PYTHON_FACTORY_CLASS( TriangulatedSurfaceOutputFactory##dimension##D ) diff --git a/bindings/python/src/mesh/io/vertex_set.cpp b/bindings/python/src/mesh/io/vertex_set.cpp index 3a0e5a6c2..c800a9138 100644 --- a/bindings/python/src/mesh/io/vertex_set.cpp +++ b/bindings/python/src/mesh/io/vertex_set.cpp @@ -39,6 +39,7 @@ namespace geode absl::string_view ) >( &load_vertex_set ) ); module.def( "check_vertex_set_missing_files", &check_vertex_set_missing_files ); + module.def( "is_vertex_set_saveable", &is_vertex_set_saveable ); PYTHON_INPUT_MESH_CLASS( std::unique_ptr< VertexSet >, "VertexSet" ); PYTHON_FACTORY_CLASS( VertexSetInputFactory ); PYTHON_FACTORY_CLASS( VertexSetOutputFactory ); diff --git a/bindings/python/src/model/mixin/core/component_type.cpp b/bindings/python/src/model/mixin/core/component_type.cpp index fbb22f750..bf2592d7a 100644 --- a/bindings/python/src/model/mixin/core/component_type.cpp +++ b/bindings/python/src/model/mixin/core/component_type.cpp @@ -38,10 +38,11 @@ namespace geode pybind11::class_< ComponentID >( module, "ComponentID" ) .def( pybind11::init<>() ) .def( pybind11::init< ComponentType, uuid >() ) - .def( "id", - (const uuid& (ComponentID::*) () const&) &ComponentID::id ) - .def( "type", (const ComponentType& (ComponentID::*) () - const&) &ComponentID::type ) + .def( "id", static_cast< const uuid& (ComponentID::*) () const& >( + &ComponentID::id ) ) + .def( "type", + static_cast< const ComponentType& (ComponentID::*) () const& >( + &ComponentID::type ) ) .def( "string", &ComponentID::string ) .def( pybind11::self == pybind11::self ) .def( pybind11::self != pybind11::self ); diff --git a/bindings/python/src/model/mixin/core/vertex_identifier.cpp b/bindings/python/src/model/mixin/core/vertex_identifier.cpp index cb0dbfec3..d244481d6 100644 --- a/bindings/python/src/model/mixin/core/vertex_identifier.cpp +++ b/bindings/python/src/model/mixin/core/vertex_identifier.cpp @@ -33,17 +33,17 @@ namespace geode .def( pybind11::init<>() ) .def( "nb_unique_vertices", &VertexIdentifier::nb_unique_vertices ) .def( "component_mesh_vertices", - ( const std::vector< ComponentMeshVertex >& ( - VertexIdentifier::*) ( index_t ) const ) - & VertexIdentifier::component_mesh_vertices ) + static_cast< const std::vector< ComponentMeshVertex >& ( + VertexIdentifier::*) ( index_t ) const >( + &VertexIdentifier::component_mesh_vertices ) ) .def( "filtered_component_mesh_vertices_by_type", - ( std::vector< ComponentMeshVertex >( VertexIdentifier::* )( - index_t, const ComponentType& ) const ) - & VertexIdentifier::component_mesh_vertices ) + static_cast< std::vector< ComponentMeshVertex > ( + VertexIdentifier::* )( index_t, const ComponentType& ) + const >( &VertexIdentifier::component_mesh_vertices ) ) .def( "filtered_component_mesh_vertices_by_id", - ( std::vector< index_t >( VertexIdentifier::* )( - index_t, const uuid& ) const ) - & VertexIdentifier::component_mesh_vertices ) + static_cast< std::vector< index_t > ( VertexIdentifier::* )( + index_t, const uuid& ) const >( + &VertexIdentifier::component_mesh_vertices ) ) .def( "unique_vertex", &VertexIdentifier::unique_vertex ); pybind11::class_< ComponentMeshVertex >( module, "ComponentMeshVertex" ) diff --git a/bindings/python/src/model/representation/io/brep.cpp b/bindings/python/src/model/representation/io/brep.cpp index b3868d667..494258a7a 100644 --- a/bindings/python/src/model/representation/io/brep.cpp +++ b/bindings/python/src/model/representation/io/brep.cpp @@ -36,6 +36,7 @@ namespace geode module.def( "save_brep", &save_brep ); module.def( "load_brep", &load_brep ); module.def( "check_brep_missing_files", &check_brep_missing_files ); + module.def( "is_brep_saveable", &is_brep_saveable ); PYTHON_INPUT_CLASS( BRep, "BRep" ); PYTHON_FACTORY_CLASS( BRepInputFactory ); PYTHON_FACTORY_CLASS( BRepOutputFactory ); diff --git a/bindings/python/src/model/representation/io/section.cpp b/bindings/python/src/model/representation/io/section.cpp index fde5e99c6..8dc524884 100644 --- a/bindings/python/src/model/representation/io/section.cpp +++ b/bindings/python/src/model/representation/io/section.cpp @@ -37,6 +37,7 @@ namespace geode module.def( "load_section", &load_section ); module.def( "check_section_missing_files", &check_section_missing_files ); + module.def( "is_section_saveable", &is_section_saveable ); PYTHON_INPUT_CLASS( Section, "Section" ); PYTHON_FACTORY_CLASS( SectionInputFactory ); PYTHON_FACTORY_CLASS( SectionOutputFactory ); diff --git a/include/geode/basic/detail/geode_input_impl.h b/include/geode/basic/detail/geode_input_impl.h index 8e47d5b36..e6a806790 100644 --- a/include/geode/basic/detail/geode_input_impl.h +++ b/include/geode/basic/detail/geode_input_impl.h @@ -23,11 +23,15 @@ #pragma once +#include + #include +#include #include #include #include +#include #include namespace geode diff --git a/include/geode/basic/detail/geode_output_impl.h b/include/geode/basic/detail/geode_output_impl.h index c7b1e1848..baf64db40 100644 --- a/include/geode/basic/detail/geode_output_impl.h +++ b/include/geode/basic/detail/geode_output_impl.h @@ -23,31 +23,43 @@ #pragma once +#include + #include #include +#include #include +#include #include namespace geode { namespace detail { - template < typename Factory, typename Object > - void geode_object_output_impl( absl::string_view type, - const Object& object, - absl::string_view filename ) + template < typename Factory > + std::unique_ptr< typename Factory::BaseClass > + geode_object_output_writer( absl::string_view& filename ) { - Timer timer; filename = absl::StripAsciiWhitespace( filename ); const auto extension = absl::AsciiStrToLower( extension_from_filename( filename ) ); OPENGEODE_EXCEPTION( Factory::has_creator( extension ), "Unknown extension: ", extension ); + return Factory::create( extension, filename ); + } + + template < typename Factory, typename Object > + void geode_object_output_impl( absl::string_view type, + const Object& object, + absl::string_view filename ) + { + const Timer timer; + auto output = geode_object_output_writer< Factory >( filename ); ghc::filesystem::create_directories( filepath_without_filename( filename ) ); - Factory::create( extension, filename )->write( object ); + output->write( object ); Logger::info( type, " saved in ", filename, " in ", timer.duration() ); } diff --git a/include/geode/basic/output.h b/include/geode/basic/output.h index c22972347..0cabd8536 100644 --- a/include/geode/basic/output.h +++ b/include/geode/basic/output.h @@ -34,6 +34,11 @@ namespace geode public: virtual void write( const Object& object ) const = 0; + virtual bool is_saveable( const Object& /*unused*/ ) const + { + return true; + } + protected: Output( absl::string_view filename ) : IOFile( filename ) {} }; diff --git a/include/geode/image/io/raster_image_input.h b/include/geode/image/io/raster_image_input.h index 9c80a54f2..9ef35c9e7 100644 --- a/include/geode/image/io/raster_image_input.h +++ b/include/geode/image/io/raster_image_input.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include diff --git a/include/geode/image/io/raster_image_output.h b/include/geode/image/io/raster_image_output.h index 86e127384..808db5599 100644 --- a/include/geode/image/io/raster_image_output.h +++ b/include/geode/image/io/raster_image_output.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include @@ -55,6 +57,10 @@ namespace geode } }; + template < index_t dimension > + bool is_raster_image_saveable( + const RasterImage< dimension >& raster, absl::string_view filename ); + template < index_t dimension > using RasterImageOutputFactory = Factory< std::string, RasterImageOutput< dimension >, diff --git a/include/geode/mesh/io/edged_curve_input.h b/include/geode/mesh/io/edged_curve_input.h index f20c172e8..cd8fcfa53 100644 --- a/include/geode/mesh/io/edged_curve_input.h +++ b/include/geode/mesh/io/edged_curve_input.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include diff --git a/include/geode/mesh/io/edged_curve_output.h b/include/geode/mesh/io/edged_curve_output.h index 2ce6a194c..d46a39a78 100644 --- a/include/geode/mesh/io/edged_curve_output.h +++ b/include/geode/mesh/io/edged_curve_output.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include @@ -55,6 +57,10 @@ namespace geode } }; + template < index_t dimension > + bool is_edged_curve_saveable( const EdgedCurve< dimension >& edged_curve, + absl::string_view filename ); + template < index_t dimension > using EdgedCurveOutputFactory = Factory< std::string, EdgedCurveOutput< dimension >, diff --git a/include/geode/mesh/io/graph_input.h b/include/geode/mesh/io/graph_input.h index a14546ccf..4b49e5797 100644 --- a/include/geode/mesh/io/graph_input.h +++ b/include/geode/mesh/io/graph_input.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include diff --git a/include/geode/mesh/io/graph_output.h b/include/geode/mesh/io/graph_output.h index e4b021892..3d478bec1 100644 --- a/include/geode/mesh/io/graph_output.h +++ b/include/geode/mesh/io/graph_output.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include @@ -52,6 +54,9 @@ namespace geode } }; + bool opengeode_mesh_api is_graph_saveable( + const Graph& graph, absl::string_view filename ); + using GraphOutputFactory = Factory< std::string, GraphOutput, absl::string_view >; } // namespace geode diff --git a/include/geode/mesh/io/hybrid_solid_input.h b/include/geode/mesh/io/hybrid_solid_input.h index b13723d50..429b28840 100644 --- a/include/geode/mesh/io/hybrid_solid_input.h +++ b/include/geode/mesh/io/hybrid_solid_input.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include diff --git a/include/geode/mesh/io/hybrid_solid_output.h b/include/geode/mesh/io/hybrid_solid_output.h index 9b4a829dc..19b2fd2bf 100644 --- a/include/geode/mesh/io/hybrid_solid_output.h +++ b/include/geode/mesh/io/hybrid_solid_output.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include @@ -57,6 +59,10 @@ namespace geode } }; + template < index_t dimension > + bool is_hybrid_solid_saveable( const HybridSolid< dimension >& hybrid_solid, + absl::string_view filename ); + template < index_t dimension > using HybridSolidOutputFactory = Factory< std::string, HybridSolidOutput< dimension >, diff --git a/include/geode/mesh/io/point_set_input.h b/include/geode/mesh/io/point_set_input.h index be7237d5e..9df6ba5f3 100644 --- a/include/geode/mesh/io/point_set_input.h +++ b/include/geode/mesh/io/point_set_input.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include diff --git a/include/geode/mesh/io/point_set_output.h b/include/geode/mesh/io/point_set_output.h index 8066b7e40..9b227baaf 100644 --- a/include/geode/mesh/io/point_set_output.h +++ b/include/geode/mesh/io/point_set_output.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include @@ -55,6 +57,10 @@ namespace geode } }; + template < index_t dimension > + bool is_point_set_saveable( + const PointSet< dimension >& point_set, absl::string_view filename ); + template < index_t dimension > using PointSetOutputFactory = Factory< std::string, PointSetOutput< dimension >, absl::string_view >; diff --git a/include/geode/mesh/io/polygonal_surface_input.h b/include/geode/mesh/io/polygonal_surface_input.h index b76d63f89..489794a4c 100644 --- a/include/geode/mesh/io/polygonal_surface_input.h +++ b/include/geode/mesh/io/polygonal_surface_input.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include diff --git a/include/geode/mesh/io/polygonal_surface_output.h b/include/geode/mesh/io/polygonal_surface_output.h index 1933d2557..716e27bbb 100644 --- a/include/geode/mesh/io/polygonal_surface_output.h +++ b/include/geode/mesh/io/polygonal_surface_output.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include @@ -58,6 +60,11 @@ namespace geode } }; + template < index_t dimension > + bool is_polygonal_surface_saveable( + const PolygonalSurface< dimension >& polygonal_surface, + absl::string_view filename ); + template < index_t dimension > using PolygonalSurfaceOutputFactory = Factory< std::string, PolygonalSurfaceOutput< dimension >, diff --git a/include/geode/mesh/io/polyhedral_solid_input.h b/include/geode/mesh/io/polyhedral_solid_input.h index 6e5e6c499..19050f3fb 100644 --- a/include/geode/mesh/io/polyhedral_solid_input.h +++ b/include/geode/mesh/io/polyhedral_solid_input.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include diff --git a/include/geode/mesh/io/polyhedral_solid_output.h b/include/geode/mesh/io/polyhedral_solid_output.h index 2cfd8eda9..0fe063191 100644 --- a/include/geode/mesh/io/polyhedral_solid_output.h +++ b/include/geode/mesh/io/polyhedral_solid_output.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include @@ -58,6 +60,11 @@ namespace geode } }; + template < index_t dimension > + bool is_polyhedral_solid_saveable( + const PolyhedralSolid< dimension >& polyhedral_solid, + absl::string_view filename ); + template < index_t dimension > using PolyhedralSolidOutputFactory = Factory< std::string, PolyhedralSolidOutput< dimension >, diff --git a/include/geode/mesh/io/regular_grid_input.h b/include/geode/mesh/io/regular_grid_input.h index 21f3b54c3..ef2b1e2d8 100644 --- a/include/geode/mesh/io/regular_grid_input.h +++ b/include/geode/mesh/io/regular_grid_input.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include diff --git a/include/geode/mesh/io/regular_grid_output.h b/include/geode/mesh/io/regular_grid_output.h index 8a5ed119b..872c9e078 100644 --- a/include/geode/mesh/io/regular_grid_output.h +++ b/include/geode/mesh/io/regular_grid_output.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include @@ -55,6 +57,10 @@ namespace geode } }; + template < index_t dimension > + bool is_regular_grid_saveable( const RegularGrid< dimension >& regular_grid, + absl::string_view filename ); + template < index_t dimension > using RegularGridOutputFactory = Factory< std::string, RegularGridOutput< dimension >, diff --git a/include/geode/mesh/io/tetrahedral_solid_input.h b/include/geode/mesh/io/tetrahedral_solid_input.h index 878a741f3..4c613dce3 100644 --- a/include/geode/mesh/io/tetrahedral_solid_input.h +++ b/include/geode/mesh/io/tetrahedral_solid_input.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include diff --git a/include/geode/mesh/io/tetrahedral_solid_output.h b/include/geode/mesh/io/tetrahedral_solid_output.h index b9cfd3c8a..61c363a4d 100644 --- a/include/geode/mesh/io/tetrahedral_solid_output.h +++ b/include/geode/mesh/io/tetrahedral_solid_output.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include @@ -59,6 +61,11 @@ namespace geode } }; + template < index_t dimension > + bool is_tetrahedral_solid_saveable( + const TetrahedralSolid< dimension >& tetrahedral_solid, + absl::string_view filename ); + template < index_t dimension > using TetrahedralSolidOutputFactory = Factory< std::string, TetrahedralSolidOutput< dimension >, diff --git a/include/geode/mesh/io/triangulated_surface_input.h b/include/geode/mesh/io/triangulated_surface_input.h index 51f2bafc6..8cd3e9ae5 100644 --- a/include/geode/mesh/io/triangulated_surface_input.h +++ b/include/geode/mesh/io/triangulated_surface_input.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include diff --git a/include/geode/mesh/io/triangulated_surface_output.h b/include/geode/mesh/io/triangulated_surface_output.h index b85ceafdd..2f404dcf6 100644 --- a/include/geode/mesh/io/triangulated_surface_output.h +++ b/include/geode/mesh/io/triangulated_surface_output.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include @@ -57,6 +59,11 @@ namespace geode } }; + template < index_t dimension > + bool is_triangulated_surface_saveable( + const TriangulatedSurface< dimension >& triangulated_surface, + absl::string_view filename ); + template < index_t dimension > using TriangulatedSurfaceOutputFactory = Factory< std::string, TriangulatedSurfaceOutput< dimension >, diff --git a/include/geode/mesh/io/vertex_set_input.h b/include/geode/mesh/io/vertex_set_input.h index 7746dbe98..0bf13bc80 100644 --- a/include/geode/mesh/io/vertex_set_input.h +++ b/include/geode/mesh/io/vertex_set_input.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include diff --git a/include/geode/mesh/io/vertex_set_output.h b/include/geode/mesh/io/vertex_set_output.h index bfa228e3c..96d68b633 100644 --- a/include/geode/mesh/io/vertex_set_output.h +++ b/include/geode/mesh/io/vertex_set_output.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include @@ -53,6 +55,9 @@ namespace geode } }; + bool opengeode_mesh_api is_vertex_set_saveable( + const VertexSet& vertex_set, absl::string_view filename ); + using VertexSetOutputFactory = Factory< std::string, VertexSetOutput, absl::string_view >; } // namespace geode diff --git a/include/geode/model/representation/io/brep_input.h b/include/geode/model/representation/io/brep_input.h index 873c61569..fea019524 100644 --- a/include/geode/model/representation/io/brep_input.h +++ b/include/geode/model/representation/io/brep_input.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include diff --git a/include/geode/model/representation/io/brep_output.h b/include/geode/model/representation/io/brep_output.h index 9e7c22999..fdd12ba5b 100644 --- a/include/geode/model/representation/io/brep_output.h +++ b/include/geode/model/representation/io/brep_output.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include @@ -50,6 +52,9 @@ namespace geode BRepOutput( absl::string_view filename ) : Output< BRep >{ filename } {} }; + bool opengeode_model_api is_brep_saveable( + const BRep& brep, absl::string_view filename ); + using BRepOutputFactory = Factory< std::string, BRepOutput, absl::string_view >; } // namespace geode diff --git a/include/geode/model/representation/io/section_input.h b/include/geode/model/representation/io/section_input.h index 86af8f4b0..38fa6f770 100644 --- a/include/geode/model/representation/io/section_input.h +++ b/include/geode/model/representation/io/section_input.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include diff --git a/include/geode/model/representation/io/section_output.h b/include/geode/model/representation/io/section_output.h index 00f25cda9..7c0b3dec8 100644 --- a/include/geode/model/representation/io/section_output.h +++ b/include/geode/model/representation/io/section_output.h @@ -23,6 +23,8 @@ #pragma once +#include + #include #include @@ -53,6 +55,9 @@ namespace geode } }; + bool opengeode_model_api is_section_saveable( + const Section& section, absl::string_view filename ); + using SectionOutputFactory = Factory< std::string, SectionOutput, absl::string_view >; } // namespace geode diff --git a/src/geode/image/io/raster_image_input.cpp b/src/geode/image/io/raster_image_input.cpp index 5770e250c..67a93306f 100644 --- a/src/geode/image/io/raster_image_input.cpp +++ b/src/geode/image/io/raster_image_input.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include diff --git a/src/geode/image/io/raster_image_output.cpp b/src/geode/image/io/raster_image_output.cpp index bc2157e9f..b1085d91e 100644 --- a/src/geode/image/io/raster_image_output.cpp +++ b/src/geode/image/io/raster_image_output.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include @@ -48,8 +50,22 @@ namespace geode } } + template < index_t dimension > + bool is_raster_image_saveable( + const RasterImage< dimension >& raster, absl::string_view filename ) + { + const auto output = detail::geode_object_output_writer< + RasterImageOutputFactory< dimension > >( filename ); + return output->is_saveable( raster ); + } + template void opengeode_image_api save_raster_image( const RasterImage< 2 >&, absl::string_view ); template void opengeode_image_api save_raster_image( const RasterImage< 3 >&, absl::string_view ); + + template bool opengeode_image_api is_raster_image_saveable( + const RasterImage< 2 >&, absl::string_view ); + template bool opengeode_image_api is_raster_image_saveable( + const RasterImage< 3 >&, absl::string_view ); } // namespace geode diff --git a/src/geode/mesh/io/edged_curve_input.cpp b/src/geode/mesh/io/edged_curve_input.cpp index ef6ce8179..a6a3c830f 100644 --- a/src/geode/mesh/io/edged_curve_input.cpp +++ b/src/geode/mesh/io/edged_curve_input.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include diff --git a/src/geode/mesh/io/edged_curve_output.cpp b/src/geode/mesh/io/edged_curve_output.cpp index cf2bf63c4..20237dede 100644 --- a/src/geode/mesh/io/edged_curve_output.cpp +++ b/src/geode/mesh/io/edged_curve_output.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include @@ -48,8 +50,22 @@ namespace geode } } + template < index_t dimension > + bool is_edged_curve_saveable( + const EdgedCurve< dimension >& edged_curve, absl::string_view filename ) + { + const auto output = detail::geode_object_output_writer< + EdgedCurveOutputFactory< dimension > >( filename ); + return output->is_saveable( edged_curve ); + } + template void opengeode_mesh_api save_edged_curve( const EdgedCurve< 2 >&, absl::string_view ); template void opengeode_mesh_api save_edged_curve( const EdgedCurve< 3 >&, absl::string_view ); + + template bool opengeode_mesh_api is_edged_curve_saveable( + const EdgedCurve< 2 >&, absl::string_view ); + template bool opengeode_mesh_api is_edged_curve_saveable( + const EdgedCurve< 3 >&, absl::string_view ); } // namespace geode diff --git a/src/geode/mesh/io/graph_input.cpp b/src/geode/mesh/io/graph_input.cpp index f0a48911b..c1b3501be 100644 --- a/src/geode/mesh/io/graph_input.cpp +++ b/src/geode/mesh/io/graph_input.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include diff --git a/src/geode/mesh/io/graph_output.cpp b/src/geode/mesh/io/graph_output.cpp index 0a0a42283..cb75ac56f 100644 --- a/src/geode/mesh/io/graph_output.cpp +++ b/src/geode/mesh/io/graph_output.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include @@ -42,4 +44,13 @@ namespace geode throw OpenGeodeException{ "Cannot save Graph in file: ", filename }; } } + + bool is_graph_saveable( const Graph& graph, absl::string_view filename ) + { + const auto output = + detail::geode_object_output_writer< GraphOutputFactory >( + filename ); + return output->is_saveable( graph ); + } + } // namespace geode diff --git a/src/geode/mesh/io/hybrid_solid_input.cpp b/src/geode/mesh/io/hybrid_solid_input.cpp index b8e429ab0..f6b7cadf6 100644 --- a/src/geode/mesh/io/hybrid_solid_input.cpp +++ b/src/geode/mesh/io/hybrid_solid_input.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include diff --git a/src/geode/mesh/io/hybrid_solid_output.cpp b/src/geode/mesh/io/hybrid_solid_output.cpp index 599f64855..37138e112 100644 --- a/src/geode/mesh/io/hybrid_solid_output.cpp +++ b/src/geode/mesh/io/hybrid_solid_output.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include @@ -48,6 +50,18 @@ namespace geode } } + template < index_t dimension > + bool is_hybrid_solid_saveable( const HybridSolid< dimension >& hybrid_solid, + absl::string_view filename ) + { + const auto output = detail::geode_object_output_writer< + HybridSolidOutputFactory< dimension > >( filename ); + return output->is_saveable( hybrid_solid ); + } + template void opengeode_mesh_api save_hybrid_solid( const HybridSolid< 3 >&, absl::string_view ); + + template bool opengeode_mesh_api is_hybrid_solid_saveable( + const HybridSolid< 3 >&, absl::string_view ); } // namespace geode diff --git a/src/geode/mesh/io/point_set_input.cpp b/src/geode/mesh/io/point_set_input.cpp index f41a5fd2d..bb2b303c8 100644 --- a/src/geode/mesh/io/point_set_input.cpp +++ b/src/geode/mesh/io/point_set_input.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include diff --git a/src/geode/mesh/io/point_set_output.cpp b/src/geode/mesh/io/point_set_output.cpp index e464d628f..66c3fe0bd 100644 --- a/src/geode/mesh/io/point_set_output.cpp +++ b/src/geode/mesh/io/point_set_output.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include @@ -49,8 +51,22 @@ namespace geode } } + template < index_t dimension > + bool is_point_set_saveable( + const PointSet< dimension >& point_set, absl::string_view filename ) + { + const auto output = detail::geode_object_output_writer< + PointSetOutputFactory< dimension > >( filename ); + return output->is_saveable( point_set ); + } + template void opengeode_mesh_api save_point_set( const PointSet< 2 >&, absl::string_view ); template void opengeode_mesh_api save_point_set( const PointSet< 3 >&, absl::string_view ); + + template bool opengeode_mesh_api is_point_set_saveable( + const PointSet< 2 >&, absl::string_view ); + template bool opengeode_mesh_api is_point_set_saveable( + const PointSet< 3 >&, absl::string_view ); } // namespace geode diff --git a/src/geode/mesh/io/polygonal_surface_input.cpp b/src/geode/mesh/io/polygonal_surface_input.cpp index a374e4ebb..410f0215a 100644 --- a/src/geode/mesh/io/polygonal_surface_input.cpp +++ b/src/geode/mesh/io/polygonal_surface_input.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include diff --git a/src/geode/mesh/io/polygonal_surface_output.cpp b/src/geode/mesh/io/polygonal_surface_output.cpp index 7d80940d2..967d839a5 100644 --- a/src/geode/mesh/io/polygonal_surface_output.cpp +++ b/src/geode/mesh/io/polygonal_surface_output.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include @@ -49,8 +51,23 @@ namespace geode } } + template < index_t dimension > + bool is_polygonal_surface_saveable( + const PolygonalSurface< dimension >& polygonal_surface, + absl::string_view filename ) + { + const auto output = detail::geode_object_output_writer< + PolygonalSurfaceOutputFactory< dimension > >( filename ); + return output->is_saveable( polygonal_surface ); + } + template void opengeode_mesh_api save_polygonal_surface( const PolygonalSurface< 2 >&, absl::string_view ); template void opengeode_mesh_api save_polygonal_surface( const PolygonalSurface< 3 >&, absl::string_view ); + + template bool opengeode_mesh_api is_polygonal_surface_saveable( + const PolygonalSurface< 2 >&, absl::string_view ); + template bool opengeode_mesh_api is_polygonal_surface_saveable( + const PolygonalSurface< 3 >&, absl::string_view ); } // namespace geode diff --git a/src/geode/mesh/io/polyhedral_solid_input.cpp b/src/geode/mesh/io/polyhedral_solid_input.cpp index 6a377bda3..4ce8e1aed 100644 --- a/src/geode/mesh/io/polyhedral_solid_input.cpp +++ b/src/geode/mesh/io/polyhedral_solid_input.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include diff --git a/src/geode/mesh/io/polyhedral_solid_output.cpp b/src/geode/mesh/io/polyhedral_solid_output.cpp index 959e54f5a..c7fc95127 100644 --- a/src/geode/mesh/io/polyhedral_solid_output.cpp +++ b/src/geode/mesh/io/polyhedral_solid_output.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include @@ -49,6 +51,19 @@ namespace geode } } + template < index_t dimension > + bool is_polyhedral_solid_saveable( + const PolyhedralSolid< dimension >& polyhedral_solid, + absl::string_view filename ) + { + const auto output = detail::geode_object_output_writer< + PolyhedralSolidOutputFactory< dimension > >( filename ); + return output->is_saveable( polyhedral_solid ); + } + template void opengeode_mesh_api save_polyhedral_solid( const PolyhedralSolid< 3 >&, absl::string_view ); + + template bool opengeode_mesh_api is_polyhedral_solid_saveable( + const PolyhedralSolid< 3 >&, absl::string_view ); } // namespace geode diff --git a/src/geode/mesh/io/regular_grid_input.cpp b/src/geode/mesh/io/regular_grid_input.cpp index d4e1d10c2..0c3ed2a67 100644 --- a/src/geode/mesh/io/regular_grid_input.cpp +++ b/src/geode/mesh/io/regular_grid_input.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include diff --git a/src/geode/mesh/io/regular_grid_output.cpp b/src/geode/mesh/io/regular_grid_output.cpp index b5657077c..01ca7af33 100644 --- a/src/geode/mesh/io/regular_grid_output.cpp +++ b/src/geode/mesh/io/regular_grid_output.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include @@ -49,8 +51,22 @@ namespace geode } } + template < index_t dimension > + bool is_regular_grid_saveable( const RegularGrid< dimension >& regular_grid, + absl::string_view filename ) + { + const auto output = detail::geode_object_output_writer< + RegularGridOutputFactory< dimension > >( filename ); + return output->is_saveable( regular_grid ); + } + template void opengeode_mesh_api save_regular_grid( const RegularGrid< 2 >&, absl::string_view ); template void opengeode_mesh_api save_regular_grid( const RegularGrid< 3 >&, absl::string_view ); + + template bool opengeode_mesh_api is_regular_grid_saveable( + const RegularGrid< 2 >&, absl::string_view ); + template bool opengeode_mesh_api is_regular_grid_saveable( + const RegularGrid< 3 >&, absl::string_view ); } // namespace geode diff --git a/src/geode/mesh/io/tetrahedral_solid_input.cpp b/src/geode/mesh/io/tetrahedral_solid_input.cpp index ca6cb00e4..623a6c598 100644 --- a/src/geode/mesh/io/tetrahedral_solid_input.cpp +++ b/src/geode/mesh/io/tetrahedral_solid_input.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include diff --git a/src/geode/mesh/io/tetrahedral_solid_output.cpp b/src/geode/mesh/io/tetrahedral_solid_output.cpp index a153f9fc0..29928bab3 100644 --- a/src/geode/mesh/io/tetrahedral_solid_output.cpp +++ b/src/geode/mesh/io/tetrahedral_solid_output.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include @@ -49,6 +51,19 @@ namespace geode } } + template < index_t dimension > + bool is_tetrahedral_solid_saveable( + const TetrahedralSolid< dimension >& tetrahedral_solid, + absl::string_view filename ) + { + const auto output = detail::geode_object_output_writer< + TetrahedralSolidOutputFactory< dimension > >( filename ); + return output->is_saveable( tetrahedral_solid ); + } + template void opengeode_mesh_api save_tetrahedral_solid( const TetrahedralSolid< 3 >&, absl::string_view ); + + template bool opengeode_mesh_api is_tetrahedral_solid_saveable( + const TetrahedralSolid< 3 >&, absl::string_view ); } // namespace geode diff --git a/src/geode/mesh/io/triangulated_surface_input.cpp b/src/geode/mesh/io/triangulated_surface_input.cpp index c188a1ec0..1a73c620b 100644 --- a/src/geode/mesh/io/triangulated_surface_input.cpp +++ b/src/geode/mesh/io/triangulated_surface_input.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include diff --git a/src/geode/mesh/io/triangulated_surface_output.cpp b/src/geode/mesh/io/triangulated_surface_output.cpp index c771b7baa..0119ff1c0 100644 --- a/src/geode/mesh/io/triangulated_surface_output.cpp +++ b/src/geode/mesh/io/triangulated_surface_output.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include @@ -50,8 +52,23 @@ namespace geode } } + template < index_t dimension > + bool is_triangulated_surface_saveable( + const TriangulatedSurface< dimension >& triangulated_surface, + absl::string_view filename ) + { + const auto output = detail::geode_object_output_writer< + TriangulatedSurfaceOutputFactory< dimension > >( filename ); + return output->is_saveable( triangulated_surface ); + } + template void opengeode_mesh_api save_triangulated_surface( const TriangulatedSurface< 2 >&, absl::string_view ); template void opengeode_mesh_api save_triangulated_surface( const TriangulatedSurface< 3 >&, absl::string_view ); + + template bool opengeode_mesh_api is_triangulated_surface_saveable( + const TriangulatedSurface< 2 >&, absl::string_view ); + template bool opengeode_mesh_api is_triangulated_surface_saveable( + const TriangulatedSurface< 3 >&, absl::string_view ); } // namespace geode diff --git a/src/geode/mesh/io/vertex_set_input.cpp b/src/geode/mesh/io/vertex_set_input.cpp index dc3fb2e46..e2cb26902 100644 --- a/src/geode/mesh/io/vertex_set_input.cpp +++ b/src/geode/mesh/io/vertex_set_input.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include diff --git a/src/geode/mesh/io/vertex_set_output.cpp b/src/geode/mesh/io/vertex_set_output.cpp index 530fbb895..ac5d39ff2 100644 --- a/src/geode/mesh/io/vertex_set_output.cpp +++ b/src/geode/mesh/io/vertex_set_output.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include @@ -44,4 +46,13 @@ namespace geode filename }; } } + + bool is_vertex_set_saveable( + const VertexSet& vertex_set, absl::string_view filename ) + { + const auto output = + detail::geode_object_output_writer< VertexSetOutputFactory >( + filename ); + return output->is_saveable( vertex_set ); + } } // namespace geode diff --git a/src/geode/model/representation/io/brep_input.cpp b/src/geode/model/representation/io/brep_input.cpp index 65558585c..15d41e97e 100644 --- a/src/geode/model/representation/io/brep_input.cpp +++ b/src/geode/model/representation/io/brep_input.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include diff --git a/src/geode/model/representation/io/brep_output.cpp b/src/geode/model/representation/io/brep_output.cpp index 7487091e3..d9f4b2405 100644 --- a/src/geode/model/representation/io/brep_output.cpp +++ b/src/geode/model/representation/io/brep_output.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include @@ -42,4 +44,11 @@ namespace geode throw OpenGeodeException{ "Cannot save BRep in file: ", filename }; } } + + bool is_brep_saveable( const BRep& brep, absl::string_view filename ) + { + const auto output = + detail::geode_object_output_writer< BRepOutputFactory >( filename ); + return output->is_saveable( brep ); + } } // namespace geode diff --git a/src/geode/model/representation/io/section_input.cpp b/src/geode/model/representation/io/section_input.cpp index 0757aefa3..c2611ad4c 100644 --- a/src/geode/model/representation/io/section_input.cpp +++ b/src/geode/model/representation/io/section_input.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include diff --git a/src/geode/model/representation/io/section_output.cpp b/src/geode/model/representation/io/section_output.cpp index f9e0487c0..b181b116f 100644 --- a/src/geode/model/representation/io/section_output.cpp +++ b/src/geode/model/representation/io/section_output.cpp @@ -23,6 +23,8 @@ #include +#include + #include #include @@ -43,4 +45,13 @@ namespace geode filename }; } } + + bool is_section_saveable( + const Section& section, absl::string_view filename ) + { + const auto output = + detail::geode_object_output_writer< SectionOutputFactory >( + filename ); + return output->is_saveable( section ); + } } // namespace geode