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... | |
Monitor * | getMonitor (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 () |
PhysicalModel * | getInitPml () |
PhysicalModel * | getPml () |
PhysicalModel * | takePml () |
This is nearly the same as getPml(), but it also transfers ownership of the pointer. More... | |
Loads * | getLml () |
Loads * | takeLml () |
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 () |
Simulator * | getSimulator () |
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... | |
Simulator * | simul |
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 | |
PhysicalModel * | initPml |
initial pml More... | |
Loads * | lml |
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... | |
PhysicalModel * | pml |
pml at current moment More... | |
std::string | pmlFileName |
name of the pml file (complete path from working directory) More... | |
Manager of the benchmark tests.
Do simulation loop and tests
MonitoringManager::MonitoringManager | ( | const char * | mml | ) |
constructor
mml | mml file name |
sim | simulator name (Sofa, Ansys...) |
References buildLoads(), buildMonitors(), buildPmlAndSimulator(), computingTime, currentTime, dt, initPml, isLmlPresent(), isPmlPresent(), lml, lmlFileName, mmlFileFolder, mmlFileName, mmlIn, oldPositionPointer, pml, pmlFileName, refresh, simul, simulatorName, step, stepComputingTime, and timeParameter2double().
|
virtual |
void MonitoringManager::addMonitor | ( | Monitor * | monitor | ) |
add a monitor to the list
References monitors.
|
private |
build the loads if lml file was given
References isLmlPresent(), lml, lmlFileName, and ownLml.
Referenced by MonitoringManager(), and reload().
|
private |
build monitors
References MonitorFactory::createMonitor(), mmlIn, and monitors.
Referenced by MonitoringManager().
|
private |
build physical model and simulator
delPml | true 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().
|
private |
build physical model and simulator from a pml file
References SimulatorFactory::createSimulator(), PhysicalModel::getAtoms(), SimulatorFactory::getInstance(), StructuralComponent::getNumberOfStructures(), initPml, oldPositionPointer, ownPml, pml, pmlFileName, simul, and simulatorName.
Referenced by buildPmlAndSimulator().
|
private |
build physical model and simulator from a specific simulator file
References Simulator::createPml(), SimulatorFactory::createSimulator(), PhysicalModel::getAtoms(), SimulatorFactory::getInstance(), StructuralComponent::getNumberOfStructures(), initPml, mmlFileFolder, mmlIn, oldPositionPointer, ownPml, pml, pmlFileName, simul, and simulatorName.
Referenced by buildPmlAndSimulator().
|
pure virtual |
Check if simulation is finished.
Implemented in InteractiveMonitoringManager, and NonInteractiveMonitoringManager.
Referenced by MonitoringGuiManager::doOneStep(), simulate(), and MonitoringGuiManager::simulateOneStep().
void MonitoringManager::deleteMonitor | ( | const unsigned int | i | ) |
delete a monitor and remove it from the list using its index
References monitors.
|
pure virtual |
Do one step of simulation and save monitors for this step.
Implemented in InteractiveMonitoringManager, and NonInteractiveMonitoringManager.
Referenced by MonitoringGuiManager::doOneStep(), and simulate().
|
pure virtual |
End manager.
Implemented in InteractiveMonitoringManager, and NonInteractiveMonitoringManager.
double MonitoringManager::getComputingTime | ( | ) |
References computingTime.
Referenced by MonitorComputingTime::calculate(), and MonitoringDialog::updateSimulation().
double MonitoringManager::getCurrentStep | ( | ) |
References step.
Referenced by AnsysSimulator::getPosition(), ArtisynthSimulator::getPosition(), and MonitoringDialog::updateSimulation().
double MonitoringManager::getCurrentTime | ( | ) |
References currentTime.
Referenced by MonitorDistanceX::calculate(), MonitorDistanceY::calculate(), MonitorDistanceZ::calculate(), MonitorGeometricDeviation::calculate(), MonitorPointSetDistance::calculate(), MonitorRen::calculate(), Time::calculate(), MonitoringGuiManager::doOneStep(), and MonitoringDialog::updateSimulation().
double MonitoringManager::getDt | ( | ) |
References dt.
Referenced by SoluWriter::SoluWriter(), and MonitoringDialog::updateSimulation().
PhysicalModel * MonitoringManager::getInitPml | ( | ) |
References initPml.
Referenced by MonitorDisplacement::calculate(), MonitorNormDisplacement::calculate(), MonitorRen::calculate(), and Monitor::Monitor().
Loads * MonitoringManager::getLml | ( | ) |
References lml.
Referenced by SofaSimulator::buildConstraints(), takeLml(), and PrepWriter::write().
string MonitoringManager::getLmlFileName | ( | ) |
References lmlFileName.
Referenced by MonitoringDialog::updateSimulation().
string MonitoringManager::getmmlFileFolder | ( | ) |
References mmlFileFolder.
Referenced by Reference::Reference().
string MonitoringManager::getMmlFileName | ( | ) |
References mmlFileName.
Referenced by MonitoringDialog::updateSimulation().
Monitor * MonitoringManager::getMonitor | ( | const unsigned int | i | ) | const |
get a monitor by its index in the list
References monitors.
Referenced by MMLDisplay::connectMonitor(), MMLDisplay::getDisplayedMonitor(), MonitoringDialog::updateMonitors(), and MMLDisplay::updateMonitorsTable().
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().
PhysicalModel * MonitoringManager::getPml | ( | ) |
References pml.
Referenced by MonitorDisplacement::calculate(), MonitorDistanceX::calculate(), MonitorDistanceY::calculate(), MonitorDistanceZ::calculate(), MonitorForce::calculate(), MonitorGeometricDeviation::calculate(), MonitorNormDisplacement::calculate(), MonitorPointFinalSetDistance::calculate(), MonitorPointSetDistance::calculate(), MonitorPointToTriangleMeshDistanceFinal::calculate(), MonitorPosition::calculate(), MonitorRen::calculate(), MonitorSurface::calculate(), MonitorVolume::calculate(), Position::calculate(), Position::Position(), ArtisynthSimulator::runArtisynth(), takePml(), Simulator::updatePositions(), ParametersWriter::write(), and PrepWriter::write().
std::string MonitoringManager::getPmlFileName | ( | ) |
References pmlFileName.
Referenced by MMLComponent::connectPml(), MMLComponent::MMLComponent(), MonitoringDialog::updateSimulation(), and writeOutput().
double MonitoringManager::getRefresh | ( | ) |
References refresh.
Referenced by MonitoringGuiManager::doOneStep(), and MonitoringDialog::updateSimulation().
Simulator * MonitoringManager::getSimulator | ( | ) |
References simul.
Referenced by MonitorForce::calculate(), and MonitoringDialog::updateSimulatorWidget().
double MonitoringManager::getStepComputingTime | ( | ) |
References stepComputingTime.
Referenced by MonitoringDialog::updateSimulation().
void MonitoringManager::incStep | ( | ) |
increment step by one
References step.
Referenced by InteractiveMonitoringManager::doMove(), and NonInteractiveMonitoringManager::doMove().
|
pure virtual |
Initialize manager.
Implemented in InteractiveMonitoringManager, and NonInteractiveMonitoringManager.
Referenced by MonitoringGuiManager::loadMmlInFile(), reload(), rewind(), and simulate().
bool MonitoringManager::isLmlPresent | ( | ) |
check if a lml is present
References mmlIn.
Referenced by buildLoads(), MonitoringDialog::enableButtons(), SofaSimulator::init(), MonitoringManager(), and PrepWriter::write().
bool MonitoringManager::isPmlPresent | ( | ) |
check if a scn is present instead of pmlFileName
References mmlIn.
Referenced by buildPmlAndSimulator(), MonitoringDialog::enableButtons(), and MonitoringManager().
unsigned int MonitoringManager::numberOfMonitor | ( | ) | const |
get the number of monitors stored in the list
References monitors.
Referenced by MonitoringDialog::updateMonitors().
void MonitoringManager::reload | ( | bool | delPml = true | ) |
reload simulation with current parameters
delPml | true 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().
void MonitoringManager::rewind | ( | ) |
Rewind simulation.
References computingTime, currentTime, init(), step, stepComputingTime, and times.
Referenced by MonitoringGuiManager::rewind().
void MonitoringManager::saveMmlIn | ( | const char * | fileName | ) |
save current version of mml in
References mmlIn.
Referenced by MonitoringGuiManager::saveMmlInFile().
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().
void MonitoringManager::setCurrentTime | ( | double | time | ) |
mutators for simulation parameters
References currentTime.
void MonitoringManager::setDt | ( | double | dt | ) |
change dt and save modification into mmlIn
Referenced by SofaSimulator::build(), and MonitoringGuiManager::updateDt().
void MonitoringManager::setLmlFileName | ( | const char * | file | ) |
change lml file name and save modification into mmlIn
References lmlFileName, and mmlIn.
Referenced by MonitoringGuiManager::updateLml().
void MonitoringManager::setPmlFileName | ( | const char * | file | ) |
change pml file name and save modification into mmlIn
References mmlIn, and pmlFileName.
Referenced by MonitoringGuiManager::updatePml().
void MonitoringManager::setRefresh | ( | double | refresh | ) |
change refresh and save modification into mmlIn
References mmlIn, and refresh.
Referenced by MonitoringGuiManager::updateRefresh().
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().
void MonitoringManager::storeOldPositions | ( | ) |
store old positions before next step
References PhysicalModel::getPositionPointer(), oldPositionPointer, and pml.
Referenced by Simulator::updatePositions().
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.
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().
void MonitoringManager::updateComputingTime | ( | ) |
add step computing time to total computing time
References computingTime, and stepComputingTime.
Referenced by InteractiveMonitoringManager::doMove().
void MonitoringManager::updateCurrentTime | ( | ) |
add dt to current time
References currentTime, and dt.
Referenced by InteractiveMonitoringManager::doMove().
void MonitoringManager::writeCsv | ( | const char * | fileName | ) |
Write all saved monitors'state into csv file.
References monitors, and times.
Referenced by MonitoringGuiManager::saveCsvFile().
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().
|
protected |
total computing time at current moment
Referenced by getComputingTime(), MonitoringManager(), reload(), rewind(), simulate(), and updateComputingTime().
|
protected |
time at current moment
Referenced by NonInteractiveMonitoringManager::doMove(), getCurrentTime(), MonitoringManager(), reload(), rewind(), saveMonitors(), setCurrentTime(), simulate(), and updateCurrentTime().
|
protected |
integration step
Referenced by InteractiveMonitoringManager::doMove(), getDt(), MonitoringManager(), setDt(), and updateCurrentTime().
|
private |
initial pml
Referenced by buildPmlAndSimulator(), buildPmlAndSimulatorfromPml(), buildPmlAndSimulatorfromSimulator(), getInitPml(), MonitoringManager(), and ~MonitoringManager().
|
private |
Loads applied to pml.
Referenced by buildLoads(), getLml(), MonitoringManager(), and ~MonitoringManager().
|
private |
name of the lml file (complete path from working directory)
Referenced by buildLoads(), getLmlFileName(), MonitoringManager(), and setLmlFileName().
|
private |
folder of mml file (complete path from working directory)
Referenced by buildPmlAndSimulatorfromSimulator(), getmmlFileFolder(), and MonitoringManager().
|
private |
name of the mml in file (complete path from working directory)
Referenced by getMmlFileName(), and MonitoringManager().
|
protected |
Object representing manager in the file generated by xsdcxx, can be used for serialization.
Referenced by buildMonitors(), buildPmlAndSimulatorfromSimulator(), InteractiveMonitoringManager::InteractiveMonitoringManager(), isLmlPresent(), isPmlPresent(), MonitoringManager(), saveMmlIn(), saveMonitors(), setDt(), setLmlFileName(), setPmlFileName(), and setRefresh().
|
protected |
Vector that contains all monitors.
Referenced by addMonitor(), buildMonitors(), deleteMonitor(), getMonitor(), numberOfMonitor(), saveMonitors(), writeCsv(), and ~MonitoringManager().
|
private |
old position pointer
Referenced by buildPmlAndSimulator(), buildPmlAndSimulatorfromPml(), buildPmlAndSimulatorfromSimulator(), getOldPosition(), MonitoringManager(), and storeOldPositions().
|
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().
|
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().
|
private |
pml at current moment
Referenced by buildPmlAndSimulator(), buildPmlAndSimulatorfromPml(), buildPmlAndSimulatorfromSimulator(), getOldPosition(), getPml(), MonitoringManager(), storeOldPositions(), writeOutput(), and ~MonitoringManager().
|
private |
name of the pml file (complete path from working directory)
Referenced by buildPmlAndSimulatorfromPml(), buildPmlAndSimulatorfromSimulator(), getPmlFileName(), MonitoringManager(), and setPmlFileName().
|
protected |
refreshing step
Referenced by getRefresh(), MonitoringManager(), and setRefresh().
|
protected |
the simulator used for simualtion
Referenced by buildPmlAndSimulator(), buildPmlAndSimulatorfromPml(), buildPmlAndSimulatorfromSimulator(), getSimulator(), InteractiveMonitoringManager::init(), NonInteractiveMonitoringManager::init(), and MonitoringManager().
|
protected |
name of the simulator
Referenced by buildPmlAndSimulatorfromPml(), buildPmlAndSimulatorfromSimulator(), and MonitoringManager().
|
protected |
current step
Referenced by NonInteractiveMonitoringManager::checkStop(), NonInteractiveMonitoringManager::doMove(), getCurrentStep(), incStep(), MonitoringManager(), reload(), rewind(), and simulate().
|
protected |
computing time of last step
Referenced by InteractiveMonitoringManager::doMove(), getStepComputingTime(), MonitoringManager(), reload(), rewind(), and updateComputingTime().
|
protected |
Vector that contains information saved by saveMonitors method.
Referenced by reload(), rewind(), saveMonitors(), writeCsv(), writeOutput(), and ~MonitoringManager().