diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataManager.cpp b/CFDStruct/CFDStructDataManager/CFDStructDataManager.cpp index 9866b1d..c8e8769 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataManager.cpp +++ b/CFDStruct/CFDStructDataManager/CFDStructDataManager.cpp @@ -109,7 +109,7 @@ void CFDStructDataManager::updateJson() { m_solverBasicModeManager->saveDataToDom(m_dom); m_solverKvislManager->saveDataToDom(m_dom); m_solverNumericalMethodManager->saveDataToDom(m_dom); - m_solverSportsAttributesManager->saveDataToDom(m_dom); + // m_solverSportsAttributesManager->saveDataToDom(m_dom); m_solverBoundaryConditionManager->saveDataToDom(m_dom); m_solverInitializationManager->saveDataToDom(m_dom); m_solverReferenceQuantityManager->saveDataToDom(m_dom); @@ -132,6 +132,25 @@ void CFDStructDataManager::printJson() { CFDStructMainUtils::write(caseJSONPath, buffer.GetString()); } +void CFDStructDataManager::loadJson() { + const char *json = CFDStructMainUtils::read(templateJSONPath).c_str(); + // qDebug() << json; + m_dom.Parse(json); + + m_solverTimeModeManager->readDataFromDom(m_dom); + m_solverBasicModeManager->readDataFromDom(m_dom); + m_solverKvislManager->readDataFromDom(m_dom); + m_solverNumericalMethodManager->readDataFromDom(m_dom); + m_solverSportsAttributesManager->readDataFromDom(m_dom); + m_solverBoundaryConditionManager->readDataFromDom(m_dom); + m_solverInitializationManager->readDataFromDom(m_dom); + m_solverReferenceQuantityManager->readDataFromDom(m_dom); + m_solverComputingControlManager->readDataFromDom(m_dom); + m_solverMonitorResidualManager->readDataFromDom(m_dom); + m_solverMonitorAerodynamicForceManager->readDataFromDom(m_dom); + m_solverMonitorTubomachineryPerformanceManager->readDataFromDom(m_dom); +} + int CFDStructDataManager::getTimeModeRunTime() { return m_solverTimeModeManager->getRunType(); } diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataManager.h b/CFDStruct/CFDStructDataManager/CFDStructDataManager.h index 2b5f589..c9a5006 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataManager.h +++ b/CFDStruct/CFDStructDataManager/CFDStructDataManager.h @@ -61,6 +61,7 @@ class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataManager { void updateJson(); rapidjson::Document getJson(); void printJson(); + void loadJson(); // 获取时间模型的时间模式 定常 非定常 int getTimeModeRunTime(); diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverBasicModelManager.cpp b/CFDStruct/CFDStructDataManager/CFDStructDataSolverBasicModelManager.cpp index f89ca78..012a96a 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataSolverBasicModelManager.cpp +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverBasicModelManager.cpp @@ -92,10 +92,10 @@ CUIConfig *CFDStructDataSolverBasicModelManager::genFluidPropertiesOffUIConfig() }, {new CUIConfig({// 选项:外流 {"type", "Item"}, - {"name", tr("Internal Flow")}}), + {"name", tr("External Flow")}}), new CUIConfig({// 选项:内流 {"type", "Item"}, - {"name", tr("External Flow")}}), + {"name", tr("Internal Flow")}}), new CUIConfig({// 选项:多级叶轮机械 {"type", "Item"}, {"name", tr("Multistage Turbomachinery")}})}), @@ -137,10 +137,10 @@ CUIConfig *CFDStructDataSolverBasicModelManager::genFluidPropertiesOnUIConfig() }, {new CUIConfig({// 选项:外流 {"type", "Item"}, - {"name", tr("Internal Flow")}}), + {"name", tr("External Flow")}}), new CUIConfig({// 选项:内流 {"type", "Item"}, - {"name", tr("External Flow")}}), + {"name", tr("Internal Flow")}}), new CUIConfig({// 选项:多级叶轮机械 {"type", "Item"}, {"name", tr("Multistage Turbomachinery")}})}), diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverBasicModelManager.h b/CFDStruct/CFDStructDataManager/CFDStructDataSolverBasicModelManager.h index 2a4aca3..074ac86 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataSolverBasicModelManager.h +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverBasicModelManager.h @@ -38,13 +38,13 @@ class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverBasicModelManager : public int m_FluidProperties = 0; // 气体成分 - QString m_GasComposition = ""; + QString m_GasComposition = "空气"; // 气体常数 - double m_Rgasmean = 0; + double m_Rgasmean = 287.1; // 比热比 - double m_Gmean = 0; + double m_Gmean = 1.4; // 层流普朗特数 double m_Prlmean = 0.72; diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverInitializationManager.cpp b/CFDStruct/CFDStructDataManager/CFDStructDataSolverInitializationManager.cpp index 37b006e..a57dcae 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataSolverInitializationManager.cpp +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverInitializationManager.cpp @@ -32,7 +32,7 @@ CUIConfig *CFDStructDataSolverInitializationManager::getParamUIConfig() { void CFDStructDataSolverInitializationManager::saveDataToDom(rapidjson::Document &dom) { // TODO // 温度 - jsonAdd(dom, 0, + jsonAdd(dom, m_temp, {"region", 0, "initialize", "global", "temp"}); jsonAdd(dom, m_Pressure, {"region", 0, "initialize", "global", "Press"}); @@ -50,13 +50,14 @@ void CFDStructDataSolverInitializationManager::saveDataToDom(rapidjson::Document // 界面给出 // x方向速度 - jsonAdd(dom, m_Vx, + qDebug() << "[" << m_Vx << ' ' << m_Vy << ' ' << m_Vz << ']'; + jsonAdd(dom, m_Vx / sqrt(m_Vx * m_Vx + m_Vy * m_Vy + m_Vz * m_Vz), {"region", 0, "initialize", "global", "InDirect", 0}); // y方向速度 - jsonAdd(dom, m_Vy, + jsonAdd(dom, m_Vy / sqrt(m_Vx * m_Vx + m_Vy * m_Vy + m_Vz * m_Vz), {"region", 0, "initialize", "global", "InDirect", 1}); // z方向速度 - jsonAdd(dom, m_Vz, + jsonAdd(dom, m_Vz / sqrt(m_Vx * m_Vx + m_Vy * m_Vy + m_Vz * m_Vz), {"region", 0, "initialize", "global", "InDirect", 2}); } // 函数名 @@ -118,11 +119,17 @@ CUIConfig *CFDStructDataSolverInitializationManager::genCylindricalUIConfig() { }, { new CUIConfig({ - {"type", "LineEdit"}, // 密度 - {"name", tr("density")}, + {"type", "LineEdit"}, // 温度 + {"name", tr("temp")}, {"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE}, - {"value_origin", QVA_GLOBAL(&m_Density)}, + {"value_origin", QVA_GLOBAL(&m_temp)}, }), + // new CUIConfig({ + // {"type", "LineEdit"}, // 密度 + // {"name", tr("density")}, + // {"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE}, + // {"value_origin", QVA_GLOBAL(&m_Density)}, + // }), new CUIConfig({ {"type", "LineEdit"}, // 展向速度vr {"name", tr("Vr")}, @@ -197,11 +204,17 @@ CUIConfig *CFDStructDataSolverInitializationManager::genCartesianUIConfig() { {"name", tr("Initial value definition")}, }, { + // new CUIConfig({ + // {"type", "LineEdit"}, // 密度 + // {"name", tr("density")}, + // {"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE}, + // {"value_origin", QVA_GLOBAL(&m_Density)}, + // }), new CUIConfig({ - {"type", "LineEdit"}, // 密度 - {"name", tr("density")}, + {"type", "LineEdit"}, // 温度 + {"name", tr("temp")}, {"value_type", CUI_DATA_TYPE::CUI_DATA_TYPE_DOUBLE}, - {"value_origin", QVA_GLOBAL(&m_Density)}, + {"value_origin", QVA_GLOBAL(&m_temp)}, }), new CUIConfig({ {"type", "LineEdit"}, // vx diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverInitializationManager.h b/CFDStruct/CFDStructDataManager/CFDStructDataSolverInitializationManager.h index 3f2668d..61c063c 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataSolverInitializationManager.h +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverInitializationManager.h @@ -30,6 +30,9 @@ class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverInitializationManager : pub // 参考值取自 int m_ReferenceValuesFrom = 0; // Reference Values From + // 温度 + double m_temp = 0; + // 坐标系 int m_CoordinateSystem = 0; diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverKvislManager.cpp b/CFDStruct/CFDStructDataManager/CFDStructDataSolverKvislManager.cpp index aa06fd4..849ff5a 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataSolverKvislManager.cpp +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverKvislManager.cpp @@ -83,6 +83,9 @@ void CFDStructDataSolverKvislManager::saveDataToDom(rapidjson::Document &dom) { jsonAdd(dom, 0, {"region", 0, "solver", "turbModel", "type"}); } else if (m_Model == 1) { jsonAdd(dom, 1, {"region", 0, "solver", "turbModel", "type"}); + jsonAdd(dom, 0.72, {"region", 0, "solver", "turbModel", "RANS", "params", "Prl"}); + jsonAdd(dom, 0.9, {"region", 0, "solver", "turbModel", "RANS", "params", "Prt"}); + } else if (m_Model == 2) { jsonAdd(dom, 2, {"region", 0, "solver", "turbModel", "type"}); } else if (m_Model == 3) { @@ -106,6 +109,72 @@ void CFDStructDataSolverKvislManager::saveDataToDom(rapidjson::Document &dom) { } else if (m_RNSModel == 2) { jsonAdd(dom, m_keType, {"region", 0, "solver", "turbModel", "RANS", "subType"}); } + + if ((m_Model == 2 && m_RNSModel == 0 && m_SAType == 0) || + (m_Model == 3 && m_DESModel == 0 && m_RNSModel == 0 && m_SAType == 0) || + (m_Model == 3 && m_DESModel == 1 && m_RNSModel == 0 && m_SAType == 0) || + (m_Model == 3 && m_DESModel == 2 && m_RNSModel == 0 && m_SAType == 0) || + (m_Model == 4 && m_RNSModel == 0 && m_SAType == 0)) { + // RANS-SA-standard + // DES-DES-SA-Standard + // DES-DDES-SA-Standard + // DES-IDDES-SA-Standard + // CLES-SA-Standard + jsonAdd(dom, 0.9, {"region", 0, "solver", "turbModel", "RANS", "params", "Prt"}); + jsonAdd(dom, 0.41, {"region", 0, "solver", "turbModel", "RANS", "params", "Kappa"}); + jsonAdd(dom, 0.667, {"region", 0, "solver", "turbModel", "RANS", "params", "Sigma_vt"}); + jsonAdd(dom, 0.1355, {"region", 0, "solver", "turbModel", "RANS", "params", "Cb1"}); + jsonAdd(dom, 0.622, {"region", 0, "solver", "turbModel", "RANS", "params", "Cb2"}); + jsonAdd(dom, 0.3, {"region", 0, "solver", "turbModel", "RANS", "params", "Cw2"}); + jsonAdd(dom, 2, {"region", 0, "solver", "turbModel", "RANS", "params", "Cw3"}); + jsonAdd(dom, 7.1, {"region", 0, "solver", "turbModel", "RANS", "params", "Cv1"}); + jsonAdd(dom, 1.2, {"region", 0, "solver", "turbModel", "RANS", "params", "Ct3"}); + jsonAdd(dom, 0.5, {"region", 0, "solver", "turbModel", "RANS", "params", "Ct4"}); + jsonAdd(dom, 2, {"region", 0, "solver", "turbModel", "RANS", "params", "Faro"}); + jsonAdd(dom, 0.72, {"region", 0, "solver", "turbModel", "RANS", "params", "Prl"}); + jsonAdd(dom, 10, {"region", 0, "solver", "turbModel", "RANS", "params", "Cflt"}); + } else if (m_Model == 2 && m_RNSModel == 0 && m_SAType == 1) { + // RANS-SA-Edwards + jsonAdd(dom, 0.9, {"region", 0, "solver", "turbModel", "RANS", "params", "Prt"}); + jsonAdd(dom, 0.41, {"region", 0, "solver", "turbModel", "RANS", "params", "Kappa"}); + jsonAdd(dom, 0.667, {"region", 0, "solver", "turbModel", "RANS", "params", "Sigma_vt"}); + jsonAdd(dom, 0.1355, {"region", 0, "solver", "turbModel", "RANS", "params", "Cb1"}); + jsonAdd(dom, 0.622, {"region", 0, "solver", "turbModel", "RANS", "params", "Cb2"}); + jsonAdd(dom, 0.3, {"region", 0, "solver", "turbModel", "RANS", "params", "Cw2"}); + jsonAdd(dom, 2, {"region", 0, "solver", "turbModel", "RANS", "params", "Cw3"}); + jsonAdd(dom, 7.1, {"region", 0, "solver", "turbModel", "RANS", "params", "Cv1"}); + jsonAdd(dom, 5, {"region", 0, "solver", "turbModel", "RANS", "params", "Cv2"}); + jsonAdd(dom, 1.2, {"region", 0, "solver", "turbModel", "RANS", "params", "Ct3"}); + jsonAdd(dom, 0.5, {"region", 0, "solver", "turbModel", "RANS", "params", "Ct4"}); + jsonAdd(dom, 2, {"region", 0, "solver", "turbModel", "RANS", "params", "Faro"}); + jsonAdd(dom, 0.72, {"region", 0, "solver", "turbModel", "RANS", "params", "Prl"}); + jsonAdd(dom, 10, {"region", 0, "solver", "turbModel", "RANS", "params", "Cflt"}); + } else if ((m_Model == 2 && m_RNSModel == 1 && m_kwType == 0) || + (m_Model == 3 && m_DESModel == 0 && m_RNSModel == 1 && m_SAType == 0) || + (m_Model == 3 && m_DESModel == 1 && m_RNSModel == 1 && m_SAType == 0) || + (m_Model == 3 && m_DESModel == 2 && m_RNSModel == 1 && m_SAType == 0) || + (m_Model == 4 && m_RNSModel == 1 && m_SAType == 0)) { + // RANS-kW-sst + // DES-DES-KW-SST + // DES-DDES-kw-sst + // DES-IDDES-kw-SST + // CLES-kw-SST + jsonAdd(dom, 0.9, {"region", 0, "solver", "turbModel", "RANS", "params", "Prt"}); + jsonAdd(dom, 0.41, {"region", 0, "solver", "turbModel", "RANS", "params", "Kappa"}); + jsonAdd(dom, 0.31, {"region", 0, "solver", "turbModel", "RANS", "params", "Alpha1"}); + jsonAdd(dom, 0.075, {"region", 0, "solver", "turbModel", "RANS", "params", "Beta1"}); + jsonAdd(dom, 0.0828, {"region", 0, "solver", "turbModel", "RANS", "params", "Beta2"}); + jsonAdd(dom, 1.1765, {"region", 0, "solver", "turbModel", "RANS", "params", "Sigma_k1"}); + jsonAdd(dom, 1, {"region", 0, "solver", "turbModel", "RANS", "params", "Sigma_k2"}); + jsonAdd(dom, 2, {"region", 0, "solver", "turbModel", "RANS", "params", "Sigma_w1"}); + jsonAdd(dom, 1.1682, {"region", 0, "solver", "turbModel", "RANS", "params", "Sigma_w2"}); + jsonAdd(dom, 0.5556, {"region", 0, "solver", "turbModel", "RANS", "params", "Gamma1"}); + jsonAdd(dom, 0.44, {"region", 0, "solver", "turbModel", "RANS", "params", "Gamma2"}); + jsonAdd(dom, 2, {"region", 0, "solver", "turbModel", "RANS", "params", "Faro"}); + jsonAdd(dom, 0.72, {"region", 0, "solver", "turbModel", "RANS", "params", "Prl"}); + jsonAdd(dom, 0.001, {"region", 0, "solver", "turbModel", "RANS", "params", "Fark"}); + jsonAdd(dom, 10, {"region", 0, "solver", "turbModel", "RANS", "params", "Cflt"}); + } } void CFDStructDataSolverKvislManager::readDataFromDom(rapidjson::Document &dom) { @@ -289,8 +358,8 @@ CUIConfig *CFDStructDataSolverKvislManager::genRANSUIMentersConfig() { {"semaphore", (int)SolutionAnalysisModuleProperty::Viscosity_Model}, }, { - new CUIConfig({{"type", "RadioButton"}, // 按钮:standard - {"name", tr("standard")}}), + new CUIConfig({{"type", "RadioButton"}, // 按钮:SST + {"name", tr("SST")}}), }), }); return nullptr; diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverKvislManager.h b/CFDStruct/CFDStructDataManager/CFDStructDataSolverKvislManager.h index 8b5fe92..02914bf 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataSolverKvislManager.h +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverKvislManager.h @@ -67,10 +67,10 @@ class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverKvislManager : public CFDSt int m_runTime = 0; // 模型:0_无粘;1_层流;2_雷诺平均;3_分离涡模拟;4_约束大涡模拟; - int m_Model = 0; + int m_Model = 2; // RNS模型:0_S-A(一方程);1_Menters's κ-ω(两方程);2_κ-ε(两方程); - int m_RNSModel = 0; + int m_RNSModel = 1; // S-A类型:0_standard;1_Edwards int m_SAType = 0; diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverNumericalMethodManager.cpp b/CFDStruct/CFDStructDataManager/CFDStructDataSolverNumericalMethodManager.cpp index a5f0e22..4ce5600 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataSolverNumericalMethodManager.cpp +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverNumericalMethodManager.cpp @@ -50,7 +50,7 @@ void CFDStructDataSolverNumericalMethodManager::saveDataToDom(rapidjson::Documen } jsonAdd(dom, m_relaxationFactor, {"region", 0, "numericMethod", "numMethodParm", "lussor"}); - jsonAdd(dom, m_multigridLevels, + jsonAdd(dom, m_multigridLevels + 1, {"region", 0, "numericMethod", "numMethodParm", "gridLevelNum"}); // 循环类型,如果是v循环的话写入1;如果是w循环的话写入2 diff --git a/CFDStruct/CFDStructDataManager/CFDStructDataSolverTimeModeManager.h b/CFDStruct/CFDStructDataManager/CFDStructDataSolverTimeModeManager.h index a98813a..ae223ba 100644 --- a/CFDStruct/CFDStructDataManager/CFDStructDataSolverTimeModeManager.h +++ b/CFDStruct/CFDStructDataManager/CFDStructDataSolverTimeModeManager.h @@ -30,7 +30,7 @@ class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverTimeModeManager : public CF // 时间模式:定常0,非定常1 int m_runtype = 0; // 内迭代步数 - int m_innerIters = 1000; + int m_innerIters = 10000; // 迭代步数 int m_iters = 1000; // 步长模式 >=1 diff --git a/CFDStruct/CFDStructMain/CFDStructMainUtils.cpp b/CFDStruct/CFDStructMain/CFDStructMainUtils.cpp index 06842dd..79b637f 100644 --- a/CFDStruct/CFDStructMain/CFDStructMainUtils.cpp +++ b/CFDStruct/CFDStructMain/CFDStructMainUtils.cpp @@ -31,9 +31,11 @@ std::string CFDStructMainUtils::read(std::string path) { ifstream infile(path); if (infile.is_open()) { cout << "openfile" << endl; - char c; - while (infile >> c) - res += c; + string line; + while (getline(infile, res)) { + cout << line; + res += line; + } infile.close(); } else { cout << "cant openfile" << endl; diff --git a/CFDStruct/CFDStructMain/CFDTreeWidget.cpp b/CFDStruct/CFDStructMain/CFDTreeWidget.cpp index 1699a79..f835008 100644 --- a/CFDStruct/CFDStructMain/CFDTreeWidget.cpp +++ b/CFDStruct/CFDStructMain/CFDTreeWidget.cpp @@ -1,305 +1,293 @@ #include "CFDTreeWidget.h" +#include "GUIFrame/MainTreeWidget.h" #include "GUIFrame/MainWindow.h" #include "GUIFrame/PropertyWidget.h" -#include "GUIFrame/MainTreeWidget.h" #include "OperatorsInterface/GraphEventOperator.h" #include "OperatorsInterface/TreeEventOperator.h" -#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h" -#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h" -#include "FITK_Kernel/FITKCore/FITKOperatorRepo.h" -#include "FITK_Kernel/FITKCore/FITKActionOperator.h" -#include "FITK_Interface/FITKInterfaceFlowOF/FITKOFGeometryData.h" -#include "FITK_Interface/FITKInterfaceFlowOF/FITKOFEnum.hpp" #include "FITK_Interface/FITKInterfaceFlowOF/FITKAbstractOFSolver.h" -#include "FITK_Interface/FITKInterfaceFlowOF/FITKOFPhysicsData.h" #include "FITK_Interface/FITKInterfaceFlowOF/FITKOFBoundary.h" +#include "FITK_Interface/FITKInterfaceFlowOF/FITKOFEnum.hpp" +#include "FITK_Interface/FITKInterfaceFlowOF/FITKOFGeometryData.h" +#include "FITK_Interface/FITKInterfaceFlowOF/FITKOFPhysicsData.h" #include "FITK_Interface/FITKInterfaceGeometry/FITKAbsGeoCommand.h" -#include "FITK_Interface/FITKInterfaceModel/FITKAbstractGeoModel.h" -#include "FITK_Interface/FITKInterfaceMeshGen/FITKMeshGenInterface.h" +#include "FITK_Interface/FITKInterfaceMesh/FITKUnstructuredFluidMeshVTK.h" #include "FITK_Interface/FITKInterfaceMeshGen/FITKAbstractGeometryMeshSizeGenerator.h" #include "FITK_Interface/FITKInterfaceMeshGen/FITKGeometryMeshSize.h" -#include "FITK_Interface/FITKInterfaceMesh/FITKUnstructuredFluidMeshVTK.h" +#include "FITK_Interface/FITKInterfaceMeshGen/FITKMeshGenInterface.h" +#include "FITK_Interface/FITKInterfaceModel/FITKAbstractGeoModel.h" +#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h" +#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h" +#include "FITK_Kernel/FITKCore/FITKActionOperator.h" +#include "FITK_Kernel/FITKCore/FITKOperatorRepo.h" -#include +#include +#include #include #include #include -#include -#include +#include -#include "CFDStructDataManager/CFDStructSigsCenter.h" #include "CFDStructDataManager/CFDStructDataManager.h" +#include "CFDStructDataManager/CFDStructSigsCenter.h" -namespace GUI -{ +namespace GUI { - CFDTreeWidget::CFDTreeWidget(QWidget *parent, PropertyWidget *m_PropertyWidget) : TreeWidget(parent) - { - this->m_PropertyWidget = m_PropertyWidget; - // 右键 不可少否则右键无反应 - setContextMenuPolicy(Qt::CustomContextMenu); - disconnect(this, SIGNAL(itemClicked(QTreeWidgetItem *, int)), nullptr, nullptr); - connect(this, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(onItemClicked(QTreeWidgetItem *, int))); - connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onModelCustomContextMenu(QPoint))); - } +CFDTreeWidget::CFDTreeWidget(QWidget *parent, PropertyWidget *m_PropertyWidget) : TreeWidget(parent) { + this->m_PropertyWidget = m_PropertyWidget; + // 右键 不可少否则右键无反应 + setContextMenuPolicy(Qt::CustomContextMenu); + disconnect(this, SIGNAL(itemClicked(QTreeWidgetItem *, int)), nullptr, nullptr); + connect(this, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(onItemClicked(QTreeWidgetItem *, int))); + connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onModelCustomContextMenu(QPoint))); +} - void CFDTreeWidget::updateTree(QString s) - { - this->clear(); - if (s == "SolutionAnalysis") { - addTreeSolutionAnalysis(); - } else if (s == "Postprocessing") { - addTreePostprocessing(); - } else if (s == "Preprocessing") { - addTreePreprocessing(); - } - setItemsExpandable(true); - expandAll(); +void CFDTreeWidget::updateTree(QString s) { + this->clear(); + if (s == "SolutionAnalysis") { + addTreeSolutionAnalysis(); + } else if (s == "Postprocessing") { + addTreePostprocessing(); + } else if (s == "Preprocessing") { + addTreePreprocessing(); } + setItemsExpandable(true); + expandAll(); +} - void CFDTreeWidget::addTreePreprocessing() - { - QTreeWidgetItem *GeometryAndMeshingItem = new QTreeWidgetItem(); - GeometryAndMeshingItem->setText(0, tr("Preprocessing")); - GeometryAndMeshingItem->setData(1, 0, -1); - // GeometryAndMeshingItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_GeometryandMeshing)); - this->addTopLevelItem(GeometryAndMeshingItem); - } +void CFDTreeWidget::addTreePreprocessing() { + QTreeWidgetItem *GeometryAndMeshingItem = new QTreeWidgetItem(); + GeometryAndMeshingItem->setText(0, tr("Preprocessing")); + GeometryAndMeshingItem->setData(1, 0, -1); + // GeometryAndMeshingItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_GeometryandMeshing)); + this->addTopLevelItem(GeometryAndMeshingItem); +} - void CFDTreeWidget::addTreeSolutionAnalysis() - { - QTreeWidgetItem *GeometryAndMeshingItem = new QTreeWidgetItem(); - GeometryAndMeshingItem->setText(0, tr("Geometry and Meshing")); - GeometryAndMeshingItem->setData(1, 0, -1); - GeometryAndMeshingItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_GeometryandMeshing)); - this->addTopLevelItem(GeometryAndMeshingItem); - QTreeWidgetItem *mesh = new QTreeWidgetItem(); - mesh->setText(0, tr("Mesh001")); - mesh->setData(1, 0, -1); - // mesh->setdata(2,0,QVariant::fromValue(SolutionAnalysisTreeEnum::)) - GeometryAndMeshingItem->addChild(mesh); - QTreeWidgetItem *ComputationalSetupItem = new QTreeWidgetItem(); - ComputationalSetupItem->setText(0, tr("Computational Setup")); - ComputationalSetupItem->setData(1, 0, -1); - ComputationalSetupItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetup)); - this->addTopLevelItem(ComputationalSetupItem); - QTreeWidgetItem *TimeModeItem = new QTreeWidgetItem(); - TimeModeItem->setText(0, tr("Time Mode")); - TimeModeItem->setData(1, 0, -1); - TimeModeItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupTimeMode)); - ComputationalSetupItem->addChild(TimeModeItem); - QTreeWidgetItem *ComputationalDomainItem = new QTreeWidgetItem(); - ComputationalDomainItem->setText(0, tr("Computational Domain")); - ComputationalDomainItem->setData(1, 0, -1); - ComputationalDomainItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomain)); - ComputationalSetupItem->addChild(ComputationalDomainItem); - QTreeWidgetItem *SolverItem = new QTreeWidgetItem(); - SolverItem->setText(0, tr("Solver")); - SolverItem->setData(1, 0, -1); - SolverItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolver)); - ComputationalDomainItem->addChild(SolverItem); - QTreeWidgetItem *BasicModelItem = new QTreeWidgetItem(); - BasicModelItem->setText(0, tr("Basic Model")); - BasicModelItem->setData(1, 0, -1); - BasicModelItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverBasicModel)); - SolverItem->addChild(BasicModelItem); - QTreeWidgetItem *ViscosityModelItem = new QTreeWidgetItem(); - ViscosityModelItem->setText(0, tr("Viscosity Model")); - ViscosityModelItem->setData(1, 0, -1); - ViscosityModelItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverViscosityModel)); - SolverItem->addChild(ViscosityModelItem); - QTreeWidgetItem *NumericalMethodsItem = new QTreeWidgetItem(); - NumericalMethodsItem->setText(0, tr("Numerical Methods")); - NumericalMethodsItem->setData(1, 0, -1); - NumericalMethodsItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverNumericalMethods)); - SolverItem->addChild(NumericalMethodsItem); - QTreeWidgetItem *MotionPropertiesItem = new QTreeWidgetItem(); - //--------------------------------------------------------------------------------------------- - MotionPropertiesItem->setText(0, tr("Motion Properties")); - MotionPropertiesItem->setData(1, 0, -1); - MotionPropertiesItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMotionProperties)); - ComputationalDomainItem->addChild(MotionPropertiesItem); - QTreeWidgetItem *motion1Item = new QTreeWidgetItem(); - motion1Item->setText(0, tr("motion-1")); - motion1Item->setData(1, 0, -1); - MotionPropertiesItem->addChild(motion1Item); - QTreeWidgetItem *BoundaryConditionsItem = new QTreeWidgetItem(); - BoundaryConditionsItem->setText(0, tr("Boundary Conditions")); - BoundaryConditionsItem->setData(1, 0, -1); - BoundaryConditionsItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverBoundaryConditions)); - ComputationalDomainItem->addChild(BoundaryConditionsItem); - QTreeWidgetItem *pressureinletItem = new QTreeWidgetItem(); - pressureinletItem->setText(0, tr("Pressure-Inlet")); - pressureinletItem->setData(1, 0, -1); - pressureinletItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverBoundaryConditionsPressureInlet)); - BoundaryConditionsItem->addChild(pressureinletItem); - QTreeWidgetItem *InitializationItem = new QTreeWidgetItem(); - InitializationItem->setText(0, tr("Initialization")); - InitializationItem->setData(1, 0, -1); - InitializationItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverInitialization)); - ComputationalDomainItem->addChild(InitializationItem); - QTreeWidgetItem *ReferenceQuantityItem = new QTreeWidgetItem(); - ReferenceQuantityItem->setText(0, tr("Dimensionless")); - ReferenceQuantityItem->setData(1, 0, -1); - ReferenceQuantityItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverComputationalControlReferenceQuantity)); - InitializationItem->addChild(ReferenceQuantityItem); - QTreeWidgetItem *ComputationalControlItem = new QTreeWidgetItem(); - ComputationalControlItem->setText(0, tr("Computational Control")); - ComputationalControlItem->setData(1, 0, -1); - ComputationalControlItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverComputationalControl)); - ComputationalDomainItem->addChild(ComputationalControlItem); - QTreeWidgetItem *MonitorsItem = new QTreeWidgetItem(); - MonitorsItem->setText(0, tr("Monitors")); - MonitorsItem->setData(1, 0, -1); - MonitorsItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitors)); - ComputationalDomainItem->addChild(MonitorsItem); - QTreeWidgetItem *ResidualItem = new QTreeWidgetItem(); - ResidualItem->setText(0, tr("Residual")); - ResidualItem->setData(1, 0, -1); - ResidualItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsResidual)); - MonitorsItem->addChild(ResidualItem); - QTreeWidgetItem *AerodynamicForceItem = new QTreeWidgetItem(); - AerodynamicForceItem->setText(0, tr("Aerodynamic Force")); - AerodynamicForceItem->setData(1, 0, -1); - AerodynamicForceItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsAerodynamicForce)); - MonitorsItem->addChild(AerodynamicForceItem); - QTreeWidgetItem *TurbomachineryPerformanceItem = new QTreeWidgetItem(); - TurbomachineryPerformanceItem->setText(0, tr("Turbomachinery Performance")); - TurbomachineryPerformanceItem->setData(1, 0, -1); - TurbomachineryPerformanceItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsTurbomachineryPerformance)); - MonitorsItem->addChild(TurbomachineryPerformanceItem); +void CFDTreeWidget::addTreeSolutionAnalysis() { + QTreeWidgetItem *GeometryAndMeshingItem = new QTreeWidgetItem(); + GeometryAndMeshingItem->setText(0, tr("Geometry and Meshing")); + GeometryAndMeshingItem->setData(1, 0, -1); + GeometryAndMeshingItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_GeometryandMeshing)); + this->addTopLevelItem(GeometryAndMeshingItem); + QTreeWidgetItem *mesh = new QTreeWidgetItem(); + mesh->setText(0, tr("Mesh001")); + mesh->setData(1, 0, -1); + // mesh->setdata(2,0,QVariant::fromValue(SolutionAnalysisTreeEnum::)) + GeometryAndMeshingItem->addChild(mesh); + QTreeWidgetItem *ComputationalSetupItem = new QTreeWidgetItem(); + ComputationalSetupItem->setText(0, tr("Computational Setup")); + ComputationalSetupItem->setData(1, 0, -1); + ComputationalSetupItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetup)); + this->addTopLevelItem(ComputationalSetupItem); + QTreeWidgetItem *TimeModeItem = new QTreeWidgetItem(); + TimeModeItem->setText(0, tr("Time Mode")); + TimeModeItem->setData(1, 0, -1); + TimeModeItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupTimeMode)); + ComputationalSetupItem->addChild(TimeModeItem); + QTreeWidgetItem *ComputationalDomainItem = new QTreeWidgetItem(); + ComputationalDomainItem->setText(0, tr("Computational Domain")); + ComputationalDomainItem->setData(1, 0, -1); + ComputationalDomainItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomain)); + ComputationalSetupItem->addChild(ComputationalDomainItem); + QTreeWidgetItem *SolverItem = new QTreeWidgetItem(); + SolverItem->setText(0, tr("Solver")); + SolverItem->setData(1, 0, -1); + SolverItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolver)); + ComputationalDomainItem->addChild(SolverItem); + QTreeWidgetItem *BasicModelItem = new QTreeWidgetItem(); + BasicModelItem->setText(0, tr("Basic Model")); + BasicModelItem->setData(1, 0, -1); + BasicModelItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverBasicModel)); + SolverItem->addChild(BasicModelItem); + QTreeWidgetItem *ViscosityModelItem = new QTreeWidgetItem(); + ViscosityModelItem->setText(0, tr("Viscosity Model")); + ViscosityModelItem->setData(1, 0, -1); + ViscosityModelItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverViscosityModel)); + SolverItem->addChild(ViscosityModelItem); + QTreeWidgetItem *NumericalMethodsItem = new QTreeWidgetItem(); + NumericalMethodsItem->setText(0, tr("Numerical Methods")); + NumericalMethodsItem->setData(1, 0, -1); + NumericalMethodsItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverNumericalMethods)); + SolverItem->addChild(NumericalMethodsItem); + QTreeWidgetItem *MotionPropertiesItem = new QTreeWidgetItem(); + //--------------------------------------------------------------------------------------------- + MotionPropertiesItem->setText(0, tr("Motion Properties")); + MotionPropertiesItem->setData(1, 0, -1); + MotionPropertiesItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMotionProperties)); + ComputationalDomainItem->addChild(MotionPropertiesItem); + QTreeWidgetItem *motion1Item = new QTreeWidgetItem(); + motion1Item->setText(0, tr("motion-1")); + motion1Item->setData(1, 0, -1); + MotionPropertiesItem->addChild(motion1Item); + QTreeWidgetItem *BoundaryConditionsItem = new QTreeWidgetItem(); + BoundaryConditionsItem->setText(0, tr("Boundary Conditions")); + BoundaryConditionsItem->setData(1, 0, -1); + BoundaryConditionsItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverBoundaryConditions)); + ComputationalDomainItem->addChild(BoundaryConditionsItem); + QTreeWidgetItem *pressureinletItem = new QTreeWidgetItem(); + pressureinletItem->setText(0, tr("Pressure-Inlet")); + pressureinletItem->setData(1, 0, -1); + pressureinletItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverBoundaryConditionsPressureInlet)); + BoundaryConditionsItem->addChild(pressureinletItem); + QTreeWidgetItem *InitializationItem = new QTreeWidgetItem(); + InitializationItem->setText(0, tr("Initialization")); + InitializationItem->setData(1, 0, -1); + InitializationItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverInitialization)); + ComputationalDomainItem->addChild(InitializationItem); + QTreeWidgetItem *ReferenceQuantityItem = new QTreeWidgetItem(); + ReferenceQuantityItem->setText(0, tr("Dimensionless")); + ReferenceQuantityItem->setData(1, 0, -1); + ReferenceQuantityItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverComputationalControlReferenceQuantity)); + InitializationItem->addChild(ReferenceQuantityItem); + QTreeWidgetItem *ComputationalControlItem = new QTreeWidgetItem(); + ComputationalControlItem->setText(0, tr("Computational Control")); + ComputationalControlItem->setData(1, 0, -1); + ComputationalControlItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverComputationalControl)); + ComputationalDomainItem->addChild(ComputationalControlItem); + QTreeWidgetItem *MonitorsItem = new QTreeWidgetItem(); + MonitorsItem->setText(0, tr("Monitors")); + MonitorsItem->setData(1, 0, -1); + MonitorsItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitors)); + ComputationalDomainItem->addChild(MonitorsItem); + QTreeWidgetItem *ResidualItem = new QTreeWidgetItem(); + ResidualItem->setText(0, tr("Residual")); + ResidualItem->setData(1, 0, -1); + ResidualItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsResidual)); + MonitorsItem->addChild(ResidualItem); + QTreeWidgetItem *AerodynamicForceItem = new QTreeWidgetItem(); + AerodynamicForceItem->setText(0, tr("Aerodynamic Force")); + AerodynamicForceItem->setData(1, 0, -1); + AerodynamicForceItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsAerodynamicForce)); + MonitorsItem->addChild(AerodynamicForceItem); + QTreeWidgetItem *TurbomachineryPerformanceItem = new QTreeWidgetItem(); + TurbomachineryPerformanceItem->setText(0, tr("Turbomachinery Performance")); + TurbomachineryPerformanceItem->setData(1, 0, -1); + TurbomachineryPerformanceItem->setData(2, 0, QVariant::fromValue(SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsTurbomachineryPerformance)); + MonitorsItem->addChild(TurbomachineryPerformanceItem); - QTreeWidgetItem *SaveItem = new QTreeWidgetItem(); - SaveItem->setText(0,tr("Save")); - SaveItem->setData(2,0,999); - this->addTopLevelItem(SaveItem); + QTreeWidgetItem *SaveItem = new QTreeWidgetItem(); + SaveItem->setText(0, tr("Save")); + SaveItem->setData(2, 0, 999); + this->addTopLevelItem(SaveItem); +} - } +void CFDTreeWidget::addTreePostprocessing() { + QTreeWidgetItem *PostProcessingItem = new QTreeWidgetItem(); + PostProcessingItem->setText(0, tr("Post-processing")); + PostProcessingItem->setData(1, 0, -1); + this->addTopLevelItem(PostProcessingItem); + QTreeWidgetItem *MeshItem = new QTreeWidgetItem(); + MeshItem->setText(0, tr("Mesh")); + MeshItem->setData(1, 0, -1); + PostProcessingItem->addChild(MeshItem); + QTreeWidgetItem *Mesh1Item = new QTreeWidgetItem(); + Mesh1Item->setText(0, tr("Mesh 1")); + Mesh1Item->setData(1, 0, -1); + MeshItem->addChild(Mesh1Item); + QTreeWidgetItem *Interface1Item = new QTreeWidgetItem(); + Interface1Item->setText(0, tr("Interface 1")); + Interface1Item->setData(1, 0, -1); + MeshItem->addChild(Interface1Item); + QTreeWidgetItem *CuttingPlaneItem = new QTreeWidgetItem(); + CuttingPlaneItem->setText(0, tr("Cutting Plane")); + CuttingPlaneItem->setData(1, 0, -1); + PostProcessingItem->addChild(CuttingPlaneItem); + QTreeWidgetItem *IsosurfaceItem = new QTreeWidgetItem(); + IsosurfaceItem->setText(0, tr("Isosurface")); + IsosurfaceItem->setData(1, 0, -1); + PostProcessingItem->addChild(IsosurfaceItem); + QTreeWidgetItem *StreamlineItem = new QTreeWidgetItem(); + StreamlineItem->setText(0, tr("Streamline")); + StreamlineItem->setData(1, 0, -1); + PostProcessingItem->addChild(StreamlineItem); + QTreeWidgetItem *DataStatisticsItem = new QTreeWidgetItem(); + DataStatisticsItem->setText(0, tr("Data Statistics")); + DataStatisticsItem->setData(1, 0, -1); + PostProcessingItem->addChild(DataStatisticsItem); + QTreeWidgetItem *ForceAndMomentItem = new QTreeWidgetItem(); + ForceAndMomentItem->setText(0, tr("Force and Moment")); + ForceAndMomentItem->setData(1, 0, -1); + DataStatisticsItem->addChild(ForceAndMomentItem); +} - void CFDTreeWidget::addTreePostprocessing() - { - QTreeWidgetItem *PostProcessingItem = new QTreeWidgetItem(); - PostProcessingItem->setText(0, tr("Post-processing")); - PostProcessingItem->setData(1, 0, -1); - this->addTopLevelItem(PostProcessingItem); - QTreeWidgetItem *MeshItem = new QTreeWidgetItem(); - MeshItem->setText(0, tr("Mesh")); - MeshItem->setData(1, 0, -1); - PostProcessingItem->addChild(MeshItem); - QTreeWidgetItem *Mesh1Item = new QTreeWidgetItem(); - Mesh1Item->setText(0, tr("Mesh 1")); - Mesh1Item->setData(1, 0, -1); - MeshItem->addChild(Mesh1Item); - QTreeWidgetItem *Interface1Item = new QTreeWidgetItem(); - Interface1Item->setText(0, tr("Interface 1")); - Interface1Item->setData(1, 0, -1); - MeshItem->addChild(Interface1Item); - QTreeWidgetItem *CuttingPlaneItem = new QTreeWidgetItem(); - CuttingPlaneItem->setText(0, tr("Cutting Plane")); - CuttingPlaneItem->setData(1, 0, -1); - PostProcessingItem->addChild(CuttingPlaneItem); - QTreeWidgetItem *IsosurfaceItem = new QTreeWidgetItem(); - IsosurfaceItem->setText(0, tr("Isosurface")); - IsosurfaceItem->setData(1, 0, -1); - PostProcessingItem->addChild(IsosurfaceItem); - QTreeWidgetItem *StreamlineItem = new QTreeWidgetItem(); - StreamlineItem->setText(0, tr("Streamline")); - StreamlineItem->setData(1, 0, -1); - PostProcessingItem->addChild(StreamlineItem); - QTreeWidgetItem *DataStatisticsItem = new QTreeWidgetItem(); - DataStatisticsItem->setText(0, tr("Data Statistics")); - DataStatisticsItem->setData(1, 0, -1); - PostProcessingItem->addChild(DataStatisticsItem); - QTreeWidgetItem *ForceAndMomentItem = new QTreeWidgetItem(); - ForceAndMomentItem->setText(0, tr("Force and Moment")); - ForceAndMomentItem->setData(1, 0, -1); - DataStatisticsItem->addChild(ForceAndMomentItem); +void CFDTreeWidget::onItemClicked(QTreeWidgetItem *item, int column) { + EventOper::TreeEventOperator *treeOper = Core::FITKOperatorRepo::getInstance()->getOperatorT("ModelTreeEvent"); + if (treeOper == nullptr) { + return; } + EventOper::GraphEventOperator *graphOper = FITKOPERREPO->getOperatorT("GraphPreprocess"); + if (graphOper == nullptr) { + return; + } + graphOper->clearHighlight(); + if (item == nullptr) { + return; + } + int objID = item->data(1, 0).toInt(); - void CFDTreeWidget::onItemClicked(QTreeWidgetItem *item, int column) - { - EventOper::TreeEventOperator *treeOper = Core::FITKOperatorRepo::getInstance()->getOperatorT("ModelTreeEvent"); - if (treeOper == nullptr) { - return; - } - EventOper::GraphEventOperator *graphOper = FITKOPERREPO->getOperatorT("GraphPreprocess"); - if (graphOper == nullptr) { - return; - } - graphOper->clearHighlight(); - if (item == nullptr) { - 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(); - Interface::FITKGeoEnum::FITKGeometryComType geometryType = item->data(3, 0).value(); - SolutionAnalysisModuleProperty sig = SolutionAnalysisModuleProperty::UNKNOW; - - + if (item->data(2, 0) == 999) { + qDebug() << "Save is clicked"; + CFDStructDataManager::getInstance()->initJson(); + CFDStructDataManager::getInstance()->updateJson(); + CFDStructDataManager::getInstance()->printJson(); + } - switch (treeType) { - case SolutionAnalysisTreeEnum::SATree_ComputationalSetupTimeMode: - sig = SolutionAnalysisModuleProperty::Time_Mode; - break; - case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverBasicModel: - sig = SolutionAnalysisModuleProperty::Basic_Model; - break; - case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverViscosityModel: - sig = SolutionAnalysisModuleProperty::Viscosity_Model; - break; - case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverNumericalMethods: - sig = SolutionAnalysisModuleProperty::NUumerical_Methods; - break; - //--------------------------------------------------------------------------------------- - // 运动属性 - case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMotionProperties: - sig = SolutionAnalysisModuleProperty::Motion_Properties; - break; - // Pressure-Inlet - case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverBoundaryConditionsPressureInlet: - sig = SolutionAnalysisModuleProperty::Boundary_Conditions; - break; - // 初始化 - case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverInitialization: - sig = SolutionAnalysisModuleProperty::Initialization; - break; - // 参考量 - case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverComputationalControlReferenceQuantity: - sig = SolutionAnalysisModuleProperty::Computational_Control_Reference_Quantity; - break; - // 计算控制 - case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverComputationalControl: - sig = SolutionAnalysisModuleProperty::Computational_Control; - break; - case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsResidual: - sig = SolutionAnalysisModuleProperty::Monitors_Residual; - break; - case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsAerodynamicForce: - sig = SolutionAnalysisModuleProperty::Monitors_AerodynamicForce; - break; - case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsTurbomachineryPerformance: - sig = SolutionAnalysisModuleProperty::Monitors_Tubomachinery_Performance; - break; - default: - break; - } - qDebug() << (int)sig; - if (sig != SolutionAnalysisModuleProperty::UNKNOW) { - emit CFDStructSigsCenter::getInstance()->sig_solverModuleProperty(sig); - return; - } + SolutionAnalysisTreeEnum treeType = item->data(2, 0).value(); + Interface::FITKGeoEnum::FITKGeometryComType geometryType = item->data(3, 0).value(); + SolutionAnalysisModuleProperty sig = SolutionAnalysisModuleProperty::UNKNOW; + switch (treeType) { + case SolutionAnalysisTreeEnum::SATree_ComputationalSetupTimeMode: + sig = SolutionAnalysisModuleProperty::Time_Mode; + break; + case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverBasicModel: + sig = SolutionAnalysisModuleProperty::Basic_Model; + break; + case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverViscosityModel: + sig = SolutionAnalysisModuleProperty::Viscosity_Model; + break; + case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverNumericalMethods: + sig = SolutionAnalysisModuleProperty::NUumerical_Methods; + break; + //--------------------------------------------------------------------------------------- + // 运动属性 + case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMotionProperties: + sig = SolutionAnalysisModuleProperty::Motion_Properties; + break; + // Pressure-Inlet + case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverBoundaryConditionsPressureInlet: + sig = SolutionAnalysisModuleProperty::Boundary_Conditions; + break; + // 初始化 + case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverInitialization: + sig = SolutionAnalysisModuleProperty::Initialization; + break; + // 参考量 + case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverComputationalControlReferenceQuantity: + sig = SolutionAnalysisModuleProperty::Computational_Control_Reference_Quantity; + break; + // 计算控制 + case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverComputationalControl: + sig = SolutionAnalysisModuleProperty::Computational_Control; + break; + case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsResidual: + sig = SolutionAnalysisModuleProperty::Monitors_Residual; + break; + case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsAerodynamicForce: + sig = SolutionAnalysisModuleProperty::Monitors_AerodynamicForce; + break; + case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsTurbomachineryPerformance: + sig = SolutionAnalysisModuleProperty::Monitors_Tubomachinery_Performance; + break; + default: + break; + } + qDebug() << (int)sig; + if (sig != SolutionAnalysisModuleProperty::UNKNOW) { + emit CFDStructSigsCenter::getInstance() -> sig_solverModuleProperty(sig); + return; } - } + +} // namespace GUI diff --git a/CFDStruct/CFDStructOperatorsModel/CFDStructOperatorsModelSolverProperty.cpp b/CFDStruct/CFDStructOperatorsModel/CFDStructOperatorsModelSolverProperty.cpp index 55c90ab..6332148 100644 --- a/CFDStruct/CFDStructOperatorsModel/CFDStructOperatorsModelSolverProperty.cpp +++ b/CFDStruct/CFDStructOperatorsModel/CFDStructOperatorsModelSolverProperty.cpp @@ -19,6 +19,14 @@ CFDStructOperatorsModelSolverProperty *CFDStructOperatorsModelSolverProperty::m_ CFDStructOperatorsModelSolverProperty::CFDStructOperatorsModelSolverProperty(QObject *parent) : QObject(parent) { CFDStructSigsCenter *sigsCenter = CFDStructSigsCenter::getInstance(); + // 定义读入按钮 + QPushButton *btnLoad = new QPushButton("Load"); + // 连接保存的信号 + connect(btnLoad, &QPushButton::clicked, this, [=]() { + qDebug() << "btnLoad button has clicked"; + CFDStructDataManager::getInstance()->loadJson(); + }); + // 定义保存按钮 QPushButton *btn = new QPushButton("Save"); // 连接保存的信号 @@ -46,6 +54,7 @@ CFDStructOperatorsModelSolverProperty::CFDStructOperatorsModelSolverProperty(QOb CUIConfig *uiConfig = CFDStructDataManager::getInstance()->getActionParamUIConfig(sig, idx); QWidget *widget = new CUIPropertyWidget(nullptr, uiConfig); + widget->layout()->addWidget(btnLoad); // 添加保存按钮 widget->layout()->addWidget(btn); diff --git a/CFDStruct/CUIProperty/CUIComponentILineEdit.cpp b/CFDStruct/CUIProperty/CUIComponentILineEdit.cpp index f7c5430..7c9fd68 100644 --- a/CFDStruct/CUIProperty/CUIComponentILineEdit.cpp +++ b/CFDStruct/CUIProperty/CUIComponentILineEdit.cpp @@ -147,4 +147,8 @@ void CUIComponentLineEdit::onTextChanged(const QString &text) { this->setValueToOrigin(); qDebug() << "setValueToOrigin LineEidt" << m_value; } + + m_value = this->getQVFrom(m_lineEdit->text()); + this->setValueToOrigin(); + qDebug() << "setValueToOrigin LineEidt" << m_value; }