diff stencil.jl @ 69:8cd8d83b92e7

Add some notes to stencil
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 18 Jan 2019 10:12:23 +0100
parents ef060ab3b035
children 700a74c41b26 48079bd39969
line wrap: on
line diff
--- a/stencil.jl	Wed Jan 16 12:40:20 2019 +0100
+++ b/stencil.jl	Fri Jan 18 10:12:23 2019 +0100
@@ -17,6 +17,7 @@
 
 # Provides index into the Stencil based on offset for the root element
 function Base.getindex(s::Stencil, i::Int)
+    # TBD: Rearrange to mark with @boundscheck?
     if s.range[1] <= i <= s.range[2]
         return s.weights[1 + i - s.range[1]]
     else
@@ -27,7 +28,7 @@
 function apply(s::Stencil, v::AbstractVector, i::Int)
     w = zero(eltype(v))
     for j ∈ s.range[1]:s.range[2]
-        w += s[j]*v[i+j]
+        w += s[j]*v[i+j] # TBD: Make this without boundschecks?
     end
     return w
 end