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 | Static Protected Attributes | List of all members
Menge::Agents::SimulatorInterface Class Referenceabstract

The basic simulator interface required by the fsm. More...

#include <SimulatorInterface.h>

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

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

Detailed Description

The basic simulator interface required by the fsm.

Member Function Documentation

void Menge::Agents::SimulatorInterface::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::XMLSimulatorBase.

Reimplemented in Menge::Agents::SimulatorBase< Agent >.

virtual BaseAgent* Menge::Agents::SimulatorInterface::getAgent ( size_t  agentNo)
pure virtual

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.

Implemented in Menge::Agents::SimulatorBase< Agent >.

virtual const BaseAgent* Menge::Agents::SimulatorInterface::getAgent ( size_t  agentNo) const
pure virtual

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.

Implemented in Menge::Agents::SimulatorBase< Agent >.

float Menge::Agents::SimulatorInterface::getElevation ( const BaseAgent agent) const

Returns the elevation of the given agent.

Parameters
agentThe agent.
Returns
The elevation for the given agent.
float Menge::Agents::SimulatorInterface::getElevation ( const Vector2 point) const

Returns the elevation of the x-z position.

Parameters
pointThe x-z point.
Returns
The elevation at the given point.
Elevation* Menge::Agents::SimulatorInterface::getElevationInstance ( )
inline

Set the elevation instance of the simulator.

Returns
The elevation instance.
float Menge::Agents::SimulatorInterface::getGlobalTime ( ) const
inline

Returns the global time of the simulation.

Returns
The present global time of the simulation (zero initially).
virtual size_t Menge::Agents::SimulatorInterface::getNumAgents ( ) const
pure virtual

Returns the count of agents in the simulation.

Returns
The count of agents in the simulation.

Implemented in Menge::Agents::SimulatorBase< Agent >.

SpatialQuery* Menge::Agents::SimulatorInterface::getSpatialQuery ( )
inlinevirtual

get the spatial query instance of the simulator.

Returns
a pointer to The spatial query object.

Implements Menge::Agents::XMLSimulatorBase.

size_t Menge::Agents::SimulatorInterface::getSubSteps ( ) const
inline

Reports the number of simulation substeps to take.

Returns
The number of substeps to take.
float Menge::Agents::SimulatorInterface::getTimeStep ( ) const
inline

Returns the logical time step of the simulation.

Returns
The present time step of the simulation.
bool Menge::Agents::SimulatorInterface::hasElevation ( ) const
inlinevirtual

Reports if the elevation has been set.

Returns
True if the elevation has been set, false otherwise.

Implements Menge::Agents::XMLSimulatorBase.

bool Menge::Agents::SimulatorInterface::hasSpatialQuery ( ) const
inlinevirtual

Reports if the spatial query has been set.

Returns
True if the elevation has been set, false otherwise.

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.

Parameters
point1The first point of the query.
point2The second point of the query.
radiusThe 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.
Returns
A boolean specifying whether the two points are mutually visible. Returns true when the obstacles have not been processed.
void Menge::Agents::SimulatorInterface::setElevationInstance ( Elevation elevation)
virtual

Set the elevation instance of the simulator.

Parameters
elevationThe elevation object.

Implements Menge::Agents::XMLSimulatorBase.

void Menge::Agents::SimulatorInterface::setSpatialQuery ( SpatialQuery spatialQuery)
virtual

Sets the spatial query instance of the simulator.

Parameters
spatialQueryThe spatial query object.

Implements Menge::Agents::XMLSimulatorBase.

void Menge::Agents::SimulatorInterface::setSubSteps ( size_t  subSteps)
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.

Parameters
subStepsThe number of sub steps to take.
void Menge::Agents::SimulatorInterface::setTimeStep ( float  timeStep)
inline

Sets the time step of the simulation.

Parameters
timeStepThe time step of the simulation. Must be positive.

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