diff --git a/src/meshes/mesh_io.jl b/src/meshes/mesh_io.jl index 92e38ce1bf3..337e33e6969 100644 --- a/src/meshes/mesh_io.jl +++ b/src/meshes/mesh_io.jl @@ -30,6 +30,7 @@ function save_mesh_file(mesh::TreeMesh, output_directory, timestep, attributes(file)["mesh_type"] = get_name(mesh) attributes(file)["ndims"] = ndims(mesh) attributes(file)["n_cells"] = n_cells + attributes(file)["capacity"] = mesh.tree.capacity attributes(file)["n_leaf_cells"] = count_leaf_cells(mesh.tree) attributes(file)["minimum_level"] = minimum_level(mesh.tree) attributes(file)["maximum_level"] = maximum_level(mesh.tree) @@ -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(attributes(file)["capacity"]) 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