Computer Assisted Medical Intervention Tool Kit  version 5.1
 
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-2023 Univ. Grenoble Alpes, CNRS, Grenoble INP, 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
58 MonitoringManager(const char* mml);
59
61 virtual ~MonitoringManager();
62
66 virtual bool init() = 0;
68 virtual void end() = 0;
69
71 void simulate();
73 virtual void doMove() = 0;
75 virtual bool checkStop() = 0;
77 void rewind();
81 void reload(bool delPml = true);
82
84 void saveMonitors();
86 void writeOutput(const char* fileName);
88 void writeCsv(const char* fileName);
90 void saveMmlIn(const char* fileName);
91
94 double getDt();
95 double getRefresh();
96 double getCurrentTime();
97 double getCurrentStep();
98 double getStepComputingTime();
99 double getComputingTime();
100 PhysicalModel* getInitPml();
101 PhysicalModel* getPml();
107 PhysicalModel* takePml();
108 Loads* getLml();
114 Loads* takeLml();
115 std::string getPmlFileName();
116 std::string getLmlFileName();
117 std::string getMmlFileName();
118 std::string getmmlFileFolder();
119 Simulator* getSimulator();
121 void getOldPosition(double pos[3], unsigned int index);
123
125 void setCurrentTime(double time);
126
128 void storeOldPositions();
130 void updateCurrentTime();
132 void updateComputingTime();
134 void incStep();
135
137 void setDt(double dt);
139 void setRefresh(double refresh);
141 void setPmlFileName(const char* file);
143 void setLmlFileName(const char* file);
144
145 //accessors and mutators for monitors
147 void addMonitor(Monitor* monitor);
149 Monitor* getMonitor(const unsigned int i) const;
151 void deleteMonitor(const unsigned int i);
153 unsigned int numberOfMonitor() const;
154
156 bool isPmlPresent();
158 bool isLmlPresent();
159
160protected:
161
163 std::unique_ptr<mml::MonitoringIn> mmlIn;
165 std::vector<Monitor*> monitors;
167 std::vector<mml::TimeStep*> times;
168
170 double dt;
172 double refresh;
174 std::string simulatorName;
175
177 int step;
186
187private:
188
190 void buildMonitors();
192 void buildLoads();
196 void buildPmlAndSimulator(bool delPml = true);
198 void buildPmlAndSimulatorfromPml();
200 void buildPmlAndSimulatorfromSimulator();
201
203 PhysicalModel* pml;
205 bool ownPml;
207 double* oldPositionPointer;
209 PhysicalModel* initPml;
211 Loads* lml;
213 bool ownLml;
215 std::string pmlFileName;
217 std::string lmlFileName;
219 std::string mmlFileName;
221 std::string mmlFileFolder;
222
223};
224
225#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:172
std::vector< mml::TimeStep * > times
Vector that contains information saved by saveMonitors method.
Definition MonitoringManager.h:167
double computingTime
total computing time at current moment
Definition MonitoringManager.h:183
Simulator * simul
the simulator used for simualtion
Definition MonitoringManager.h:185
double currentTime
time at current moment
Definition MonitoringManager.h:179
std::vector< Monitor * > monitors
Vector that contains all monitors.
Definition MonitoringManager.h:165
double stepComputingTime
computing time of last step
Definition MonitoringManager.h:181
std::unique_ptr< mml::MonitoringIn > mmlIn
Object representing manager in the file generated by xsdcxx, can be used for serialization.
Definition MonitoringManager.h:163
int step
current step
Definition MonitoringManager.h:177
double dt
integration step
Definition MonitoringManager.h:170
std::string simulatorName
name of the simulator
Definition MonitoringManager.h:174
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