diff --git a/julia/PolyCube.jl b/julia/PolyCube.jl index b45c925..dc7c971 100644 --- a/julia/PolyCube.jl +++ b/julia/PolyCube.jl @@ -1,9 +1,10 @@ include("tuple_tools.jl") import Combinatorics: powerset +import XXhash: xxh3_64 -Coord = Tuple{Number, Number, Number} - +# since differences fully represent the structure, everything may be faster if we just dump the explicit +# location data and work only on the differences struct PolyCube cubes::Vector{Coord} oriented_difference::Vector{Vector{Coord}} @@ -51,3 +52,7 @@ function generate_children(pcube::PolyCube, n_max::Int) end return Iterators.map(x -> PolyCube(vcat(cubes, x), x), powerset(growth_candidates, 1, allowed_growth)) end + +function hash!(pcube::PolyCube, UInt::h) -> UInt + return xxh3_64(pcube.oriented_differences[1]) +end