Class AgentInterface

Inheritance Relationships

Derived Type

Class Documentation

class AgentInterface

Base-class (interface) for classes like CUDAAgent, which provide access to agent data

Subclassed by flamegpu::detail::CUDAAgent

Public Functions

virtual ~AgentInterface() = default
virtual CAgentDescription getAgentDescription() const = 0
virtual void *getStateVariablePtr(const std::string &state_name, const std::string &variable_name) = 0
virtual flamegpu::size_type getStateSize(const std::string &state_name) const = 0
virtual id_t nextID(unsigned int count) = 0

Returns the next free agent id, and increments the ID tracker by the specified count

Parameters:

count – Number that will be added to the return value on next call to this function

Returns:

An ID that can be assigned to an agent that wil be stored within this Agent collection

virtual void setPopulationVec(const std::string &state_name, const std::shared_ptr<DeviceAgentVector_impl> &d_vec) = 0

Used to allow HostAgentAPI to store a persistent DeviceAgentVector

Note

The presence of this inside AgentInterface is questionable, and should be made more generic in future if HostSimulation is created

Parameters:
  • state_name – Agent state to affect

  • d_vec – The DeviceAgentVector to be stored

virtual std::shared_ptr<DeviceAgentVector_impl> getPopulationVec(const std::string &state_name) = 0

Used to allow HostAgentAPI to retrieve a stored DeviceAgentVector

Note

The presence of this inside AgentInterface is questionable, and should be made more generic in future if HostSimulation is created

Parameters:

state_name – Agent state to affect

virtual void resetPopulationVecs() = 0

Used to allow HostAgentAPI to clear the stored DeviceAgentVector Any changes will be synchronised first

Note

The presence of this inside AgentInterface is questionable, and should be made more generic in future if HostSimulation is created