Menge
Modular Pedestrian Simulation Framework for Research and Development
|
Defines the basic simulator. It is responsible for tracking agents and obstacles as well as initializing such from files. More...
#include <SimulatorBase.h>
Public Member Functions | |
SimulatorBase () | |
Constructs a simulator instance. | |
~SimulatorBase () | |
Destorys a simulator instance. | |
void | doStep () |
Lets the simulator perform a simulation step and updates the two-dimensional _p and two-dimensional velocity of each agent. | |
virtual bool | initSpatialQuery () |
Initalize spatial query structure. | |
virtual void | finalize () |
After all agents and all obstacles have been added to the scene does the work to finish preparing the simulation to be run. More... | |
virtual BaseAgent * | getAgent (size_t agentNo) |
Accessor for agents. More... | |
virtual const BaseAgent * | getAgent (size_t agentNo) const |
Const accessor for agents. More... | |
virtual BaseAgent * | addAgent (const Vector2 &pos, AgentInitializer *agentInit) |
Add an agent with specified position to the simulator whose properties are defined by the given agent initializer. More... | |
virtual size_t | getNumAgents () const |
Returns the count of agents in the simulation. More... | |
virtual bool | hasExpTarget () |
Reports if there are non-common Experiment parameters that this simulator requires in the XML file. More... | |
virtual bool | isExpTarget (const std::string &tagName) |
Reports if the given Experiment attribute tag name belongs to this simulator. More... | |
virtual bool | setExpParam (const std::string ¶mName, const std::string &value) throw ( XMLParamException ) |
Given an Experiment parameter name and value, sets the appropriate simulator parameter. More... | |
Public Member Functions inherited from Menge::Agents::SimulatorInterface | |
SimulatorInterface () | |
Default constructor. | |
virtual | ~SimulatorInterface () |
Destructor. | |
float | getGlobalTime () const |
Returns the global time of the simulation. More... | |
void | setTimeStep (float timeStep) |
Sets the time step of the simulation. More... | |
void | setSubSteps (size_t subSteps) |
Sets the number of intermediate computation sub steps to take. More... | |
float | getTimeStep () const |
Returns the logical time step of the simulation. More... | |
float | getElevation (const BaseAgent *agent) const |
Returns the elevation of the given agent. More... | |
float | getElevation (const Vector2 &point) const |
Returns the elevation of the x-z position. More... | |
void | setElevationInstance (Elevation *elevation) |
Set the elevation instance of the simulator. More... | |
Elevation * | getElevationInstance () |
Set the elevation instance of the simulator. More... | |
bool | hasElevation () const |
Reports if the elevation has been set. More... | |
void | setSpatialQuery (SpatialQuery *spatialQuery) |
Sets the spatial query instance of the simulator. More... | |
SpatialQuery * | getSpatialQuery () |
get the spatial query instance of the simulator. More... | |
bool | hasSpatialQuery () const |
Reports if the spatial query has been set. More... | |
bool | queryVisibility (const Vector2 &point1, const Vector2 &point2, float radius=0.0f) const |
Performs a visibility query between the two specified points with respect to the obstacles. More... | |
size_t | getSubSteps () const |
Reports the number of simulation substeps to take. More... | |
Public Member Functions inherited from Menge::Agents::XMLSimulatorBase | |
XMLSimulatorBase () | |
Constructor. | |
~XMLSimulatorBase () | |
Destructor. | |
SimulatorState * | getInitialState () |
Returns a pointer to the simulator's initial state. More... | |
Protected Member Functions | |
void | computeNeighbors (Agent *agent) |
Computes the neighbors for the given agent. More... | |
Protected Member Functions inherited from Menge::Agents::SimulatorInterface | |
void | updateEffTimeStep () |
Updates the effective time step – how large an actual simulation time step is due to computation sub-steps. | |
Protected Attributes | |
std::vector< Agent > | _agents |
The collection of agents in the simulation. | |
Protected Attributes inherited from Menge::Agents::SimulatorInterface | |
float | _globalTime |
The total accumulated simulation time. | |
Elevation * | _elevation |
Data structure for reporting the elevation data of agents. This allows the simulation to be more than 2D (and more than topologically planar.) | |
SpatialQuery * | _spatialQuery |
The data structure used to perform spatial queries. | |
Protected Attributes inherited from Menge::Agents::XMLSimulatorBase | |
SimulatorState * | _initState |
The initial state of the simulator. | |
Additional Inherited Members | |
Static Protected Attributes inherited from Menge::Agents::SimulatorInterface | |
static float | LOGICAL_TIME_STEP = 0.1f |
The logical simulation time step. The simulation's state is communicated to the outside world at this time step. In practice, sub-steps can decrease the effective time step. | |
static float | TIME_STEP = 0.1f |
The effective simulation time step - takes into account time step and computation sub-steps. | |
static size_t | SUB_STEPS = 0 |
The number of intermediate steps taken between subsequent simulation time steps. | |
Defines the basic simulator. It is responsible for tracking agents and obstacles as well as initializing such from files.
|
virtual |
Add an agent with specified position to the simulator whose properties are defined by the given agent initializer.
It uses the agent initializer to define the values of the remaining agent parameters
pos | The 2d vector representing the agent's position |
agentInit | The AgentInitializer necessary to parse AgentSet properties |
Implements Menge::Agents::XMLSimulatorBase.
|
protected |
Computes the neighbors for the given agent.
agent | The agent whose neighbors are to be computed. |
|
virtual |
After all agents and all obstacles have been added to the scene does the work to finish preparing the simulation to be run.
This work is performed when the simulator is done being initialized. If a particular new pedestrian simulator requires particular finalization work, this function should be sub-classed and the parent class's version of the function should be explicitly called before any additional work is performed.
Reimplemented from Menge::Agents::SimulatorInterface.
|
inlinevirtual |
Accessor for agents.
agentNo | The number of the agent who is to be retrieved. This is not the same as the agent identifier. It is merely the local index of the agent in the simulator's local store. |
Implements Menge::Agents::SimulatorInterface.
|
inlinevirtual |
Const accessor for agents.
agentNo | The number of the agent who is to be retrieved. This is not the same as the agent identifier. It is merely the local index of the agent in the simulator's local store. |
Implements Menge::Agents::SimulatorInterface.
|
inlinevirtual |
Returns the count of agents in the simulation.
Implements Menge::Agents::SimulatorInterface.
|
inlinevirtual |
Reports if there are non-common Experiment parameters that this simulator requires in the XML file.
Reimplemented from Menge::Agents::XMLSimulatorBase.
|
inlinevirtual |
Reports if the given Experiment attribute tag name belongs to this simulator.
tagName | The name of the candidate experiment XML tag. |
Implements Menge::Agents::XMLSimulatorBase.
|
virtual |
Given an Experiment parameter name and value, sets the appropriate simulator parameter.
// TODO: Define the conditions of success/failure.
paramName | A string containing the parameter name for the experiment. |
value | A string containing the value for the parameter. |
Implements Menge::Agents::XMLSimulatorBase.