1、创建CFDStructMainUtils

2、实现Utils中write函数
3、修改json写入逻辑,调用Utils中的wirte函数,强制创建路径
feature/struct-menu-20241023
mzh 1 week ago
parent 36e41041dd
commit 011318054a

@ -103,7 +103,9 @@ void CFDStructDataManager::initJson() {
}
void CFDStructDataManager::updateJson() {
qDebug() << "-----------";
m_dom.SetObject();
qDebug() << "++++++++++";
m_solverTimeModeManager->saveDataToDom(m_dom);
m_solverBasicModeManager->saveDataToDom(m_dom);
@ -119,7 +121,9 @@ void CFDStructDataManager::updateJson() {
m_solverMonitorTubomachineryPerformanceManager->saveDataToDom(m_dom);
}
#include "CFDStructMain/CFDStructMainUtils.h"
#include <iostream>
void CFDStructDataManager::printJson() {
using namespace rapidjson;
@ -127,9 +131,9 @@ void CFDStructDataManager::printJson() {
Writer<StringBuffer> writer(buffer);
m_dom.Accept(writer);
freopen(caseJSONPath.c_str(), "w", stdout);
std::cout << buffer.GetString() << std::endl;
// freopen(caseJSONPath.c_str(), "w", stdout);
// std::cout << buffer.GetString() << std::endl;
// fclose(stdout);
fclose(stdout);
CFDStructMainUtils::write(caseJSONPath, buffer.GetString());
}

@ -62,6 +62,7 @@ win32{
-lOperatorsModel \
-lCUIProperty \
-lCFDStructOperatorsModel \
-lCFDStructMain \
# -lCFDStructDataManager \
@ -96,6 +97,7 @@ win32{
-lOperatorsModel \
-lCUIProperty \
-lCFDStructOperatorsModel \
-lCFDStructMain \
# -lCFDStructDataManager \

@ -4,42 +4,40 @@
#ifndef CFDSTRUCTDATASOLVERBASICMODELMANAGER_H
#define CFDSTRUCTDATASOLVERBASICMODELMANAGER_H
#include <QObject>
#include "CFDStruct/CFDStructDataManager/CFDStructDataManagerBase.h"
#include "CFDStructDataManager_global.h"
#include <QObject>
class CUIConfig;
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverBasicModelManager : public CFDStructDataManagerBase
{
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataSolverBasicModelManager : public CFDStructDataManagerBase {
Q_OBJECT
public:
public:
explicit CFDStructDataSolverBasicModelManager(QObject *parent = nullptr);
~CFDStructDataSolverBasicModelManager();
CUIConfig* getParamUIConfig();
CUIConfig *getParamUIConfig();
void saveDataToDom(rapidjson::Document &dom);
void readDataFromDom(rapidjson::Document &dom);
private:
// 生成流体属性关闭界面配置
CUIConfig* genFluidPropertiesOffUIConfig();
CUIConfig *genFluidPropertiesOffUIConfig();
// 生成流体属性开启界面配置
CUIConfig* genFluidPropertiesOnUIConfig();
signals:
private:
CUIConfig *genFluidPropertiesOnUIConfig();
signals:
//流动模型:外流0;内流1;多级叶轮机械2
private:
// 流动模型:外流0;内流1;多级叶轮机械2
int m_FlowModel = 0;
//重叠网格:不勾选0;勾选1
// 重叠网格:不勾选0;勾选1
int m_OverlayNetwork = 0;
//流体属性:关闭0;开启1
// 流体属性:关闭0;开启1
int m_FluidProperties = 0;
//气体成分
// 气体成分
QString m_GasComposition = "";
// 气体常数
@ -54,8 +52,7 @@ private:
// 湍流普朗特数
double m_Prtmean = 0;
CUIConfig* m_uiConfig = nullptr;
CUIConfig *m_uiConfig = nullptr;
};
#endif // CFDSTRUCTDATASOLVERBASICMODELMANAGER_H

@ -5,9 +5,11 @@ HEADERS += \
$$PWD/CFDMainTreeWidget.h \
$$PWD/CFDTreeWidget.h \
$$PWD/CFDPropertyWidget.h \
$$PWD/CFDStructMainUtils.h \
SOURCES += \
$$PWD/CFDStructMainWindow.cpp \
$$PWD/CFDMainTreeWidget.cpp \
$$PWD/CFDTreeWidget.cpp \
$$PWD/CFDPropertyWidget.cpp
$$PWD/CFDPropertyWidget.cpp \
$$PWD/CFDStructMainUtils.cpp \

@ -0,0 +1,20 @@
#include "CFDStructMainUtils.h"
#include <direct.h>
#include <iostream>
#include <stdlib.h>
#include <string>
void CFDStructMainUtils::write(std::string path, std::string text) {
using namespace std;
char drive[_MAX_PATH], dir[_MAX_PATH], filename[_MAX_PATH], ext[_MAX_PATH];
_splitpath(path.c_str(), drive, dir, filename, ext);
_mkdir(dir);
freopen(path.c_str(), "w", stdout);
cout << text << endl;
fclose(stdout);
}
void CFDStructMainUtils::read(std::string path, std::string &text) {
}

@ -0,0 +1,15 @@
#ifndef CFDStructMainUtils_h
#define CFDStructMainUtils_h
#include "CFDStructMainAPI.h"
#include <string>
class CFDStructMAINAPI CFDStructMainUtils {
public:
static void write(std::string path, std::string text);
static void read(std::string path, std::string &text);
};
#endif
Loading…
Cancel
Save