diff src/SbpOperators/stencil.jl @ 905:a3bc90c59e8e feature/variable_derivatives

Fix type instability in apply_stencil_backwards and add tests
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 15 Feb 2022 08:08:19 +0100
parents a7f898b1ce1e
children 14cb97284373
line wrap: on
line diff
--- a/src/SbpOperators/stencil.jl	Tue Feb 15 07:54:52 2022 +0100
+++ b/src/SbpOperators/stencil.jl	Tue Feb 15 08:08:19 2022 +0100
@@ -78,7 +78,7 @@
 end
 
 Base.@propagate_inbounds @inline function apply_stencil_backwards(s::Stencil, v::AbstractVector, i::Int)
-    w = zero(eltype(v))
+    w = zero(promote_type(eltype(s),eltype(v)))
     @simd for k ∈ length(s):-1:1
         w += s.weights[k]*v[i - s.range[k]]
     end