Mercurial > repos > public > sbplib_julia
diff stencil.jl @ 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 | 8d505e9bc715 |
children | 6b6d921e8f05 |
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)