changeset 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 07315bc72b31
children 0e93fc7fb2e2
files src/SbpOperators/boundaryops/boundary_restriction.jl test/SbpOperators/boundaryops/boundary_restriction_test.jl
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
diff -r 07315bc72b31 -r 5fb64e42138c src/SbpOperators/boundaryops/boundary_restriction.jl
--- a/src/SbpOperators/boundaryops/boundary_restriction.jl	Thu Feb 05 22:20:55 2026 +0100
+++ b/src/SbpOperators/boundaryops/boundary_restriction.jl	Thu Feb 05 22:22:25 2026 +0100
@@ -25,3 +25,5 @@
     converted_stencil = convert(Stencil{eltype(g)}, closure_stencil)
     return BoundaryOperator(g, converted_stencil, boundary)
 end
+
+boundary_restriction(::ZeroDimGrid, stencil_set::StencilSet, boundary) = throw(ArgumentError("ZeroDimGrid has no boundaries"))
diff -r 07315bc72b31 -r 5fb64e42138c test/SbpOperators/boundaryops/boundary_restriction_test.jl
--- a/test/SbpOperators/boundaryops/boundary_restriction_test.jl	Thu Feb 05 22:20:55 2026 +0100
+++ b/test/SbpOperators/boundaryops/boundary_restriction_test.jl	Thu Feb 05 22:22:25 2026 +0100
@@ -6,6 +6,7 @@
 using Diffinitive.RegionIndices
 using Diffinitive.SbpOperators: BoundaryOperator, Stencil
 
+
 @testset "boundary_restriction" begin
 	stencil_set = read_stencil_set(sbp_operators_path()*"standard_diagonal.toml"; order = 4)
 	e_closure = parse_stencil(stencil_set["e"]["closure"])
@@ -30,6 +31,11 @@
             @test e_w isa InflatedTensor
             @test e_w isa LazyTensor{T,1,2} where T
         end
+
+        @testset "0D" begin
+            g = ZeroDimGrid(1)
+            @test_throws ArgumentError("ZeroDimGrid has no boundaries") boundary_restriction(g, stencil_set, ())
+        end
     end
 
     @testset "Application" begin