Class SubModelDescription
Defined in File SubModelDescription.h
Inheritance Relationships
Base Type
public flamegpu::CSubModelDescription
(Class CSubModelDescription)
Class Documentation
-
class SubModelDescription : public flamegpu::CSubModelDescription
This class provides an interface to a mapping between the parent and sub-model
Public Functions
Constructor, creates an interface to the SubModelData Constructors
- Parameters:
data – Data store of this agent’s data
-
SubModelDescription(const SubModelDescription &other_agent) = default
Copy constructor Creates a new interface to the same SubModelData/ModelData
-
SubModelDescription(SubModelDescription &&other_agent) = default
-
SubModelDescription &operator=(const SubModelDescription &other_agent) = default
Assignment operator Assigns this interface to the same SubModelData/ModelData
-
SubModelDescription &operator=(SubModelDescription &&other_agent) = default
-
SubAgentDescription bindAgent(const std::string &sub_agent_name, const std::string &master_agent_name, bool auto_map_vars = false, bool auto_map_states = true)
Defines which agent from the parent/master model will be mapped to which agent in the submodel Only 1 master agent can be bound to each sub agent, however the same master agent can be bound to many sub agents Binding an agent to a subagent, ensures the population of subagents is always the same size. Furthermore, agent variables can be mapped so that they are shared between the two agents. Returns SubAgentDescription
which can be used to manually map variables If auto_map_vars is enabled, variables with matching name, type and length will be automatically mapped
Accessors
- Parameters:
sub_agent_name – Name of the agent in the submodel (must be unique, 1 bind per subagent)
master_agent_name – Name of the agent in the parent/host/master model
auto_map_vars – Whether to automatically map matching variables of the two agents
auto_map_states – Whether to automatically map matching states of the two agents
- Throws:
exception::InvalidSubAgentName – If the sub agent name does not map to a valid agent
exception::InvalidAgentName – If the master agent has already been bound
exception::InvalidSubAgentName – If the sub agent name does not map to a valid agent
exception::InvalidAgentName – If the master agent has already been bound
-
SubAgentDescription SubAgent(const std::string &sub_agent_name)
Returns a mutable reference to the named SubAgent description if it has already been bound to a master agent
See also
SubModelDescription::getSubAgent(const std::string &) for the immutable version
- Parameters:
sub_agent_name – Name of the sub agent, who’s description to return
- Throws:
exception::InvalidSubAgentName – If the sub_agent_name does not exist within the sub_model and/or has not been bound yet
- Returns:
A mutable reference to the named SubAgent description
-
CSubAgentDescription getSubAgent(const std::string &sub_agent_name) const
Returns an immutable reference to the named SubAgent description if it has already been bound to a master agent
See also
SubModelDescription::SubAgent(const std::string &) for the mutable version
- Parameters:
sub_agent_name – Name of the sub agent, who’s description to return
- Throws:
exception::InvalidSubAgentName – If the sub_agent_name does not exist within the sub_model and/or has not been bound yet
- Returns:
An immutable reference to the named SubAgent description
-
SubEnvironmentDescription SubEnvironment(bool auto_map = false)
Returns an interface for configuring mapped environment properties
- Parameters:
auto_map – If true is passed, all properties and macro properties with matching name, type and length between models will be mapped
-
CSubEnvironmentDescription getSubEnvironment() const
Returns an immutable interface for viewing the configuration of mapped environment properties
-
void setMaxSteps(unsigned int max_steps)
Set the maximum number of steps per execution of the submodel If 0 (default), unlimited however an exit condition is required