Class MessageArray3D::In

Class Documentation

class flamegpu::MessageArray3D::In

This class is accessible via DeviceAPI.message_in if MessageArray3D is specified in FLAMEGPU_AGENT_FUNCTION It gives access to functionality for reading three dimensional array messages

Public Functions

__device__ inline In(detail::curve::Curve::NamespaceHash agentfn_hash, detail::curve::Curve::NamespaceHash message_hash, const void *_metadata)

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 – Reinterpreted as type MessageArray3D::MetaData

__device__ inline WrapFilter wrap(const size_type &x, const size_type &y, const size_type &z, const size_type &radius = 1) const

Returns a WrapFilter object which provides access to message iterator for iterating a subset of messages including those within the radius of the search origin this excludes the message at the search origin The radius will wrap over environment bounds

Note

radius 1 is 26 cells in 3x3x3

Note

radius 2 is 124 cells in 5x5x5

Note

radius which produce a message read dimension (radius*2 + 1) greater than one of the message list dimensions are unsupported

Note

radius of 0 is unsupported

Note

The location [x, y, z] must be within the bounds of the message list

Parameters
  • x – Search origin x coord

  • y – Search origin y coord

  • z – Search origin y coord

  • radius – Search radius

__device__ inline Filter operator()(const size_type &x, const size_type &y, const size_type &z, const size_type &radius = 1) const

Returns a Filter object which provides access to message iterator for iterating a subset of messages including those within the radius of the search origin this excludes the message at the search origin The radius will not wrap over environment bounds

Note

radius 1 is 26 cells in 3x3x3

Note

radius 2 is 124 cells in 5x5x5

Note

radius of 0 is unsupported

Note

The location [x, y, z] must be within the bounds of the message list

Parameters
  • x – Search origin x coord

  • y – Search origin y coord

  • z – Search origin y coord

  • radius – Search radius

__device__ inline size_type getDimX() const

Returns the x dimension size of the message list

__device__ inline size_type getDimY() const

Returns the y dimension size of the message list

__device__ inline size_type getDimZ() const

Returns the z dimension size of the message list

__device__ inline size_type size(void) const

Returns the length of the message list. xDim x yDim x zDim

__device__ inline Message at(const size_type &x, const size_type &y, const size_type &z) const
class Filter

This class is created when a search origin is provided to MessageArray2D::In::operator()(size_type, size_type, size_type = 1) It provides iterator access to a subset of the full message list, according to the provided search origin and radius The radius does not wrap the message list bounds

See

MessageArray2D::In::operator()(size_type, size_type, size_type)

Public Functions

__device__ inline Filter(const MetaData *_metadata, const detail::curve::Curve::NamespaceHash &_combined_hash, const size_type &x, const size_type &y, const size_type &z, const size_type &_radius)

Constructor, takes the search parameters required

Parameters
  • _metadata – Pointer to message list metadata

  • _combined_hash – agentfn+message hash for accessing message data

  • x – Search origin x coord

  • y – Search origin y coord

  • z – Search origin z coord

  • _radius – Search radius

__device__ inline iterator begin(void) const

Returns an iterator to the start of the message list subset about the search origin

__device__ inline iterator end(void) const

Returns an iterator to the position beyond the end of the message list subset

Note

This iterator is the same for all message list subsets

class iterator

Stock iterator for iterating MessageSpatial3D::In::Filter::Message objects

Public Functions

__device__ inline iterator(const Filter &parent, const int &relative_x, const int &relative_y, const int &relative_z)

Constructor This iterator is constructed by MessageArray3D::In::Filter::begin()(size_type, size_type, size_type, size_type)

See

MessageArray3D::In::Operator()(size_type, size_type, size_type, size_type)

__device__ inline iterator &operator++()

Moves to the next message (Prefix increment operator)

__device__ inline iterator operator++(int)

Moves to the next message (Postfix increment operator, returns value prior to increment)

__device__ inline bool operator==(const iterator &rhs) const

Equality operator Compares message

__device__ inline bool operator!=(const iterator &rhs) const

Inequality operator Compares message

__device__ inline Message &operator*()

Dereferences the iterator to return the message object, for accessing variables

__device__ inline Message *operator->()

Dereferences the iterator to return the message object, for accessing variables

class Message

Provides access to a specific message Returned by the iterator

See

In::Filter::iterator

Public Functions

__device__ inline Message(const Filter &parent, const int &relative_x, const int &relative_y, const int &relative_z)

Constructs a message and directly initialises all of it’s member variables

Note

See member variable documentation for their purposes

__device__ inline bool operator==(const Message &rhs) const

Equality operator Compares all internal member vars for equality

Note

Does not compare _parent

__device__ inline bool operator!=(const Message &rhs) const

Inequality operator Returns inverse of equality operator

See

operator==(const Message&)

__device__ inline Message &operator++()

Updates the message to return variables from the next cell in the Moore neighbourhood

Returns

Returns itself

__device__ inline size_type getX() const

Returns x array index of message

__device__ inline size_type getY() const

Returns y array index of message

__device__ inline size_type getZ() const

Returns z array index of message

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

Returns the value for the current message attached to the named variable

Parameters

variable_name – Name of the 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, MessageNone::size_type N, unsigned int M>
__device__ T getVariable(const char (&variable_name)[M], const unsigned int &index) const

