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.
AppFlow/CFDStruct/CFDStructDataManager/CFDStructDataSolverReferenc...

125 lines
6.4 KiB
C++

#include "CFDStructDataSolverReferenceQuantityManager.h"
#include "CFDStructDataSolverTimeModeManager.h"
#include "CFDStructMain/CFDStructDefine.h"
#include "CFDStructSigsCenter.h"
#include "CUIProperty/CUIConfig.h"
#include "CUIProperty/CUISigsCenter.h"
#include <QVariant>
CFDStructDataSolverReferenceQuantityManager::CFDStructDataSolverReferenceQuantityManager(QObject *parent) : CFDStructDataManagerBase(parent) {
m_uiConfig = nullptr;
connect(m_cuiSigsCenter, &CUISigsCenter::sig_cuiPropertyChanged, this, [=](int semaphore) { emit CFDStructSigsCenter::getInstance() -> sig_solverTimeModeDataChanged(); });
}
CFDStructDataSolverReferenceQuantityManager::~CFDStructDataSolverReferenceQuantityManager() {
// CFDStructDataManagerBase::~CFDStructDataManagerBase();
}
CUIConfig *CFDStructDataSolverReferenceQuantityManager::getParamUIConfig() {
if (m_uiConfig != nullptr) {
delete m_uiConfig;
m_uiConfig = nullptr;
}
// m_uiConfig->printConfig();
m_uiConfig = this->genUIConfig();
return m_uiConfig;
}
void CFDStructDataSolverReferenceQuantityManager::saveDataToDom(rapidjson::Document &dom) {
jsonAdd(dom, m_Pressure, {"region", 0, "refValue", "pressure"});
jsonAdd(dom, m_Temperature, {"region", 0, "refValue", "temperature"});
jsonAdd(dom, m_Length, {"region", 0, "refValue", "refLength"});
jsonAdd(dom, m_Area, {"region", 0, "refValue", "refArea"});
jsonAdd(dom, m_TorqueCenterOfMoment, {"region", 0, "refValue", "jx"});
}
void CFDStructDataSolverReferenceQuantityManager::readDataFromDom(rapidjson::Document &dom) {
QVariant temp;
jsonRead(dom, temp, {"region", 0, "refValue", "pressure"});
if (temp != QVariant()) {
m_Pressure = temp.toDouble();
}
jsonRead(dom, temp, {"region", 0, "refValue", "temperature"});
if (temp != QVariant()) {
m_Temperature = temp.toDouble();
}
jsonRead(dom, temp, {"region", 0, "refValue", "refLength"});
if (temp != QVariant()) {
m_Length = temp.toDouble();
}
jsonRead(dom, temp, {"region", 0, "refValue", "refArea"});
if (temp != QVariant()) {
m_Area = temp.toDouble();
}
jsonRead(dom, temp, {"region", 0, "refValue", "jx"});
if (temp != QVariant()) {
m_TorqueCenterOfMoment = temp.toString();
}
}
CUIConfig *CFDStructDataSolverReferenceQuantityManager::genUIConfig() {
return new CUIConfig({
{"type", "Widget"},
},
{
new CUIConfig({
{"type", "ComboBox"}, // 参考值取自
{"name", tr("The reference value is taken from")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_INT},
{"value_origin", QVA_GLOBAL(&m_ReferenceValuesFrom)},
},
{
new CUIConfig({
{"type", "Item"}, // 无
{"name", tr("none")},
}),
}),
new CUIConfig({{"type", "GroupBox"}, // 热力学
{"name", tr("thermodynamics")}},
{
new CUIConfig({
{"type", "LineEdit"}, // 压强
{"name", tr("pressure")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE},
{"value_origin", QVA_GLOBAL(&m_Pressure)},
}),
new CUIConfig({
{"type", "LineEdit"}, // 温度
{"name", tr("temperature")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE},
{"value_origin", QVA_GLOBAL(&m_Temperature)},
}),
}),
new CUIConfig({{"type", "GroupBox"}, // Re数相关
{"name", tr("Re number related")}},
{
new CUIConfig({
{"type", "LineEdit"}, // 长度
{"name", tr("length")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE},
{"value_origin", QVA_GLOBAL(&m_Length)},
}),
}),
new CUIConfig({{"type", "GroupBox"}, // 力和力矩
{"name", tr("Force and torque")}},
{
new CUIConfig({
{"type", "LineEdit"}, // 面积
{"name", tr("the measure of area")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE},
{"value_origin", QVA_GLOBAL(&m_Area)},
}),
new CUIConfig({
{"type", "LineEdit"}, // 力矩矩心
{"name", tr("Torque Center of Moment")},
{"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_STRING},
{"value_origin", QVA_GLOBAL(&m_TorqueCenterOfMoment)},
}),
}),
});
return nullptr;
}