@@ -37,21 +37,26 @@ struct PrecomputedNeighborhoodSearch{NDIMS, NHS, NL, PB} <: AbstractNeighborhood
3737 neighbor_lists :: NL
3838 periodic_box :: PB
3939
40- function PrecomputedNeighborhoodSearch {NDIMS} (; search_radius = 0.0 , n_points = 0 ,
41- periodic_box = nothing ,
42- update_strategy = nothing ,
43- backend = VectorOfVectors{Int}) where {NDIMS}
44- nhs = GridNeighborhoodSearch {NDIMS} (; search_radius, n_points,
45- periodic_box, update_strategy)
46-
47- neighbor_lists = backend ()
48-
49- new{NDIMS, typeof (nhs),
50- typeof (neighbor_lists),
51- typeof (periodic_box)}(nhs, neighbor_lists, periodic_box)
40+ # This constructor is necessary for Adapt.jl to work with this struct.
41+ # See the comments in gpu.jl for more details.
42+ function PrecomputedNeighborhoodSearch (nhs, neighbor_lists, periodic_box)
43+ new{ndims (nhs), typeof (nhs),
44+ typeof (neighbor_lists), typeof (periodic_box)}(nhs, neighbor_lists, periodic_box)
5245 end
5346end
5447
48+ function PrecomputedNeighborhoodSearch {NDIMS} (; search_radius = 0.0 , n_points = 0 ,
49+ periodic_box = nothing ,
50+ update_strategy = nothing ,
51+ backend = VectorOfVectors{Int}) where {NDIMS}
52+ nhs = GridNeighborhoodSearch {NDIMS} (; search_radius, n_points,
53+ periodic_box, update_strategy)
54+
55+ neighbor_lists = backend ()
56+
57+ return PrecomputedNeighborhoodSearch (nhs, neighbor_lists, periodic_box)
58+ end
59+
5560@inline Base. ndims (:: PrecomputedNeighborhoodSearch{NDIMS} ) where {NDIMS} = NDIMS
5661
5762@inline requires_update (:: PrecomputedNeighborhoodSearch ) = (true , true )
0 commit comments