Skip to content

Commit eb23383

Browse files
committed
Improve docs
1 parent 88adc6c commit eb23383

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/nhs_neighbor_lists.jl

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
@doc raw"""
22
NeighborListsNeighborhoodSearch{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
67
Neighborhood search with precomputed neighbor lists. A list of all neighbors is computed
78
for 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
"""
2735
struct NeighborListsNeighborhoodSearch{NDIMS, NHS, NL, PB}
2836
neighborhood_search :: NHS
@@ -32,7 +40,7 @@ struct NeighborListsNeighborhoodSearch{NDIMS, NHS, NL, PB}
3240
function NeighborListsNeighborhoodSearch{NDIMS}(search_radius, n_particles;
3341
periodic_box_min_corner = nothing,
3442
periodic_box_max_corner = nothing,
35-
backend = VectorOfVectors{Int}) where {
43+
backend = VectorOfVectors{Int32}) where {
3644
NDIMS
3745
}
3846
nhs = GridNeighborhoodSearch{NDIMS}(search_radius, n_particles,
@@ -74,7 +82,8 @@ function update!(search::NeighborListsNeighborhoodSearch,
7482
end
7583
end
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
8998
end
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

Comments
 (0)