Mercurial > repos > public > sbplib_julia
diff src/SbpOperators/stencil.jl @ 826:4433be383840 operator_storage_array_of_table
Add stencil constructor to change the type of the weights along with a convert method
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 21 Dec 2021 16:30:16 +0100 |
parents | 1fc6c4daec44 |
children | 313648b01504 11767fbb29f4 |
line wrap: on
line diff
--- a/src/SbpOperators/stencil.jl Tue Dec 21 16:02:11 2021 +0100 +++ b/src/SbpOperators/stencil.jl Tue Dec 21 16:30:16 2021 +0100 @@ -22,6 +22,12 @@ return Stencil(range, weights) end +function Stencil{T}(s::Stencil) where T + return Stencil(s.range, T.(s.weights)) +end + +Base.convert(::Type{Stencil{T}}, stencil) where T = Stencil{T}(stencil) + function CenteredStencil(weights::Vararg) if iseven(length(weights)) throw(ArgumentError("a centered stencil must have an odd number of weights."))