Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Menge::Agents::SimulatorBase< Agent > Class Template Reference

Defines the basic simulator. It is responsible for tracking agents and obstacles as well as initializing such from files. More...

#include <SimulatorBase.h>

Inheritance diagram for Menge::Agents::SimulatorBase< Agent >:
Menge::Agents::SimulatorInterface Menge::Agents::XMLSimulatorBase ORCA::Simulator PedVO::Simulator

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 BaseAgentgetAgent (size_t agentNo)
 Accessor for agents. More...
 
virtual const BaseAgentgetAgent (size_t agentNo) const
 Const accessor for agents. More...
 
virtual BaseAgentaddAgent (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 &paramName, 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...
 
ElevationgetElevationInstance ()
 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...
 
SpatialQuerygetSpatialQuery ()
 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.
 
SimulatorStategetInitialState ()
 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.
 

Detailed Description

template<class Agent>
class Menge::Agents::SimulatorBase< Agent >

Defines the basic simulator. It is responsible for tracking agents and obstacles as well as initializing such from files.

Member Function Documentation

template<class Agent >
BaseAgent * Menge::Agents::SimulatorBase< Agent >::addAgent ( const Vector2 pos,
AgentInitializer agentInit 
)
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

Parameters
posThe 2d vector representing the agent's position
agentInitThe AgentInitializer necessary to parse AgentSet properties
Returns
A pointer to the agent (if initialization was succesful) or NULL if failed.

Implements Menge::Agents::XMLSimulatorBase.

template<class Agent >
void Menge::Agents::SimulatorBase< Agent >::computeNeighbors ( Agent *  agent)
protected

Computes the neighbors for the given agent.

Parameters
agentThe agent whose neighbors are to be computed.
template<class Agent >
void Menge::Agents::SimulatorBase< Agent >::finalize ( )
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.

template<class Agent >
virtual BaseAgent* Menge::Agents::SimulatorBase< Agent >::getAgent ( size_t  agentNo)
inlinevirtual

Accessor for agents.

Parameters
agentNoThe 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.
Returns
A pointer to the agent.

Implements Menge::Agents::SimulatorInterface.

template<class Agent >
virtual const BaseAgent* Menge::Agents::SimulatorBase< Agent >::getAgent ( size_t  agentNo) const
inlinevirtual

Const accessor for agents.

Parameters
agentNoThe 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.
Returns
A pointer to the agent.

Implements Menge::Agents::SimulatorInterface.

template<class Agent >
virtual size_t Menge::Agents::SimulatorBase< Agent >::getNumAgents ( ) const
inlinevirtual

Returns the count of agents in the simulation.

Returns
The count of agents in the simulation.

Implements Menge::Agents::SimulatorInterface.

template<class Agent >
virtual bool Menge::Agents::SimulatorBase< Agent >::hasExpTarget ( )
inlinevirtual

Reports if there are non-common Experiment parameters that this simulator requires in the XML file.

Returns
By default, the simulator base ONLY uses common parameters. Always returns false.

Reimplemented from Menge::Agents::XMLSimulatorBase.

template<class Agent >
virtual bool Menge::Agents::SimulatorBase< Agent >::isExpTarget ( const std::string &  tagName)
inlinevirtual

Reports if the given Experiment attribute tag name belongs to this simulator.

Parameters
tagNameThe name of the candidate experiment XML tag.
Returns
By default, the simulator base ONLY uses common parameters. Always returns false.

Implements Menge::Agents::XMLSimulatorBase.

template<class Agent >
bool Menge::Agents::SimulatorBase< Agent >::setExpParam ( const std::string &  paramName,
const std::string &  value 
)
throw (XMLParamException
)
virtual

Given an Experiment parameter name and value, sets the appropriate simulator parameter.

// TODO: Define the conditions of success/failure.

Parameters
paramNameA string containing the parameter name for the experiment.
valueA string containing the value for the parameter.
Returns
True if the parameter was successfully set, false otherwise.

Implements Menge::Agents::XMLSimulatorBase.


The documentation for this class was generated from the following file: