Skip to content

different cells map to the same key #6

@flabowski

Description

@flabowski

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

	int3 cell = GetCell3D(PredictedPositions[index], smoothingRadius);
	uint hash = HashCell3D(cell);
	uint key = KeyFromHash(hash, numParticles);

you could do something like:

	int3 cell = GetCell3D(PredictedPositions[index], smoothingRadius);
	uint key = FlatIndex(cell, domain_size);

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions