Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/stencil.jl @ 887:0be29e65521e feature/variable_derivatives
Add length method for stencils
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 07 Feb 2022 14:34:03 +0100 |
parents | f74189c954d6 |
children | 54e36688dab8 |
comparison
equal
deleted
inserted
replaced
886:0e170dcc6a9e | 887:0be29e65521e |
---|---|
47 """ | 47 """ |
48 function scale(s::Stencil, a) | 48 function scale(s::Stencil, a) |
49 return Stencil(s.range, a.*s.weights) | 49 return Stencil(s.range, a.*s.weights) |
50 end | 50 end |
51 | 51 |
52 Base.eltype(::Stencil{T}) where T = T | 52 Base.eltype(::Stencil{T,N}) where {T,N} = T |
53 Base.length(::Stencil{T,N}) where {T,N} = N | |
53 | 54 |
54 function flip(s::Stencil) | 55 function flip(s::Stencil) |
55 range = (-s.range[2], -s.range[1]) | 56 range = (-s.range[2], -s.range[1]) |
56 return Stencil(range, reverse(s.weights)) | 57 return Stencil(range, reverse(s.weights)) |
57 end | 58 end |