changeset 2064:cd8dee819f6c default tip

Merge bugfix/zero_dim_grid_boundary_ops
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 17 Feb 2026 07:11:13 +0100
parents 377df47849cb (current diff) cd53fb73d4b8 (diff)
children
files
diffstat 4 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/SbpOperators/boundaryops/boundary_restriction.jl	Sat Feb 14 23:37:40 2026 +0100
+++ b/src/SbpOperators/boundaryops/boundary_restriction.jl	Tue Feb 17 07:11:13 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"))
--- a/src/SbpOperators/boundaryops/normal_derivative.jl	Sat Feb 14 23:37:40 2026 +0100
+++ b/src/SbpOperators/boundaryops/normal_derivative.jl	Tue Feb 17 07:11:13 2026 +0100
@@ -28,3 +28,5 @@
     scaled_stencil = scale(closure_stencil,h_inv)
     return BoundaryOperator(g, scaled_stencil, boundary)
 end
+
+normal_derivative(::ZeroDimGrid, stencil_set::StencilSet, boundary) = throw(ArgumentError("ZeroDimGrid has no boundaries"))
--- a/test/SbpOperators/boundaryops/boundary_restriction_test.jl	Sat Feb 14 23:37:40 2026 +0100
+++ b/test/SbpOperators/boundaryops/boundary_restriction_test.jl	Tue Feb 17 07:11:13 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
--- a/test/SbpOperators/boundaryops/normal_derivative_test.jl	Sat Feb 14 23:37:40 2026 +0100
+++ b/test/SbpOperators/boundaryops/normal_derivative_test.jl	Tue Feb 17 07:11:13 2026 +0100
@@ -30,6 +30,11 @@
             @test d_w isa LazyTensor{T,1,2} where T
             @test d_n isa LazyTensor{T,1,2} where T
         end
+
+        @testset "0D" begin
+            g = ZeroDimGrid(1)
+            @test_throws ArgumentError("ZeroDimGrid has no boundaries") normal_derivative(g, stencil_set, ())
+        end
     end
     @testset "Accuracy" begin
         v = eval_on(g_2D, (x,y)-> x^2 + (y-1)^2 + x*y)