VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Attributes
DtMultiVehicleFed Class Reference

multiVehicleFed.h More...

+ Collaboration diagram for DtMultiVehicleFed:

Public Types

enum  mode { PARALLEL = 1, SERIAL = 2 }

Public Member Functions

 DtMultiVehicleFed ()
 Constructor.
virtual ~DtMultiVehicleFed ()
 Pure Virtual destructor.
void initializeExConn (DtTime theTimeOutInterval, DtF18Initializer *initializer)
void initializeFleet (int appNumOffset, int theNumVehicles, const DtF18Initializer *initializer)
void drainInput (double tMaxRealElapsed)
void simulate ()
void publish ()
void sleep (double deltaTime)
void dismantleFleet ()
void dismantleExConn ()
void setExecutionMode (mode theMode)
mode executionMode () const

Protected Member Functions

DtVehicleSimvehicleFactory (int num, int appNumOffset, const DtF18Initializer *initializer, DtObjectPublisherContainer &pubContainer)
void processDetonation (const DtDetonationInteraction *theDetonation)

Static Protected Member Functions

static void theDetonationCb (DtDetonationInteraction *theDetonation, void *theUserData)

Private Attributes

mode myMode
DtTime mySimTime
DtClockmyClock
DtExerciseConnmyExConn
DtReflectedEntityListrel
DtParallelExecutionContainer
< DtVehicleSim
mySimulatedVehicles
DtObjectPublisherContainer myPublishedObjects

Detailed Description

multiVehicleFed.h

This example describes two ways to exploit parallel execution.

1.The general purpose DtParallelExecutionContainer<> which executes a member method on all objects in the container in parallel, and waits for all to complete. Because the specified method will be called from multiple threads, that method must be carefully designed, for example it should be careful when writing or reading variables used by other threads (or avoid this completely if possible).

  1. DtPublisherContainer which calls tick() or forceUpdate() on all contained DtObjectPublisher objects. This assumes those methods are thread safe. DtPublisherContainer is simply a convenient specialization of DtParallelExecutionContainer.

CAUTION - the containers themselves are NOT thread safe, and you MUST NOT MODIFY the contents of these containers WHILE THEY'RE EXECUTING a method in parallel. Instead, use a thread safe collection to hold the modifications (e.g. concurrent_vector from the Intel Thread Building Blocks, already included with VR Link), then copy that collection into a DtParallelExecutionContainer or DtPublisherContainer.

These two containers may be used at the descretion of the application designer as needed, in any combination. This example could be written with a single DtParallelExecutionContainer<DtVehicleSim>.

This example may be switched between parallel and serial execution for comparison or debugging using setExecutionMode().A DtMultiVehicleFed object corresponds to a single simulation with one or more simulated vehicles.

Member Enumeration Documentation

Enumerator:
PARALLEL 
SERIAL 

Constructor & Destructor Documentation

DtMultiVehicleFed::DtMultiVehicleFed ( )

Constructor.

virtual DtMultiVehicleFed::~DtMultiVehicleFed ( )
virtual

Pure Virtual destructor.

Member Function Documentation

void DtMultiVehicleFed::dismantleExConn ( )
void DtMultiVehicleFed::dismantleFleet ( )
void DtMultiVehicleFed::drainInput ( double  tMaxRealElapsed)
mode DtMultiVehicleFed::executionMode ( ) const
void DtMultiVehicleFed::initializeExConn ( DtTime  theTimeOutInterval,
DtF18Initializer initializer 
)
void DtMultiVehicleFed::initializeFleet ( int  appNumOffset,
int  theNumVehicles,
const DtF18Initializer initializer 
)
void DtMultiVehicleFed::processDetonation ( const DtDetonationInteraction theDetonation)
protected
void DtMultiVehicleFed::publish ( )
void DtMultiVehicleFed::setExecutionMode ( mode  theMode)
void DtMultiVehicleFed::simulate ( )
void DtMultiVehicleFed::sleep ( double  deltaTime)
static void DtMultiVehicleFed::theDetonationCb ( DtDetonationInteraction theDetonation,
void *  theUserData 
)
staticprotected
DtVehicleSim* DtMultiVehicleFed::vehicleFactory ( int  num,
int  appNumOffset,
const DtF18Initializer initializer,
DtObjectPublisherContainer pubContainer 
)
protected

Member Data Documentation

DtClock* DtMultiVehicleFed::myClock
private
DtExerciseConn* DtMultiVehicleFed::myExConn
private
mode DtMultiVehicleFed::myMode
private
DtObjectPublisherContainer DtMultiVehicleFed::myPublishedObjects
private
DtTime DtMultiVehicleFed::mySimTime
private
DtParallelExecutionContainer<DtVehicleSim> DtMultiVehicleFed::mySimulatedVehicles
private
DtReflectedEntityList* DtMultiVehicleFed::rel
private

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

Document ID: Generated on Thu Feb 22 04:26:36 EST 2018 from SVN revision 186468
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)