Computer Assited Medical Intervention Tool Kit  version 4.0
Classes | Public Slots | Signals | Public Member Functions | Private Member Functions | Private Attributes | List of all members
LoadsSimulationDriver Class Reference

This class manages the display of a simulation (either an already made simulation opened in a single lml file by LoadsMovie, or a simple step given by a simulation motor). More...

#include <LoadsSimulationDriver.h>

Inherits QObject.

Classes

struct  Position
 private struct to store the initial positions More...
 

Public Slots

void play ()
 Slot called when at each timer tick (i.e. after the same interval of time) More...
 

Signals

void doOneStep ()
 signal call when one step is to be performed More...
 

Public Member Functions

double getDt () const
 get delta-t More...
 
double getNextRefreshTime ()
 get the next planed time when the 3D will be refreshed More...
 
double getRefreshDt () const
 get delta-t between 3d view refresh More...
 
double getTime () const
 get time More...
 
double getTMax () const
 get tmax More...
 
double getTMin () const
 get tmin More...
 
bool isTimerActive ()
 is the timer currently running More...
 
 LoadsSimulationDriver (LoadsManager *, Loads *)
 Constructor. More...
 
void maxSpeed ()
 set the timer interval to maxSpeed (1000Hz) More...
 
void quicker ()
 decrease the timer interval by 5ms, thus calling doOneStep more often More...
 
void resetPositions ()
 reset the 3D positions to the initial value (stored in the map during init), (do not update the display) More...
 
void resetTMaxToDefault ()
 set default tmax (using the current loads last event) More...
 
void resetTMinToDefault ()
 set default tmin (using the current loads first event) More...
 
void resetToDefault ()
 set tmin, tmax and dt to default More...
 
void rewind ()
 rewind time to tMin (do not update the display) More...
 
void setDt (double dt)
 set the delta-t (default is 0.1) More...
 
void setLoads (Loads *)
 set the current loads to be displayed More...
 
void setRefreshDt (double)
 set delta-t between 3d view refresh (default 0.1) More...
 
void setTime (double)
 set the time to a different value ("jump" to a given time) More...
 
void setTMax (double)
 set the new tMax More...
 
void setTMin (double)
 set the new tMin More...
 
void slower ()
 increase the timer interval by 5ms, thus calling doOneStep less often More...
 
void startTimer ()
 starts the timer that will repeatedly call play and emit doOneStep More...
 
void stopTimer ()
 stop the timer More...
 
void updateAtomData ()
 only update the Atom data More...
 
void updateDisplay (bool force)
 update the display using the current loads (and refresh the 3D viewers if parameter is true) More...
 
virtual ~LoadsSimulationDriver ()
 Destructor. More...
 

Private Member Functions

void getInitialPosition (unsigned int, double [3])
 get an initial position using the key (i.e. targetId) More...
 
void init ()
 init display and initial positions. More...
 
void updatePositions (bool force)
 update the positions depending on the current loads (and refresh the DCs position if parameter is true) More...
 

Private Attributes

LoadscurrentLoads
 the current loads More...
 
double dt
 the delta-t used to change t More...
 
QMap< unsigned int, PositioninitialPositionMap
 initial positions of all the targets More...
 
int interval
 timer interval in ms More...
 
double lastRefreshTime
 last time the display was refresh More...
 
double lastUpdateTime
 last time we updated the display More...
 
LoadsManagermyLM
 the load manager More...
 
QMap< unsigned int, PositionreferencePositionMap
 the reference pm positions (used to display the distances, ...) More...
 
double refreshDt
 the delta-t between two refresh of the 3D view More...
 
double t
 simulation time More...
 
QTimer * timer
 the simulation timer More...
 
double tMax
 last event time More...
 
double tMin
 first event time More...
 

Detailed Description

This class manages the display of a simulation (either an already made simulation opened in a single lml file by LoadsMovie, or a simple step given by a simulation motor).

It is just a utility class for handling the display of loads a given time, using a timer.

Constructor & Destructor Documentation

◆ LoadsSimulationDriver()

LoadsSimulationDriver::LoadsSimulationDriver ( LoadsManager lm,
Loads initialLoads 
)

Constructor.

Set the load manager, and (initial) current loads (if the loads ptr is null, then all atoms initial positions will be stored; just in case they have to move in the future)

◆ ~LoadsSimulationDriver()

LoadsSimulationDriver::~LoadsSimulationDriver ( )
virtual

Destructor.

Member Function Documentation

◆ doOneStep

void LoadsSimulationDriver::doOneStep ( )
signal

signal call when one step is to be performed

◆ getDt()

double LoadsSimulationDriver::getDt ( ) const

◆ getInitialPosition()

void LoadsSimulationDriver::getInitialPosition ( unsigned int  targetId,
double  pos[3] 
)
inlineprivate

get an initial position using the key (i.e. targetId)

References initialPositionMap.

◆ getNextRefreshTime()

double LoadsSimulationDriver::getNextRefreshTime ( )

get the next planed time when the 3D will be refreshed

Referenced by LoadsSimulation::doOneStep().

◆ getRefreshDt()

double LoadsSimulationDriver::getRefreshDt ( ) const

get delta-t between 3d view refresh

Referenced by LoadsSimulation::doOneStep(), LoadsSimulation::LoadsSimulation(), and LoadsSimulation::pause().

◆ getTime()

double LoadsSimulationDriver::getTime ( ) const

◆ getTMax()

double LoadsSimulationDriver::getTMax ( ) const

◆ getTMin()

double LoadsSimulationDriver::getTMin ( ) const

◆ init()

void LoadsSimulationDriver::init ( )
private

init display and initial positions.

