Computer Assited Medical Intervention Tool Kit  version 5.0
MonitoringManager Class Referenceabstract

Manager of the benchmark tests. More...

#include <MonitoringManager.h>

Public Member Functions

void addMonitor (Monitor *monitor)
 add a monitor to the list More...
 
virtual bool checkStop ()=0
 Check if simulation is finished. More...
 
void deleteMonitor (const unsigned int i)
 delete a monitor and remove it from the list using its index More...
 
virtual void doMove ()=0
 Do one step of simulation and save monitors for this step. More...
 
virtual void end ()=0
 End manager. More...
 
MonitorgetMonitor (const unsigned int i) const
 get a monitor by its index in the list More...
 
void incStep ()
 increment step by one More...
 
virtual bool init ()=0
 Initialize manager. More...
 
bool isLmlPresent ()
 check if a lml is present More...
 
bool isPmlPresent ()
 check if a scn is present instead of pmlFileName More...
 
 MonitoringManager (const char *mml)
 constructor More...
 
unsigned int numberOfMonitor () const
 get the number of monitors stored in the list More...
 
void reload (bool delPml=true)
 reload simulation with current parameters More...
 
void rewind ()
 Rewind simulation. More...
 
void saveMmlIn (const char *fileName)
 save current version of mml in More...
 
void saveMonitors ()
 Save save monitors' state for the current time. More...
 
void setCurrentTime (double time)
 mutators for simulation parameters More...
 
void setDt (double dt)
 change dt and save modification into mmlIn More...
 
void setLmlFileName (const char *file)
 change lml file name and save modification into mmlIn More...
 
void setPmlFileName (const char *file)
 change pml file name and save modification into mmlIn More...
 
void setRefresh (double refresh)
 change refresh and save modification into mmlIn More...
 
void simulate ()
 perform simulation loop, make tests and save monitors' data into output file More...
 
void storeOldPositions ()
 store old positions before next step More...
 
void updateComputingTime ()
 add step computing time to total computing time More...
 
void updateCurrentTime ()
 add dt to current time More...
 
void writeCsv (const char *fileName)
 Write all saved monitors'state into csv file. More...
 
void writeOutput (const char *fileName)
 Write all saved monitors' states into mmlOut file. More...
 
virtual ~MonitoringManager ()
 destructor More...
 
accessors for simulation parameters
double getDt ()
 
double getRefresh ()
 
double getCurrentTime ()
 
double getCurrentStep ()
 
double getStepComputingTime ()
 
double getComputingTime ()
 
PhysicalModelgetInitPml ()
 
PhysicalModelgetPml ()
 
PhysicalModeltakePml ()
 This is nearly the same as getPml(), but it also transfers ownership of the pointer. More...
 
LoadsgetLml ()
 
LoadstakeLml ()
 This is nearly the same as getLml(), but it also transfers ownership of the pointer. More...
 
std::string getPmlFileName ()
 
std::string getLmlFileName ()
 
std::string getMmlFileName ()
 
std::string getmmlFileFolder ()
 
SimulatorgetSimulator ()
 
void getOldPosition (double pos[3], unsigned int index)
 get atom position for precedent step More...
 

Protected Attributes

double computingTime
 total computing time at current moment More...
 
double currentTime
 time at current moment More...
 
double dt
 integration step More...
 
std::unique_ptr< mml::MonitoringIn > mmlIn
 Object representing manager in the file generated by xsdcxx, can be used for serialization. More...
 
std::vector< Monitor * > monitors
 Vector that contains all monitors. More...
 
double refresh
 refreshing step More...
 
Simulatorsimul
 the simulator used for simualtion More...
 
std::string simulatorName
 name of the simulator More...
 
int step
 current step More...
 
double stepComputingTime
 computing time of last step More...
 
std::vector< mml::TimeStep * > times
 Vector that contains information saved by saveMonitors method. More...
 

Private Member Functions

void buildLoads ()
 build the loads if lml file was given More...
 
void buildMonitors ()
 build monitors More...
 
void buildPmlAndSimulator (bool delPml=true)
 build physical model and simulator More...
 
void buildPmlAndSimulatorfromPml ()
 build physical model and simulator from a pml file More...
 
void buildPmlAndSimulatorfromSimulator ()
 build physical model and simulator from a specific simulator file More...
 

