PxCustomParticleSystemSolverCallback

Defined in include/PxCustomParticleSystemSolverCallback.h

class PxCustomParticleSystemSolverCallback

Public Functions

virtual void onBegin(PxGpuParticleSystem *gpuParticleSystem, PxReal dt, CUstream stream) = 0

callback called when the particle solver begins.

This is called once per frame. It occurs after external forces have been pre-integrated into the particle state. It is called prior to the particles being reordered by spatial hash index, so state can be accessed in the unsorted buffers only at this stage. This provides an opportunity to add custom forces and modifications to position or velocity.

Parameters
  • gpuParticleSystem[in] A pointer to the GPU particle system. This pointer points to a mirror of the particle system in device memory.

  • dt[in] The time-step.

  • stream[in] The CUDA stream currently being used by the particle system. Additional kernels should either be launched on this stream, or synchronization events should be used to avoid race conditions.

virtual void onSolve(PxGpuParticleSystem *gpuParticleSystem, PxReal dt, CUstream stream) = 0

callback called during the iterative particle solve stage.

This callback will potentially be called multiple times between onBegin and onFinalize.

Parameters
  • gpuParticleSystem[in] A pointer to the GPU particle system. This pointer points to a mirror of the particle system in device memory.

  • dt[in] The time-step.

  • stream[in] The CUDA stream currently being used by the particle system. Additional kernels should either be launched on this stream, or synchronization events should be used to avoid race conditions.

virtual void onFinalize(PxGpuParticleSystem *gpuParticleSystem, PxReal dt, CUstream stream) = 0

callback called after all solver iterations have completed.

This callback will be called once per frame, after integration has completed.

Parameters
  • gpuParticleSystem[in] A pointer to the GPU particle system. This pointer points to a mirror of the particle system in device memory.

  • dt[in] The time-step.

  • stream[in] The CUDA stream currently being used by the particle system. Additional kernels should either be launched on this stream, or synchronization events should be used to avoid race conditions.

inline virtual ~PxCustomParticleSystemSolverCallback()

Destructor.