Skip to content

Commit

Permalink
HackyFix: AgentData::IDType was not visible to RTC compilation of age…
Browse files Browse the repository at this point in the history
…nt functions.

This fix includes AgentData.h, and ifndef's away all the unwanted stuff (most of the header).

Ideally we instead move the typedef to somewhere alone.
  • Loading branch information
Robadob committed Apr 29, 2021
1 parent da0a357 commit 7ae4a88
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions include/flamegpu/model/AgentData.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef INCLUDE_FLAMEGPU_MODEL_AGENTDATA_H_
#define INCLUDE_FLAMEGPU_MODEL_AGENTDATA_H_

#ifndef __CUDACC_RTC__
#include <memory>
#include <unordered_map>
#include <set>
Expand All @@ -17,9 +18,9 @@ struct AgentFunctionData;
* Users should only access that data stored within via an instance of AgentDescription
*/
struct AgentData : std::enable_shared_from_this<AgentData> {
friend class ModelDescription;
friend struct ModelData;
friend class DependencyGraph;
#else
struct AgentData {
#endif
/*
* Type of the internal agent id variable
*/
Expand All @@ -33,6 +34,10 @@ struct AgentData : std::enable_shared_from_this<AgentData> {
* To set an agent's id, the agent must be part of a model which has begun (id's are assigned before initialisation functions)
*/
static constexpr IDType ID_NOT_SET() { return static_cast<IDType>(0); }
#ifndef __CUDACC_RTC__
friend class ModelDescription;
friend struct ModelData;
friend class DependencyGraph;
/**
* Map of name:agent function definition
* map<string, AgentFunctionData>
Expand Down Expand Up @@ -111,6 +116,7 @@ struct AgentData : std::enable_shared_from_this<AgentData> {
* Normal constructor, only to be called by ModelDescription
*/
AgentData(std::shared_ptr<const ModelData> model, const std::string &agent_name);
#endif
};

#endif // INCLUDE_FLAMEGPU_MODEL_AGENTDATA_H_
2 changes: 1 addition & 1 deletion include/flamegpu/runtime/DeviceAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
#include "flamegpu/runtime/utility/AgentRandom.cuh"
#include "flamegpu/runtime/utility/DeviceEnvironment.cuh"
#include "flamegpu/gpu/CUDAScanCompaction.h"
#include "flamegpu/model/AgentData.h"
#include "flamegpu/runtime/AgentFunction.h"
#include "flamegpu/runtime/AgentFunctionCondition.h"
#include "flamegpu/runtime/messaging_device.h"


/**
* @brief FLAMEGPU_API is a singleton class for the device runtime
*
Expand Down

0 comments on commit 7ae4a88

Please sign in to comment.