1、完成粘性模型,数据从json写入

feature/struct-menu-20241023
mzh 1 week ago
parent b080d0ee33
commit 106ba1b7e0

@ -1,34 +1,27 @@
#include "CFDStructDataSolverKvislManager.h" #include "CFDStructDataSolverKvislManager.h"
#include "CUIProperty/CUIConfig.h"
#include "CFDStructMain/CFDStructDefine.h" #include "CFDStructMain/CFDStructDefine.h"
#include "CFDStructSigsCenter.h" #include "CFDStructSigsCenter.h"
#include "CUIProperty/CUIConfig.h"
CFDStructDataSolverKvislManager::CFDStructDataSolverKvislManager(QObject *parent) : CFDStructDataManagerBase(parent) CFDStructDataSolverKvislManager::CFDStructDataSolverKvislManager(QObject *parent) : CFDStructDataManagerBase(parent) {
{
m_uiConfig = nullptr; m_uiConfig = nullptr;
connect(m_cuiSigsCenter, &CUISigsCenter::sig_cuiPropertyChanged, this, [=](int semaphore) connect(m_cuiSigsCenter, &CUISigsCenter::sig_cuiPropertyChanged, this, [=](int semaphore) {
{
if (semaphore == (int)SolutionAnalysisModuleProperty::Viscosity_Model) { if (semaphore == (int)SolutionAnalysisModuleProperty::Viscosity_Model) {
emit CFDStructSigsCenter::getInstance()->sig_solverKvislDataChanged(); emit CFDStructSigsCenter::getInstance()->sig_solverKvislDataChanged();
} }); } });
} }
CFDStructDataSolverKvislManager::~CFDStructDataSolverKvislManager() CFDStructDataSolverKvislManager::~CFDStructDataSolverKvislManager() {
{
} }
CUIConfig *CFDStructDataSolverKvislManager::getParamUIConfig() CUIConfig *CFDStructDataSolverKvislManager::getParamUIConfig() {
{ if (m_Model == 0) {
if (m_Model == 0)
{
return genInviscidUIConfig(); return genInviscidUIConfig();
} }
if (m_Model == 1) if (m_Model == 1) {
{
return genLaminarUIConfig(); return genLaminarUIConfig();
} }
if (m_Model == 2) if (m_Model == 2) {
{
if (m_RNSModel == 0) if (m_RNSModel == 0)
return genRANSSAUIConfig(); return genRANSSAUIConfig();
if (m_RNSModel == 1) if (m_RNSModel == 1)
@ -37,8 +30,7 @@ CUIConfig *CFDStructDataSolverKvislManager::getParamUIConfig()
return genRANSKEUIConfig(); return genRANSKEUIConfig();
return genRANSSAUIConfig(); return genRANSSAUIConfig();
} }
if (m_Model == 3) if (m_Model == 3) {
{
m_SAType = 0; m_SAType = 0;
if (m_RNSModel == 0) if (m_RNSModel == 0)
return genDESSAUIConfig(); return genDESSAUIConfig();
@ -48,8 +40,7 @@ CUIConfig *CFDStructDataSolverKvislManager::getParamUIConfig()
m_RNSModel = 0; m_RNSModel = 0;
return genDESSAUIConfig(); return genDESSAUIConfig();
} }
if (m_Model == 4) if (m_Model == 4) {
{
m_SAType = 0; m_SAType = 0;
if (m_RNSModel == 0) if (m_RNSModel == 0)
return genCLESUIConfig(); return genCLESUIConfig();
@ -62,58 +53,76 @@ CUIConfig *CFDStructDataSolverKvislManager::getParamUIConfig()
return this->genInviscidUIConfig(); return this->genInviscidUIConfig();
} }
void CFDStructDataSolverKvislManager::saveDataToDom(rapidjson::Document &dom) void CFDStructDataSolverKvislManager::saveDataToDom(rapidjson::Document &dom) {
{ if (m_Model == 0) {
if (m_Model == 0)
{
jsonAdd(dom, 0, {"region", 0, "solver", "turbModel", "type"}); jsonAdd(dom, 0, {"region", 0, "solver", "turbModel", "type"});
} } else if (m_Model == 1) {
else if (m_Model == 1)
{
jsonAdd(dom, 1, {"region", 0, "solver", "turbModel", "type"}); jsonAdd(dom, 1, {"region", 0, "solver", "turbModel", "type"});
} } else if (m_Model == 2) {
else if (m_Model == 2)
{
jsonAdd(dom, 2, {"region", 0, "solver", "turbModel", "type"}); jsonAdd(dom, 2, {"region", 0, "solver", "turbModel", "type"});
} } else if (m_Model == 3) {
else if (m_Model == 3) if (m_DESModel == 0) {
{
if (m_DESModel == 0)
{
jsonAdd(dom, 3, {"region", 0, "solver", "turbModel", "type"}); jsonAdd(dom, 3, {"region", 0, "solver", "turbModel", "type"});
} } else if (m_DESModel == 1) {
else if (m_DESModel == 1)
{
jsonAdd(dom, 4, {"region", 0, "solver", "turbModel", "type"}); jsonAdd(dom, 4, {"region", 0, "solver", "turbModel", "type"});
} } else if (m_DESModel == 2) {
else if (m_DESModel == 2)
{
jsonAdd(dom, 5, {"region", 0, "solver", "turbModel", "type"}); jsonAdd(dom, 5, {"region", 0, "solver", "turbModel", "type"});
} }
} } else if (m_Model == 4) {
else if (m_Model == 4)
{
jsonAdd(dom, 7, {"region", 0, "solver", "turbModel", "type"}); jsonAdd(dom, 7, {"region", 0, "solver", "turbModel", "type"});
} }
jsonAdd(dom, m_RNSModel, {"region", 0, "solver", "turbModel", "RANS", "type"}); jsonAdd(dom, m_RNSModel, {"region", 0, "solver", "turbModel", "RANS", "type"});
if (m_RNSModel == 0) if (m_RNSModel == 0) {
{
jsonAdd(dom, m_SAType, {"region", 0, "solver", "turbModel", "RANS", "subType"}); jsonAdd(dom, m_SAType, {"region", 0, "solver", "turbModel", "RANS", "subType"});
} } else if (m_RNSModel == 1) {
else if (m_RNSModel == 1)
{
jsonAdd(dom, m_kwType, {"region", 0, "solver", "turbModel", "RANS", "subType"}); jsonAdd(dom, m_kwType, {"region", 0, "solver", "turbModel", "RANS", "subType"});
} } else if (m_RNSModel == 2) {
else if (m_RNSModel == 2)
{
jsonAdd(dom, m_keType, {"region", 0, "solver", "turbModel", "RANS", "subType"}); jsonAdd(dom, m_keType, {"region", 0, "solver", "turbModel", "RANS", "subType"});
} }
} }
CUIConfig *CFDStructDataSolverKvislManager::genInviscidUIConfig() void CFDStructDataSolverKvislManager::readDataFromDom(rapidjson::Document &dom) {
{ QVariant type;
jsonRead(dom, type, {"region", 0, "solver", "turbModel", "type"});
if (type == 0) {
m_Model = 0;
} else if (type == 1) {
m_Model = 1;
} else if (type == 2) {
m_Model = 2;
} else if (type == 3) {
m_Model = 3;
m_DESModel = 0;
} else if (type == 4) {
m_Model = 3;
m_DESModel = 1;
} else if (type == 5) {
m_Model = 3;
m_DESModel = 2;
} else if (type == 7) {
m_Model = 4;
}
QVariant ransType;
jsonRead(dom, ransType, {"region", 0, "solver", "turbModel", "RANS", "type"});
if (ransType != QVariant()) {
m_RNSModel = ransType.toInt();
}
QVariant temp;
jsonRead(dom, temp, {"region", 0, "solver", "turbModel", "RANS", "subType"});
if (m_RNSModel == 0) {
m_SAType = temp.toInt();
} else if (m_RNSModel == 1) {
m_kwType = temp.toInt();
} else if (m_RNSModel == 2) {
m_keType = temp.toInt();
}
}
CUIConfig *CFDStructDataSolverKvislManager::genInviscidUIConfig() {
return new CUIConfig( return new CUIConfig(
{{"type", "Widget"}}, {new CUIConfig({ {{"type", "Widget"}}, {new CUIConfig({
{"type", "RadioComponent"}, // 组:模型 {"type", "RadioComponent"}, // 组:模型
@ -136,8 +145,7 @@ CUIConfig *CFDStructDataSolverKvislManager::genInviscidUIConfig()
return nullptr; return nullptr;
} }
CUIConfig *CFDStructDataSolverKvislManager::genLaminarUIConfig() CUIConfig *CFDStructDataSolverKvislManager::genLaminarUIConfig() {
{
return new CUIConfig( return new CUIConfig(
{{"type", "Widget"}}, {new CUIConfig({ {{"type", "Widget"}}, {new CUIConfig({
{"type", "RadioComponent"}, // 组:模型 {"type", "RadioComponent"}, // 组:模型
@ -160,8 +168,7 @@ CUIConfig *CFDStructDataSolverKvislManager::genLaminarUIConfig()
return nullptr; return nullptr;
} }
CUIConfig *CFDStructDataSolverKvislManager::genRANSSAUIConfig() CUIConfig *CFDStructDataSolverKvislManager::genRANSSAUIConfig() {
{
return new CUIConfig( return new CUIConfig(
{{"type", "Widget"}}, { {{"type", "Widget"}}, {
new CUIConfig({ new CUIConfig({
@ -212,8 +219,7 @@ CUIConfig *CFDStructDataSolverKvislManager::genRANSSAUIConfig()
return nullptr; return nullptr;
} }
CUIConfig *CFDStructDataSolverKvislManager::genRANSUIMentersConfig() CUIConfig *CFDStructDataSolverKvislManager::genRANSUIMentersConfig() {
{
return new CUIConfig( return new CUIConfig(
{{"type", "Widget"}}, { {{"type", "Widget"}}, {
new CUIConfig({ new CUIConfig({
@ -265,8 +271,7 @@ CUIConfig *CFDStructDataSolverKvislManager::genRANSUIMentersConfig()
return nullptr; return nullptr;
} }
CUIConfig *CFDStructDataSolverKvislManager::genRANSKEUIConfig() CUIConfig *CFDStructDataSolverKvislManager::genRANSKEUIConfig() {
{
return new CUIConfig( return new CUIConfig(
{{"type", "Widget"}}, { {{"type", "Widget"}}, {
new CUIConfig({ new CUIConfig({
@ -318,8 +323,7 @@ CUIConfig *CFDStructDataSolverKvislManager::genRANSKEUIConfig()
return nullptr; return nullptr;
} }
CUIConfig *CFDStructDataSolverKvislManager::genDESSAUIConfig() CUIConfig *CFDStructDataSolverKvislManager::genDESSAUIConfig() {
{
return new CUIConfig( return new CUIConfig(
{{"type", "Widget"}}, { {{"type", "Widget"}}, {
new CUIConfig({ new CUIConfig({
@ -387,8 +391,7 @@ CUIConfig *CFDStructDataSolverKvislManager::genDESSAUIConfig()
return nullptr; return nullptr;
} }
CUIConfig *CFDStructDataSolverKvislManager::genDESMentersUIConfig() CUIConfig *CFDStructDataSolverKvislManager::genDESMentersUIConfig() {
{
return new CUIConfig( return new CUIConfig(
{{"type", "Widget"}}, { {{"type", "Widget"}}, {
new CUIConfig({ new CUIConfig({
@ -455,8 +458,7 @@ CUIConfig *CFDStructDataSolverKvislManager::genDESMentersUIConfig()
return nullptr; return nullptr;
} }
CUIConfig *CFDStructDataSolverKvislManager::genCLESUIConfig() CUIConfig *CFDStructDataSolverKvislManager::genCLESUIConfig() {
{
return new CUIConfig( return new CUIConfig(
{{"type", "Widget"}}, { {{"type", "Widget"}}, {
new CUIConfig({ new CUIConfig({
@ -528,8 +530,7 @@ CUIConfig *CFDStructDataSolverKvislManager::genCLESUIConfig()
return nullptr; return nullptr;
} }
CUIConfig *CFDStructDataSolverKvislManager::genCLESMentersUIConfig() CUIConfig *CFDStructDataSolverKvislManager::genCLESMentersUIConfig() {
{
return new CUIConfig( return new CUIConfig(
{{"type", "Widget"}}, { {{"type", "Widget"}}, {
new CUIConfig({ new CUIConfig({

@ -21,7 +21,9 @@ public:
CUIConfig* getParamUIConfig(); CUIConfig* getParamUIConfig();
void saveDataToDom(rapidjson::Document &dom); void saveDataToDom(rapidjson::Document &dom);
private: void readDataFromDom(rapidjson::Document &dom);
private:
// 生成无粘界面配置 // 生成无粘界面配置
CUIConfig* genInviscidUIConfig(); CUIConfig* genInviscidUIConfig();

Loading…
Cancel
Save