Class DeviceEnvironment

Class Documentation

class DeviceEnvironment

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

Public Functions

template<typename T, unsigned int N>
__device__ __forceinline__ T getProperty(const char (&name)[N]) 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

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

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

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

template<typename T, unsigned int N>
__device__ __forceinline__ T getProperty(const char (&name)[N], const 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 – Length of property name, this should always be implicit if passing a string literal

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

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

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

template<unsigned int N>
__device__ __forceinline__ bool containsProperty(const char (&name)[N]) const

Returns whether the named env property exists

Util

Note

Use of this function is not recommended as it should be unnecessary and will impact performance

Parameters

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

Template Parameters

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