Mercurial > repos > public > sbplib_julia
comparison stencil.jl @ 93:93df72e2b135 stencil_index
Implement apply for 2D-Laplace which takes an StencilIndex as input
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 04 Feb 2019 09:13:48 +0100 |
parents | 8d505e9bc715 |
children | 84b1ad5a3755 |
comparison
equal
deleted
inserted
replaced
92:b8c9e2db126f | 93:93df72e2b135 |
---|---|
17 return s.weights[1 + i - s.range[1]] | 17 return s.weights[1 + i - s.range[1]] |
18 end | 18 end |
19 | 19 |
20 Base.@propagate_inbounds function apply(s::Stencil, v::AbstractVector, i::Int) | 20 Base.@propagate_inbounds function apply(s::Stencil, v::AbstractVector, i::Int) |
21 w = zero(eltype(v)) | 21 w = zero(eltype(v)) |
22 @show s.range[1]:s.range[2] | |
22 for j ∈ s.range[1]:s.range[2] | 23 for j ∈ s.range[1]:s.range[2] |
23 @inbounds weight = s[j] | 24 @inbounds weight = s[j] |
24 w += weight*v[i+j] | 25 w += weight*v[i+j] |
25 end | 26 end |
26 return w | 27 return w |