stores all the initial position of the atoms implied in the loads. if current loads is NULL, then all the atoms will have their initial positions stored.

References PhysicalModel::getAtoms(), PMManagerDC::getDC(), Structure::getIndex(), StructuralComponent::getNumberOfStructures(), PMManagerDC::getPhysicalModel(), Atom::getPosition(), StructuralComponent::getStructure(), LoadsSimulationDriver::Position::x, LoadsSimulationDriver::Position::y, and LoadsSimulationDriver::Position::z.

◆ isTimerActive()

bool LoadsSimulationDriver::isTimerActive ( )

is the timer currently running

Referenced by LoadsSimulation::doOneStep(), LoadsMovie::play(), and LoadsSimulation::simulate().

◆ maxSpeed()

void LoadsSimulationDriver::maxSpeed ( )

set the timer interval to maxSpeed (1000Hz)

Referenced by LoadsSimulation::simulate().

◆ play

void LoadsSimulationDriver::play ( )
slot

Slot called when at each timer tick (i.e. after the same interval of time)

◆ quicker()

void LoadsSimulationDriver::quicker ( )

decrease the timer interval by 5ms, thus calling doOneStep more often

◆ resetPositions()

void LoadsSimulationDriver::resetPositions ( )

reset the 3D positions to the initial value (stored in the map during init), (do not update the display)

References PhysicalModel::getAtom(), PMManagerDC::getDC(), PMManagerDC::getPhysicalModel(), AtomDC::resetAlreadyMovedFlag(), and AtomDC::setPosition().

Referenced by LoadsMovie::reset().

◆ resetTMaxToDefault()

void LoadsSimulationDriver::resetTMaxToDefault ( )

set default tmax (using the current loads last event)

Referenced by LoadsMovie::defaultTMax(), and LoadsSimulation::LoadsSimulation().

◆ resetTMinToDefault()

void LoadsSimulationDriver::resetTMinToDefault ( )

set default tmin (using the current loads first event)

Referenced by LoadsMovie::defaultTMin().

◆ resetToDefault()

void LoadsSimulationDriver::resetToDefault ( )

set tmin, tmax and dt to default

◆ rewind()

void LoadsSimulationDriver::rewind ( )

rewind time to tMin (do not update the display)

Referenced by LoadsMovie::doOneStep(), and LoadsMovie::rewind().

◆ setDt()

void LoadsSimulationDriver::setDt ( double  dt)

set the delta-t (default is 0.1)

Referenced by LoadsMovie::dtChanged(), LoadsSimulation::dtChanged(), and LoadsSimulation::LoadsSimulation().

◆ setLoads()

void LoadsSimulationDriver::setLoads ( Loads l)

set the current loads to be displayed

Referenced by LoadsSimulation::doOneStep(), and LoadsSimulation::rewind().

◆ setRefreshDt()

void LoadsSimulationDriver::setRefreshDt ( double  dt)

◆ setTime()

void LoadsSimulationDriver::setTime ( double  newTime)

◆ setTMax()

void LoadsSimulationDriver::setTMax ( double  newTMax)

◆ setTMin()

void LoadsSimulationDriver::setTMin ( double  newTMin)

set the new tMin

Referenced by LoadsMovie::tMinChanged().

◆ slower()

void LoadsSimulationDriver::slower ( )

increase the timer interval by 5ms, thus calling doOneStep less often

Referenced by LoadsSimulation::doOneStep().

◆ startTimer()

void LoadsSimulationDriver::startTimer ( )

starts the timer that will repeatedly call play and emit doOneStep

Referenced by LoadsMovie::play(), and LoadsSimulation::simulate().

◆ stopTimer()

void LoadsSimulationDriver::stopTimer ( )

◆ updateAtomData()

void LoadsSimulationDriver::updateAtomData ( )

◆ updateDisplay()

void LoadsSimulationDriver::updateDisplay ( bool  force)

update the display using the current loads (and refresh the 3D viewers if parameter is true)

Parameters
forceif true force display update independently from refresh dt (default is false)

References camitk::InteractiveViewer::get3DViewer(), and camitk::InteractiveViewer::refreshRenderer().

Referenced by LoadsMovie::updateDisplay(), and LoadsSimulation::updateDisplay().

◆ updatePositions()

void LoadsSimulationDriver::updatePositions ( bool  force)
private

Member Data Documentation

◆ currentLoads

Loads* LoadsSimulationDriver::currentLoads
private

the current loads

◆ dt

double LoadsSimulationDriver::dt
private

the delta-t used to change t

◆ initialPositionMap

QMap<unsigned int, Position> LoadsSimulationDriver::initialPositionMap
private

initial positions of all the targets

Referenced by getInitialPosition().

◆ interval

int LoadsSimulationDriver::interval
private

timer interval in ms

◆ lastRefreshTime

double LoadsSimulationDriver::lastRefreshTime
private

last time the display was refresh

◆ lastUpdateTime

double LoadsSimulationDriver::lastUpdateTime
private

last time we updated the display

◆ myLM

LoadsManager* LoadsSimulationDriver::myLM
private

the load manager

◆ referencePositionMap

QMap<unsigned int, Position> LoadsSimulationDriver::referencePositionMap
private

the reference pm positions (used to display the distances, ...)

◆ refreshDt

double LoadsSimulationDriver::refreshDt
private

the delta-t between two refresh of the 3D view

◆ t

double LoadsSimulationDriver::t
private

simulation time

◆ timer

QTimer* LoadsSimulationDriver::timer
private

the simulation timer

◆ tMax

double LoadsSimulationDriver::tMax
private

last event time

◆ tMin

double LoadsSimulationDriver::tMin
private

first event time


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