|
numerics
|
#include <cell_list.hpp>
Public Member Functions | |
| CellList2D (Scalar cell_size, Scalar xmin, Scalar xmax, Scalar ymin, Scalar ymax) | |
| template<typename PosAccessor > | |
| void | build (PosAccessor &&get_pos, int n) |
| Rebuild the cell list from n particles. | |
| template<typename F > | |
| void | query (Scalar px, Scalar py, F &&f) const |
| Point query: calls f(int j) for every particle in the 3x3 cell neighbourhood of (px, py). | |
| template<typename F > | |
| void | iterate_pairs (F &&f) const |
| Newton's 3rd law pair traversal. | |
| IntRange | cell_particles (int cx, int cy) const noexcept |
| Direct access to sorted particle indices for cell (cx, cy). | |
| int | nx () const noexcept |
| int | ny () const noexcept |
| int | n_particles () const noexcept |
Definition at line 69 of file cell_list.hpp.
|
inline |
| cell_size | Width of one cell (use kernel support radius 2h). |
| xmin,xmax,ymin,ymax | Simulation domain. Particles outside are clamped to the boundary cell (safe, just no missed neighbours). |
Definition at line 74 of file cell_list.hpp.
|
inline |
Rebuild the cell list from n particles.
PosAccessor: callable int -> std::pair<Scalar,Scalar> (x, y)
Complexity: O(n + C) (two passes over particles + one prefix sum)
Definition at line 93 of file cell_list.hpp.
References num::ipow().
Referenced by physics::SpatialHash::build().
|
inlinenoexcept |
Direct access to sorted particle indices for cell (cx, cy).
Definition at line 185 of file cell_list.hpp.
References num::ipow().
|
inline |
Newton's 3rd law pair traversal.
Calls f(int i, int j) for every unique unordered pair {i,j} whose cells lie within the 3x3 neighbourhood. Each pair appears exactly once. Caller can apply equal-and-opposite contributions to i and j.
Complexity: O(n*k/2) where k = average neighbour count.
Definition at line 145 of file cell_list.hpp.
References num::ipow().
Referenced by physics::SpatialHash::iterate_pairs().
|
inlinenoexcept |
Definition at line 193 of file cell_list.hpp.
|
inlinenoexcept |
Definition at line 191 of file cell_list.hpp.
|
inlinenoexcept |
Definition at line 192 of file cell_list.hpp.
|
inline |
Point query: calls f(int j) for every particle in the 3x3 cell neighbourhood of (px, py).
Caller must still verify |r_ij| < cutoff – this returns candidates.
Definition at line 121 of file cell_list.hpp.
References num::ipow().
Referenced by physics::SpatialHash::query().