1、完成数值方法,将数据存入json中

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

@ -35,8 +35,16 @@ void CFDStructDataSolverNumericalMethodManager::saveDataToDom(rapidjson::Documen
{"region", 0, "numericMethod", "numMethodParm", "limiter"}); {"region", 0, "numericMethod", "numMethodParm", "limiter"});
jsonAdd(dom, m_timeFormat, jsonAdd(dom, m_timeFormat,
{"region", 0, "numericMethod", "numMethodParm", "timeType"}); {"region", 0, "numericMethod", "numMethodParm", "timeType"});
jsonAdd(dom, m_iterationMethod, // 此变量在ui中对应下拉框但仅有一个选项并且json值不为0所以该变量不需要读取
// jsonAdd(dom, m_iterationMethod,
// {"region", 0, "numericMethod", "numMethodParm", "iterType"});
if (m_timeFormat == 0) {
jsonAdd(dom, 2,
{"region", 0, "numericMethod", "numMethodParm", "iterType"}); {"region", 0, "numericMethod", "numMethodParm", "iterType"});
} else if (m_timeFormat == 1) {
jsonAdd(dom, 1,
{"region", 0, "numericMethod", "numMethodParm", "iterType"});
}
jsonAdd(dom, m_relaxationFactor, jsonAdd(dom, m_relaxationFactor,
{"region", 0, "numericMethod", "numMethodParm", "lussor"}); {"region", 0, "numericMethod", "numMethodParm", "lussor"});
jsonAdd(dom, m_multigridLevels, jsonAdd(dom, m_multigridLevels,
@ -51,10 +59,78 @@ void CFDStructDataSolverNumericalMethodManager::saveDataToDom(rapidjson::Documen
{"region", 0, "numericMethod", "numMethodParm", "cfl"}); {"region", 0, "numericMethod", "numMethodParm", "cfl"});
jsonAdd(dom, m_EntropyCorrectionType, jsonAdd(dom, m_EntropyCorrectionType,
{"region", 0, "numericMethod", "numMethodParm", "EntropyFixVal"}); {"region", 0, "numericMethod", "numMethodParm", "EntropyFixVal"});
}
// TODO 时间格式,会随定常和非定常变化 void CFDStructDataSolverNumericalMethodManager::readDataFromDom(rapidjson::Document &dom) {
// TODO 迭代方法,会随定常和非定常变化 QVariant temp;
// TODO 熵修正类型,未确定 jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "generalFmt"});
if (temp != QVariant()) {
m_fluxFormat = temp.toInt();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "twojamson"});
if (temp != QVariant()) {
m_secondOrderArtificialViscosity = temp.toDouble();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "fourjamson"});
if (temp != QVariant()) {
m_fourthOrderArtificialViscosity = temp.toDouble();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "accuracy"});
if (temp != QVariant()) {
m_spaceAccuracy = temp.toInt();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "limiter"});
if (temp != QVariant()) {
m_limiter = temp.toInt();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "timeType"});
if (temp != QVariant()) {
m_timeFormat = temp.toInt();
}
// 此变量在ui中对应下拉框但仅有一个选项并且json值不为0所以该变量不需要读取
// jsonRead(dom, m_iterationMethod,
// {"region", 0, "numericMethod", "numMethodParm", "iterType"});
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "lussor"});
if (temp != QVariant()) {
m_relaxationFactor = temp.toDouble();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "gridLevelNum"});
if (temp != QVariant()) {
m_multigridLevels = temp.toInt();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "cycleType"});
if (temp != QVariant()) {
m_cycleType = temp.toInt();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "coarseGridNum"});
if (temp != QVariant()) {
m_coarseGridCFL = temp.toDouble();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "fineGridNum"});
if (temp != QVariant()) {
m_fineGridCFL = temp.toDouble();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "cfl"});
if (temp != QVariant()) {
m_turbulentCFL = temp.toDouble();
}
jsonRead(dom, temp,
{"region", 0, "numericMethod", "numMethodParm", "EntropyFixVal"});
if (temp != QVariant()) {
m_EntropyCorrectionType = temp.toInt();
}
} }
CUIConfig *CFDStructDataSolverNumericalMethodManager::genJamesonModeUIConfig() { CUIConfig *CFDStructDataSolverNumericalMethodManager::genJamesonModeUIConfig() {

@ -4,12 +4,11 @@
#ifndef CFDSTRUCTDATASOLVERNUMERICALMETHODEMANAGER_H #ifndef CFDSTRUCTDATASOLVERNUMERICALMETHODEMANAGER_H
#define CFDSTRUCTDATASOLVERNUMERICALMETHODEMANAGER_H #define CFDSTRUCTDATASOLVERNUMERICALMETHODEMANAGER_H
#include <CFDStructDataManagerBase.h>
#include "CFDStructDataManager_global.h" #include "CFDStructDataManager_global.h"
#include <CFDStructDataManagerBase.h>
class CUIConfig; class CUIConfig;
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverNumericalMethodManager : public CFDStructDataManagerBase class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverNumericalMethodManager : public CFDStructDataManagerBase {
{
Q_OBJECT Q_OBJECT
public: public:
explicit CFDStructDataSolverNumericalMethodManager(QObject *parent = nullptr); explicit CFDStructDataSolverNumericalMethodManager(QObject *parent = nullptr);
@ -18,6 +17,8 @@ public:
CUIConfig *getParamUIConfig(); CUIConfig *getParamUIConfig();
void saveDataToDom(rapidjson::Document &dom); void saveDataToDom(rapidjson::Document &dom);
void readDataFromDom(rapidjson::Document &dom);
private: private:
// 生成Jameson的界面配置 // 生成Jameson的界面配置
CUIConfig *genJamesonModeUIConfig(); CUIConfig *genJamesonModeUIConfig();
@ -30,7 +31,6 @@ private:
signals: signals:
private: private:
// 通量格式 // 通量格式
/** /**
* @brief m_fluxFormat * @brief m_fluxFormat
@ -72,6 +72,15 @@ private:
* @brief m_timeFormat * @brief m_timeFormat
* 0- * 0-
* 1- * 1-
*
* ------------------------------------
* ------------------------------------
* **
* 0-
* 1-
*
* **
* 0-
*/ */
int m_timeFormat = 0; int m_timeFormat = 0;
@ -79,6 +88,15 @@ private:
/** /**
* @brief m_iterationMethod * @brief m_iterationMethod
* 0-LUSGS * 0-LUSGS
*
* ---------old----------
* ---------new-----------
*
* LUSGSjson2
*
*
* json1
*
*/ */
int m_iterationMethod = 0; int m_iterationMethod = 0;
@ -116,7 +134,6 @@ private:
// 收敛稳定化 // 收敛稳定化
int m_ConvergenceStabilization = 0; int m_ConvergenceStabilization = 0;
}; };
#endif // CFDSTRUCTDATASOLVERNUMERICALMETHODMANAGER_H #endif // CFDSTRUCTDATASOLVERNUMERICALMETHODMANAGER_H

Loading…
Cancel
Save