|
Chris,
The second loop creates a chained hash table.
If (RX,RY,RZ) hold the positions of the particles, then this code finds the index of the spatial region that the particle is in, denoted by ICELL. (This is used as the hash key).
After the loop over all particles the LIST and HEAD arrays form a linked list, where each element of HEAD is the last particle encountered in each spatial region (HEAD(ICELL)==0 if no particles in that region), and each element of list contains the number of the particle which was previously encountered in each region.
So to determine which particles are close to a given location you would compute the hash key ICELL, look in HEAD(ICELL) for the 'first' particle number NN, then look in LIST(NN) to get the next particle number and continue this process until LIST(NN) == 0.
Hth,
Darren.
|