diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverTimeModeManager.cpp b/CFDStruct/CFDStructDataManager/CFDStructDataSolverTimeModeManager.cpp index 53e6cff..e6eb373 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataSolverTimeModeManager.cpp +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverTimeModeManager.cpp @@ -41,36 +41,45 @@ CUIConfig *CFDStructDataSolverTimeModeManager::getParamUIConfig() { void CFDStructDataSolverTimeModeManager::saveDataToDom(rapidjson::Document &dom) { jsonAdd(dom, m_runtype, {"region", 0, "solver", "time"}); - jsonAdd(dom, m_innerIters, { - "couplingSolver", - "unSteady", - "innerIters", - }); - jsonAdd(dom, m_iters, { - "couplingSolver", - "steady", - "iters", - }); - jsonAdd(dom, m_alf0, { - "couplingSolver", - "unSteady", - "stepType", - }); - jsonAdd(dom, m_realdt, { - "couplingSolver", - "unSteady", - "timeStep", - }); - jsonAdd(dom, m_nstep, { - "couplingSolver", - "unSteady", - "timeStepsNumber", - }); - jsonAdd(dom, m_timeaverage, { - "couplingSolver", - "unSteady", - "Timeverage", - }); + jsonAdd(dom, m_innerIters, {"couplingSolver", "unSteady", "innerIters"}); + jsonAdd(dom, m_iters, {"couplingSolver", "steady", "iters"}); + jsonAdd(dom, m_alf0, {"couplingSolver", "unSteady", "stepType"}); + jsonAdd(dom, m_realdt, {"couplingSolver", "unSteady", "timeStep"}); + jsonAdd(dom, m_nstep, {"couplingSolver", "unSteady", "timeStepsNumber"}); + jsonAdd(dom, m_timeaverage, {"couplingSolver", "unSteady", "Timeverage"}); +} + +void CFDStructDataSolverTimeModeManager::readDataFromDom(rapidjson::Document &dom) { + QVariant temp; + + jsonRead(dom, temp, {"region", 0, "solver", "time"}); + if (temp != QVariant()) { + m_runtype = temp.toInt(); + } + jsonRead(dom, temp, {"couplingSolver", "unSteady", "innerIters"}); + if (temp != QVariant()) { + m_innerIters = temp.toInt(); + } + jsonRead(dom, temp, {"couplingSolver", "steady", "iters"}); + if (temp != QVariant()) { + m_iters = temp.toInt(); + } + jsonRead(dom, temp, {"couplingSolver", "unSteady", "stepType"}); + if (temp != QVariant()) { + m_alf0 = temp.toDouble(); + } + jsonRead(dom, temp, {"couplingSolver", "unSteady", "timeStep"}); + if (temp != QVariant()) { + m_realdt = temp.toDouble(); + } + jsonRead(dom, temp, {"couplingSolver", "unSteady", "timeStepsNumber"}); + if (temp != QVariant()) { + m_nstep = temp.toInt(); + } + jsonRead(dom, temp, {"couplingSolver", "unSteady", "Timeverage"}); + if (temp != QVariant()) { + m_timeaverage = temp.toInt(); + } } CUIConfig *CFDStructDataSolverTimeModeManager::genSteadyModeUIConfig() { diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverTimeModeManager.h b/CFDStruct/CFDStructDataManager/CFDStructDataSolverTimeModeManager.h index 5baaed8..41a5717 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataSolverTimeModeManager.h +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverTimeModeManager.h @@ -1,28 +1,32 @@ -#ifndef CFDSTRUCTDATASOLVERTIMEMODEMANAGER_H +/** + * 时间模式 + */ +#ifndef CFDSTRUCTDATASOLVERTIMEMODEMANAGER_H #define CFDSTRUCTDATASOLVERTIMEMODEMANAGER_H -#include #include "CFDStructDataManager_global.h" +#include class CUIConfig; -class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverTimeModeManager : public CFDStructDataManagerBase -{ +class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverTimeModeManager : public CFDStructDataManagerBase { Q_OBJECT -public: + public: explicit CFDStructDataSolverTimeModeManager(QObject *parent = nullptr); ~CFDStructDataSolverTimeModeManager(); - CUIConfig* getParamUIConfig(); + CUIConfig *getParamUIConfig(); void saveDataToDom(rapidjson::Document &dom); -private: + void readDataFromDom(rapidjson::Document &dom); + + private: // 生成定常的界面配置 - CUIConfig* genSteadyModeUIConfig(); + CUIConfig *genSteadyModeUIConfig(); // 生成非定常的截面配置 - CUIConfig* genUnsteadyModeUIConfig(); -signals: + CUIConfig *genUnsteadyModeUIConfig(); + signals: -private: + private: // 时间模式:定常0,非定常1 int m_runtype = 0; // 内迭代步数