diff --git a/include/flamegpu/runtime/environment/HostEnvironmentDirectedGraph.cuh b/include/flamegpu/runtime/environment/HostEnvironmentDirectedGraph.cuh index d8a7db035..602a8903f 100644 --- a/include/flamegpu/runtime/environment/HostEnvironmentDirectedGraph.cuh +++ b/include/flamegpu/runtime/environment/HostEnvironmentDirectedGraph.cuh @@ -22,11 +22,15 @@ class HostEnvironmentDirectedGraph { // So be extra safe with weak ptr std::weak_ptr directed_graph; const cudaStream_t stream; +#ifdef FLAMEGPU_ADVANCED_API + detail::CUDAScatter &scatter; + const unsigned int streamID; +#endif public: class VertexMap; class EdgeMap; - HostEnvironmentDirectedGraph(std::shared_ptr& _directed_graph, cudaStream_t _stream); + HostEnvironmentDirectedGraph(std::shared_ptr& _directed_graph, cudaStream_t _stream, detail::CUDAScatter& _scatter, unsigned int _streamID); // Graph Structure Modifiers /** * Attempts to import edge and vertex data from the specified file diff --git a/src/flamegpu/runtime/environment/HostEnvironment.cu b/src/flamegpu/runtime/environment/HostEnvironment.cu index f7479e6ad..0cd8dd227 100644 --- a/src/flamegpu/runtime/environment/HostEnvironment.cu +++ b/src/flamegpu/runtime/environment/HostEnvironment.cu @@ -115,7 +115,7 @@ void HostEnvironment::exportMacroProperty(const std::string& property_name, cons HostEnvironmentDirectedGraph HostEnvironment::getDirectedGraph(const std::string& name) const { const auto rt = directed_graph_map.find(name); if (rt != directed_graph_map.end()) - return HostEnvironmentDirectedGraph(rt->second, stream); + return HostEnvironmentDirectedGraph(rt->second, stream, scatter, streamID); THROW exception::InvalidGraphName("Directed Graph with name '%s' was not found, " "in HostEnvironment::getDirectedGraph()", name.c_str()); diff --git a/src/flamegpu/runtime/environment/HostEnvironmentDirectedGraph.cu b/src/flamegpu/runtime/environment/HostEnvironmentDirectedGraph.cu index f650cf491..31e74d11f 100644 --- a/src/flamegpu/runtime/environment/HostEnvironmentDirectedGraph.cu +++ b/src/flamegpu/runtime/environment/HostEnvironmentDirectedGraph.cu @@ -7,9 +7,14 @@ #include "flamegpu/io/JSONGraphWriter.h" namespace flamegpu { -HostEnvironmentDirectedGraph::HostEnvironmentDirectedGraph(std::shared_ptr& _directed_graph, const cudaStream_t _stream) +HostEnvironmentDirectedGraph::HostEnvironmentDirectedGraph(std::shared_ptr& _directed_graph, const cudaStream_t _stream, + detail::CUDAScatter& _scatter, const unsigned int _streamID) : directed_graph(_directed_graph) , stream(_stream) +#ifdef FLAMEGPU_ADVANCED_API + , scatter(_scatter) + , streamID(_streamID) +#endif { } void HostEnvironmentDirectedGraph::importGraph(const std::string& in_file) { // Case insensitive ends_with()