Mercurial > repos > public > sbplib_julia
comparison test/SbpOperators/stencil_test.jl @ 867:313648b01504 feature/variable_derivatives
Start implementing nested stencils
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 19 Jan 2022 21:49:34 +0100 |
parents | 4433be383840 |
children | e37ee63bf9ac |
comparison
equal
deleted
inserted
replaced
864:9a2776352c2a | 867:313648b01504 |
---|---|
1 using Test | 1 using Test |
2 using Sbplib.SbpOperators | 2 using Sbplib.SbpOperators |
3 import Sbplib.SbpOperators.Stencil | 3 import Sbplib.SbpOperators.Stencil |
4 import Sbplib.SbpOperators.NestedStencil | |
5 import Sbplib.SbpOperators.scale | |
4 | 6 |
5 @testset "Stencil" begin | 7 @testset "Stencil" begin |
6 s = Stencil((-2,2), (1.,2.,2.,3.,4.)) | 8 s = Stencil((-2,2), (1.,2.,2.,3.,4.)) |
7 @test s isa Stencil{Float64, 5} | 9 @test s isa Stencil{Float64, 5} |
8 | 10 |
27 @test convert(Stencil{Float64}, CenteredStencil(1,2,3,4,5)) == CenteredStencil(1.,2.,3.,4.,5.) | 29 @test convert(Stencil{Float64}, CenteredStencil(1,2,3,4,5)) == CenteredStencil(1.,2.,3.,4.,5.) |
28 @test convert(Stencil{Int}, Stencil(1.,2.,3.,4.,5.; center=2)) == Stencil(1,2,3,4,5; center=2) | 30 @test convert(Stencil{Int}, Stencil(1.,2.,3.,4.,5.; center=2)) == Stencil(1,2,3,4,5; center=2) |
29 @test convert(Stencil{Rational}, Stencil(1.,2.,3.,4.,5.; center=2)) == Stencil(1//1,2//1,3//1,4//1,5//1; center=2) | 31 @test convert(Stencil{Rational}, Stencil(1.,2.,3.,4.,5.; center=2)) == Stencil(1//1,2//1,3//1,4//1,5//1; center=2) |
30 end | 32 end |
31 end | 33 end |
34 | |
35 @testset "NestedStencil" begin | |
36 | |
37 @testset "Constructors" begin | |
38 s1 = Stencil(-1, 1, 0; center = 1) | |
39 s2 = Stencil(-1, 0, 1; center = 2) | |
40 s3 = Stencil( 0,-1, 1; center = 3) | |
41 | |
42 ns = NestedStencil(CenteredStencil(s1,s2,s3)) | |
43 @test ns isa NestedStencil{Int,3} | |
44 | |
45 @test CenteredNestedStencil(s1,s2,s3) == ns | |
46 | |
47 @test NestedStencil(s1,s2,s3, center = 2) == ns | |
48 @test NestedStencil(s1,s2,s3, center = 1) == NestedStencil(Stencil(s1,s2,s3, center=1)) | |
49 | |
50 @test NestedStencil((-1,1,0),(-1,0,1),(0,-1,1), center=2) == ns | |
51 | |
52 | |
53 @testset "Error handling" begin | |
54 | |
55 end | |
56 end | |
57 end |