You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
153 lines
7.9 KiB
C++
153 lines
7.9 KiB
C++
#include "CFDStructDataSolverTimeModeManager.h"
|
|
#include "CFDStructDataManagerBase.h"
|
|
#include "CFDStructMain/CFDStructDefine.h"
|
|
#include "CFDStructSigsCenter.h"
|
|
#include "CUIProperty/CUIConfig.h"
|
|
#include "CUIProperty/CUISigsCenter.h"
|
|
#include <QVariant>
|
|
|
|
#include <rapidjson/document.h>
|
|
#include <rapidjson/stringbuffer.h>
|
|
#include <rapidjson/writer.h>
|
|
|
|
CFDStructDataSolverTimeModeManager::CFDStructDataSolverTimeModeManager(QObject *parent) : CFDStructDataManagerBase(parent) {
|
|
m_uiConfig = nullptr;
|
|
// qDebug() << "build timemode manager";
|
|
connect(m_cuiSigsCenter, &CUISigsCenter::sig_cuiPropertyChanged, this, [=](int semaphore) {
|
|
emit CFDStructSigsCenter::getInstance() -> sig_solverModuleProperty((SolutionAnalysisModuleProperty)semaphore);
|
|
});
|
|
}
|
|
|
|
CFDStructDataSolverTimeModeManager::~CFDStructDataSolverTimeModeManager() {
|
|
// CFDStructDataManagerBase::~CFDStructDataManagerBase();
|
|
}
|
|
|
|
CUIConfig *CFDStructDataSolverTimeModeManager::getParamUIConfig() {
|
|
if (m_uiConfig != nullptr) {
|
|
delete m_uiConfig;
|
|
m_uiConfig = nullptr;
|
|
}
|
|
|
|
// qDebug()<<m_mcyc;
|
|
// 如果是定常
|
|
if (m_runtype == 0) {
|
|
m_uiConfig = this->genSteadyModeUIConfig();
|
|
} else {
|
|
// 如果是非定常
|
|
m_uiConfig = this->genUnsteadyModeUIConfig();
|
|
}
|
|
// m_uiConfig->printConfig();
|
|
return m_uiConfig;
|
|
}
|
|
|
|
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"});
|
|
}
|
|
|
|
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() {
|
|
return new CUIConfig({{"type", "Widget"}}, {new CUIConfig({
|
|
{"type", "ComboBox"},
|
|
{"name", "Time Mode"},
|
|
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT},
|
|
{"value_origin", QVA_GLOBAL(&m_runtype)},
|
|
{"semaphore", (int)SolutionAnalysisModuleProperty::Time_Mode},
|
|
},
|
|
{new CUIConfig({
|
|
{"type", "Item"},
|
|
{"name", "steady"},
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "Item"},
|
|
{"name", "unsteady"},
|
|
})}),
|
|
new CUIConfig({
|
|
{"type", "LineEdit"},
|
|
{"name", "iteration count"},
|
|
{"value_type", CUI_DATA_TYPE_INT},
|
|
{"value_origin", QVA_GLOBAL(&m_iters)},
|
|
})});
|
|
}
|
|
CUIConfig *CFDStructDataSolverTimeModeManager::genUnsteadyModeUIConfig() {
|
|
return new CUIConfig({{"type", "Widget"}}, {new CUIConfig({
|
|
{"type", "ComboBox"},
|
|
{"name", "Time Mode"},
|
|
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT},
|
|
{"value_origin", QVA_GLOBAL(&m_runtype)},
|
|
{"semaphore", (int)SolutionAnalysisModuleProperty::Time_Mode},
|
|
},
|
|
{new CUIConfig({{"type", "Item"}, {"name", "steady"}}), new CUIConfig({{"type", "Item"}, {"name", "unsteady"}})}),
|
|
new CUIConfig({
|
|
{"type", "LineEdit"},
|
|
{"name", "alf0"},
|
|
{"value_type", CUI_DATA_TYPE_DOUBLE},
|
|
{"value_origin", QVA_GLOBAL(&m_alf0)},
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "LineEdit"},
|
|
{"name", "realdt"},
|
|
{"value_type", CUI_DATA_TYPE_DOUBLE},
|
|
{"value_origin", QVA_GLOBAL(&m_realdt)},
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "LineEdit"},
|
|
{"name", "nstep"},
|
|
{"value_type", CUI_DATA_TYPE_INT},
|
|
{"value_origin", QVA_GLOBAL(&m_nstep)},
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "LineEdit"},
|
|
{"name", "mcyc"},
|
|
{"value_type", CUI_DATA_TYPE_INT},
|
|
{"value_origin", QVA_GLOBAL(&m_iters)},
|
|
}),
|
|
new CUIConfig({
|
|
{"type", "CheckBox"},
|
|
{"name", "Time Average"},
|
|
{"value_type", CUI_DATA_TYPE_INT},
|
|
{"value_origin", QVA_GLOBAL(&m_timeaverage)},
|
|
})});
|
|
}
|
|
|
|
int CFDStructDataSolverTimeModeManager::getRunType() {
|
|
return m_runtype;
|
|
}
|