Mercurial > repos > public > sbplib_julia
diff src/SbpOperators/stencil.jl @ 1058:c4f71d6f2d63 feature/nested_stencils
Add functions for converting the element type of nested stencils
(grafted from 54e36688dab85d935058d31c82f9ec00f03637ff)
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 10 Feb 2022 10:57:00 +0100 |
parents | 0728e84af0dc |
children | 004324d7ed35 |
line wrap: on
line diff
--- a/src/SbpOperators/stencil.jl Mon Feb 07 14:34:03 2022 +0100 +++ b/src/SbpOperators/stencil.jl Thu Feb 10 10:57:00 2022 +0100 @@ -102,6 +102,14 @@ return CenteredNestedStencil(inner_stencils...) end + +# Conversion +function NestedStencil{T}(ns::NestedStencil) where T + return NestedStencil(Stencil{Stencil{T}}(ns.s)) +end + +Base.convert(::Type{NestedStencil{T}}, stencil) where T = NestedStencil{T}(stencil) + Base.eltype(::NestedStencil{T}) where T = T function flip(ns::NestedStencil)