diff src/SbpOperators/stencil.jl @ 1059:4d06642174ec feature/nested_stencils

Add scale method for nested stencils (grafted from 004324d7ed3561aded3ff49905bb26e2c359bd63)
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 10 Feb 2022 11:26:28 +0100
parents c4f71d6f2d63
children 737cd68318c7
line wrap: on
line diff
--- a/src/SbpOperators/stencil.jl	Thu Feb 10 10:57:00 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)))