#include "CFDStructDataSolverTimeModeManager.h" #include "CUIProperty/CUIConfig.h" #include "CFDStructMain/CFDStructDefine.h" #include "CFDStructSigsCenter.h" #include "CUIProperty/CUISigsCenter.h" #include CFDStructDataSolverTimeModeManager::CFDStructDataSolverTimeModeManager(QObject *parent) : QObject(parent) { m_uiConfig = nullptr; connect(CUISigsCenter::getInstance(), &CUISigsCenter::sig_cuiPropertyChanged, this, [ = ](int semaphore) { qDebug() << semaphore << " ========================"; emit CFDStructSigsCenter::getInstance()->sig_solverTimeModeDataChanged(); }); } CFDStructDataSolverTimeModeManager::~CFDStructDataSolverTimeModeManager() { if (m_uiConfig != nullptr) { delete m_uiConfig; m_uiConfig = nullptr; } } CUIConfig *CFDStructDataSolverTimeModeManager::getParamUIConfig() { if (m_uiConfig != nullptr) { delete m_uiConfig; m_uiConfig = nullptr; } // 如果是定常 if (m_runtype == 0) { m_uiConfig = this->genSteadyModeUIConfig(); qDebug() << " steady ============"; } else { // 如果是非定常 m_uiConfig = this->genUnsteadyModeUIConfig(); qDebug() << " unsteady ============"; } m_uiConfig->printConfig(); return m_uiConfig; } CUIConfig *CFDStructDataSolverTimeModeManager::genSteadyModeUIConfig() { return new CUIConfig({ {"type", "Widget"}}, { new CUIConfig({ {"type", "ComboBox"}, {"name", "Time Mode"}, {"valueType", "Int"}, {"valueOrigin", QVA_GLOBAL(&m_runtype)}, {"semaphore", 1}, }, { new CUIConfig({ {"type", "Item"}, {"name", "steady"}, {"data", "0"}, }), new CUIConfig({ {"type", "Item"}, {"name", "unsteady"}, {"data", "1"}, }) }), new CUIConfig({ {"type", "LineEdit"}, {"name", "iteration count"} }) }); } CUIConfig *CFDStructDataSolverTimeModeManager::genUnsteadyModeUIConfig() { return new CUIConfig({ {"type", "Widget"} }, { new CUIConfig({ {"type", "ComboBox"}, {"name", "Time Mode"}, {"valueType", "Int"}, {"valueOrigin", QVA_GLOBAL(&m_runtype)}, {"semaphore", 1}, }, { new CUIConfig({ {"type", "Item"}, {"name", "steady"} }), new CUIConfig({ {"type", "Item"}, {"name", "unsteady"} }) }), new CUIConfig({ {"type", "LineEdit"}, {"name", "alf0"} }), new CUIConfig({ {"type", "LineEdit"}, {"name", "realdt"} }), new CUIConfig({ {"type", "LineEdit"}, {"name", "nstep"} }), new CUIConfig({ {"type", "LineEdit"}, {"name", "mcyc"} }) }); }