fn apply_stencil(
output: &mut [f32],
input: &[f32],
stencil: &[[[f32; 3]; 3]; 3],
mask: Option<&[u8]>,
nx: usize,
ny: usize,
nz: usize,
)Expand description
Apply dipole stencil to a 3D volume Uses Neumann BC at boundaries (matching Julia’s wave_local)
With mask, the output is zero outside it; without, it is computed at every voxel (the
reference’s wave_local, zero only on the box boundary).