Private Attributes

PhysicalModelinitPml
 initial pml More...
 
Loadslml
 Loads applied to pml. More...
 
std::string lmlFileName
 name of the lml file (complete path from working directory) More...
 
std::string mmlFileFolder
 folder of mml file (complete path from working directory) More...
 
std::string mmlFileName
 name of the mml in file (complete path from working directory) More...
 
double * oldPositionPointer
 old position pointer More...
 
bool ownLml
 is the lml "own" by this is instance, which is the normal case when there are not visual representation. But ownership can also be taken by some other instance, see takeLml() More...
 
bool ownPml
 is the pml "own" by this instance, which is the normal case when there are no visual representation. But ownership can also be taken by some other instance, see takePml() More...
 
PhysicalModelpml
 pml at current moment More...
 
std::string pmlFileName
 name of the pml file (complete path from working directory) More...
 

Detailed Description

Manager of the benchmark tests.

Do simulation loop and tests

Constructor & Destructor Documentation

◆ MonitoringManager()

MonitoringManager::MonitoringManager ( const char *  mml)

◆ ~MonitoringManager()

MonitoringManager::~MonitoringManager ( )
virtual

destructor

References initPml, lml, monitors, ownLml, ownPml, pml, and times.

Member Function Documentation

◆ addMonitor()

void MonitoringManager::addMonitor ( Monitor monitor)

add a monitor to the list

References monitors.

◆ buildLoads()

void MonitoringManager::buildLoads ( )
private

build the loads if lml file was given

References isLmlPresent(), lml, lmlFileName, and ownLml.

Referenced by MonitoringManager(), and reload().

◆ buildMonitors()

void MonitoringManager::buildMonitors ( )
private

build monitors

References MonitorFactory::createMonitor(), mmlIn, and monitors.

Referenced by MonitoringManager().

◆ buildPmlAndSimulator()

void MonitoringManager::buildPmlAndSimulator ( bool  delPml = true)
private

build physical model and simulator

Parameters
delPmltrue if pml object have to be deleted (perhaps used by others: physicalModel component...)

References buildPmlAndSimulatorfromPml(), buildPmlAndSimulatorfromSimulator(), initPml, isPmlPresent(), oldPositionPointer, ownPml, pml, and simul.

Referenced by MonitoringManager(), and reload().

◆ buildPmlAndSimulatorfromPml()

void MonitoringManager::buildPmlAndSimulatorfromPml ( )
private

◆ buildPmlAndSimulatorfromSimulator()

void MonitoringManager::buildPmlAndSimulatorfromSimulator ( )
private

◆ checkStop()

virtual bool MonitoringManager::checkStop ( )
pure virtual

◆ deleteMonitor()

void MonitoringManager::deleteMonitor ( const unsigned int  i)

delete a monitor and remove it from the list using its index

References monitors.

◆ doMove()

virtual void MonitoringManager::doMove ( )
pure virtual

Do one step of simulation and save monitors for this step.

Implemented in InteractiveMonitoringManager, and NonInteractiveMonitoringManager.

Referenced by MonitoringGuiManager::doOneStep(), and simulate().

◆ end()

virtual void MonitoringManager::end ( )
pure virtual

◆ getComputingTime()

double MonitoringManager::getComputingTime ( )

◆ getCurrentStep()

double MonitoringManager::getCurrentStep ( )

◆ getCurrentTime()

◆ getDt()

double MonitoringManager::getDt ( )

◆ getInitPml()

◆ getLml()

Loads * MonitoringManager::getLml ( )

◆ getLmlFileName()

string MonitoringManager::getLmlFileName ( )

◆ getmmlFileFolder()

string MonitoringManager::getmmlFileFolder ( )

References mmlFileFolder.

Referenced by Reference::Reference().

◆ getMmlFileName()

string MonitoringManager::getMmlFileName ( )

◆ getMonitor()

Monitor * MonitoringManager::getMonitor ( const unsigned int  i) const

◆ getOldPosition()

void MonitoringManager::getOldPosition ( double  pos[3],
unsigned int  index 
)

get atom position for precedent step

References a, PhysicalModel::getAtoms(), StructuralComponent::getStructure(), oldPositionPointer, and pml.

Referenced by Position::calculate().

◆ getPml()

◆ getPmlFileName()

std::string MonitoringManager::getPmlFileName ( )