Returns the specified variable array element from the current message attached to the named variable

Parameters
  • variable_name – name used for accessing the variable, this value should be a string literal e.g. “foobar”

  • index – Index of the element within the variable array to return

Template Parameters
  • T – Type of the message variable being accessed

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

  • M – Length of variable_name, this should always be implicit if passing a string literal

Throws
  • exception::DeviceError – If name is not a valid variable within the agent (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)

class Message

Provides access to a specific message Returned by In::at(size_type)

See

In::at(size_type)

Public Functions

__device__ inline Message(const MessageArray3D::In &parent, const size_type &_index)

Constructs a message and directly initialises all of it’s member variables index is always init to 0

Note

See member variable documentation for their purposes

__device__ inline bool operator==(const Message &rhs) const

Equality operator Compares all internal member vars for equality

Note

Does not compare _parent

__device__ inline bool operator!=(const Message &rhs) const

Inequality operator Returns inverse of equality operator

See

operator==(const Message&)

__device__ inline size_type getIndex() const

Returns the index of the message within the full message list

template<typename T, size_type N>
__device__ T getVariable(const char (&variable_name)[N]) const

Returns the value for the current message attached to the named variable

Parameters

variable_name – Name of the 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, MessageNone::size_type N, unsigned int M>
__device__ T getVariable(const char (&variable_name)[M], const unsigned int &index) const

Returns the specified variable array element from the current message attached to the named variable

Parameters
  • variable_name – name used for accessing the variable, this value should be a string literal e.g. “foobar”

  • index – Index of the element within the variable array to return

Template Parameters
  • T – Type of the message variable being accessed

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

  • M – Length of variable_name, this should always be implicit if passing a string literal

Throws
  • exception::DeviceError – If name is not a valid variable within the agent (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)

class WrapFilter

This class is created when a search origin is provided to MessageArray2D::In::operator()(size_type, size_type, size_type = 1) It provides iterator access to a subset of the full message list, according to the provided search origin and radius The radius wraps the message list bounds

See

MessageArray2D::In::wrap()(size_type, size_type, size_type)

Public Functions

__device__ inline WrapFilter(const MetaData *_metadata, const detail::curve::Curve::NamespaceHash &_combined_hash, const size_type &x, const size_type &y, const size_type &z, const size_type &_radius)

Constructor, takes the search parameters required

Parameters
  • _metadata – Pointer to message list metadata

  • _combined_hash – agentfn+message hash for accessing message data

  • x – Search origin x coord

  • y – Search origin y coord

  • z – Search origin z coord

  • _radius – Search radius

__device__ inline iterator begin(void) const

Returns an iterator to the start of the message list subset about the search origin

__device__ inline iterator end(void) const

Returns an iterator to the position beyond the end of the message list subset

Note

This iterator is the same for all message list subsets

class iterator

Stock iterator for iterating MessageSpatial3D::In::WrapFilter::Message objects

Public Functions

__device__ inline iterator(const WrapFilter &parent, const int &relative_x, const int &relative_y, const int &relative_z)

Constructor This iterator is constructed by MessageArray3D::In::WrapFilter::begin()(size_type, size_type, size_type, size_type)

See

MessageArray3D::In::wrap(size_type, size_type, size_type, size_type)

__device__ inline iterator &operator++()

Moves to the next message (Prefix increment operator)

__device__ inline iterator operator++(int)

Moves to the next message (Postfix increment operator, returns value prior to increment)

__device__ inline bool operator==(const iterator &rhs) const

Equality operator Compares message

__device__ inline bool operator!=(const iterator &rhs) const

Inequality operator Compares message

__device__ inline Message &operator*()

Dereferences the iterator to return the message object, for accessing variables

__device__ inline Message *operator->()

Dereferences the iterator to return the message object, for accessing variables

class Message

Provides access to a specific message Returned by the iterator

See

In::WrapFilter::iterator

Public Functions

__device__ inline Message(const WrapFilter &parent, const int &relative_x, const int &relative_y, const int &relative_z)

Constructs a message and directly initialises all of it’s member variables

Note

See member variable documentation for their purposes

__device__ inline bool operator==(const Message &rhs) const

Equality operator Compares all internal member vars for equality

Note

Does not compare _parent

__device__ inline bool operator!=(const Message &rhs) const

Inequality operator Returns inverse of equality operator

See

operator==(const Message&)

__device__ inline Message &operator++()

Updates the message to return variables from the next cell in the Moore neighbourhood

Returns

Returns itself

__device__ inline size_type getX() const

Returns x array index of message

__device__ inline size_type getY() const

Returns y array index of message

__device__ inline size_type getZ() const

Returns z array index of message

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

Returns the value for the current message attached to the named variable

Parameters

variable_name – Name of the 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, MessageNone::size_type N, unsigned int M>
__device__ T getVariable(const char (&variable_name)[M], const unsigned int &index) const

Returns the specified variable array element from the current message attached to the named variable

Parameters
  • variable_name – name used for accessing the variable, this value should be a string literal e.g. “foobar”

  • index – Index of the element within the variable array to return

Template Parameters
  • T – Type of the message variable being accessed

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

  • M – Length of variable_name, this should always be implicit if passing a string literal

Throws
  • exception::DeviceError – If name is not a valid variable within the agent (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)