comparison test/SbpOperators/stencil_test.jl @ 903:a7f898b1ce1e feature/variable_derivatives

Fix type instability for stencil application when weights and vector didn't match
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 14 Feb 2022 14:28:48 +0100
parents cd6d71781137
children 47f5451cdfc4
comparison
equal deleted inserted replaced
902:7513c5ace0a2 903:a7f898b1ce1e
40 @test Stencil(1,2//2; center = 1) isa Stencil{Rational{Int64}, 2} 40 @test Stencil(1,2//2; center = 1) isa Stencil{Rational{Int64}, 2}
41 end 41 end
42 42
43 @testset "promotion" begin 43 @testset "promotion" begin
44 @test promote(Stencil(1,1;center=1), Stencil(2.,2.;center=2)) == (Stencil(1.,1.;center=1), Stencil(2.,2.;center=2)) 44 @test promote(Stencil(1,1;center=1), Stencil(2.,2.;center=2)) == (Stencil(1.,1.;center=1), Stencil(2.,2.;center=2))
45 end
46
47 @testset "type inference" begin
48 s_int = CenteredStencil(1,2,3)
49 s_float = CenteredStencil(1.,2.,3.)
50 v_int = rand(1:10,10);
51 v_float = rand(10);
52
53 @inferred SbpOperators.apply_stencil(s_int, v_int, 2)
54 @inferred SbpOperators.apply_stencil(s_float, v_float, 2)
55 @inferred SbpOperators.apply_stencil(s_int, v_float, 2)
56 @inferred SbpOperators.apply_stencil(s_float, v_int, 2)
45 end 57 end
46 end 58 end
47 59
48 @testset "NestedStencil" begin 60 @testset "NestedStencil" begin
49 61