diff --git a/bindings/python/src/mesh/helpers/convert_edged_curve.cpp b/bindings/python/src/mesh/helpers/convert_edged_curve.cpp index ef8d9f025..06b339543 100644 --- a/bindings/python/src/mesh/helpers/convert_edged_curve.cpp +++ b/bindings/python/src/mesh/helpers/convert_edged_curve.cpp @@ -31,10 +31,7 @@ namespace geode { void define_convert_edged_curve( pybind11::module& module ) { - module - .def( "convert_edged_curve3d_into_2d", - &convert_edged_curve3d_into_2d ) - .def( "merge_edged_curves2D", &merge_edged_curves< 2 > ) - .def( "merge_edged_curves3D", &merge_edged_curves< 3 > ); + module.def( + "convert_edged_curve3d_into_2d", &convert_edged_curve3d_into_2d ); } } // namespace geode diff --git a/bindings/python/src/mesh/helpers/convert_solid_mesh.cpp b/bindings/python/src/mesh/helpers/convert_solid_mesh.cpp index ecb347179..c6fab49c8 100644 --- a/bindings/python/src/mesh/helpers/convert_solid_mesh.cpp +++ b/bindings/python/src/mesh/helpers/convert_solid_mesh.cpp @@ -36,7 +36,6 @@ namespace geode .def( "convert_solid_mesh_into_tetrahedral_solid", &convert_solid_mesh_into_tetrahedral_solid ) .def( "convert_grid_into_tetrahedral_solid", - &convert_grid_into_tetrahedral_solid ) - .def( "merge_solid_meshes", &merge_solid_meshes ); + &convert_grid_into_tetrahedral_solid ); } } // namespace geode diff --git a/bindings/python/src/mesh/helpers/convert_surface_mesh.cpp b/bindings/python/src/mesh/helpers/convert_surface_mesh.cpp index 8d06c932b..7c5cb8df7 100644 --- a/bindings/python/src/mesh/helpers/convert_surface_mesh.cpp +++ b/bindings/python/src/mesh/helpers/convert_surface_mesh.cpp @@ -57,8 +57,6 @@ namespace geode .def( "convert_triangulated_surface2d_into_3d", &convert_triangulated_surface2d_into_3d ) .def( "convert_triangulated_surface3d_into_2d", - &convert_triangulated_surface3d_into_2d ) - .def( "merge_surface_meshes2D", &merge_surface_meshes< 2 > ) - .def( "merge_surface_meshes3D", &merge_surface_meshes< 3 > ); + &convert_triangulated_surface3d_into_2d ); } } // namespace geode \ No newline at end of file diff --git a/bindings/python/src/mesh/helpers/repair_polygon_orientations.cpp b/bindings/python/src/mesh/helpers/repair_polygon_orientations.cpp index 9ae4c9314..c40d6b09d 100644 --- a/bindings/python/src/mesh/helpers/repair_polygon_orientations.cpp +++ b/bindings/python/src/mesh/helpers/repair_polygon_orientations.cpp @@ -23,6 +23,7 @@ #include "../../common.hpp" +#include #include #include @@ -31,10 +32,8 @@ namespace geode void define_repair_polygon_orientations( pybind11::module& module ) { module.def( "repair_polygon_orientations2D", - static_cast< void ( * )( SurfaceMesh< 2 >& ) >( - &repair_polygon_orientations< 2 > ) ); + &repair_polygon_orientations< 2 > ); module.def( "repair_polygon_orientations3D", - static_cast< void ( * )( SurfaceMesh< 3 >& ) >( - &repair_polygon_orientations< 3 > ) ); + &repair_polygon_orientations< 3 > ); } } // namespace geode diff --git a/cmake/ConfigureGDAL.cmake b/cmake/ConfigureGDAL.cmake index dd4dc23f2..4ab4abbcd 100644 --- a/cmake/ConfigureGDAL.cmake +++ b/cmake/ConfigureGDAL.cmake @@ -27,7 +27,7 @@ ExternalProject_Add(gdal BINARY_DIR ${GDAL_PATH}/build STAMP_DIR ${GDAL_PATH}/stamp GIT_REPOSITORY https://github.com/Geode-solutions/gdal - GIT_TAG 18102025 + GIT_TAG b98359e91c94cfc7486b419da3ba828c98fb31c6 GIT_SHALLOW ON GIT_PROGRESS ON GIT_CONFIG core.longpaths=true diff --git a/cmake/ConfigureMinizip.cmake b/cmake/ConfigureMinizip.cmake index eea13f2c6..8c6c608cd 100644 --- a/cmake/ConfigureMinizip.cmake +++ b/cmake/ConfigureMinizip.cmake @@ -26,7 +26,7 @@ ExternalProject_Add(minizip BINARY_DIR ${MINIZIP_PATH}/build STAMP_DIR ${MINIZIP_PATH}/stamp GIT_REPOSITORY https://github.com/zlib-ng/minizip-ng - GIT_TAG 4.0.7 + GIT_TAG 4.1.0 GIT_SHALLOW ON GIT_PROGRESS ON CMAKE_GENERATOR ${CMAKE_GENERATOR} diff --git a/cmake/ConfigureNanoflann.cmake b/cmake/ConfigureNanoflann.cmake index 0edd0c209..0b3cb0fa7 100644 --- a/cmake/ConfigureNanoflann.cmake +++ b/cmake/ConfigureNanoflann.cmake @@ -26,7 +26,7 @@ ExternalProject_Add(nanoflann BINARY_DIR ${NANOFLANN_PATH}/build STAMP_DIR ${NANOFLANN_PATH}/stamp GIT_REPOSITORY https://github.com/jlblancoc/nanoflann - GIT_TAG v1.5.5 + GIT_TAG v1.9.0 GIT_SHALLOW ON GIT_PROGRESS ON CMAKE_GENERATOR ${CMAKE_GENERATOR} diff --git a/cmake/ConfigurePybind11.cmake b/cmake/ConfigurePybind11.cmake index c76c69d6b..170e7634a 100644 --- a/cmake/ConfigurePybind11.cmake +++ b/cmake/ConfigurePybind11.cmake @@ -26,7 +26,7 @@ ExternalProject_Add(pybind11 BINARY_DIR ${PYBIND11_PATH}/build STAMP_DIR ${PYBIND11_PATH}/stamp GIT_REPOSITORY https://github.com/pybind/pybind11 - GIT_TAG v2.13.1 + GIT_TAG v3.0.2 GIT_SHALLOW ON GIT_PROGRESS ON CMAKE_GENERATOR ${CMAKE_GENERATOR} diff --git a/cmake/ConfigureSpdlog.cmake b/cmake/ConfigureSpdlog.cmake index 11aaa7115..4f5d6e89e 100644 --- a/cmake/ConfigureSpdlog.cmake +++ b/cmake/ConfigureSpdlog.cmake @@ -26,7 +26,7 @@ ExternalProject_Add(spdlog BINARY_DIR ${SPDLOG_PATH}/build STAMP_DIR ${SPDLOG_PATH}/stamp GIT_REPOSITORY https://github.com/gabime/spdlog - GIT_TAG v1.14.1 + GIT_TAG v1.17.0 GIT_SHALLOW ON GIT_PROGRESS ON CMAKE_GENERATOR ${CMAKE_GENERATOR} diff --git a/include/geode/basic/console_progress_logger_client.hpp b/include/geode/basic/console_progress_logger_client.hpp index 2c440fc1e..52d95afdb 100644 --- a/include/geode/basic/console_progress_logger_client.hpp +++ b/include/geode/basic/console_progress_logger_client.hpp @@ -55,19 +55,6 @@ namespace geode void failed( const uuid& progress_logger_id, Logger::LEVEL level ) override; - [[deprecated]] void start( const uuid& progress_logger_id, - const std::string& message, - index_t nb_steps ) override; - - [[deprecated]] void update( const uuid& progress_logger_id, - index_t current_step, - index_t nb_steps ) override; - - [[deprecated]] void completed( - const uuid& progress_logger_id ) override; - - [[deprecated]] void failed( const uuid& progress_logger_id ) override; - private: IMPLEMENTATION_MEMBER( impl_ ); }; diff --git a/include/geode/basic/detail/geode_input_impl.hpp b/include/geode/basic/detail/geode_input_impl.hpp index cdaa9211c..ea780b28a 100644 --- a/include/geode/basic/detail/geode_input_impl.hpp +++ b/include/geode/basic/detail/geode_input_impl.hpp @@ -38,27 +38,6 @@ namespace geode { namespace detail { - template < typename Object > - void update_default_name( Object& object, std::string_view filename ) - { - if( object.name() == Identifier::DEFAULT_NAME ) - { - IdentifierBuilder{ object }.set_name( - filename_without_extension( filename ).string() ); - } - } - - template < typename Object > - void update_default_name( - std::unique_ptr< Object >& object, std::string_view filename ) - { - if( object->name() == Identifier::DEFAULT_NAME ) - { - IdentifierBuilder{ *object }.set_name( - filename_without_extension( filename ).string() ); - } - } - template < typename Factory > [[nodiscard]] std::unique_ptr< typename Factory::BaseClass > geode_object_input_reader( std::string_view& filename ) @@ -80,7 +59,6 @@ namespace geode const Timer timer; auto input = geode_object_input_reader< Factory >( filename ); auto object = input->read( std::forward< Args >( args )... ); - update_default_name( object, filename ); Logger::info( type, " loaded from ", filename, " in ", timer.duration() ); return object; diff --git a/include/geode/basic/identifier.hpp b/include/geode/basic/identifier.hpp index 70fc2d11c..8f782954e 100644 --- a/include/geode/basic/identifier.hpp +++ b/include/geode/basic/identifier.hpp @@ -23,6 +23,8 @@ #pragma once +#include + #include #include #include @@ -46,14 +48,12 @@ namespace geode friend class bitsery::Access; public: - static constexpr auto DEFAULT_NAME = "default_name"; - Identifier( Identifier&& other ) noexcept; ~Identifier(); [[nodiscard]] const uuid& id() const; - [[nodiscard]] std::string_view name() const; + [[nodiscard]] const std::optional< std::string >& name() const; void save_identifier( std::string_view directory ) const; diff --git a/include/geode/basic/progress_logger.hpp b/include/geode/basic/progress_logger.hpp index b7f6abaff..68dad4254 100644 --- a/include/geode/basic/progress_logger.hpp +++ b/include/geode/basic/progress_logger.hpp @@ -36,8 +36,6 @@ namespace geode class opengeode_basic_api ProgressLogger { public: - [[deprecated]] ProgressLogger( - const std::string& message, index_t nb_steps ); ProgressLogger( Logger::LEVEL level, const std::string& message, index_t nb_steps ); ~ProgressLogger(); diff --git a/include/geode/basic/progress_logger_client.hpp b/include/geode/basic/progress_logger_client.hpp index 397b02bd6..1bc1bdd50 100644 --- a/include/geode/basic/progress_logger_client.hpp +++ b/include/geode/basic/progress_logger_client.hpp @@ -56,20 +56,6 @@ namespace geode virtual void failed( const uuid& progress_logger_id, Logger::LEVEL level ) = 0; - [[deprecated]] virtual void start( const uuid& progress_logger_id, - const std::string& message, - index_t nb_steps ) = 0; - - [[deprecated]] virtual void update( const uuid& progress_logger_id, - index_t current_step, - index_t nb_steps ) = 0; - - [[deprecated]] virtual void completed( - const uuid& progress_logger_id ) = 0; - - [[deprecated]] virtual void failed( - const uuid& progress_logger_id ) = 0; - protected: ProgressLoggerClient() = default; }; diff --git a/include/geode/basic/progress_logger_manager.hpp b/include/geode/basic/progress_logger_manager.hpp index 39a8f1d90..e1218c002 100644 --- a/include/geode/basic/progress_logger_manager.hpp +++ b/include/geode/basic/progress_logger_manager.hpp @@ -58,18 +58,6 @@ namespace geode static void failed( const uuid& progress_logger_id, Logger::LEVEL level ); - [[deprecated]] static void start( const uuid& progress_logger_id, - const std::string& message, - index_t nb_steps ); - - [[deprecated]] static void update( const uuid& progress_logger_id, - index_t current_step, - index_t nb_steps ); - - [[deprecated]] static void completed( const uuid& progress_logger_id ); - - [[deprecated]] static void failed( const uuid& progress_logger_id ); - private: ProgressLoggerManager(); diff --git a/include/geode/geometry/aabb.hpp b/include/geode/geometry/aabb.hpp index 55eac9524..46a3d44c1 100644 --- a/include/geode/geometry/aabb.hpp +++ b/include/geode/geometry/aabb.hpp @@ -70,17 +70,6 @@ namespace geode [[nodiscard]] const BoundingBox< dimension >& bounding_box() const; - /*! - * @brief Whether or not the queries run on this tree are parallelized. - */ - [[deprecated, nodiscard]] bool parallel() const; - - /*! - * @brief Sets whether or not the queries run on this tree are - * parallelized. - */ - [[deprecated]] void set_parallel( bool parallel ); - /*! * @brief Gets all the boxes containing a point * @param[in] query the point to test diff --git a/include/geode/mesh/helpers/convert_edged_curve.hpp b/include/geode/mesh/helpers/convert_edged_curve.hpp index 6c74a2ee0..e88bfdef9 100644 --- a/include/geode/mesh/helpers/convert_edged_curve.hpp +++ b/include/geode/mesh/helpers/convert_edged_curve.hpp @@ -45,9 +45,4 @@ namespace geode convert_edged_curve2d_into_3d( const EdgedCurve2D& curve2d, local_index_t axis_to_add, double axis_coordinate ); - - template < index_t dimension > - [[deprecated, nodiscard]] std::unique_ptr< EdgedCurve< dimension > > - merge_edged_curves( absl::Span< const std::reference_wrapper< - const EdgedCurve< dimension > > > curves ); } // namespace geode \ No newline at end of file diff --git a/include/geode/mesh/helpers/convert_solid_mesh.hpp b/include/geode/mesh/helpers/convert_solid_mesh.hpp index 3cea30486..d888bacc4 100644 --- a/include/geode/mesh/helpers/convert_solid_mesh.hpp +++ b/include/geode/mesh/helpers/convert_solid_mesh.hpp @@ -60,9 +60,4 @@ namespace geode [[nodiscard]] std::optional< std::unique_ptr< HybridSolid3D > > opengeode_mesh_api convert_solid_mesh_into_hybrid_solid( const SolidMesh3D& solid ); - - [[deprecated, nodiscard]] std::unique_ptr< SolidMesh3D > - opengeode_mesh_api merge_solid_meshes( - absl::Span< const std::reference_wrapper< const SolidMesh3D > > - solids ); } // namespace geode \ No newline at end of file diff --git a/include/geode/mesh/helpers/convert_surface_mesh.hpp b/include/geode/mesh/helpers/convert_surface_mesh.hpp index b8383e003..ba13341dc 100644 --- a/include/geode/mesh/helpers/convert_surface_mesh.hpp +++ b/include/geode/mesh/helpers/convert_surface_mesh.hpp @@ -101,9 +101,4 @@ namespace geode opengeode_mesh_api convert_triangulated_surface3d_into_2d( const TriangulatedSurface3D& surface3d, local_index_t axis_to_remove ); - - template < index_t dimension > - [[deprecated, nodiscard]] std::unique_ptr< SurfaceMesh< dimension > > - merge_surface_meshes( absl::Span< const std::reference_wrapper< - const SurfaceMesh< dimension > > > surfaces ); } // namespace geode \ No newline at end of file diff --git a/include/geode/mesh/helpers/internal/copy.hpp b/include/geode/mesh/helpers/internal/copy.hpp index bb1dff9ce..2bf9d99d0 100644 --- a/include/geode/mesh/helpers/internal/copy.hpp +++ b/include/geode/mesh/helpers/internal/copy.hpp @@ -88,7 +88,10 @@ namespace geode template < typename MeshFrom, typename Builder > void copy_meta_info( const MeshFrom& from, Builder& builder ) { - builder.set_name( from.name() ); + if( const auto name = from.name() ) + { + builder.set_name( name.value() ); + } } void copy_attributes( diff --git a/include/geode/mesh/helpers/ray_tracing.hpp b/include/geode/mesh/helpers/ray_tracing.hpp index 237e1692c..d8ccf6a01 100644 --- a/include/geode/mesh/helpers/ray_tracing.hpp +++ b/include/geode/mesh/helpers/ray_tracing.hpp @@ -76,10 +76,6 @@ namespace geode }; public: - [[deprecated]] RayTracing2D( - const EdgedCurve2D& mesh, const Ray2D& ray ); - [[deprecated]] RayTracing2D( - const EdgedCurve2D& mesh, const InfiniteLine2D& infinite_line ); RayTracing2D( const EdgedCurve2D& mesh, const BoundingBox2D& bbox, const Ray2D& ray ); @@ -135,10 +131,6 @@ namespace geode }; public: - [[deprecated]] RayTracing3D( - const SurfaceMesh3D& mesh, const Ray3D& ray ); - [[deprecated]] RayTracing3D( - const SurfaceMesh3D& mesh, const InfiniteLine3D& infinite_line ); RayTracing3D( const SurfaceMesh3D& mesh, const BoundingBox3D& bbox, const Ray3D& ray ); diff --git a/include/geode/mesh/helpers/remove_vertex_duplication.hpp b/include/geode/mesh/helpers/remove_vertex_duplication.hpp deleted file mode 100644 index 1a5d84488..000000000 --- a/include/geode/mesh/helpers/remove_vertex_duplication.hpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2019 - 2026 Geode-solutions - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -#pragma once - -#include - -namespace geode -{ - FORWARD_DECLARATION_DIMENSION_CLASS( PointSet ); - FORWARD_DECLARATION_DIMENSION_CLASS( EdgedCurve ); - FORWARD_DECLARATION_DIMENSION_CLASS( SurfaceMesh ); - FORWARD_DECLARATION_DIMENSION_CLASS( SolidMesh ); - FORWARD_DECLARATION_DIMENSION_CLASS( PointSetBuilder ); - FORWARD_DECLARATION_DIMENSION_CLASS( EdgedCurveBuilder ); - FORWARD_DECLARATION_DIMENSION_CLASS( SurfaceMeshBuilder ); - FORWARD_DECLARATION_DIMENSION_CLASS( SolidMeshBuilder ); - ALIAS_3D( SolidMesh ); - ALIAS_3D( SolidMeshBuilder ); -} // namespace geode - -namespace geode -{ - template < index_t dimension > - [[deprecated]] void remove_vertex_duplication( - const PointSet< dimension >& mesh, - PointSetBuilder< dimension >& builder ); - - template < index_t dimension > - [[deprecated]] void remove_vertex_duplication( - const EdgedCurve< dimension >& mesh, - EdgedCurveBuilder< dimension >& builder ); - - template < index_t dimension > - [[deprecated]] void remove_vertex_duplication( - const SurfaceMesh< dimension >& mesh, - SurfaceMeshBuilder< dimension >& builder ); - - [[deprecated]] void opengeode_mesh_api remove_vertex_duplication( - const SolidMesh3D& mesh, SolidMeshBuilder3D& builder ); -} // namespace geode diff --git a/include/geode/mesh/helpers/repair_polygon_orientations.hpp b/include/geode/mesh/helpers/repair_polygon_orientations.hpp index f02d03e4a..93d0c038c 100644 --- a/include/geode/mesh/helpers/repair_polygon_orientations.hpp +++ b/include/geode/mesh/helpers/repair_polygon_orientations.hpp @@ -33,10 +33,6 @@ namespace geode namespace geode { - template < index_t dimension > - void OPENGEODE_MESH_DEPRECATED repair_polygon_orientations( - SurfaceMesh< dimension >& mesh ); - template < index_t dimension > void repair_polygon_orientations( const SurfaceMesh< dimension >& mesh, SurfaceMeshBuilder< dimension >& builder ); diff --git a/include/geode/model/representation/builder/detail/copy.hpp b/include/geode/model/representation/builder/detail/copy.hpp index 30d6ecc89..0a250c3b6 100644 --- a/include/geode/model/representation/builder/detail/copy.hpp +++ b/include/geode/model/representation/builder/detail/copy.hpp @@ -73,7 +73,10 @@ namespace geode mapping.map( corner.id(), id ); } const auto& id = mapping.in2out( corner.id() ); - builder_to.set_corner_name( id, corner.name() ); + if( const auto name = corner.name() ) + { + builder_to.set_corner_name( id, name.value() ); + } builder_to.set_corner_active( id, corner.is_active() ); } } @@ -100,7 +103,10 @@ namespace geode mapping.map( line.id(), id ); } const auto& id = mapping.in2out( line.id() ); - builder_to.set_line_name( id, line.name() ); + if( const auto name = line.name() ) + { + builder_to.set_line_name( id, name.value() ); + } builder_to.set_line_active( id, line.is_active() ); } } @@ -128,7 +134,10 @@ namespace geode mapping.map( surface.id(), id ); } const auto& id = mapping.in2out( surface.id() ); - builder_to.set_surface_name( id, surface.name() ); + if( const auto name = surface.name() ) + { + builder_to.set_surface_name( id, name.value() ); + } builder_to.set_surface_active( id, surface.is_active() ); } } @@ -155,7 +164,10 @@ namespace geode mapping.map( block.id(), id ); } const auto& id = mapping.in2out( block.id() ); - builder_to.set_block_name( id, block.name() ); + if( const auto name = block.name() ) + { + builder_to.set_block_name( id, name.value() ); + } builder_to.set_block_active( id, block.is_active() ); } } @@ -177,7 +189,10 @@ namespace geode mapping.map( model_boundary.id(), id ); } const auto& id = mapping.in2out( model_boundary.id() ); - builder_to.set_model_boundary_name( id, model_boundary.name() ); + if( const auto name = model_boundary.name() ) + { + builder_to.set_model_boundary_name( id, name.value() ); + } builder_to.set_model_boundary_active( id, model_boundary.is_active() ); } @@ -200,8 +215,10 @@ namespace geode mapping.map( corner_collection.id(), id ); } const auto& id = mapping.in2out( corner_collection.id() ); - builder_to.set_corner_collection_name( - id, corner_collection.name() ); + if( const auto name = corner_collection.name() ) + { + builder_to.set_corner_collection_name( id, name.value() ); + } builder_to.set_corner_collection_active( id, corner_collection.is_active() ); } @@ -224,8 +241,10 @@ namespace geode mapping.map( line_collection.id(), id ); } const auto& id = mapping.in2out( line_collection.id() ); - builder_to.set_line_collection_name( - id, line_collection.name() ); + if( const auto name = line_collection.name() ) + { + builder_to.set_line_collection_name( id, name.value() ); + } builder_to.set_line_collection_active( id, line_collection.is_active() ); } @@ -248,8 +267,10 @@ namespace geode mapping.map( surface_collection.id(), id ); } const auto& id = mapping.in2out( surface_collection.id() ); - builder_to.set_surface_collection_name( - id, surface_collection.name() ); + if( const auto name = surface_collection.name() ) + { + builder_to.set_surface_collection_name( id, name.value() ); + } builder_to.set_surface_collection_active( id, surface_collection.is_active() ); } @@ -272,8 +293,10 @@ namespace geode mapping.map( block_collection.id(), id ); } const auto& id = mapping.in2out( block_collection.id() ); - builder_to.set_block_collection_name( - id, block_collection.name() ); + if( const auto name = block_collection.name() ) + { + builder_to.set_block_collection_name( id, name.value() ); + } builder_to.set_block_collection_active( id, block_collection.is_active() ); } diff --git a/include/geode/model/representation/core/mapping.hpp b/include/geode/model/representation/core/mapping.hpp index aaa9a8ce3..5b6c31f19 100644 --- a/include/geode/model/representation/core/mapping.hpp +++ b/include/geode/model/representation/core/mapping.hpp @@ -189,12 +189,6 @@ namespace geode ModelUnchangedComponentMapping unchanged_components; }; - struct [[deprecated]] ModelMappings : public ModelComponentMappings - { - ModelMeshesElementMapping mesh_element_mapping; - ModelMeshesVertexMapping mesh_vertices_mapping; - }; - struct SectionMappings : public ModelComponentMappings { ModelMeshesElementMapping mesh_element_mapping; diff --git a/src/geode/basic/console_progress_logger_client.cpp b/src/geode/basic/console_progress_logger_client.cpp index d0079a271..f55378031 100644 --- a/src/geode/basic/console_progress_logger_client.cpp +++ b/src/geode/basic/console_progress_logger_client.cpp @@ -118,30 +118,4 @@ namespace geode { impl_->failed( progress_logger_id, level ); } - - void ConsoleProgressLoggerClient::start( const uuid& progress_logger_id, - const std::string& message, - index_t nb_steps ) - { - impl_->start( - progress_logger_id, Logger::LEVEL::info, message, nb_steps ); - } - - void ConsoleProgressLoggerClient::update( - const uuid& progress_logger_id, index_t current, index_t nb_steps ) - { - impl_->update( - progress_logger_id, Logger::LEVEL::info, current, nb_steps ); - } - - void ConsoleProgressLoggerClient::completed( - const uuid& progress_logger_id ) - { - impl_->completed( progress_logger_id, Logger::LEVEL::info ); - } - - void ConsoleProgressLoggerClient::failed( const uuid& progress_logger_id ) - { - impl_->failed( progress_logger_id, Logger::LEVEL::info ); - } } // namespace geode diff --git a/src/geode/basic/identifier.cpp b/src/geode/basic/identifier.cpp index e986fe3f0..7b6897c42 100644 --- a/src/geode/basic/identifier.cpp +++ b/src/geode/basic/identifier.cpp @@ -25,6 +25,8 @@ #include +#include + #include #include #include @@ -34,14 +36,12 @@ namespace geode class Identifier::Impl { public: - Impl() = default; - const uuid& id() const { return id_; } - std::string_view name() const + const std::optional< std::string >& name() const { return name_; } @@ -91,20 +91,39 @@ namespace geode "[Identifier::load] Error while reading file: ", filename ); } + private: + static constexpr auto DEFAULT_NAME = "default_name"; + + friend class bitsery::Access; template < typename Archive > void serialize( Archive& archive ) { - archive.ext( *this, Growable< Archive, Impl >{ - { []( Archive& local_archive, Impl& impl ) { - local_archive.object( impl.id_ ); - local_archive.text1b( - impl.name_, impl.name_.max_size() ); - } } } ); + archive.ext( *this, + Growable< Archive, Impl >{ + { []( Archive& local_archive, Impl& impl ) { + local_archive.object( impl.id_ ); + std::string old_name; + local_archive.text1b( old_name, old_name.max_size() ); + if( old_name != DEFAULT_NAME ) + { + impl.name_.emplace( std::move( old_name ) ); + } + }, + []( Archive& local_archive, Impl& impl ) { + local_archive.object( impl.id_ ); + local_archive.ext( impl.name_, + bitsery::ext::StdOptional{}, + []( Archive& local_archive2, + std::string& name ) { + local_archive2.text1b( + name, name.max_size() ); + } ); + } } } ); } private: uuid id_; - std::string name_ = std::string{ DEFAULT_NAME }; + std::optional< std::string > name_; }; Identifier::Identifier() = default; @@ -120,7 +139,7 @@ namespace geode return impl_->id(); } - std::string_view Identifier::name() const + const std::optional< std::string >& Identifier::name() const { return impl_->name(); } @@ -149,7 +168,10 @@ namespace geode void Identifier::copy_identifier( const Identifier& other, IdentifierKey /*unused*/ ) { - set_name( other.name() ); + if( const auto name = other.name() ) + { + set_name( name.value() ); + } set_id( other.id() ); } diff --git a/src/geode/basic/progress_logger.cpp b/src/geode/basic/progress_logger.cpp index 0c0a9bf8d..e69f16b1e 100644 --- a/src/geode/basic/progress_logger.cpp +++ b/src/geode/basic/progress_logger.cpp @@ -94,12 +94,6 @@ namespace geode Logger::LEVEL level_; }; - ProgressLogger::ProgressLogger( - const std::string& message, index_t nb_steps ) - : ProgressLogger( Logger::LEVEL::info, message, nb_steps ) - { - } - ProgressLogger::ProgressLogger( Logger::LEVEL level, const std::string& message, index_t nb_steps ) : impl_( level, message, nb_steps ) diff --git a/src/geode/geometry/aabb.cpp b/src/geode/geometry/aabb.cpp index 0bfe5a86b..068bb9e5b 100644 --- a/src/geode/geometry/aabb.cpp +++ b/src/geode/geometry/aabb.cpp @@ -74,17 +74,6 @@ namespace geode return impl_->node( Impl::ROOT_INDEX ); } - template < index_t dimension > - bool AABBTree< dimension >::parallel() const - { - return false; - } - - template < index_t dimension > - void AABBTree< dimension >::set_parallel( bool /*parallel*/ ) - { - } - template < index_t dimension > std::vector< index_t > AABBTree< dimension >::containing_boxes( const Point< dimension >& query ) const diff --git a/src/geode/mesh/CMakeLists.txt b/src/geode/mesh/CMakeLists.txt index 533ae4b76..6567f01e6 100644 --- a/src/geode/mesh/CMakeLists.txt +++ b/src/geode/mesh/CMakeLists.txt @@ -115,7 +115,6 @@ add_geode_library( "helpers/grid_point_function.cpp" "helpers/grid_scalar_function.cpp" "helpers/repair_polygon_orientations.cpp" - "helpers/remove_vertex_duplication.cpp" "helpers/tetrahedral_solid_point_function.cpp" "helpers/tetrahedral_solid_scalar_function.cpp" "helpers/triangulated_surface_point_function.cpp" @@ -258,7 +257,6 @@ add_geode_library( "helpers/grid_point_function.hpp" "helpers/grid_scalar_function.hpp" "helpers/repair_polygon_orientations.hpp" - "helpers/remove_vertex_duplication.hpp" "helpers/tetrahedral_solid_point_function.hpp" "helpers/tetrahedral_solid_scalar_function.hpp" "helpers/triangulated_surface_point_function.hpp" diff --git a/src/geode/mesh/builder/vertex_set_builder.cpp b/src/geode/mesh/builder/vertex_set_builder.cpp index 897ee0c56..e29a620f0 100644 --- a/src/geode/mesh/builder/vertex_set_builder.cpp +++ b/src/geode/mesh/builder/vertex_set_builder.cpp @@ -55,7 +55,10 @@ namespace geode OPENGEODE_EXCEPTION( vertex_set_.nb_vertices() == 0, "[VertexSetBuilder::copy] Cannot copy a mesh into an already " "initialized mesh." ); - set_name( vertex_set.name() ); + if( const auto name = vertex_set.name() ) + { + set_name( name.value() ); + } create_vertices( vertex_set.nb_vertices() ); vertex_set_.vertex_attribute_manager().copy( vertex_set.vertex_attribute_manager() ); diff --git a/src/geode/mesh/core/solid_mesh.cpp b/src/geode/mesh/core/solid_mesh.cpp index 7e7c68bc1..025bf2712 100644 --- a/src/geode/mesh/core/solid_mesh.cpp +++ b/src/geode/mesh/core/solid_mesh.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -194,7 +195,8 @@ namespace } while( facet.polyhedron_id != first_polyhedron && safety_count < MAX_SAFETY_COUNT ); OPENGEODE_EXCEPTION( safety_count < MAX_SAFETY_COUNT, - "[SolidMesh::propagate_around_edge] Solid ", solid.name(), + "[SolidMesh::propagate_around_edge] Solid ", + solid.name().value_or( solid.id().string() ), ": too many polyhedra around edge ", edge_vertices[0], " ", edge_vertices[1], " (", solid.point( edge_vertices[0] ).string(), " ", solid.point( edge_vertices[1] ).string(), @@ -298,7 +300,8 @@ namespace } } OPENGEODE_EXCEPTION( safety_count < MAX_SAFETY_COUNT, - "[SolidMesh::compute_polyhedra_around_vertex] Solid ", solid.name(), + "[SolidMesh::compute_polyhedra_around_vertex] Solid ", + solid.name().value_or( solid.id().string() ), ": Too many polyhedra around vertex ", vertex_id, " (", solid.point( vertex_id ).string(), "). This is probably related to a bug in the polyhedra " diff --git a/src/geode/mesh/core/surface_mesh.cpp b/src/geode/mesh/core/surface_mesh.cpp index 9c73b953d..275d6ab12 100644 --- a/src/geode/mesh/core/surface_mesh.cpp +++ b/src/geode/mesh/core/surface_mesh.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -185,7 +186,8 @@ namespace } } OPENGEODE_EXCEPTION( safety_count < MAX_SAFETY_COUNT, - "[SurfaceMesh::polygons_around_vertex] Surface ", mesh.name(), + "[SurfaceMesh::polygons_around_vertex] Surface ", + mesh.name().value_or( mesh.id().string() ), ": Too many polygons around vertex ", vertex_id, " (", mesh.point( vertex_id ).string(), "). This is probably related to a bug in the polygon " diff --git a/src/geode/mesh/helpers/convert_edged_curve.cpp b/src/geode/mesh/helpers/convert_edged_curve.cpp index e0249de7a..cea9c668b 100644 --- a/src/geode/mesh/helpers/convert_edged_curve.cpp +++ b/src/geode/mesh/helpers/convert_edged_curve.cpp @@ -79,19 +79,4 @@ namespace geode internal::copy_meta_info( curve2d, *builder3d ); return curve3d; } - - template < index_t dimension > - std::unique_ptr< EdgedCurve< dimension > > merge_edged_curves( absl::Span< - const std::reference_wrapper< const EdgedCurve< dimension > > > curves ) - { - detail::EdgedCurveMerger< dimension > merger{ curves }; - return merger.merge( GLOBAL_EPSILON ); - } - - template std::unique_ptr< EdgedCurve< 2 > > - opengeode_mesh_api merge_edged_curves( absl::Span< - const std::reference_wrapper< const EdgedCurve< 2 > > > ); - template std::unique_ptr< EdgedCurve< 3 > > - opengeode_mesh_api merge_edged_curves( absl::Span< - const std::reference_wrapper< const EdgedCurve< 3 > > > ); } // namespace geode diff --git a/src/geode/mesh/helpers/convert_solid_mesh.cpp b/src/geode/mesh/helpers/convert_solid_mesh.cpp index ae6ca2f00..e9c3cdc29 100644 --- a/src/geode/mesh/helpers/convert_solid_mesh.cpp +++ b/src/geode/mesh/helpers/convert_solid_mesh.cpp @@ -925,11 +925,4 @@ namespace geode hybrid_solid->get()->polyhedron_attribute_manager() ); return hybrid_solid; } - - std::unique_ptr< SolidMesh3D > merge_solid_meshes( - absl::Span< const std::reference_wrapper< const SolidMesh3D > > solids ) - { - detail::SolidMeshMerger3D merger{ solids }; - return merger.merge( GLOBAL_EPSILON ); - } } // namespace geode diff --git a/src/geode/mesh/helpers/convert_surface_mesh.cpp b/src/geode/mesh/helpers/convert_surface_mesh.cpp index a6c88df29..645948cc3 100644 --- a/src/geode/mesh/helpers/convert_surface_mesh.cpp +++ b/src/geode/mesh/helpers/convert_surface_mesh.cpp @@ -528,16 +528,6 @@ namespace geode return surface2d; } - template < index_t dimension > - std::unique_ptr< SurfaceMesh< dimension > > merge_surface_meshes( - absl::Span< - const std::reference_wrapper< const SurfaceMesh< dimension > > > - surfaces ) - { - detail::SurfaceMeshMerger< dimension > merger{ surfaces }; - return merger.merge( GLOBAL_EPSILON ); - } - template std::unique_ptr< PolygonalSurface2D > opengeode_mesh_api convert_surface_mesh_into_polygonal_surface( const SurfaceMesh2D& ); template std::unique_ptr< PolygonalSurface3D > opengeode_mesh_api @@ -557,11 +547,4 @@ namespace geode const SurfaceMesh2D&, SurfaceMeshBuilder2D& ); template void opengeode_mesh_api triangulate_surface_mesh( const SurfaceMesh3D&, SurfaceMeshBuilder3D& ); - - template std::unique_ptr< SurfaceMesh< 2 > > - opengeode_mesh_api merge_surface_meshes( absl::Span< - const std::reference_wrapper< const SurfaceMesh< 2 > > > ); - template std::unique_ptr< SurfaceMesh< 3 > > - opengeode_mesh_api merge_surface_meshes( absl::Span< - const std::reference_wrapper< const SurfaceMesh< 3 > > > ); } // namespace geode diff --git a/src/geode/mesh/helpers/ray_tracing.cpp b/src/geode/mesh/helpers/ray_tracing.cpp index 5f993822c..c991dff24 100644 --- a/src/geode/mesh/helpers/ray_tracing.cpp +++ b/src/geode/mesh/helpers/ray_tracing.cpp @@ -362,11 +362,6 @@ namespace geode std::mutex mutex_; }; - RayTracing2D::RayTracing2D( const EdgedCurve2D& mesh, const Ray2D& ray ) - : impl_{ mesh, ray } - { - } - RayTracing2D::RayTracing2D( const EdgedCurve2D& mesh, const BoundingBox2D& bbox, const Ray2D& ray ) : impl_{ mesh, bbox, ray } @@ -387,12 +382,6 @@ namespace geode { } - RayTracing2D::RayTracing2D( - const EdgedCurve2D& mesh, const InfiniteLine2D& infinite_line ) - : impl_{ mesh, infinite_line } - { - } - RayTracing2D::RayTracing2D( RayTracing2D&& ) noexcept = default; RayTracing2D::~RayTracing2D() = default; @@ -595,17 +584,6 @@ namespace geode std::mutex mutex_; }; - RayTracing3D::RayTracing3D( const SurfaceMesh3D& mesh, const Ray3D& ray ) - : impl_{ mesh, ray } - { - } - - RayTracing3D::RayTracing3D( - const SurfaceMesh3D& mesh, const InfiniteLine3D& infinite_line ) - : impl_{ mesh, infinite_line } - { - } - RayTracing3D::RayTracing3D( const SurfaceMesh3D& mesh, const BoundingBox3D& bbox, const Ray3D& ray ) : impl_{ mesh, bbox, ray } diff --git a/src/geode/mesh/helpers/remove_vertex_duplication.cpp b/src/geode/mesh/helpers/remove_vertex_duplication.cpp deleted file mode 100644 index dd0c1bee8..000000000 --- a/src/geode/mesh/helpers/remove_vertex_duplication.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2019 - 2026 Geode-solutions - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - */ - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace -{ - template < geode::index_t dimension > - void replace_vertices( const geode::PointSet< dimension >& mesh, - geode::PointSetBuilder< dimension >& builder, - const geode::GenericMapping< geode::index_t >& mapping ) - { - std::vector< bool > to_delete( mesh.nb_vertices(), false ); - for( const auto v : geode::Range{ mesh.nb_vertices() } ) - { - if( mapping.in2out( v ).front() != v ) - { - to_delete[v] = true; - } - } - builder.delete_vertices( to_delete ); - } - - template < geode::index_t dimension > - void replace_vertices( const geode::EdgedCurve< dimension >& mesh, - geode::EdgedCurveBuilder< dimension >& builder, - const geode::GenericMapping< geode::index_t >& mapping ) - { - for( const auto e : geode::Range{ mesh.nb_edges() } ) - { - const auto vertices = mesh.edge_vertices( e ); - for( const auto v : geode::LRange{ 2 } ) - { - const auto new_vertex_id = - mapping.in2out( vertices[v] ).front(); - if( new_vertex_id != vertices[v] ) - { - builder.set_edge_vertex( { e, v }, new_vertex_id ); - } - } - } - builder.delete_isolated_vertices(); - } - - template < geode::index_t dimension > - void replace_vertices( const geode::SurfaceMesh< dimension >& mesh, - geode::SurfaceMeshBuilder< dimension >& builder, - const geode::GenericMapping< geode::index_t >& mapping ) - { - builder.replace_vertices( mapping ); - if( mesh.are_edges_enabled() ) - { - builder.edges_builder().delete_isolated_edges(); - } - builder.delete_isolated_vertices(); - } - - template < geode::index_t dimension > - void replace_vertices( const geode::SolidMesh< dimension >& mesh, - geode::SolidMeshBuilder< dimension >& builder, - const geode::GenericMapping< geode::index_t >& mapping ) - { - builder.replace_vertices( mapping ); - if( mesh.are_edges_enabled() ) - { - builder.edges_builder().delete_isolated_edges(); - } - if( mesh.are_facets_enabled() ) - { - builder.facets_builder().delete_isolated_facets(); - } - builder.delete_isolated_vertices(); - } - - template < typename Mesh, typename Builder > - void remove_vertex_duplication( const Mesh& mesh, Builder& builder ) - { - const auto nnsearch = create_nn_search( mesh ); - const auto mapping = - nnsearch.colocated_index_mapping( geode::GLOBAL_EPSILON ); - if( mapping.nb_colocated_points() == mesh.nb_vertices() ) - { - return; - } - replace_vertices( mesh, builder, mapping.vertices_mapping() ); - } -} // namespace - -namespace geode -{ - template < index_t dimension > - void remove_vertex_duplication( const PointSet< dimension >& mesh, - PointSetBuilder< dimension >& builder ) - { - ::remove_vertex_duplication( mesh, builder ); - } - - template < index_t dimension > - void remove_vertex_duplication( const EdgedCurve< dimension >& mesh, - EdgedCurveBuilder< dimension >& builder ) - { - ::remove_vertex_duplication( mesh, builder ); - } - - template < index_t dimension > - void remove_vertex_duplication( const SurfaceMesh< dimension >& mesh, - SurfaceMeshBuilder< dimension >& builder ) - { - ::remove_vertex_duplication( mesh, builder ); - } - - void remove_vertex_duplication( - const SolidMesh3D& mesh, SolidMeshBuilder3D& builder ) - { - ::remove_vertex_duplication( mesh, builder ); - } - - template void opengeode_mesh_api remove_vertex_duplication( - const PointSet2D&, PointSetBuilder2D& ); - template void opengeode_mesh_api remove_vertex_duplication( - const PointSet3D&, PointSetBuilder3D& ); - - template void opengeode_mesh_api remove_vertex_duplication( - const EdgedCurve2D&, EdgedCurveBuilder2D& ); - template void opengeode_mesh_api remove_vertex_duplication( - const EdgedCurve3D&, EdgedCurveBuilder3D& ); - - template void opengeode_mesh_api remove_vertex_duplication( - const SurfaceMesh2D&, SurfaceMeshBuilder2D& ); - template void opengeode_mesh_api remove_vertex_duplication( - const SurfaceMesh3D&, SurfaceMeshBuilder3D& ); - -} // namespace geode diff --git a/src/geode/mesh/helpers/repair_polygon_orientations.cpp b/src/geode/mesh/helpers/repair_polygon_orientations.cpp index 2cb163ede..8b30758a3 100644 --- a/src/geode/mesh/helpers/repair_polygon_orientations.cpp +++ b/src/geode/mesh/helpers/repair_polygon_orientations.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -64,18 +65,19 @@ namespace visited[p] = true; process_polygon_queue( visited ); } + return get_bad_oriented_polygons(); } catch( geode::OpenGeodeException& e ) { - const auto msg = - absl::StrCat( "Surface ", mesh_.name(), ": ", e.what() ); + const auto msg = absl::StrCat( "Surface ", + mesh_.name().value_or( mesh_.id().string() ), ": ", + e.what() ); throw geode::OpenGeodeException( msg ); } catch( ... ) { throw; } - return get_bad_oriented_polygons(); } private: @@ -321,13 +323,6 @@ namespace namespace geode { - template < index_t dimension > - void repair_polygon_orientations( SurfaceMesh< dimension >& mesh ) - { - auto builder = SurfaceMeshBuilder< dimension >::create( mesh ); - repair_polygon_orientations( mesh, *builder ); - } - template < index_t dimension > void repair_polygon_orientations( const SurfaceMesh< dimension >& mesh, SurfaceMeshBuilder< dimension >& builder ) @@ -343,11 +338,6 @@ namespace geode polygons_to_reorient.size(), " polygons reoriented" ); } - template void opengeode_mesh_api repair_polygon_orientations( - SurfaceMesh2D& ); - template void opengeode_mesh_api repair_polygon_orientations( - SurfaceMesh3D& ); - template void opengeode_mesh_api repair_polygon_orientations( const SurfaceMesh2D&, SurfaceMeshBuilder2D& ); template void opengeode_mesh_api repair_polygon_orientations( diff --git a/src/geode/model/helpers/convert_brep_section.cpp b/src/geode/model/helpers/convert_brep_section.cpp index c23b3b894..657884dc5 100644 --- a/src/geode/model/helpers/convert_brep_section.cpp +++ b/src/geode/model/helpers/convert_brep_section.cpp @@ -200,8 +200,11 @@ namespace for( const auto& model_boundary : section_.model_boundaries() ) { const auto new_id = brep_builder_.add_model_boundary(); - brep_builder_.set_model_boundary_name( - new_id, model_boundary.name() ); + if( const auto name = model_boundary.name() ) + { + brep_builder_.set_model_boundary_name( + new_id, name.value() ); + } for( const auto& item : section_.model_boundary_items( model_boundary ) ) { diff --git a/src/geode/model/helpers/detail/build_model_boundaries.cpp b/src/geode/model/helpers/detail/build_model_boundaries.cpp index 805941893..7453717b9 100644 --- a/src/geode/model/helpers/detail/build_model_boundaries.cpp +++ b/src/geode/model/helpers/detail/build_model_boundaries.cpp @@ -52,7 +52,7 @@ namespace const geode::ModelBoundary< Model::dim >& find_or_create_boundary( const Model& model, typename Model::Builder& builder, - std::string_view name ) + const std::optional< std::string >& name ) { for( const auto& boundary : model.model_boundaries() ) { @@ -62,7 +62,10 @@ namespace } } const auto& model_boundary_id = builder.add_model_boundary(); - builder.set_model_boundary_name( model_boundary_id, name ); + if( name ) + { + builder.set_model_boundary_name( model_boundary_id, name.value() ); + } const auto& boundary = model.model_boundary( model_boundary_id ); return boundary; } diff --git a/src/geode/model/representation/builder/brep_builder.cpp b/src/geode/model/representation/builder/brep_builder.cpp index b7a9a9762..09b9b7018 100644 --- a/src/geode/model/representation/builder/brep_builder.cpp +++ b/src/geode/model/representation/builder/brep_builder.cpp @@ -76,7 +76,10 @@ namespace geode OPENGEODE_EXCEPTION( nb_components == 0, "[BRepBuild::copy] BRep should be empty before copy. To add BRep " "components in a BRep which is not empty, use ModelConcatener." ); - set_name( brep.name() ); + if( const auto name = brep.name() ) + { + set_name( name.value() ); + } auto mapping = copy_components( brep ); copy_relationships( mapping, brep ); copy_component_geometry( mapping, brep ); diff --git a/src/geode/model/representation/builder/section_builder.cpp b/src/geode/model/representation/builder/section_builder.cpp index 6cf812d60..477b19fd1 100644 --- a/src/geode/model/representation/builder/section_builder.cpp +++ b/src/geode/model/representation/builder/section_builder.cpp @@ -70,7 +70,10 @@ namespace geode "[SectionBuild::copy] Section should be empty before copy. To add " "Section components in a Section which is not empty, use " "ModelConcatener." ); - set_name( section.name() ); + if( const auto name = section.name() ) + { + set_name( name.value() ); + } auto mapping = copy_components( section ); copy_relationships( mapping, section ); copy_component_geometry( mapping, section ); diff --git a/src/geode/model/representation/core/detail/transfer_collections.cpp b/src/geode/model/representation/core/detail/transfer_collections.cpp index 8f2ae9ab9..e13c7ea9b 100644 --- a/src/geode/model/representation/core/detail/transfer_collections.cpp +++ b/src/geode/model/representation/core/detail/transfer_collections.cpp @@ -72,8 +72,11 @@ namespace if( !new_model.has_corner_collection( collection_in.id() ) ) { new_model_builder.add_corner_collection( collection_in.id() ); - new_model_builder.set_corner_collection_name( - collection_in.id(), collection_in.name() ); + if( const auto name = collection_in.name() ) + { + new_model_builder.set_corner_collection_name( + collection_in.id(), name.value() ); + } } const auto& new_collection = new_model.corner_collection( collection_in.id() ); @@ -132,8 +135,11 @@ namespace if( !new_model.has_corner_collection( collection_in.id() ) ) { new_model_builder.add_corner_collection( collection_in.id() ); - new_model_builder.set_corner_collection_name( - collection_in.id(), collection_in.name() ); + if( const auto name = collection_in.name() ) + { + new_model_builder.set_corner_collection_name( + collection_in.id(), name.value() ); + } } const auto& new_collection = new_model.corner_collection( collection_in.id() ); @@ -177,8 +183,11 @@ namespace if( !new_model.has_line_collection( collection_in.id() ) ) { new_model_builder.add_line_collection( collection_in.id() ); - new_model_builder.set_line_collection_name( - collection_in.id(), collection_in.name() ); + if( const auto name = collection_in.name() ) + { + new_model_builder.set_line_collection_name( + collection_in.id(), name.value() ); + } } const auto& new_collection = new_model.line_collection( collection_in.id() ); @@ -235,8 +244,11 @@ namespace if( !new_model.has_line_collection( collection_in.id() ) ) { new_model_builder.add_line_collection( collection_in.id() ); - new_model_builder.set_line_collection_name( - collection_in.id(), collection_in.name() ); + if( const auto name = collection_in.name() ) + { + new_model_builder.set_line_collection_name( + collection_in.id(), name.value() ); + } } const auto& new_collection = new_model.line_collection( collection_in.id() ); @@ -281,8 +293,11 @@ namespace if( !new_model.has_surface_collection( collection_in.id() ) ) { new_model_builder.add_surface_collection( collection_in.id() ); - new_model_builder.set_surface_collection_name( - collection_in.id(), collection_in.name() ); + if( const auto name = collection_in.name() ) + { + new_model_builder.set_surface_collection_name( + collection_in.id(), name.value() ); + } } const auto& new_collection = new_model.surface_collection( collection_in.id() ); @@ -342,8 +357,11 @@ namespace if( !new_model.has_surface_collection( collection_in.id() ) ) { new_model_builder.add_surface_collection( collection_in.id() ); - new_model_builder.set_surface_collection_name( - collection_in.id(), collection_in.name() ); + if( const auto name = collection_in.name() ) + { + new_model_builder.set_surface_collection_name( + collection_in.id(), name.value() ); + } } const auto& new_collection = new_model.surface_collection( collection_in.id() ); @@ -387,8 +405,11 @@ namespace if( !new_model.has_block_collection( collection_in.id() ) ) { new_model_builder.add_block_collection( collection_in.id() ); - new_model_builder.set_block_collection_name( - collection_in.id(), collection_in.name() ); + if( const auto name = collection_in.name() ) + { + new_model_builder.set_block_collection_name( + collection_in.id(), name.value() ); + } } const auto& new_collection = new_model.block_collection( collection_in.id() ); @@ -445,8 +466,11 @@ namespace if( !new_model.has_block_collection( collection_in.id() ) ) { new_model_builder.add_block_collection( collection_in.id() ); - new_model_builder.set_block_collection_name( - collection_in.id(), collection_in.name() ); + if( const auto name = collection_in.name() ) + { + new_model_builder.set_block_collection_name( + collection_in.id(), name.value() ); + } } const auto& new_collection = new_model.block_collection( collection_in.id() ); @@ -490,8 +514,11 @@ namespace if( !new_model.has_model_boundary( collection_in.id() ) ) { new_model_builder.add_model_boundary( collection_in.id() ); - new_model_builder.set_model_boundary_name( - collection_in.id(), collection_in.name() ); + if( const auto name = collection_in.name() ) + { + new_model_builder.set_model_boundary_name( + collection_in.id(), name.value() ); + } } const auto& new_collection = new_model.model_boundary( collection_in.id() ); @@ -550,8 +577,11 @@ namespace if( !new_model.has_model_boundary( model_bdry.id() ) ) { new_model_builder.add_model_boundary( model_bdry.id() ); - new_model_builder.set_model_boundary_name( - model_bdry.id(), model_bdry.name() ); + if( const auto name = model_bdry.name() ) + { + new_model_builder.set_model_boundary_name( + model_bdry.id(), name.value() ); + } } const auto& new_model_bdry = new_model.model_boundary( model_bdry.id() ); @@ -595,8 +625,11 @@ namespace if( !new_model.has_model_boundary( collection_in.id() ) ) { new_model_builder.add_model_boundary( collection_in.id() ); - new_model_builder.set_model_boundary_name( - collection_in.id(), collection_in.name() ); + if( const auto name = collection_in.name() ) + { + new_model_builder.set_model_boundary_name( + collection_in.id(), name.value() ); + } } const auto& new_collection = new_model.model_boundary( collection_in.id() ); @@ -652,8 +685,11 @@ namespace if( !new_model.has_model_boundary( model_bdry.id() ) ) { new_model_builder.add_model_boundary( model_bdry.id() ); - new_model_builder.set_model_boundary_name( - model_bdry.id(), model_bdry.name() ); + if( const auto name = model_bdry.name() ) + { + new_model_builder.set_model_boundary_name( + model_bdry.id(), name.value() ); + } } const auto& new_model_bdry = new_model.model_boundary( model_bdry.id() ); diff --git a/src/geode/model/representation/core/detail/transfer_meshes.cpp b/src/geode/model/representation/core/detail/transfer_meshes.cpp index 54334cab0..bbb0108e5 100644 --- a/src/geode/model/representation/core/detail/transfer_meshes.cpp +++ b/src/geode/model/representation/core/detail/transfer_meshes.cpp @@ -150,7 +150,10 @@ namespace corner, other_builder.steal_corner_mesh( other_corner_id ) ); auto mesh_builder = builder.corner_mesh_builder( corner_id ); mesh_builder->set_id( corner.id() ); - mesh_builder->set_name( corner.name() ); + if( const auto name = corner.name() ) + { + mesh_builder->set_name( name.value() ); + } set_mesh_unique_vertices( builder, corner_unique_vertices, corner.component_id(), first_new_unique_vertex_id ); } @@ -176,7 +179,10 @@ namespace line, other_builder.steal_line_mesh( other_line_id ) ); auto mesh_builder = builder.line_mesh_builder( line_id ); mesh_builder->set_id( line.id() ); - mesh_builder->set_name( line.name() ); + if( const auto name = line.name() ) + { + mesh_builder->set_name( name.value() ); + } set_mesh_unique_vertices( builder, line_unique_vertices, line.component_id(), first_new_unique_vertex_id ); } @@ -203,7 +209,10 @@ namespace surface, other_builder.steal_surface_mesh( other_surface_id ) ); auto mesh_builder = builder.surface_mesh_builder( surface_id ); mesh_builder->set_id( surface.id() ); - mesh_builder->set_name( surface.name() ); + if( const auto name = surface.name() ) + { + mesh_builder->set_name( name.value() ); + } set_mesh_unique_vertices( builder, surface_unique_vertices, surface.component_id(), first_new_unique_vertex_id ); } @@ -229,7 +238,10 @@ namespace block, other_builder.steal_block_mesh( other_block_id ) ); auto mesh_builder = builder.block_mesh_builder( block_id ); mesh_builder->set_id( block.id() ); - mesh_builder->set_name( block.name() ); + if( const auto name = block.name() ) + { + mesh_builder->set_name( name.value() ); + } set_mesh_unique_vertices( builder, block_unique_vertices, block.component_id(), first_new_unique_vertex_id ); } diff --git a/src/geode/model/representation/core/detail/transfer_metadata.cpp b/src/geode/model/representation/core/detail/transfer_metadata.cpp index 13ba9a176..7b8cacd23 100644 --- a/src/geode/model/representation/core/detail/transfer_metadata.cpp +++ b/src/geode/model/representation/core/detail/transfer_metadata.cpp @@ -56,12 +56,19 @@ namespace .at( geode::Corner< Model::dim >::component_type_static() ) .out2in_map() ) { - std::string out_name{ "" }; - geode::SmallSet< std::string_view > unique_names; + geode::SmallSet< std::string > unique_names; for( const auto& in_uuid : in_uuids ) { - unique_names.insert( old_model.corner( in_uuid ).name() ); + if( const auto name = old_model.corner( in_uuid ).name() ) + { + unique_names.insert( name.value() ); + } + } + if( unique_names.empty() ) + { + continue; } + std::string out_name{ "" }; for( const auto& corner_name : unique_names ) { absl::StrAppend( &out_name, corner_name, "+" ); @@ -85,12 +92,19 @@ namespace .at( geode::Line< Model::dim >::component_type_static() ) .out2in_map() ) { - std::string out_name{ "" }; - geode::SmallSet< std::string_view > unique_names; + geode::SmallSet< std::string > unique_names; for( const auto& in_uuid : in_uuids ) { - unique_names.insert( old_model.line( in_uuid ).name() ); + if( const auto name = old_model.line( in_uuid ).name() ) + { + unique_names.insert( name.value() ); + } + } + if( unique_names.empty() ) + { + continue; } + std::string out_name{ "" }; for( const auto& line_name : unique_names ) { absl::StrAppend( &out_name, line_name, "+" ); @@ -114,12 +128,19 @@ namespace .at( geode::Surface< Model::dim >::component_type_static() ) .out2in_map() ) { - std::string out_name{ "" }; - geode::SmallSet< std::string_view > unique_names; + geode::SmallSet< std::string > unique_names; for( const auto& in_uuid : in_uuids ) { - unique_names.insert( old_model.surface( in_uuid ).name() ); + if( const auto name = old_model.surface( in_uuid ).name() ) + { + unique_names.insert( name.value() ); + } + } + if( unique_names.empty() ) + { + continue; } + std::string out_name{ "" }; for( const auto& surface_name : unique_names ) { absl::StrAppend( &out_name, surface_name, "+" ); @@ -142,12 +163,19 @@ namespace component_mapping.at( geode::Block3D::component_type_static() ) .out2in_map() ) { - std::string out_name{ "" }; - geode::SmallSet< std::string_view > unique_names; + geode::SmallSet< std::string > unique_names; for( const auto& in_uuid : in_uuids ) { - unique_names.insert( old_model.block( in_uuid ).name() ); + if( const auto name = old_model.block( in_uuid ).name() ) + { + unique_names.insert( name.value() ); + } + } + if( unique_names.empty() ) + { + continue; } + std::string out_name{ "" }; for( const auto& surface_name : unique_names ) { absl::StrAppend( &out_name, surface_name, "+" ); @@ -207,14 +235,12 @@ namespace geode .out2in_map() ) { std::string out_name{ "" }; - bool first{ true }; for( const auto& in_uuid : out2in_mapping.second ) { - if( !first ) + if( !out_name.empty() ) { absl::StrAppend( &out_name, "+" ); } - first = false; const auto in_pointset = absl::c_find_if( pointsets, [&in_uuid]( const std::reference_wrapper< const PointSet< ModelBuilder::dim > >& @@ -224,9 +250,16 @@ namespace geode OPENGEODE_EXCEPTION( in_pointset != pointsets.end(), "[transfer_pointsets_metadata] Should have found input " "pointset from mapping" ); - absl::StrAppend( &out_name, in_pointset->get().name() ); + if( const auto name = in_pointset->get().name() ) + { + absl::StrAppend( &out_name, name.value() ); + } + } + if( !out_name.empty() ) + { + model_builder.set_corner_name( + out2in_mapping.first, out_name ); } - model_builder.set_corner_name( out2in_mapping.first, out_name ); } } @@ -248,14 +281,12 @@ namespace geode .out2in_map() ) { std::string out_name{ "" }; - bool first{ true }; for( const auto& in_uuid : out2in_mapping.second ) { - if( !first ) + if( !out_name.empty() ) { absl::StrAppend( &out_name, "+" ); } - first = false; const auto in_curve = absl::c_find_if( curves, [&in_uuid]( const std::reference_wrapper< const EdgedCurve< ModelBuilder::dim > >& @@ -265,9 +296,16 @@ namespace geode OPENGEODE_EXCEPTION( in_curve != curves.end(), "[transfer_curves_metadata] Should have found input " "curve from mapping" ); - absl::StrAppend( &out_name, in_curve->get().name() ); + if( const auto name = in_curve->get().name() ) + { + absl::StrAppend( &out_name, name.value() ); + } + } + if( !out_name.empty() ) + { + model_builder.set_line_name( + out2in_mapping.first, out_name ); } - model_builder.set_line_name( out2in_mapping.first, out_name ); } } @@ -289,14 +327,12 @@ namespace geode .out2in_map() ) { std::string out_name{ "" }; - bool first{ true }; for( const auto& in_uuid : out2in_mapping.second ) { - if( !first ) + if( !out_name.empty() ) { absl::StrAppend( &out_name, "+" ); } - first = false; const auto in_surface = absl::c_find_if( surfaces, [&in_uuid]( const std::reference_wrapper< const SurfaceMesh< ModelBuilder::dim > >& @@ -306,10 +342,16 @@ namespace geode OPENGEODE_EXCEPTION( in_surface != surfaces.end(), "[transfer_surfaces_metadata] Should have found input " "surface from mapping" ); - absl::StrAppend( &out_name, in_surface->get().name() ); + if( const auto name = in_surface->get().name() ) + { + absl::StrAppend( &out_name, name.value() ); + } + } + if( !out_name.empty() ) + { + model_builder.set_surface_name( + out2in_mapping.first, out_name ); } - model_builder.set_surface_name( - out2in_mapping.first, out_name ); } } @@ -329,14 +371,12 @@ namespace geode .out2in_map() ) { std::string out_name{ "" }; - bool first{ true }; for( const auto& in_uuid : out2in_mapping.second ) { - if( !first ) + if( !out_name.empty() ) { absl::StrAppend( &out_name, "+" ); } - first = false; const auto in_solid = absl::c_find_if( solids, [&in_uuid]( const std::reference_wrapper< const SolidMesh3D >& @@ -346,9 +386,16 @@ namespace geode OPENGEODE_EXCEPTION( in_solid != solids.end(), "[transfer_solids_metadata] Should have found input " "solid from mapping" ); - absl::StrAppend( &out_name, in_solid->get().name() ); + if( const auto name = in_solid->get().name() ) + { + absl::StrAppend( &out_name, name.value() ); + } + } + if( !out_name.empty() ) + { + model_builder.set_block_name( + out2in_mapping.first, out_name ); } - model_builder.set_block_name( out2in_mapping.first, out_name ); } }