Class EnvironmentDescription

Inheritance Relationships

Base Type

Class Documentation

class EnvironmentDescription : public flamegpu::CEnvironmentDescription

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

explicit EnvironmentDescription(std::shared_ptr<EnvironmentData> data)

Constructor, creates an interface to the EnvironmentData Constructors

Parameters:

data – Data store of this environment’s data

EnvironmentDescription(const EnvironmentDescription &other_env) = default

Copy constructor Creates a new interface to the same EnvironmentData/ModelData

EnvironmentDescription(EnvironmentDescription &&other_env) = default
EnvironmentDescription &operator=(const EnvironmentDescription &other_env) = default

Assignment operator Assigns this interface to the same EnvironmentData/ModelData

EnvironmentDescription &operator=(EnvironmentDescription &&other_env) = default
template<typename T>
void newProperty(const std::string &name, T value, 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, flamegpu::size_type N>
void newProperty(const std::string &name, const std::array<T, N> &value, 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, flamegpu::size_type I = 1, flamegpu::size_type J = 1, flamegpu::size_type K = 1, flamegpu::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

EnvironmentDirectedGraphDescription newDirectedGraph(const std::string &graph_name)

Define a new directed graph

Directed graphs are environmental graph structures which can hold properties on their vertices and edges Agent’s can traverse the graph structure and assign messages to the graph using related communication strategies

Parameters:

graph_name – The name used to refer to the graph throughout the model

EnvironmentDirectedGraphDescription getDirectedGraph(const std::string &graph_name)

Returns an existing directed graph

Directed graphs are environmental graph structures which can hold properties on their vertices and edges Agent’s can traverse the graph structure and assign messages to the graph using related communication strategies

Parameters:

graph_name – The name used to refer to the graph throughout the model

template<typename T>
T setProperty(const std::string &name, 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, flamegpu::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, flamegpu::size_type index, T value)

Sets an element of an environment property array

See also

set(const std::string &, 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:
  • exception::InvalidEnvProperty – If a property of the name does not exist

  • std::out_of_range

Returns:

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