DamBreak++ Wave Simulator 0.3
DamBreak++ Simulation Framework
Loading...
Searching...
No Matches
Sfx_Simulation.h
Go to the documentation of this file.
1#pragma once
2
3// C++ include
4#include <string>
5#include <filesystem>
6// SfxBase19 lib include
7#include "include/Sfx_DefineTypes.h"
8// Framework Library include
9#include "include/Sfx_Singleton.hpp"
10
11namespace Sfx
12{
21 class Simulation : public Sfx::SfxSingleton<Simulation>
22 {
26 using ArrayType = std::vector<float64>; // Warning: also define in Sfx_defineTypes.h
27
28 public:
33 std::string getCalculFFSchemeName() const noexcept
34 {
35 return m_simProp.m_CalculFFSchemeName;
36 }
37
41 void setCalculFFSchemeName(const std::string& aCalculFFSchemeName) noexcept
42 {
43 m_simProp.m_CalculFFSchemeName = aCalculFFSchemeName;
44 }
45
49 void setPerformMeasurement(bool measurement) noexcept
50 {
51 m_simProp.m_performMeasurement = measurement;
52 }
53
57 void setNumberMeasurements(uint32 aNumofMeasurements) noexcept
58 {
59 m_simProp.m_numberMeasuremenst = aNumofMeasurements;
60 }
61
65 void setDataStore(const std::string& dataStore) noexcept
66 {
67 m_simProp.m_dataStoreName = dataStore;
68 }
69
73 void setDataStoreFile(std::string aDataStoreFile) noexcept {/*to be completed*/ }
74
76 void setDoFinalReport(bool doFinalReport) noexcept { m_simProp.m_doFinalRep = doFinalReport; }
77
79 bool doFinalReport() const noexcept { return m_simProp.m_doFinalRep; }
85 void setFinalReportClass(const std::string& finalReportClass) noexcept {/*not implemented yet*/ }
90 void setPhysicalConfigureClass(const std::string& aConfClass) noexcept
91 {
92 m_simProp.m_physConfigClass = aConfClass;
93 }
94
98 void setPhysicalAlgoClass(const std::string& aAlgoClass) noexcept
99 {
100 m_simProp.m_physAlgoClass = aAlgoClass;
101 }
102
106 bool getPerformMeasurement() const noexcept { return m_simProp.m_performMeasurement; }
111 uint32 getNumberMeasurements() const noexcept { return m_simProp.m_numberMeasuremenst; }
116 std::string getDataStore() const noexcept { return m_simProp.m_dataStoreName; }
121 const std::string getDataStoreFile() const noexcept { return m_simProp.m_dataStoreFile; }
126 void setPhysicalMeasurementClass( std::string aPhysicalMeasureClass) { m_simProp.m_physMeasurementClass = aPhysicalMeasureClass; }
131 std::string getPhysicalMeasurementClass() const noexcept
132 {
133 return m_simProp.m_physMeasurementClass;
134 }
135
139 std::string getPhysicalConfigurationClass() const noexcept
140 {
141 return m_simProp.m_physConfigClass;
142 }
143
147 void setPhysicalConfigurationClass(std::string aPhysicalConfig) noexcept
148 { m_simProp.m_physConfigClass = aPhysicalConfig; }
149
153 std::string getPhysicalAlgorithmClass() const noexcept
154 {
155 return m_simProp.m_physAlgoClass;
156 }
157
160 void setPhysicalAlgorithmClass(std::string aPhysicalAlgo) noexcept { m_simProp.m_physAlgoClass = aPhysicalAlgo; }
165 std::string getFinalReportClass() const noexcept { return std::string{ "" }; }
170 void setPhysicalSystemClass( std::string aPhysicalSystemClass) noexcept {}
175 std::string getInitialCnd() const noexcept { return std::string{ "" }; }
179 void setBoundaryCnd(std::string aBoundaryCnd) noexcept {}
184 std::string getBoundaryCnd() noexcept { return std::string{ "" }; }
188 void setNumericalMethod(std::string aNumethod) noexcept
189 {
190 m_simProp.m_numericalMethod = aNumethod;
191 }
192
196 std::string getNumericalMethod() const noexcept { return m_simProp.m_numericalMethod; }
201 float64 getSimulationStartTime() const noexcept { return m_simProp.m_startTime; }
206 void setSimulationStartTime(float64 aStartTime) noexcept
207 {
208 m_simProp.m_startTime = aStartTime;
209 m_simProp.m_simTime = aStartTime;
210 }
211
215 void setSimulationTime(float64 aTime) noexcept { m_simProp.m_simTime = aTime; }
220 float64 getSimulationTime() const noexcept { return m_simProp.m_simTime; /*+= getSimulationTimeStep();*/ }
225 void setNumTimeStep(uint32 aNumTimeStep) noexcept { m_simProp.m_numTimeStep = aNumTimeStep; }
230 uint32 getNumTimeStep() noexcept { return m_simProp.m_numTimeStep; }
235 void setSimulationTimeStep(const float64 aTimeStep) noexcept
236 {
237 m_simProp.m_timeStep = aTimeStep;
238 updateTime();
239 }
240
244 const float64 getSimulationTimeStep() const noexcept { return m_simProp.m_timeStep; }
248 void updateTime() noexcept
249 {
250 m_simProp.m_simTime += getSimulationTimeStep();
251 }
252
256 std::string toString() const noexcept { return std::string{ "" }; }
260 struct SimProp;
266 Simulation::SimProp loadPropertyFile( const std::filesystem::path& aFilePropPath/*std::string aPropFile*/);
271 void setParamsFileName(std::string aPropFileName) { m_simProp.m_propFileName = aPropFileName; }
276 std::string getParamsFileName() const { return m_simProp.m_propFileName; }
280 friend class Sfx::SfxSingleton<Simulation>;
281 public:
288 struct SimProp
289 {
294 {
295 m_performMeasurement = true;
296 m_doFinalRep = true;
298 m_CalculFFSchemeName = std::string{ "HLL_Scheme" }; // flux function
299 m_propFileName = std::string{ "DbppSimulationProp.txt" };
300 m_dataStoreFile = std::string{ "HLL_Scheme_FullResult.txt" };
301 m_dataStoreName = std::string{ "FileDataStore" };
302 m_physMeasurementClass = std::string{ "DamBreakMeasure" };
303 m_physConfigClass = std::string{ "DamBreakSetup" };
304 m_physAlgoClass = std::string{ "PhysicalAlgo" };
305 m_phySystemClass = std::string{ "DamBreakSystem" };
306 m_numericalMethod = std::string{ "Rk2HllScheme" };
307 m_boundaryCnd = std::string{ "EMcNeilBnd" };
308 m_NbIterations = 1;
309 m_startTime = 0.;
310 m_stopTime = 0.;
311 m_simTime = 0.;
312 m_maxTimeStep = 0.1;
313 m_lastTime = 0.;
314 m_timeStep = 0.1;
315 m_numTimeStep = 1;
316 // m_lastTime = 0.; /**< */
317 }
322 std::string m_propFileName;
323 std::string m_dataStoreName;
324 std::string m_dataStoreFile;
326 std::string m_physConfigClass;
327 std::string m_physAlgoClass;
328 std::string m_phySystemClass;
329 std::string m_numericalMethod;
330 std::string m_boundaryCnd;
332 float64 m_startTime;
333 float64 m_stopTime;
334 float64 m_simTime;
335 float32 m_lastTime;
336 float64 m_timeStep;
339 // std::string m_equationName;
340 // private:
341 // std::string m_fileDataStore;
343
344 protected:
346 Simulation() = default;
350 ~Simulation() = default;
355 Simulation( const Simulation& aOther) = delete;
361 Simulation& operator= (const Simulation& aOther) = delete;
362 private:
363 //
364 // Simulation properties
365 //
366 // int32 m_NbIterations; // ...
367 //bool m_isRunning; simulation state
368 // float64 m_simTime;
369 // float32 m_MaxTimeStep; // step size (dt)
370 //float32 m_LastTime; // ...
371 //float64 m_timeStep;
372 // std::string m_algoName; //
373 // std::list<std::string> m_listOfAlgorithm;
374 //private:
375 // bool m_doFinalrep;
376 };
377}// End of namespace
Bean that represents a simulation in the framework. Many of the attributes of the simulation bean are...
Definition Sfx_Simulation.h:22
std::string getNumericalMethod() const noexcept
Getter.
Definition Sfx_Simulation.h:196
std::string getDataStore() const noexcept
Getter.
Definition Sfx_Simulation.h:116
void setPhysicalMeasurementClass(std::string aPhysicalMeasureClass)
Set class name.
Definition Sfx_Simulation.h:126
float64 getSimulationStartTime() const noexcept
Getter.
Definition Sfx_Simulation.h:201
std::string getCalculFFSchemeName() const noexcept
Numerical algorithm for the current simulation.
Definition Sfx_Simulation.h:33
void setSimulationStartTime(float64 aStartTime) noexcept
Use this method to specify the time at the start of the simulation.
Definition Sfx_Simulation.h:206
Simulation::SimProp loadPropertyFile(const std::filesystem::path &aFilePropPath)
load property file of the simulation
Definition Sfx_Simulation.cpp:16
void updateTime() noexcept
Use this method to set the time during any point during the simulation.
Definition Sfx_Simulation.h:248
bool doFinalReport() const noexcept
Definition Sfx_Simulation.h:79
uint32 getNumTimeStep() noexcept
Return the number of time step.
Definition Sfx_Simulation.h:230
void setPhysicalConfigureClass(const std::string &aConfClass) noexcept
Set configuration class name.
Definition Sfx_Simulation.h:90
struct Sfx::Simulation::SimProp m_simProp
Simulation(const Simulation &aOther)=delete
Disable copy ctor.
std::string getBoundaryCnd() noexcept
boundary condition name
Definition Sfx_Simulation.h:184
Simulation & operator=(const Simulation &aOther)=delete
Disable assign ctor.
void setDataStoreFile(std::string aDataStoreFile) noexcept
Use this method to specify the DataStoreFile.
Definition Sfx_Simulation.h:73
void setBoundaryCnd(std::string aBoundaryCnd) noexcept
Use this method to specify the Boundary Condition Type.
Definition Sfx_Simulation.h:179
void setSimulationTime(float64 aTime) noexcept
Use this method to specify the time during any point during the simulation.
Definition Sfx_Simulation.h:215
std::vector< float64 > ArrayType
Alias (array type)
Definition Sfx_Simulation.h:26
void setCalculFFSchemeName(const std::string &aCalculFFSchemeName) noexcept
Set Numerical flux pointer to function.
Definition Sfx_Simulation.h:41
void setNumberMeasurements(uint32 aNumofMeasurements) noexcept
Set number of measurements.
Definition Sfx_Simulation.h:57
void setDataStore(const std::string &dataStore) noexcept
Use this method to specify the DataStore.
Definition Sfx_Simulation.h:65
const float64 getSimulationTimeStep() const noexcept
Use this method to get the interval which is usually a timestep.
Definition Sfx_Simulation.h:244
const std::string getDataStoreFile() const noexcept
Getter.
Definition Sfx_Simulation.h:121
void setPhysicalSystemClass(std::string aPhysicalSystemClass) noexcept
Use this method to specify the PhysicalSystemClass.
Definition Sfx_Simulation.h:170
void setPhysicalConfigurationClass(std::string aPhysicalConfig) noexcept
Use this method to specify the PhysicalConfigurationClass.
Definition Sfx_Simulation.h:147
void setPerformMeasurement(bool measurement) noexcept
Flag to set if measure to be taken.
Definition Sfx_Simulation.h:49
Simulation()=default
prevent client from using it
std::string toString() const noexcept
string representation of the object
Definition Sfx_Simulation.h:256
std::string getPhysicalMeasurementClass() const noexcept
Use this method to get the PhysicalMeasurementClass.
Definition Sfx_Simulation.h:131
std::string getFinalReportClass() const noexcept
Get the class for the final report.
Definition Sfx_Simulation.h:165
void setPhysicalAlgorithmClass(std::string aPhysicalAlgo) noexcept
Use this method to specify the PhysicalAlgorithmClass.
Definition Sfx_Simulation.h:160
~Simulation()=default
Dtor.
void setPhysicalAlgoClass(const std::string &aAlgoClass) noexcept
Set algorithm class name.
Definition Sfx_Simulation.h:98
void setNumericalMethod(std::string aNumethod) noexcept
Use this method to specify the Numerical Method.
Definition Sfx_Simulation.h:188
void setDoFinalReport(bool doFinalReport) noexcept
Definition Sfx_Simulation.h:76
void setParamsFileName(std::string aPropFileName)
Set file name.
Definition Sfx_Simulation.h:271
void setFinalReportClass(const std::string &finalReportClass) noexcept
Use this method to define a class that performs a summary report of the simulation.
Definition Sfx_Simulation.h:85
uint32 getNumberMeasurements() const noexcept
Getter.
Definition Sfx_Simulation.h:111
std::string getPhysicalConfigurationClass() const noexcept
Use this method to get the PhysicalConfigurationClass.
Definition Sfx_Simulation.h:139
std::string getInitialCnd() const noexcept
Initial conditon name.
Definition Sfx_Simulation.h:175
void setSimulationTimeStep(const float64 aTimeStep) noexcept
Use this method to specify the timestep interval to be used to calculate the running time.
Definition Sfx_Simulation.h:235
float64 getSimulationTime() const noexcept
Return current time of the simulation.
Definition Sfx_Simulation.h:220
std::string getPhysicalAlgorithmClass() const noexcept
Get the PhysicalAlgorithmClass name.
Definition Sfx_Simulation.h:153
bool getPerformMeasurement() const noexcept
Getter.
Definition Sfx_Simulation.h:106
void setNumTimeStep(uint32 aNumTimeStep) noexcept
Set the number of time-step.
Definition Sfx_Simulation.h:225
std::string getParamsFileName() const
Getter.
Definition Sfx_Simulation.h:276
Definition HydUtils.h:15
Property loaded at initialization (from file, user) Struct that hold parameters for the current simul...
Definition Sfx_Simulation.h:289
bool m_performMeasurement
Definition Sfx_Simulation.h:319
std::string m_physAlgoClass
Definition Sfx_Simulation.h:327
bool m_doFinalRep
Definition Sfx_Simulation.h:318
std::string m_numericalMethod
Definition Sfx_Simulation.h:329
int32 m_NbIterations
Definition Sfx_Simulation.h:331
float64 m_simTime
Definition Sfx_Simulation.h:334
std::string m_phySystemClass
Definition Sfx_Simulation.h:328
std::string m_dataStoreFile
Definition Sfx_Simulation.h:324
std::string m_propFileName
Definition Sfx_Simulation.h:322
float32 m_lastTime
Definition Sfx_Simulation.h:335
uint32 m_numberMeasuremenst
Definition Sfx_Simulation.h:320
std::string m_boundaryCnd
Definition Sfx_Simulation.h:330
float64 m_maxTimeStep
Definition Sfx_Simulation.h:338
std::string m_physMeasurementClass
Definition Sfx_Simulation.h:325
std::string m_physConfigClass
Definition Sfx_Simulation.h:326
SimProp()
default ctor (phase we overwrite these at loading)
Definition Sfx_Simulation.h:293
float64 m_stopTime
Definition Sfx_Simulation.h:333
std::string m_dataStoreName
Definition Sfx_Simulation.h:323
float64 m_startTime
Definition Sfx_Simulation.h:332
uint32 m_numTimeStep
Definition Sfx_Simulation.h:337
std::string m_CalculFFSchemeName
Definition Sfx_Simulation.h:321
float64 m_timeStep
Definition Sfx_Simulation.h:336