.. _program_listing_file_include_flamegpu_runtime_detail_curve_curve_rtc.cuh: Program Listing for File curve_rtc.cuh ====================================== |exhale_lsh| :ref:`Return to documentation for file ` (``include/flamegpu/runtime/detail/curve/curve_rtc.cuh``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef INCLUDE_FLAMEGPU_RUNTIME_DETAIL_CURVE_CURVE_RTC_CUH_ #define INCLUDE_FLAMEGPU_RUNTIME_DETAIL_CURVE_CURVE_RTC_CUH_ #include #include #include #include #include #include #include #include #include "flamegpu/util/StringPair.h" namespace jitify { namespace experimental { class KernelInstantiation; } // namespace experimental } // namespace jitify namespace flamegpu { namespace detail { namespace curve { class CurveRTCHost { public: CurveRTCHost(); ~CurveRTCHost(); void registerAgentVariable(const char* variableName, const char* type, size_t type_size, unsigned int elements = 1, bool read = true, bool write = true); void registerMessageOutVariable(const char* variableName, const char* type, size_t type_size, unsigned int elements = 1, bool read = true, bool write = true); void registerMessageInVariable(const char* variableName, const char* type, size_t type_size, unsigned int elements = 1, bool read = true, bool write = true); void registerNewAgentVariable(const char* variableName, const char* type, size_t type_size, unsigned int elements = 1, bool read = true, bool write = true); void registerEnvironmentDirectedGraphVertexProperty(const std::string& graphName, const std::string& propertyName, const char* type, size_t type_size, unsigned int elements = 1, bool read = true, bool write = false); void registerEnvironmentDirectedGraphEdgeProperty(const std::string &graphName, const std::string &propertyName, const char* type, size_t type_size, unsigned int elements = 1, bool read = true, bool write = false); void unregisterAgentVariable(const char* variableName); void unregisterMessageOutVariable(const char* variableName); void unregisterMessageInVariable(const char* variableName); void unregisterNewAgentVariable(const char* variableName); void unregisterEnvironmentDirectedGraphVertexProperty(const std::string& graphName, const std::string& propertyName); void unregisterEnvironmentDirectedGraphEdgeProperty(const std::string& graphName, const std::string& propertyName); void* getAgentVariableCachePtr(const char* variableName); void* getMessageOutVariableCachePtr(const char* variableName); void* getMessageInVariableCachePtr(const char* variableName); void* getNewAgentVariableCachePtr(const char* variableName); void* getEnvironmentDirectedGraphVertexPropertyCachePtr(const std::string& graphName, const std::string& propertyName); void* getEnvironmentDirectedGraphEdgePropertyCachePtr(const std::string& graphName, const std::string& propertyName); void setAgentVariableCount(const std::string& variableName, unsigned int count); void setMessageOutVariableCount(const std::string& variableName, unsigned int count); void setMessageInVariableCount(const std::string& variableName, unsigned int count); void setNewAgentVariableCount(const std::string& variableName, unsigned int count); void setEnvironmentDirectedGraphVertexPropertyCount(const std::string& graphName, const std::string& propertyName, unsigned int count); void setEnvironmentDirectedGraphEdgePropertyCount(const std::string& graphName, const std::string& propertyName, unsigned int count); void registerEnvVariable(const char* propertyName, ptrdiff_t offset, const char* type, size_t type_size, unsigned int elements = 1); void unregisterEnvVariable(const char* propertyName); void registerEnvMacroProperty(const char* propertyName, void* d_ptr, const char* type, size_t type_size, const std::array& dimensions); void unregisterEnvMacroProperty(const char* propertyName); void registerAgent(const std::string &agentName, const std::string &agentState); void setFileName(const std::string& filename); std::string getDynamicHeader(size_t env_buffer_len); static std::string getVariableSymbolName(); static std::string demangle(const char* verbose_name); static std::string demangle(const std::type_index& type); void updateEnvCache(const void* d_env_ptr, const size_t bufferLen); void updateDevice_async(const jitify::experimental::KernelInstantiation& instance, cudaStream_t stream); protected: void setHeaderPlaceholder(std::string placeholder, std::string dst); struct RTCVariableProperties { std::string type; bool read; bool write; unsigned int elements; size_t type_size; void *h_data_ptr; unsigned int count_index; }; struct RTCEnvVariableProperties { std::string type; unsigned int elements; ptrdiff_t offset; size_t type_size; }; struct RTCEnvMacroPropertyProperties { std::string type; std::array dimensions; size_t type_size; void* d_ptr; void* h_data_ptr; }; private: void initHeaderEnvironment(size_t env_buffer_len); void initHeaderSetters(); void initHeaderGetters(); void initDataBuffer(); std::string header; static const char* curve_rtc_dynamic_h_template; size_t agent_data_offset = 0; size_t messageOut_data_offset = 0; size_t messageIn_data_offset = 0; size_t newAgent_data_offset = 0; size_t directedGraphVertex_data_offset = 0; size_t directedGraphEdge_data_offset = 0; size_t envMacro_data_offset = 0; size_t count_data_offset = 0; size_t data_buffer_size = 0; char * h_data_buffer = nullptr; std::map agent_variables; std::map messageOut_variables; std::map messageIn_variables; std::map newAgent_variables; util::StringPairMap directedGraph_vertexProperties; util::StringPairMap directedGraph_edgeProperties; std::map RTCEnvVariables; std::map RTCEnvMacroProperties; std::vector count_buffer; std::string agentName; std::string agentState; }; } // namespace curve } // namespace detail } // namespace flamegpu #endif // INCLUDE_FLAMEGPU_RUNTIME_DETAIL_CURVE_CURVE_RTC_CUH_