11@doc raw """
22 PrecomputedNeighborhoodSearch{NDIMS}(search_radius, n_particles;
33 periodic_box_min_corner = nothing,
4- periodic_box_max_corner = nothing)
4+ periodic_box_max_corner = nothing,
5+ backend = VectorOfVectors{Int32})
56
67Neighborhood search with precomputed neighbor lists. A list of all neighbors is computed
78for each particle during initialization and update.
@@ -23,6 +24,13 @@ initialization and update.
2324- `periodic_box_max_corner`: In order to use a (rectangular) periodic domain, pass the
2425 coordinates of the domain corner in positive coordinate
2526 directions.
27+ - `backend=VectorOfVectors{Int32}`: Data structure to store the neighbor lists. The default
28+ `VectorOfVectors` is a data structure from
29+ [ArraysOfArrays.jl](https://github.com/JuliaArrays/ArraysOfArrays.jl),
30+ which behaves like a `Vector` of `Vector`s, but uses
31+ a single `Vector` for a contiguous memory layout.
32+ Use `backend=Vector{Vector{Int32}}` to benchmark
33+ the benefits of this representation.
2634"""
2735struct PrecomputedNeighborhoodSearch{NDIMS, NHS, NL, PB}
2836 neighborhood_search :: NHS
@@ -74,7 +82,8 @@ function update!(search::PrecomputedNeighborhoodSearch,
7482 end
7583end
7684
77- function initialize_neighbor_lists! (neighbor_lists, neighborhood_search, x, y)
85+ function initialize_neighbor_lists! (neighbor_lists:: Vector{<:Vector} , neighborhood_search,
86+ x, y)
7887 # Initialize neighbor lists
7988 empty! (neighbor_lists)
8089 resize! (neighbor_lists, size (x, 2 ))
@@ -88,9 +97,8 @@ function initialize_neighbor_lists!(neighbor_lists, neighborhood_search, x, y)
8897 end
8998end
9099
91- function initialize_neighbor_lists! (neighbor_lists:: VectorOfVectors , neighborhood_search, x,
92- y)
93- neighbor_lists_ = Vector {Vector{Int}} ()
100+ function initialize_neighbor_lists! (neighbor_lists, neighborhood_search, x, y)
101+ neighbor_lists_ = Vector {Vector{Int32}} ()
94102 initialize_neighbor_lists! (neighbor_lists_, neighborhood_search, x, y)
95103
96104 empty! (neighbor_lists)
0 commit comments