Skip to content

num::cell_list_2d

Defined in header <spatial/cell_list.hpp>

template <field scalar>
class cell_list_2d;

Particles sorted into square cells of a 2D grid.

Members

member description
cell_list_2d(scalar cell_size, scalar xmin, scalar xmax, scalar ymin, scalar ymax) Construct cells of side cell_size over the bounding box.
template <position_accessor_2d<scalar> PosAccessor> void build(PosAccessor &&get_pos, int n) Sort the particles into cells again, by counting sort.
template <typename F> void query(scalar px, scalar py, F &&f) const Call f(j) for each particle that may be near \((p_x, p_y)\).
template <typename F> void iterate_pairs(F &&f) const Call f(i, j) once for each pair of particles that may be near each other.
integer_range cell_particles(int cx, int cy) const noexcept Return the particles in cell \((c_x, c_y)\).
int nx() const noexcept
int ny() const noexcept
int n_particles() const noexcept