diff src/SbpOperators/stencil.jl @ 896:004324d7ed35 feature/variable_derivatives

Add scale method for nested stencils
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 10 Feb 2022 11:26:28 +0100
parents 54e36688dab8
children 737cd68318c7
line wrap: on
line diff
--- a/src/SbpOperators/stencil.jl	Thu Feb 10 11:08:39 2022 +0100
+++ b/src/SbpOperators/stencil.jl	Thu Feb 10 11:26:28 2022 +0100
@@ -112,6 +112,13 @@
 
 Base.eltype(::NestedStencil{T}) where T = T
 
+function scale(ns::NestedStencil, a)
+    range = ns.s.range
+    weights = ns.s.weights
+
+    return NestedStencil(Stencil(range, scale.(weights,a)))
+end
+
 function flip(ns::NestedStencil)
     s_flip = flip(ns.s)
     return NestedStencil(Stencil(s_flip.range, flip.(s_flip.weights)))