Skip to content

Commit 7518a8c

Browse files
committed
Use new foreach_neighbor_unsafe
1 parent bcdc27d commit 7518a8c

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/schemes/structure/total_lagrangian_sph/rhs.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ end
2020
# Everything here is done in the initial coordinates
2121
system_coords = initial_coordinates(system)
2222
neighborhood_search = get_neighborhood_search(system, system, semi)
23+
backend = semi.parallelization_backend
2324

2425
# For `distance == 0`, the analytical gradient is zero, but the unsafe gradient
2526
# and the density diffusion divide by zero.
@@ -47,11 +48,9 @@ end
4748
dv_particle = Ref(zero(current_coords_a))
4849

4950
# Loop over all neighbors within the kernel cutoff
50-
@inbounds PointNeighbors.foreach_neighbor(system_coords, system_coords,
51-
neighborhood_search,
52-
particle) do particle, neighbor,
53-
initial_pos_diff,
54-
initial_distance
51+
@inbounds foreach_neighbor(system_coords, system_coords, neighborhood_search,
52+
backend,particle) do particle, neighbor,
53+
initial_pos_diff, initial_distance
5554
# Skip neighbors with the same position because the kernel gradient is zero.
5655
# Note that `return` only exits the closure, i.e., skips the current neighbor.
5756
skip_zero_distance(system) && initial_distance < almostzero && return

src/schemes/structure/total_lagrangian_sph/system.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,7 @@ end
490490
# Loop over all pairs of particles and neighbors within the kernel cutoff
491491
initial_coords = initial_coordinates(system)
492492
neighborhood_search = get_neighborhood_search(system, system, semi)
493+
backend = semi.parallelization_backend
493494

494495
@threaded semi for particle in each_integrated_particle(system)
495496
# We are looping over the particles of `system`, so it is guaranteed
@@ -504,11 +505,9 @@ end
504505
result = Ref(zero(L_a))
505506

506507
# Loop over all neighbors within the kernel cutoff
507-
@inbounds PointNeighbors.foreach_neighbor(initial_coords, initial_coords,
508-
neighborhood_search,
509-
particle) do particle, neighbor,
510-
initial_pos_diff,
511-
initial_distance
508+
@inbounds foreach_neighbor(initial_coords, initial_coords, neighborhood_search,
509+
backend, particle) do particle, neighbor,
510+
initial_pos_diff, initial_distance
512511
# Skip neighbors with the same position because the kernel gradient is zero.
513512
# Note that `return` only exits the closure, i.e., skips the current neighbor.
514513
skip_zero_distance(system) && initial_distance < almostzero && return

0 commit comments

Comments
 (0)