18 float xmin,
float xmax,
19 float ymin,
float ymax,
20 float zmin,
float zmax)
21 : cl_(cell_size, xmin, xmax, ymin, ymax, zmin, zmax) {}
23 void build(
const std::vector<Particle3D>& particles) {
24 const int n =
static_cast<int>(particles.size());
25 cl_.
build([&](
int i) {
26 return std::make_tuple(particles[i].x, particles[i].y, particles[i].z);
31 void query(
float px,
float py,
float pz, F&& f)
const {
32 cl_.
query(px, py, pz, std::forward<F>(f));
Cache-coherent 3D cell list for O(1) amortized neighbour queries.
void iterate_pairs(F &&f) const
void build(PosAccessor &&get_pos, int n)
void query(Scalar px, Scalar py, Scalar pz, F &&f) const
3x3x3 neighbourhood query around (px, py, pz).
void build(const std::vector< Particle3D > &particles)
SpatialHash3D(float cell_size, float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)
void query(float px, float py, float pz, F &&f) const
void iterate_pairs(F &&f) const
Newton's 3rd law pair traversal – 13 forward offsets, O(n*k/2).