Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00056 #ifndef __ENGINE_HPP__
00057 #define __ENGINE_HPP__
00058
00059
00060 #include <openfluid/dllexport.hpp>
00061 #include <openfluid/core.hpp>
00062 #include <openfluid/base.hpp>
00063 #include <openfluid/io.hpp>
00064 #include <openfluid/machine/PluginManager.hpp>
00065 #include <openfluid/base/RuntimeEnv.hpp>
00066 #include <openfluid/machine/ModelInstance.hpp>
00067 #include <openfluid/machine/MachineListener.hpp>
00068 #include <openfluid/machine/SimulationBlob.hpp>
00069
00070 namespace openfluid { namespace machine {
00071
00072
00073
00074
00075
00076
00080 class DLLEXPORT Engine
00081 {
00082 public:
00083
00084 struct PretestInfos_t
00085 {
00086 bool Model;
00087 std::string ModelMsg;
00088
00089 bool Inputdata;
00090 std::string InputdataMsg;
00091
00092 bool ExtraFiles;
00093 std::string ExtraFilesMsg;
00094
00095 PretestInfos_t() : Model(true), ModelMsg(""),
00096 Inputdata(true), InputdataMsg(""),
00097 ExtraFiles(true), ExtraFilesMsg("")
00098 { };
00099 };
00100
00101 private:
00102
00103 SimulationBlob& m_SimulationBlob;
00104
00105 openfluid::base::RuntimeEnvironment* mp_RunEnv;
00106
00107 openfluid::base::SimulationStatus* mp_SimStatus;
00108
00109
00110
00111 MachineListener* mp_MachineListener;
00112
00113 openfluid::io::IOListener* mp_IOListener;
00114
00115 ModelInstance& m_ModelInstance;
00116
00117 openfluid::io::OutputsWriter* mp_OutputsWriter;
00118
00119 openfluid::io::MessagesWriter* mp_MessagesWriter;
00120
00121
00122
00123 void checkSimulationVarsProduction(int ExpectedVarsCount);
00124
00125 void checkModelConsistency();
00126
00127 void checkInputDataConsistency();
00128
00129 void checkExtraFilesConsistency();
00130
00131 void checkExistingVariable(openfluid::core::VariableName_t VarName,
00132 openfluid::core::UnitClass_t ClassName,
00133 std::string FunctionName);
00134
00135 void createVariable(openfluid::core::VariableName_t VarName,
00136 openfluid::core::UnitClass_t ClassName,
00137 bool UpdateMode,
00138 std::string FunctionName);
00139
00140 void checkExistingInputData(openfluid::core::InputDataName_t DataName,
00141 openfluid::core::UnitClass_t ClassName,
00142 std::string FunctionName);
00143
00144 void prepareOutputDir();
00145
00146 void initOutputs();
00147
00148 void prepareOutputs();
00149
00150 void saveOutputs(const openfluid::core::DateTime& CurrentDT);
00151
00152 void saveSimulationInfos();
00153
00154 void saveSimulationProfile();
00155
00156
00157 public:
00161 Engine(SimulationBlob& SimBlob, ModelInstance& MInstance,
00162 openfluid::machine::MachineListener* MachineListener,
00163 openfluid::io::IOListener* IOListener);
00164
00168 ~Engine();
00169
00170
00171 void pretestConsistency(PretestInfos_t& PretestInfos);
00172
00173
00174 void initParams();
00175
00176 void prepareData();
00177
00178 void checkConsistency();
00179
00180 void run();
00181
00182 void saveReports();
00183
00184 void closeOutputs();
00185
00186 openfluid::base::SimulationInfo* getSimulationInfo() { return (openfluid::base::SimulationInfo*)mp_SimStatus; };
00187
00188 SimulationBlob* getSimulationBlob() { return &m_SimulationBlob; };
00189
00190 MachineListener* getMachineListener() { return mp_MachineListener; };
00191
00192 openfluid::io::IOListener* getIOListener() { return mp_IOListener; };
00193
00194 ModelInstance* getModelInstance() { return &m_ModelInstance; };
00195
00196
00197 };
00198
00199
00200 } }
00201
00202
00203 #endif
00204
00205
00206
00207
00208
00209
00210