Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store capacity serial tree mesh #1748

Merged
merged 11 commits into from
Nov 28, 2023
7 changes: 4 additions & 3 deletions src/meshes/mesh_io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function save_mesh_file(mesh::TreeMesh, output_directory, timestep,
file["neighbor_ids"] = @view mesh.tree.neighbor_ids[:, 1:n_cells]
file["levels"] = @view mesh.tree.levels[1:n_cells]
file["coordinates"] = @view mesh.tree.coordinates[:, 1:n_cells]
file["capacity"] = mesh.tree.capacity
DanielDoehring marked this conversation as resolved.
Show resolved Hide resolved
end

return filename
Expand Down Expand Up @@ -249,10 +250,10 @@ function load_mesh_serial(mesh_file::AbstractString; n_cells_max, RealT)
end

if mesh_type == "TreeMesh"
n_cells = h5open(mesh_file, "r") do file
return read(attributes(file)["n_cells"])
capacity = h5open(mesh_file, "r") do file
return read(file["capacity"])
DanielDoehring marked this conversation as resolved.
Show resolved Hide resolved
end
mesh = TreeMesh(SerialTree{ndims}, max(n_cells, n_cells_max))
mesh = TreeMesh(SerialTree{ndims}, max(n_cells_max, capacity))
load_mesh!(mesh, mesh_file)
elseif mesh_type == "StructuredMesh"
size_, mapping_as_string = h5open(mesh_file, "r") do file
Expand Down