Class ReadOnlyDeviceEnvironment

Inheritance Relationships

Derived Type

Class Documentation

class ReadOnlyDeviceEnvironment

Utility for accessing environmental properties These can only be read within agent functions They can be set and updated within host functions

Subclassed by flamegpu::DeviceEnvironment

Public Functions

template<typename T, unsigned int M>
__device__ __forceinline__ T getProperty(const char (&name)[M]) const

Gets an environment property

Getters

Parameters:

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

Template Parameters:
  • T – Type of the environment property being accessed

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

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

  • exception::DeviceError – If T is not the type of the environment property specified by name (flamegpu must be built with FLAMEGPU_SEATBELTS enabled for device error checking)

template<typename T, unsigned int N = 0, unsigned int M>
__device__ __forceinline__ T getProperty(const char (&name)[M], unsigned int index) const

Gets an element of an environment property array

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

  • index – Index of the element within the environment property array to return

Template Parameters:
  • T – Type of the environment property being accessed

  • N – (Optional) Length of the environment property array, available for parity with other APIs, checked if provided

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

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

  • exception::DeviceError – If T is not the type of the environment property specified by name (flamegpu must be built with FLAMEGPU_SEATBELTS enabled for device error checking)

  • exception::DeviceError – If index is out of bounds for the environment property array specified by name (flamegpu must be built with FLAMEGPU_SEATBELTS enabled for device error checking)

  • exception::DeviceError – If N does not match the length of the environment property array specified by name (flamegpu must be built with FLAMEGPU_SEATBELTS enabled for device error checking)

template<typename T, unsigned int I = 1, unsigned int J = 1, unsigned int K = 1, unsigned int W = 1, unsigned int M>
__device__ __forceinline__ ReadOnlyDeviceMacroProperty<T, I, J, K, W> getMacroProperty(const char (&name)[M]) const

Returns a read-only accessor to the named macro property

Parameters:

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

Template Parameters:
  • I – Length of macro property in the 1st dimension, default 1

  • J – Length of macro property in the 2nd dimension, default 1

  • K – Length of macro property in the 3rd dimension, default 1

  • W – Length of macro property in the 4th dimension, default 1

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

template<unsigned int M>
__device__ __forceinline__ DeviceEnvironmentDirectedGraph getDirectedGraph(const char (&name)[M]) const

Returns a read-only accessor to the named directed graph

Parameters:

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

Template Parameters:

M – Length of variable name, this should always be implicit if passing a string literal

template<typename T, unsigned int I, unsigned int J, unsigned int K, unsigned int W, unsigned int N>
__device__ __forceinline__ ReadOnlyDeviceMacroProperty<T, I, J, K, W> getMacroProperty(const char (&name)[N]) const