I'd like to setup deposition fields for particle velocities. This means doing a mass-weighted nearest neighbor or cloud-in-cell deposition of the particle velocities in a grid dataset. I'm using this to analyze the stellar velocity dispersions in a simulation, so it's much more convenient to have the particle velocities interpolated onto a grid to calculate the local velocity dispersion using a 3D convolution.

Does anyone have an example of setting up a particle deposition field? If not, where should I look in the source?