|
5 | 5 | coords2 = [NaN, 0] |
6 | 6 | coords3 = [typemax(Int) + 1.0, -typemax(Int) - 1.0] |
7 | 7 |
|
8 | | - @test TrixiNeighborhoodSearch.cell_coords(coords1, nothing, (1.0, 1.0)) == |
| 8 | + @test PointNeighbors.cell_coords(coords1, nothing, (1.0, 1.0)) == |
9 | 9 | (typemax(Int), typemin(Int)) |
10 | | - @test TrixiNeighborhoodSearch.cell_coords(coords2, nothing, (1.0, 1.0)) == |
| 10 | + @test PointNeighbors.cell_coords(coords2, nothing, (1.0, 1.0)) == |
11 | 11 | (typemax(Int), 0) |
12 | | - @test TrixiNeighborhoodSearch.cell_coords(coords3, nothing, (1.0, 1.0)) == |
| 12 | + @test PointNeighbors.cell_coords(coords3, nothing, (1.0, 1.0)) == |
13 | 13 | (typemax(Int), typemin(Int)) |
14 | 14 | end |
15 | 15 |
|
|
32 | 32 | initialize!(nhs1, coords_fun) |
33 | 33 |
|
34 | 34 | # Get each neighbor for `particle_position1` |
35 | | - neighbors1 = sort(collect(TrixiNeighborhoodSearch.eachneighbor(particle_position1, |
36 | | - nhs1))) |
| 35 | + neighbors1 = sort(collect(PointNeighbors.eachneighbor(particle_position1, nhs1))) |
37 | 36 |
|
38 | 37 | # Move particles |
39 | 38 | coordinates2 = coordinates1 .+ [1.4, -3.5] |
|
43 | 42 | update!(nhs1, coords_fun2) |
44 | 43 |
|
45 | 44 | # Get each neighbor for updated NHS |
46 | | - neighbors2 = sort(collect(TrixiNeighborhoodSearch.eachneighbor(particle_position1, |
47 | | - nhs1))) |
| 45 | + neighbors2 = sort(collect(PointNeighbors.eachneighbor(particle_position1, |
| 46 | + nhs1))) |
48 | 47 |
|
49 | 48 | # Change position |
50 | 49 | particle_position2 = particle_position1 .+ [1.4, -3.5] |
51 | 50 |
|
52 | 51 | # Get each neighbor for `particle_position2` |
53 | | - neighbors3 = sort(collect(TrixiNeighborhoodSearch.eachneighbor(particle_position2, |
54 | | - nhs1))) |
| 52 | + neighbors3 = sort(collect(PointNeighbors.eachneighbor(particle_position2, |
| 53 | + nhs1))) |
55 | 54 |
|
56 | 55 | # Double search radius |
57 | 56 | nhs2 = GridNeighborhoodSearch{2}(2 * radius, size(coordinates1, 2)) |
58 | 57 | initialize!(nhs2, coords_fun) |
59 | 58 |
|
60 | 59 | # Get each neighbor in double search radius |
61 | | - neighbors4 = sort(collect(TrixiNeighborhoodSearch.eachneighbor(particle_position1, |
62 | | - nhs2))) |
| 60 | + neighbors4 = sort(collect(PointNeighbors.eachneighbor(particle_position1, |
| 61 | + nhs2))) |
63 | 62 |
|
64 | 63 | # Move particles |
65 | 64 | coordinates2 = coordinates1 .+ [0.4, -0.4] |
|
68 | 67 | update!(nhs2, coords_fun2) |
69 | 68 |
|
70 | 69 | # Get each neighbor in double search radius |
71 | | - neighbors5 = sort(collect(TrixiNeighborhoodSearch.eachneighbor(particle_position1, |
72 | | - nhs2))) |
| 70 | + neighbors5 = sort(collect(PointNeighbors.eachneighbor(particle_position1, |
| 71 | + nhs2))) |
73 | 72 |
|
74 | 73 | #### Verification |
75 | 74 | @test neighbors1 == [17, 18, 19, 24, 25, 26, 31, 32, 33] |
|
105 | 104 | initialize!(nhs1, coords_fun) |
106 | 105 |
|
107 | 106 | # Get each neighbor for `particle_position1` |
108 | | - neighbors1 = sort(collect(TrixiNeighborhoodSearch.eachneighbor(particle_position1, |
109 | | - nhs1))) |
| 107 | + neighbors1 = sort(collect(PointNeighbors.eachneighbor(particle_position1, |
| 108 | + nhs1))) |
110 | 109 |
|
111 | 110 | # Move particles |
112 | 111 | coordinates2 = coordinates1 .+ [1.4, -3.5, 0.8] |
|
116 | 115 | update!(nhs1, coords_fun2) |
117 | 116 |
|
118 | 117 | # Get each neighbor for updated NHS |
119 | | - neighbors2 = sort(collect(TrixiNeighborhoodSearch.eachneighbor(particle_position1, |
120 | | - nhs1))) |
| 118 | + neighbors2 = sort(collect(PointNeighbors.eachneighbor(particle_position1, |
| 119 | + nhs1))) |
121 | 120 |
|
122 | 121 | # Change position |
123 | 122 | particle_position2 = particle_position1 .+ [1.4, -3.5, 0.8] |
124 | 123 |
|
125 | 124 | # Get each neighbor for `particle_position2` |
126 | | - neighbors3 = sort(collect(TrixiNeighborhoodSearch.eachneighbor(particle_position2, |
127 | | - nhs1))) |
| 125 | + neighbors3 = sort(collect(PointNeighbors.eachneighbor(particle_position2, |
| 126 | + nhs1))) |
128 | 127 |
|
129 | 128 | #### Verification |
130 | 129 | @test neighbors1 == |
|
150 | 149 |
|
151 | 150 | initialize!(nhs, coords) |
152 | 151 |
|
153 | | - neighbors = [sort(collect(TrixiNeighborhoodSearch.eachneighbor(coords[:, i], |
154 | | - nhs))) |
| 152 | + neighbors = [sort(collect(PointNeighbors.eachneighbor(coords[:, i], |
| 153 | + nhs))) |
155 | 154 | for i in 1:5] |
156 | 155 |
|
157 | 156 | # Note that (1, 2) and (2, 3) are not neighbors, but they are in neighboring cells |
|
189 | 188 |
|
190 | 189 | initialize!(nhs, coords) |
191 | 190 |
|
192 | | - neighbors = [sort(collect(TrixiNeighborhoodSearch.eachneighbor(coords[:, i], |
193 | | - nhs))) |
| 191 | + neighbors = [sort(collect(PointNeighbors.eachneighbor(coords[:, i], |
| 192 | + nhs))) |
194 | 193 | for i in 1:5] |
195 | 194 |
|
196 | 195 | # Note that (1, 2) and (2, 3) are not neighbors, but they are in neighboring cells |
|
224 | 223 | # see the right particle, even though it is within the search distance. |
225 | 224 | # The domain size is an integer multiple of the cell size, but the NHS did not |
226 | 225 | # offset the grid based on the domain position. |
227 | | - # See https://github.com/trixi-framework/TrixiNeighborhoodSearch.jl/pull/211 |
| 226 | + # See https://github.com/trixi-framework/PointNeighbors.jl/pull/211 |
228 | 227 | # for a more detailed explanation. |
229 | 228 | coords = [-1.4 1.9 |
230 | 229 | 0.0 0.0] |
|
236 | 235 |
|
237 | 236 | initialize!(nhs, coords) |
238 | 237 |
|
239 | | - neighbors = [sort(unique(collect(TrixiNeighborhoodSearch.eachneighbor(coords[:, |
240 | | - i], |
241 | | - nhs)))) |
| 238 | + neighbors = [sort(unique(collect(PointNeighbors.eachneighbor(coords[:, |
| 239 | + i], |
| 240 | + nhs)))) |
242 | 241 | for i in 1:2] |
243 | 242 |
|
244 | 243 | @test neighbors[1] == [1, 2] |
|
258 | 257 |
|
259 | 258 | initialize!(nhs, coords) |
260 | 259 |
|
261 | | - neighbors = [sort(collect(TrixiNeighborhoodSearch.eachneighbor(coords[:, i], nhs))) |
| 260 | + neighbors = [sort(collect(PointNeighbors.eachneighbor(coords[:, i], nhs))) |
262 | 261 | for i in 1:5] |
263 | 262 |
|
264 | 263 | # Note that (1, 2) and (2, 3) are not neighbors, but they are in neighboring cells |
|
0 commit comments