diff benchmark/benchmark_laplace.jl @ 1529:43aaf710463e refactor/equidistant_grid/signature

Change to signature of equidistant_grid to same style as many array methods. See for example Array{T}(undef, dims...), zeros(T, dims...), fill(a, dims...) and more.
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 11 Apr 2024 22:31:04 +0200
parents 2ad2de55061a
children 471a948cd2b2
line wrap: on
line diff
--- a/benchmark/benchmark_laplace.jl	Wed Apr 10 09:01:54 2024 +0200
+++ b/benchmark/benchmark_laplace.jl	Thu Apr 11 22:31:04 2024 +0200
@@ -10,7 +10,7 @@
 
 function benchmark_const_coeff_1d(;N = 100, order = 4)
     stencil_set = read_stencil_set(operator_path; order=order)
-    g = equidistant_grid(N, 0., 1.)
+    g = equidistant_grid(0., 1., N)
     D = second_derivative(g, stencil_set)
     u = rand(size(g)...)
     u_xx = rand(size(g)...)
@@ -25,7 +25,7 @@
 
 function benchmark_var_coeff_1d(;N = 100, order = 4)
     stencil_set = read_stencil_set(operator_path; order=order)
-    g = equidistant_grid(N, 0., 1.)
+    g = equidistant_grid(0., 1., N)
     c = rand(size(g)...)
     c_lz = eval_on(g, x -> 0.5)
     D = second_derivative_variable(g, c, stencil_set)
@@ -49,7 +49,7 @@
 
 function benchmark_const_coeff_2d(;N = 100, order = 4)
     stencil_set = read_stencil_set(operator_path; order=order)
-    g = equidistant_grid((N,N), (0.,0.,),(1.,1.))
+    g = equidistant_grid((0.,0.,),(1.,1.), N, N)
     D = Laplace(g, stencil_set)
     u = rand(size(g)...)
     u_xx = rand(size(g)...)
@@ -71,7 +71,7 @@
 
 function benchmark_var_coeff_2d(;N = 100, order = 4)
     stencil_set = read_stencil_set(operator_path; order=order)
-    g = equidistant_grid((N,N), (0.,0.,),(1.,1.))
+    g = equidistant_grid((0.,0.,),(1.,1.), N, N)
     c = rand(size(g)...)
     c_lz = eval_on(g, x-> 0.5)
     D = second_derivative_variable(g, c, stencil_set, 1) + second_derivative_variable(g, c, stencil_set, 2)
@@ -217,4 +217,4 @@
     for I ∈ @view CartesianIndices(u)[end-clz_sz+1:end,end-clz_sz+1:end]
         u_xx[I] = tm[Index{Upper}(I[1]),Index{Upper}(I[2])]
     end
-end
\ No newline at end of file
+end