Mercurial > repos > public > sbplib_julia
diff src/SbpOperators/stencil.jl @ 823:3c1dd7692797
Merge refactor/sbp_operators_method_signatures
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Thu, 13 Jan 2022 12:43:10 +0100 |
| parents | 1fc6c4daec44 |
| children | 4433be383840 |
line wrap: on
line diff
--- a/src/SbpOperators/stencil.jl Thu Jan 13 12:29:11 2022 +0100 +++ b/src/SbpOperators/stencil.jl Thu Jan 13 12:43:10 2022 +0100 @@ -1,10 +1,10 @@ export CenteredStencil -struct Stencil{T<:Real,N} +struct Stencil{T,N} range::Tuple{Int,Int} weights::NTuple{N,T} - function Stencil(range::Tuple{Int,Int},weights::NTuple{N,T}) where {T <: Real, N} + function Stencil(range::Tuple{Int,Int},weights::NTuple{N,T}) where {T, N} @assert range[2]-range[1]+1 == N new{T,N}(range,weights) end @@ -15,7 +15,7 @@ Create a stencil with the given weights with element `center` as the center of the stencil. """ -function Stencil(weights::Vararg{Number}; center::Int) +function Stencil(weights::Vararg{T}; center::Int) where T # Type parameter T makes sure the weights are valid for the Stencil constuctors and throws an earlier, more readable, error N = length(weights) range = (1, N) .- center
