Class DeviceAPI::AgentOut

Nested Relationships

This class is a nested type of Template Class DeviceAPI.

Class Documentation

class DeviceAPI::AgentOut

Public Functions

__device__ inline AgentOut(const Curve::NamespaceHash &aoh, id_t *&d_agent_output_nextID, unsigned int *&scan_flag_agentOutput)
template<typename T, unsigned int N>
__device__ void setVariable(const char (&variable_name)[N], T value) const

Sets a variable in a new agent to be output after the agent function has completed

Note

Any agent variables not set will remain as their default values

Note

Calling AgentOut::setVariable() or AgentOut::getID() will trigger agent output

Parameters
  • variable_name – The name of the variable

  • value – The value to set the variable

Template Parameters
  • T – The type of the variable, as set within the model description hierarchy

  • NVariable name length, this should be ignored as it is implicitly set

Throws
  • DeviceError – If name is not a valid variable within the agent (flamegpu must be built with SEATBELTS enabled for device error checking)

  • DeviceError – If T is not the type of variable ‘name’ within the agent (flamegpu must be built with SEATBELTS enabled for device error checking)

template<typename T, unsigned int N, unsigned int M>
__device__ void setVariable(const char (&variable_name)[M], const unsigned int &index, T value) const

Sets an element of an array variable in a new agent to be output after the agent function has completed

Note

Any agent variables not set will remain as their default values

Note

Calling AgentOut::setVariable() or AgentOut::getID() will trigger agent output

Parameters
  • variable_name – The name of the array variable

  • index – The index to set within the array variable

  • value – The value to set the element of the array element

Template Parameters
  • T – The type of the variable, as set within the model description hierarchy

  • N – The length of the array variable, as set within the model description hierarchy

  • MVariable name length, this should be ignored as it is implicitly set

Throws
  • DeviceError – If name is not a valid variable within the agent (flamegpu must be built with SEATBELTS enabled for device error checking)

  • DeviceError – If T is not the type of variable ‘name’ within the agent (flamegpu must be built with SEATBELTS enabled for device error checking)

  • DeviceError – If index is out of bounds for the variable array specified by name (flamegpu must be built with SEATBELTS enabled for device error checking)

__device__ id_t getID() const

Return the ID of the agent to be created

Note

Calling AgentOut::setVariable() or AgentOut::getID() will trigger agent output