comparison src/SbpOperators/stencil.jl @ 1065:fdd594b2a15e feature/nested_stencils

Fix type instability in apply_stencil_backwards and add tests (grafted from a3bc90c59e8e89de3535c7767963f3a3010c4f4c)
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 15 Feb 2022 08:08:19 +0100
parents f98893154e22
children 14cb97284373
comparison
equal deleted inserted replaced
1064:a601427023e3 1065:fdd594b2a15e
76 76
77 return w 77 return w
78 end 78 end
79 79
80 Base.@propagate_inbounds @inline function apply_stencil_backwards(s::Stencil, v::AbstractVector, i::Int) 80 Base.@propagate_inbounds @inline function apply_stencil_backwards(s::Stencil, v::AbstractVector, i::Int)
81 w = zero(eltype(v)) 81 w = zero(promote_type(eltype(s),eltype(v)))
82 @simd for k ∈ length(s):-1:1 82 @simd for k ∈ length(s):-1:1
83 w += s.weights[k]*v[i - s.range[k]] 83 w += s.weights[k]*v[i - s.range[k]]
84 end 84 end
85 return w 85 return w
86 end 86 end