comparison test/SbpOperators/boundaryops/boundary_restriction_test.jl @ 1829:871f3f1decea refactor/grids/iterable_boundary_indices

Merge default
author Jonatan Werpers <jonatan@werpers.com>
date Sun, 20 Oct 2024 21:38:09 +0200
parents 471a948cd2b2
children f3d7e2d7a43f
comparison
equal deleted inserted replaced
1828:8adecef380b4 1829:871f3f1decea
1 using Test 1 using Test
2 2
3 using Sbplib.SbpOperators 3 using Diffinitive.SbpOperators
4 using Sbplib.Grids 4 using Diffinitive.Grids
5 using Sbplib.LazyTensors 5 using Diffinitive.LazyTensors
6 using Sbplib.RegionIndices 6 using Diffinitive.RegionIndices
7 using Sbplib.SbpOperators: BoundaryOperator, Stencil 7 using Diffinitive.SbpOperators: BoundaryOperator, Stencil
8 8
9 @testset "boundary_restriction" begin 9 @testset "boundary_restriction" begin
10 stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order = 4) 10 stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order = 4)
11 e_closure = parse_stencil(stencil_set["e"]["closure"]) 11 e_closure = parse_stencil(stencil_set["e"]["closure"])
12 g_1D = equidistant_grid(0.0, 1.0, 11) 12 g_1D = equidistant_grid(0.0, 1.0, 11)
13 g_2D = equidistant_grid((0.0, 0.0), (1.0,1.0), 11, 15) 13 g_2D = equidistant_grid((0.0, 0.0), (1.0,1.0), 11, 15)
14 14
15 @testset "boundary_restriction" begin 15 @testset "boundary_restriction" begin
16 @testset "1D" begin 16 @testset "1D" begin
17 e_l = boundary_restriction(g_1D,stencil_set,Lower()) 17 e_l = boundary_restriction(g_1D,stencil_set,LowerBoundary())
18 @test e_l == BoundaryOperator(g_1D,Stencil{Float64}(e_closure),Lower()) 18 @test e_l == BoundaryOperator(g_1D,Stencil{Float64}(e_closure),LowerBoundary())
19 @test e_l isa BoundaryOperator{T,Lower} where T 19 @test e_l isa BoundaryOperator{T,LowerBoundary} where T
20 @test e_l isa LazyTensor{T,0,1} where T 20 @test e_l isa LazyTensor{T,0,1} where T
21 21
22 e_r = boundary_restriction(g_1D,stencil_set,Upper()) 22 e_r = boundary_restriction(g_1D,stencil_set,UpperBoundary())
23 @test e_r == BoundaryOperator(g_1D,Stencil{Float64}(e_closure),Upper()) 23 @test e_r == BoundaryOperator(g_1D,Stencil{Float64}(e_closure),UpperBoundary())
24 @test e_r isa BoundaryOperator{T,Upper} where T 24 @test e_r isa BoundaryOperator{T,UpperBoundary} where T
25 @test e_r isa LazyTensor{T,0,1} where T 25 @test e_r isa LazyTensor{T,0,1} where T
26 end 26 end
27 27
28 @testset "2D" begin 28 @testset "2D" begin
29 e_w = boundary_restriction(g_2D,stencil_set,CartesianBoundary{1,Upper}()) 29 e_w = boundary_restriction(g_2D,stencil_set,CartesianBoundary{1,UpperBoundary}())
30 @test e_w isa InflatedTensor 30 @test e_w isa InflatedTensor
31 @test e_w isa LazyTensor{T,1,2} where T 31 @test e_w isa LazyTensor{T,1,2} where T
32 end 32 end
33 end 33 end
34 34