.. _program_listing_file_include_flamegpu_simulation_detail_CUDAScanCompaction.h: Program Listing for File CUDAScanCompaction.h ============================================= |exhale_lsh| :ref:`Return to documentation for file ` (``include/flamegpu/simulation/detail/CUDAScanCompaction.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef INCLUDE_FLAMEGPU_SIMULATION_DETAIL_CUDASCANCOMPACTION_H_ #define INCLUDE_FLAMEGPU_SIMULATION_DETAIL_CUDASCANCOMPACTION_H_ #include namespace flamegpu { // forward declare classes from other modules class CUDASimulation; namespace detail { struct CUDAScanCompactionPtrs { unsigned int *scan_flag = nullptr; unsigned int *position = nullptr; }; struct CUDAScanCompactionConfig { CUDAScanCompactionConfig() : scan_flag_len(0) { } ~CUDAScanCompactionConfig(); CUDAScanCompactionConfig(CUDAScanCompactionConfig const&) = delete; void operator=(CUDAScanCompactionConfig const&) = delete; unsigned int scan_flag_len = 0; CUDAScanCompactionPtrs d_ptrs; void free_scan_flag(); void resize_scan_flag(unsigned int count); void zero_scan_flag_async(cudaStream_t stream); }; class CUDAScanCompaction { public: static const unsigned int MAX_TYPES = 3; static const unsigned int MAX_STREAMS = 128; enum Type : unsigned int { MESSAGE_OUTPUT = 0, AGENT_DEATH = 1, AGENT_OUTPUT = 2 }; CUDAScanCompaction() { } CUDAScanCompaction(CUDAScanCompaction const&) = delete; void operator=(CUDAScanCompaction const&) = delete; void resize(unsigned int newCount, const Type& type, unsigned int streamId); void zero_async(const Type& type, cudaStream_t stream, unsigned int streamId); const CUDAScanCompactionConfig &getConfig(const Type& type, unsigned int streamId); CUDAScanCompactionConfig &Config(const Type& type, unsigned int streamId); private: CUDAScanCompactionConfig configs[MAX_TYPES][MAX_STREAMS]; }; } // namespace detail } // namespace flamegpu #endif // INCLUDE_FLAMEGPU_SIMULATION_DETAIL_CUDASCANCOMPACTION_H_