Skip to content

Commit 0045290

Browse files
authored
Rename inner function to foreach_neighbor (#24)
1 parent 51f8fe4 commit 0045290

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

src/PointNeighbors.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ include("neighborhood_search.jl")
1111
include("nhs_trivial.jl")
1212
include("nhs_grid.jl")
1313

14-
export for_particle_neighbor
14+
export for_particle_neighbor, foreach_neighbor
1515
export TrivialNeighborhoodSearch, GridNeighborhoodSearch
1616
export initialize!, update!, initialize_grid!, update_grid!
1717

src/neighborhood_search.jl

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ end
6666
@inline function for_particle_neighbor(f, system_coords, neighbor_coords,
6767
neighborhood_search, particles, parallel::Val{true})
6868
@threaded for particle in particles
69-
for_particle_neighbor_inner(f, system_coords, neighbor_coords, neighborhood_search,
70-
particle)
69+
foreach_neighbor(f, system_coords, neighbor_coords, neighborhood_search, particle)
7170
end
7271

7372
return nothing
@@ -76,20 +75,16 @@ end
7675
@inline function for_particle_neighbor(f, system_coords, neighbor_coords,
7776
neighborhood_search, particles, parallel::Val{false})
7877
for particle in particles
79-
for_particle_neighbor_inner(f, system_coords, neighbor_coords, neighborhood_search,
80-
particle)
78+
foreach_neighbor(f, system_coords, neighbor_coords, neighborhood_search, particle)
8179
end
8280

8381
return nothing
8482
end
8583

86-
# Use this function barrier and unpack inside to avoid passing closures to Polyester.jl
87-
# with `@batch` (`@threaded`).
88-
# Otherwise, `@threaded` does not work here with Julia ARM on macOS.
89-
# See https://github.com/JuliaSIMD/Polyester.jl/issues/88.
90-
@inline function for_particle_neighbor_inner(f, system_coords, neighbor_system_coords,
91-
neighborhood_search, particle)
92-
(; search_radius, periodic_box) = neighborhood_search
84+
@inline function foreach_neighbor(f, system_coords, neighbor_system_coords,
85+
neighborhood_search, particle;
86+
search_radius = neighborhood_search.search_radius)
87+
(; periodic_box) = neighborhood_search
9388

9489
particle_coords = extract_svector(system_coords, Val(ndims(neighborhood_search)),
9590
particle)

0 commit comments

Comments
 (0)