|
279 | 279 | " i_idx = np.arange(N)\n", |
280 | 280 | " mutual = has_nn & (nn[nn] == i_idx)\n", |
281 | 281 | "\n", |
282 | | - " # process each mutual pair only once (i < j)\n", |
| 282 | + " # define pairs i and their nearest neighbour j\n", |
283 | 283 | " pair_mask = mutual & (i_idx < nn)\n", |
284 | 284 | " pair_i = i_idx[pair_mask]\n", |
285 | 285 | " pair_j = nn[pair_mask]\n", |
286 | 286 | "\n", |
287 | 287 | " if pair_i.size == 0:\n", |
288 | 288 | " return\n", |
289 | 289 | "\n", |
290 | | - " # larger = where mass_j >= mass_i -> j else i\n", |
| 290 | + " # compute which of the two (i, j) has the largest mass\n", |
291 | 291 | " mass_i = particles.mass[pair_i]\n", |
292 | 292 | " mass_j = particles.mass[pair_j]\n", |
293 | 293 | " larger_idx = np.where(mass_j > mass_i, pair_j, pair_i)\n", |
294 | 294 | " smaller_idx = np.where(mass_j > mass_i, pair_i, pair_j)\n", |
295 | 295 | "\n", |
296 | 296 | " # perform transfer and mark deletions\n", |
297 | | - " # note that we use temporary arrays for indexing because of KernelParticle bug (GH #2143)\n", |
| 297 | + " # TODO note that we use temporary arrays for indexing because of KernelParticle bug (GH #2143)\n", |
298 | 298 | " masses = particles.mass\n", |
299 | 299 | " states = particles.state\n", |
300 | 300 | "\n", |
301 | 301 | " # transfer mass from smaller to larger and mark smaller for deletion\n", |
302 | 302 | " masses[larger_idx] += particles.mass[smaller_idx]\n", |
303 | 303 | " states[smaller_idx] = parcels.StatusCode.Delete\n", |
304 | 304 | "\n", |
305 | | - " # TODO use particle variables directly KernelParticle bug (GH #2143) is fixed\n", |
| 305 | + " # TODO use particle variables directly after KernelParticle bug (GH #2143) is fixed\n", |
306 | 306 | " particles.mass = masses\n", |
307 | 307 | " particles.state = states" |
308 | 308 | ] |
|
0 commit comments