From 810cd8ef7aa8d6277f2f742023c6b8a245bb8bb8 Mon Sep 17 00:00:00 2001 From: huiyuxie Date: Tue, 15 Oct 2024 17:17:42 -1000 Subject: [PATCH] Start --- src/solvers/dgmulti/dg.jl | 11 +++++++---- src/solvers/dgmulti/flux_differencing.jl | 6 ------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/solvers/dgmulti/dg.jl b/src/solvers/dgmulti/dg.jl index 2d588c5c79d..293e6499875 100644 --- a/src/solvers/dgmulti/dg.jl +++ b/src/solvers/dgmulti/dg.jl @@ -33,6 +33,11 @@ mul_by_accum!(A::UniformScaling) = MulByAccumUniformScaling() StructArrays.foreachfield(f, args...) end +# Matrix{<:SVector} fallback +@inline function apply_to_each_field(f::F, args::Vararg{Any, N}) where {F, N} + f(args...) +end + # specialize for UniformScaling types: works for either StructArray{SVector} or Matrix{SVector} # solution storage formats. @inline apply_to_each_field(f::MulByUniformScaling, out, x, args...) = copy!(out, x) @@ -138,10 +143,8 @@ end # Allocate nested array type for DGMulti solution storage. function allocate_nested_array(uEltype, nvars, array_dimensions, dg) - # store components as separate arrays, combine via StructArrays - return StructArray{SVector{nvars, uEltype}}(ntuple(_ -> zeros(uEltype, - array_dimensions...), - nvars)) + # store components as separate arrays, combine them into Matrix{SVector} + return zeros(SVector{nvars, uEltype}, array_dimensions...) end function reset_du!(du, dg::DGMulti, other_args...) diff --git a/src/solvers/dgmulti/flux_differencing.jl b/src/solvers/dgmulti/flux_differencing.jl index 88f06607019..aca950ecf2d 100644 --- a/src/solvers/dgmulti/flux_differencing.jl +++ b/src/solvers/dgmulti/flux_differencing.jl @@ -288,12 +288,6 @@ function compute_flux_differencing_SBP_matrices(dg::DGMultiFluxDiffSBP, return Qrst_skew end -# For flux differencing SBP-type approximations, store solutions in Matrix{SVector{nvars}}. -# This results in a slight speedup for `calc_volume_integral!`. -function allocate_nested_array(uEltype, nvars, array_dimensions, dg::DGMultiFluxDiffSBP) - return zeros(SVector{nvars, uEltype}, array_dimensions...) -end - function create_cache(mesh::DGMultiMesh, equations, dg::DGMultiFluxDiffSBP, RealT, uEltype) rd = dg.basis