changeset 126:66c239678a21 cell_based_test

Add Assertion in stencil constructor
author Ylva Rydin <ylva.rydin@telia.com>
date Thu, 07 Feb 2019 16:00:04 +0100
parents f99320a459ef
children f01b70b81e95
files stencil.jl
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stencil.jl	Wed Feb 06 23:08:36 2019 +0100
+++ b/stencil.jl	Thu Feb 07 16:00:04 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)