diff src/SbpOperators/stencil.jl @ 617:f59e1732eacc feature/volume_and_boundary_operators

Merge with default
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Mon, 07 Dec 2020 12:07:29 +0100
parents 03ef4d4740ab
children e14627e79a54
line wrap: on
line diff
--- a/src/SbpOperators/stencil.jl	Mon Dec 07 11:57:36 2020 +0100
+++ b/src/SbpOperators/stencil.jl	Mon Dec 07 12:07:29 2020 +0100
@@ -9,6 +9,18 @@
 end
 
 """
+    Stencil(weights::NTuple; center::Int)
+
+Create a stencil with the given weights with element `center` as the center of the stencil.
+"""
+function Stencil(weights::NTuple; center::Int)
+    N = length(weights)
+    range = (1, N) .- center
+
+    return Stencil(range, weights)
+end
+
+"""
     scale(s::Stencil, a)
 
 Scale the weights of the stencil `s` with `a` and return a new stencil.