#include "CFDStructDataSolverComputingControlManager.h" #include "CFDStructDataSolverTimeModeManager.h" #include "CFDStructMain/CFDStructDefine.h" #include "CFDStructSigsCenter.h" #include "CUIProperty/CUIConfig.h" #include "CUIProperty/CUISigsCenter.h" #include CFDStructDataSolverComputingControlManager::CFDStructDataSolverComputingControlManager(QObject *parent) : CFDStructDataManagerBase(parent) { m_uiConfig = nullptr; connect(m_cuiSigsCenter, &CUISigsCenter::sig_cuiPropertyChanged, this, [=](int semaphore) { emit CFDStructSigsCenter::getInstance() -> sig_solverTimeModeDataChanged(); }); } CFDStructDataSolverComputingControlManager::~CFDStructDataSolverComputingControlManager() { // CFDStructDataManagerBase::~CFDStructDataManagerBase(); } CUIConfig *CFDStructDataSolverComputingControlManager::getParamUIConfig() { if (m_uiConfig != nullptr) { delete m_uiConfig; m_uiConfig = nullptr; } // m_uiConfig->printConfig(); m_uiConfig = this->genUIConfig(); return m_uiConfig; } void CFDStructDataSolverComputingControlManager::saveDataToDom(rapidjson::Document &dom) { jsonAdd(dom, m_DataSaveFrequency, {"couplingSolver", "unSteady", "savedSteps"}); jsonAdd(dom, m_DataSaveFrequency, {"couplingSolver", "steady", "savedIters"}); jsonAdd(dom, m_NumericalComputationCores, {"couplingSolver", "mpi", "core"}); jsonAdd(dom, m_enableMPI, {"couplingSolver", "mpi", "on"}); jsonAdd(dom, m_mpiLibType, {"couplingSolver", "mpi", "type"}); } void CFDStructDataSolverComputingControlManager::readDataFromDom(rapidjson::Document &dom) { QVariant temp; jsonRead(dom, temp, {"couplingSolver", "unSteady", "savedSteps"}); if (temp != QVariant()) { m_DataSaveFrequency = temp.toInt(); } jsonRead(dom, temp, {"couplingSolver", "steady", "savedIters"}); if (temp != QVariant()) { m_DataSaveFrequency = temp.toInt(); } jsonRead(dom, temp, {"couplingSolver", "mpi", "core"}); if (temp != QVariant()) { m_NumericalComputationCores = temp.toInt(); } jsonRead(dom, temp, {"couplingSolver", "mpi", "on"}); if (temp != QVariant()) { m_enableMPI = temp.toInt(); } jsonRead(dom, temp, {"couplingSolver", "mpi", "type"}); if (temp != QVariant()) { m_mpiLibType = temp.toInt(); } } CUIConfig *CFDStructDataSolverComputingControlManager::genUIConfig() { return new CUIConfig( { {"type", "Widget"}, }, { new CUIConfig({ {"type", "GroupBox"}, // 自动保存 {"name", tr("Auto Save")}, }, { new CUIConfig({ {"type", "LineEdit"}, // 数据保存频率 {"name", tr("Data retention frequency")}, {"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT}, {"value_origin", QVA_GLOBAL(&m_DataSaveFrequency)}, }), // TODO数据文件保存 }), new CUIConfig({ {"type", "GroupBox"}, // 并行控制 {"name", tr("Parallel control")}, }, { new CUIConfig({ {"type", "CheckBox"}, // 并行 {"name", tr("parallel")}, {"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT}, {"value_origin", QVA_GLOBAL(&m_enableMPI)}, }), new CUIConfig({ {"type", "ComboBox"}, // MPI库 {"name", tr("MPI library")}, {"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT}, {"value_origin", QVA_GLOBAL(&m_mpiLibType)}, }, { new CUIConfig({ {"type", "Item"}, {"name", tr("Microsoft MPI")}, }), }), new CUIConfig({ {"type", "LineEdit"}, // 数值计算核数 {"name", tr("Numerical Computation Cores")}, {"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT}, {"value_origin", QVA_GLOBAL(&m_NumericalComputationCores)}, }), new CUIConfig({ {"type", "LineEdit"}, // 网格组装核数 {"name", tr("Mesh Assembly Cores")}, {"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT}, {"value_origin", QVA_GLOBAL(&m_MeshAssemblyCores)}, }), }), }); return nullptr; }