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,13 +4,12 @@
#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:
explicit CFDStructDataSolverBasicModelManager(QObject *parent = nullptr);
@ -29,7 +28,6 @@ public:
signals:
private:
// 流动模型:外流0;内流1;多级叶轮机械2
int m_FlowModel = 0;
@ -54,7 +52,6 @@ private:
// 湍流普朗特数
double m_Prtmean = 0;
CUIConfig *m_uiConfig = nullptr;
};

@ -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