From a64bbc2ce7a39d4dfb1ea0cd0ad9a2cfd0b5a8d5 Mon Sep 17 00:00:00 2001 From: SimonCan Date: Thu, 7 Dec 2023 22:45:02 +0000 Subject: [PATCH] Added structuresd mesh view to parametric types. --- src/callbacks_step/save_solution_dg.jl | 2 +- src/meshes/mesh_io.jl | 2 +- src/meshes/structured_mesh_view.jl | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/callbacks_step/save_solution_dg.jl b/src/callbacks_step/save_solution_dg.jl index 350aee7336a..26effed85a4 100644 --- a/src/callbacks_step/save_solution_dg.jl +++ b/src/callbacks_step/save_solution_dg.jl @@ -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, diff --git a/src/meshes/mesh_io.jl b/src/meshes/mesh_io.jl index 1a6ae472689..9bfb759039c 100644 --- a/src/meshes/mesh_io.jl +++ b/src/meshes/mesh_io.jl @@ -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"]) diff --git a/src/meshes/structured_mesh_view.jl b/src/meshes/structured_mesh_view.jl index a81e1855991..da8991892c6 100644 --- a/src/meshes/structured_mesh_view.jl +++ b/src/meshes/structured_mesh_view.jl @@ -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 @@ -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