Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring committed Nov 21, 2023
1 parent 14ff1cc commit e74ded2
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/meshes/mesh_io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ function load_mesh_serial(mesh_file::AbstractString; n_cells_max, RealT)
elseif mesh_type == "StructuredMesh"
size_, mapping_as_string = h5open(mesh_file, "r") do file
return read(attributes(file)["size"]),
read(attributes(file)["mapping"])
read(attributes(file)["mapping"])
end

size = Tuple(size_)
Expand Down Expand Up @@ -291,23 +291,23 @@ function load_mesh_serial(mesh_file::AbstractString; n_cells_max, RealT)
end

mesh = StructuredMesh(size, mapping; RealT = RealT, unsaved_changes = false,
mapping_as_string = mapping_as_string)
mapping_as_string = mapping_as_string)
mesh.current_filename = mesh_file
elseif mesh_type == "UnstructuredMesh2D"
mesh_filename, periodicity_ = h5open(mesh_file, "r") do file
return read(attributes(file)["mesh_filename"]),
read(attributes(file)["periodicity"])
read(attributes(file)["periodicity"])
end
mesh = UnstructuredMesh2D(mesh_filename; RealT = RealT,
periodicity = periodicity_,
unsaved_changes = false)
periodicity = periodicity_,
unsaved_changes = false)
elseif mesh_type == "P4estMesh"
p4est_filename, tree_node_coordinates,
nodes, boundary_names_ = h5open(mesh_file, "r") do file
return read(attributes(file)["p4est_file"]),
read(file["tree_node_coordinates"]),
read(file["nodes"]),
read(file["boundary_names"])
read(file["tree_node_coordinates"]),
read(file["nodes"]),
read(file["boundary_names"])
end

boundary_names = boundary_names_ .|> Symbol
Expand Down Expand Up @@ -357,7 +357,7 @@ function load_mesh_parallel(mesh_file::AbstractString; n_cells_max, RealT)
if mpi_isroot()
ndims_, mesh_type = h5open(mesh_file, "r") do file
return read(attributes(file)["ndims"]),
read(attributes(file)["mesh_type"])
read(attributes(file)["mesh_type"])
end
MPI.Bcast!(Ref(ndims_), mpi_root(), mpi_comm())
MPI.bcast(mesh_type, mpi_root(), mpi_comm())
Expand Down Expand Up @@ -385,9 +385,9 @@ function load_mesh_parallel(mesh_file::AbstractString; n_cells_max, RealT)
p4est_filename, tree_node_coordinates,
nodes, boundary_names_ = h5open(mesh_file, "r") do file
return read(attributes(file)["p4est_file"]),
read(file["tree_node_coordinates"]),
read(file["nodes"]),
read(file["boundary_names"])
read(file["tree_node_coordinates"]),
read(file["nodes"]),
read(file["boundary_names"])
end

boundary_names = boundary_names_ .|> Symbol
Expand All @@ -407,7 +407,7 @@ function load_mesh_parallel(mesh_file::AbstractString; n_cells_max, RealT)
p4est = load_p4est(p4est_file, Val(ndims_))

mesh = P4estMesh{ndims_}(p4est, tree_node_coordinates,
nodes, boundary_names, "", false, true)
nodes, boundary_names, "", false, true)
else
error("Unknown mesh type!")
end
Expand Down Expand Up @@ -443,19 +443,19 @@ function load_mesh!(mesh::ParallelTreeMesh, mesh_file::AbstractString)
@views MPI.Bcast!(mesh.tree.parent_ids[1:n_cells], mpi_root(), mpi_comm())
@views MPI.Bcast!(mesh.tree.child_ids[:, 1:n_cells], mpi_root(), mpi_comm())
@views MPI.Bcast!(mesh.tree.neighbor_ids[:, 1:n_cells], mpi_root(),
mpi_comm())
mpi_comm())
@views MPI.Bcast!(mesh.tree.levels[1:n_cells], mpi_root(), mpi_comm())
@views MPI.Bcast!(mesh.tree.coordinates[:, 1:n_cells], mpi_root(),
mpi_comm())
mpi_comm())
end
else # non-root ranks
# Set domain information
mesh.tree.center_level_0 = MPI.Bcast!(collect(mesh.tree.center_level_0),
mpi_root(), mpi_comm())
mpi_root(), mpi_comm())
mesh.tree.length_level_0 = MPI.Bcast!(collect(mesh.tree.length_level_0),
mpi_root(), mpi_comm())[1]
mpi_root(), mpi_comm())[1]
mesh.tree.periodicity = Tuple(MPI.Bcast!(collect(mesh.tree.periodicity),
mpi_root(), mpi_comm()))
mpi_root(), mpi_comm()))

# Set length
n_cells = MPI.Bcast!(Ref(0), mpi_root(), mpi_comm())[]
Expand Down

0 comments on commit e74ded2

Please sign in to comment.