Skip to content

Commit

Permalink
Merge branch 'main' into OptionalErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring authored Nov 28, 2023
2 parents be34323 + d7e1f74 commit 278ec96
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/meshes/mesh_io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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(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
Expand Down

0 comments on commit 278ec96

Please sign in to comment.