Class HostEnvironment
Defined in File HostEnvironment.cuh
Class Documentation
-
class HostEnvironment
This class provides host function access to Environment Properties It acts as a wrapper to EnvironmentManager, proxying calls, converting variable name and model_name into a combined hash Pairs with EnvironmentManager, AgentEnvironment and EnvironmentDescription This class is only to be constructed by HostAPI
Note
Not thread-safe
Public Functions
-
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 environment property
- Throws:
exception::InvalidEnvProperty – If a property of the name does not exist
-
template<typename T, flamegpu::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 elements of the environment property array
N – Length of the environment property array
- Throws:
exception::InvalidEnvProperty – If a property array of the name does not exist
-
template<typename T, flamegpu::size_type N = 0>
T getProperty(const std::string &name, flamegpu::size_type index) const Gets an element of an environment property array
See also
get(const std::string &)
- Parameters:
name – name used for accessing the property
index – Index of the element within the environment property array to return
- Template Parameters:
T – Type of the elements of the environment property array
N – (Optional) The length of the array variable, available for parity with other APIs, checked if provided
- Throws:
exception::InvalidEnvProperty – If a property of the name does not exist
std::out_of_range –
-
template<typename T>
T setProperty(const std::string &name, T value) const Sets an environment property
Setters
- Parameters:
name – name used for accessing the property
value – to set the property
- Template Parameters:
T – Type of the elements of the environment property
- Throws:
exception::InvalidEnvProperty – If a property of the name does not exist
exception::ReadOnlyEnvProperty – If the named property is marked as const
- 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) const Sets an environment property array
- Parameters:
name – name used for accessing the property array
value – to set the property array
- Template Parameters:
T – Type of the elements of the environment property array
N – Length of the environmental property array
- Throws:
exception::InvalidEnvProperty – If a property of the name does not exist
exception::ReadOnlyEnvProperty – If the named property is marked as const
- Returns:
Returns the previous value
-
template<typename T, flamegpu::size_type N = 0>
T setProperty(const std::string &name, flamegpu::size_type index, T value) const Sets an element of an environment property array
See also
get(const std::string &)
- Parameters:
name – name used for accessing the property array
index – element within the environment property array to set
value – to set the element of the property array
- Template Parameters:
T – Type of the environmental property array
N – (Optional) The length of the array variable, available for parity with other APIs, checked if provided
- Throws:
exception::InvalidEnvProperty – If a property of the name does not exist
std::out_of_range –
- Returns:
Returns the previous value
-
template<typename T, unsigned int I = 1, unsigned int J = 1, unsigned int K = 1, unsigned int W = 1>
HostMacroProperty<T, I, J, K, W> getMacroProperty(const std::string &name) const Returns an interface for accessing the named host macro property
- Parameters:
name – The name of the environment macro property to return
Protected Functions
Constructor, to be called by HostAPI
Protected Attributes
-
const std::shared_ptr<detail::EnvironmentManager> env_mgr
Provides access to EnvironmentManager singleton
-
detail::CUDAMacroEnvironment ¯o_env
Provides access to macro properties for the instance
-
const unsigned int instance_id
Access to instance id of the CUDASimulation This is used to augment all variable names
-
template<typename T>