Computer Assisted Medical Intervention Tool Kit version 6.0
 
Loading...
Searching...
No Matches
MonitoringManager.h
Go to the documentation of this file.
1/*****************************************************************************
2 * $CAMITK_LICENCE_BEGIN$
3 *
4 * CamiTK - Computer Assisted Medical Intervention ToolKit
5 * (c) 2001-2025 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
6 *
7 * Visit http://camitk.imag.fr for more information
8 *
9 * This file is part of CamiTK.
10 *
11 * CamiTK is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * CamiTK is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22 *
23 * $CAMITK_LICENCE_END$
24 ****************************************************************************/
25
26#ifndef MANAGER_MONITORINGMANAGER_H
27#define MANAGER_MONITORINGMANAGER_H
28
29#include <memory> // std::auto_ptr
30#include <vector>
31
32#include <PhysicalModel.h>
33#include <Loads.h>
34
35#include <MonitorIn.hxx>
36#include <MonitorOut.hxx>
37
38class Monitor;
39class Simulator;
40
41#include "MMLAPI.h"
51public:
52
57 MonitoringManager(const char* mml);
58
60 virtual ~MonitoringManager();
61
65 virtual bool init() = 0;
67 virtual void end() = 0;
68
70 void simulate();
72 virtual void doMove() = 0;
74 virtual bool checkStop() = 0;
76 void rewind();
80 void reload(bool delPml = true);
81
83 void saveMonitors();
85 void writeOutput(const char* fileName);
87 void writeCsv(const char* fileName);
89 void saveMmlIn(const char* fileName);
90
93 double getDt();
94 double getRefresh();
95 double getCurrentTime();
96 double getCurrentStep();
97 double getStepComputingTime();
98 double getComputingTime();
99 PhysicalModel* getInitPml();
100 PhysicalModel* getPml();
106 PhysicalModel* takePml();
107 Loads* getLml();
113 Loads* takeLml();
114 std::string getPmlFileName();
115 std::string getLmlFileName();
116 std::string getMmlFileName();
117 std::string getmmlFileFolder();
118 Simulator* getSimulator();
120 void getOldPosition(double pos[3], unsigned int index);
122
124 void setCurrentTime(double time);
125
127 void storeOldPositions();
129 void updateCurrentTime();
131 void updateComputingTime();
133 void incStep();
134
136 void setDt(double dt);
138 void setRefresh(double refresh);
140 void setPmlFileName(const char* file);
142 void setLmlFileName(const char* file);
143
144 //accessors and mutators for monitors
146 void addMonitor(Monitor* monitor);
148 Monitor* getMonitor(const unsigned int i) const;
150 void deleteMonitor(const unsigned int i);
152 unsigned int numberOfMonitor() const;
153
155 bool isPmlPresent();
157 bool isLmlPresent();
158
159protected:
160
162 std::unique_ptr<mml::MonitoringIn> mmlIn;
164 std::vector<Monitor*> monitors;
166 std::vector<mml::TimeStep*> times;
167
169 double dt;
171 double refresh;
173 std::string simulatorName;
174
176 int step;
185
186private:
187
189 void buildMonitors();
191 void buildLoads();
195 void buildPmlAndSimulator(bool delPml = true);
197 void buildPmlAndSimulatorfromPml();
199 void buildPmlAndSimulatorfromSimulator();
200
202 PhysicalModel* pml;
204 bool ownPml;
206 double* oldPositionPointer;
208 PhysicalModel* initPml;
210 Loads* lml;
212 bool ownLml;
214 std::string pmlFileName;
216 std::string lmlFileName;
218 std::string mmlFileName;
220 std::string mmlFileFolder;
221
222};
223
224#endif // MANAGER_MONITORINGMANAGERF_H
#define MML_API
Definition MMLAPI.h:43
This class makes it possible to manage a list of "Load".
Definition Loads.h:71
A monitor calculate and store followed data (ex:calculation between current position and references) ...
Definition Monitor.h:49
Manager of the benchmark tests.
Definition MonitoringManager.h:50
double refresh
refreshing step
Definition MonitoringManager.h:171
std::vector< mml::TimeStep * > times
Vector that contains information saved by saveMonitors method.
Definition MonitoringManager.h:166
double computingTime
total computing time at current moment
Definition MonitoringManager.h:182
Simulator * simul
the simulator used for simualtion
Definition MonitoringManager.h:184
double currentTime
time at current moment
Definition MonitoringManager.h:178
std::vector< Monitor * > monitors
Vector that contains all monitors.
Definition MonitoringManager.h:164
double stepComputingTime
computing time of last step
Definition MonitoringManager.h:180
std::unique_ptr< mml::MonitoringIn > mmlIn
Object representing manager in the file generated by xsdcxx, can be used for serialization.
Definition MonitoringManager.h:162
int step
current step
Definition MonitoringManager.h:176
double dt
integration step
Definition MonitoringManager.h:169
std::string simulatorName
name of the simulator
Definition MonitoringManager.h:173
virtual bool checkStop()=0
Check if simulation is finished.
virtual void end()=0
End manager.
virtual void doMove()=0
Do one step of simulation and save monitors for this step.
virtual bool init()=0
Initialize manager.
This is the main class of this project.
Definition PhysicalModel.h:86
A simulator engine is used to compute the displacements of all atoms of the model.
Definition Simulator.h:46