Skip to content

Commit 5c3283b

Browse files
committed
Vary initalize and update functions
1 parent 10e6c5b commit 5c3283b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

test/grid_nhs.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
# Create neighborhood search
2929
nhs1 = GridNeighborhoodSearch{2}(radius, nparticles)
3030

31-
coords_fun(i) = coordinates1[:, i]
32-
initialize_grid!(nhs1, coords_fun)
31+
initialize_grid!(nhs1, coordinates1)
3332

3433
# Get each neighbor for `particle_position1`
3534
neighbors1 = sort(collect(PointNeighbors.eachneighbor(particle_position1, nhs1)))
@@ -38,8 +37,7 @@
3837
coordinates2 = coordinates1 .+ [1.4, -3.5]
3938

4039
# Update neighborhood search
41-
coords_fun2(i) = coordinates2[:, i]
42-
update_grid!(nhs1, coords_fun2)
40+
update_grid!(nhs1, coordinates2)
4341

4442
# Get each neighbor for updated NHS
4543
neighbors2 = sort(collect(PointNeighbors.eachneighbor(particle_position1,
@@ -54,7 +52,7 @@
5452

5553
# Double search radius
5654
nhs2 = GridNeighborhoodSearch{2}(2 * radius, size(coordinates1, 2))
57-
initialize_grid!(nhs2, coords_fun)
55+
initialize!(nhs2, coordinates1, coordinates1)
5856

5957
# Get each neighbor in double search radius
6058
neighbors4 = sort(collect(PointNeighbors.eachneighbor(particle_position1,
@@ -64,7 +62,7 @@
6462
coordinates2 = coordinates1 .+ [0.4, -0.4]
6563

6664
# Update neighborhood search
67-
update_grid!(nhs2, coords_fun2)
65+
update!(nhs2, coordinates2, coordinates2)
6866

6967
# Get each neighbor in double search radius
7068
neighbors5 = sort(collect(PointNeighbors.eachneighbor(particle_position1,

0 commit comments

Comments
 (0)