Skip to main content

parallel_sph_density

Function parallel_sph_density 

Source
pub fn parallel_sph_density(
    positions: &[[f64; 3]],
    masses: &[f64],
    h: f64,
    kernel_fn: impl Fn(f64, f64) -> f64 + Sync,
) -> Vec<f64>
Expand description

Parallel SPH density computation.

For each particle i, computes rho_i = sum_j m_j * W(|r_i - r_j|, h). The outer loop runs in parallel via Rayon.

ยงArguments

  • positions - slice of 3-D particle positions.
  • masses - per-particle masses (same length as positions).
  • h - smoothing length.
  • kernel_fn - smoothing kernel W(r, h) callable from multiple threads.