From 6cd6caa3dd6226c88b16122c86b70358444e4e29 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 8 Nov 2024 14:05:33 +0100 Subject: [PATCH] Similarize Structured1D to Tree1D --- .../elixir_traffic_flow_lwr_greenlight.jl | 4 ++-- src/meshes/structured_mesh.jl | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/structured_1d_dgsem/elixir_traffic_flow_lwr_greenlight.jl b/examples/structured_1d_dgsem/elixir_traffic_flow_lwr_greenlight.jl index e5badf14451..3cb4735e132 100644 --- a/examples/structured_1d_dgsem/elixir_traffic_flow_lwr_greenlight.jl +++ b/examples/structured_1d_dgsem/elixir_traffic_flow_lwr_greenlight.jl @@ -8,8 +8,8 @@ equations = TrafficFlowLWREquations1D() solver = DGSEM(polydeg = 3, surface_flux = FluxHLL(min_max_speed_davis)) -coordinates_min = (-1.0,) # minimum coordinate -coordinates_max = (1.0,) # maximum coordinate +coordinates_min = -1.0 # minimum coordinate +coordinates_max = 1.0 # maximum coordinate cells_per_dimension = (64,) mesh = StructuredMesh(cells_per_dimension, coordinates_min, coordinates_max, diff --git a/src/meshes/structured_mesh.jl b/src/meshes/structured_mesh.jl index 0e4d9a359ca..e30fc705d19 100644 --- a/src/meshes/structured_mesh.jl +++ b/src/meshes/structured_mesh.jl @@ -171,6 +171,11 @@ end function coordinates2mapping(coordinates_min::NTuple{1}, coordinates_max::NTuple{1}) mapping(xi) = linear_interpolate(xi, coordinates_min[1], coordinates_max[1]) end +# Convenience constructor for 1D: Do not insist on tuples +function coordinates2mapping(coordinates_min::RealT, + coordinates_max::RealT) where {RealT <: Real} + mapping(xi) = linear_interpolate(xi, coordinates_min, coordinates_max) +end function coordinates2mapping(coordinates_min::NTuple{2}, coordinates_max::NTuple{2}) function mapping(xi, eta)