diff --git a/include/geode/basic/named_type.hpp b/include/geode/basic/named_type.hpp index 80197e7de..c369c0318 100644 --- a/include/geode/basic/named_type.hpp +++ b/include/geode/basic/named_type.hpp @@ -23,6 +23,8 @@ #pragma once +#include + #include #include @@ -65,6 +67,12 @@ namespace geode return !( operator==( other ) ); } + template < typename H > + friend H AbslHashValue( H h, const NamedType& value ) + { + return H::combine( std::move( h ), value.value_ ); + } + private: template < typename Archive > void serialize( Archive& archive ) diff --git a/include/geode/basic/uuid.hpp b/include/geode/basic/uuid.hpp index 8fc5d8678..1f0c92848 100644 --- a/include/geode/basic/uuid.hpp +++ b/include/geode/basic/uuid.hpp @@ -81,6 +81,8 @@ #include +#include + #include #include @@ -110,6 +112,12 @@ namespace geode [[nodiscard]] std::string string() const; + template < typename H > + friend H AbslHashValue( H h, const uuid &value ) + { + return H::combine( std::move( h ), value.ab, value.cd ); + } + uint64_t ab; uint64_t cd; diff --git a/include/geode/geometry/point.hpp b/include/geode/geometry/point.hpp index adbc1277a..ea71900a4 100644 --- a/include/geode/geometry/point.hpp +++ b/include/geode/geometry/point.hpp @@ -25,6 +25,8 @@ #include +#include + #include #include @@ -80,6 +82,12 @@ namespace geode [[nodiscard]] Point< dimension - 1 > project_point( local_index_t axis_to_remove ) const; + template < typename H > + friend H AbslHashValue( H h, const Point &point ) + { + return H::combine( std::move( h ), point.values_ ); + } + private: friend class bitsery::Access; template < typename Archive > diff --git a/include/geode/mesh/core/graph.hpp b/include/geode/mesh/core/graph.hpp index 68fa6b2d2..2ec4c8d0d 100644 --- a/include/geode/mesh/core/graph.hpp +++ b/include/geode/mesh/core/graph.hpp @@ -27,6 +27,7 @@ #include #include +#include #include @@ -79,6 +80,12 @@ namespace geode template < typename Archive > void serialize( Archive& archive ); + template < typename H > + friend H AbslHashValue( H h, const EdgeVertex& value ) + { + return H::combine( std::move( h ), value.edge_id, value.vertex_id ); + } + /*! * Index of the edge */ diff --git a/include/geode/mesh/core/mesh_element.hpp b/include/geode/mesh/core/mesh_element.hpp index 6b5fcdd6c..b9b024119 100644 --- a/include/geode/mesh/core/mesh_element.hpp +++ b/include/geode/mesh/core/mesh_element.hpp @@ -24,6 +24,7 @@ #pragma once #include +#include #include #include @@ -76,6 +77,13 @@ namespace geode return absl::StrCat( "[", mesh_id.string(), " ", element_id, "]" ); } + template < typename H > + friend H AbslHashValue( H h, const MeshElement& value ) + { + return H::combine( + std::move( h ), value.mesh_id, value.element_id ); + } + uuid mesh_id; index_t element_id{ geode::NO_ID }; }; diff --git a/include/geode/mesh/core/solid_mesh.hpp b/include/geode/mesh/core/solid_mesh.hpp index d7aff794a..c07e540a8 100644 --- a/include/geode/mesh/core/solid_mesh.hpp +++ b/include/geode/mesh/core/solid_mesh.hpp @@ -27,6 +27,7 @@ #include #include +#include #include @@ -87,6 +88,13 @@ namespace geode template < typename Archive > void serialize( Archive& archive ); + template < typename H > + friend H AbslHashValue( H h, const PolyhedronVertex& value ) + { + return H::combine( + std::move( h ), value.polyhedron_id, value.vertex_id ); + } + index_t polyhedron_id{ NO_ID }; local_index_t vertex_id{ NO_LID }; }; @@ -126,6 +134,13 @@ namespace geode template < typename Archive > void serialize( Archive& archive ); + template < typename H > + friend H AbslHashValue( H h, const PolyhedronFacet& value ) + { + return H::combine( + std::move( h ), value.polyhedron_id, value.facet_id ); + } + index_t polyhedron_id{ NO_ID }; local_index_t facet_id{ NO_LID }; }; @@ -165,6 +180,13 @@ namespace geode template < typename Archive > void serialize( Archive& archive ); + template < typename H > + friend H AbslHashValue( H h, const PolyhedronFacetVertex& value ) + { + return H::combine( + std::move( h ), value.polyhedron_facet, value.vertex_id ); + } + PolyhedronFacet polyhedron_facet; local_index_t vertex_id{ NO_LID }; }; @@ -201,6 +223,13 @@ namespace geode template < typename Archive > void serialize( Archive& archive ); + template < typename H > + friend H AbslHashValue( H h, const PolyhedronFacetEdge& value ) + { + return H::combine( + std::move( h ), value.polyhedron_facet, value.edge_id ); + } + PolyhedronFacet polyhedron_facet; local_index_t edge_id{ NO_LID }; }; diff --git a/include/geode/mesh/core/surface_mesh.hpp b/include/geode/mesh/core/surface_mesh.hpp index 0211cfdb0..b6eca1bc3 100644 --- a/include/geode/mesh/core/surface_mesh.hpp +++ b/include/geode/mesh/core/surface_mesh.hpp @@ -26,6 +26,7 @@ #include #include +#include #include @@ -88,6 +89,13 @@ namespace geode template < typename Archive > void serialize( Archive& archive ); + template < typename H > + friend H AbslHashValue( H h, const PolygonVertex& value ) + { + return H::combine( + std::move( h ), value.polygon_id, value.vertex_id ); + } + index_t polygon_id{ NO_ID }; local_index_t vertex_id{ NO_LID }; }; @@ -126,6 +134,13 @@ namespace geode template < typename Archive > void serialize( Archive& archive ); + template < typename H > + friend H AbslHashValue( H h, const PolygonEdge& value ) + { + return H::combine( + std::move( h ), value.polygon_id, value.edge_id ); + } + index_t polygon_id{ NO_ID }; local_index_t edge_id{ NO_LID }; }; diff --git a/include/geode/model/mixin/core/component_type.hpp b/include/geode/model/mixin/core/component_type.hpp index 26750a3e5..8f277f20d 100644 --- a/include/geode/model/mixin/core/component_type.hpp +++ b/include/geode/model/mixin/core/component_type.hpp @@ -23,6 +23,8 @@ #pragma once +#include + #include #include @@ -87,6 +89,12 @@ namespace geode return absl::StrCat( type_.get(), " ", id_.string() ); } + template < typename H > + friend H AbslHashValue( H h, const ComponentID& value ) + { + return H::combine( std::move( h ), value.type_, value.id_ ); + } + private: friend class bitsery::Access; template < typename Archive > diff --git a/include/geode/model/mixin/core/vertex_identifier.hpp b/include/geode/model/mixin/core/vertex_identifier.hpp index ab87983bb..e22428b77 100644 --- a/include/geode/model/mixin/core/vertex_identifier.hpp +++ b/include/geode/model/mixin/core/vertex_identifier.hpp @@ -25,6 +25,7 @@ #include +#include #include #include @@ -64,6 +65,13 @@ namespace geode return absl::StrCat( component_id.string(), " ", vertex ); } + template < typename H > + friend H AbslHashValue( H h, const ComponentMeshVertex& value ) + { + return H::combine( + std::move( h ), value.component_id, value.vertex ); + } + ComponentID component_id; index_t vertex{ NO_ID };