changeset 5:2737156fb884

Add flip method for stencils
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 17 Dec 2018 14:17:25 +0100
parents ef878a3df87d
children cb8e50ca9e15
files sbpD2.jl
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sbpD2.jl	Mon Dec 17 13:05:16 2018 +0100
+++ b/sbpD2.jl	Mon Dec 17 14:17:25 2018 +0100
@@ -23,6 +23,11 @@
     end
 end
 
+function flip(s::Stencil)
+    range = (-s.range[2], -s.range[1])
+    s = Stencil(range, s.weights(end:-1:1))
+end
+
 # Provides index into the Stencil based on offset for the root element
 function Base.getindex(s::Stencil, i::Int)
     if s.range[1] <= i <= s.range[2]