comparison test/SbpOperators/boundaryops/boundary_restriction_test.jl @ 2042:5fb64e42138c bugfix/zero_dim_grid_boundary_ops

Add implementation of boundary_restriction for ZeroDimGrid throwing an error
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 05 Feb 2026 22:22:25 +0100
parents 471a948cd2b2
children c08bc343d1cd
comparison
equal deleted inserted replaced
2041:07315bc72b31 2042:5fb64e42138c
3 using Diffinitive.SbpOperators 3 using Diffinitive.SbpOperators
4 using Diffinitive.Grids 4 using Diffinitive.Grids
5 using Diffinitive.LazyTensors 5 using Diffinitive.LazyTensors
6 using Diffinitive.RegionIndices 6 using Diffinitive.RegionIndices
7 using Diffinitive.SbpOperators: BoundaryOperator, Stencil 7 using Diffinitive.SbpOperators: BoundaryOperator, Stencil
8
8 9
9 @testset "boundary_restriction" begin 10 @testset "boundary_restriction" begin
10 stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order = 4) 11 stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order = 4)
11 e_closure = parse_stencil(stencil_set["e"]["closure"]) 12 e_closure = parse_stencil(stencil_set["e"]["closure"])
12 g_1D = equidistant_grid(0.0, 1.0, 11) 13 g_1D = equidistant_grid(0.0, 1.0, 11)
27 28
28 @testset "2D" begin 29 @testset "2D" begin
29 e_w = boundary_restriction(g_2D,stencil_set,CartesianBoundary{1,UpperBoundary}()) 30 e_w = boundary_restriction(g_2D,stencil_set,CartesianBoundary{1,UpperBoundary}())
30 @test e_w isa InflatedTensor 31 @test e_w isa InflatedTensor
31 @test e_w isa LazyTensor{T,1,2} where T 32 @test e_w isa LazyTensor{T,1,2} where T
33 end
34
35 @testset "0D" begin
36 g = ZeroDimGrid(1)
37 @test_throws ArgumentError("ZeroDimGrid has no boundaries") boundary_restriction(g, stencil_set, ())
32 end 38 end
33 end 39 end
34 40
35 @testset "Application" begin 41 @testset "Application" begin
36 @testset "1D" begin 42 @testset "1D" begin