Skip to main content

parallel_count_particles

Function parallel_count_particles 

Source
pub fn parallel_count_particles(
    positions: &[[f64; 3]],
    n_cells: [usize; 3],
    cell_size: f64,
) -> Vec<usize>
Expand description

Count how many particles fall into each cell of a regular grid.

The grid has n_cells = [nx, ny, nz] cells, each of side length cell_size. The origin is [0, 0, 0]. Particles outside the grid are clamped to the nearest boundary cell.

Returns a flat Vec of length nx * ny * nz.