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 private:
00083
00084 SimulationBlob& m_SimulationBlob;
00085
00086 openfluid::base::RuntimeEnvironment* mp_RunEnv;
00087
00088 openfluid::base::SimulationStatus* mp_SimStatus;
00089
00090
00091
00092 MachineListener* mp_MachineListener;
00093
00094 openfluid::io::IOListener* mp_IOListener;
00095
00096 ModelInstance& m_ModelInstance;
00097
00098 openfluid::io::OutputsWriter* mp_OutputsWriter;
00099
00100 openfluid::io::MessagesWriter* mp_MessagesWriter;
00101
00102
00103
00104 void checkSimulationVarsProduction(int ExpectedVarsCount);
00105
00106 void checkModelConsistency();
00107
00108 void checkInputDataConsistency();
00109
00110 void checkExtraFilesConsistency();
00111
00112 void checkExistingVariable(openfluid::core::VariableName_t VarName,
00113 openfluid::core::UnitClass_t ClassName,
00114 std::string FunctionName);
00115
00116 void createVariable(openfluid::core::VariableName_t VarName,
00117 openfluid::core::UnitClass_t ClassName,
00118 bool UpdateMode,
00119 std::string FunctionName);
00120
00121 void checkExistingInputData(openfluid::core::InputDataName_t DataName,
00122 openfluid::core::UnitClass_t ClassName,
00123 std::string FunctionName);
00124
00125 void prepareOutputDir();
00126
00127 void initOutputs();
00128
00129 void prepareOutputs();
00130
00131 void saveOutputs(const openfluid::core::DateTime& CurrentDT);
00132
00133 void saveSimulationInfos();
00134
00135
00136
00137 public:
00141 Engine(SimulationBlob& SimBlob, ModelInstance& MInstance,
00142 openfluid::machine::MachineListener* MachineListener,
00143 openfluid::io::IOListener* IOListener);
00144
00148 ~Engine();
00149
00150
00151 void initParams();
00152
00153 void prepareData();
00154
00155 void checkConsistency();
00156
00157 void run();
00158
00159 void saveReports();
00160
00161 void closeOutputs();
00162
00163 openfluid::base::SimulationInfo *getSimulationInfo() { return (openfluid::base::SimulationInfo*)mp_SimStatus; };
00164
00165 };
00166
00167
00168 } }
00169
00170
00171 #endif
00172
00173
00174
00175
00176
00177
00178