From 5ae4fd751d7e97e936c74ade70d0c1662ef32108 Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Mon, 13 Jan 2025 18:21:24 -0500 Subject: [PATCH] Make backwards compatible --- src/InputOutput/readers.jl | 40 +++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/src/InputOutput/readers.jl b/src/InputOutput/readers.jl index 82de99bdb2..97d9a3c36d 100644 --- a/src/InputOutput/readers.jl +++ b/src/InputOutput/readers.jl @@ -250,21 +250,35 @@ function read_mesh_new(reader::HDF5Reader, name::AbstractString) if type == "IntervalMesh" domain = read_domain(reader, attrs(group)["domain"]) nelements = attrs(group)["nelements"] - stretch_type = attrs(group)["stretch_type"] - if stretch_type == "Uniform" - return Meshes.IntervalMesh( - domain, - Meshes.Uniform(); - nelems = nelements, - ) + if haskey(attrs(group), "faces_type") + faces_type = attrs(group)["faces_type"] + if faces_type == "Range" + return Meshes.IntervalMesh( + domain, + Meshes.Uniform(), + nelems = nelements, + ) + else + CT = Domains.coordinate_type(domain) + faces = [CT(coords) for coords in attrs(group)["faces"]] + return Meshes.IntervalMesh(domain, faces) + end else stretch_type = attrs(group)["stretch_type"] - stretch_params = attrs(group)["stretch_params"] - CT = Domains.coordinate_type(domain) - stretch = - getproperty(Meshes, Symbol(stretch_type))(stretch_params...) - mesh = Meshes.IntervalMesh(domain, stretch; nelems = nelements) - return mesh + if stretch_type == "Uniform" + return Meshes.IntervalMesh( + domain, + Meshes.Uniform(); + nelems = nelements, + ) + else + stretch_type = attrs(group)["stretch_type"] + stretch_params = attrs(group)["stretch_params"] + CT = Domains.coordinate_type(domain) + stretch = + getproperty(Meshes, Symbol(stretch_type))(stretch_params...) + return Meshes.IntervalMesh(domain, stretch; nelems = nelements) + end end elseif type == "RectilinearMesh" intervalmesh1 = read_mesh(reader, attrs(group)["intervalmesh1"])