Mercurial > repos > public > sbplib_julia
comparison 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 |
comparison
equal
deleted
inserted
replaced
1058:c4f71d6f2d63 | 1059:4d06642174ec |
---|---|
110 | 110 |
111 Base.convert(::Type{NestedStencil{T}}, stencil) where T = NestedStencil{T}(stencil) | 111 Base.convert(::Type{NestedStencil{T}}, stencil) where T = NestedStencil{T}(stencil) |
112 | 112 |
113 Base.eltype(::NestedStencil{T}) where T = T | 113 Base.eltype(::NestedStencil{T}) where T = T |
114 | 114 |
115 function scale(ns::NestedStencil, a) | |
116 range = ns.s.range | |
117 weights = ns.s.weights | |
118 | |
119 return NestedStencil(Stencil(range, scale.(weights,a))) | |
120 end | |
121 | |
115 function flip(ns::NestedStencil) | 122 function flip(ns::NestedStencil) |
116 s_flip = flip(ns.s) | 123 s_flip = flip(ns.s) |
117 return NestedStencil(Stencil(s_flip.range, flip.(s_flip.weights))) | 124 return NestedStencil(Stencil(s_flip.range, flip.(s_flip.weights))) |
118 end | 125 end |
119 | 126 |