Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/volumeops/derivatives/first_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 |
|---|---|
| 12 first_derivative(g::TensorGrid, stencil_set, direction) | 12 first_derivative(g::TensorGrid, stencil_set, direction) |
| 13 | 13 |
| 14 See also: [`VolumeOperator`](@ref), [`LazyTensors.inflate`](@ref). | 14 See also: [`VolumeOperator`](@ref), [`LazyTensors.inflate`](@ref). |
| 15 """ | 15 """ |
| 16 function first_derivative(g::TensorGrid, stencil_set, direction) | 16 function first_derivative(g::TensorGrid, stencil_set, direction) |
| 17 if direction ∉ Interval(0, ndims(g)) | 17 if direction ∉ 1:ndims(g) |
| 18 throw(DomainError(direction, "Direction must be inside [0, $(ndims(g))].")) | 18 throw(DomainError(direction, "Direction must be inside [0, $(ndims(g))].")) |
| 19 end | 19 end |
| 20 D₁ = first_derivative(g.grids[direction], stencil_set) | 20 D₁ = first_derivative(g.grids[direction], stencil_set) |
| 21 return LazyTensors.inflate(D₁, size(g), direction) | 21 return LazyTensors.inflate(D₁, size(g), direction) |
| 22 end | 22 end |