◆ getRefresh()

double MonitoringManager::getRefresh ( )

◆ getSimulator()

Simulator * MonitoringManager::getSimulator ( )

◆ getStepComputingTime()

double MonitoringManager::getStepComputingTime ( )

◆ incStep()

void MonitoringManager::incStep ( )

increment step by one

References step.

Referenced by InteractiveMonitoringManager::doMove(), and NonInteractiveMonitoringManager::doMove().

◆ init()

virtual bool MonitoringManager::init ( )
pure virtual

Initialize manager.

Returns
false if initialisation faild

Implemented in InteractiveMonitoringManager, and NonInteractiveMonitoringManager.

Referenced by MonitoringGuiManager::loadMmlInFile(), reload(), rewind(), and simulate().

◆ isLmlPresent()

bool MonitoringManager::isLmlPresent ( )

◆ isPmlPresent()

bool MonitoringManager::isPmlPresent ( )

check if a scn is present instead of pmlFileName

References mmlIn.

Referenced by buildPmlAndSimulator(), MonitoringDialog::enableButtons(), and MonitoringManager().

◆ numberOfMonitor()

unsigned int MonitoringManager::numberOfMonitor ( ) const

get the number of monitors stored in the list

References monitors.

Referenced by MonitoringDialog::updateMonitors().

◆ reload()

void MonitoringManager::reload ( bool  delPml = true)

reload simulation with current parameters

Parameters
delPmltrue if pml object have to be deleted (perhaps used by others: physicalModel component...)

References buildLoads(), buildPmlAndSimulator(), computingTime, currentTime, init(), step, stepComputingTime, and times.

Referenced by MonitoringGuiManager::reload().

◆ rewind()

void MonitoringManager::rewind ( )

Rewind simulation.

References computingTime, currentTime, init(), step, stepComputingTime, and times.

Referenced by MonitoringGuiManager::rewind().

◆ saveMmlIn()

void MonitoringManager::saveMmlIn ( const char *  fileName)

save current version of mml in

References mmlIn.

Referenced by MonitoringGuiManager::saveMmlInFile().

◆ saveMonitors()

void MonitoringManager::saveMonitors ( )

Save save monitors' state for the current time.

References currentTime, mmlIn, monitors, timeParameter2double(), and times.

Referenced by InteractiveMonitoringManager::doMove(), NonInteractiveMonitoringManager::doMove(), and simulate().

◆ setCurrentTime()

void MonitoringManager::setCurrentTime ( double  time)

mutators for simulation parameters

References currentTime.

◆ setDt()

void MonitoringManager::setDt ( double  dt)

change dt and save modification into mmlIn

References dt, and mmlIn.

Referenced by SofaSimulator::build(), and MonitoringGuiManager::updateDt().

◆ setLmlFileName()

void MonitoringManager::setLmlFileName ( const char *  file)

change lml file name and save modification into mmlIn

References lmlFileName, and mmlIn.

Referenced by MonitoringGuiManager::updateLml().

◆ setPmlFileName()

void MonitoringManager::setPmlFileName ( const char *  file)

change pml file name and save modification into mmlIn

References mmlIn, and pmlFileName.

Referenced by MonitoringGuiManager::updatePml().

◆ setRefresh()

void MonitoringManager::setRefresh ( double  refresh)

change refresh and save modification into mmlIn

References mmlIn, and refresh.

Referenced by MonitoringGuiManager::updateRefresh().

◆ simulate()

void MonitoringManager::simulate ( )

perform simulation loop, make tests and save monitors' data into output file

References checkStop(), computingTime, currentTime, doMove(), init(), saveMonitors(), step, and writeOutput().

◆ storeOldPositions()

void MonitoringManager::storeOldPositions ( )

store old positions before next step

References PhysicalModel::getPositionPointer(), oldPositionPointer, and pml.

Referenced by Simulator::updatePositions().

◆ takeLml()

Loads * MonitoringManager::takeLml ( )

This is nearly the same as getLml(), but it also transfers ownership of the pointer.

After this method is called, this instance of MonitoringManager will not delete the pml. It is then the responsability of the caller (the instance which is taking ownership of the Loads). This is useful when transmitting to PMManagerDC's Loads manager for example.

References getLml(), and ownLml.

◆ takePml()

