Skip to content

Commit

Permalink
Minor changes to interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
jipolanco committed Oct 16, 2024
1 parent f199d04 commit b49ceac
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/interpolation/gpu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,23 @@ using StaticArrays: MVector
@inbounds pointperm[i]
end

x⃗ = map(xs -> @inbounds(xs[j]), points)

# Determine grid dimensions.
# Unlike in spreading, here `us` can be made of arrays of complex numbers, because we
# don't perform atomic operations. This is why the code is simpler here.
Ns = size(first(us)) # grid dimensions

indvals = ntuple(Val(D)) do n
@inline
g = gs[n]
gdata = Kernels.evaluate_kernel(g, x⃗[n])
vals = gdata.values # kernel values
M = Kernels.half_support(gs[n])
i₀ = gdata.i - M # active region is (i₀ + 1):(i₀ + 2M) (up to periodic wrapping)
i₀ = ifelse(i₀ < 0, i₀ + Ns[n], i₀) # make sure i₀ ≥ 0
i₀ => vals
@inbounds begin
g = gs[n]
x = points[n][j]
gdata = Kernels.evaluate_kernel(g, x)
vals = gdata.values # kernel values
M = Kernels.half_support(gs[n])
i₀ = gdata.i - M # active region is (i₀ + 1):(i₀ + 2M) (up to periodic wrapping)
i₀ = ifelse(i₀ < 0, i₀ + Ns[n], i₀) # make sure i₀ ≥ 0
i₀ => vals
end
end

v⃗ = interpolate_from_arrays_gpu(us, indvals, Ns, Δxs)
Expand Down

0 comments on commit b49ceac

Please sign in to comment.