.. _program_listing_file_src_flamegpu_model_EnvironmentDirectedGraphData.cu: Program Listing for File EnvironmentDirectedGraphData.cu ======================================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/flamegpu/model/EnvironmentDirectedGraphData.cu``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #include "flamegpu/model/EnvironmentDirectedGraphData.cuh" #include #include #include "flamegpu/model/EnvironmentDirectedGraphDescription.cuh" #include "flamegpu/defines.h" namespace flamegpu { EnvironmentDirectedGraphData::EnvironmentDirectedGraphData(const std::shared_ptr &_parent, const std::string& agent_name) : model(_parent->model) , name(agent_name) { vertexProperties.emplace(ID_VARIABLE_NAME, Variable(std::array{ ID_NOT_SET })); edgeProperties.emplace(GRAPH_SOURCE_DEST_VARIABLE_NAME, Variable(std::array{ ID_NOT_SET, ID_NOT_SET })); } EnvironmentDirectedGraphData::EnvironmentDirectedGraphData(const std::shared_ptr &_model, const EnvironmentDirectedGraphData& other) : model(_model) , vertexProperties(other.vertexProperties) , edgeProperties(other.edgeProperties) , name(other.name) { } bool EnvironmentDirectedGraphData::operator==(const EnvironmentDirectedGraphData& rhs) const { if (name == rhs.name && vertexProperties.size() == rhs.vertexProperties.size() && edgeProperties.size() == rhs.edgeProperties.size()) { { // Compare vertex properties for (auto& v : vertexProperties) { auto _v = rhs.vertexProperties.find(v.first); if (_v == rhs.vertexProperties.end()) return false; if (v.second.type_size != _v->second.type_size || v.second.type != _v->second.type || v.second.elements != _v->second.elements) return false; } } { // Compare edge properties for (auto& v : edgeProperties) { auto _v = rhs.edgeProperties.find(v.first); if (_v == rhs.edgeProperties.end()) return false; if (v.second.type_size != _v->second.type_size || v.second.type != _v->second.type || v.second.elements != _v->second.elements) return false; } } return true; } return false; } bool EnvironmentDirectedGraphData::operator!=(const EnvironmentDirectedGraphData& rhs) const { return !operator==(rhs); } } // namespace flamegpu