diff src/SbpOperators/stencil.jl @ 1063:f98893154e22 feature/nested_stencils

Fix type instability for stencil application when weights and vector didn't match (grafted from a7f898b1ce1ea3adfe21201d3ccafdffb09c5be6)
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 14 Feb 2022 14:28:48 +0100
parents a76830879c63
children a3bc90c59e8e
line wrap: on
line diff
--- a/src/SbpOperators/stencil.jl	Sun Feb 13 22:00:02 2022 +0100
+++ b/src/SbpOperators/stencil.jl	Mon Feb 14 14:28:48 2022 +0100
@@ -69,7 +69,7 @@
 end
 
 Base.@propagate_inbounds @inline function apply_stencil(s::Stencil, v::AbstractVector, i::Int)
-    w = zero(eltype(v))
+    w = zero(promote_type(eltype(s),eltype(v)))
     @simd for k ∈ 1:length(s)
         w += s.weights[k]*v[i + s.range[k]]
     end