PhysicalModel * MonitoringManager::takePml ( )

This is nearly the same as getPml(), but it also transfers ownership of the pointer.

After this method is called, this instance of MonitoringManager will not delete the pml. It is then the responsability of the caller (the instance which is taking ownership of the PhysicalModel). This is useful when transmitting to PMManagerDC Component for example.

References getPml(), and ownPml.

Referenced by MMLComponent::connectPml(), and MMLComponent::MMLComponent().

◆ updateComputingTime()

void MonitoringManager::updateComputingTime ( )

add step computing time to total computing time

References computingTime, and stepComputingTime.

Referenced by InteractiveMonitoringManager::doMove().

◆ updateCurrentTime()

void MonitoringManager::updateCurrentTime ( )

add dt to current time

References currentTime, and dt.

Referenced by InteractiveMonitoringManager::doMove().

◆ writeCsv()

void MonitoringManager::writeCsv ( const char *  fileName)

Write all saved monitors'state into csv file.

References monitors, and times.

Referenced by MonitoringGuiManager::saveCsvFile().

◆ writeOutput()

void MonitoringManager::writeOutput ( const char *  fileName)

Write all saved monitors' states into mmlOut file.

References getPmlFileName(), pml, times, and PhysicalModel::xmlPrint().

Referenced by MonitoringGuiManager::saveMmlOutFile(), and simulate().

Member Data Documentation

◆ computingTime

double MonitoringManager::computingTime
protected

total computing time at current moment

Referenced by getComputingTime(), MonitoringManager(), reload(), rewind(), simulate(), and updateComputingTime().

◆ currentTime

double MonitoringManager::currentTime
protected

◆ dt

double MonitoringManager::dt
protected

◆ initPml

◆ lml

Loads* MonitoringManager::lml
private

Loads applied to pml.

Referenced by buildLoads(), getLml(), MonitoringManager(), and ~MonitoringManager().

◆ lmlFileName

std::string MonitoringManager::lmlFileName
private

name of the lml file (complete path from working directory)

Referenced by buildLoads(), getLmlFileName(), MonitoringManager(), and setLmlFileName().

◆ mmlFileFolder

std::string MonitoringManager::mmlFileFolder
private

folder of mml file (complete path from working directory)

Referenced by buildPmlAndSimulatorfromSimulator(), getmmlFileFolder(), and MonitoringManager().

◆ mmlFileName

std::string MonitoringManager::mmlFileName
private

name of the mml in file (complete path from working directory)

Referenced by getMmlFileName(), and MonitoringManager().

◆ mmlIn

std::unique_ptr<mml::MonitoringIn> MonitoringManager::mmlIn
protected

◆ monitors

std::vector<Monitor*> MonitoringManager::monitors
protected

◆ oldPositionPointer

double* MonitoringManager::oldPositionPointer
private

◆ ownLml

bool MonitoringManager::ownLml
private

is the lml "own" by this is instance, which is the normal case when there are not visual representation. But ownership can also be taken by some other instance, see takeLml()

Referenced by buildLoads(), takeLml(), and ~MonitoringManager().

◆ ownPml

bool MonitoringManager::ownPml
private

is the pml "own" by this instance, which is the normal case when there are no visual representation. But ownership can also be taken by some other instance, see takePml()

Referenced by buildPmlAndSimulator(), buildPmlAndSimulatorfromPml(), buildPmlAndSimulatorfromSimulator(), takePml(), and ~MonitoringManager().

◆ pml

◆ pmlFileName

std::string MonitoringManager::pmlFileName
private

name of the pml file (complete path from working directory)

Referenced by buildPmlAndSimulatorfromPml(), buildPmlAndSimulatorfromSimulator(), getPmlFileName(), MonitoringManager(), and setPmlFileName().

◆ refresh

double MonitoringManager::refresh
protected

refreshing step

Referenced by getRefresh(), MonitoringManager(), and setRefresh().

◆ simul

◆ simulatorName

std::string MonitoringManager::simulatorName
protected

◆ step

◆ stepComputingTime

double MonitoringManager::stepComputingTime
protected

◆ times

std::vector<mml::TimeStep*> MonitoringManager::times
protected

Vector that contains information saved by saveMonitors method.

Referenced by reload(), rewind(), saveMonitors(), writeCsv(), writeOutput(), and ~MonitoringManager().


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