Skip to content
This repository has been archived by the owner on Feb 9, 2020. It is now read-only.

Commit

Permalink
Merge 9eb54a8 into e02d09f
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Lycken committed Apr 13, 2015
2 parents e02d09f + 9eb54a8 commit fa6a098
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/interp.jl
Expand Up @@ -603,18 +603,18 @@ function interp_coords_1d(coord1d::Vector{Int}, ::Type{InterpLinear})
end
# version for indices
function interp_coords_1d{T,BC<:BoundaryCondition}(coord1d::Vector{Int}, ::Type{BC}, ::Type{InterpLinear}, x::T, len::Int)
ifx = trunc(Int, x)
ifx = floor(Int, x)
dx = x-ifx
ifx -= x < convert(T, ifx)
ix = wrap(BC, ifx, len)
@inbounds coord1d[1] = ix
iswrap = (ix == len && dx > 0)
@inbounds coord1d[2] = wrap(BC, ix+1, len)
iswrap = (ix == len && dx > 0) || (ix == 1 && ifx < 1)
@inbounds coord1d[2] = iswrap ? ix : wrap(BC, ix+1, len)
return ix, dx, iswrap
end
function interp_coords_1d{T}(coord1d::Vector{Int}, ::Type{BCreflect}, ::Type{InterpLinear}, x::T, len::Int)
ix = mod(floor(Int, x)-1, 2*len)
dx = x-trunc(x)
dx = x-floor(Int, x)
if ix < len
ix += 1
ixp = ix+1
Expand Down

0 comments on commit fa6a098

Please sign in to comment.