comparison src/SbpOperators/volumeops/derivatives/second_derivative.jl @ 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 0f949681d3d3
children 1bc63fa55145
comparison
equal deleted inserted replaced
2087:ebf0c1686eba 2088:438dc7664c1f
8 dimension specified by `direction`. 8 dimension specified by `direction`.
9 9
10 See also: [`VolumeOperator`](@ref), [`LazyTensors.inflate`](@ref). 10 See also: [`VolumeOperator`](@ref), [`LazyTensors.inflate`](@ref).
11 """ 11 """
12 function second_derivative(g::TensorGrid, stencil_set, direction) 12 function second_derivative(g::TensorGrid, stencil_set, direction)
13 if direction ∉ Interval(0, ndims(g)) 13 if direction ∉ 1:ndims(g)
14 throw(DomainError(direction, "Direction must be inside [0, $(ndims(g))].")) 14 throw(DomainError(direction, "Direction must be inside [0, $(ndims(g))]."))
15 end 15 end
16 D₂ = second_derivative(g.grids[direction], stencil_set) 16 D₂ = second_derivative(g.grids[direction], stencil_set)
17 return LazyTensors.inflate(D₂, size(g), direction) 17 return LazyTensors.inflate(D₂, size(g), direction)
18 end 18 end