Skip to content

Commit

Permalink
Added structuresd mesh view to parametric types.
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCan committed Dec 7, 2023
1 parent 6291a67 commit a64bbc2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/callbacks_step/save_solution_dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#! format: noindent

function save_solution_file(u, time, dt, timestep,
mesh::Union{SerialTreeMesh, StructuredMesh,
mesh::Union{SerialTreeMesh, StructuredMesh, StructuredMeshView,
UnstructuredMesh2D, SerialP4estMesh,
SerialT8codeMesh},
equations, dg::DG, cache,
Expand Down
2 changes: 1 addition & 1 deletion src/meshes/mesh_io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ function load_mesh_serial(mesh_file::AbstractString; n_cells_max, RealT)
end
mesh = TreeMesh(SerialTree{ndims}, max(n_cells_max, capacity))
load_mesh!(mesh, mesh_file)
elseif mesh_type == "StructuredMesh"
elseif (mesh_type == "StructuredMesh") || (mesh_type == "StructuredMeshView")
size_, mapping_as_string = h5open(mesh_file, "r") do file
return read(attributes(file)["size"]),
read(attributes(file)["mapping"])
Expand Down
7 changes: 5 additions & 2 deletions src/meshes/structured_mesh_view.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
mutable struct StructuredMeshView{NDIMS, RealT <: Real} <: AbstractMesh{NDIMS}
parent::StructuredMesh{NDIMS, RealT}
mapping::Any # Not relevant for performance
mapping_as_string::String
current_filename::String
index_min::NTuple{NDIMS, Int}
index_max::NTuple{NDIMS, Int}
unsaved_changes::Bool
Expand All @@ -16,8 +18,9 @@ function StructuredMeshView(parent::StructuredMesh{NDIMS, RealT};
@assert all(index_min .> 0)
@assert index_max <= size(parent)

return StructuredMeshView{NDIMS, RealT}(parent, parent.mapping, index_min,
index_max, parent.unsaved_changes)
return StructuredMeshView{NDIMS, RealT}(parent, parent.mapping, parent.mapping_as_string,
parent.current_filename,
index_min, index_max, parent.unsaved_changes)
end

# Check if mesh is periodic
Expand Down

0 comments on commit a64bbc2

Please sign in to comment.