adevs
Public Member Functions | List of all members
adevs::ParSimulator< X, T > Class Template Reference

#include <adevs_par_simulator.h>

Inheritance diagram for adevs::ParSimulator< X, T >:
adevs::AbstractSimulator< X, T >

Public Member Functions

 ParSimulator (Devs< X, T > *model, MessageManager< X > *msg_manager=NULL)
 
 ParSimulator (Devs< X, T > *model, LpGraph &g, MessageManager< X > *msg_manager=NULL)
 
nextEventTime ()
 Get the model's next event time.
 
void execUntil (T stop_time)
 
 ~ParSimulator ()
 
- Public Member Functions inherited from adevs::AbstractSimulator< X, T >
void addEventListener (EventListener< X, T > *l)
 
void removeEventListener (EventListener< X, T > *l)
 Remove an event listener.
 
virtual ~AbstractSimulator ()
 Destructor leaves the model intact.
 
void notify_output_listeners (Devs< X, T > *model, const X &value, T t)
 Notify listeners of an output event.
 
void notify_state_listeners (Atomic< X, T > *model, T t)
 Notify listeners of a state change.
 

Detailed Description

template<class X, class T = double>
class adevs::ParSimulator< X, T >

This is the conservative simulator described in "Building Software for Simulation". Models, network and atomic, can be assigned to specific threads (processors) by calling the setProc() method. The components of a network will inherit its thread assignment. Model's with an explicit assignment must have a positive lookahead. Atomic models that are unassigned, by inheritance or otherwise, must have a positive lookahead and will be assigned randomly to a thread. Note that this simulator does not support dynamic structure models.

Constructor & Destructor Documentation

template<class X , class T >
adevs::ParSimulator< X, T >::ParSimulator ( Devs< X, T > *  model,
MessageManager< X > *  msg_manager = NULL 
)

Create a simulator for the provided model. The Atomic components will be assigned to the preferred processors, or assigned randomly if no preference is given or the preference can not be satisfied. The message manager is used to handle inter-thread events. If msg_manager is NULL, the assignment and copy constructors of output objects are used and their is no explicit cleanup (see the MessageManager documentation). This constructor assumes all to all connection of the processors.

References adevs::LpGraph::addEdge().

template<class X , class T >
adevs::ParSimulator< X, T >::ParSimulator ( Devs< X, T > *  model,
LpGraph g,
MessageManager< X > *  msg_manager = NULL 
)

This constructor accepts a directed graph whose edges tell the simulator which processes feed input to which other processes. For example, a simulator with processors 1, 2, and 3 where 1 -> 2 and 2 -> 3 would have two edges: 1->2 and 2->3.

template<class X , class T >
adevs::ParSimulator< X, T >::~ParSimulator ( )

Deletes the simulator, but leaves the model intact. The model must exist when the simulator is deleted, so delete the model only after the simulator is deleted.

Member Function Documentation

template<class X , class T >
void adevs::ParSimulator< X, T >::execUntil ( stop_time)
virtual

Execute the simulator until the next event time is greater than the specified value. There is no global clock, so this must be the actual time that you want to stop.

Implements adevs::AbstractSimulator< X, T >.


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