diff src/SbpOperators/stencil.jl @ 894:54e36688dab8 feature/variable_derivatives

Add functions for converting the element type of nested stencils
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 10 Feb 2022 10:57:00 +0100
parents 0be29e65521e
children 004324d7ed35
line wrap: on
line diff
--- a/src/SbpOperators/stencil.jl	Thu Feb 10 10:02:33 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)