Skip to content

Commit

Permalink
Store capacity serial tree mesh (#1748)
Browse files Browse the repository at this point in the history
* Store capacity serial tree mesh

* relevant changes

* fmt

* shorten

* move capacity

* Update src/meshes/mesh_io.jl

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

---------

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>
Co-authored-by: Hendrik Ranocha <[email protected]>
  • Loading branch information
3 people authored Nov 28, 2023
1 parent 5c08cf4 commit d7e1f74
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 d7e1f74

Please sign in to comment.