Class SubModelDescription

Inheritance Relationships

Base Type

Class Documentation

class flamegpu::SubModelDescription : public flamegpu::DependencyNode

This class provides an interface to a mapping between the parent and sub-model

Public Functions

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

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
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

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

const SubAgentDescription &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

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_props = false)

Returns an interface for configuring mapped environment properties

Parameters

auto_map_props – If true is passed, all properties with matching name, type and length between models will be mapped

const SubEnvironmentDescription &getSubEnvironment(bool auto_map_props = false) const

Returns an immutable interface for viewing the configuration of mapped environment properties

Parameters

auto_map_props – If true is passed, all properties with matching name, type and length between models will be mapped

void setMaxSteps(const 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

unsigned int getMaxSteps() const

Return the current value of max steps, defaults to 0 This is the maximum number of steps per call of the submodel 0 is unlimited, however requires the model to have an exit condition

const std::string getName()