Mercurial > repos > public > sbplib_julia
diff sbpD2.jl @ 81:7f72e7e14659 patch_based_test
Add benchmarktest and mark all apply functions with @inline and @inbounds
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 24 Jan 2019 14:58:22 +0100 |
parents | 700a74c41b26 |
children | 170e5447bc19 |
line wrap: on
line diff
--- a/sbpD2.jl Thu Jan 24 14:33:49 2019 +0100 +++ b/sbpD2.jl Thu Jan 24 14:58:22 2019 +0100 @@ -1,21 +1,21 @@ abstract type ConstantStencilOperator end -function apply!(op::ConstantStencilOperator, u::AbstractVector, v::AbstractVector, h::Real) +@inline function apply!(op::ConstantStencilOperator, u::AbstractVector, v::AbstractVector, h::Real) N = length(v) cSize = closureSize(op) for i ∈ range(1; length=cSize) - u[i] = apply(op.closureStencils[i], v, i)/h^2 + @inbounds u[i] = apply(op.closureStencils[i], v, i)/h^2 end innerStart = 1 + cSize innerEnd = N - cSize for i ∈ range(innerStart, stop=innerEnd) - u[i] = apply(op.innerStencil, v, i)/h^2 + @inbounds u[i] = apply(op.innerStencil, v, i)/h^2 end for i ∈ range(innerEnd+1, length=cSize) - u[i] = Int(op.parity)*apply(flip(op.closureStencils[N-i+1]), v, i)/h^2 + @inbounds u[i] = Int(op.parity)*apply(flip(op.closureStencils[N-i+1]), v, i)/h^2 end return nothing