Class MessageSpecialisationHandler

Inheritance Relationships

Derived Types

Class Documentation

class flamegpu::MessageSpecialisationHandler

Interface for message specialisation A derived implementation of this is required for each combination of message type (e.g. MessageBruteForce) and simulation type (e.g. CUDASimulation)


It is recommended that derived classes require an object that provides access to the model specialisation’s representation of messages (e.g. CUDAMessage)


: this is slightly CUDA aware. Future abstraction DevicePtr should be in a CUDANone message or similar.

Subclassed by flamegpu::MessageArray2D::CUDAModelHandler, flamegpu::MessageArray3D::CUDAModelHandler, flamegpu::MessageArray::CUDAModelHandler, flamegpu::MessageBruteForce::CUDAModelHandler, flamegpu::MessageBucket::CUDAModelHandler, flamegpu::MessageNone::CUDAModelHandler, flamegpu::MessageSpatial2D::CUDAModelHandler, flamegpu::MessageSpatial3D::CUDAModelHandler

Public Functions

inline MessageSpecialisationHandler()
inline virtual ~MessageSpecialisationHandler()

Destructor, should free any allocated memory in derived classes

virtual void init(CUDAScatter &scatter, const unsigned int &streamId) = 0

Allocate and fill metadata, as though message list was empty

  • scatter – Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)

  • streamId – Index of stream specific structures used

inline virtual void buildIndex(CUDAScatter &scatter, const unsigned int &streamId, const cudaStream_t &stream)

Constructs an index for the message data structure (e.g. Partition boundary matrix for spatial message types) This is called the first time messages are read, after new messages have been output

  • scatter – Scatter instance and scan arrays to be used (CUDASimulation::singletons->scatter)

  • streamId – The stream index to use for accessing stream specific resources such as scan compaction arrays and buffers

  • stream – CUDA stream to be used for async CUDA operations

inline virtual void allocateMetaDataDevicePtr()

Allocates memory for the constructed index. The memory allocation is checked by build index.

inline virtual void freeMetaDataDevicePtr()

Releases memory for the constructed index.

inline virtual const void *getMetaDataDevicePtr() const

Returns a pointer to metadata for message access during agent functions (For CUDASimulation this is a device pointer)


: this is slightly CUDA aware. Future abstraction this should be base CUDANone or similar.