Mercurial > repos > public > sbplib_julia
changeset 961:775d5513da8f feature/laplace_opset
Review: Fix boundary operator tests according to review comments
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 14 Mar 2022 09:41:23 +0100 |
parents | 6a8d7fbf55fc |
children | 1bb28e47990f |
files | test/SbpOperators/boundaryops/boundary_operator_test.jl test/SbpOperators/boundaryops/boundary_restriction_test.jl test/SbpOperators/boundaryops/normal_derivative_test.jl |
diffstat | 3 files changed, 7 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/test/SbpOperators/boundaryops/boundary_operator_test.jl Mon Mar 14 08:27:54 2022 +0100 +++ b/test/SbpOperators/boundaryops/boundary_operator_test.jl Mon Mar 14 09:41:23 2022 +0100 @@ -32,8 +32,8 @@ @test e_w isa TensorMapping{T,1,2} where T end end - op_l, op_r = map(id -> boundary_operator(g_1D, closure_stencil, id), boundary_identifiers(g_1D)) - op_w, op_e, op_s, op_n = map(id -> boundary_operator(g_2D, closure_stencil, id), boundary_identifiers(g_2D)) + op_l, op_r = boundary_operator.(Ref(g_1D), Ref(closure_stencil), boundary_identifiers(g_1D)) + op_w, op_e, op_s, op_n = boundary_operator.(Ref(g_2D), Ref(closure_stencil), boundary_identifiers(g_2D)) @testset "Sizes" begin @testset "1D" begin
--- a/test/SbpOperators/boundaryops/boundary_restriction_test.jl Mon Mar 14 08:27:54 2022 +0100 +++ b/test/SbpOperators/boundaryops/boundary_restriction_test.jl Mon Mar 14 09:41:23 2022 +0100 @@ -37,10 +37,7 @@ @testset "Application" begin @testset "1D" begin - e_l, e_r = - map(id -> boundary_restriction(g_1D, e_closure, id), boundary_identifiers(g_1D)) - # REVIEW: Same as normal_derivative:45 - + e_l, e_r = boundary_restriction.(Ref(g_1D), Ref(e_closure), boundary_identifiers(g_1D)) v = evalOn(g_1D,x->1+x^2) u = fill(3.124) @@ -50,10 +47,7 @@ end @testset "2D" begin - e_w, e_e, e_s, e_n = - map(id -> boundary_restriction(g_2D, e_closure, id), boundary_identifiers(g_2D)) - # REVIEW: Same as normal_derivative:45 - + e_w, e_e, e_s, e_n = boundary_restriction.(Ref(g_2D), Ref(e_closure), boundary_identifiers(g_2D)) v = rand(11, 15) u = fill(3.124)
--- a/test/SbpOperators/boundaryops/normal_derivative_test.jl Mon Mar 14 08:27:54 2022 +0100 +++ b/test/SbpOperators/boundaryops/normal_derivative_test.jl Mon Mar 14 09:41:23 2022 +0100 @@ -40,11 +40,7 @@ @testset "2nd order" begin stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order=2) d_closure = parse_stencil(stencil_set["d1"]["closure"]) - d_w, d_e, d_s, d_n = - map(id -> normal_derivative(g_2D, d_closure, id), boundary_identifiers(g_2D)) - # REVIEW: Would prefere to write this as - # d_w, d_e, d_s, d_n = normal_derivative.(Ref(g_2D), Ref(d_closure), boundary_identifiers(g_2D)) - # to avoid the line break + d_w, d_e, d_s, d_n = normal_derivative.(Ref(g_2D), Ref(d_closure), boundary_identifiers(g_2D)) @test d_w*v ≈ -v∂x[1,:] atol = 1e-13 @test d_e*v ≈ v∂x[end,:] atol = 1e-13 @@ -55,9 +51,8 @@ @testset "4th order" begin stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order=4) d_closure = parse_stencil(stencil_set["d1"]["closure"]) - d_w, d_e, d_s, d_n = - map(id -> normal_derivative(g_2D, d_closure, id), boundary_identifiers(g_2D)) - # REVIEW: Same as above + d_w, d_e, d_s, d_n = normal_derivative.(Ref(g_2D), Ref(d_closure), boundary_identifiers(g_2D)) + @test d_w*v ≈ -v∂x[1,:] atol = 1e-13 @test d_e*v ≈ v∂x[end,:] atol = 1e-13 @test d_s*v ≈ -v∂y[:,1] atol = 1e-13