Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

different cells map to the same key #6

Open
flabowski opened this issue Nov 24, 2023 · 1 comment
Open

different cells map to the same key #6

flabowski opened this issue Nov 24, 2023 · 1 comment

Comments

@flabowski
Copy link

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

@kailando
Copy link

kailando commented May 5, 2024

...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants