comparison src/SbpOperators/stencil.jl @ 832:00f6bbdcd73a operator_storage_array_of_table

Review: Include latest changes
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 12 Jan 2022 15:54:21 +0100
parents 4433be383840
children 313648b01504 11767fbb29f4
comparison
equal deleted inserted replaced
813:cdc2b5ebf7cb 832:00f6bbdcd73a
19 N = length(weights) 19 N = length(weights)
20 range = (1, N) .- center 20 range = (1, N) .- center
21 21
22 return Stencil(range, weights) 22 return Stencil(range, weights)
23 end 23 end
24
25 function Stencil{T}(s::Stencil) where T
26 return Stencil(s.range, T.(s.weights))
27 end
28
29 Base.convert(::Type{Stencil{T}}, stencil) where T = Stencil{T}(stencil)
24 30
25 function CenteredStencil(weights::Vararg) 31 function CenteredStencil(weights::Vararg)
26 if iseven(length(weights)) 32 if iseven(length(weights))
27 throw(ArgumentError("a centered stencil must have an odd number of weights.")) 33 throw(ArgumentError("a centered stencil must have an odd number of weights."))
28 end 34 end