Class EnvironmentDescription

Class Documentation

class flamegpu::EnvironmentDescription

Description class for environment properties.

Allows environment properties to be prepared and attached to a ModelDescription. Properties can be any arithmetic or enum type. Properties marked as const within the EnvironmentDescription cannot be changed during the simulation

Public Functions

EnvironmentDescription()

Default destruction

bool operator==(const EnvironmentDescription &rhs) const
bool operator!=(const EnvironmentDescription &rhs) const
template<typename T>
void newProperty(const std::string &name, const T &value, const bool &isConst = false)

Adds a new environment property

Constructors

Parameters
  • name – name used for accessing the property

  • value – stored value of the property

  • isConst – If set to true, it is not possible to change the value during the simulation

Template Parameters

T – Type of the environmental property to be created

Throws

exception::DuplicateEnvProperty – If a property of the same name already exists

template<typename T, EnvironmentManager::size_type N>
void newProperty(const std::string &name, const std::array<T, N> &value, const bool &isConst = false)

Adds a new environment property array

Parameters
  • name – Name used for accessing the property

  • value – Stored value of the property

  • isConst – If set to true, it is not possible to change the value during the simulation

Template Parameters
  • T – Type of the environmental property array to be created

  • N – Length of the environmental property array to be created

Throws

exception::DuplicateEnvProperty – If a property of the same name already exists

template<typename T, EnvironmentManager::size_type I = 1, EnvironmentManager::size_type J = 1, EnvironmentManager::size_type K = 1, EnvironmentManager::size_type W = 1>
void newMacroProperty(const std::string &name)

Define a new environment macro property

Environment macro properties are designed for large environment properties, too large of fast constant memory. This means they must instead be stored in slower global memory, however that allows them to be modified during agent functions via a limited set of atomic operations.

Parameters

name – Name of the macro property

Template Parameters
  • T – Type of the macro property

  • I – Length of the first dimension of the macro property, default 1

  • J – Length of the second dimension of the macro property, default 1

  • K – Length of the third dimension of the macro property, default 1

  • W – Length of the fourth dimension of the macro property, default 1

template<typename T>
T getProperty(const std::string &name) const

Gets an environment property

Getters

Parameters

name – name used for accessing the property

Template Parameters

T – Type of the value to be returned

Throws

exception::InvalidEnvProperty – If a property of the name does not exist

template<typename T, EnvironmentManager::size_type N>
std::array<T, N> getProperty(const std::string &name) const

Gets an environment property array

Parameters

name – name used for accessing the property

Template Parameters
  • T – Type of the value to be returned

  • N – Length of the array to be returned

Throws

exception::InvalidEnvProperty – If a property array of the name does not exist

template<typename T>
T getProperty(const std::string &name, const EnvironmentManager::size_type &index) const

Gets an element of an environment property array

Parameters
  • name – name used for accessing the property

  • index – element from the environment property array to return

Template Parameters

T – Type of the value to be returned

Throws
bool getConst(const std::string &name)

Returns whether an environment property is marked as const

Parameters

name – name used for accessing the property

Throws

exception::InvalidEnvProperty – If a property of the name does not exist

template<typename T>
T setProperty(const std::string &name, const T &value)

Sets an environment property

Setters

Parameters
  • name – name used for accessing the property

  • value – value to set the property

Template Parameters

T – Type of the value to be returned

Throws

exception::InvalidEnvProperty – If a property of the name does not exist

Returns

Returns the previous value

template<typename T, EnvironmentManager::size_type N>
std::array<T, N> setProperty(const std::string &name, const std::array<T, N> &value)

Sets an environment property array

Parameters
  • name – name used for accessing the property

  • value – value to set the property

Template Parameters
  • T – Type of the value to be returned

  • N – Length of the array to be returned

Throws

exception::InvalidEnvProperty – If a property of the name does not exist

Returns

Returns the previous value

template<typename T>
T setProperty(const std::string &name, const EnvironmentManager::size_type &index, const T &value)

Sets an element of an environment property array

See

set(const std::string &, const T &value)

Parameters
  • name – name used for accessing the property

  • index – element from the environment property array to set

  • value – value to set the property

Template Parameters

T – Type of the value to be returned

Throws
Returns

Returns the previous value of the environment property array element which has been set

const std::unordered_map<std::string, PropData> getPropertiesMap() const
const std::unordered_map<std::string, MacroPropData> getMacroPropertiesMap() const
struct MacroPropData

Holds all of the properties required to add a value to EnvironmentManager

Public Functions

inline MacroPropData(const std::type_index &_type, const size_t _type_size, const std::array<unsigned int, 4> &_elements)
Parameters
  • _type – The type index of the base type (e.g. typeid(float))

  • _type_size – The size of the base type (e.g. sizeof(float))

  • _elements – Number of elements in each dimension

inline bool operator==(const MacroPropData &rhs) const
inline bool operator!=(const MacroPropData &rhs) const

Public Members

std::type_index type
size_t type_size
std::array<unsigned int, 4> elements
struct PropData

Holds all of the properties required to add a value to EnvironmentManager

Public Functions

inline PropData(const bool &_is_const, const util::Any &_data)
Parameters
  • _is_const – Is the property constant

  • _data – The data to initially fill the property with

inline bool operator==(const PropData &rhs) const
inline bool operator!=(const PropData &rhs) const

Public Members

bool isConst
const util::Any data