diff stencil.jl @ 139:b9e8d2e1a30f cell_based_test

Merged heads for cell_based_test
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Thu, 21 Feb 2019 16:53:13 +0100
parents 6b6d921e8f05
children
line wrap: on
line diff
--- a/stencil.jl	Thu Feb 21 16:51:27 2019 +0100
+++ b/stencil.jl	Thu Feb 21 16:53:13 2019 +0100
@@ -1,6 +1,11 @@
 struct Stencil{T<:Real,N}
     range::Tuple{Int,Int}
     weights::NTuple{N,T}
+
+    function Stencil(range::Tuple{Int,Int},weights::NTuple{N,T}) where {T <: Real, N}
+        @assert range[2]-range[1]+1 == N
+        new{T,N}(range,weights)
+    end
 end
 
 function flip(s::Stencil)