Hei,
is there a reason you are working with hashes rather than a flattened cell index? As I understand, the domain (the box that contains the particles) is always finite and there are never indefinitely many cells. Instead of (cell.x hashK1) + (cell.y hashK2) + (cell.z * hashK3) you could compute the flattened index and use it as a unique cell id: cell_key = cell.z * (n_x * n_y) +cell.y *n_x + cell.x. With n_x = ceil(domain_size.x/smoothingRadius). Not sure what your domain is called, is it boundsSize?
So instead of
No reason to call KeyFromHash anymore, because all cell_key's are already smaller than tableSize (tableSize=n_x*n_y*n_z, which is smaller than numParticles).
Hei, is there a reason you are working with hashes rather than a flattened cell index? As I understand, the domain (the box that contains the particles) is always finite and there are never indefinitely many cells. Instead of (cell.x hashK1) + (cell.y hashK2) + (cell.z * hashK3) you could compute the flattened index and use it as a unique cell id:
cell_key = cell.z * (n_x * n_y) +cell.y *n_x + cell.x
. Withn_x = ceil(domain_size.x/smoothingRadius)
. Not sure what your domain is called, is itboundsSize
? So instead ofyou could do something like:
No reason to call
KeyFromHash
anymore, because all cell_key's are already smaller thantableSize
(tableSize=n_x*n_y*n_z
, which is smaller thannumParticles
).