Menge
Modular Pedestrian Simulation Framework for Research and Development
|
The basic simulator interface required by the fsm. More...
#include <SimulatorInterface.h>
Public Member Functions | |
SimulatorInterface () | |
Default constructor. | |
virtual | ~SimulatorInterface () |
Destructor. | |
virtual size_t | getNumAgents () const =0 |
Returns the count of agents in the simulation. More... | |
virtual BaseAgent * | getAgent (size_t agentNo)=0 |
Accessor for agents. More... | |
virtual const BaseAgent * | getAgent (size_t agentNo) const =0 |
Const accessor for agents. More... | |
virtual void | doStep ()=0 |
Lets the simulator perform a simulation step and updates the two-dimensional _p and two-dimensional velocity of each agent. | |
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... | |
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. | |
virtual bool | hasExpTarget () |
Reports if there are any target-specific experiment parameters. More... | |
virtual bool | isExpTarget (const std::string &tagName)=0 |
Given the name of a tag which is the child of <Experiment>, reports if it contains target-specific experiment parameters. More... | |
virtual bool | setExpParam (const std::string ¶mName, const std::string &value)=0 throw ( XMLParamException ) |
Given the name of the xml param and its string value, sets the parameter in the simulator. More... | |
virtual BaseAgent * | addAgent (const Vector2 &pos, AgentInitializer *agentInit)=0 |
Add an agent with specified position to the simulator whose properties are defined by the given agent initializer. More... | |
virtual bool | initSpatialQuery ()=0 |
Initalize spatial query structure. | |
SimulatorState * | getInitialState () |
Returns a pointer to the simulator's initial state. More... | |
Protected Member Functions | |
void | updateEffTimeStep () |
Updates the effective time step – how large an actual simulation time step is due to computation sub-steps. | |
Protected Attributes | |
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. | |
Static Protected Attributes | |
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. | |
The basic simulator interface required by the fsm.
|
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::XMLSimulatorBase.
Reimplemented in Menge::Agents::SimulatorBase< Agent >.
|
pure virtual |
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. |
Implemented in Menge::Agents::SimulatorBase< Agent >.
|
pure virtual |
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. |
Implemented in Menge::Agents::SimulatorBase< Agent >.
float Menge::Agents::SimulatorInterface::getElevation | ( | const BaseAgent * | agent | ) | const |
Returns the elevation of the given agent.
agent | The agent. |
float Menge::Agents::SimulatorInterface::getElevation | ( | const Vector2 & | point | ) | const |
Returns the elevation of the x-z position.
point | The x-z point. |
|
inline |
Set the elevation instance of the simulator.
|
inline |
Returns the global time of the simulation.
|
pure virtual |
Returns the count of agents in the simulation.
Implemented in Menge::Agents::SimulatorBase< Agent >.
|
inlinevirtual |
get the spatial query instance of the simulator.
Implements Menge::Agents::XMLSimulatorBase.
|
inline |
Reports the number of simulation substeps to take.
|
inline |
Returns the logical time step of the simulation.
|
inlinevirtual |
Reports if the elevation has been set.
Implements Menge::Agents::XMLSimulatorBase.
|
inlinevirtual |
Reports if the spatial query has been set.
Implements Menge::Agents::XMLSimulatorBase.
bool Menge::Agents::SimulatorInterface::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.
The obstacles are one-sided. So, the ordering of point1 and point2 matter. Looking from the inside out is not equivalent to looking from the outside in.
point1 | The first point of the query. |
point2 | The second point of the query. |
radius | The minimal distance between the line connecting the two points and the obstacles in order for the points to be mutually visible (optional). Must be non-negative. |
|
virtual |
Set the elevation instance of the simulator.
elevation | The elevation object. |
Implements Menge::Agents::XMLSimulatorBase.
|
virtual |
Sets the spatial query instance of the simulator.
spatialQuery | The spatial query object. |
Implements Menge::Agents::XMLSimulatorBase.
|
inline |
Sets the number of intermediate computation sub steps to take.
For the given sim time step, this number of sub steps will be taken. This decreases the effective time step, but the simulation state to the outside world is only reported at the simulation's official time step rate.
subSteps | The number of sub steps to take. |
|
inline |
Sets the time step of the simulation.
timeStep | The time step of the simulation. Must be positive. |