Mercurial > repos > public > sbplib_julia
diff sbpD2.jl @ 78:fbf7398f8154 cell_based_test
Inline and inbounds everything
author | Ylva Rydin <ylva.rydin@telia.com> |
---|---|
date | Thu, 24 Jan 2019 14:38:14 +0100 |
parents | d485da6e3a77 |
children | b795ec7f9ca0 |
line wrap: on
line diff
--- a/sbpD2.jl Fri Jan 18 13:51:32 2019 +0100 +++ b/sbpD2.jl Thu Jan 24 14:38:14 2019 +0100 @@ -1,15 +1,15 @@ abstract type ConstantStencilOperator end -function apply(op::ConstantStencilOperator, h::Real, v::AbstractVector, i::Int) +@inline function apply(op::ConstantStencilOperator, h::Real, v::AbstractVector, i::Int) cSize = closureSize(op) N = length(v) if i ∈ range(1; length=cSize) - uᵢ = apply(op.closureStencils[i], v, i)/h^2 + uᵢ = @inbounds apply(op.closureStencils[i], v, i)/h^2 elseif i ∈ range(N - cSize+1, length=cSize) - uᵢ = Int(op.parity)*apply(flip(op.closureStencils[N-i+1]), v, i)/h^2 + uᵢ = @inbounds Int(op.parity)*apply(flip(op.closureStencils[N-i+1]), v, i)/h^2 else - uᵢ = apply(op.innerStencil, v, i)/h^2 + uᵢ = @inbounds apply(op.innerStencil, v, i)/h^2 end return uᵢ