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. More...
 
virtual ~DtMultiVehicleFed ()
 Pure Virtual destructor. More...
 
DtExerciseConnexerciseConn ()
 
void initializeExConn (DtTime theTimeOutInterval, DtF18Initializer *initializer)
 
void initializeFleet (int appNumOffset, int theNumVehicles, const DtF18Initializer *initializer)
 
void drainInput (double tMaxRealElapsed)
 
int numberRemoteEntities () const
 
void simulate ()
 
void publish ()
 
double sleep (double deltaTime)
 
void dismantleFleet ()
 
void dismantleExConn ()
 
void setExecutionMode (mode theMode)
 
mode executionMode () const
 
void setSimTime (double time)
 
double simTime () const
 

Protected Member Functions

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

Static Protected Member Functions

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

Private Attributes

mode myMode
 
DtTime mySimTime
 
DtClockmyClock
 
DtExerciseConnmyExConn
 
DtReflectedEntityListmyRel
 
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 discretion 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
DtExerciseConn* DtMultiVehicleFed::exerciseConn ( )
inline

References myExConn.

DtString& DtMultiVehicleFed::getVehicleName ( int  num,
const DtString baseName,
DtString name 
)
protected
void DtMultiVehicleFed::initializeExConn ( DtTime  theTimeOutInterval,
DtF18Initializer initializer 
)
void DtMultiVehicleFed::initializeFleet ( int  appNumOffset,
int  theNumVehicles,
const DtF18Initializer initializer 
)
int DtMultiVehicleFed::numberRemoteEntities ( ) const
void DtMultiVehicleFed::processDetonation ( const DtDetonationInteraction theDetonation)
protected
void DtMultiVehicleFed::publish ( )
void DtMultiVehicleFed::setExecutionMode ( mode  theMode)
void DtMultiVehicleFed::setSimTime ( double  time)
double DtMultiVehicleFed::simTime ( ) const
void DtMultiVehicleFed::simulate ( )
double 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

Referenced by exerciseConn().

mode DtMultiVehicleFed::myMode
private
DtObjectPublisherContainer DtMultiVehicleFed::myPublishedObjects
private
DtReflectedEntityList* DtMultiVehicleFed::myRel
private
DtTime DtMultiVehicleFed::mySimTime
private
DtParallelExecutionContainer<DtVehicleSim> DtMultiVehicleFed::mySimulatedVehicles
private

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

Document ID: Generated on Mon Apr 25 03:39:01 EDT 2022 from SVN revision 242502
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)