Documentation for OpenFLUID 2.2.2
Loading...
Searching...
No Matches
RunSimulationWorker.hpp
Go to the documentation of this file.
1/*
2
3 This file is part of OpenFLUID software
4 Copyright(c) 2021-2026, INRAE
5
6
7 == GNU General Public License Usage ==
8
9 OpenFLUID is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 OpenFLUID is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21
22
23 == Other Usage ==
24
25 Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26 license, and requires a written agreement between You and INRA.
27 Licensees for Other Usage of OpenFLUID may use this file in accordance
28 with the terms contained in the written agreement between You and INRA.
29
30*/
31
32
33/**
34 @file RunSimulationWorker.hpp
35
36 @author Jean-Christophe FABRE <jean-christophe.fabre@inra.fr>
37 */
38
39
40#ifndef __OPENFLUID_UICOMMON_RUNSIMULATIONWORKER_HPP__
41#define __OPENFLUID_UICOMMON_RUNSIMULATIONWORKER_HPP__
42
43
44#include <QApplication>
45#include <QMetaType>
46
50
51
52namespace openfluid {
53
54namespace fluidx {
55 class FluidXDescriptor;
56}
57
58
59namespace ui { namespace common {
60
61
63{
64 Q_OBJECT;
65
66 public:
67
68 enum class Stage { BEFORE, PRESIM, INIT, RUN, FINAL, AFTER };
69
70 private:
71
72 unsigned int m_CurrentIndex;
73 std::string m_CurrentIndexStr;
74 unsigned int m_CurrentSimulator;
75
76 unsigned int m_TotalTime;
77 unsigned int m_TotalSimulators;
78
79 unsigned int m_CurrentPreSim;
80 unsigned int m_CurrentInit;
81 unsigned int m_CurrentFinal;
82 unsigned int m_TotalTotal;
83
84 bool m_Completed;
85
86 openfluid::core::Duration_t m_SimDuration;
87
88 bool m_PausedByUser;
89 bool m_ConfirmedPauseByUser;
90
91 bool m_AbortedByUser;
92
93
94 signals:
95
97
98 void progressValueChanged(int Index);
99
100 void progressMaxChanged(int Index);
101
103
104
105 public slots:
106
108
110
111
112 public:
113
115
117
118
119 void setInfos(const unsigned int& TotalSimulators, const unsigned int& TotalTime);
120
122
123
125
127
129
131
133
135
136
137 void onSimulatorInitParams(const std::string& /*SimulatorID*/);
138
139 void onSimulatorPrepareData(const std::string& /*SimulatorID*/);
140
141 void onSimulatorCheckConsistency(const std::string& /*SimulatorID*/);
142
143 void onSimulatorInitializeRun(const std::string& /*SimulatorID*/);
144
145 void onSimulatorRunStep(const std::string& /*SimulatorID*/);
146
147 void onSimulatorFinalizeRun(const std::string& /*SimulatorID*/);
148
149};
150
151
152// =====================================================================
153// =====================================================================
154
155
156class OPENFLUID_API RunSimulationWorker : public QObject
157{
158
159 Q_OBJECT;
160
161 private:
162
164
165 RunSimulationListener* mp_Listener;
166
167
168 signals:
169
170 void periodChanged(QString Begin, QString End, int Duration);
171
172 void warningsChanged(unsigned int Count);
173
174 void finished();
175
176 void error(QString Error, openfluid::base::ExceptionContext Context);
177
178 void userAbort();
179
180
181 public slots:
182
183 void run();
184
185
186 public:
187
189
191
192};
193
194
195} } } //namespaces
196
197
199
200
201#endif /* __OPENFLUID_UICOMMON_RUNSIMULATIONWORKER_HPP__ */
Q_DECLARE_METATYPE(openfluid::ui::common::RunSimulationListener::Stage)
Definition ExceptionContext.hpp:54
Status
Definition Listener.hpp:52
Definition SimulationStatus.hpp:56
Definition FluidXDescriptor.hpp:60
Definition MachineListener.hpp:55
Definition RunSimulationWorker.hpp:63
void onFinalizeRunDone(const openfluid::base::Listener::Status &)
void setInfos(const unsigned int &TotalSimulators, const unsigned int &TotalTime)
void onSimulatorRunStep(const std::string &)
void onSimulatorFinalizeRun(const std::string &)
Stage
Definition RunSimulationWorker.hpp:68
void onSimulatorInitParams(const std::string &)
void onSimulatorCheckConsistency(const std::string &)
void onRunStep(const openfluid::base::SimulationStatus *SimStatus)
void onSimulatorPrepareData(const std::string &)
void onSimulatorInitializeRun(const std::string &)
void stageChanged(openfluid::ui::common::RunSimulationListener::Stage S)
Definition RunSimulationWorker.hpp:157
void warningsChanged(unsigned int Count)
RunSimulationWorker(const openfluid::fluidx::FluidXDescriptor *FXDesc, RunSimulationListener *Listener)
void error(QString Error, openfluid::base::ExceptionContext Context)
void periodChanged(QString Begin, QString End, int Duration)
#define OPENFLUID_API
Definition dllexport.hpp:86
std::uint64_t Duration_t
Definition TypeDefs.hpp:312
Definition ApplicationException.hpp:47