|
numerics
|
#include <spatial_hash.hpp>
Public Member Functions | |
| SpatialHash (float cell_size, float xmin, float xmax, float ymin, float ymax) | |
| void | build (const std::vector< Particle > &particles) |
| Rebuild from the particle array. O(n + C). | |
| template<typename F > | |
| void | query (float px, float py, F &&f) const |
| template<typename F > | |
| void | iterate_pairs (F &&f) const |
Definition at line 30 of file spatial_hash.hpp.
|
inline |
| cell_size | Kernel support radius (2h). |
| xmin..ymax | Simulation domain – required by CellList2D for the flat grid (no hash collisions, zero false positives). |
Definition at line 35 of file spatial_hash.hpp.
|
inline |
Rebuild from the particle array. O(n + C).
Definition at line 41 of file spatial_hash.hpp.
References num::CellList2D< Scalar >::build().
Referenced by physics::FluidSolver::step().
|
inline |
Newton's 3rd law pair traversal. Calls f(int i, int j) for every unique unordered pair {i,j} whose cells are within one cell of each other. Each pair appears exactly once. Caller can apply equal-and-opposite contributions to both i and j.
Definition at line 60 of file spatial_hash.hpp.
References num::CellList2D< Scalar >::iterate_pairs().
Referenced by physics::backends::seq::compute_density_pressure(), and physics::backends::seq::compute_forces().
|
inline |
Point query: calls f(int j) for every candidate in the 3x3 neighbourhood. Caller must verify |r_ij| < cutoff. (Same contract as before.)
Definition at line 51 of file spatial_hash.hpp.
References num::CellList2D< Scalar >::query().
Referenced by physics::backends::omp::compute_density_pressure(), physics::backends::omp::compute_forces(), physics::backends::omp::heat_compute(), and physics::backends::seq::heat_compute().