1、完成timemode的json写入

feature/struct-menu-20241023
mzh 1 week ago
parent c55c61c4e0
commit f13f51948e

@ -23,6 +23,7 @@ CFDStructDataManager *CFDStructDataManager::m_instance = NULL;
CFDStructDataManager::CFDStructDataManager()
{
this->initDataManagers();
this->initJson();
}
CFDStructDataManager *CFDStructDataManager::getInstance()
@ -41,32 +42,46 @@ CUIConfig *CFDStructDataManager::getActionParamUIConfig(SolutionAnalysisModulePr
qDebug() << "manager is null";
}
CUIConfig *res = nullptr;
switch (sig)
{
case SolutionAnalysisModuleProperty::Time_Mode:
res = m_solverTimeModeManager->getParamUIConfig();
break;
case SolutionAnalysisModuleProperty::Basic_Model:
res = m_solverBasicModeManager->getParamUIConfig();
break;
case SolutionAnalysisModuleProperty::Viscosity_Model:
res = m_solverKvislManager->getParamUIConfig();
break;
case SolutionAnalysisModuleProperty::NUumerical_Methods:
res = m_solverNumericalMethodManager->getParamUIConfig();
break;
case SolutionAnalysisModuleProperty::Motion_Properties:
res = m_solverSportsAttributesManager->getParamUIConfig();
break;
case SolutionAnalysisModuleProperty::Boundary_Conditions:
res = m_solverBoundaryConditionManager->getParamUIConfig();
break;
case SolutionAnalysisModuleProperty::Initialization:
res = m_solverInitializationManager->getParamUIConfig();
break;
case SolutionAnalysisModuleProperty::Computational_Control_Reference_Quantity:
res = m_solverReferenceQuantityManager->getParamUIConfig();
break;
case SolutionAnalysisModuleProperty::Computational_Control:
res = m_solverComputingControlManager->getParamUIConfig();
break;
case SolutionAnalysisModuleProperty::Monitors_Residual:
res = m_solverMonitorResidualManager->getParamUIConfig();
break;
case SolutionAnalysisModuleProperty::Monitors_AerodynamicForce:
res = m_solverMonitorAerodynamicForceManager->getParamUIConfig();
break;
case SolutionAnalysisModuleProperty::Monitors_Tubomachinery_Performance:
res = m_solverMonitorTubomachineryPerformanceManager->getParamUIConfig();
break;
default:
break;
}
@ -93,13 +108,11 @@ void CFDStructDataManager::initDataManagers()
void CFDStructDataManager::initJson()
{
m_dom.Clear();
m_dom.SetObject();
}
void CFDStructDataManager::updateJson()
{
m_dom.Clear();
m_dom.SetObject();
m_solverTimeModeManager->saveDataToDom(m_dom);

@ -24,7 +24,7 @@ void CFDStructDataManagerBase::saveDataToDom(rapidjson::Document &dom)
}
// 写入json
void jsonAdd(rapidjson::Document &document, QVariant value, QVector<QVariant> path)
void CFDStructDataManagerBase::jsonAdd(rapidjson::Document &document, QVariant value, QVector<QVariant> path)
{
using namespace rapidjson;

@ -25,7 +25,8 @@ signals:
protected:
CUIConfig* m_uiConfig = nullptr;
CUISigsCenter* m_cuiSigsCenter = nullptr;
void jsonAdd(rapidjson::Document& document, QVariant value, QVector<QVariant> path);
protected:
virtual void jsonAdd(rapidjson::Document& document, QVariant value, QVector<QVariant> path);
};
#endif // CFDSTRUCTDATAMANAGERBASE_H

@ -4,10 +4,11 @@
#include "CFDStructSigsCenter.h"
#include "CUIProperty/CUISigsCenter.h"
#include <QVariant>
#include "CFDStructDataManagerBase.h"
//#include <rapidjson/document.h>
//#include <rapidjson/writer.h>
//#include <rapidjson/stringbuffer.h>
#include <rapidjson/document.h>
#include <rapidjson/writer.h>
#include <rapidjson/stringbuffer.h>
CFDStructDataSolverTimeModeManager::CFDStructDataSolverTimeModeManager(QObject *parent) : CFDStructDataManagerBase(parent)
@ -46,7 +47,13 @@ CUIConfig *CFDStructDataSolverTimeModeManager::getParamUIConfig()
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",});
}
CUIConfig *CFDStructDataSolverTimeModeManager::genSteadyModeUIConfig()
@ -73,7 +80,7 @@ CUIConfig *CFDStructDataSolverTimeModeManager::genSteadyModeUIConfig()
{"type", "LineEdit"},
{"name", "iteration count"},
{"value_type", CUI_DATA_TYPE_INT},
{"value_origin", QVA_GLOBAL(&m_mcyc)},
{"value_origin", QVA_GLOBAL(&m_iters)},
})
});
}
@ -120,7 +127,7 @@ CUIConfig *CFDStructDataSolverTimeModeManager::genUnsteadyModeUIConfig()
{"type", "LineEdit"},
{"name", "mcyc"},
{"value_type", CUI_DATA_TYPE_INT},
{"value_origin", QVA_GLOBAL(&m_mcyc)},
{"value_origin", QVA_GLOBAL(&m_iters)},
}),
new CUIConfig({
{"type", "CheckBox"},

@ -25,8 +25,10 @@ signals:
private:
// 时间模式定常0非定常1
int m_runtype = 0;
// 时间模式定常0则是迭代步数时间模式非定常1则是内迭代步数
int m_mcyc = 1000;
// 内迭代步数
int m_innerIters = 1000;
// 迭代步数
int m_iters = 1000;
// 步长模式 >=1
double m_alf0 = 1.0;
// 时间步长 >0

@ -11,6 +11,7 @@ INCLUDEPATH += \
../../ \
include(./CFDStructMain.pri)
include(./rapidjson.pri)
win32{

@ -30,6 +30,7 @@
#include <FITK_Kernel/FITKCore/FITKActionOperator.h>
#include "CFDStructDataManager/CFDStructSigsCenter.h"
#include "CFDStructDataManager/CFDStructDataManager.h"
namespace GUI
{
@ -232,10 +233,21 @@ namespace GUI
return;
}
int objID = item->data(1, 0).toInt();
if(item->data(2,0) == 999){
qDebug()<<"Save is clicked";
CFDStructDataManager::getInstance()->initJson();
CFDStructDataManager::getInstance()->updateJson();
CFDStructDataManager::getInstance()->printJson();
}
SolutionAnalysisTreeEnum treeType = item->data(2, 0).value<SolutionAnalysisTreeEnum>();
Interface::FITKGeoEnum::FITKGeometryComType geometryType = item->data(3, 0).value<Interface::FITKGeoEnum::FITKGeometryComType>();
SolutionAnalysisModuleProperty sig = SolutionAnalysisModuleProperty::UNKNOW;
switch (treeType) {
case SolutionAnalysisTreeEnum::SATree_ComputationalSetupTimeMode:
sig = SolutionAnalysisModuleProperty::Time_Mode;

@ -0,0 +1,9 @@
win32{
INCLUDEPATH += ../../Tools/rapidjson-1.1.0/include/ \
}
unix{
INCLUDEPATH += ../../Tools/rapidjson-1.1.0/include/ \
}
Loading…
Cancel
Save