Mercurial > repos > public > sbplib_julia
changeset 1445:76a121ee7b80 bugfix/sbp_operators/stencil_return_type
Add tests for apply with NestedStencils and differing types in the stencils and arrays
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 24 Nov 2023 21:23:41 +0100 |
parents | c779af4d02e5 |
children | d744b01be520 |
files | test/SbpOperators/stencil_test.jl |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/test/SbpOperators/stencil_test.jl Fri Nov 24 21:04:22 2023 +0100 +++ b/test/SbpOperators/stencil_test.jl Fri Nov 24 21:23:41 2023 +0100 @@ -181,6 +181,18 @@ @test SbpOperators.apply_stencil(ns, c, v, 4) == 5*7 + 11*11 + 6*13 @test SbpOperators.apply_stencil_backwards(ns, c, v, 4) == -3*3 - 7*5 - 4*7 + + # Different types in vector and stencil + ns = NestedStencil((-1.,1.,0.),(-1.,0.,1.),(0.,-2.,2.), center=2) + @test SbpOperators.apply_inner_stencils(ns, c, 4) isa Stencil{Float64, 3} + @test SbpOperators.apply_inner_stencils(ns, c, 4) == Stencil(4.,9.,10.; center=2) + @test SbpOperators.apply_inner_stencils_backwards(ns, c, 4) isa Stencil{Float64, 3} + @test SbpOperators.apply_inner_stencils_backwards(ns, c, 4) == Stencil(-5.,-9.,-8.; center=2) + + @test SbpOperators.apply_stencil(ns, c, v, 4) isa Float64 + @test SbpOperators.apply_stencil(ns, c, v, 4) == 193. + @test SbpOperators.apply_stencil_backwards(ns, c, v, 4) isa Float64 + @test SbpOperators.apply_stencil_backwards(ns, c, v, 4) == -158. end @testset "type stability" begin