comparison src/SbpOperators/stencil.jl @ 1759:d28562d5ca8f feature/jet_aqua

Remove unbound parameter for Stencil
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 13 Sep 2024 14:01:37 +0200
parents d8fabe814d06
children 65fd5331caa5
comparison
equal deleted inserted replaced
1758:d8fabe814d06 1759:d28562d5ca8f
3 3
4 struct Stencil{T,N} 4 struct Stencil{T,N}
5 range::UnitRange{Int64} 5 range::UnitRange{Int64}
6 weights::NTuple{N,T} 6 weights::NTuple{N,T}
7 7
8 function Stencil(range::UnitRange,weights::NTuple{N,T}) where {T, N} 8 function Stencil(range::UnitRange,weights::NTuple{N,Any}) where N
9 T = eltype(weights)
10
9 @assert length(range) == N 11 @assert length(range) == N
10 new{T,N}(range,weights) 12 new{T,N}(range,weights)
11 end 13 end
12 end 14 end
13 15
14 """ 16 """
15 Stencil(weights::NTuple; center::Int) 17 Stencil(weights...; center::Int)
16 18
17 Create a stencil with the given weights with element `center` as the center of the stencil. 19 Create a stencil with the given weights with element `center` as the center of the stencil.
18 """ 20 """
19 function Stencil(weights...; center::Int) 21 function Stencil(weights...; center::Int)
20 weights = promote(weights...) 22 weights = promote(weights...)