Mercurial > repos > public > sbplib_julia
comparison test/SbpOperators/stencil_set_test.jl @ 1384:851d1e4ab3de
Merge feature/variable_derivatives
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Thu, 08 Jun 2023 15:52:22 +0200 |
| parents | 3bb94ce74697 |
| children | 84dc3b9b449b |
comparison
equal
deleted
inserted
replaced
| 1379:8e59c85a25c0 | 1384:851d1e4ab3de |
|---|---|
| 2 | 2 |
| 3 using TOML | 3 using TOML |
| 4 using Sbplib.SbpOperators | 4 using Sbplib.SbpOperators |
| 5 | 5 |
| 6 import Sbplib.SbpOperators.Stencil | 6 import Sbplib.SbpOperators.Stencil |
| 7 import Sbplib.SbpOperators.NestedStencil | |
| 7 | 8 |
| 8 @testset "readoperator" begin | 9 @testset "readoperator" begin |
| 9 toml_str = """ | 10 toml_str = """ |
| 10 [meta] | 11 [meta] |
| 11 authors = "Ken Mattson" | 12 authors = "Ken Mattson" |
| 168 @test SbpOperators.parse_rational("0.5") == 1//2 | 169 @test SbpOperators.parse_rational("0.5") == 1//2 |
| 169 | 170 |
| 170 @test SbpOperators.parse_rational(2) isa Rational | 171 @test SbpOperators.parse_rational(2) isa Rational |
| 171 @test SbpOperators.parse_rational(2) == 2//1 | 172 @test SbpOperators.parse_rational(2) == 2//1 |
| 172 end | 173 end |
| 174 | |
| 175 @testset "parse_nested_stencil" begin | |
| 176 toml = TOML.parse(""" | |
| 177 s1 = [["1/2", "1/2", "0"],[ "-1/2", "-1", "-1/2"],["0", "1/2", "1/2"]] | |
| 178 s2 = {s = [[ "2", "-1", "0"],[ "-3", "1", "0"],["1", "0", "0"]], c = 1} | |
| 179 s3 = {s = [[ "2", "-1", "0"],[ "-3", "1", "0"],["1", "0", "0"]], c = 2} | |
| 180 """) | |
| 181 | |
| 182 @test parse_nested_stencil(toml["s1"]) == CenteredNestedStencil((1//2, 1//2, 0//1),( -1//2, -1//1, -1//2),(0//1, 1//2, 1//2)) | |
| 183 @test parse_nested_stencil(toml["s2"]) == NestedStencil((2//1, -1//1, 0//1),( -3//1, 1//1, 0//1),(1//1, 0//1, 0//1), center = 1) | |
| 184 @test parse_nested_stencil(toml["s3"]) == NestedStencil((2//1, -1//1, 0//1),( -3//1, 1//1, 0//1),(1//1, 0//1, 0//1), center = 2) | |
| 185 | |
| 186 @test parse_nested_stencil(Float64, toml["s1"]) == CenteredNestedStencil((1/2, 1/2, 0.),( -1/2, -1., -1/2),(0., 1/2, 1/2)) | |
| 187 @test parse_nested_stencil(Int, toml["s2"]) == NestedStencil((2, -1, 0),( -3, 1, 0),(1, 0, 0), center = 1) | |
| 188 end |
