@@ -34,12 +34,7 @@ isdir(outdir) && rm(outdir, recursive = true)
3434 tspan= (0.0 , 0.1 ))
3535 # Ensure that we do not have excessive memory allocations
3636 # (e.g., from type instabilities)
37- let
38- t = sol. t[end ]
39- u_ode = sol. u[end ]
40- du_ode = similar (u_ode)
41- @test (@allocated Trixi. rhs! (du_ode, u_ode, semi, t)) < 1000
42- end
37+ @test_allocations (Trixi. rhs!, semi, sol, 1000 )
4338 end
4439
4540 @trixi_testset " elixir_shallowwater_well_balanced_nonconforming.jl" begin
@@ -61,12 +56,7 @@ isdir(outdir) && rm(outdir, recursive = true)
6156 atol= 1e-10 )
6257 # Ensure that we do not have excessive memory allocations
6358 # (e.g., from type instabilities)
64- let
65- t = sol. t[end ]
66- u_ode = sol. u[end ]
67- du_ode = similar (u_ode)
68- @test (@allocated Trixi. rhs! (du_ode, u_ode, semi, t)) < 1000
69- end
59+ @test_allocations (Trixi. rhs!, semi, sol, 1000 )
7060 end
7161
7262 @trixi_testset " elixir_shallowwater_perturbation_amr.jl" begin
@@ -87,12 +77,7 @@ isdir(outdir) && rm(outdir, recursive = true)
8777 tspan= (0.0 , 0.025 ))
8878 # Ensure that we do not have excessive memory allocations
8979 # (e.g., from type instabilities)
90- let
91- t = sol. t[end ]
92- u_ode = sol. u[end ]
93- du_ode = similar (u_ode)
94- @test (@allocated Trixi. rhs! (du_ode, u_ode, semi, t)) < 1000
95- end
80+ @test_allocations (Trixi. rhs!, semi, sol, 1000 )
9681 end
9782
9883 @trixi_testset " elixir_shallowwater_well_balanced_wet_dry_nonconforming.jl" begin
@@ -114,12 +99,7 @@ isdir(outdir) && rm(outdir, recursive = true)
11499 atol= 1e-10 )
115100 # Ensure that we do not have excessive memory allocations
116101 # (e.g., from type instabilities)
117- let
118- t = sol. t[end ]
119- u_ode = sol. u[end ]
120- du_ode = similar (u_ode)
121- @test (@allocated Trixi. rhs! (du_ode, u_ode, semi, t)) < 1000
122- end
102+ @test_allocations (Trixi. rhs!, semi, sol, 1000 )
123103 end
124104
125105 # Note, these values may change as the functionality of well-balanced mortars
@@ -143,12 +123,7 @@ isdir(outdir) && rm(outdir, recursive = true)
143123 tspan= (0.0 , 0.025 ))
144124 # Ensure that we do not have excessive memory allocations
145125 # (e.g., from type instabilities)
146- let
147- t = sol. t[end ]
148- u_ode = sol. u[end ]
149- du_ode = similar (u_ode)
150- @test (@allocated Trixi. rhs! (du_ode, u_ode, semi, t)) < 1000
151- end
126+ @test_allocations (Trixi. rhs!, semi, sol, 1000 )
152127 end
153128end # SWE
154129
@@ -170,12 +145,7 @@ end # SWE
170145 atol= 1e-10 )
171146 # Ensure that we do not have excessive memory allocations
172147 # (e.g., from type instabilities)
173- let
174- t = sol. t[end ]
175- u_ode = sol. u[end ]
176- du_ode = similar (u_ode)
177- @test (@allocated Trixi. rhs! (du_ode, u_ode, semi, t)) < 1000
178- end
148+ @test_allocations (Trixi. rhs!, semi, sol, 1000 )
179149 end
180150
181151 # Note, these values may change as the functionality of well-balanced mortars
@@ -198,12 +168,7 @@ end # SWE
198168
199169 # Ensure that we do not have excessive memory allocations
200170 # (e.g., from type instabilities)
201- let
202- t = sol. t[end ]
203- u_ode = sol. u[end ]
204- du_ode = similar (u_ode)
205- @test (@allocated Trixi. rhs! (du_ode, u_ode, semi, t)) < 1000
206- end
171+ @test_allocations (Trixi. rhs!, semi, sol, 1000 )
207172 end
208173
209174 # Note, complex example that uses TrixiBottomTopography.jl to approximate
@@ -228,12 +193,7 @@ end # SWE
228193
229194 # Ensure that we do not have excessive memory allocations
230195 # (e.g., from type instabilities)
231- let
232- t = sol. t[end ]
233- u_ode = sol. u[end ]
234- du_ode = similar (u_ode)
235- @test (@allocated Trixi. rhs! (du_ode, u_ode, semi, t)) < 1000
236- end
196+ @test_allocations (Trixi. rhs!, semi, sol, 1000 )
237197 end
238198
239199 @trixi_testset " elixir_shallowwater_multilayer_three_mound_dam_break_amr.jl" begin
@@ -254,12 +214,7 @@ end # SWE
254214
255215 # Ensure that we do not have excessive memory allocations
256216 # (e.g., from type instabilities)
257- let
258- t = sol. t[end ]
259- u_ode = sol. u[end ]
260- du_ode = similar (u_ode)
261- @test (@allocated Trixi. rhs! (du_ode, u_ode, semi, t)) < 1000
262- end
217+ @test_allocations (Trixi. rhs!, semi, sol, 1000 )
263218 end
264219end # MLSWE
265220end # P4estMesh2D
0 commit comments