I’d like to save a triangulation I’ve created using DelaunayTriangulation.jl. I have tried using JLD2 but am unable to. I feel like this should be easy so I’m probably doing something wrong.
using DelaunayTriangulation, JLD2
r = rand(2, 100)
mesh = triangulate(r)
save_object("mesh.jld2", mesh)
The error:
julia> save_object("mesh.jld2", mesh)
ERROR: Type GenericMemory does not have a definite size.
Hi @Varun_V ,
You’re welcome to open an issue at JLD2 for this.
I’ll have a look eventually but not until i submit my phd thesis (8 weeks)…
I assume that you ran your code on Julia v1.11 and that it would work on v1.10
Thanks, I’ve done this here. Good luck with your thesis
1 Like
I don’t know what save_object
does but have you trief jldsave
instead? I never had any issues with jldsave
.
That won’t help. It’s just a different API.
The real issue is that I haven’t had the time to fully update JLD2 to julia v1.11.
(E.g. to handle Memory
appearing in different places)
Most things work just fine on v1.11 but there a few problems like this one.
1 Like
You might have some luck just saving the points
, boundary_nodes
, and triangles
and then using that to reconstruct your triangulation here with this method DelaunayTriangulation.jl/src/data_structures/triangulation/triangulation.jl at da9f582bd6b9f97d218bc5a98199f886b0e13d6b · JuliaGeometry/DelaunayTriangulation.jl · GitHub. i.e.
points = get_points(tri)
boundary_nodes = get_boundary_nodes(tri)
triangles = get_triangles(tri) # might need to be Set(each_solid_triangle(tri)) ? not sure.
# then save
# to reconstruct
Triangulation(points, triangles, boundary_nodes)
(untested code)
If you have no boundary nodes you can refer to the reconstructor below the one I linked