Mercurial > repos > public > sbplib_julia
diff src/SbpOperators/stencil.jl @ 615:52749b687a67
Merge in refactor/toml_operator_format
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 06 Dec 2020 10:53:15 +0100 |
parents | 03ef4d4740ab |
children | e14627e79a54 |
line wrap: on
line diff
--- a/src/SbpOperators/stencil.jl Wed Dec 02 09:35:14 2020 +0100 +++ b/src/SbpOperators/stencil.jl Sun Dec 06 10:53:15 2020 +0100 @@ -9,6 +9,18 @@ end """ + Stencil(weights::NTuple; center::Int) + +Create a stencil with the given weights with element `center` as the center of the stencil. +""" +function Stencil(weights::NTuple; center::Int) + N = length(weights) + range = (1, N) .- center + + return Stencil(range, weights) +end + +""" scale(s::Stencil, a) Scale the weights of the stencil `s` with `a` and return a new stencil.