changeset 2088:438dc7664c1f refactor/sbp_operators/direction_check

Change direction check to use a range
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 02 Mar 2026 14:06:41 +0100
parents ebf0c1686eba
children 1bc63fa55145
files src/SbpOperators/volumeops/derivatives/first_derivative.jl src/SbpOperators/volumeops/derivatives/second_derivative.jl src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl
diffstat 3 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/SbpOperators/volumeops/derivatives/first_derivative.jl	Mon Mar 02 13:52:39 2026 +0100
+++ b/src/SbpOperators/volumeops/derivatives/first_derivative.jl	Mon Mar 02 14:06:41 2026 +0100
@@ -14,7 +14,7 @@
 See also: [`VolumeOperator`](@ref), [`LazyTensors.inflate`](@ref).
 """
 function first_derivative(g::TensorGrid, stencil_set, direction)
-    if direction ∉ Interval(0, ndims(g))
+    if direction ∉ 1:ndims(g)
         throw(DomainError(direction, "Direction must be inside [0, $(ndims(g))]."))
     end
     D₁ = first_derivative(g.grids[direction], stencil_set)
--- a/src/SbpOperators/volumeops/derivatives/second_derivative.jl	Mon Mar 02 13:52:39 2026 +0100
+++ b/src/SbpOperators/volumeops/derivatives/second_derivative.jl	Mon Mar 02 14:06:41 2026 +0100
@@ -10,7 +10,7 @@
 See also: [`VolumeOperator`](@ref), [`LazyTensors.inflate`](@ref).
 """
 function second_derivative(g::TensorGrid, stencil_set, direction)
-    if direction ∉ Interval(0, ndims(g))
+    if direction ∉ 1:ndims(g)
         throw(DomainError(direction, "Direction must be inside [0, $(ndims(g))]."))
     end
     D₂ = second_derivative(g.grids[direction], stencil_set)
--- a/src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl	Mon Mar 02 13:52:39 2026 +0100
+++ b/src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl	Mon Mar 02 14:06:41 2026 +0100
@@ -10,7 +10,7 @@
 function second_derivative_variable end
 
 function second_derivative_variable(g::TensorGrid, coeff, stencil_set, direction::Int)
-    if direction ∉ Interval(0, ndims(g))
+    if direction ∉ 1:ndims(g)
         throw(DomainError(direction, "Direction must be inside [0, $(ndims(g))]."))
     end
     inner_stencil    = parse_nested_stencil(eltype(coeff), stencil_set["D2variable"]["inner_stencil"])