Skip to content

Commit 9b51a54

Browse files
Correct dispatch for create_cache of mortars (#2520)
* Fix `create_cache` for mortars * move to tree * fix * fix * fmt * old * cache
1 parent 3082d8a commit 9b51a54

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

src/solvers/dgsem_tree/dg_2d.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ end
8989

9090
# The methods below are specialized on the mortar type
9191
# and called from the basic `create_cache` method at the top.
92-
function create_cache(mesh::Union{TreeMesh{2}, StructuredMesh{2}, UnstructuredMesh2D,
93-
P4estMesh{2}, P4estMeshView{2}, T8codeMesh{2}},
94-
equations, mortar_l2::LobattoLegendreMortarL2, uEltype)
92+
function create_cache(mesh::TreeMesh{2}, equations,
93+
mortar_l2::LobattoLegendreMortarL2, uEltype)
9594
# TODO: Taal performance using different types
96-
MA2d = MArray{Tuple{nvariables(equations), nnodes(mortar_l2)}, uEltype, 2,
95+
MA2d = MArray{Tuple{nvariables(equations), nnodes(mortar_l2)},
96+
uEltype, 2,
9797
nvariables(equations) * nnodes(mortar_l2)}
9898
fstar_primary_upper_threaded = MA2d[MA2d(undef) for _ in 1:Threads.nthreads()]
9999
fstar_primary_lower_threaded = MA2d[MA2d(undef) for _ in 1:Threads.nthreads()]
@@ -104,8 +104,10 @@ function create_cache(mesh::Union{TreeMesh{2}, StructuredMesh{2}, UnstructuredMe
104104
# fstar_upper_threaded = [A2d(undef, nvariables(equations), nnodes(mortar_l2)) for _ in 1:Threads.nthreads()]
105105
# fstar_lower_threaded = [A2d(undef, nvariables(equations), nnodes(mortar_l2)) for _ in 1:Threads.nthreads()]
106106

107-
(; fstar_primary_upper_threaded, fstar_primary_lower_threaded,
108-
fstar_secondary_upper_threaded, fstar_secondary_lower_threaded)
107+
cache = (; fstar_primary_upper_threaded, fstar_primary_lower_threaded,
108+
fstar_secondary_upper_threaded, fstar_secondary_lower_threaded)
109+
110+
return cache
109111
end
110112

111113
# TODO: Taal discuss/refactor timer, allowing users to pass a custom timer?

src/solvers/dgsem_tree/dg_3d.jl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,8 @@ end
110110

111111
# The methods below are specialized on the mortar type
112112
# and called from the basic `create_cache` method at the top.
113-
function create_cache(mesh::Union{TreeMesh{3}, StructuredMesh{3}, P4estMesh{3},
114-
T8codeMesh{3}},
115-
equations, mortar_l2::LobattoLegendreMortarL2, uEltype)
113+
function create_cache(mesh::TreeMesh{3}, equations,
114+
mortar_l2::LobattoLegendreMortarL2, uEltype)
116115
# TODO: Taal compare performance of different types
117116
A3d = Array{uEltype, 3}
118117
fstar_primary_upper_left_threaded = A3d[A3d(undef, nvariables(equations),
@@ -149,11 +148,13 @@ function create_cache(mesh::Union{TreeMesh{3}, StructuredMesh{3}, P4estMesh{3},
149148
nnodes(mortar_l2))
150149
for _ in 1:Threads.nthreads()]
151150

152-
(; fstar_primary_upper_left_threaded, fstar_primary_upper_right_threaded,
153-
fstar_primary_lower_left_threaded, fstar_primary_lower_right_threaded,
154-
fstar_secondary_upper_left_threaded, fstar_secondary_upper_right_threaded,
155-
fstar_secondary_lower_left_threaded, fstar_secondary_lower_right_threaded,
156-
fstar_tmp1_threaded)
151+
cache = (; fstar_primary_upper_left_threaded, fstar_primary_upper_right_threaded,
152+
fstar_primary_lower_left_threaded, fstar_primary_lower_right_threaded,
153+
fstar_secondary_upper_left_threaded, fstar_secondary_upper_right_threaded,
154+
fstar_secondary_lower_left_threaded, fstar_secondary_lower_right_threaded,
155+
fstar_tmp1_threaded)
156+
157+
return cache
157158
end
158159

159160
# TODO: Taal discuss/refactor timer, allowing users to pass a custom timer?

0 commit comments

Comments
 (0)