Class MessageArray2D::Out

Nested Relationships

This class is a nested type of Class MessageArray2D.

Class Documentation

class flamegpu::MessageArray2D::Out

This class is accessible via DeviceAPI.message_out if MessageArray2D is specified in FLAMEGPU_AGENT_FUNCTION It gives access to functionality for outputting array messages

Public Functions

__device__ inline Out(detail::curve::Curve::NamespaceHash agentfn_hash, detail::curve::Curve::NamespaceHash message_hash, const void *_metadata, unsigned int *scan_flag_messageOutput)

Constructer Initialises member variables

Parameters
  • agentfn_hash – Added to message_hash to produce combined_hash

  • message_hash – Added to agentfn_hash to produce combined_hash

  • _metadata – Message specialisation specific metadata struct (of type MessageArray2D::MetaData)

  • scan_flag_messageOutput – Scan flag array for optional message output

__device__ inline void setIndex(const size_type &x, const size_type &y) const

Sets the array index to store the message in

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

Sets the specified variable for this agents message

Parameters
  • variable_name – Name of the variable

  • value – The value to set the specified variable

Template Parameters
  • T – type of the variable

  • N – Length of variable name (this should be implicit if a string literal is passed to variable name)

Returns

The specified variable, else 0x0 if an error occurs

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 for this agents message

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

  • M – variable_name length, this should be ignored as it is implicitly set

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

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

  • exception::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)

Protected Attributes

detail::curve::Curve::NamespaceHash combined_hash

CURVE hash for accessing message data agentfn_hash + message_hash

unsigned int *scan_flag

Scan flag array for optional message output

const MetaData *const metadata

Metadata struct for accessing messages