Skip to content

Commit

Permalink
Back to slow bound-checking
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasmerino41 authored and rafaqz committed Jul 9, 2024
1 parent c403252 commit bccce1e
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/kernel/outwards.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,17 @@ end
if !isnothing(mask_data) && !mask_data[I...]
return nothing
end

sum = zero(N)
for (offset, k) in zip(offsets(rule), kernel(rule))
target = I .+ offset
inbounds = if isnothing(mask_data)
true
else
(target_mod, inbounds) = DynamicGrids.inbounds(data, target)
mask_data[target_mod...]
end
if inbounds
(target_mod, inbounds) = DynamicGrids.inbounds(data, target)
if inbounds && (isnothing(mask_data) || mask_data[target_mod...])
@inbounds propagules = N * k
@inbounds add!(data[W], propagules, target...)
@inbounds add!(data[W], propagules, target_mod...)
sum += propagules
end
end
@inbounds sub!(data[W], sum, I...)
return nothing
end
end

0 comments on commit bccce1e

Please sign in to comment.