diff --git a/.clang-format b/.clang-format index 55de366..d4eb548 100644 --- a/.clang-format +++ b/.clang-format @@ -149,7 +149,7 @@ PointerAlignment: Left # 允许重新排版注释 ReflowComments: true # 允许排序#include -SortIncludes: CaseInsensitive +SortIncludes: Never # 在C风格类型转换后添加空格 SpaceAfterCStyleCast: false # 在赋值运算符之前添加空格 diff --git a/.gitignore b/.gitignore index 3051875..77b0d53 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ .vscode .vs -.idea /build /install /extlib diff --git a/CMakeLists.txt b/CMakeLists.txt index b97bff6..d1cb933 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,7 @@ option(FASTCAE_ENABLE_OPENMP "使用OpenMP" OFF) option(FASTCAE_ENABLE_MPI "使用MPI" OFF) option(FASTCAE_DOXYGEN_DOC "生成Doxygen文档" OFF) option(FASTCAE_INSTALLATION_PACKAGE "生成${PROJECT_NAME}安装包" ON) +option(FASTCAE_DEBUG_INFO "输出调试信息" ON) #----------------------------------------------------------------------------- # 指定编译选项 @@ -109,6 +110,13 @@ if(FASTCAE_ENABLE_MPI) endif() endif() +#----------------------------------------------------------------------------- +# 输出调试信息 +#----------------------------------------------------------------------------- +if(FASTCAE_DEBUG_INFO) + add_definitions(-DOUTPUT_DEBUG_INFO) +endif() + #----------------------------------------------------------------------------- # 从系统查找Qt模块,开启Qt中间文件的自动生成 #----------------------------------------------------------------------------- diff --git a/Changelog.md b/Changelog.md index 09b2520..7a152f3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,6 +10,7 @@ Version:2.5.x - 加入OpenGL版本检测函数,当环境OPenGL版本低于3.3时,给出错误提示。 - 新增自动打包功能,Windows需要NSIS 3.03+、Linux需要dpkg-deb或者rpmbuild(需要python3)。 - 新增文档自动生成功能,需要安装Doxygen和Graphviz。 +- 增加vtu、pvtu格式的后处理文件支持 **功能优化** - 代码全部采用cmake进行管理,可任意选择vscode、Visual Studio、Clion、Qtcreator等支持cmake系统的IDE。 @@ -17,6 +18,9 @@ Version:2.5.x - 删除Qt浏览器组建及相关依赖(Qt安装不再需要QWebEngine组件)。 - 优化Python调用,不再依赖系统配置,简化操作。 - 从依赖库中移除未使用的VTK、OpenCASCADE模块。 +- 优化CGNS后处理文件解析,添加MIXED类型单元区域的解析。 +- 优化后处理属性面板场变量数据类型的显示方式。 +- 优化日志输出方式,便于错误定位 **功能修复** - 修复linux环境卸载插件时崩溃的问题 diff --git a/README.md b/README.md index fba8cf9..201d536 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,39 @@ - src: FastCAE源码 - test: 包含单元测试代码(待整理) +## 构建编译 + +### FastCAE相关的cmake构建选项说明 +- `FASTCAE_AUTO_DOWNLOAD`:如果源码目录不存在extlib目录时是否会自动从gitee克隆依赖包。 +- `FASTCAE_DOXYGEN_DOC`:是否需要构建目标Doxygen(需要本地安装Doxygen软件) +- `FASTCAE_ENABLE_DEV`:是否在构建完成时自动拷贝依赖文件到调试目录。(开启该选项会在每次编译完拷贝第三方依赖库文件到构建目录,会增加构建时间) +- `FASTCAE_ENABLE_MPI`:是否开启MPI支持(目前无效)。 +- `FASTCAE_ENABLE_OPENMP`:是否开启OpenMP。 +- `FASTCAE_ENABLE_TEST`:是否构建单元测试模块(目前无效)。 +- `FASTCAE_INSTALLATION_PACKAGE`:是否构建安装包制作PACKAGE。 + +### cmake预定义目标说明: +- ALL_BUILD:生成所有项目。 +- INSTALL:安装FastCAE到CMAKE_INSTALL_PREFIX定义的目录。 +- PACKAGE或者package: 在Visual Studio中该目标为大写,在其它构建系统中该目标为小写,用于将FastCAE打包成安装包(exe、deb、rpm)。 +- DOXYGEN: 生成FastCAE的Doxygen格式文档(html)。 + +### 编译视频教程 + +#### Windows + +- cmake 3.24.1 + Visual Studio Community 2017 +- QtCreator编译 + + +#### Linux + +- cmake + GNU GCC + make +- 借助vscode构建、编译、安装、打包 + +### 编译说明 + +- windows环境下使用vscode时,编译工具链只能使用Visual Studio,目前不支持MinGW工具 ### extlib目录结构 diff --git a/src/Common/DebugLogger.cpp b/src/Common/DebugLogger.cpp new file mode 100644 index 0000000..636c8ed --- /dev/null +++ b/src/Common/DebugLogger.cpp @@ -0,0 +1,111 @@ +#include "DebugLogger.h" + +#include +#include +#include + +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) +#define filename(x) strrchr(x, '\\') ? strrchr(x, '\\') + 1 : x +#else +#define filename(x) strrchr(x, '/') ? strrchr(x, '/') + 1 : x +#endif + +namespace Common { + void DebugLogger::info(const char* file, int line, const char* format, ...) + { + va_list args; + va_start(args, format); + output(file, line, format, 0, args); + va_end(args); + } + + void DebugLogger::warning(const char* file, int line, const char* format, ...) + { + va_list args; + va_start(args, format); + output(file, line, format, 1, args); + va_end(args); + } + + void DebugLogger::error(const char* file, int line, const char* format, ...) + { + va_list args; + va_start(args, format); + output(file, line, format, 2, args); + va_end(args); + } + + char* DebugLogger::currentTime() + { + time_t rawtime; + struct tm* timeS; + char* buffer = new char[80]; + + time(&rawtime); + + timeS = localtime(&rawtime); + sprintf(buffer, "%d-%s%d-%s%d %s%d:%s%d:%s%d", timeS->tm_year + 1900, + timeS->tm_mon < 10 ? "0" : "", timeS->tm_mon, timeS->tm_mday < 10 ? "0" : "", + timeS->tm_mday, timeS->tm_hour < 10 ? "0" : "", timeS->tm_hour, + timeS->tm_min < 10 ? "0" : "", timeS->tm_min, timeS->tm_sec < 10 ? "0" : "", + timeS->tm_sec); + return buffer; + } + + /** + * 控制台显示控制格式:ESC[{attr1};{attr2};…;{attrn}m + * 显示方式: + * 0(默认值) + * 1(高亮显示,顺便加粗?不确定) + * 2(暗淡) + * 22(非粗体,不确定) + * 4(下划线) + * 5(闪烁,但是我没看出有什么效果。。) + * 25(非闪烁) + * 7(反显,我也没看出效果) + * 27(非反显) + * 8(隐藏) + * + * 字体颜色: + * 30(黑色) + * 31(红色) + * 32(绿色) + * 33(黄色) + * 34(蓝色) + * 35(品红) + * 36(青色) + * 37(白色) + * 背景色: + * 40(黑色) + * 41(红色) + * 42(绿色) + * 43(黄色) + * 44(蓝色) + * 45(品红) + * 46(青色) + * 47(白色) + */ + void DebugLogger::output(const char* file, int line, const char* format, int level, + va_list args) + { + char type[15] = ""; + switch(level) { + case 1: + printf("\033[33m"); // 红色 + strcpy(type, "WARNING"); + break; + case 2: + printf("\033[31m"); // 黄色 + strcpy(type, "ERROR"); + break; + default: + strcpy(type, "INFO"); + break; + } + + printf("[%s][%s:%d][%s]: ", currentTime(), filename(file), line, type); + + vprintf(format, args); + printf("\033[0m"); + } +} // namespace Common diff --git a/src/Common/DebugLogger.h b/src/Common/DebugLogger.h new file mode 100644 index 0000000..65e117d --- /dev/null +++ b/src/Common/DebugLogger.h @@ -0,0 +1,58 @@ +/** + * @file DebugLogger.h + * @brief 用于输出调试信息的类 + * @author FastCAE研发小组(fastcae@diso.cn) + * @version 2.5.0 + * @date 2023-05-11 16:12 + * @copyright Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved. + * + * ============================================================================ + * Program: FastCAE + * + * Copyright (c) Since 2020 青岛数智船海科技有限公司 All rights reserved. + * See License or http://www.fastcae.com/ for details. + * + * BSD 3-Clause License + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. + * ================================================================================== + */ +#ifndef DEBUGLOGGER_H +#define DEBUGLOGGER_H + +#include "CommonAPI.h" + +#include + +namespace Common { + class COMMONAPI DebugLogger { + public: + DebugLogger() = delete; + ~DebugLogger() = delete; + + public: + static void info(const char* file, int line, const char* format, ...); + static void warning(const char* file, int line, const char* format, ...); + static void error(const char* file, int line, const char* format, ...); + + protected: + static char* currentTime(); + static void output(const char* file, int line, const char* format, int level, va_list args); + }; +} // namespace Common + +// 用宏OUTPUT_DEBUG_INFO控制调试信息是否输出的开关 +#ifdef OUTPUT_DEBUG_INFO +#define DebugInfo(FORMAT, ...) Common::DebugLogger::info(__FILE__, __LINE__, FORMAT, __VA_ARGS__) +#define DebugWarn(FORMAT, ...) Common::DebugLogger::warning(__FILE__, __LINE__, FORMAT, __VA_ARGS__) +#define DebugError(FORMAT, ...) Common::DebugLogger::error(__FILE__, __LINE__, FORMAT, __VA_ARGS__) +#else +#define DebugInfo(FORMAT, ...) +#define DebugWarn(FORMAT, ...) +#define DebugError(FORMAT, ...) +#endif // OUTPUT_DEBUG_INFO + +#endif \ No newline at end of file diff --git a/src/FastCAE/CMakeLists.txt b/src/FastCAE/CMakeLists.txt index 87baca9..98549b9 100644 --- a/src/FastCAE/CMakeLists.txt +++ b/src/FastCAE/CMakeLists.txt @@ -31,7 +31,7 @@ set_property(DIRECTORY ${CMAKE_SOURCE_DIR} VS_STARTUP_PROJECT FastCAE ) -list(APPEND _depend_library PythonModule SARibbonBar Settings DataProperty MeshData Material Geometry ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GmshModule PostInterface PostWidgets ProjectTree GeometryCommand GeometryWidgets IO SolverControl MainWidgets UserGuidence MainWindow) +list(APPEND _depend_library Common PythonModule SARibbonBar Settings DataProperty MeshData Material Geometry ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GmshModule PostInterface PostWidgets ProjectTree GeometryCommand GeometryWidgets IO SolverControl MainWidgets UserGuidence MainWindow) if(_WIN_) #list(APPEND _depend_library XGenerateReport License) endif() diff --git a/src/FastCAE/main.cpp b/src/FastCAE/main.cpp index 3993f06..2c35328 100644 --- a/src/FastCAE/main.cpp +++ b/src/FastCAE/main.cpp @@ -20,19 +20,21 @@ * DISCLAIMED. * ================================================================================== */ +#include "CommandLine.h" +#include "FastCAEVersionMacros.h" +#include "MainWindow/MainWindow.h" +#include "XBeautyUI.h" + #include #include #include -#include -#include #include -#include "MainWindow/MainWindow.h" -#include "XBeautyUI.h" -#include "CommandLine.h" -#include "FastCAEVersionMacros.h" +#include +#include // #include "ConfigOptions/ConfigDataReader.h" // #include "ConfigOptions/ConfigOptions.h" // #include "ConfigOptions/GlobalConfig.h" +#include "Common/DebugLogger.h" #include "Settings/BusAPI.h" #ifdef Q_OS_WIN @@ -46,24 +48,25 @@ bool testOpenGL() { - bool supportOpenGLCore = false; - QString currentOpenGLVersion = ""; + bool supportOpenGLCore = false; + QString currentOpenGLVersion = ""; QOpenGLContext ctx; - if (ctx.create()) - { + if(ctx.create()) { auto version = ctx.format(); - if (version.majorVersion() > 3 || (version.majorVersion() == 3 && version.minorVersion() >= 3)) - { + if(version.majorVersion() > 3 + || (version.majorVersion() == 3 && version.minorVersion() >= 3)) { supportOpenGLCore = true; - } - else - { - currentOpenGLVersion = QString("%1.%2").arg(version.majorVersion()).arg(version.minorVersion()); + } else { + currentOpenGLVersion = + QString("%1.%2").arg(version.majorVersion()).arg(version.minorVersion()); } } - if (!supportOpenGLCore) - { - QMessageBox::critical(nullptr, "OpenGL Error", "Startup failed: FastCAE requires OpenGL version greater than or equal to 3.3, but the current version is " + currentOpenGLVersion, QMessageBox::Ok); + if(!supportOpenGLCore) { + QMessageBox::critical(nullptr, "OpenGL Error", + "Startup failed: FastCAE requires OpenGL version greater than or " + "equal to 3.3, but the current version is " + + currentOpenGLVersion, + QMessageBox::Ok); } return supportOpenGLCore; } @@ -74,29 +77,28 @@ bool testOpenGL() * @return int 返回函数运行结果 * @since 2.5.0 */ -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { // 添加Qt的对高分屏的支持 -#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) +#if(QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif CommandPara para(argc, argv); - if (para.isHelp()) + if(para.isHelp()) return 1; QApplication app(argc, argv); - if (!testOpenGL()) - { + if(!testOpenGL()) { return 1; } // QString path = qApp->applicationDirPath(); - // ConfigOption::ConfigDataReader reader(path + "/../ConfigFiles/", ConfigOption::ConfigOption::getInstance()); - // reader.read(); - // QString qUseRibbon = ConfigOption::ConfigOption::getInstance()->getGlobalConfig()->getUseRibbon(); - // bool bUseRibbon = qUseRibbon == "yes" ? true : false; + // ConfigOption::ConfigDataReader reader(path + "/../ConfigFiles/", + // ConfigOption::ConfigOption::getInstance()); reader.read(); QString qUseRibbon = + // ConfigOption::ConfigOption::getInstance()->getGlobalConfig()->getUseRibbon(); bool + // bUseRibbon = qUseRibbon == "yes" ? true : false; - bool isRibbon = Setting::BusAPI::instance()->isUseRibbon(); + bool isRibbon = Setting::BusAPI::instance()->isUseRibbon(); GUI::MainWindow mainwindow(isRibbon); @@ -106,9 +108,8 @@ int main(int argc, char *argv[]) QString qssFileName = XBeautyUI::instance()->qssFilePath(); //**************加载qss****************** - QFile qssFile(qssFileName); - if (qssFile.exists()) - { + QFile qssFile(qssFileName); + if(qssFile.exists()) { qssFile.open(QIODevice::ReadOnly); QString style = qssFile.readAll(); qApp->setStyleSheet(style); @@ -127,7 +128,7 @@ int main(int argc, char *argv[]) #endif //***************************************** - if (para.exec(&mainwindow)) + if(para.exec(&mainwindow)) emit mainwindow.sendInfoToStatesBar(QString("Version: %1").arg(FASTCAE_VERSION)); else return 1; @@ -147,8 +148,7 @@ int main(int argc, char *argv[]) #endif #endif - if (e == -1000) - { + if(e == -1000) { QProcess::startDetached(qApp->applicationFilePath(), QStringList()); return 0; } diff --git a/src/MainWindow/CMakeLists.txt b/src/MainWindow/CMakeLists.txt index 60b4975..7efc13a 100644 --- a/src/MainWindow/CMakeLists.txt +++ b/src/MainWindow/CMakeLists.txt @@ -38,7 +38,7 @@ add_library(MainWindow #----------------------------------------------------------------------------- target_compile_definitions(MainWindow PRIVATE "MAINWINDOW_API") -list(APPEND _depend_library PythonModule SARibbonBar Settings DataProperty MeshData Material Geometry ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GmshModule PostInterface PostRenderData PostWidgets ProjectTree GeometryCommand GeometryWidgets IO SolverControl MainWidgets UserGuidence Common) +list(APPEND _depend_library Common PythonModule SARibbonBar Settings DataProperty MeshData Material Geometry ConfigOptions SelfDefObject ModelData ModuleBase PluginManager GmshModule PostInterface PostRenderData PostWidgets ProjectTree GeometryCommand GeometryWidgets IO SolverControl MainWidgets UserGuidence Common) if(_WIN_) list(APPEND _depend_library XGenerateReport) endif() diff --git a/src/MainWindow/MainWindow.cpp b/src/MainWindow/MainWindow.cpp index ea64cbc..80e3ae0 100644 --- a/src/MainWindow/MainWindow.cpp +++ b/src/MainWindow/MainWindow.cpp @@ -328,7 +328,7 @@ namespace GUI { connect(this, SIGNAL(updatePreMeshActorSig()), this, SLOT(updatePreMeshActor())); connect(this, SIGNAL(updatePreGeometryActorSig()), this, SLOT(updatePreGeometryActor())); - connect(this, SIGNAL(openPlot()), _signalHandler, SLOT(openPlotFile())); + connect(this, SIGNAL(openPlot()), _signalHandler, SLOT(openPlotFile())); } void MainWindow::registerMoudel() diff --git a/src/MainWindow/MainWindow.h b/src/MainWindow/MainWindow.h index 66093f3..40bfc42 100644 --- a/src/MainWindow/MainWindow.h +++ b/src/MainWindow/MainWindow.h @@ -289,7 +289,7 @@ namespace GUI { /** * @brief 更新后处理模型树 */ - void updatePostTreeSig(); + void updatePostTreeSig(); // // 更新二维曲线模型树 @@ -389,7 +389,7 @@ namespace GUI { // 网格过滤 void on_FilterMesh(); // 创建VTK空间变换窗口 - void on_VTKTranslation(); + void on_VTKTranslation(); private: /*初始化Menu*/ diff --git a/src/MainWindow/SignalHandler.cpp b/src/MainWindow/SignalHandler.cpp index 7b6c990..de76191 100644 --- a/src/MainWindow/SignalHandler.cpp +++ b/src/MainWindow/SignalHandler.cpp @@ -1248,7 +1248,7 @@ namespace GUI { FileDirectoryDialog dlg; QStringList filterTypes = { "VTK(*.vtk)", "CGNS(*.cgns)", "Plot3D(*.x)", - "Tecplot(*.szplt)" }; + "Tecplot(*.szplt)","VTU(*.vtu)","PVTU(*.pvtu)" }; dlg.iniFileFilterType(filterTypes); if(dlg.exec() != QDialog::Accepted) return; diff --git a/src/MainWindow/Translator.cpp b/src/MainWindow/Translator.cpp index 930e669..2f4cac2 100644 --- a/src/MainWindow/Translator.cpp +++ b/src/MainWindow/Translator.cpp @@ -5,7 +5,7 @@ #include #include #include - +#include "Common/DebugLogger.h" namespace GUI { const static QStringList Lang_List = { ":/translations/MainWindow_zh_CN", ":/translations/MainWidgets_zh_CN", @@ -34,8 +34,11 @@ namespace GUI { _app->removeTranslator(tranlator); const QString lang = Lang_List.at(i); bool ok = tranlator->load(lang); - qDebug() << lang; - assert(ok); + if(ok) { + DebugInfo("Success to load lang file: %s\n", lang.toStdString().c_str()); + } else { + DebugError("Failed to load lang file: %s\n", lang.toStdString().c_str()); + } _app->installTranslator(tranlator); } } diff --git a/src/PostAlgorithm/CGNSReaderAlgorithm.cpp b/src/PostAlgorithm/CGNSReaderAlgorithm.cpp index 731a1a7..6006dff 100644 --- a/src/PostAlgorithm/CGNSReaderAlgorithm.cpp +++ b/src/PostAlgorithm/CGNSReaderAlgorithm.cpp @@ -1,359 +1,375 @@ #include "CGNSReaderAlgorithm.h" -//#include -#include +// #include #include #include -//#include -#include -#include -#include +#include +// #include #include #include +#include +#include #include #include #include -#include +#include #include -//#include -#include +#include +// #include #include "FCGNSReader.h" -#include + #include #include #include +#include +#include -#define MAXBLOCKNUM 2000 +#define MAXBLOCKNUM 2000 CGNSReaderAlgorithm::CGNSReaderAlgorithm() { - this->FileName = NULL; - this->SetNumberOfInputPorts(0); - this->SetNumberOfOutputPorts(MAXBLOCKNUM+1); + this->FileName = NULL; + // 设置输入端口的数量 + this->SetNumberOfInputPorts(0); + // 设置输出端口的数量 + this->SetNumberOfOutputPorts(MAXBLOCKNUM + 1); - for (int i = 0 ;iFileName = NULL; + this->FileName = NULL; } -int CGNSReaderAlgorithm::ProcessRequest(vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector) +/** + * 许多过滤器可以在不直接提供ProcessRequest()方法的情况下实现。 + * 标准过滤器超类提供了ProcessRequest()的默认实现,该实现通过将最常见的请求转换为对特定于请求的方法的调用来实现。 + */ +int CGNSReaderAlgorithm::ProcessRequest(vtkInformation* request, vtkInformationVector** inputVector, + vtkInformationVector* outputVector) { - if (request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION())) - { - return this->RequestInformation(request, inputVector, - outputVector); - } - if (request->Has( - vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT())) - { - return this->RequestUpdateExtent(request, inputVector, - outputVector); - } - if (request->Has(vtkDemandDrivenPipeline::REQUEST_DATA())) - { - return this->RequestData(request, inputVector, outputVector); - } - return this->Superclass::ProcessRequest(request, inputVector, - outputVector); + // vtkDemandDrivenPipeline::REQUEST_INFORMATION()定义请求以确保输出信息是最新的 + if(request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION())) { + return this->RequestInformation(request, inputVector, outputVector); + } + // vtkDemandDrivenPipeline::REQUEST_DATA()定义了向上游传播更新范围的请求。 + if(request->Has(vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT())) { + return this->RequestUpdateExtent(request, inputVector, outputVector); + } + // vtkDemandDrivenPipeline::REQUEST_DATA()定义请求以确保输出数据是最新的 + if(request->Has(vtkDemandDrivenPipeline::REQUEST_DATA())) { + return this->RequestData(request, inputVector, outputVector); + } + return this->Superclass::ProcessRequest(request, inputVector, outputVector); } - - -int CGNSReaderAlgorithm::RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector) +/** + * @brief + * @param[in] + * @param[in] vtkInformationVector**包含输入管道信息。数组的每个元素代表一个输入端口。 + * 是一个vtkInformationVector,对应输入端口上连接的输入管道信息对象。 + * @param[in] + * outputVector是一个vtkInformationVector,包含滤器的每个输出端口提供一个输出管道信息对象。 + * @note + * 用于输入和输出的每个管道信息对象都包含一个vtkDataObject,其存储键为vtkDataObobject::DATA_OBJECT()。 + * @since 2.5.0 + */ +int CGNSReaderAlgorithm::RequestData(vtkInformation*, vtkInformationVector**, + vtkInformationVector* outputVector) { - if (!this->FileName) - { - vtkErrorMacro("A FileName must be specified."); - return 0; - } + if(!this->FileName) { + vtkErrorMacro("A FileName must be specified."); + return 0; + } + _blockList.clear(); + _blockNames.clear(); - _blockList.clear(); - _blockNames.clear(); + vtkMultiBlockDataSet* mBlock = nullptr; + // bool useVTK = useVTKCGNSReader(); - vtkMultiBlockDataSet* mBlock = nullptr; - //bool useVTK = useVTKCGNSReader(); + vtkSmartPointer reader = vtkSmartPointer::New(); + reader->SetFileName(FileName); + reader->Update(); + mBlock = reader->GetOutput(); + // vtkSmartPointer vtkReader = vtkSmartPointer::New(); + // if (useVTK) + // { + // vtkReader->SetFileName(FileName); + // vtkReader->Update(); + // mBlock = vtkReader->GetOutput(); + // } + // else + // { + // reader->SetFileName(FileName); + // reader->Update(); + // mBlock = reader->GetOutput(); + // } + vtkSmartPointer appFilter = vtkSmartPointer::New(); + appFilter->MergePointsOn(); - vtkSmartPointer reader = vtkSmartPointer::New(); - reader->SetFileName(FileName); - reader->Update(); - mBlock = reader->GetOutput(); - // vtkSmartPointer vtkReader = vtkSmartPointer::New(); - // if (useVTK) - // { - // vtkReader->SetFileName(FileName); - // vtkReader->Update(); - // mBlock = vtkReader->GetOutput(); - // } - // else - // { - // reader->SetFileName(FileName); - // reader->Update(); - // mBlock = reader->GetOutput(); - // } - vtkSmartPointer appFilter = vtkSmartPointer::New(); - appFilter->MergePointsOn(); + if(mBlock == nullptr) + return 0; + getBlocks(mBlock); - if (mBlock == nullptr) return 0; - getBlocks(mBlock); + for(int i = 0; i < _blockList.size(); ++i) { + if(!_visibleStates[i]) + continue; + auto dataset = _blockList.at(i); - for (int i =0;i< _blockList.size(); ++i) - { - if(!_visibleStates[i]) continue; - auto dataset = _blockList.at(i); + fillPointArray(dataset); + fillCellArray(dataset); + appFilter->AddInputData(dataset); + } - fillPointArray(dataset); - fillCellArray(dataset); - appFilter->AddInputData(dataset); - } + appFilter->Update(); + vtkUnstructuredGrid* output = vtkUnstructuredGrid::GetData(outputVector); + output->CopyStructure(appFilter->GetOutput()); + output->GetPointData()->PassData(appFilter->GetOutput()->GetPointData()); + output->GetCellData()->PassData(appFilter->GetOutput()->GetCellData()); - appFilter->Update(); - - vtkUnstructuredGrid* output = vtkUnstructuredGrid::GetData(outputVector); - output->CopyStructure(appFilter->GetOutput()); - output->GetPointData()->PassData(appFilter->GetOutput()->GetPointData()); - output->GetCellData()->PassData(appFilter->GetOutput()->GetCellData()); - - for (int i =1;i<=_blockList.size();i++) - { - if (i > MAXBLOCKNUM) break; - auto data = _blockList.at(i-1); - vtkUnstructuredGrid* outData = vtkUnstructuredGrid::GetData(outputVector,i); - vtkSmartPointer appFilter = vtkSmartPointer::New(); - appFilter->AddInputData(data); - appFilter->Update(); - outData->CopyStructure(appFilter->GetOutput()); - outData->GetPointData()->PassData(appFilter->GetOutput()->GetPointData()); - outData->GetCellData()->PassData(appFilter->GetOutput()->GetCellData());; - } - return 1; + for(int i = 1; i <= _blockList.size(); i++) { + if(i > MAXBLOCKNUM) + break; + auto data = _blockList.at(i - 1); + vtkUnstructuredGrid* outData = vtkUnstructuredGrid::GetData(outputVector, i); + vtkSmartPointer appFilter = vtkSmartPointer::New(); + appFilter->AddInputData(data); + appFilter->Update(); + outData->CopyStructure(appFilter->GetOutput()); + outData->GetPointData()->PassData(appFilter->GetOutput()->GetPointData()); + outData->GetCellData()->PassData(appFilter->GetOutput()->GetCellData()); + ; + } + return 1; } bool CGNSReaderAlgorithm::useVTKCGNSReader() { - int currentFileIndex = 0; - int OK = cg_open(FileName, CG_MODE_READ, ¤tFileIndex); - if (CG_OK != OK) return false; - bool useVTK = false; - int nBase = 0; - OK = cg_nbases(currentFileIndex, &nBase); + int currentFileIndex = 0; + int OK = cg_open(FileName, CG_MODE_READ, ¤tFileIndex); + if(CG_OK != OK) + return false; + bool useVTK = false; + int nBase = 0; + OK = cg_nbases(currentFileIndex, &nBase); - for (int ibase = 1; ibase <= nBase; ++ibase) - { - int zone_node_number = 0; - cg_nzones(currentFileIndex, ibase, &zone_node_number); - - for (int izone = 1; izone <= zone_node_number; ++izone) - { - CGNS_ENUMT(ZoneType_t) zonetype; - cg_zone_type(currentFileIndex, ibase, izone, &zonetype); - if (zonetype == CGNS_ENUMV(Unstructured)) - { - int nSection{ 0 }; - cg_nsections(currentFileIndex, ibase, izone, &nSection); - for (int iSec = 1;iSec <= nSection; ++iSec) - { - char sectionName[33] = { 0 }; - cgsize_t istart = 0, iend = 0; - int nbndry = 0, iparent_flag = 0; - CGNS_ENUMT(ElementType_t) itype; - OK = cg_section_read(currentFileIndex, ibase, izone, iSec, sectionName, &itype - , &istart, &iend, &nbndry, &iparent_flag); - if (itype >= 20) - { - cg_close(currentFileIndex); - return true; - } + for(int ibase = 1; ibase <= nBase; ++ibase) { + int zone_node_number = 0; + cg_nzones(currentFileIndex, ibase, &zone_node_number); - } - - } - } - } - cg_close(currentFileIndex); - return useVTK; + for(int izone = 1; izone <= zone_node_number; ++izone) { + CGNS_ENUMT(ZoneType_t) zonetype; + cg_zone_type(currentFileIndex, ibase, izone, &zonetype); + if(zonetype == CGNS_ENUMV(Unstructured)) { + int nSection{ 0 }; + cg_nsections(currentFileIndex, ibase, izone, &nSection); + for(int iSec = 1; iSec <= nSection; ++iSec) { + char sectionName[33] = { 0 }; + cgsize_t istart = 0, iend = 0; + int nbndry = 0, iparent_flag = 0; + CGNS_ENUMT(ElementType_t) itype; + OK = cg_section_read(currentFileIndex, ibase, izone, iSec, sectionName, &itype, + &istart, &iend, &nbndry, &iparent_flag); + if(itype >= 20) { + cg_close(currentFileIndex); + return true; + } + } + } + } + } + cg_close(currentFileIndex); + return useVTK; } CGNSReaderAlgorithm* CGNSReaderAlgorithm::New() { - auto reader = new CGNSReaderAlgorithm; - reader->InitializeObjectBase(); - return reader; + auto reader = new CGNSReaderAlgorithm; + reader->InitializeObjectBase(); + return reader; } - void CGNSReaderAlgorithm::PrintSelf(ostream& os, vtkIndent indent) { - this->Superclass::PrintSelf(os, indent); - os << indent << "FileName:" << (this->FileName ? this->FileName : "(none)") << "\n"; + this->Superclass::PrintSelf(os, indent); + os << indent << "FileName:" << (this->FileName ? this->FileName : "(none)") << "\n"; } void CGNSReaderAlgorithm::setVisible(int blockIndex, bool vis) { - if (blockIndex >= MAXBLOCKNUM) return; - _visibleStates[blockIndex] = vis; - // this->Modified(); + if(blockIndex >= MAXBLOCKNUM) + return; + _visibleStates[blockIndex] = vis; + // this->Modified(); } int CGNSReaderAlgorithm::getNumberOfBlocks() { - return _blockList.size(); + return _blockList.size(); } QStringList CGNSReaderAlgorithm::getBlockNames() { - return _blockNames; + return _blockNames; } QStringList CGNSReaderAlgorithm::getBlockBCTypes() { - return _bcTypes; + return _bcTypes; } -int CGNSReaderAlgorithm::FillOutputPortInformation(int port, vtkInformation* info) +int CGNSReaderAlgorithm::FillInputPortInformation(int, vtkInformation*) { - Q_UNUSED(port) - info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkUnstructuredGrid"); - return 1; + // 该算法没有输入端口 + // info->Set(vtkAlgorithm::INPUT_IS_REPEATABLE(), 1); + // info->Set(vtkAlgorithm::INPUT_IS_OPTIONAL(), 1); + // info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataSet"); + return 1; } -void CGNSReaderAlgorithm::getBlocks(vtkDataObject* blockData,const char* Name) +int CGNSReaderAlgorithm::FillOutputPortInformation(int, vtkInformation* info) { - auto block = vtkMultiBlockDataSet::SafeDownCast(blockData); + info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkUnstructuredGrid"); + return 1; +} - if (block == nullptr) - { - auto dataset = vtkDataSet::SafeDownCast(blockData); - if (dataset == nullptr) return; - dataset->Modified(); - QString totalName = QString::fromLocal8Bit(Name); - QStringList NameBC = totalName.split("!|||!"); - - if (NameBC.size() == 2) - { - _blockNames.append(NameBC.at(0)); - _bcTypes.append(NameBC.at(1)); - } - else - { - _blockNames.append(totalName); - _bcTypes.append("None"); - } - - _blockList.append(dataset); - getPointArray(dataset); - getCellArray(dataset); - return; - } +void CGNSReaderAlgorithm::getBlocks(vtkDataObject* blockData, const char* Name) +{ + auto block = vtkMultiBlockDataSet::SafeDownCast(blockData); - block->Modified(); - const int nBlock = block->GetNumberOfBlocks(); + if(block == nullptr) { + auto dataset = vtkDataSet::SafeDownCast(blockData); + if(dataset == nullptr) + return; + dataset->Modified(); + QString totalName = QString::fromLocal8Bit(Name); + QStringList NameBC = totalName.split("!|||!"); - for (int i = 0; i < nBlock; i++) - { - vtkDataObject* obj = block->GetBlock(i); - const char* currentName = block->GetMetaData(i)->Get(vtkCompositeDataSet::NAME()); - getBlocks(obj,currentName); - } + if(NameBC.size() == 2) { + _blockNames.append(NameBC.at(0)); + _bcTypes.append(NameBC.at(1)); + } else { + _blockNames.append(totalName); + _bcTypes.append("None"); + } + + _blockList.append(dataset); + getPointArray(dataset); + getCellArray(dataset); + return; + } + + block->Modified(); + const int nBlock = block->GetNumberOfBlocks(); + + for(int i = 0; i < nBlock; i++) { + vtkDataObject* obj = block->GetBlock(i); + const char* currentName = block->GetMetaData(i)->Get(vtkCompositeDataSet::NAME()); + getBlocks(obj, currentName); + } } void CGNSReaderAlgorithm::getPointArray(vtkDataSet* dataset) { - if (dataset == nullptr) return; + if(dataset == nullptr) + return; - auto pointData = dataset->GetPointData(); - if (pointData == nullptr) return; + auto pointData = dataset->GetPointData(); + if(pointData == nullptr) + return; - const int nPointArray = pointData->GetNumberOfArrays(); - for (int i = 0; i < nPointArray; i++) - { - const char* aName = pointData->GetArrayName(i); - auto dataArray = pointData->GetArray(aName); - if (dataArray == nullptr) return; //continue; - int aNum[2]{ 0 }; - aNum[0] = dataArray->GetNumberOfComponents(); - aNum[1] = dataArray->GetNumberOfTuples(); + const int nPointArray = pointData->GetNumberOfArrays(); + for(int i = 0; i < nPointArray; i++) { + const char* aName = pointData->GetArrayName(i); + auto dataArray = pointData->GetArray(aName); + if(dataArray == nullptr) + return; // continue; + int aNum[2]{ 0 }; + aNum[0] = dataArray->GetNumberOfComponents(); + aNum[1] = dataArray->GetNumberOfTuples(); - if (_pointDataArray.contains(aName)) continue; - _pointDataArray.insert(aName, aNum); - } + if(_pointDataArray.contains(aName)) + continue; + _pointDataArray.insert(aName, aNum); + } } void CGNSReaderAlgorithm::getCellArray(vtkDataSet* dataset) { - if (dataset == nullptr) return; + if(dataset == nullptr) + return; - auto cellData = dataset->GetCellData(); - if (cellData == nullptr) return; + auto cellData = dataset->GetCellData(); + if(cellData == nullptr) + return; - const int nCellArray = cellData->GetNumberOfArrays(); - for (int i = 0; i < nCellArray; i++) - { - const char* aName = cellData->GetArrayName(i); - auto dataArray = cellData->GetArray(aName); - if (dataArray == nullptr) return; //continue; - int aNum[2]{ 0 }; - aNum[0] = dataArray->GetNumberOfComponents(); - aNum[1] = dataArray->GetNumberOfTuples(); + const int nCellArray = cellData->GetNumberOfArrays(); + for(int i = 0; i < nCellArray; i++) { + const char* aName = cellData->GetArrayName(i); + auto dataArray = cellData->GetArray(aName); + if(dataArray == nullptr) + return; // continue; + int aNum[2]{ 0 }; + aNum[0] = dataArray->GetNumberOfComponents(); + aNum[1] = dataArray->GetNumberOfTuples(); - if (_cellDataArray.contains(aName)) continue; - _cellDataArray.insert(aName, aNum); - } + if(_cellDataArray.contains(aName)) + continue; + _cellDataArray.insert(aName, aNum); + } } void CGNSReaderAlgorithm::fillPointArray(vtkDataSet* dataset) -{ - Q_UNUSED(dataset) - // if (dataset == nullptr) return; //continue; - // - // vtkPointData* pointData = dataset->GetPointData(); - // if (pointData == nullptr) return; - // - // QList pArrayNames = _pointDataArray.uniqueKeys(); - // for (auto name : pArrayNames) - // { - // QString2Char(name, cName) - // vtkDataArray* array = pointData->GetArray(cName); - // if (array != nullptr)continue; - // - // int* aNum = _pointDataArray.value(name); - // vtkSmartPointer dataArray = vtkSmartPointer::New(); - // dataArray->SetName(cName); - // dataArray->SetNumberOfComponents(aNum[0]); - // dataArray->SetNumberOfTuples(aNum[1]); - // dataArray->Fill(0); - // - // pointData->AddArray(dataArray); - // } - +{ + Q_UNUSED(dataset) + // if (dataset == nullptr) return; //continue; + // + // vtkPointData* pointData = dataset->GetPointData(); + // if (pointData == nullptr) return; + // + // QList pArrayNames = _pointDataArray.uniqueKeys(); + // for (auto name : pArrayNames) + // { + // QString2Char(name, cName) + // vtkDataArray* array = pointData->GetArray(cName); + // if (array != nullptr)continue; + // + // int* aNum = _pointDataArray.value(name); + // vtkSmartPointer dataArray = vtkSmartPointer::New(); + // dataArray->SetName(cName); + // dataArray->SetNumberOfComponents(aNum[0]); + // dataArray->SetNumberOfTuples(aNum[1]); + // dataArray->Fill(0); + // + // pointData->AddArray(dataArray); + // } } void CGNSReaderAlgorithm::fillCellArray(vtkDataSet* dataset) { - Q_UNUSED(dataset) - // if (dataset == nullptr) return; //continue; - // - // vtkCellData* cellData = dataset->GetCellData(); - // if (cellData == nullptr) return; - // - // QList cArrayNames = _cellDataArray.uniqueKeys(); - // for (auto name : cArrayNames) - // { - // QString2Char(name, cName) - // vtkDataArray* array = cellData->GetArray(cName); - // if (array != nullptr)continue; - // - // int* aNum = _pointDataArray.value(name); - // vtkSmartPointer dataArray = vtkSmartPointer::New(); - // dataArray->SetName(cName); - // dataArray->SetNumberOfComponents(aNum[0]); - // dataArray->SetNumberOfTuples(aNum[1]); - // dataArray->Fill(0); - // - // cellData->AddArray(dataArray); - // } + Q_UNUSED(dataset) + // if (dataset == nullptr) return; //continue; + // + // vtkCellData* cellData = dataset->GetCellData(); + // if (cellData == nullptr) return; + // + // QList cArrayNames = _cellDataArray.uniqueKeys(); + // for (auto name : cArrayNames) + // { + // QString2Char(name, cName) + // vtkDataArray* array = cellData->GetArray(cName); + // if (array != nullptr)continue; + // + // int* aNum = _pointDataArray.value(name); + // vtkSmartPointer dataArray = vtkSmartPointer::New(); + // dataArray->SetName(cName); + // dataArray->SetNumberOfComponents(aNum[0]); + // dataArray->SetNumberOfTuples(aNum[1]); + // dataArray->Fill(0); + // + // cellData->AddArray(dataArray); + // } } diff --git a/src/PostAlgorithm/CGNSReaderAlgorithm.h b/src/PostAlgorithm/CGNSReaderAlgorithm.h index c419653..fbedc5e 100644 --- a/src/PostAlgorithm/CGNSReaderAlgorithm.h +++ b/src/PostAlgorithm/CGNSReaderAlgorithm.h @@ -3,100 +3,133 @@ #include "PostAlgorithmAPI.h" #include "PostRenderData/Macros.hxx" -#include -#include + #include +#include +#include -ForwardDeclar(vtkInformation) -ForwardDeclar(vtkDataSet) -ForwardDeclar(vtkDataObject) -ForwardDeclar(vtkDataArray) +ForwardDeclar(vtkInformation); +ForwardDeclar(vtkDataSet); +ForwardDeclar(vtkDataObject); +ForwardDeclar(vtkDataArray); -class POSTALGORITHMAPI CGNSReaderAlgorithm :public vtkUnstructuredGridAlgorithm -{ +class POSTALGORITHMAPI CGNSReaderAlgorithm : public vtkUnstructuredGridAlgorithm { public: static CGNSReaderAlgorithm* New(); vtkTypeMacro(CGNSReaderAlgorithm, vtkUnstructuredGridAlgorithm); - void PrintSelf(ostream& os, vtkIndent indent); - + /** + * @brief 打印对象当前对象(包括超类)的信息 + * + * @param[in] os 输出流 + * @param[in] indent 缩进 + */ + void PrintSelf(ostream& os, vtkIndent indent) override; + /** @name Set/Get宏 + * 相当于setter/getter,同vtkSetMacro(FileName, char*)/vtkGetMacro(FileName, char*) + * @{ + */ vtkSetStringMacro(FileName); vtkGetStringMacro(FileName); + /** @} */ - void setVisible(int blockIndex, bool vis); + void setVisible(int blockIndex, bool vis); - int getNumberOfBlocks(); + int getNumberOfBlocks(); - QStringList getBlockNames(); + QStringList getBlockNames(); - QStringList getBlockBCTypes(); - - int FillOutputPortInformation(int port, vtkInformation* info); + QStringList getBlockBCTypes(); /** - * @brief 获取块数据 - * @param block 数据 - */ - void getBlocks(vtkDataObject* block, const char* cuttentName =""); + * @brief 填充该算法的输入端口信息对象 + * @param[in] port 端口序号,从0开始 + */ + int FillInputPortInformation(int port, vtkInformation* info) override; /** - * @brief 获取dataset中所有point属性 - * @param dataset - */ - void getPointArray(vtkDataSet* dataset); + * @brief 填充该算法的输入端口信息对象 + * @param[in] port 端口序号,从0开始 + */ + int FillOutputPortInformation(int port, vtkInformation* info) override; + /** - * @brief 获取dataset中所有cell属性 - * @param dataset - */ - void getCellArray(vtkDataSet* dataset); + * @brief 获取块数据 + * @param block 数据 + */ + void getBlocks(vtkDataObject* block, const char* cuttentName = ""); /** - * @brief 填充point的属性 - * @param dataset - */ - void fillPointArray(vtkDataSet* dataset); + * @brief 获取dataset中所有point属性 + * @param dataset + */ + void getPointArray(vtkDataSet* dataset); /** - * @brief 填充cell的属性 - * @param dataset - */ - void fillCellArray(vtkDataSet* dataset); + * @brief 获取dataset中所有cell属性 + * @param dataset + */ + void getCellArray(vtkDataSet* dataset); + /** + * @brief 填充point的属性 + * @param dataset + */ + void fillPointArray(vtkDataSet* dataset); + /** + * @brief 填充cell的属性 + * @param dataset + */ + void fillCellArray(vtkDataSet* dataset); protected: CGNSReaderAlgorithm(); ~CGNSReaderAlgorithm(); - - int ProcessRequest(vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector); - int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*); - bool useVTKCGNSReader(); + /** + * @brief 当VTK管道更新时,过滤器可能会收到请求,要求它处理一些信息和/或数据。 + * 这些请求首先被发送到过滤器的执行对象,然后由该对象发送请求 + * 通过调用虚拟方法vtkAlgorithm::ProcessRequest()来实现算法。 + * 该方法给出了请求信息对象和一组输入输出管道信息要操作的对象。它负责尝试完成请求并报告成功或失败。 + * 每个算法对象必须按原样提供ProcessRequest()的实现算法执行的入口点. + * + * \param request + * \param inputVector + * \param outputVector + * \return + */ + int ProcessRequest(vtkInformation* request, vtkInformationVector** inputVector, + vtkInformationVector* outputVector) override; + + int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override; + + bool useVTKCGNSReader(); protected: char* FileName; private: CGNSReaderAlgorithm(const CGNSReaderAlgorithm&); - void operator=(const CGNSReaderAlgorithm&); + void operator=(const CGNSReaderAlgorithm&); /** - * @brief 块数据列表 - * @since Version: 1.0.0 - */ - QList _blockList{}; + * @brief 块数据列表 + * @since Version: 1.0.0 + */ + QList _blockList{}; /** - * @brief 所有point属性数据 - * @note 缺少tuple - * @since Version: 1.0.0 - */ + * @brief 所有point属性数据 + * @note 缺少tuple + * @since Version: 1.0.0 + */ QHash _pointDataArray{}; /** - * @brief 所有cell属性数据 - * @note 缺少tuple - * @since Version: 1.0.0 - */ + * @brief 所有cell属性数据 + * @note 缺少tuple + * @since Version: 1.0.0 + */ QHash _cellDataArray{}; - QList _visibleStates{}; + QList _visibleStates{}; - QStringList _blockNames{}; + QStringList _blockNames{}; - QStringList _bcTypes; + QStringList _bcTypes; }; #endif diff --git a/src/PostAlgorithm/CMakeLists.txt b/src/PostAlgorithm/CMakeLists.txt index 3403352..001fe4c 100644 --- a/src/PostAlgorithm/CMakeLists.txt +++ b/src/PostAlgorithm/CMakeLists.txt @@ -28,6 +28,8 @@ add_library(PostAlgorithm target_compile_definitions(PostAlgorithm PRIVATE "POSTALGORITHM_API") #target_compile_definitions(PostAlgorithm PRIVATE "H5_BUILT_AS_DYNAMIC_LIB") +list(APPEND _depend_library Common) + list(APPEND _runtimes_libraries FASTCAE::CGNS FASTCAE::HDF5 FASTCAE::HDF5CPP FASTCAE::TECIO Qt5::Core VTK::CommonColor VTK::CommonComputationalGeometry VTK::CommonCore VTK::CommonDataModel VTK::CommonExecutionModel VTK::CommonMath VTK::CommonMisc VTK::CommonSystem VTK::CommonTransforms VTK::DICOMParser VTK::FiltersCore VTK::FiltersExtraction VTK::FiltersGeneral VTK::FiltersGeometry VTK::FiltersHybrid VTK::FiltersModeling VTK::FiltersParallel VTK::FiltersSources VTK::FiltersStatistics VTK::FiltersTexture VTK::IOCore VTK::IOGeometry VTK::IOImage VTK::IOLegacy VTK::IOParallel VTK::IOXML VTK::IOXMLParser VTK::ImagingCore VTK::ImagingFourier VTK::ImagingSources VTK::ParallelCore VTK::ParallelDIY VTK::RenderingCore VTK::doubleconversion VTK::expat VTK::jpeg VTK::jsoncpp VTK::lz4 VTK::lzma VTK::metaio VTK::png VTK::pugixml VTK::sys VTK::tiff VTK::zlib ) @@ -37,8 +39,14 @@ list(APPEND _runtimes_libraries #----------------------------------------------------------------------------- target_link_libraries(PostAlgorithm PRIVATE ${_runtimes_libraries} + ${_depend_library} ) +#----------------------------------------------------------------------------- +# 添加依赖关系 +#----------------------------------------------------------------------------- +add_dependencies(PostAlgorithm ${_depend_library}) + #----------------------------------------------------------------------------- # 添加运行时依赖关系 #----------------------------------------------------------------------------- diff --git a/src/PostAlgorithm/FCGNSGridReaderBase.cpp b/src/PostAlgorithm/FCGNSGridReaderBase.cpp index a75572e..f9acb5c 100644 --- a/src/PostAlgorithm/FCGNSGridReaderBase.cpp +++ b/src/PostAlgorithm/FCGNSGridReaderBase.cpp @@ -1,17 +1,19 @@ #include "FCGNSGridReaderBase.h" -#include + +#include "Common/DebugLogger.h" + #include #include -#include -#include -#include +#include #include +#include #include #include -#include #include +#include +#include -FCGNSGridReaderBase::FCGNSGridReaderBase(vtkMultiBlockDataSet *root) +FCGNSGridReaderBase::FCGNSGridReaderBase(vtkMultiBlockDataSet* root) : _root(root) { } @@ -23,299 +25,308 @@ void FCGNSGridReaderBase::setInfo(int fileIndex, int baseIndex, int zoneIndex) _zoneIndex = zoneIndex; } -void FCGNSGridReaderBase::readCoordinate(int dim, int count, cgsize_t rangeMin[3], cgsize_t rangeMax[3]) +void FCGNSGridReaderBase::readCoordinate(int dim, int count, cgsize_t rangeMin[3], + cgsize_t rangeMax[3]) { _vertexList.clear(); _vertexList.fill(VPoint(), count); - char coordinate_name[33] = {0}; - CGNS_ENUMV(DataType_t) - datatype; - int OK = 0; - for (int i = 1; i <= dim; ++i) - { - OK = cg_coord_info(_fileIndex, _baseIndex, _zoneIndex, i, &datatype, coordinate_name); - if (CG_OK != OK) - continue; - void *xyz{nullptr}; - if (datatype == CGNS_ENUMV(RealSingle)) + // 坐标名称(CoordinateX,CoordinateY,CoordinateZ,CoordinateR,CoordinateTheta,CoordinatePhi等) + // 参考http://cgns.github.io/CGNS_docs_current/sids/dataname.html#dataname_grid + char coordinate_name[33] = { 0 }; + // 坐标值的数据类型(RealSingle 或者 RealDouble) + CGNS_ENUMV(DataType_t) datatype; + int result = 0; + for(int i = 1; i <= dim; ++i) { + // 读取坐标信息,构建数据存储数组 + result = cg_coord_info(_fileIndex, _baseIndex, _zoneIndex, i, &datatype, coordinate_name); + if(CG_OK != result) { + DebugError("Failed to get coordinate(index = %d) info\n", i); + break; + } + void* xyz{ nullptr }; + if(datatype == CGNS_ENUMV(RealSingle)) { xyz = new float[count]; - else if (datatype == CGNS_ENUMV(RealDouble)) + } else if(datatype == CGNS_ENUMV(RealDouble)) { xyz = new double[count]; - if (xyz == nullptr) - continue; + } else { + DebugError("Invalid data type for coordinate: %s\n", coordinate_name); + break; + } - OK = cg_coord_read(_fileIndex, _baseIndex, _zoneIndex, coordinate_name, datatype, rangeMin, rangeMax, xyz); - if (OK != 0) - continue; + // 读取坐标数据 + // 官方文档(datatype不需要区分RealSingle或者RealDouble,可以自动处理,但是由于数据量一般比较大,考虑 + // 节约内存,也可以做区分):The function cg_coord_read returns the coordinate array + // coord_array, for the range prescribed by range_min and range_max. The array is returned + // to the application in the data type requested in mem_datatype. This data type does not + // need to be the same as the one in which the coordinates are stored in the file. A + // coordinate array stored as double precision in the CGNS file can be returned to the + // application as single precision, or vice versa. The functions cg_coord_general_read and + // cg_coord_general_write allow for type conversion when both reading from and writing to + // the file. + result = cg_coord_read(_fileIndex, _baseIndex, _zoneIndex, coordinate_name, datatype, + rangeMin, rangeMax, xyz); + if(CG_OK != result) { + DebugError("Failed to read grid coordinate: %s\n", coordinate_name); + break; + } - if (!strcmp(coordinate_name, "CoordinateX")) - { - if (datatype == CGNS_ENUMV(RealDouble)) - { - auto *c = static_cast(xyz); - for (int ipt = 0; ipt < count; ++ipt) + if(strcmp(coordinate_name, "CoordinateX") == 0) { + if(datatype == CGNS_ENUMV(RealDouble)) { + auto* c = static_cast(xyz); + for(int ipt = 0; ipt < count; ++ipt) + _vertexList[ipt].x = c[ipt]; + } else if(datatype == CGNS_ENUMV(RealSingle)) { + auto* c = static_cast(xyz); + for(int ipt = 0; ipt < count; ++ipt) _vertexList[ipt].x = c[ipt]; } - else if (datatype == CGNS_ENUMV(RealSingle)) - { - auto *c = static_cast(xyz); - for (int ipt = 0; ipt < count; ++ipt) - _vertexList[ipt].x = c[ipt]; - } - } - else if (!strcmp(coordinate_name, "CoordinateY")) - { - if (datatype == CGNS_ENUMV(RealDouble)) - { - auto *c = static_cast(xyz); - for (int ipt = 0; ipt < count; ++ipt) + } else if(strcmp(coordinate_name, "CoordinateY") == 0) { + if(datatype == CGNS_ENUMV(RealDouble)) { + auto* c = static_cast(xyz); + for(int ipt = 0; ipt < count; ++ipt) + _vertexList[ipt].y = c[ipt]; + } else if(datatype == CGNS_ENUMV(RealSingle)) { + auto* c = static_cast(xyz); + for(int ipt = 0; ipt < count; ++ipt) _vertexList[ipt].y = c[ipt]; } - else if (datatype == CGNS_ENUMV(RealSingle)) - { - auto *c = static_cast(xyz); - for (int ipt = 0; ipt < count; ++ipt) - _vertexList[ipt].y = c[ipt]; - } - } - else if (!strcmp(coordinate_name, "CoordinateZ")) - { - if (datatype == CGNS_ENUMV(RealDouble)) - { - auto *c = static_cast(xyz); - for (int ipt = 0; ipt < count; ++ipt) + } else if(dim == 3 && (strcmp(coordinate_name, "CoordinateZ") == 0)) { + if(datatype == CGNS_ENUMV(RealDouble)) { + auto* c = static_cast(xyz); + for(int ipt = 0; ipt < count; ++ipt) _vertexList[ipt].z = c[ipt]; - } - else if (datatype == CGNS_ENUMV(RealSingle)) - { - auto *c = static_cast(xyz); - for (int ipt = 0; ipt < count; ++ipt) + } else if(datatype == CGNS_ENUMV(RealSingle)) { + auto* c = static_cast(xyz); + for(int ipt = 0; ipt < count; ++ipt) _vertexList[ipt].z = c[ipt]; } _dim = 3; } - if (datatype == CGNS_ENUMV(RealSingle)) - delete (float *)xyz; - else if (datatype == CGNS_ENUMV(RealDouble)) - delete (double *)xyz; + if(datatype == CGNS_ENUMV(RealSingle)) + delete[](float*)xyz; + else if(datatype == CGNS_ENUMV(RealDouble)) + delete[](double*)xyz; } } -void FCGNSGridReaderBase::readFlowSolution(vtkDataSet *grid) +void FCGNSGridReaderBase::readFlowSolution(vtkDataSet* grid) { - int OK = 0; - int nsol = 0; - OK = cg_nsols(_fileIndex, _baseIndex, _zoneIndex, &nsol); - if (CG_OK != OK) + int result = 0; + int nsol = 0; + result = cg_nsols(_fileIndex, _baseIndex, _zoneIndex, &nsol); + if(CG_OK != result) { + DebugError("Failed to read number of flow solution\n"); return; + } else { + DebugInfo("Number of flow solution is %d\n", nsol); + } + _dataSet = grid; - for (int isol = 1; isol <= nsol; ++isol) - { - CGNS_ENUMT(GridLocation_t) - varloc; - char sol_name[33] = {0}; - OK = cg_sol_info(_fileIndex, _baseIndex, _zoneIndex, isol, sol_name, &varloc); - if (CG_OK != OK) - continue; - qDebug() << sol_name << varloc; + for(int isol = 1; isol <= nsol; ++isol) { + CGNS_ENUMT(GridLocation_t) varloc; + char sol_name[33] = { 0 }; + result = cg_sol_info(_fileIndex, _baseIndex, _zoneIndex, isol, sol_name, &varloc); + if(CG_OK != result) { + DebugError("Failed to read info of flow solution\n"); + return; + } else { + DebugInfo("Flow solution: %s, var location: %d\n", sol_name, varloc); + } QList varNames; - QList values; - QList valueType; // 3-float 4-double + QList values; + QList valueType; // 3-float 4-double readFieldData(isol, varloc, varNames, valueType, values); addValueToGrid(varloc, varNames, valueType, values); - for (auto v : values) + for(auto v : values) delete v; values.clear(); } } -void FCGNSGridReaderBase::readFieldData(int solIndex, CGNS_ENUMT(GridLocation_t) loc, - QList &varNames, QList &valueType, QList &values) +void FCGNSGridReaderBase::readFieldData(int solIndex, CGNS_ENUMT(GridLocation_t) loc, + QList& varNames, QList& valueType, + QList& values) { - qDebug() << loc; - if (loc != CGNS_ENUMT(Vertex) && loc != CGNS_ENUMT(CellCenter)) - return; - int OK = 0; - int var_num = 0; - OK = cg_nfields(_fileIndex, _baseIndex, _zoneIndex, solIndex, &var_num); - if (CG_OK != OK) - return; - int valNum = 0; - for (int iFiled = 1; iFiled <= var_num; ++iFiled) + if(loc != CGNS_ENUMT(Vertex) && loc != CGNS_ENUMT(CellCenter)) { - CGNS_ENUMT(DataType_t) - datatype; - char var_name[33] = {0}; - OK = cg_field_info(_fileIndex, _baseIndex, _zoneIndex, solIndex, iFiled, &datatype, var_name); - if (CG_OK != OK) - continue; - qDebug() << var_name << datatype; - - cgsize_t min[3] = {1, 1, 1}, max[3] = {0}; - if (!_isStructedGrid) + DebugError("Unsupported grid location: %d\n", loc); + return; + } + int OK = 0; + int nFields = 0; + OK = cg_nfields(_fileIndex, _baseIndex, _zoneIndex, solIndex, &nFields); + if(CG_OK != OK) + { + DebugError("Failed to read number of fields\n"); + return; + } + int valNum = 0; + for(int iField = 1; iField <= nFields; ++iField) { + CGNS_ENUMT(DataType_t) datatype; + char fieldName[33] = { 0 }; + OK = cg_field_info(_fileIndex, _baseIndex, _zoneIndex, solIndex, iField, &datatype, + fieldName); + if(CG_OK != OK) { + DebugError("Failed to read info of field[%d]\n", iField); + return; + } else { - switch (loc) - { - case CGNS_ENUMT(Vertex): - valNum = max[0] = max[1] = max[2] = _dataSet->GetNumberOfPoints(); - break; - case CGNS_ENUMT(CellCenter): - valNum = max[0] = max[1] = max[2] = _dataSet->GetNumberOfCells(); - break; - default: - break; - } + DebugInfo("Begin to parse field: %s\n", fieldName); } - else - { + + cgsize_t min[3] = { 1, 1, 1 }, max[3] = { 0 }; + if(!_isStructedGrid) { + switch(loc) { + case CGNS_ENUMT(Vertex): + valNum = max[0] = max[1] = max[2] = _dataSet->GetNumberOfPoints(); + break; + case CGNS_ENUMT(CellCenter): + valNum = max[0] = max[1] = max[2] = _dataSet->GetNumberOfCells(); + break; + default: + break; + } + } else { auto sG = vtkStructuredGrid::SafeDownCast(_dataSet); - int dims[3]; + int dims[3]; sG->GetDimensions(dims); - switch (loc) - { - case CGNS_ENUMT(Vertex): - max[0] = dims[0]; - max[1] = dims[1]; - max[2] = dims[2]; - valNum = max[0] * max[1] * max[2]; - break; - case CGNS_ENUMT(CellCenter): - max[0] = dims[0] - 1; - max[1] = dims[1] - 1; - max[2] = dims[2] - 1; - valNum = max[0] * max[1] * max[2]; - break; + switch(loc) { + case CGNS_ENUMT(Vertex): + max[0] = dims[0]; + max[1] = dims[1]; + max[2] = dims[2]; + valNum = max[0] * max[1] * max[2]; + break; + case CGNS_ENUMT(CellCenter): + max[0] = dims[0] - 1; + max[1] = dims[1] - 1; + max[2] = dims[2] - 1; + valNum = max[0] * max[1] * max[2]; + break; - default: - break; + default: + break; } } - void *valuesArr = nullptr; + void* valuesArr = nullptr; - if (datatype == CGNS_ENUMT(RealSingle)) + if(datatype == CGNS_ENUMT(RealSingle)) valuesArr = new float[valNum]; - else if (datatype == CGNS_ENUMT(RealDouble)) + else if(datatype == CGNS_ENUMT(RealDouble)) valuesArr = new double[valNum]; - OK = cg_field_read(_fileIndex, _baseIndex, _zoneIndex, solIndex, var_name, datatype, min, max, valuesArr); - if (CG_OK != OK) - continue; + OK = cg_field_read(_fileIndex, _baseIndex, _zoneIndex, solIndex, fieldName, datatype, min, + max, valuesArr); + if(CG_OK != OK) { + DebugError("Failed to read flow solution for %s\n", fieldName); + return; + } - varNames.append(var_name); - values.append(valuesArr); + varNames.append(fieldName); valueType.append(datatype); + values.append(valuesArr); } } -void FCGNSGridReaderBase::addValueToGrid(CGNS_ENUMT(GridLocation_t) loc, - QList varNames, QList vType, QList valueList) +void FCGNSGridReaderBase::addValueToGrid(CGNS_ENUMT(GridLocation_t) loc, QList varNames, + QList vType, QList valueList) { QHash> vectorName; - QStringList scalarName; - for (QString varName : varNames) - { + QStringList scalarName; + for(QString varName : varNames) { QString component, vecName; - bool isV = isVectorComponent(varName, vecName, component); - if (!isV) + bool isV = isVectorComponent(varName, vecName, component); + if(isV) { + vectorName[vecName].insert(component.toLower(), varName); + } else { scalarName.append(varName); - continue; } - vectorName[vecName].insert(component.toLower(), varName); + } QStringList vecKeys = vectorName.keys(); QStringList unVkeys; - for (QString vecKey : vecKeys) - { + for(QString vecKey : vecKeys) { QHash vvs = vectorName.value(vecKey); - if (vvs.size() == _dim) + if(vvs.size() == _dim) continue; unVkeys.append(vecKey); scalarName.append(vvs.values()); } - for (QString uk : unVkeys) + for(QString uk : unVkeys) vectorName.remove(uk); - if (CGNS_ENUMT(Vertex) == loc) - { - int nc = _dataSet->GetNumberOfPoints(); - auto pointArray = _dataSet->GetPointData(); - for (QString sca : scalarName) - { - int index = varNames.indexOf(sca); - int type = vType.at(index); - void *v = valueList.at(index); - auto array = generateScalarArray(sca, nc, type, v); + if(CGNS_ENUMT(Vertex) == loc) { + int nc = _dataSet->GetNumberOfPoints(); + auto* pointArray = _dataSet->GetPointData(); + for(QString sca : scalarName) { + int index = varNames.indexOf(sca); + int type = vType.at(index); + void* v = valueList.at(index); + auto array = generateScalarArray(sca, nc, type, v); pointArray->AddArray(array); } - for (QString vec : vectorName.keys()) - { + for(QString vec : vectorName.keys()) { QHash comps = vectorName.value(vec); - QString comp = comps.value("x"); - int index = varNames.indexOf(comp); - void *x = valueList.at(index); - int xtype = vType.at(index); + QString comp = comps.value("x"); + int index = varNames.indexOf(comp); + void* x = valueList.at(index); + int xtype = vType.at(index); - comp = comps.value("y"); - index = varNames.indexOf(comp); - void *y = valueList.at(index); - int ytype = vType.at(index); + comp = comps.value("y"); + index = varNames.indexOf(comp); + void* y = valueList.at(index); + int ytype = vType.at(index); - comp = comps.value("z"); - index = varNames.indexOf(comp); - void *z = nullptr; - int ztype = 0; - if (index >= 0) - { - z = valueList.at(index); + comp = comps.value("z"); + index = varNames.indexOf(comp); + void* z = nullptr; + int ztype = 0; + if(index >= 0) { + z = valueList.at(index); ztype = vType.at(index); } auto array = generateVectorArray(vec, nc, xtype, x, ytype, y, ztype, z); pointArray->AddArray(array); } - } - else if (CGNS_ENUMT(CellCenter) == loc) - { - int nc = _dataSet->GetNumberOfCells(); + } else if(CGNS_ENUMT(CellCenter) == loc) { + int nc = _dataSet->GetNumberOfCells(); auto cellArray = _dataSet->GetCellData(); - for (QString sca : scalarName) - { - int index = varNames.indexOf(sca); - void *v = valueList.at(index); - int type = vType.at(index); - auto array = generateScalarArray(sca, nc, type, v); + for(QString sca : scalarName) { + int index = varNames.indexOf(sca); + void* v = valueList.at(index); + int type = vType.at(index); + auto array = generateScalarArray(sca, nc, type, v); cellArray->AddArray(array); } - for (QString vec : vectorName.keys()) - { + for(QString vec : vectorName.keys()) { QHash comps = vectorName.value(vec); - QString comp = comps.value("x"); - int index = varNames.indexOf(comp); - void *x = valueList.at(index); - int xtype = vType.at(index); + QString comp = comps.value("x"); + int index = varNames.indexOf(comp); + void* x = valueList.at(index); + int xtype = vType.at(index); - comp = comps.value("y"); - index = varNames.indexOf(comp); - void *y = valueList.at(index); - int ytype = vType.at(index); + comp = comps.value("y"); + index = varNames.indexOf(comp); + void* y = valueList.at(index); + int ytype = vType.at(index); - comp = comps.value("z"); - index = varNames.indexOf(comp); - void *z = nullptr; - int ztype = 0; - if (index >= 0) - { - z = valueList.at(index); + comp = comps.value("z"); + index = varNames.indexOf(comp); + void* z = nullptr; + int ztype = 0; + if(index >= 0) { + z = valueList.at(index); ztype = vType.at(index); } @@ -325,64 +336,59 @@ void FCGNSGridReaderBase::addValueToGrid(CGNS_ENUMT(GridLocation_t) loc, } } -bool FCGNSGridReaderBase::isVectorComponent(QString name, QString &vecName, QString &comp) +bool FCGNSGridReaderBase::isVectorComponent(QString name, QString& vecName, QString& comp) { QRegExp pattern("\\s*x$|\\s*X$|\\s*y$|\\s*Y$|\\s*z$|\\s*Z$"); - bool is = false; - is = name.contains(pattern); - if (is) - { - comp = name.right(1); + bool is = false; + is = name.contains(pattern); + if(is) { + comp = name.right(1); vecName = name.remove(comp); - if (vecName.isEmpty()) + if(vecName.isEmpty()) return false; } return is; } -vtkDataArray *FCGNSGridReaderBase::generateScalarArray(QString varName, int num, int type, void *va) +vtkDataArray* FCGNSGridReaderBase::generateScalarArray(QString varName, int num, int type, void* va) { - vtkDataArray *array = nullptr; - float *valueFloat = nullptr; - double *valueDouble = nullptr; + vtkDataArray* array = nullptr; + float* valueFloat = nullptr; + double* valueDouble = nullptr; - if (type == 3) // float + if(type == 3) // float { - array = vtkFloatArray::New(); - valueFloat = static_cast(va); - } - else if (type == 4) // double + array = vtkFloatArray::New(); + valueFloat = static_cast(va); + } else if(type == 4) // double { - array = vtkDoubleArray::New(); - valueDouble = static_cast(va); + array = vtkDoubleArray::New(); + valueDouble = static_cast(va); } double v = 0; array->SetName(varName.toLatin1().data()); - for (int i = 0; i < num; ++i) - { - switch (type) - { - case 3: - v = valueFloat[i]; - break; - case 4: - v = valueDouble[i]; - break; - default: - break; + for(int i = 0; i < num; ++i) { + switch(type) { + case 3: + v = valueFloat[i]; + break; + case 4: + v = valueDouble[i]; + break; + default: + break; } array->InsertNextTuple1(v); } double range[2]; array->GetRange(range); - qDebug() << varName << range[0] << range[1]; return array; } -vtkDataArray *FCGNSGridReaderBase::generateVectorArray(QString varName, int num, - int xType, void *x, int yType, void *y, int zType, void *z) +vtkDataArray* FCGNSGridReaderBase::generateVectorArray(QString varName, int num, int xType, void* x, + int yType, void* y, int zType, void* z) { auto array = vtkDoubleArray::New(); array->SetName(varName.toLatin1().data()); @@ -391,61 +397,57 @@ vtkDataArray *FCGNSGridReaderBase::generateVectorArray(QString varName, int num, array->SetComponentName(1, "y"); array->SetComponentName(2, "z"); - float *xFV = nullptr, *yFV = nullptr, *zFV = nullptr; + float * xFV = nullptr, *yFV = nullptr, *zFV = nullptr; double *xDV = nullptr, *yDV = nullptr, *zDV = nullptr; - if (xType == 3) // float - xFV = static_cast(x); - else if (xType == 4) // double - xDV = static_cast(x); + if(xType == 3) // float + xFV = static_cast(x); + else if(xType == 4) // double + xDV = static_cast(x); - if (yType == 3) // float - yFV = static_cast(y); - else if (yType == 4) // double - yDV = static_cast(y); + if(yType == 3) // float + yFV = static_cast(y); + else if(yType == 4) // double + yDV = static_cast(y); - if (zType == 3) // float - zFV = static_cast(z); - else if (zType == 4) // double - zDV = static_cast(z); + if(zType == 3) // float + zFV = static_cast(z); + else if(zType == 4) // double + zDV = static_cast(z); double vx = 0, vy = 0, vz = 0; - for (int i = 0; i < num; ++i) - { - switch (xType) - { - case 3: - vx = xFV[i]; - break; - case 4: - vx = xDV[i]; - break; - default: - break; + for(int i = 0; i < num; ++i) { + switch(xType) { + case 3: + vx = xFV[i]; + break; + case 4: + vx = xDV[i]; + break; + default: + break; } - switch (yType) - { - case 3: - vy = yFV[i]; - break; - case 4: - vy = yDV[i]; - break; - default: - break; + switch(yType) { + case 3: + vy = yFV[i]; + break; + case 4: + vy = yDV[i]; + break; + default: + break; } - switch (zType) - { - case 3: - vz = zFV[i]; - break; - case 4: - vz = zDV[i]; - break; - default: - break; + switch(zType) { + case 3: + vz = zFV[i]; + break; + case 4: + vz = zDV[i]; + break; + default: + break; } array->InsertNextTuple3(vx, vy, vz); diff --git a/src/PostAlgorithm/FCGNSGridReaderBase.h b/src/PostAlgorithm/FCGNSGridReaderBase.h index 54112dc..da578f5 100644 --- a/src/PostAlgorithm/FCGNSGridReaderBase.h +++ b/src/PostAlgorithm/FCGNSGridReaderBase.h @@ -1,59 +1,154 @@ #ifndef _FCGNSGRIDREADER_H__ #define _FCGNSGRIDREADER_H__ -#include -#include #include +#include #include +#include class vtkMultiBlockDataSet; class vtkDataSet; class vtkDataArray; -struct VPoint -{ - double x{0}; - double y{0}; - double z{0}; +/** + * @brief 用于存储点坐标的结构体 + * @since 2.5.0 + */ +struct VPoint { + double x{ 0 }; + double y{ 0 }; + double z{ 0 }; }; -class FCGNSGridReaderBase -{ +class FCGNSGridReaderBase { public: - FCGNSGridReaderBase(vtkMultiBlockDataSet* root); - virtual ~FCGNSGridReaderBase() = default; + /** + * @brief 构造函数 + * @param[out] root 包含数据的vtkMultiBlockDataSet对象 + */ + FCGNSGridReaderBase(vtkMultiBlockDataSet* root); + virtual ~FCGNSGridReaderBase() = default; - void setInfo(int fileIndex, int baseIndex, int zoneIndex); + /** + * @brief 设置要读取zone的信息 + * + * @param[in] fileIndex 文件索引 + * @param[in] baseIndex 单库base的索引 + * @param[in] zoneIndex 区域zone的索引 + */ + void setInfo(int fileIndex, int baseIndex, int zoneIndex); - virtual void read()=0; + /** + * @brief zone读取函数,由子类重写 + * @since 2.5.0 + */ + virtual void read() = 0; protected: - void readCoordinate(int dim,int count, cgsize_t range_from[3], cgsize_t range_to[3]); + /** + * @brief 读取zone中的坐标信息 + * @param[in] dim 维数 + * @param[in] count 顶点数 + * @param[out] range_from 指定读取范围的最小索引,全部读取时为1 + * @param[out] range_to 指定读取范围的最大索引,全部读取时为顶点数 + * @since 2.5.0 + */ + void readCoordinate(int dim, int count, cgsize_t range_from[3], cgsize_t range_to[3]); + /** + * @brief 读取zone中的计算结果 + * @param[out] grid 要保存计算结果的vtkDataSet对象 + * @since 2.5.0 + */ + void readFlowSolution(vtkDataSet* grid); + /** + * @brief 读取场数据 + * @param[in] solIndex 计算结果索引 + * @param[in] loc 计算结果存储位置 + * @param[out] varNames 场变量名称数组 + * @param[out] valueType 场变量类型数组 + * @param[out] values 场变量数据数组 + * @since 2.5.0 + */ + void readFieldData(int solIndex, CGNS_ENUMT(GridLocation_t) loc, QList& varNames, + QList& valueType, QList& values); + /** + * @brief 添加场数据到vtk格式数据中 + * @param[in] loc 场变量位置 + * @param[in] varNames 场变量名称数组 + * @param[in] valueType 场变量类型数组 + * @param[in] values 场变量数据数组 + * @since 2.5.0 + */ + void addValueToGrid(CGNS_ENUMT(GridLocation_t) loc, QList varNames, + QList valueType, QList values); - void readFlowSolution(vtkDataSet* grid); + /** + * @brief 判断场变量是否为矢量分量 + * @param[in] name 场变量名称 + * @param[out] vecName 场变量名称(不含分量x,y,z) + * @param[out] comp 分量(x,y,z) + * @note 该函数判断依据为变量名称的最后一个字母是否为x,y,z(不区分大小写)。 + * @since 2.5.0 + */ + bool isVectorComponent(QString name, QString& vecName, QString& comp); + /** + * @brief 生成标量场的vtkDataArray + * @param[in] varName 场变量名称 + * @param[in] num 场变量值数组大小 + * @param[in] type 场变量数据类型 + * @param[in] va 场变量值数组 + * @since 2.5.0 + */ + vtkDataArray* generateScalarArray(QString varName, int num, int type, void* va); - void readFieldData(int solIndex, CGNS_ENUMT(GridLocation_t) loc,QList &varNames, - QList &valueType, QList &values); - - void addValueToGrid(CGNS_ENUMT(GridLocation_t) loc, QList varNames, - QList valueType, QList values); - - bool isVectorComponent(QString name, QString& vecName, QString& comp); - - vtkDataArray* generateScalarArray(QString varName, int num, int type,void* va); - - vtkDataArray* generateVectorArray(QString varName, int num, - int xtype, void * x,int ytype, void* y, int ztype, void* z); + /** + * @brief 生成矢量场的vtkDataArray + * @param[in] varName 场变量名称 + * @param[in] num 场变量值数组大小 + * @param[in] xtype 场变量数据x分量类型 + * @param[in] x 场变量值x分量数组 + * @param[in] ytype 场变量数据y分量类型 + * @param[in] y 场变量值y分量数组 + * @param[in] ztype 场变量数据z分量类型 + * @param[in] z 场变量值z分量数组 + * @since 2.5.0 + */ + vtkDataArray* generateVectorArray(QString varName, int num, int xtype, void* x, int ytype, + void* y, int ztype, void* z); protected: - vtkMultiBlockDataSet* _root{}; - int _fileIndex{ -1 }, _baseIndex{ -1 }, _zoneIndex{ -1 }; - bool _isStructedGrid{ false }; - int _dim{ 2 }; - vtkDataSet* _dataSet{}; - QString _zoneName; + /** + * @brief 存储要返回的结果数据 + */ + vtkMultiBlockDataSet* _root{}; + /** + * @brief CGNS文件索引 + */ + int _fileIndex{ -1 }; + /** + * @brief base索引 + */ + int _baseIndex{ -1 }; + /** + * @brief zone索引 + */ + int _zoneIndex{ -1 }; + /** + * @brief 是否为结构化数据 + */ + bool _isStructedGrid{ false }; + /** + * @brief 数据维度 + */ + int _dim{ 2 }; + vtkDataSet* _dataSet{}; + QString _zoneName; - QVector _vertexList{}; + /** + * @brief 节点数组 + * @since 2.5.0 + */ + QVector _vertexList{}; }; #endif diff --git a/src/PostAlgorithm/FCGNSReader.cpp b/src/PostAlgorithm/FCGNSReader.cpp index 1fdf574..acf590f 100644 --- a/src/PostAlgorithm/FCGNSReader.cpp +++ b/src/PostAlgorithm/FCGNSReader.cpp @@ -1,234 +1,288 @@ #include "FCGNSReader.h" + +#include "Common/DebugLogger.h" +#include "FCGNSStructureZoneReader.h" +#include "FCGNSUnStructureZoneReader.h" + +#include +#include +#include +#include #include #include -#include -#include #include #include -#include -#include -#include -#include "FCGNSUnStructureZoneReader.h" -#include "FCGNSStructureZoneReader.h" +#include FCGNSReader* FCGNSReader::New() { - auto reader = new FCGNSReader; - reader->InitializeObjectBase(); - return reader; + auto reader = new FCGNSReader; + reader->InitializeObjectBase(); + return reader; } void FCGNSReader::PrintSelf(ostream& os, vtkIndent indent) { - Q_UNUSED(os) - Q_UNUSED(indent) + Q_UNUSED(os) + Q_UNUSED(indent) } FCGNSReader::FCGNSReader() { - this->SetNumberOfInputPorts(0); - this->SetNumberOfOutputPorts(1); - this->FileName = nullptr; + this->SetNumberOfInputPorts(0); + this->SetNumberOfOutputPorts(1); + this->FileName = nullptr; } -FCGNSReader::~FCGNSReader() +FCGNSReader::~FCGNSReader() {} + +void FCGNSReader::readZone(int fileIndex, int baseIndex, int zoneIndex, + vtkMultiBlockDataSet* output) { + // 读取zonetype:Structured 或 Unstructured + CGNS_ENUMT(ZoneType_t) zonetype; + if(CG_OK != cg_zone_type(fileIndex, baseIndex, zoneIndex, &zonetype)){ + DebugError("Failed to read zone(index = %d) type\n", zoneIndex); + return; + } + + if(zonetype == CGNS_ENUMV(Structured)) { + FCGNSStructeGridReader r(output); + r.setInfo(fileIndex, baseIndex, zoneIndex); + r.setReadBC(_readBC); + r.read(); + } else if(zonetype == CGNS_ENUMV(Unstructured)) { + FCGNSUnStructeGridReader r(output); + r.setInfo(fileIndex, baseIndex, zoneIndex); + r.read(); + } } -void FCGNSReader::readZone(int fileIndex, int baseIndex, int zoneIndex, vtkMultiBlockDataSet* output) +int FCGNSReader::ProcessRequest(vtkInformation* request, vtkInformationVector** inputVector, + vtkInformationVector* outputVector) { - CGNS_ENUMT(ZoneType_t) zonetype; - if (CG_OK != cg_zone_type(fileIndex, baseIndex, zoneIndex, &zonetype)) - return ; - - if (zonetype == CGNS_ENUMV(Structured)) - { - FCGNSStructeGridReader r(output); - r.setInfo(fileIndex, baseIndex, zoneIndex); - r.setReadBC(_readBC); - r.read(); - } - else if (zonetype == CGNS_ENUMV(Unstructured)) - { - FCGNSUnStructeGridReader r(output); - r.setInfo(fileIndex, baseIndex, zoneIndex); - r.read(); - } + if(request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION())) { + return this->RequestInformation(request, inputVector, outputVector); + } + if(request->Has(vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT())) { + return this->RequestUpdateExtent(request, inputVector, outputVector); + } + if(request->Has(vtkDemandDrivenPipeline::REQUEST_DATA())) { + return this->RequestData(request, inputVector, outputVector); + } + return this->Superclass::ProcessRequest(request, inputVector, outputVector); } -int FCGNSReader::ProcessRequest(vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector) +int FCGNSReader::RequestData(vtkInformation*, vtkInformationVector**, + vtkInformationVector* outputVector) { - if (request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION())) - { - return this->RequestInformation(request, inputVector, - outputVector); - } - if (request->Has( - vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT())) - { - return this->RequestUpdateExtent(request, inputVector, - outputVector); - } - if (request->Has(vtkDemandDrivenPipeline::REQUEST_DATA())) - { - return this->RequestData(request, inputVector, outputVector); - } - return this->Superclass::ProcessRequest(request, inputVector, - outputVector); -} + auto output = vtkMultiBlockDataSet::GetData(outputVector); -int FCGNSReader::RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector) -{ - auto output = vtkMultiBlockDataSet::GetData(outputVector); + bool ok = canReadFile(); + if(!ok) { + return 0; + } - bool ok = canReadFile(); - if (!ok) return 0; + // 打开文件 + int currentFileIndex = 0; + if(CG_OK != cg_open(FileName, CG_MODE_READ, ¤tFileIndex)) { + DebugError("Failed to open file %s\n", FileName); + return 0; + } else { + DebugInfo("Success to open file %s\n", FileName); + } - int currentFileIndex = 0; - if (cg_open(FileName, CG_MODE_READ, ¤tFileIndex)) - { - return 0; - } - + // 获取CGNS数据库的单库(CGNSBase_t)的数量,一般为1 + int nBase = 0; + if(CG_OK != cg_nbases(currentFileIndex, &nBase)) { + DebugError("Failed to get number of base\n"); + return 0; + } - int nBase = 0; - if (cg_nbases(currentFileIndex, &nBase)) - { - return 0; - } - - for (int ibase = 1; ibase <= nBase; ++ibase) - { - int zone_node_number = 0; - if (cg_nzones(currentFileIndex, ibase, &zone_node_number)) - { - return false; - } - for (int izone = 1; izone <= zone_node_number; ++izone) - { - readZone(currentFileIndex, ibase, izone, output); - } - - } - cgio_close_file(currentFileIndex); - return 1; + // 遍历读取zone(base和zone节点的索引都是从1开始的) + for(int ibase = 1; ibase <= nBase; ++ibase) { + int zone_node_number = 0; + if(CG_OK != cg_nzones(currentFileIndex, ibase, &zone_node_number)) { + return false; + } + for(int izone = 1; izone <= zone_node_number; ++izone) { + readZone(currentFileIndex, ibase, izone, output); + } + } + // 关闭文件 + cg_close(currentFileIndex); + return 1; } bool FCGNSReader::canReadFile() -{ - int cgioFile; - int ierr = 1; - double rootNodeId; - double childId; - float FileVersion = 0.0; - int intFileVersion = 0; - char dataType[CGIO_MAX_DATATYPE_LENGTH + 1]; - char errmsg[CGIO_MAX_ERROR_LENGTH + 1]; - int ndim = 0; - cgsize_t dimVals[12]; - int fileType = CG_FILE_NONE; +{ + int cgioFile; + bool ierr = true; + double rootNodeId; + double childId; + float FileVersion = 0.0; + int intFileVersion = 0; + char dataType[CGIO_MAX_DATATYPE_LENGTH + 1]; + char errmsg[CGIO_MAX_ERROR_LENGTH + 1]; + int ndim = 0; + cgsize_t dimVals[12]; + int fileType = CGIO_FILE_NONE; + char* fileTypeStr = new char[20]; - if (cgio_open_file(FileName, CG_MODE_READ, CG_FILE_NONE, &cgioFile) != CG_OK) - { - cgio_error_message(errmsg); - vtkErrorMacro(<< "vtkCGNSReader::CanReadFile : " << errmsg); - return 0; - } + // 检查文件文件名以确定它是否是有效的数据库 + auto result = cgio_check_file(FileName, &fileType); + if(CGIO_ERR_NONE != result || CGIO_FILE_NONE == fileType) { + DebugError("%s is a invalid database!\n", FileName); + return false; + } else { + DebugInfo("Check database: %s?\tpass!\n", FileName); + } - cgio_get_root_id(cgioFile, &rootNodeId); - cgio_get_file_type(cgioFile, &fileType); + // 确定当前库是否支持fileType给出的数据库类型 + // 始终支持CGIO_FILE_ADF;如果库是用HDF5构建的,则支持CGIO_FILE_HDF5;在32位模式下构建时支持CGIO_FILE_ADF2。 + result = cgio_is_supported(fileType); + switch(fileType) { + case CGIO_FILE_ADF: + strcpy(fileTypeStr, "CGIO_FILE_ADF"); + break; + case CGIO_FILE_HDF5: + strcpy(fileTypeStr, "CGIO_FILE_HDF5"); + break; + case CGIO_FILE_ADF2: + strcpy(fileTypeStr, "CGIO_FILE_ADF2"); + break; + case CGIO_FILE_NONE: + strcpy(fileTypeStr, "CGIO_FILE_NONE"); + break; + default: + fileTypeStr = "Unknown"; + break; + } + if(CGIO_ERR_FILE_TYPE == result) { + DebugError("FileType: %s is not support!\n", fileTypeStr); + return false; + } else { + DebugInfo("FileType: support by library?\tyes!\n"); + } - if (cgio_get_node_id(cgioFile, rootNodeId, "CGNSLibraryVersion", &childId)) - { - cgio_error_message(errmsg); - vtkErrorMacro(<< "vtkCGNSReader::CanReadFile : " << errmsg); - ierr = 0; - goto CanReadError; - } + // 打开数据库,设置数据库标识cgioFile,用于后续操作 + if(cgio_open_file(FileName, CG_MODE_READ, fileType, &cgioFile) != CG_OK) { + cgio_error_message(errmsg); + DebugError("Failed to open file %s, error: %s\n", FileName, errmsg); + return 0; + } else { + DebugInfo("Success to open file %s, identifier = %d\n", FileName, cgioFile); + } - if (cgio_get_data_type(cgioFile, childId, dataType)) - { - vtkErrorMacro(<< "CGNS Version data type"); - ierr = 0; - goto CanReadError; - } + // 获取数据库中根节点的标识 + if(CG_OK != cgio_get_root_id(cgioFile, &rootNodeId)) { + DebugError("Failed to get root node identifier of database(%d)\n", cgioFile); + goto CloseDataBase; + } else { + DebugInfo("Success to get root node identifier of database(%d), identifier = %d\n", + cgioFile, rootNodeId); + } - if (cgio_get_dimensions(cgioFile, childId, &ndim, dimVals)) - { - vtkErrorMacro(<< "cgio_get_dimensions"); - ierr = 0; - goto CanReadError; - } + // 为什么还要获取一次fileType? + // cgio_get_file_type(cgioFile, &fileType); - // check data type - if (strcmp(dataType, "R4") != 0) - { - vtkErrorMacro(<< "Unexpected data type for CGNS-Library-Version=" << dataType); - ierr = 0; - goto CanReadError; - } + // 获取生成文件的CGNS动态库版本 + if(CG_OK != cgio_get_node_id(cgioFile, rootNodeId, "CGNSLibraryVersion", &childId)) { + cgio_error_message(errmsg); + DebugError("Failed to get CGNSLibraryVersion node, error: %s\n", errmsg); + ierr = false; + goto CloseDataBase; + } else { + DebugInfo("Success to get CGNSLibraryVersion node, identifier = %f\n", childId); + } - // check data dim - if ((ndim != 1) || (dimVals[0] != 1)) - { - vtkDebugMacro(<< "Wrong data dimension for CGNS-Library-Version"); - ierr = 0; - goto CanReadError; - } + // 获取CGNSLibraryVersion节点的数据类型( "MT", "I4", "I8", "U4", "U8", "R4", "C1", "B1") + // "MT" 不包含数据的空节点 + // "I4" 32位整数(4字节) + // "I8" 64位整数(8字节) + // "U4" 32位无符号整数(4字节) + // "U8" 64位无符号整数(8字节) + // "R4" 32位实数(4字节) + // "R8" 64位实数(8字节) + // "C1" 字符 + // "B1" 无符号字节 + if(CG_OK != cgio_get_data_type(cgioFile, childId, dataType)) { + cgio_error_message(errmsg); + DebugError("Failed to get CGNSLibraryVersion value type, error: %s\n", errmsg); + ierr = false; + goto CloseDataBase; + } else { + DebugInfo("Success to get CGNSLibraryVersion value type: %s\n", dataType); + } - // read data - if (cgio_read_all_data_type(cgioFile, childId, "R4", &FileVersion)) - { - vtkErrorMacro(<< "read CGNS version number"); - ierr = 0; - goto CanReadError; - } + // 获取CGNSLibraryVersion节点的数据的维度 + if(CG_OK != cgio_get_dimensions(cgioFile, childId, &ndim, dimVals)) { + cgio_error_message(errmsg); + DebugError("Failed to get CGNSLibraryVersion value dimensions, error: %s\n", errmsg); + ierr = false; + goto CloseDataBase; + } else { + DebugInfo("Success to get CGNSLibraryVersion value dimensions, num of dimensions: %d\n", + ndim); + } - // Check that the library version is at least as recent as the one used - // to create the file being read + // 检查CGNSLibraryVersion节点的数据类型(float,参考cg_version函数:http://cgns.github.io/CGNS_docs_current/midlevel/fileops.html) + if(strcmp(dataType, "R4") != 0) { + DebugError("Unexpected data type for CGNS library version: %s\n", dataType); + ierr = false; + goto CloseDataBase; + } - intFileVersion = static_cast(FileVersion * 1000 + 0.5); + // 检查CGNSLibraryVersion节点的数据的维度 + if((ndim != 1) || (dimVals[0] != 1)) { + DebugError("Invalid data dimension for CGNS library version\n"); + ierr = false; + goto CloseDataBase; + } - if (intFileVersion > CGNS_VERSION) - { - // This code allows reading version newer than the lib, - // as long as the 1st digit of the versions are equal - if ((intFileVersion / 1000) > (CGNS_VERSION / 1000)) - { - vtkErrorMacro(<< "The file " << FileName - << " was written with a more recent version" - "of the CGNS library. You must update your CGNS" - "library before trying to read this file."); - ierr = 0; - } - // warn only if different in second digit - if ((intFileVersion / 100) > (CGNS_VERSION / 100)) - { - vtkWarningMacro(<< "The file being read is more recent" - "than the CGNS library used"); - } - } - if ((intFileVersion / 10) < 255) - { - vtkWarningMacro(<< "The file being read was written with an old version" - "of the CGNS library. Please update your file" - "to a more recent version."); - } - vtkDebugMacro(<< "FileVersion=" << FileVersion << "\n"); + // 读取CGNSLibraryVersion节点的数据 + if(cgio_read_all_data_type(cgioFile, childId, "R4", &FileVersion)) { + DebugError("An error occurred reading the CGNS library version\n"); + ierr = false; + goto CloseDataBase; + } else { + DebugInfo("CGNS library version: %f\n", FileVersion); + } -CanReadError: - cgio_close_file(cgioFile); - return ierr ? true : false; + // 检测生成CGNS文件的库版本号是否比当前版本FastCAE使用的CGNS库版本更新 + intFileVersion = static_cast(FileVersion * 1000 + 0.5); + if(intFileVersion > CGNS_VERSION) { + // 主版本号一样的,可以读取 + if(floor(intFileVersion / 1000) > floor(CGNS_VERSION / 1000)) { + DebugError("The file %s was written with a more newer version of the CGNS library\n", + FileName); + ierr = false; + } + // warn only if different in second digit + if((intFileVersion / 100) > (CGNS_VERSION / 100)) { + vtkWarningMacro(<< "The file being read is more recent" + "than the CGNS library used"); + } + } + if((intFileVersion / 10) < 255) { + vtkWarningMacro(<< "The file being read was written with an old version" + "of the CGNS library. Please update your file" + "to a more recent version."); + } + +CloseDataBase: + cgio_close_file(cgioFile); + return ierr; } void FCGNSReader::setReadBC(bool read) { - _readBC = read; - this->Modified(); + _readBC = read; + this->Modified(); } bool FCGNSReader::isReadBC() { - return _readBC; + return _readBC; } diff --git a/src/PostAlgorithm/FCGNSReader.h b/src/PostAlgorithm/FCGNSReader.h index d91e41d..8c0a35b 100644 --- a/src/PostAlgorithm/FCGNSReader.h +++ b/src/PostAlgorithm/FCGNSReader.h @@ -3,36 +3,49 @@ #include -class FCGNSReader : public vtkMultiBlockDataSetAlgorithm -{ +class FCGNSReader : public vtkMultiBlockDataSetAlgorithm { public: - static FCGNSReader* New(); - vtkTypeMacro(FCGNSReader, vtkMultiBlockDataSetAlgorithm); - void PrintSelf(ostream& os, vtkIndent indent) override; + static FCGNSReader* New(); + vtkTypeMacro(FCGNSReader, vtkMultiBlockDataSetAlgorithm); + void PrintSelf(ostream& os, vtkIndent indent) override; - vtkSetStringMacro(FileName); - vtkGetStringMacro(FileName); + /**@name Getter和Setter宏 + * 相当于setter/getter,同vtkSetMacro(FileName, char*)/vtkGetMacro(FileName, char*) + * @{ + */ + vtkSetStringMacro(FileName); + vtkGetStringMacro(FileName); + //@} - + int ProcessRequest(vtkInformation* request, vtkInformationVector** inputVector, + vtkInformationVector* outputVector) override; + int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override; - int ProcessRequest(vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector); - int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*); + /** + * @brief 检测指定文件是否可以被正常读取(包括文件格式、CGNS库版本号) + */ + bool canReadFile(); - bool canReadFile(); + void setReadBC(bool read); - void setReadBC(bool read); - - bool isReadBC(); + bool isReadBC(); private: - FCGNSReader(); - ~FCGNSReader(); - - void readZone(int fileIndex, int baseIndex, int zoneIndex, vtkMultiBlockDataSet* output); + FCGNSReader(); + ~FCGNSReader(); + /** + * @brief 读取CGNS文件的单个zone + * @param[in] fileIndex 文件的索引号 + * @param[in] baseIndex base的索引号(从1开始) + * @param[in] zoneIndex zone的索引号(从1开始) + * @param[out] output + * @since 2.5.0 + */ + void readZone(int fileIndex, int baseIndex, int zoneIndex, vtkMultiBlockDataSet* output); protected: - char* FileName; - bool _readBC{true}; + char* FileName; + bool _readBC{ true }; }; #endif \ No newline at end of file diff --git a/src/PostAlgorithm/FCGNSStructureZoneReader.cpp b/src/PostAlgorithm/FCGNSStructureZoneReader.cpp index ebaa8b3..7f3db5c 100644 --- a/src/PostAlgorithm/FCGNSStructureZoneReader.cpp +++ b/src/PostAlgorithm/FCGNSStructureZoneReader.cpp @@ -1,245 +1,219 @@ #include "FCGNSStructureZoneReader.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + #include "PostRenderData/Macros.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include FCGNSStructeGridReader::FCGNSStructeGridReader(vtkMultiBlockDataSet* root) - :FCGNSGridReaderBase(root) -{ - _isStructedGrid = true; + : FCGNSGridReaderBase(root) +{ + _isStructedGrid = true; } - void FCGNSStructeGridReader::read() { - char zone_name[33] = { 0 }; - cgsize_t zoneSize[3][3] = { 0 }; - int OK = cg_zone_read(_fileIndex, _baseIndex, _zoneIndex, zone_name, zoneSize[0]); - if (CG_OK != OK) return; - _zoneName = QString(zone_name); - - int dim{ 0 }; - OK = cg_ncoords(_fileIndex, _baseIndex, _zoneIndex, &dim); - if (CG_OK != OK) return; + char zone_name[33] = { 0 }; + cgsize_t zoneSize[3][3] = { 0 }; + int OK = cg_zone_read(_fileIndex, _baseIndex, _zoneIndex, zone_name, zoneSize[0]); + if(CG_OK != OK) + return; + _zoneName = QString(zone_name); - cgsize_t read_range[2][3] = { 0 }; - for (int ijk = 0; ijk < 3; ++ijk) - { - read_range[0][ijk] = 1; - read_range[1][ijk] = zoneSize[0][ijk]; - } - int nVertex = zoneSize[0][0] * zoneSize[0][1] * zoneSize[0][2]; - this->readCoordinate(dim, nVertex, read_range[0], read_range[1]); + int dim{ 0 }; + OK = cg_ncoords(_fileIndex, _baseIndex, _zoneIndex, &dim); + if(CG_OK != OK) + return; - vtkStructuredGrid* sGrid = vtkStructuredGrid::New(); - sGrid->SetDimensions(zoneSize[0][0], zoneSize[0][1], zoneSize[0][2]); - // vtkNew points; //形成整体点集合 - DecCreVTKSmartPtr(vtkPoints,points) - - for (int i = 0; i < _vertexList.size(); ++i) - { - VPoint po = _vertexList.at(i); - points->InsertNextPoint(po.x, po.y, po.z); - } + cgsize_t read_range[2][3] = { 0 }; + for(int ijk = 0; ijk < 3; ++ijk) { + read_range[0][ijk] = 1; + read_range[1][ijk] = zoneSize[0][ijk]; + } + int nVertex = zoneSize[0][0] * zoneSize[0][1] * zoneSize[0][2]; + this->readCoordinate(dim, nVertex, read_range[0], read_range[1]); - sGrid->SetPoints(points); + vtkStructuredGrid* sGrid = vtkStructuredGrid::New(); + sGrid->SetDimensions(zoneSize[0][0], zoneSize[0][1], zoneSize[0][2]); + // vtkNew points; //形成整体点集合 + DecCreVTKSmartPtr(vtkPoints, points) - this->readFlowSolution(sGrid); + for(int i = 0; i < _vertexList.size(); ++i) + { + VPoint po = _vertexList.at(i); + points->InsertNextPoint(po.x, po.y, po.z); + } - if(_readBC) - this->readBC(); + sGrid->SetPoints(points); - this->spllitSection(sGrid); + this->readFlowSolution(sGrid); + if(_readBC) + this->readBC(); + + this->spllitSection(sGrid); } void FCGNSStructeGridReader::setReadBC(bool r) { - _readBC = r; + _readBC = r; } bool FCGNSStructeGridReader::isReadBC() { - return _readBC; + return _readBC; } void FCGNSStructeGridReader::readBC() { - int nbc{ 0 }; - int OK = cg_nbocos(_fileIndex, _baseIndex, _zoneIndex, &nbc); - if (CG_OK != OK) return; - for (int ibc = 1; ibc <= nbc; ++ibc) - { - CGNS_ENUMT(BCType_t) bctype; - CGNS_ENUMT(PointSetType_t) ptype; - //CGNS_ENUMT(GridLocation_t) location; - CGNS_ENUMT(DataType_t) datatype; - char bc_name[33] = { 0 }; - int nrmlindex[3] = { 0 }; - cgsize_t np = 0, is = 0; - int ib = 0; + int nbc{ 0 }; + int OK = cg_nbocos(_fileIndex, _baseIndex, _zoneIndex, &nbc); + if(CG_OK != OK) + return; + for(int ibc = 1; ibc <= nbc; ++ibc) { + CGNS_ENUMT(BCType_t) bctype; + CGNS_ENUMT(PointSetType_t) ptype; + // CGNS_ENUMT(GridLocation_t) location; + CGNS_ENUMT(DataType_t) datatype; + char bc_name[33] = { 0 }; + int nrmlindex[3] = { 0 }; + cgsize_t np = 0, is = 0; + int ib = 0; - OK = cg_boco_info(_fileIndex,_baseIndex, _zoneIndex, ibc, bc_name, &bctype, - &ptype, &np, nrmlindex, &is, &datatype, &ib); - if (CG_OK != OK) continue; - if(ptype != CGNS_ENUMV(PointRange)) continue; + OK = cg_boco_info(_fileIndex, _baseIndex, _zoneIndex, ibc, bc_name, &bctype, &ptype, &np, + nrmlindex, &is, &datatype, &ib); + if(CG_OK != OK) + continue; + if(ptype != CGNS_ENUMV(PointRange)) + continue; - cgsize_t * pnpnts = new cgsize_t[6]; - OK = cg_boco_read(_fileIndex, _baseIndex, _zoneIndex, ibc, pnpnts, NULL); - if(OK != CG_OK) continue; - - BCInfo info(bc_name, pnpnts,bctype); - _bcList.append(info); - } + cgsize_t* pnpnts = new cgsize_t[6]; + OK = cg_boco_read(_fileIndex, _baseIndex, _zoneIndex, ibc, pnpnts, NULL); + if(OK != CG_OK) + continue; + BCInfo info(bc_name, pnpnts, bctype); + _bcList.append(info); + } } void FCGNSStructeGridReader::spllitSection(vtkStructuredGrid* gird) { - int n = _root->GetNumberOfBlocks(); - _root->SetBlock(n, gird); - QString NameBC = _zoneName + "!|||!" + "None"; - _root->GetMetaData(n)->Set(vtkCompositeDataSet::NAME(), NameBC.toLatin1().data()); + int n = _root->GetNumberOfBlocks(); + _root->SetBlock(n, gird); + QString NameBC = _zoneName + "!|||!" + "None"; + _root->GetMetaData(n)->Set(vtkCompositeDataSet::NAME(), NameBC.toLatin1().data()); - extractBCs(gird); + extractBCs(gird); } -void FCGNSStructeGridReader::extractBCs(vtkStructuredGrid *grid) +void FCGNSStructeGridReader::extractBCs(vtkStructuredGrid* grid) { - qDebug() << "BC in zone: " << _zoneName; - int dim[3] = { 0 }; - grid->GetDimensions(dim); - for (BCInfo bc: _bcList) - { - QList ptIndexs; - for (int k = bc.kMin; k <= bc.kMax; ++k) - { - for (int j = bc.jMin; j <= bc.jMax; ++j) - { - for (int i = bc.iMin; i <= bc.iMax; ++i) - { - int index = dim[0]*dim[1]*k+ dim[0]*j+i; - ptIndexs.append(index); - } - } - } - extractBCGrid(grid, &bc, ptIndexs); - } - - + int dim[3] = { 0 }; + grid->GetDimensions(dim); + for(BCInfo bc : _bcList) { + QList ptIndexs; + for(int k = bc.kMin; k <= bc.kMax; ++k) { + for(int j = bc.jMin; j <= bc.jMax; ++j) { + for(int i = bc.iMin; i <= bc.iMax; ++i) { + int index = dim[0] * dim[1] * k + dim[0] * j + i; + ptIndexs.append(index); + } + } + } + extractBCGrid(grid, &bc, ptIndexs); + } } - -void FCGNSStructeGridReader::extractBCGrid(vtkStructuredGrid* grid, BCInfo* info, QList & indexs) +void FCGNSStructeGridReader::extractBCGrid(vtkStructuredGrid* grid, BCInfo* info, + QList& indexs) { - vtkStructuredGrid* bcMesh = vtkStructuredGrid::New(); - const int iDim = info->iMax - info->iMin + 1; - const int jDim = info->jMax - info->jMin + 1; - const int kDim = info->kMax - info->kMin + 1; + vtkStructuredGrid* bcMesh = vtkStructuredGrid::New(); + const int iDim = info->iMax - info->iMin + 1; + const int jDim = info->jMax - info->jMin + 1; + const int kDim = info->kMax - info->kMin + 1; - bcMesh->SetDimensions(iDim, jDim, kDim); + bcMesh->SetDimensions(iDim, jDim, kDim); - qDebug() << indexs.size(); - qDebug() << iDim * jDim*kDim; + DecCreVTKSmartPtr(vtkPoints, points) for(int index : indexs) + { + double* coor = grid->GetPoint(index); + points->InsertNextPoint(coor); + } + bcMesh->SetPoints(points); -// vtkNew points; - DecCreVTKSmartPtr(vtkPoints,points) - for (int index : indexs) - { - double* coor = grid->GetPoint(index); - points->InsertNextPoint(coor); - } - bcMesh->SetPoints(points); + vtkPointData* pointData = grid->GetPointData(); + const int nArray = pointData->GetNumberOfArrays(); - vtkPointData* pointData = grid->GetPointData(); - const int nArray = pointData->GetNumberOfArrays(); + for(int iArray = 0; iArray < nArray; ++iArray) { + const char* name = pointData->GetArrayName(iArray); + vtkDataArray* array = pointData->GetArray(name); + const int nComp = array->GetNumberOfComponents(); - for (int iArray = 0; iArray < nArray; ++iArray) - { - const char* name = pointData->GetArrayName(iArray); - vtkDataArray* array = pointData->GetArray(name); - const int nComp = array->GetNumberOfComponents(); + vtkDataArray* copyArray = nullptr; - vtkDataArray* copyArray = nullptr; - - if (array->IsA("vtkDoubleArray")) - copyArray = vtkDoubleArray::New(); - else if (array->IsA("vtkFloatArray")) - copyArray = vtkFloatArray::New(); - if(copyArray == nullptr) continue; - copyArray->SetName(name); + if(array->IsA("vtkDoubleArray")) + copyArray = vtkDoubleArray::New(); + else if(array->IsA("vtkFloatArray")) + copyArray = vtkFloatArray::New(); + if(copyArray == nullptr) + continue; + copyArray->SetName(name); - copyArray->SetNumberOfComponents(nComp); - for (int ic = 0; ic < nComp; ++ic) - { - const char* arrName= array->GetComponentName(ic); - copyArray->SetComponentName(ic, arrName); - } - // copyArray->Resize(indexs.size()); - for (int in =0;inGetComponent(index, ic); - copyArray->InsertComponent(in, ic, v); - } - } - bcMesh->GetPointData()->AddArray(copyArray); + copyArray->SetNumberOfComponents(nComp); + for(int ic = 0; ic < nComp; ++ic) { + const char* arrName = array->GetComponentName(ic); + copyArray->SetComponentName(ic, arrName); + } + // copyArray->Resize(indexs.size()); + for(int in = 0; in < indexs.size(); ++in) { + int index = indexs.at(in); + for(int ic = 0; ic < nComp; ++ic) { + double v = array->GetComponent(index, ic); + copyArray->InsertComponent(in, ic, v); + } + } + bcMesh->GetPointData()->AddArray(copyArray); + } - } - - int n = _root->GetNumberOfBlocks(); - _root->SetBlock(n, bcMesh); - QString NameBC = info->name + "!|||!" + info->BCType; - _root->GetMetaData(n)->Set(vtkCompositeDataSet::NAME(), NameBC.toLatin1().data()); + int n = _root->GetNumberOfBlocks(); + _root->SetBlock(n, bcMesh); + QString NameBC = info->name + "!|||!" + info->BCType; + _root->GetMetaData(n)->Set(vtkCompositeDataSet::NAME(), NameBC.toLatin1().data()); } QString GetBCType(QString name, int bcType) { - QString sBCType{ "None" }; - QString sName = name.toLower(); - if (bcType == 7) - { - sBCType = "Far"; - return sBCType; - } - else if (bcType >= 16 && bcType <= 17) - { - sBCType = "Sym"; - return sBCType; - } - else if (bcType >= 20 && bcType <= 24) - { - sBCType = "Wall"; - return sBCType; - } - else if(sName.contains("far")) - { - sBCType = "Far"; - return sBCType; - } - else if (sName.contains("sym")) - { - sBCType = "Sym"; - return sBCType; - } - else if (sName.contains("wall")) - { - sBCType = "Wall"; - return sBCType; - } - return sBCType; + QString sBCType{ "None" }; + QString sName = name.toLower(); + if(bcType == 7) { + sBCType = "Far"; + return sBCType; + } else if(bcType >= 16 && bcType <= 17) { + sBCType = "Sym"; + return sBCType; + } else if(bcType >= 20 && bcType <= 24) { + sBCType = "Wall"; + return sBCType; + } else if(sName.contains("far")) { + sBCType = "Far"; + return sBCType; + } else if(sName.contains("sym")) { + sBCType = "Sym"; + return sBCType; + } else if(sName.contains("wall")) { + sBCType = "Wall"; + return sBCType; + } + return sBCType; } diff --git a/src/PostAlgorithm/FCGNSUnStructureZoneReader.cpp b/src/PostAlgorithm/FCGNSUnStructureZoneReader.cpp index 433c635..392a062 100644 --- a/src/PostAlgorithm/FCGNSUnStructureZoneReader.cpp +++ b/src/PostAlgorithm/FCGNSUnStructureZoneReader.cpp @@ -1,23 +1,25 @@ #include "FCGNSUnStructureZoneReader.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + +#include "Common/DebugLogger.h" #include "PostRenderData/Macros.hxx" -FCGNSUnStructeGridReader::FCGNSUnStructeGridReader(vtkMultiBlockDataSet *root) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +FCGNSUnStructeGridReader::FCGNSUnStructeGridReader(vtkMultiBlockDataSet* root) : FCGNSGridReaderBase(root) { _isStructedGrid = false; @@ -25,188 +27,361 @@ FCGNSUnStructeGridReader::FCGNSUnStructeGridReader(vtkMultiBlockDataSet *root) void FCGNSUnStructeGridReader::read() { - char zone_name[33] = {0}; - cgsize_t zoneSize[3] = {0, 0, 0}; - int OK = cg_zone_read(_fileIndex, _baseIndex, _zoneIndex, zone_name, zoneSize); - if (CG_OK != OK) + if(_fileIndex < 0 || _baseIndex < 0 || _zoneIndex < 0) { + DebugError("Invalid zone(file: %d, base: %d, zone: %d)\n", _fileIndex, _baseIndex, + _zoneIndex); return; - _zoneName = QString(zone_name); + } + DebugInfo("Start reading zone(file: %d, base: %d, zone: %d)...\n", _fileIndex, _baseIndex, + _zoneIndex); + // 读取zone信息 + char zone_name[33] = { 0 }; + // 在非结构化网格数据中zonesize的元素分别对应NVertex, NCell, NBoundVertex + cgsize_t zoneSize[3] = { 0, 0, 0 }; + auto result = cg_zone_read(_fileIndex, _baseIndex, _zoneIndex, zone_name, zoneSize); + if(CG_OK != result) { + DebugError("Failed to read zone(index = %d) information\n", _zoneIndex); + return; + } else { + DebugInfo("NVertex = %d, NCell = %d, NBoundVertex = %d\n", zoneSize[0], zoneSize[1], + zoneSize[2]); + } + + _zoneName = QString(zone_name); const int nVertex = zoneSize[0], nCell = zoneSize[1], nBoundary = zoneSize[2]; - int dim{0}; - OK = cg_ncoords(_fileIndex, _baseIndex, _zoneIndex, &dim); - if (CG_OK != OK) + // 坐标数组的个数 + int dim{ 0 }; + result = cg_ncoords(_fileIndex, _baseIndex, _zoneIndex, &dim); + if(CG_OK != result) { + DebugError("Failed to read number of coordinate arrays for zone %d\n", _zoneIndex); return; + } else { + DebugInfo("Number of coordinate arrays for zone %d is %d\n", _zoneIndex, dim); + } - // vtkUnstructuredGrid* unsGrid = vtkUnstructuredGrid::New(); - - DecCreVTKSmartPtr(vtkUnstructuredGrid, unsGrid) - cgsize_t read_range[2][3] = {0}; - for (int ijk = 0; ijk < 3; ++ijk) - { + // 需要读取全部数据,所以range=[1,nVertex] + cgsize_t read_range[2][3] = { 0 }; + for(int ijk = 0; ijk < 3; ++ijk) { read_range[0][ijk] = 1; read_range[1][ijk] = nVertex; } + // 读取坐标数据信息 this->readCoordinate(dim, nVertex, read_range[0], read_range[1]); - - DecCreVTKSmartPtr(vtkPoints, points) //形成整体点集合 - for (int i = 0; i < _vertexList.size(); ++i) - { - VPoint po = _vertexList.at(i); - points->InsertNextPoint(po.x, po.y, po.z); + if(_vertexList.size() != nVertex) { + DebugError("Failed to read coordinate arrays for zone %d\n", _zoneIndex); + return; } + // 准备vtk数据,并插入点 + DecCreVTKSmartPtr(vtkPoints, points); + for(int i = 0; i < _vertexList.size(); ++i) { + auto po = _vertexList.at(i); + points->InsertNextPoint(po.x, po.y, po.z); + } + DecCreVTKSmartPtr(vtkUnstructuredGrid, unsGrid); unsGrid->SetPoints(points); - int nSection{0}; - cg_nsections(_fileIndex, _baseIndex, _zoneIndex, &nSection); + // 获取网格单元的节点数量 + int nSection{ 0 }; + result = cg_nsections(_fileIndex, _baseIndex, _zoneIndex, &nSection); + if(CG_OK != result) { + DebugError("Failed to get number of element sections\n"); + return; + } else { + DebugInfo("Number of element sections is %d\n", nSection); + } QList sectionList = sectionOrder(nSection); + if(sectionList.size() == 0) { + DebugError("Failed to order sections\n"); + return; + } - for (int iSection : sectionList) - { - char sectionName[33] = {0}; + for(int iSection : sectionList) { + char sectionName[33] = { 0 }; cgsize_t istart = 0, iend = 0; - int nbndry = 0, iparent_flag = 0; + int nbndry = 0, iparent_flag = 0; CGNS_ENUMT(ElementType_t) itype; - OK = cg_section_read(_fileIndex, _baseIndex, _zoneIndex, iSection, sectionName, &itype, &istart, &iend, &nbndry, &iparent_flag); - const int ncellCount = iend - istart + 1; + result = cg_section_read(_fileIndex, _baseIndex, _zoneIndex, iSection, sectionName, &itype, + &istart, &iend, &nbndry, &iparent_flag); - qDebug() << QString(sectionName) << istart << iend; - cgsize_t elementDataSize = 0; - OK = cg_ElementDataSize(_fileIndex, _baseIndex, _zoneIndex, iSection, &elementDataSize); - if (CG_OK != 0) - continue; - cgsize_t *elements = new cgsize_t[elementDataSize]; - OK = cg_elements_read(_fileIndex, _baseIndex, _zoneIndex, iSection, elements, NULL); - if (CG_OK != 0) - continue; - FSection section(QString(sectionName), istart, iend); //记录section + if(CG_OK != result) { + DebugError("Failed to read element section: %d\n", iSection); + return; + } else { + DebugInfo("element section: %s, element type: %d, first element index: %d, last " + "element index: %d\n", + sectionName, static_cast(itype), istart, iend); + } + + const int ncellCount = iend - istart + 1; + cgsize_t elementDataSize = 0; + result = cg_ElementDataSize(_fileIndex, _baseIndex, _zoneIndex, iSection, &elementDataSize); + if(CG_OK != result) { + DebugError("Failed to get size of element connectivity data array\n"); + return; + } + cgsize_t* elements = new cgsize_t[elementDataSize]; + cgsize_t* connectOffset = nullptr; + /** */ + + if(itype == CGNS_ENUMT(MIXED)) { + connectOffset = new cgsize_t[elementDataSize]; + result = cg_poly_elements_read(_fileIndex, _baseIndex, _zoneIndex, iSection, elements, + connectOffset, NULL); + } else { + // 只能读取固定大小的单元类型 + result = cg_elements_read(_fileIndex, _baseIndex, _zoneIndex, iSection, elements, NULL); + } + if(CG_OK != result) { + DebugError("Failed to read fixed size element data, error: %s\n", cg_get_error()); + return; + } + + FSection section(QString(sectionName), istart, iend); _sections.append(section); - this->addCells(unsGrid, ncellCount, itype, elements); + this->addCells(unsGrid, ncellCount, itype, elements, connectOffset); } this->readFlowSolution(unsGrid); this->spllitSection(unsGrid); } -void FCGNSUnStructeGridReader::addCells(vtkUnstructuredGrid *grid, int ncell, CGNS_ENUMT(ElementType_t) type, cgsize_t *elements) +/** + * type:参考http://cgns.github.io/CGNS_docs_current/sids/conv.html#unstructgrid + * ElementTypeNull, ElementTypeUserDefined, NODE, BAR_2, BAR_3, TRI_3, TRI_6, QUAD_4, QUAD_8, + * QUAD_9, TETRA_4, TETRA_10, PYRA_5, PYRA_14, PENTA_6, PENTA_15, PENTA_18, HEXA_8, HEXA_20, + * HEXA_27, MIXED, PYRA_13, NGON_n, NFACE_n, BAR_4, TRI_9, TRI_10, QUAD_12, QUAD_16, TETRA_16, + * TETRA_20, PYRA_21, PYRA_29, PYRA_30, PENTA_24, PENTA_38, PENTA_40, HEXA_32, HEXA_56, HEXA_64, + * BAR_5, TRI_12, TRI_15, QUAD_P4_16, QUAD_25, TETRA_22, TETRA_34, TETRA_35, PYRA_P4_29, PYRA_50, + * PYRA_55, PENTA_33, PENTA_66, PENTA_75, HEXA_44, HEXA_98, HEXA_125 + * + * CGNS的索引是从1开始的,VTK的索引是从0开始,需要注意 + */ +void FCGNSUnStructeGridReader::addCells(vtkUnstructuredGrid* grid, int ncell, + CGNS_ENUMT(ElementType_t) type, cgsize_t* elements, + cgsize_t* connectOffset) { - if (CGNS_ENUMT(TRI_3) == type) //三角形 + if(CGNS_ENUMT(TRI_3) == type) // 三角形 { - - for (int iCnt = 0; iCnt < ncell; ++iCnt) - { - vtkSmartPointer idlist = vtkSmartPointer::New(); - idlist->InsertNextId(elements[iCnt * 3 + 0] - 1); - idlist->InsertNextId(elements[iCnt * 3 + 1] - 1); - idlist->InsertNextId(elements[iCnt * 3 + 2] - 1); - grid->InsertNextCell(VTK_TRIANGLE, idlist); + for(int iCnt = 0; iCnt < ncell; ++iCnt) { + addTri3Cell(grid, elements[iCnt * 3 + 0] - 1, elements[iCnt * 3 + 1] - 1, + elements[iCnt * 3 + 2] - 1); } - } - else if (CGNS_ENUMT(BAR_2) == type) //二节点梁单元 + } else if(CGNS_ENUMT(BAR_2) == type) // 二节点梁单元 { - for (int iCnt = 0; iCnt < ncell; ++iCnt) - { - vtkSmartPointer idlist = vtkSmartPointer::New(); - idlist->InsertNextId(elements[iCnt * 2 + 0] - 1); - idlist->InsertNextId(elements[iCnt * 2 + 1] - 1); - grid->InsertNextCell(VTK_LINE, idlist); + for(int iCnt = 0; iCnt < ncell; ++iCnt) { + addBar2Cell(grid, elements[iCnt * 2 + 0] - 1, elements[iCnt * 2 + 1] - 1); } - } - else if (CGNS_ENUMT(TETRA_4) == type) //四节点四面体 + } else if(CGNS_ENUMT(TETRA_4) == type) // 四节点四面体 { - for (int iCnt = 0; iCnt < ncell; ++iCnt) - { - vtkSmartPointer idlist = vtkSmartPointer::New(); - idlist->InsertNextId(elements[iCnt * 4 + 0] - 1); - idlist->InsertNextId(elements[iCnt * 4 + 1] - 1); - idlist->InsertNextId(elements[iCnt * 4 + 2] - 1); - idlist->InsertNextId(elements[iCnt * 4 + 3] - 1); - grid->InsertNextCell(VTK_TETRA, idlist); + for(int iCnt = 0; iCnt < ncell; ++iCnt) { + addTetra4Cell(grid, elements[iCnt * 4 + 0] - 1, elements[iCnt * 4 + 1] - 1, + elements[iCnt * 4 + 2] - 1, elements[iCnt * 4 + 3] - 1); } - } - else if (CGNS_ENUMT(QUAD_4) == type) //四节点四边形 + } else if(CGNS_ENUMT(QUAD_4) == type) // 四节点四边形 { - for (int iCnt = 0; iCnt < ncell; ++iCnt) - { - vtkSmartPointer idlist = vtkSmartPointer::New(); - idlist->InsertNextId(elements[iCnt * 4 + 0] - 1); - idlist->InsertNextId(elements[iCnt * 4 + 1] - 1); - idlist->InsertNextId(elements[iCnt * 4 + 2] - 1); - idlist->InsertNextId(elements[iCnt * 4 + 3] - 1); - grid->InsertNextCell(VTK_QUAD, idlist); + for(int iCnt = 0; iCnt < ncell; ++iCnt) { + addQuad4Cell(grid, elements[iCnt * 4 + 0] - 1, elements[iCnt * 4 + 1] - 1, + elements[iCnt * 4 + 2] - 1, elements[iCnt * 4 + 3] - 1); } - } - else if (CGNS_ENUMT(HEXA_8) == type) //八节点六面体 + } else if(CGNS_ENUMT(HEXA_8) == type) // 八节点六面体 { - for (int iCnt = 0; iCnt < ncell; ++iCnt) - { - vtkSmartPointer idlist = vtkSmartPointer::New(); - idlist->InsertNextId(elements[iCnt * 8 + 0] - 1); - idlist->InsertNextId(elements[iCnt * 8 + 1] - 1); - idlist->InsertNextId(elements[iCnt * 8 + 2] - 1); - idlist->InsertNextId(elements[iCnt * 8 + 3] - 1); - idlist->InsertNextId(elements[iCnt * 8 + 4] - 1); - idlist->InsertNextId(elements[iCnt * 8 + 5] - 1); - idlist->InsertNextId(elements[iCnt * 8 + 6] - 1); - idlist->InsertNextId(elements[iCnt * 8 + 7] - 1); - grid->InsertNextCell(VTK_HEXAHEDRON, idlist); + for(int iCnt = 0; iCnt < ncell; ++iCnt) { + addHexa8Cell(grid, elements[iCnt * 8 + 0] - 1, elements[iCnt * 8 + 1] - 1, + elements[iCnt * 8 + 2] - 1, elements[iCnt * 8 + 3] - 1, + elements[iCnt * 8 + 4] - 1, elements[iCnt * 8 + 5] - 1, + elements[iCnt * 8 + 6] - 1, elements[iCnt * 8 + 7] - 1); } - } - else if (CGNS_ENUMT(PENTA_6) == type) //六节点三棱柱 + } else if(CGNS_ENUMT(PENTA_6) == type) // 六节点三棱柱 { - for (int iCnt = 0; iCnt < ncell; ++iCnt) - { - vtkSmartPointer idlist = vtkSmartPointer::New(); - idlist->InsertNextId(elements[iCnt * 6 + 0] - 1); - idlist->InsertNextId(elements[iCnt * 6 + 1] - 1); - idlist->InsertNextId(elements[iCnt * 6 + 2] - 1); - idlist->InsertNextId(elements[iCnt * 6 + 3] - 1); - idlist->InsertNextId(elements[iCnt * 6 + 4] - 1); - idlist->InsertNextId(elements[iCnt * 6 + 5] - 1); - grid->InsertNextCell(VTK_WEDGE, idlist); + for(int iCnt = 0; iCnt < ncell; ++iCnt) { + addPenta6Cell(grid, elements[iCnt * 6 + 0] - 1, elements[iCnt * 6 + 1] - 1, + elements[iCnt * 6 + 2] - 1, elements[iCnt * 6 + 3] - 1, + elements[iCnt * 6 + 4] - 1, elements[iCnt * 6 + 5] - 1); } - } - else if (CGNS_ENUMT(PYRA_5) == type) //金字塔单元 + } else if(CGNS_ENUMT(PYRA_5) == type) // 金字塔单元 { - for (int iCnt = 0; iCnt < ncell; ++iCnt) - { - vtkSmartPointer idlist = vtkSmartPointer::New(); - idlist->InsertNextId(elements[iCnt * 5 + 0] - 1); - idlist->InsertNextId(elements[iCnt * 5 + 1] - 1); - idlist->InsertNextId(elements[iCnt * 5 + 2] - 1); - idlist->InsertNextId(elements[iCnt * 5 + 3] - 1); - idlist->InsertNextId(elements[iCnt * 5 + 4] - 1); - // idlist->InsertNextId(elements[iCnt * 5 + 0] - 1); - grid->InsertNextCell(VTK_PYRAMID, idlist); + for(int iCnt = 0; iCnt < ncell; ++iCnt) { + addPyra5Cell(grid, elements[iCnt * 5 + 0] - 1, elements[iCnt * 5 + 1] - 1, + elements[iCnt * 5 + 2] - 1, elements[iCnt * 5 + 3] - 1, + elements[iCnt * 5 + 4] - 1); } + } else if(CGNS_ENUMT(MIXED) == type && connectOffset != nullptr) { // 混合单元 + int iCnt = 0; + int iEle = 0; + while((iCnt < ncell) && (iEle == connectOffset[iCnt])) { + // 混合单元比其他单元多存储一个值,即第一个值存储单元类型,后面是节点编号 + auto type = elements[iEle]; + switch(type) { + case CGNS_ENUMT(BAR_2): { + auto id1 = elements[++iEle] - 1; + auto id2 = elements[++iEle] - 1; + addBar2Cell(grid, id1, id2); + } break; + case CGNS_ENUMT(TRI_3): { + auto id1 = elements[++iEle] - 1; + auto id2 = elements[++iEle] - 1; + auto id3 = elements[++iEle] - 1; + addTri3Cell(grid, id1, id2, id3); + } break; + case CGNS_ENUMT(TETRA_4): { + auto id1 = elements[++iEle] - 1; + auto id2 = elements[++iEle] - 1; + auto id3 = elements[++iEle] - 1; + auto id4 = elements[++iEle] - 1; + addTetra4Cell(grid, id1, id2, id3, id4); + } break; + case CGNS_ENUMT(QUAD_4): { + auto id1 = elements[++iEle] - 1; + auto id2 = elements[++iEle] - 1; + auto id3 = elements[++iEle] - 1; + auto id4 = elements[++iEle] - 1; + addQuad4Cell(grid, id1, id2, id3, id4); + } break; + case CGNS_ENUMT(HEXA_8): { + auto id1 = elements[++iEle] - 1; + auto id2 = elements[++iEle] - 1; + auto id3 = elements[++iEle] - 1; + auto id4 = elements[++iEle] - 1; + auto id5 = elements[++iEle] - 1; + auto id6 = elements[++iEle] - 1; + auto id7 = elements[++iEle] - 1; + auto id8 = elements[++iEle] - 1; + addHexa8Cell(grid, id1, id2, id3, id4, id5, id6, id7, id8); + } break; + case CGNS_ENUMT(PENTA_6): { + auto id1 = elements[++iEle] - 1; + auto id2 = elements[++iEle] - 1; + auto id3 = elements[++iEle] - 1; + auto id4 = elements[++iEle] - 1; + auto id5 = elements[++iEle] - 1; + auto id6 = elements[++iEle] - 1; + addPenta6Cell(grid, id1, id2, id3, id4, id5, id6); + } break; + case CGNS_ENUMT(PYRA_5): { + auto id1 = elements[++iEle] - 1; + auto id2 = elements[++iEle] - 1; + auto id3 = elements[++iEle] - 1; + auto id4 = elements[++iEle] - 1; + auto id5 = elements[++iEle] - 1; + addPyra5Cell(grid, id1, id2, id3, id4, id5); + } break; + default: + DebugError("Unsupported element type was found: %d\n", static_cast(type)); + break; + } + ++iEle; + ++iCnt; + } + } else { + DebugError("Unsupported element type was found: %d\n", static_cast(type)); } } -void FCGNSUnStructeGridReader::spllitSection(vtkUnstructuredGrid *gird) +vtkIdType FCGNSUnStructeGridReader::addBar2Cell(vtkUnstructuredGrid* grid, vtkIdType id1, + vtkIdType id2) { - if (_sections.isEmpty()) - { + auto idlist = vtkSmartPointer::New(); + idlist->InsertNextId(id1); + idlist->InsertNextId(id2); + return grid->InsertNextCell(VTK_LINE, idlist); +} + +vtkIdType FCGNSUnStructeGridReader::addTri3Cell(vtkUnstructuredGrid* grid, vtkIdType id1, + vtkIdType id2, vtkIdType id3) +{ + auto idlist = vtkSmartPointer::New(); + idlist->InsertNextId(id1); + idlist->InsertNextId(id2); + idlist->InsertNextId(id3); + return grid->InsertNextCell(VTK_TRIANGLE, idlist); +} + +vtkIdType FCGNSUnStructeGridReader::addTetra4Cell(vtkUnstructuredGrid* grid, vtkIdType id1, + vtkIdType id2, vtkIdType id3, vtkIdType id4) +{ + auto idlist = vtkSmartPointer::New(); + idlist->InsertNextId(id1); + idlist->InsertNextId(id2); + idlist->InsertNextId(id3); + idlist->InsertNextId(id4); + return grid->InsertNextCell(VTK_TETRA, idlist); +} + +vtkIdType FCGNSUnStructeGridReader::addQuad4Cell(vtkUnstructuredGrid* grid, vtkIdType id1, + vtkIdType id2, vtkIdType id3, vtkIdType id4) +{ + auto idlist = vtkSmartPointer::New(); + idlist->InsertNextId(id1); + idlist->InsertNextId(id2); + idlist->InsertNextId(id3); + idlist->InsertNextId(id4); + return grid->InsertNextCell(VTK_QUAD, idlist); +} + +vtkIdType FCGNSUnStructeGridReader::addHexa8Cell(vtkUnstructuredGrid* grid, vtkIdType id1, + vtkIdType id2, vtkIdType id3, vtkIdType id4, + vtkIdType id5, vtkIdType id6, vtkIdType id7, + vtkIdType id8) +{ + auto idlist = vtkSmartPointer::New(); + idlist->InsertNextId(id1); + idlist->InsertNextId(id2); + idlist->InsertNextId(id3); + idlist->InsertNextId(id4); + idlist->InsertNextId(id5); + idlist->InsertNextId(id6); + return grid->InsertNextCell(VTK_WEDGE, idlist); +} + +vtkIdType FCGNSUnStructeGridReader::addPenta6Cell(vtkUnstructuredGrid* grid, vtkIdType id1, + vtkIdType id2, vtkIdType id3, vtkIdType id4, + vtkIdType id5, vtkIdType id6) +{ + auto idlist = vtkSmartPointer::New(); + idlist->InsertNextId(id1); + idlist->InsertNextId(id2); + idlist->InsertNextId(id3); + idlist->InsertNextId(id4); + idlist->InsertNextId(id5); + idlist->InsertNextId(id6); + return grid->InsertNextCell(VTK_WEDGE, idlist); +} + +vtkIdType FCGNSUnStructeGridReader::addPyra5Cell(vtkUnstructuredGrid* grid, vtkIdType id1, + vtkIdType id2, vtkIdType id3, vtkIdType id4, + vtkIdType id5) +{ + auto idlist = vtkSmartPointer::New(); + idlist->InsertNextId(id1); + idlist->InsertNextId(id2); + idlist->InsertNextId(id3); + idlist->InsertNextId(id4); + idlist->InsertNextId(id5); + return grid->InsertNextCell(VTK_PYRAMID, idlist); +} + +void FCGNSUnStructeGridReader::spllitSection(vtkUnstructuredGrid* gird) +{ + if(_sections.isEmpty()) { int n = _root->GetNumberOfBlocks(); _root->SetBlock(n, gird); QString NameBC = _zoneName + "!|||!" + "None"; _root->GetMetaData(n)->Set(vtkCompositeDataSet::NAME(), NameBC.toLatin1().data()); } - for (FSection sec : _sections) - { + for(FSection sec : _sections) { // vtkNew ids; - DecCreVTKSmartPtr(vtkIdTypeArray, ids) - ids->SetNumberOfComponents(1); - for (int i = sec._begin - 1; i <= sec._end - 1; ++i) + DecCreVTKSmartPtr(vtkIdTypeArray, ids) ids->SetNumberOfComponents(1); + for(int i = sec._begin - 1; i <= sec._end - 1; ++i) ids->InsertNextValue(i); // vtkNew node; - DecCreVTKSmartPtr(vtkSelectionNode, node) - node->SetFieldType(vtkSelectionNode::CELL); + DecCreVTKSmartPtr(vtkSelectionNode, node) node->SetFieldType(vtkSelectionNode::CELL); node->SetContentType(vtkSelectionNode::INDICES); node->SetSelectionList(ids); @@ -215,57 +390,58 @@ void FCGNSUnStructeGridReader::spllitSection(vtkUnstructuredGrid *gird) section->AddNode(node); // vtkNew exctra; - DecCreVTKSmartPtr(vtkExtractSelection, exctra) - exctra->SetInputData(0, gird); + DecCreVTKSmartPtr(vtkExtractSelection, exctra) exctra->SetInputData(0, gird); exctra->SetInputData(1, section); exctra->Update(); auto secGrid = exctra->GetOutput(); - int n = _root->GetNumberOfBlocks(); + int n = _root->GetNumberOfBlocks(); _root->SetBlock(n, secGrid); QString NameBC = sec._name + "!|||!" + "None"; _root->GetMetaData(n)->Set(vtkCompositeDataSet::NAME(), NameBC.toLatin1().data()); - // _root->GetMetaData(n)->Set(vtkCompositeDataSet::NAME(), sec._name.toLatin1().data()); + // _root->GetMetaData(n)->Set(vtkCompositeDataSet::NAME(), + // sec._name.toLatin1().data()); } } QList FCGNSUnStructeGridReader::sectionOrder(int nsec) { - struct sectionInfo - { + struct sectionInfo { sectionInfo(int index, int s) { - Index = index; + Index = index; startNum = s; } int Index; int startNum; }; - auto compare = [](const sectionInfo &s1, const sectionInfo &s2) -> bool - { + auto compare = [](const sectionInfo& s1, const sectionInfo& s2) -> bool { return s1.startNum <= s2.startNum; }; QList secs; - for (int iSection = 1; iSection <= nsec; ++iSection) - { - char sectionName[33] = {0}; + for(int iSection = 1; iSection <= nsec; ++iSection) { + char sectionName[33] = { 0 }; cgsize_t istart = 0, iend = 0; - int nbndry = 0, iparent_flag = 0; - CGNS_ENUMT(ElementType_t) - itype; - int OK = cg_section_read(_fileIndex, _baseIndex, _zoneIndex, iSection, sectionName, &itype, &istart, &iend, &nbndry, &iparent_flag); - if (OK != CG_OK) - continue; + // 最后一个边界单元的索引,如果单元未排序则设为0 + int nbndry = 0; + // 指示父级数据是否定义,如果存在则为1否则为0 + int iparent_flag = 0; + CGNS_ENUMT(ElementType_t) itype; + int result = cg_section_read(_fileIndex, _baseIndex, _zoneIndex, iSection, sectionName, + &itype, &istart, &iend, &nbndry, &iparent_flag); + if(result != CG_OK) { + DebugError("Failed to get info for an element section\n"); + return {}; + } sectionInfo sinfo(iSection, istart); secs.append(sinfo); } std::sort(secs.begin(), secs.end(), compare); QList secOrders; - for (auto s : secs) - { + for(auto s : secs) { secOrders.append(s.Index); } return secOrders; diff --git a/src/PostAlgorithm/FCGNSUnStructureZoneReader.h b/src/PostAlgorithm/FCGNSUnStructureZoneReader.h index b0d5048..dd56e05 100644 --- a/src/PostAlgorithm/FCGNSUnStructureZoneReader.h +++ b/src/PostAlgorithm/FCGNSUnStructureZoneReader.h @@ -2,38 +2,81 @@ #define _FCGNSUNSTRUCTEGRIDREADER_H__ #include "FCGNSGridReaderBase.h" + +#include +#include #include #include -#include -#include #include -struct FSection -{ - FSection(QString name, int b, int e) :_name(name),_begin(b), _end(e){} - QString _name{}; - int _begin{0}; - int _end{0}; +/** + * @brief section属性结构体 + * @since 2.5.0 + */ +struct FSection { + FSection(QString name, int b, int e) + : _name(name) + , _begin(b) + , _end(e) + { + } + /** + * @brief 名称 + * @since 2.5.0 + */ + QString _name{}; + /** + * @brief 第一个单元的索引 + * @since 2.5.0 + */ + int _begin{ 0 }; + /** + * @brief 最后一个单元的索引 + * @since 2.5.0 + */ + int _end{ 0 }; }; -class FCGNSUnStructeGridReader :public FCGNSGridReaderBase -{ +class FCGNSUnStructeGridReader : public FCGNSGridReaderBase { public: - FCGNSUnStructeGridReader(vtkMultiBlockDataSet* root); - ~FCGNSUnStructeGridReader() = default; - - void read() override; + FCGNSUnStructeGridReader(vtkMultiBlockDataSet* root); + ~FCGNSUnStructeGridReader() = default; + + void read() override; private: - void addCells(vtkUnstructuredGrid* grid, int ncell, CGNS_ENUMT(ElementType_t) type, cgsize_t* eles); + /** + * @brief 添加单元到vtkUnstructuredGrid对象中 + * @param[out] grid 要添加单元的vtkUnstructuredGrid对象 + * @param[in] ncell 单元数量 + * @param[in] type 单元类型 + * @param[in] eles 单元数组 + * @param[in] connectOffset 单元偏移数组,仅在type=mixed时可用 + * @since 2.5.0 + */ + void addCells(vtkUnstructuredGrid* grid, int ncell, CGNS_ENUMT(ElementType_t) type, + cgsize_t* eles, cgsize_t* connectOffset); - void spllitSection(vtkUnstructuredGrid* gird); + vtkIdType addBar2Cell(vtkUnstructuredGrid* grid, vtkIdType id1, vtkIdType id2); + vtkIdType addTri3Cell(vtkUnstructuredGrid* grid, vtkIdType id1, vtkIdType id2, vtkIdType id3); + vtkIdType addTetra4Cell(vtkUnstructuredGrid* grid, vtkIdType id1, vtkIdType id2, vtkIdType id3, + vtkIdType id4); + vtkIdType addQuad4Cell(vtkUnstructuredGrid* grid, vtkIdType id1, vtkIdType id2, vtkIdType id3, + vtkIdType id4); + vtkIdType addHexa8Cell(vtkUnstructuredGrid* grid, vtkIdType id1, vtkIdType id2, vtkIdType id3, + vtkIdType id4, vtkIdType id5, vtkIdType id6, vtkIdType id7, + vtkIdType id8); + vtkIdType addPenta6Cell(vtkUnstructuredGrid* grid, vtkIdType id1, vtkIdType id2, vtkIdType id3, + vtkIdType id4, vtkIdType id5, vtkIdType id6); + vtkIdType addPyra5Cell(vtkUnstructuredGrid* grid, vtkIdType id1, vtkIdType id2, vtkIdType id3, + vtkIdType id4, vtkIdType id5); - QList sectionOrder(int nsec); + void spllitSection(vtkUnstructuredGrid* gird); + + QList sectionOrder(int nsec); private: - QList _sections; - + QList _sections; }; #endif diff --git a/src/PostInterface/DialogCreateCalculate.cpp b/src/PostInterface/DialogCreateCalculate.cpp index a42e896..58905ff 100644 --- a/src/PostInterface/DialogCreateCalculate.cpp +++ b/src/PostInterface/DialogCreateCalculate.cpp @@ -1,17 +1,19 @@ -#include "DialogCreateCalculate.h" -#include "ui_DialogCreateCalculate.h" -#include "PostTreeWidget.h" -#include "RenderDirector.h" -#include "PostRenderData/RenderDataObject.h" +#include "DialogCreateCalculate.h" + #include "PostRenderData/CalculateRenderDataAlg.h" +#include "PostRenderData/RenderDataObject.h" +#include "PostTreeWidget.h" #include "PythonModule/PyAgent.h" +#include "RenderDirector.h" +#include "ui_DialogCreateCalculate.h" + #include #include -namespace Post -{ - CreateCalculateDialog::CreateCalculateDialog(PostTreeWidget *tree, QWidget *parent) : PostFunctionDialogBase(tree, parent), - _ui(new Ui::CreateCalculateDialog) +namespace Post { + CreateCalculateDialog::CreateCalculateDialog(PostTreeWidget* tree, QWidget* parent) + : PostFunctionDialogBase(tree, parent) + , _ui(new Ui::CreateCalculateDialog) { _ui->setupUi(this); init(); @@ -37,14 +39,13 @@ namespace Post void CreateCalculateDialog::accept() { - if (_parentObject == nullptr) - { + if(_parentObject == nullptr) { QMessageBox::warning(this, tr("Warning!"), tr("No selected data!")); return; } - QString name = _ui->nameLineEdit->text(); - QString exp = _ui->expressionLineEdit->text().trimmed(); + QString name = _ui->nameLineEdit->text(); + QString exp = _ui->expressionLineEdit->text().trimmed(); QStringList codes{}; @@ -54,9 +55,9 @@ namespace Post codes += QString("calculate.setUsePointData(%1)").arg(_isPoint); codes += QString("calculate.setFunction('%1')").arg(exp); - for (auto v : _scalarList) + for(auto v : _scalarList) codes += QString("calculate.appendScalar('%1')").arg(v); - for (auto v : _vectorList) + for(auto v : _vectorList) codes += QString("calculate.appendVector('%1')").arg(v); codes += this->getSeletedDataCode("calculate"); @@ -83,7 +84,8 @@ namespace Post // alg->update(); // // _parentObject->appendSubObjects(alg); - // RenderDirector::getInstance()->renderDataObjectToWindow(alg, _parentObject->getRenderWinID()); + // RenderDirector::getInstance()->renderDataObjectToWindow(alg, + // _parentObject->getRenderWinID()); // _tree->updatePostTree(); QDialog::accept(); this->close(); @@ -97,46 +99,38 @@ namespace Post void CreateCalculateDialog::updateDisplayInterface() { - if (_parentObject == nullptr) + if(_parentObject == nullptr) return; - QAction *action = nullptr; + QAction* action = nullptr; _scalarMenu->clear(); _vectorMenu->clear(); - auto createMenu = [=, &action](QStringList arrayList) - { - for (auto array : arrayList) - { - int type = _parentObject->variableType(1, array); - if (type == 1) - { + auto createMenu = [=, &action](QStringList arrayList) { + for(auto array : arrayList) { + auto type = _parentObject->variableType(1, array); + if(type == "scalar") { action = _scalarMenu->addAction(array); - connect(action, &QAction::triggered, [=] - { - setExpression(array); - if (!_scalarList.contains(array)) - _scalarList.append(array); }); - } - else if (type == 2) - { - action = _vectorMenu->addAction(array); - connect(action, &QAction::triggered, [=] - { + connect(action, &QAction::triggered, [=] { setExpression(array); - if (!_vectorList.contains(array)) - _vectorList.append(array); }); + if(!_scalarList.contains(array)) + _scalarList.append(array); + }); + } else if(type == "vector") { + action = _vectorMenu->addAction(array); + connect(action, &QAction::triggered, [=] { + setExpression(array); + if(!_vectorList.contains(array)) + _vectorList.append(array); + }); } } }; - if (_isPoint) - { + if(_isPoint) { QStringList pArray = _parentObject->getPointDataArray(); createMenu(pArray); - } - else - { + } else { QStringList cArray = _parentObject->getCellDataArray(); createMenu(cArray); } @@ -343,17 +337,17 @@ namespace Post { QString exp = _operationList.join(""); text.remove(exp); - if (text.isEmpty()) + if(text.isEmpty()) return; _operationList.append(text); } void CreateCalculateDialog::on_typeComboBox_currentIndexChanged(int index) { - if (index == 0) + if(index == 0) _isPoint = true; else _isPoint = false; } -} \ No newline at end of file +} // namespace Post \ No newline at end of file diff --git a/src/PostInterface/DialogRenderSetting.cpp b/src/PostInterface/DialogRenderSetting.cpp index 0bf1e01..8deb6d6 100644 --- a/src/PostInterface/DialogRenderSetting.cpp +++ b/src/PostInterface/DialogRenderSetting.cpp @@ -1,20 +1,19 @@ #include "DialogRenderSetting.h" -#include "ui_DialogRenderSetting.h" + #include "GraphWidget.h" -#include "PostTreeWidget.h" +#include "PostInterface/RenderWindowManager.h" #include "PostRenderData/RenderDataObject.h" #include "PostRenderData/RenderProperty.h" -#include "PostInterface/RenderWindowManager.h" +#include "PostTreeWidget.h" #include "PythonModule/PyAgent.h" +#include "ui_DialogRenderSetting.h" + #include #include -namespace Post -{ - // RenderSettingDialog::RenderSettingDialog(RenderDataObject* obj, int index, QWidget *parent) : - // QDialog(parent), - // _ui(new Ui::RenderSettingDialog), - // _dataObject(obj) +namespace Post { + // RenderSettingDialog::RenderSettingDialog(RenderDataObject* obj, int index, QWidget *parent) + // : QDialog(parent), _ui(new Ui::RenderSettingDialog), _dataObject(obj) // { // _ui->setupUi(this); // this->setWindowFlags(Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint); @@ -31,15 +30,19 @@ namespace Post // // init(); // - // connect(_ui->variableTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(setColorByVariable(QTreeWidgetItem*))); - // connect(_ui->transparencyHorizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(setTransparency(const int))); - // connect(_ui->transparencySpinBox, SIGNAL(valueChanged(int)), this, SLOT(setTransparency(const int))); + // connect(_ui->variableTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, + // SLOT(setColorByVariable(QTreeWidgetItem*))); connect(_ui->transparencyHorizontalSlider, + // SIGNAL(valueChanged(int)), this, SLOT(setTransparency(const int))); + // connect(_ui->transparencySpinBox, SIGNAL(valueChanged(int)), this, + // SLOT(setTransparency(const int))); // } - RenderSettingDialog::RenderSettingDialog(PostTreeWidget *tree, RenderDataObject *obj, QWidget *parent /*= nullptr*/) : QDialog(parent), - _ui(new Ui::RenderSettingDialog), - _dataObject(obj), - _tree(tree) + RenderSettingDialog::RenderSettingDialog(PostTreeWidget* tree, RenderDataObject* obj, + QWidget* parent /*= nullptr*/) + : QDialog(parent) + , _ui(new Ui::RenderSettingDialog) + , _dataObject(obj) + , _tree(tree) { _ui->setupUi(this); @@ -47,7 +50,8 @@ namespace Post this->setAttribute(Qt::WA_DeleteOnClose); _ui->variableTreeWidget->header()->setSectionResizeMode(QHeaderView::Stretch); - _renderWindow = RenderWindowManager::getInstance()->getRenderWindowByID(_dataObject->getRenderWinID()); + _renderWindow = + RenderWindowManager::getInstance()->getRenderWindowByID(_dataObject->getRenderWinID()); init(); } @@ -59,10 +63,8 @@ namespace Post void RenderSettingDialog::init() { - - auto initInterfaceUI = [=](RenderProperty *pro) - { - double color[3] = {0}; + auto initInterfaceUI = [=](RenderProperty* pro) { + double color[3] = { 0 }; pro->getPropertyColor(color); _ui->variableColorPushButton->setStyleSheet(QString("background-color: rgb(%1,%2,%3);") .arg(color[0] * 255) @@ -72,15 +74,12 @@ namespace Post _ui->transparencyHorizontalSlider->setValue(trans * 100); _ui->transparencySpinBox->setValue(trans * 100); auto type = pro->getVariableType(); - if (type == 0) - { + if(type == 0) { _ui->colorBarCheckBox->setChecked(false); _ui->colorBarCheckBox->setEnabled(false); _ui->variableColorCheckBox->setChecked(false); _ui->variableColorCheckBox->setEnabled(false); - } - else - { + } else { _ui->colorBarCheckBox->setChecked(pro->getShowColorMap()); _ui->colorBarCheckBox->setEnabled(true); _ui->variableColorCheckBox->setChecked(true); @@ -90,18 +89,14 @@ namespace Post QMultiHash dataList = _tree->getSelectedData(_dataObject); - if (dataList.size() > 0) - { - auto id = dataList.uniqueKeys().at(0); + if(dataList.size() > 0) { + auto id = dataList.uniqueKeys().at(0); auto index = dataList.values(id).at(0); - if (index == -1) - { - auto obj = _dataObject->getObjectByID(id); + if(index == -1) { + auto obj = _dataObject->getObjectByID(id); auto objPro = obj->getPropertyListAt(0); initInterfaceUI(objPro); - } - else - { + } else { auto objPro = _dataObject->getPropertyListAt(index); initInterfaceUI(objPro); } @@ -112,15 +107,18 @@ namespace Post initVariableTreeWidget(1, pArrayList); initVariableTreeWidget(2, cArrayList); - connect(_ui->variableTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(setColorByVariable(QTreeWidgetItem *))); - connect(_ui->transparencyHorizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(setTransparency(const int))); - connect(_ui->transparencySpinBox, SIGNAL(valueChanged(int)), this, SLOT(setTransparency(const int))); + connect(_ui->variableTreeWidget, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, + SLOT(setColorByVariable(QTreeWidgetItem*))); + connect(_ui->transparencyHorizontalSlider, SIGNAL(valueChanged(int)), this, + SLOT(setTransparency(const int))); + connect(_ui->transparencySpinBox, SIGNAL(valueChanged(int)), this, + SLOT(setTransparency(const int))); } void RenderSettingDialog::initVariableTreeWidget(int loc, QStringList arrayList) { QString locName = tr("Point"); - if (loc == 2) + if(loc == 2) locName = tr("Cell"); // int cType = 1; // int cIndex = -1; @@ -128,8 +126,7 @@ namespace Post // // getCurrentVariable(cVariable, cType, cIndex); - auto createTreeItem = [=](QString name, QString type, int loc, int index = -1) - { + auto createTreeItem = [=](QString name, QString type, int loc, int index = -1) { auto item = new QTreeWidgetItem; item->setText(0, name); item->setText(1, type); @@ -144,23 +141,15 @@ namespace Post // } }; - for (auto name : arrayList) - { - const int vType = _dataObject->variableType(loc, name); - if (vType == 0) - ; - else if (vType == 1) - { + for(auto name : arrayList) { + const auto vType = _dataObject->variableType(loc, name); + if(vType == "scalar") { createTreeItem(name, tr("%1Scalar").arg(locName), loc); - } - else if (vType == 2) - { + } else if(vType == "vector") { createTreeItem(name, tr("%1Vector-X").arg(locName), loc, 0); createTreeItem(name, tr("%1Vector-Y").arg(locName), loc, 1); createTreeItem(name, tr("%1Vector-Z").arg(locName), loc, 2); - } - else if (vType == 3) - { + } else if(vType == "tensor") { createTreeItem(name, tr("%1Tensor").arg(locName), loc); } } @@ -169,43 +158,40 @@ namespace Post QString RenderSettingDialog::getVariableType(int loc, int type) { QString locName = tr("Point"); - if (loc == 1) + if(loc == 1) locName = tr("Cell"); QString typeName; - switch (type) - { - case 1: - typeName = tr("Scalar"); - break; - case 2: - typeName = tr("Vector"); - break; - case 3: - typeName = tr("Tensor"); - break; - default: - break; + switch(type) { + case 1: + typeName = tr("Scalar"); + break; + case 2: + typeName = tr("Vector"); + break; + case 3: + typeName = tr("Tensor"); + break; + default: + break; } - if (typeName.isEmpty()) + if(typeName.isEmpty()) return typeName; return locName + typeName; } - void RenderSettingDialog::getCurrentVariable(QString &name, int &loc, int &index) + void RenderSettingDialog::getCurrentVariable(QString& name, int& loc, int& index) { Q_UNUSED(name) Q_UNUSED(loc) Q_UNUSED(index) // if (_renderProperty == nullptr) // { - // auto pro = _dataObject->getPropertyListAt(_dataObject->getPropertyListCount() - 1); - // if (pro == nullptr) return; - // name = pro->getVariableName(); - // loc = pro->getVariableType(); - // index = pro->getComponentIndex(); + // auto pro = _dataObject->getPropertyListAt(_dataObject->getPropertyListCount() - + // 1); if (pro == nullptr) return; name = pro->getVariableName(); loc = + // pro->getVariableType(); index = pro->getComponentIndex(); // } // else // { @@ -221,25 +207,20 @@ namespace Post QMultiHash dataList = _tree->getSelectedData(_dataObject); - for (auto id : dataList.uniqueKeys()) - { + for(auto id : dataList.uniqueKeys()) { auto obj = _dataObject->getObjectByID(id); - if (obj == nullptr) + if(obj == nullptr) continue; - for (auto bIndex : dataList.values(id)) - { - if (bIndex == -1) - { + for(auto bIndex : dataList.values(id)) { + if(bIndex == -1) { auto cPro = obj->getPropertyListAt(0); - if (cPro == nullptr) + if(cPro == nullptr) continue; _propertyList.append(cPro); - } - else - { + } else { auto bPro = obj->getPropertyListAt(bIndex); - if (bPro == nullptr) + if(bPro == nullptr) continue; _propertyList.append(bPro); } @@ -249,11 +230,10 @@ namespace Post void RenderSettingDialog::on_variableColorPushButton_clicked() { - QColor c = _ui->variableColorPushButton->palette().color(QPalette::Background); + QColor c = _ui->variableColorPushButton->palette().color(QPalette::Background); QColor color = QColorDialog::getColor(c, this); - if (color.isValid()) - { + if(color.isValid()) { _ui->variableColorCheckBox->setChecked(false); _ui->variableColorCheckBox->setEnabled(false); _ui->colorBarCheckBox->setChecked(false); @@ -268,17 +248,18 @@ namespace Post // for (auto pro : _propertyList) // pro->setPropertyColor(color.redF(), color.greenF(), color.blueF()); - auto dataHash = _tree->getSelectedData(_dataObject); + auto dataHash = _tree->getSelectedData(_dataObject); QStringList codes{}; codes += QString("variablecolor = PostProcess.VariableColor()"); - codes += QString("variablecolor.setColor(%1,%2,%3)").arg(color.redF()).arg(color.greenF()).arg(color.blueF()); + codes += QString("variablecolor.setColor(%1,%2,%3)") + .arg(color.redF()) + .arg(color.greenF()) + .arg(color.blueF()); - for (auto obj : dataHash.uniqueKeys()) - { + for(auto obj : dataHash.uniqueKeys()) { auto blockList = dataHash.values(obj); - for (auto block : blockList) - { + for(auto block : blockList) { codes += QString("variablecolor.appendBlock(%1,%2)").arg(obj).arg(block); } } @@ -294,29 +275,29 @@ namespace Post void RenderSettingDialog::on_variableColorCheckBox_clicked() { - if (!_ui->variableColorCheckBox->isChecked()) - { + if(!_ui->variableColorCheckBox->isChecked()) { _ui->variableColorCheckBox->setEnabled(false); _ui->colorBarCheckBox->setChecked(false); _ui->colorBarCheckBox->setEnabled(false); - QColor color = _ui->variableColorPushButton->palette().color(QPalette::Background); + QColor color = _ui->variableColorPushButton->palette().color(QPalette::Background); // getRenderPropertyList(); // // for (auto pro : _propertyList) // pro->setPropertyColor(color.redF(), color.greenF(), color.blueF()); - auto dataHash = _tree->getSelectedData(_dataObject); + auto dataHash = _tree->getSelectedData(_dataObject); QStringList codes{}; codes += QString("variablecolor = PostProcess.VariableColor()"); - codes += QString("variablecolor.setColor(%1,%2,%3)").arg(color.redF()).arg(color.greenF()).arg(color.blueF()); + codes += QString("variablecolor.setColor(%1,%2,%3)") + .arg(color.redF()) + .arg(color.greenF()) + .arg(color.blueF()); - for (auto obj : dataHash.uniqueKeys()) - { + for(auto obj : dataHash.uniqueKeys()) { auto blockList = dataHash.values(obj); - for (auto block : blockList) - { + for(auto block : blockList) { codes += QString("variablecolor.appendBlock(%1,%2)").arg(obj).arg(block); } } @@ -332,12 +313,11 @@ namespace Post void RenderSettingDialog::on_colorBarCheckBox_clicked() { - bool show = _ui->colorBarCheckBox->isChecked(); getRenderPropertyList(); - for (auto pro : _propertyList) + for(auto pro : _propertyList) pro->setShowColorMap(show); _renderWindow->reRender(); @@ -352,46 +332,44 @@ namespace Post _ui->transparencyHorizontalSlider->blockSignals(false); _ui->transparencySpinBox->blockSignals(false); - if (_dataObject == nullptr) + if(_dataObject == nullptr) return; double trans = (double)value / 100; getRenderPropertyList(); - for (auto pro : _propertyList) + for(auto pro : _propertyList) pro->setTransparency(trans); _renderWindow->reRender(); _tree->updatePostTree(); } - void RenderSettingDialog::setColorByVariable(QTreeWidgetItem *item) + void RenderSettingDialog::setColorByVariable(QTreeWidgetItem* item) { _ui->variableColorCheckBox->setEnabled(true); _ui->variableColorCheckBox->setChecked(true); _ui->colorBarCheckBox->setEnabled(true); - QString name = item->text(0); - int type = item->data(0, Qt::UserRole).toInt(); - int index = item->data(1, Qt::UserRole).toInt(); + QString name = item->text(0); + int type = item->data(0, Qt::UserRole).toInt(); + int index = item->data(1, Qt::UserRole).toInt(); // getRenderPropertyList(); // // for (auto pro : _propertyList) // pro->setCurrentVariable(type, name, index); - auto dataHash = _tree->getSelectedData(_dataObject); + auto dataHash = _tree->getSelectedData(_dataObject); QStringList codes{}; codes += QString("variablecolor = PostProcess.VariableColor()"); codes += QString("variablecolor.selectVariable(%1,'%2',%3)").arg(type).arg(name).arg(index); - for (auto obj : dataHash.uniqueKeys()) - { + for(auto obj : dataHash.uniqueKeys()) { auto blockList = dataHash.values(obj); - for (auto block : blockList) - { + for(auto block : blockList) { codes += QString("variablecolor.appendBlock(%1,%2)").arg(obj).arg(block); } } @@ -405,4 +383,4 @@ namespace Post _tree->updatePostTree(); } -} +} // namespace Post diff --git a/src/PostInterface/PostInfoWidget.cpp b/src/PostInterface/PostInfoWidget.cpp index f1419fc..1ce4865 100644 --- a/src/PostInterface/PostInfoWidget.cpp +++ b/src/PostInterface/PostInfoWidget.cpp @@ -1,55 +1,51 @@ #include "PostInfoWidget.h" -#include "ui_PostInfoWidget.h" + +#include "PostRenderData/RenderDataAlgorithm.h" +#include "PostRenderData/RenderDataImportSteady.h" +#include "PostRenderData/RenderDataImportUnSteady.h" #include "PostRenderData/RenderDataManager.h" #include "PostRenderData/RenderDataObject.h" #include "PostRenderData/RenderProperty.h" -#include "PostRenderData/RenderDataAlgorithm.h" -#include "PostRenderData/RenderDataImportUnSteady.h" -#include "PostRenderData/RenderDataImportSteady.h" +#include "ui_PostInfoWidget.h" + +#include #include #include -#include +namespace Post { -namespace Post -{ - - PostInfoWidget::PostInfoWidget(GUI::MainWindow* m, QWidget* parent) : - _ui(new Ui::PostInfoWidget), _parent(parent), _mainWindow(m) - { - _ui->setupUi(this); - _dataManager = RenderDataManager::getInstance(); - _ui->tableWidget->setColumnCount(4); - QStringList header; + PostInfoWidget::PostInfoWidget(GUI::MainWindow* m, QWidget* parent) + : _ui(new Ui::PostInfoWidget) + , _parent(parent) + , _mainWindow(m) + { + _ui->setupUi(this); + _dataManager = RenderDataManager::getInstance(); + _ui->tableWidget->setColumnCount(4); + QStringList header; header << tr("Property") << tr("Name") << tr("Type") << tr("Range"); - _ui->tableWidget->setHorizontalHeaderLabels(header); - _ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); - _ui->tableWidget->verticalHeader()->setVisible(false); + _ui->tableWidget->setHorizontalHeaderLabels(header); + _ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); + _ui->tableWidget->verticalHeader()->setVisible(false); + } - } + PostInfoWidget::~PostInfoWidget() + { + delete _ui; + } - PostInfoWidget::~PostInfoWidget() - { - delete _ui; - } - - QString PostInfoWidget::enumToString(Post::ObjType type) - { - QString types; - if(type == Post::ObjType::Alg) - { - types = "Alg"; - } - else if(type == Post::ObjType::Imp) - { - types = tr("Imp"); - } - else if(type == Post::ObjType::TNone) - { - types = "TNone"; - } - return types; - } + QString PostInfoWidget::enumToString(Post::ObjType type) + { + QString types; + if(type == Post::ObjType::Alg) { + types = "Alg"; + } else if(type == Post::ObjType::Imp) { + types = tr("Imp"); + } else if(type == Post::ObjType::TNone) { + types = "TNone"; + } + return types; + } void PostInfoWidget::reTranslate() { @@ -65,78 +61,92 @@ namespace Post QString PostInfoWidget::getRenderDataObjectType(RenderDataObject* obj) { QString sType = "TNone"; - auto type = obj->getDataType(); - if (type == Post::ObjType::Alg) - { - sType = tr("Alg"); + auto type = obj->getDataType(); + if(type == Post::ObjType::Alg) { + sType = tr("Alg"); auto alg = RenderDataAlgorithm::SafeDownCast(obj); - if (alg == nullptr) return sType; + if(alg == nullptr) + return sType; - switch (alg->getAlgoType()) - { - case Post::ISO: sType = tr("ISOSurface"); break; - case Post::ISOCurve: sType = tr("ISOCurve"); break; - case Post::Vector: sType = tr("Vector"); break; - case Post::Slice: sType = tr("Slice"); break; - case Post::Clip: sType = tr("Clip"); break; - case Post::StreamLine: sType = tr("StreamLine"); break; - case Post::Simplify: sType = tr("Simplify"); break; - case Post::Calculator: sType = tr("Calculator"); break; - case Post::Reflection: sType = tr("Reflection"); break; + switch(alg->getAlgoType()) { + case Post::ISO: + sType = tr("ISOSurface"); + break; + case Post::ISOCurve: + sType = tr("ISOCurve"); + break; + case Post::Vector: + sType = tr("Vector"); + break; + case Post::Slice: + sType = tr("Slice"); + break; + case Post::Clip: + sType = tr("Clip"); + break; + case Post::StreamLine: + sType = tr("StreamLine"); + break; + case Post::Simplify: + sType = tr("Simplify"); + break; + case Post::Calculator: + sType = tr("Calculator"); + break; + case Post::Reflection: + sType = tr("Reflection"); + break; } - } - else if (type == Post::ObjType::Imp) - { - sType = tr("Steady"); + } else if(type == Post::ObjType::Imp) { + sType = tr("Steady"); auto usteady = RenderDataImportUnSteady::SafeDownCast(obj); - if (usteady != nullptr) sType = tr("UnSteady"); + if(usteady != nullptr) + sType = tr("UnSteady"); } return sType; } void PostInfoWidget::updatePostTable(QTreeWidgetItem* item) - { - if (item == nullptr) return; + { + if(item == nullptr) + return; - bool ok = false; + bool ok = false; - int id = item->data(0, Qt::UserRole).toInt(&ok); - if (!ok)return; - - auto obj = _dataManager->getObjectByID(id); - if (obj == nullptr) return; + int id = item->data(0, Qt::UserRole).toInt(&ok); + if(!ok) + return; + auto obj = _dataManager->getObjectByID(id); + if(obj == nullptr) + return; int index = item->data(1, Qt::UserRole).toInt(&ok); - if (!ok) return; + if(!ok) + return; auto setRangeItem = [=](int row, int type, QString var) { - int vtype = obj->variableType(type, var); - double range[2]{ 0 }; + auto vtype = obj->variableType(type, var); + double range[2]{ 0 }; QString sRange; - if (vtype == 1) - { + if(vtype == "scalar") { obj->getRange(range, type, var, -1); sRange = QString("[%1,%2]").arg(range[0]).arg(range[1]); - } - else if (vtype == 2) - { + } else if(vtype == "vector") { obj->getRange(range, type, var, 0); sRange = QString("[%1,%2];").arg(range[0]).arg(range[1]); obj->getRange(range, type, var, 1); sRange += QString("[%1,%2];").arg(range[0]).arg(range[1]); obj->getRange(range, type, var, 2); sRange += QString("[%1,%2]").arg(range[0]).arg(range[1]); - } - else return; + } else + return; _ui->tableWidget->setItem(row, 3, new QTableWidgetItem(sRange)); - }; - if (index == -1) - { + if(index == -1) { _ui->FileNameValue->setText(obj->getName()); _ui->TypeValue->setText(getRenderDataObjectType(obj)); _ui->PointNumValue->setText(QString::number(obj->getPointDataNum())); @@ -144,35 +154,33 @@ namespace Post QStringList PointData; QStringList CellData; - PointData = obj->getPointDataArray(); - CellData = obj->getCellDataArray(); + PointData = obj->getPointDataArray(); + CellData = obj->getCellDataArray(); int Rowcount = PointData.size() + CellData.size(); _ui->tableWidget->setRowCount(Rowcount); - - - for (int i = 0; i < PointData.size(); i++) - { + for(int i = 0; i < PointData.size(); i++) { double range[2]{ 0 }; obj->getRange(range, 1, PointData[i], -1); _ui->tableWidget->setItem(i, 0, new QTableWidgetItem(tr("PointProperty"))); _ui->tableWidget->setItem(i, 1, new QTableWidgetItem(PointData[i])); - _ui->tableWidget->setItem(i, 2, new QTableWidgetItem(QString::number(obj->variableType(1, PointData[i])))); - // qDebug() << obj->variableType(1, PointData[i]); + _ui->tableWidget->setItem(i, 2, + new QTableWidgetItem(obj->variableType(1, PointData[i]))); + // qDebug() << obj->variableType(1, PointData[i]); setRangeItem(i, 1, PointData[i]); } - for (int j = 0; j < CellData.size(); j++) - { - _ui->tableWidget->setItem(PointData.size() + j, 0, new QTableWidgetItem(tr("CellProperty"))); - _ui->tableWidget->setItem(PointData.size() + j, 1, new QTableWidgetItem(CellData[j])); - _ui->tableWidget->setItem(PointData.size() + j, 2, new QTableWidgetItem(QString::number(obj->variableType(2, CellData[j])))); + for(int j = 0; j < CellData.size(); j++) { + _ui->tableWidget->setItem(PointData.size() + j, 0, + new QTableWidgetItem(tr("CellProperty"))); + _ui->tableWidget->setItem(PointData.size() + j, 1, + new QTableWidgetItem(CellData[j])); + _ui->tableWidget->setItem(PointData.size() + j, 2, + new QTableWidgetItem(obj->variableType(2, CellData[j]))); setRangeItem(PointData.size() + j, 2, CellData[j]); } - } - else - { + } else { _ui->FileNameValue->setText(obj->getBlockName(index)); _ui->TypeValue->setText(getRenderDataObjectType(obj)); _ui->PointNumValue->setText(QString::number(obj->getNumberOfBlockPoints(index + 1))); @@ -180,105 +188,111 @@ namespace Post QStringList PointData; QStringList CellData; - PointData = obj->getBlockPointDataArray(index + 1); - CellData = obj->getBlockCellDataArray(index + 1); + PointData = obj->getBlockPointDataArray(index + 1); + CellData = obj->getBlockCellDataArray(index + 1); int Rowcount = PointData.size() + CellData.size(); _ui->tableWidget->setRowCount(Rowcount); - for (int i = 0; i < PointData.size(); i++) - { + for(int i = 0; i < PointData.size(); i++) { double range[2]{ 0 }; obj->getRange(range, 1, PointData[i], -1); _ui->tableWidget->setItem(i, 0, new QTableWidgetItem(tr("PointProperty"))); _ui->tableWidget->setItem(i, 1, new QTableWidgetItem(PointData[i])); - _ui->tableWidget->setItem(i, 2, new QTableWidgetItem(QString::number(obj->variableType(1, PointData[i])))); + _ui->tableWidget->setItem(i, 2, + new QTableWidgetItem(obj->variableType(1, PointData[i]))); // qDebug() << obj->variableType(1, PointData[i]); setRangeItem(i, 1, PointData[i]); } - for (int j = 0; j < CellData.size(); j++) - { - _ui->tableWidget->setItem(PointData.size() + j, 0, new QTableWidgetItem(tr("CellProperty"))); - _ui->tableWidget->setItem(PointData.size() + j, 1, new QTableWidgetItem(CellData[j])); - _ui->tableWidget->setItem(PointData.size() + j, 2, new QTableWidgetItem(QString::number(obj->variableType(2, CellData[j])))); + for(int j = 0; j < CellData.size(); j++) { + _ui->tableWidget->setItem(PointData.size() + j, 0, + new QTableWidgetItem(tr("CellProperty"))); + _ui->tableWidget->setItem(PointData.size() + j, 1, + new QTableWidgetItem(CellData[j])); + _ui->tableWidget->setItem(PointData.size() + j, 2, + new QTableWidgetItem(obj->variableType(2, CellData[j]))); setRangeItem(PointData.size() + j, 2, CellData[j]); } } -// if(item->childCount() > 0) -// { -// -// -// // int idBlock = item->data(1, Qt::UserRole).toInt(&ok); -// -// _ui->FileNameValue->setText(obj->getName()); -// _ui->TypeValue->setText(enumToString(obj->getDataType())); -// _ui->PointNumValue->setText(QString::number(obj->getPointDataNum())); -// _ui->CellNumValue->setText(QString::number(obj->getCellDataNum())); -// -// QStringList PointData; -// QStringList CellData; -// PointData = obj->getPointDataArray(); -// CellData = obj->getCellDataArray(); -// -// int Rowcount = PointData.size()+CellData.size(); -// _ui->tableWidget->setRowCount(Rowcount); -// -// for(int i=0; itableWidget->setItem(i,0,new QTableWidgetItem("PointProperty")); -// _ui->tableWidget->setItem(i,1,new QTableWidgetItem(PointData[i])); -// _ui->tableWidget->setItem(i,2,new QTableWidgetItem(QString::number(obj->variableType(1,PointData[i])))); -// qDebug()<variableType(1,PointData[i]); -// -// } -// for(int j=0; jtableWidget->setItem(PointData.size()+j,0,new QTableWidgetItem("CellProperty")); -// _ui->tableWidget->setItem(PointData.size()+j,1,new QTableWidgetItem(CellData[j])); -// _ui->tableWidget->setItem(PointData.size()+j,2,new QTableWidgetItem(QString::number(obj->variableType(2,CellData[j])))); -// } -// } -// -// if(item->childCount() == 0) -// { -// _ui->FileNameValue->setText(obj->getBlockName(item->parent()->indexOfChild(item))); -// _ui->TypeValue->setText(""); -// _ui->PointNumValue->setText(QString::number(obj->getNumberOfBlockPoints(item->parent()->indexOfChild(item)+1))); -// _ui->CellNumValue->setText(QString::number(obj->getNumberOfBlockCells(item->parent()->indexOfChild(item)+1))); -// -// QStringList PointData; -// QStringList CellData; -// PointData = obj->getPointDataArray(); -// CellData = obj->getCellDataArray(); -// -// int Rowcount = PointData.size()+CellData.size(); -// _ui->tableWidget->setRowCount(Rowcount); -// -// for(int i=0; itableWidget->setItem(i,0,new QTableWidgetItem("PointProperty")); -// _ui->tableWidget->setItem(i,1,new QTableWidgetItem(PointData[i])); -// _ui->tableWidget->setItem(i,2,new QTableWidgetItem(QString::number(obj->variableType(1,PointData[i])))); -// qDebug()<variableType(1,PointData[i]); -// -// } -// for(int j=0; jtableWidget->setItem(PointData.size()+j,0,new QTableWidgetItem("CellProperty")); -// _ui->tableWidget->setItem(PointData.size()+j,1,new QTableWidgetItem(CellData[j])); -// _ui->tableWidget->setItem(PointData.size()+j,2,new QTableWidgetItem(QString::number(obj->variableType(2,CellData[j])))); -// } -// -// -// } - - } - - -} - + // if(item->childCount() > 0) + // { + // + // + // // int idBlock = item->data(1, Qt::UserRole).toInt(&ok); + // + // _ui->FileNameValue->setText(obj->getName()); + // _ui->TypeValue->setText(enumToString(obj->getDataType())); + // _ui->PointNumValue->setText(QString::number(obj->getPointDataNum())); + // _ui->CellNumValue->setText(QString::number(obj->getCellDataNum())); + // + // QStringList PointData; + // QStringList CellData; + // PointData = obj->getPointDataArray(); + // CellData = obj->getCellDataArray(); + // + // int Rowcount = PointData.size()+CellData.size(); + // _ui->tableWidget->setRowCount(Rowcount); + // + // for(int i=0; itableWidget->setItem(i,0,new QTableWidgetItem("PointProperty")); + // _ui->tableWidget->setItem(i,1,new QTableWidgetItem(PointData[i])); + // _ui->tableWidget->setItem(i,2,new + // QTableWidgetItem(QString::number(obj->variableType(1,PointData[i])))); + // qDebug()<variableType(1,PointData[i]); + // + // } + // for(int j=0; jtableWidget->setItem(PointData.size()+j,0,new + // QTableWidgetItem("CellProperty")); + // _ui->tableWidget->setItem(PointData.size()+j,1,new + // QTableWidgetItem(CellData[j])); + // _ui->tableWidget->setItem(PointData.size()+j,2,new + // QTableWidgetItem(QString::number(obj->variableType(2,CellData[j])))); + // } + // } + // + // if(item->childCount() == 0) + // { + // _ui->FileNameValue->setText(obj->getBlockName(item->parent()->indexOfChild(item))); + // _ui->TypeValue->setText(""); + // _ui->PointNumValue->setText(QString::number(obj->getNumberOfBlockPoints(item->parent()->indexOfChild(item)+1))); + // _ui->CellNumValue->setText(QString::number(obj->getNumberOfBlockCells(item->parent()->indexOfChild(item)+1))); + // + // QStringList PointData; + // QStringList CellData; + // PointData = obj->getPointDataArray(); + // CellData = obj->getCellDataArray(); + // + // int Rowcount = PointData.size()+CellData.size(); + // _ui->tableWidget->setRowCount(Rowcount); + // + // for(int i=0; itableWidget->setItem(i,0,new QTableWidgetItem("PointProperty")); + // _ui->tableWidget->setItem(i,1,new QTableWidgetItem(PointData[i])); + // _ui->tableWidget->setItem(i,2,new + // QTableWidgetItem(QString::number(obj->variableType(1,PointData[i])))); + // qDebug()<variableType(1,PointData[i]); + // + // } + // for(int j=0; jtableWidget->setItem(PointData.size()+j,0,new + // QTableWidgetItem("CellProperty")); + // _ui->tableWidget->setItem(PointData.size()+j,1,new + // QTableWidgetItem(CellData[j])); + // _ui->tableWidget->setItem(PointData.size()+j,2,new + // QTableWidgetItem(QString::number(obj->variableType(2,CellData[j])))); + // } + // + // + // } + } +} // namespace Post diff --git a/src/PostInterface/PostProcessPy.cpp b/src/PostInterface/PostProcessPy.cpp index 08fe78b..d8d303c 100644 --- a/src/PostInterface/PostProcessPy.cpp +++ b/src/PostInterface/PostProcessPy.cpp @@ -17,7 +17,6 @@ #include "PostRenderData/StreamLineRenderDataAlg.h" #include "PostRenderData/CalculateRenderDataAlg.h" #include "PostRenderData/ReflectionRenderDataAlg.h" -#include "MainWindow/MainWindow.h" namespace Post { @@ -57,16 +56,19 @@ namespace Post { RenderDataObject *dataObj = nullptr; if (FileDirectoryDialog::isGourpFiles(file)) - dataObj = new RenderDataImportUnSteady(file); + { + dataObj = new RenderDataImportUnSteady(file); + } else - dataObj = new RenderDataImportSteady(file); - + { + dataObj = new RenderDataImportSteady(file); + } dataObj->update(); auto dataset = dataObj->getOutputData(); RenderDataManager::getInstance()->appendRenderObjectList(dataObj); - // RenderDirector::getInstance()->renderDataObjectToWindow(dataObj, wID); + // RenderDirector::getInstance()->renderDataObjectToWindow(dataObj, wID); emit _director->signal_renderDataObject(dataObj, wID); _tree->updatePostTree(); // emit _mainWindow->updatePostTreeSig(); diff --git a/src/PostInterface/RenderDirector.h b/src/PostInterface/RenderDirector.h index e9c609d..eaafadf 100644 --- a/src/PostInterface/RenderDirector.h +++ b/src/PostInterface/RenderDirector.h @@ -15,7 +15,7 @@ namespace Post { { Q_OBJECT - Singleton(RenderDirector) + Singleton(RenderDirector) signals: void signal_renderDataObject(RenderDataObject* obj,int wID); @@ -55,4 +55,4 @@ namespace Post { -#endif \ No newline at end of file +#endif diff --git a/src/PostRenderData/RenderDataImportSteady.cpp b/src/PostRenderData/RenderDataImportSteady.cpp index b01c34a..f49730e 100644 --- a/src/PostRenderData/RenderDataImportSteady.cpp +++ b/src/PostRenderData/RenderDataImportSteady.cpp @@ -18,6 +18,8 @@ #include #include #include +#include +#include namespace Post { @@ -97,6 +99,26 @@ namespace Post mapper->SetInputConnection(_vtkAlg->GetOutputPort(i + 1)); } } + else if (_Suffix == "vtu") + { + CreateVTKSmartPtr(vtkXMLUnstructuredGridReader, _vtkAlg) auto r = vtkXMLUnstructuredGridReader::SafeDownCast(_vtkAlg); + QString2Char(_FileName, c); + r->SetFileName(c); + r->Update(); + _blockNumber = 1; + auto mapper = createMapper(true); + mapper->SetInputConnection(_vtkAlg->GetOutputPort(0)); + } + else if (_Suffix == "pvtu") + { + CreateVTKSmartPtr(vtkXMLPUnstructuredGridReader, _vtkAlg) auto r = vtkXMLPUnstructuredGridReader::SafeDownCast(_vtkAlg); + QString2Char(_FileName, c); + r->SetFileName(c); + r->Update(); + _blockNumber = 1; + auto mapper = createMapper(true); + mapper->SetInputConnection(_vtkAlg->GetOutputPort(0)); + } } RenderDataImportSteady *RenderDataImportSteady::SafeDownCast(RenderDataObject *obj) @@ -144,4 +166,4 @@ namespace Post ac->SetVisibility(vis); } -} \ No newline at end of file +} diff --git a/src/PostRenderData/RenderDataImportUnSteady.cpp b/src/PostRenderData/RenderDataImportUnSteady.cpp index 76a4295..56472d1 100644 --- a/src/PostRenderData/RenderDataImportUnSteady.cpp +++ b/src/PostRenderData/RenderDataImportUnSteady.cpp @@ -5,6 +5,8 @@ #include "PostAlgorithm/CGNSReaderAlgorithm.h" #include "PostAlgorithm/Plot3DReaderAlgorithm.h" #include "Macros.hxx" +#include +#include namespace Post { QStringList getSelectGroupFiles(const QString path) @@ -124,8 +126,27 @@ namespace Post { auto mapper = createMapper(true); mapper->SetInputConnection(_vtkAlg->GetOutputPort(i + 1)); } - - } + } + else if (Suffix == "vtu") + { + CreateVTKSmartPtr(vtkXMLUnstructuredGridReader, _vtkAlg) + auto r = vtkXMLUnstructuredGridReader::SafeDownCast(_vtkAlg); + QString2Char(fileName, c) + r->SetFileName(c); + _blockNumber = 1; + auto mapper = createMapper(true); + mapper->SetInputConnection(_vtkAlg->GetOutputPort(0)); + } + else if (Suffix == "pvtu") + { + CreateVTKSmartPtr(vtkXMLPUnstructuredGridReader, _vtkAlg) + auto r = vtkXMLPUnstructuredGridReader::SafeDownCast(_vtkAlg); + QString2Char(fileName, c) + r->SetFileName(c); + _blockNumber = 1; + auto mapper = createMapper(true); + mapper->SetInputConnection(_vtkAlg->GetOutputPort(0)); + } } void RenderDataImportUnSteady::ReadFile() @@ -148,7 +169,19 @@ namespace Post { auto r = Plot3DReaderAlgorithm::SafeDownCast(_vtkAlg); QString2Char(f, c); r->SetFileName(c); - } + } + else if (this->getSuffix() == "vtu") + { + auto r = vtkXMLUnstructuredGridReader::SafeDownCast(_vtkAlg); + QString2Char(f, c); + r->SetFileName(c); + } + else if (this->getSuffix() == "pvtu") + { + auto r = vtkXMLPUnstructuredGridReader::SafeDownCast(_vtkAlg); + QString2Char(f, c); + r->SetFileName(c); + } } RenderDataImportUnSteady::~RenderDataImportUnSteady() @@ -166,4 +199,4 @@ namespace Post { _CurrentIndex = index; this->ReadFile(); } -} \ No newline at end of file +} diff --git a/src/PostRenderData/RenderDataObject.cpp b/src/PostRenderData/RenderDataObject.cpp index 19ca047..66c78f2 100644 --- a/src/PostRenderData/RenderDataObject.cpp +++ b/src/PostRenderData/RenderDataObject.cpp @@ -201,9 +201,9 @@ QStringList RenderDataObject::getBlockCellDataArray(int index) return nameList; } -int RenderDataObject::variableType(int vaLocation, QString vaName) +QString RenderDataObject::variableType(int vaLocation, QString vaName) { - int type = 0; + QString type = "Unknown"; vtkDataSet* data = getOutputData(); if (data == nullptr) return 0; QString2Char(vaName, cName) @@ -215,11 +215,11 @@ int RenderDataObject::variableType(int vaLocation, QString vaName) if (dataArray == nullptr) return 0; const int cNum = dataArray->GetNumberOfComponents(); if (cNum == 1) - type = 1; + type = "scalar"; else if (cNum == 3) - type = 2; - else if (cNum >= 4) - type = 3; + type = "vector"; + else if (cNum == 9) + type = "tensor"; return type; } diff --git a/src/PostRenderData/RenderDataObject.h b/src/PostRenderData/RenderDataObject.h index 39c696d..cab1d40 100644 --- a/src/PostRenderData/RenderDataObject.h +++ b/src/PostRenderData/RenderDataObject.h @@ -120,9 +120,10 @@ namespace Post { * @brief 获取变量类型 * @param vaLocation 变量所在位置 1-pointData 2-cellData * @param vaName 变量名称 - * @return int 变量类型 1-标量 2-矢量 3-张量 0-错误值 + * @return QString 变量类型:scalar\vector\tensor\Unknown + * @note 在vtk中通过分量数量判断数据类型并不是十分准确 */ - int variableType(int vaLocation, QString vaName); + QString variableType(int vaLocation, QString vaName); /** * @brief 获取变量成员数量 * @param vaLocation 变量所在位置 1-pointData 2-cellData diff --git a/src/PythonModule/CMakeLists.txt b/src/PythonModule/CMakeLists.txt index 8d162f2..b26d038 100644 --- a/src/PythonModule/CMakeLists.txt +++ b/src/PythonModule/CMakeLists.txt @@ -27,6 +27,8 @@ add_library(PythonModule #----------------------------------------------------------------------------- target_compile_definitions(PythonModule PRIVATE "PYTHONMODULE_API") +list(APPEND _depend_library Common) + list(APPEND _runtimes_libraries Qt5::Widgets FASTCAE::PYTHON ) @@ -39,7 +41,14 @@ endif() #----------------------------------------------------------------------------- # 链接依赖库 #----------------------------------------------------------------------------- -target_link_libraries(PythonModule ${_runtimes_libraries}) +target_link_libraries(PythonModule + ${_runtimes_libraries} + ${_depend_library}) + +#----------------------------------------------------------------------------- +# 添加依赖关系 +#----------------------------------------------------------------------------- +add_dependencies(PythonModule ${_depend_library}) #----------------------------------------------------------------------------- # 添加运行时依赖关系 diff --git a/src/PythonModule/PyAgent.cpp b/src/PythonModule/PyAgent.cpp index 88ff863..d9d54e3 100644 --- a/src/PythonModule/PyAgent.cpp +++ b/src/PythonModule/PyAgent.cpp @@ -1,17 +1,16 @@ #include -#include "PyAgent.h" -#include #include #include #include +#include +#include +#include +#include +#include "PyAgent.h" #include "MainWindow/MainWindow.h" #include "PyInterpreter.h" #include "RecordScript.h" #include "ScriptReader.h" -#include -#include -#include -#include #ifdef Q_OS_WIN32 #include @@ -19,13 +18,12 @@ #include -namespace Py -{ - PythonAgent *PythonAgent::_instance = nullptr; +namespace Py { + PythonAgent* PythonAgent::_instance = nullptr; - PythonAgent *PythonAgent::getInstance() + PythonAgent* PythonAgent::getInstance() { - if (_instance == nullptr) + if(_instance == nullptr) _instance = new PythonAgent; return _instance; @@ -33,13 +31,14 @@ namespace Py void PythonAgent::connectSignals() { - connect(this, SIGNAL(printInfo(Common::Message, QString)), _mainWindow, SIGNAL(printMessageSig(Common::Message, QString))); + connect(this, SIGNAL(printInfo(Common::Message, QString)), _mainWindow, + SIGNAL(printMessageSig(Common::Message, QString))); connect(this, SIGNAL(closeMainWindow()), _mainWindow, SIGNAL(closeMainWindow())); } void PythonAgent::appCodeList(QString code) { - if (!_append) + if(!_append) return; emit printInfo(Common::Message::Python, code); _interpreter->codeListAppend(code); @@ -50,40 +49,13 @@ namespace Py _interpreter = new PyInterpreter; } - void PythonAgent::initialize(GUI::MainWindow *m) + void PythonAgent::initialize(GUI::MainWindow* m) { _mainWindow = m; connectSignals(); - /* - QString path = qApp->applicationDirPath() + "/../python37"; - path = QDir::cleanPath(path); - char *ch; - QByteArray ba = path.toLocal8Bit(); - ch = ba.data(); - wchar_t *wc; - - #ifdef Q_OS_WIN32 - USES_CONVERSION; - wc = A2W(ch); - #endif - - #ifdef Q_OS_LINUX - setlocale(LC_CTYPE, "zh_CN.utf8"); - int w_size = mbstowcs(NULL, ba, 0) + 1; - wc = new wchar_t[w_size]; - mbstowcs(wc, ba, strlen(ba) + 1); - #endif - - QDir d(path); - if (d.exists()) - { - #ifdef Q_OS_WIN32 - Py_SetPythonHome(wc); - #endif - }*/ Py_SetProgramName(L"FastCAE"); Py_Initialize(); - if (!_interpreter->init(this)) + if(!_interpreter->init(this)) emit printInfo(Common::Message::Error, tr("Python Initialize failed!")); else emit printInfo(Common::Message::Normal, tr("Python Initialized")); @@ -93,15 +65,13 @@ namespace Py void PythonAgent::finalize() { - if (_reader != nullptr) - { - if (_reader->isRunning()) - { + if(_reader != nullptr) { + if(_reader->isRunning()) { _reader->stop(); _reader->quit(); _reader->wait(); } - while (_reader->isRunning()) + while(_reader->isRunning()) ; delete _reader; _reader = nullptr; @@ -112,23 +82,20 @@ namespace Py _recordScript->wait(); delete _recordScript; - if (_interpreter != nullptr) + if(_interpreter != nullptr) delete _interpreter; - if (Py_IsInitialized()) + if(Py_IsInitialized()) Py_Finalize(); } void PythonAgent::submit(QString code, bool s) { - // this->lock(); - qDebug() << "submit: " << code; emit printInfo(Common::Message::Python, code); // lock(); - int ok = _interpreter->execCode(code, s); - if (ok == -1) - { - if (_reader != nullptr) + int ok = _interpreter->execCode(code, s); + if(ok == -1) { + if(_reader != nullptr) _reader->restart(); } } @@ -136,8 +103,7 @@ namespace Py void PythonAgent::submit(QStringList codes, bool save /*= true*/) { const int n = codes.size(); - for (int i = 0; i < n; ++i) - { + for(int i = 0; i < n; ++i) { this->submit(codes.at(i), save); } } @@ -145,15 +111,13 @@ namespace Py void PythonAgent::saveScript(QString fileName) { QFile file(fileName); - if (!file.open(QIODevice::Text | QIODevice::WriteOnly)) - { + if(!file.open(QIODevice::Text | QIODevice::WriteOnly)) { emit printInfo(Common::Message::Error, tr("Script open failed")); return; } QTextStream stream(&file); - const int n = _interpreter->getCodeCount(); - for (int i = 0; i < n; ++i) - { + const int n = _interpreter->getCodeCount(); + for(int i = 0; i < n; ++i) { QString s = _interpreter->getCodeAt(i); stream << s << endl; } @@ -163,7 +127,7 @@ namespace Py bool PythonAgent::execScript(QString fileName) { - if (_reader != nullptr) + if(_reader != nullptr) return false; _reader = new ScriptReader(fileName, this); _recordScript->pause(); @@ -174,23 +138,23 @@ namespace Py void PythonAgent::readerFinished() { - if (_reader != nullptr) + if(_reader != nullptr) delete _reader; _reader = nullptr; _recordScript->reStart(); - if (_noGUI) + if(_noGUI) emit closeMainWindow(); } void PythonAgent::lock() { - if (_reader != nullptr) + if(_reader != nullptr) _reader->pause(); } void PythonAgent::unLock() { - if (_reader != nullptr) + if(_reader != nullptr) _reader->restart(); } @@ -201,7 +165,7 @@ namespace Py QStringList PythonAgent::getcodelist() { - if (_interpreter != nullptr) + if(_interpreter != nullptr) return _interpreter->getCode(); return QStringList(); } @@ -229,4 +193,4 @@ namespace Py { _interpreter->execCode(code, false); } -} \ No newline at end of file +} // namespace Py \ No newline at end of file diff --git a/src/PythonModule/PyInterpreter.cpp b/src/PythonModule/PyInterpreter.cpp index 2b00b65..2ccb343 100644 --- a/src/PythonModule/PyInterpreter.cpp +++ b/src/PythonModule/PyInterpreter.cpp @@ -8,14 +8,13 @@ #include #include #include "Common/Types.h" +#include "Common/DebugLogger.h" -namespace Py -{ +namespace Py { - bool PyInterpreter::init(PythonAgent *agent) + bool PyInterpreter::init(PythonAgent* agent) { - if (!Py_IsInitialized()) - { + if(!Py_IsInitialized()) { return false; } _agent = agent; @@ -23,19 +22,18 @@ namespace Py this->execCode("import sys", false); this->execCode("import os", false); QString path = QDir::cleanPath(qApp->applicationDirPath()); - QString qs = QString("sys.path.append(\"%1\")").arg(path); + QString qs = QString("sys.path.append(\"%1\")").arg(path); this->execCode(qs, false); - QDir dir(path); + QDir dir(path); QStringList suffix; suffix << "*.py"; dir.setNameFilters(suffix); QList files = dir.entryInfoList(suffix); - for (int i = 0; i < files.size(); ++i) - { + for(int i = 0; i < files.size(); ++i) { QFileInfo fileinfo = files.at(i); - QString name = fileinfo.baseName(); - QString command = QString("import %1").arg(name); + QString name = fileinfo.baseName(); + QString command = QString("import %1").arg(name); this->execCode(command, false); } @@ -47,18 +45,18 @@ namespace Py QReadWriteLock lock; lock.lockForRead(); std::string s = code.toStdString(); - const char *c = s.c_str(); - qDebug() << "exec: " << code; + const char* c = s.c_str(); + + DebugInfo("Exec python script: %s\n", code.toStdString().c_str()); int ok = PyRun_SimpleStringFlags(c, NULL); - if (ok == -1) - { + if(ok == -1) { QString error = QString(tr("Exception occurred at: \"%1\"")).arg(code); _agent->printInfo(Common::Message::Warning, error); } - if (save) + if(save) _codelist.append(code); lock.unlock(); return ok; @@ -67,10 +65,10 @@ namespace Py void PyInterpreter::execFile(QString file) { QByteArray la = file.toLocal8Bit(); - char *c = la.data(); - FILE *fp = nullptr; - fp = fopen(c, "r"); - if (fp != nullptr) + char* c = la.data(); + FILE* fp = nullptr; + fp = fopen(c, "r"); + if(fp != nullptr) PyRun_SimpleFile(fp, c); } @@ -82,7 +80,7 @@ namespace Py QString PyInterpreter::getCodeAt(int i) { QString c; - if (i >= 0 && i < _codelist.size()) + if(i >= 0 && i < _codelist.size()) c = _codelist.at(i); return c; } @@ -96,4 +94,4 @@ namespace Py { return _codelist; } -} \ No newline at end of file +} // namespace Py \ No newline at end of file diff --git a/src/SARibbonBar/SARibbonMainWindow.cpp b/src/SARibbonBar/SARibbonMainWindow.cpp index a3ed8cf..3d93119 100644 --- a/src/SARibbonBar/SARibbonMainWindow.cpp +++ b/src/SARibbonBar/SARibbonMainWindow.cpp @@ -47,7 +47,6 @@ SARibbonMainWindow::SARibbonMainWindow(QWidget *parent, bool useRibbon) { m_d->init(); m_d->useRibbon = useRibbon; - qDebug() << windowFlags(); if (useRibbon) { qDebug() << "sa ribbon version:" << SA_RIBBON_BAR_VERSION_STR; setRibbonTheme(ribbonTheme()); diff --git a/src/qrc/Hello.png b/src/qrc/Hello.png index 1eb06d9..13e02cd 100644 Binary files a/src/qrc/Hello.png and b/src/qrc/Hello.png differ diff --git a/src/qrc/QUI/beauty/Sticker_Star.png b/src/qrc/QUI/beauty/Sticker_Star.png index 17e2ae7..211ca50 100644 Binary files a/src/qrc/QUI/beauty/Sticker_Star.png and b/src/qrc/QUI/beauty/Sticker_Star.png differ diff --git a/src/qrc/QUI/beauty/btn_close.png b/src/qrc/QUI/beauty/btn_close.png index efce47d..6a48bfe 100644 Binary files a/src/qrc/QUI/beauty/btn_close.png and b/src/qrc/QUI/beauty/btn_close.png differ diff --git a/src/qrc/QUI/beauty/btn_max.png b/src/qrc/QUI/beauty/btn_max.png index 40b96e0..d0a6ea8 100644 Binary files a/src/qrc/QUI/beauty/btn_max.png and b/src/qrc/QUI/beauty/btn_max.png differ diff --git a/src/qrc/QUI/beauty/btn_min.png b/src/qrc/QUI/beauty/btn_min.png index 982dba6..8b7e7b3 100644 Binary files a/src/qrc/QUI/beauty/btn_min.png and b/src/qrc/QUI/beauty/btn_min.png differ diff --git a/src/qrc/QUI/beauty/btn_normal.png b/src/qrc/QUI/beauty/btn_normal.png index 9ead00a..46691f2 100644 Binary files a/src/qrc/QUI/beauty/btn_normal.png and b/src/qrc/QUI/beauty/btn_normal.png differ diff --git a/src/qrc/QUI/beauty/checked.png b/src/qrc/QUI/beauty/checked.png index d87975d..2f9e0cf 100644 Binary files a/src/qrc/QUI/beauty/checked.png and b/src/qrc/QUI/beauty/checked.png differ diff --git a/src/qrc/QUI/beauty/close_normal.png b/src/qrc/QUI/beauty/close_normal.png index 37f70dd..5f6b0b5 100644 Binary files a/src/qrc/QUI/beauty/close_normal.png and b/src/qrc/QUI/beauty/close_normal.png differ diff --git a/src/qrc/QUI/beauty/close_pressed.png b/src/qrc/QUI/beauty/close_pressed.png index b020cf2..f4a811e 100644 Binary files a/src/qrc/QUI/beauty/close_pressed.png and b/src/qrc/QUI/beauty/close_pressed.png differ diff --git a/src/qrc/QUI/beauty/dock_title.png b/src/qrc/QUI/beauty/dock_title.png index 5836e2c..4945c3c 100644 Binary files a/src/qrc/QUI/beauty/dock_title.png and b/src/qrc/QUI/beauty/dock_title.png differ diff --git a/src/qrc/QUI/beauty/max_normal.png b/src/qrc/QUI/beauty/max_normal.png index 9b1d2ea..06efb36 100644 Binary files a/src/qrc/QUI/beauty/max_normal.png and b/src/qrc/QUI/beauty/max_normal.png differ diff --git a/src/qrc/QUI/beauty/max_pressed.png b/src/qrc/QUI/beauty/max_pressed.png index 8e658e7..dd23b02 100644 Binary files a/src/qrc/QUI/beauty/max_pressed.png and b/src/qrc/QUI/beauty/max_pressed.png differ diff --git a/src/qrc/QUI/beauty/min_normal.png b/src/qrc/QUI/beauty/min_normal.png index 0327897..5ea0848 100644 Binary files a/src/qrc/QUI/beauty/min_normal.png and b/src/qrc/QUI/beauty/min_normal.png differ diff --git a/src/qrc/QUI/beauty/min_pressed.png b/src/qrc/QUI/beauty/min_pressed.png index 458f103..5773247 100644 Binary files a/src/qrc/QUI/beauty/min_pressed.png and b/src/qrc/QUI/beauty/min_pressed.png differ diff --git a/src/qrc/QUI/beauty/radio_selected.png b/src/qrc/QUI/beauty/radio_selected.png index f8341fe..256af4e 100644 Binary files a/src/qrc/QUI/beauty/radio_selected.png and b/src/qrc/QUI/beauty/radio_selected.png differ diff --git a/src/qrc/QUI/beauty/radio_unselected.png b/src/qrc/QUI/beauty/radio_unselected.png index 5df5420..0aa1e03 100644 Binary files a/src/qrc/QUI/beauty/radio_unselected.png and b/src/qrc/QUI/beauty/radio_unselected.png differ diff --git a/src/qrc/QUI/beauty/restore_normal.png b/src/qrc/QUI/beauty/restore_normal.png index 6a6d5d1..f00626f 100644 Binary files a/src/qrc/QUI/beauty/restore_normal.png and b/src/qrc/QUI/beauty/restore_normal.png differ diff --git a/src/qrc/QUI/beauty/restore_pressed.png b/src/qrc/QUI/beauty/restore_pressed.png index c894432..c9baef9 100644 Binary files a/src/qrc/QUI/beauty/restore_pressed.png and b/src/qrc/QUI/beauty/restore_pressed.png differ diff --git a/src/qrc/QUI/beauty/toolbar_bk.png b/src/qrc/QUI/beauty/toolbar_bk.png index ef7679e..7ad9485 100644 Binary files a/src/qrc/QUI/beauty/toolbar_bk.png and b/src/qrc/QUI/beauty/toolbar_bk.png differ diff --git a/src/qrc/QUI/beauty/tree_expand.png b/src/qrc/QUI/beauty/tree_expand.png index a5af24f..42edb87 100644 Binary files a/src/qrc/QUI/beauty/tree_expand.png and b/src/qrc/QUI/beauty/tree_expand.png differ diff --git a/src/qrc/QUI/beauty/tree_item_checked.png b/src/qrc/QUI/beauty/tree_item_checked.png index 8a90002..0f6099c 100644 Binary files a/src/qrc/QUI/beauty/tree_item_checked.png and b/src/qrc/QUI/beauty/tree_item_checked.png differ diff --git a/src/qrc/QUI/beauty/tree_item_unchecked.png b/src/qrc/QUI/beauty/tree_item_unchecked.png index 043e6ea..c4e1cf9 100644 Binary files a/src/qrc/QUI/beauty/tree_item_unchecked.png and b/src/qrc/QUI/beauty/tree_item_unchecked.png differ diff --git a/src/qrc/QUI/beauty/tree_normal.png b/src/qrc/QUI/beauty/tree_normal.png index fd0a119..082a9f2 100644 Binary files a/src/qrc/QUI/beauty/tree_normal.png and b/src/qrc/QUI/beauty/tree_normal.png differ diff --git a/src/qrc/QUI/geometry/add.png b/src/qrc/QUI/geometry/add.png index 7018861..7d09ab8 100644 Binary files a/src/qrc/QUI/geometry/add.png and b/src/qrc/QUI/geometry/add.png differ diff --git a/src/qrc/QUI/icon/FastCAEFrame.png b/src/qrc/QUI/icon/FastCAEFrame.png index d0f34a0..a0a8187 100644 Binary files a/src/qrc/QUI/icon/FastCAEFrame.png and b/src/qrc/QUI/icon/FastCAEFrame.png differ diff --git a/src/qrc/QUI/icon/Plugin_ava.png b/src/qrc/QUI/icon/Plugin_ava.png index ae98c33..d5d4c11 100644 Binary files a/src/qrc/QUI/icon/Plugin_ava.png and b/src/qrc/QUI/icon/Plugin_ava.png differ diff --git a/src/qrc/QUI/icon/Plugin_ins.png b/src/qrc/QUI/icon/Plugin_ins.png index 75a4d5e..c28f3a9 100644 Binary files a/src/qrc/QUI/icon/Plugin_ins.png and b/src/qrc/QUI/icon/Plugin_ins.png differ diff --git a/src/qrc/QUI/icon/about_us.png b/src/qrc/QUI/icon/about_us.png index 8175868..ea1bc71 100644 Binary files a/src/qrc/QUI/icon/about_us.png and b/src/qrc/QUI/icon/about_us.png differ diff --git a/src/qrc/QUI/icon/acce.png b/src/qrc/QUI/icon/acce.png index 732d361..8024673 100644 Binary files a/src/qrc/QUI/icon/acce.png and b/src/qrc/QUI/icon/acce.png differ diff --git a/src/qrc/QUI/icon/angle.png b/src/qrc/QUI/icon/angle.png index d90ad78..22b9d60 100644 Binary files a/src/qrc/QUI/icon/angle.png and b/src/qrc/QUI/icon/angle.png differ diff --git a/src/qrc/QUI/icon/bc.png b/src/qrc/QUI/icon/bc.png index c826fda..2ea27b0 100644 Binary files a/src/qrc/QUI/icon/bc.png and b/src/qrc/QUI/icon/bc.png differ diff --git a/src/qrc/QUI/icon/boxCell.png b/src/qrc/QUI/icon/boxCell.png index 8c089f8..8729a06 100644 Binary files a/src/qrc/QUI/icon/boxCell.png and b/src/qrc/QUI/icon/boxCell.png differ diff --git a/src/qrc/QUI/icon/boxNode.png b/src/qrc/QUI/icon/boxNode.png index dca6fd5..1ba51d9 100644 Binary files a/src/qrc/QUI/icon/boxNode.png and b/src/qrc/QUI/icon/boxNode.png differ diff --git a/src/qrc/QUI/icon/chinese_language.png b/src/qrc/QUI/icon/chinese_language.png index d05da2a..fa6adfc 100644 Binary files a/src/qrc/QUI/icon/chinese_language.png and b/src/qrc/QUI/icon/chinese_language.png differ diff --git a/src/qrc/QUI/icon/counter.png b/src/qrc/QUI/icon/counter.png index 121731c..528a4fe 100644 Binary files a/src/qrc/QUI/icon/counter.png and b/src/qrc/QUI/icon/counter.png differ diff --git a/src/qrc/QUI/icon/createNew.png b/src/qrc/QUI/icon/createNew.png index 58f56d4..a26c123 100644 Binary files a/src/qrc/QUI/icon/createNew.png and b/src/qrc/QUI/icon/createNew.png differ diff --git a/src/qrc/QUI/icon/createSet.png b/src/qrc/QUI/icon/createSet.png index 85d8a11..2a9c26f 100644 Binary files a/src/qrc/QUI/icon/createSet.png and b/src/qrc/QUI/icon/createSet.png differ diff --git a/src/qrc/QUI/icon/createSketch.png b/src/qrc/QUI/icon/createSketch.png index f10f7d1..2744ca7 100644 Binary files a/src/qrc/QUI/icon/createSketch.png and b/src/qrc/QUI/icon/createSketch.png differ diff --git a/src/qrc/QUI/icon/curve.png b/src/qrc/QUI/icon/curve.png index da17142..cc492ba 100644 Binary files a/src/qrc/QUI/icon/curve.png and b/src/qrc/QUI/icon/curve.png differ diff --git a/src/qrc/QUI/icon/datumPlane.png b/src/qrc/QUI/icon/datumPlane.png index 8547c00..fa29db0 100644 Binary files a/src/qrc/QUI/icon/datumPlane.png and b/src/qrc/QUI/icon/datumPlane.png differ diff --git a/src/qrc/QUI/icon/desCase.png b/src/qrc/QUI/icon/desCase.png index 3536c63..3b74e9d 100644 Binary files a/src/qrc/QUI/icon/desCase.png and b/src/qrc/QUI/icon/desCase.png differ diff --git a/src/qrc/QUI/icon/desGeo.png b/src/qrc/QUI/icon/desGeo.png index 7629e80..02292e6 100644 Binary files a/src/qrc/QUI/icon/desGeo.png and b/src/qrc/QUI/icon/desGeo.png differ diff --git a/src/qrc/QUI/icon/desMesh.png b/src/qrc/QUI/icon/desMesh.png index 572767b..5ba8a1c 100644 Binary files a/src/qrc/QUI/icon/desMesh.png and b/src/qrc/QUI/icon/desMesh.png differ diff --git a/src/qrc/QUI/icon/eleset.png b/src/qrc/QUI/icon/eleset.png index 90b1388..fbee062 100644 Binary files a/src/qrc/QUI/icon/eleset.png and b/src/qrc/QUI/icon/eleset.png differ diff --git a/src/qrc/QUI/icon/english_language.png b/src/qrc/QUI/icon/english_language.png index 5cfdac9..ec28a36 100644 Binary files a/src/qrc/QUI/icon/english_language.png and b/src/qrc/QUI/icon/english_language.png differ diff --git a/src/qrc/QUI/icon/execScript.png b/src/qrc/QUI/icon/execScript.png index fdab89e..644238c 100644 Binary files a/src/qrc/QUI/icon/execScript.png and b/src/qrc/QUI/icon/execScript.png differ diff --git a/src/qrc/QUI/icon/expandL1.png b/src/qrc/QUI/icon/expandL1.png index a5af24f..42edb87 100644 Binary files a/src/qrc/QUI/icon/expandL1.png and b/src/qrc/QUI/icon/expandL1.png differ diff --git a/src/qrc/QUI/icon/exportGeometry.png b/src/qrc/QUI/icon/exportGeometry.png index dc7636c..e300d89 100644 Binary files a/src/qrc/QUI/icon/exportGeometry.png and b/src/qrc/QUI/icon/exportGeometry.png differ diff --git a/src/qrc/QUI/icon/exportMesh.png b/src/qrc/QUI/icon/exportMesh.png index ffde83d..21c5409 100644 Binary files a/src/qrc/QUI/icon/exportMesh.png and b/src/qrc/QUI/icon/exportMesh.png differ diff --git a/src/qrc/QUI/icon/face.png b/src/qrc/QUI/icon/face.png index 4d535a5..c90c71b 100644 Binary files a/src/qrc/QUI/icon/face.png and b/src/qrc/QUI/icon/face.png differ diff --git a/src/qrc/QUI/icon/faceWithEdge.png b/src/qrc/QUI/icon/faceWithEdge.png index 27e415a..5e57c88 100644 Binary files a/src/qrc/QUI/icon/faceWithEdge.png and b/src/qrc/QUI/icon/faceWithEdge.png differ diff --git a/src/qrc/QUI/icon/family.png b/src/qrc/QUI/icon/family.png index 033b586..04ec12b 100644 Binary files a/src/qrc/QUI/icon/family.png and b/src/qrc/QUI/icon/family.png differ diff --git a/src/qrc/QUI/icon/far.png b/src/qrc/QUI/icon/far.png index 7ad4dd8..cb4b3fa 100644 Binary files a/src/qrc/QUI/icon/far.png and b/src/qrc/QUI/icon/far.png differ diff --git a/src/qrc/QUI/icon/fit.png b/src/qrc/QUI/icon/fit.png index ec8eaf1..b713434 100644 Binary files a/src/qrc/QUI/icon/fit.png and b/src/qrc/QUI/icon/fit.png differ diff --git a/src/qrc/QUI/icon/fix.png b/src/qrc/QUI/icon/fix.png index c38a80a..39cb235 100644 Binary files a/src/qrc/QUI/icon/fix.png and b/src/qrc/QUI/icon/fix.png differ diff --git a/src/qrc/QUI/icon/fulid.png b/src/qrc/QUI/icon/fulid.png index 07a7bd4..45ceb15 100644 Binary files a/src/qrc/QUI/icon/fulid.png and b/src/qrc/QUI/icon/fulid.png differ diff --git a/src/qrc/QUI/icon/geometry.png b/src/qrc/QUI/icon/geometry.png index f2c0342..7d1b757 100644 Binary files a/src/qrc/QUI/icon/geometry.png and b/src/qrc/QUI/icon/geometry.png differ diff --git a/src/qrc/QUI/icon/graphOption.png b/src/qrc/QUI/icon/graphOption.png index 552d99a..550ceed 100644 Binary files a/src/qrc/QUI/icon/graphOption.png and b/src/qrc/QUI/icon/graphOption.png differ diff --git a/src/qrc/QUI/icon/help.png b/src/qrc/QUI/icon/help.png index b99efb2..4c1aa1a 100644 Binary files a/src/qrc/QUI/icon/help.png and b/src/qrc/QUI/icon/help.png differ diff --git a/src/qrc/QUI/icon/icon.png b/src/qrc/QUI/icon/icon.png index 35c05ff..f6b48a9 100644 Binary files a/src/qrc/QUI/icon/icon.png and b/src/qrc/QUI/icon/icon.png differ diff --git a/src/qrc/QUI/icon/importGeometry.png b/src/qrc/QUI/icon/importGeometry.png index eaf4cba..8682848 100644 Binary files a/src/qrc/QUI/icon/importGeometry.png and b/src/qrc/QUI/icon/importGeometry.png differ diff --git a/src/qrc/QUI/icon/importMesh.png b/src/qrc/QUI/icon/importMesh.png index 40b3814..13ad6d9 100644 Binary files a/src/qrc/QUI/icon/importMesh.png and b/src/qrc/QUI/icon/importMesh.png differ diff --git a/src/qrc/QUI/icon/inlet.png b/src/qrc/QUI/icon/inlet.png index 099a7c5..9fb5df4 100644 Binary files a/src/qrc/QUI/icon/inlet.png and b/src/qrc/QUI/icon/inlet.png differ diff --git a/src/qrc/QUI/icon/iso.png b/src/qrc/QUI/icon/iso.png index fbd6d31..faf3551 100644 Binary files a/src/qrc/QUI/icon/iso.png and b/src/qrc/QUI/icon/iso.png differ diff --git a/src/qrc/QUI/icon/language.png b/src/qrc/QUI/icon/language.png index e580e6f..39b922a 100644 Binary files a/src/qrc/QUI/icon/language.png and b/src/qrc/QUI/icon/language.png differ diff --git a/src/qrc/QUI/icon/material.png b/src/qrc/QUI/icon/material.png index 978513a..f8529a2 100644 Binary files a/src/qrc/QUI/icon/material.png and b/src/qrc/QUI/icon/material.png differ diff --git a/src/qrc/QUI/icon/mesh.png b/src/qrc/QUI/icon/mesh.png index a8c4f99..eafe1a3 100644 Binary files a/src/qrc/QUI/icon/mesh.png and b/src/qrc/QUI/icon/mesh.png differ diff --git a/src/qrc/QUI/icon/meshChecking.png b/src/qrc/QUI/icon/meshChecking.png index 1fe82aa..fabd78f 100644 Binary files a/src/qrc/QUI/icon/meshChecking.png and b/src/qrc/QUI/icon/meshChecking.png differ diff --git a/src/qrc/QUI/icon/meshComponent.png b/src/qrc/QUI/icon/meshComponent.png index d0354bb..481605f 100644 Binary files a/src/qrc/QUI/icon/meshComponent.png and b/src/qrc/QUI/icon/meshComponent.png differ diff --git a/src/qrc/QUI/icon/meshFilter.png b/src/qrc/QUI/icon/meshFilter.png index bc6a6e1..c84698b 100644 Binary files a/src/qrc/QUI/icon/meshFilter.png and b/src/qrc/QUI/icon/meshFilter.png differ diff --git a/src/qrc/QUI/icon/meshFluid.png b/src/qrc/QUI/icon/meshFluid.png index 1c19b15..ac97541 100644 Binary files a/src/qrc/QUI/icon/meshFluid.png and b/src/qrc/QUI/icon/meshFluid.png differ diff --git a/src/qrc/QUI/icon/meshmodeling.png b/src/qrc/QUI/icon/meshmodeling.png index 1c37404..f9b894c 100644 Binary files a/src/qrc/QUI/icon/meshmodeling.png and b/src/qrc/QUI/icon/meshmodeling.png differ diff --git a/src/qrc/QUI/icon/monitor.png b/src/qrc/QUI/icon/monitor.png index 48e0ec5..618977a 100644 Binary files a/src/qrc/QUI/icon/monitor.png and b/src/qrc/QUI/icon/monitor.png differ diff --git a/src/qrc/QUI/icon/near.png b/src/qrc/QUI/icon/near.png index 864a3f6..633ff6a 100644 Binary files a/src/qrc/QUI/icon/near.png and b/src/qrc/QUI/icon/near.png differ diff --git a/src/qrc/QUI/icon/node.png b/src/qrc/QUI/icon/node.png index 51da2b0..06454f0 100644 Binary files a/src/qrc/QUI/icon/node.png and b/src/qrc/QUI/icon/node.png differ diff --git a/src/qrc/QUI/icon/nodeset.png b/src/qrc/QUI/icon/nodeset.png index 3e6de43..81885e5 100644 Binary files a/src/qrc/QUI/icon/nodeset.png and b/src/qrc/QUI/icon/nodeset.png differ diff --git a/src/qrc/QUI/icon/normalL1.png b/src/qrc/QUI/icon/normalL1.png index fd0a119..082a9f2 100644 Binary files a/src/qrc/QUI/icon/normalL1.png and b/src/qrc/QUI/icon/normalL1.png differ diff --git a/src/qrc/QUI/icon/open.png b/src/qrc/QUI/icon/open.png index 1aa20e4..012ef1f 100644 Binary files a/src/qrc/QUI/icon/open.png and b/src/qrc/QUI/icon/open.png differ diff --git a/src/qrc/QUI/icon/outlet.png b/src/qrc/QUI/icon/outlet.png index 47b0faf..b4b9f9d 100644 Binary files a/src/qrc/QUI/icon/outlet.png and b/src/qrc/QUI/icon/outlet.png differ diff --git a/src/qrc/QUI/icon/physics.png b/src/qrc/QUI/icon/physics.png index 2e36ecc..8f73bdb 100644 Binary files a/src/qrc/QUI/icon/physics.png and b/src/qrc/QUI/icon/physics.png differ diff --git a/src/qrc/QUI/icon/pluginManager.png b/src/qrc/QUI/icon/pluginManager.png index 4476304..912a07a 100644 Binary files a/src/qrc/QUI/icon/pluginManager.png and b/src/qrc/QUI/icon/pluginManager.png differ diff --git a/src/qrc/QUI/icon/post.png b/src/qrc/QUI/icon/post.png index 9b1c6af..c17d718 100644 Binary files a/src/qrc/QUI/icon/post.png and b/src/qrc/QUI/icon/post.png differ diff --git a/src/qrc/QUI/icon/press.png b/src/qrc/QUI/icon/press.png index 7110045..7e26909 100644 Binary files a/src/qrc/QUI/icon/press.png and b/src/qrc/QUI/icon/press.png differ diff --git a/src/qrc/QUI/icon/ruler.png b/src/qrc/QUI/icon/ruler.png index 54e74b1..80ef6ad 100644 Binary files a/src/qrc/QUI/icon/ruler.png and b/src/qrc/QUI/icon/ruler.png differ diff --git a/src/qrc/QUI/icon/save.png b/src/qrc/QUI/icon/save.png index 7ed9263..c50a714 100644 Binary files a/src/qrc/QUI/icon/save.png and b/src/qrc/QUI/icon/save.png differ diff --git a/src/qrc/QUI/icon/saveAnimate.png b/src/qrc/QUI/icon/saveAnimate.png index 08fefb9..3675dd8 100644 Binary files a/src/qrc/QUI/icon/saveAnimate.png and b/src/qrc/QUI/icon/saveAnimate.png differ diff --git a/src/qrc/QUI/icon/saveAs.png b/src/qrc/QUI/icon/saveAs.png index d75e8f6..6604ce7 100644 Binary files a/src/qrc/QUI/icon/saveAs.png and b/src/qrc/QUI/icon/saveAs.png differ diff --git a/src/qrc/QUI/icon/saveImage.png b/src/qrc/QUI/icon/saveImage.png index 1d37ea2..839f0af 100644 Binary files a/src/qrc/QUI/icon/saveImage.png and b/src/qrc/QUI/icon/saveImage.png differ diff --git a/src/qrc/QUI/icon/saveScript.png b/src/qrc/QUI/icon/saveScript.png index 30c3335..e2c7e55 100644 Binary files a/src/qrc/QUI/icon/saveScript.png and b/src/qrc/QUI/icon/saveScript.png differ diff --git a/src/qrc/QUI/icon/selectElement.png b/src/qrc/QUI/icon/selectElement.png index bf95bc2..a58d085 100644 Binary files a/src/qrc/QUI/icon/selectElement.png and b/src/qrc/QUI/icon/selectElement.png differ diff --git a/src/qrc/QUI/icon/selectGeo.png b/src/qrc/QUI/icon/selectGeo.png index 972f4c4..3d90fc0 100644 Binary files a/src/qrc/QUI/icon/selectGeo.png and b/src/qrc/QUI/icon/selectGeo.png differ diff --git a/src/qrc/QUI/icon/selectNode.png b/src/qrc/QUI/icon/selectNode.png index 9416265..d3a77d3 100644 Binary files a/src/qrc/QUI/icon/selectNode.png and b/src/qrc/QUI/icon/selectNode.png differ diff --git a/src/qrc/QUI/icon/selectOff.png b/src/qrc/QUI/icon/selectOff.png index 3de32ab..318406a 100644 Binary files a/src/qrc/QUI/icon/selectOff.png and b/src/qrc/QUI/icon/selectOff.png differ diff --git a/src/qrc/QUI/icon/setting.png b/src/qrc/QUI/icon/setting.png index 90736fc..9137485 100644 Binary files a/src/qrc/QUI/icon/setting.png and b/src/qrc/QUI/icon/setting.png differ diff --git a/src/qrc/QUI/icon/sketchArc.png b/src/qrc/QUI/icon/sketchArc.png index 052d483..1a8bbc2 100644 Binary files a/src/qrc/QUI/icon/sketchArc.png and b/src/qrc/QUI/icon/sketchArc.png differ diff --git a/src/qrc/QUI/icon/sketchCircle.png b/src/qrc/QUI/icon/sketchCircle.png index e282264..0f8c35e 100644 Binary files a/src/qrc/QUI/icon/sketchCircle.png and b/src/qrc/QUI/icon/sketchCircle.png differ diff --git a/src/qrc/QUI/icon/sketchLine.png b/src/qrc/QUI/icon/sketchLine.png index 9a85cb1..26224f2 100644 Binary files a/src/qrc/QUI/icon/sketchLine.png and b/src/qrc/QUI/icon/sketchLine.png differ diff --git a/src/qrc/QUI/icon/sketchPolyLine.png b/src/qrc/QUI/icon/sketchPolyLine.png index 9b2aadd..dfb5dec 100644 Binary files a/src/qrc/QUI/icon/sketchPolyLine.png and b/src/qrc/QUI/icon/sketchPolyLine.png differ diff --git a/src/qrc/QUI/icon/sketchRectangle.png b/src/qrc/QUI/icon/sketchRectangle.png index 33e2184..ee19de6 100644 Binary files a/src/qrc/QUI/icon/sketchRectangle.png and b/src/qrc/QUI/icon/sketchRectangle.png differ diff --git a/src/qrc/QUI/icon/sketchSpline.png b/src/qrc/QUI/icon/sketchSpline.png index 964ae78..032266c 100644 Binary files a/src/qrc/QUI/icon/sketchSpline.png and b/src/qrc/QUI/icon/sketchSpline.png differ diff --git a/src/qrc/QUI/icon/solidMesh.png b/src/qrc/QUI/icon/solidMesh.png index 132f360..a193f61 100644 Binary files a/src/qrc/QUI/icon/solidMesh.png and b/src/qrc/QUI/icon/solidMesh.png differ diff --git a/src/qrc/QUI/icon/solumationsetting.png b/src/qrc/QUI/icon/solumationsetting.png index 4d4ff2b..857377e 100644 Binary files a/src/qrc/QUI/icon/solumationsetting.png and b/src/qrc/QUI/icon/solumationsetting.png differ diff --git a/src/qrc/QUI/icon/solve.png b/src/qrc/QUI/icon/solve.png index 0503d1a..f54051e 100644 Binary files a/src/qrc/QUI/icon/solve.png and b/src/qrc/QUI/icon/solve.png differ diff --git a/src/qrc/QUI/icon/speed.png b/src/qrc/QUI/icon/speed.png index 2bf1818..8a681ac 100644 Binary files a/src/qrc/QUI/icon/speed.png and b/src/qrc/QUI/icon/speed.png differ diff --git a/src/qrc/QUI/icon/stop.png b/src/qrc/QUI/icon/stop.png index 56a086b..857bd88 100644 Binary files a/src/qrc/QUI/icon/stop.png and b/src/qrc/QUI/icon/stop.png differ diff --git a/src/qrc/QUI/icon/streamline.png b/src/qrc/QUI/icon/streamline.png index 1d829d1..8022491 100644 Binary files a/src/qrc/QUI/icon/streamline.png and b/src/qrc/QUI/icon/streamline.png differ diff --git a/src/qrc/QUI/icon/surface.png b/src/qrc/QUI/icon/surface.png index f2c0342..7d1b757 100644 Binary files a/src/qrc/QUI/icon/surface.png and b/src/qrc/QUI/icon/surface.png differ diff --git a/src/qrc/QUI/icon/surfaceMesh.png b/src/qrc/QUI/icon/surfaceMesh.png index b5bdf87..d7fab50 100644 Binary files a/src/qrc/QUI/icon/surfaceMesh.png and b/src/qrc/QUI/icon/surfaceMesh.png differ diff --git a/src/qrc/QUI/icon/surfaceWithEdge.png b/src/qrc/QUI/icon/surfaceWithEdge.png index d0fe0ec..b351f43 100644 Binary files a/src/qrc/QUI/icon/surfaceWithEdge.png and b/src/qrc/QUI/icon/surfaceWithEdge.png differ diff --git a/src/qrc/QUI/icon/symmetry.png b/src/qrc/QUI/icon/symmetry.png index 00781be..c02bcae 100644 Binary files a/src/qrc/QUI/icon/symmetry.png and b/src/qrc/QUI/icon/symmetry.png differ diff --git a/src/qrc/QUI/icon/tempure.png b/src/qrc/QUI/icon/tempure.png index 744da94..a5f8b0b 100644 Binary files a/src/qrc/QUI/icon/tempure.png and b/src/qrc/QUI/icon/tempure.png differ diff --git a/src/qrc/QUI/icon/userguidance.png b/src/qrc/QUI/icon/userguidance.png index feb5555..a93ad63 100644 Binary files a/src/qrc/QUI/icon/userguidance.png and b/src/qrc/QUI/icon/userguidance.png differ diff --git a/src/qrc/QUI/icon/vector.png b/src/qrc/QUI/icon/vector.png index e9a3274..4ec040b 100644 Binary files a/src/qrc/QUI/icon/vector.png and b/src/qrc/QUI/icon/vector.png differ diff --git a/src/qrc/QUI/icon/wall.png b/src/qrc/QUI/icon/wall.png index 7fe15be..eddc7ca 100644 Binary files a/src/qrc/QUI/icon/wall.png and b/src/qrc/QUI/icon/wall.png differ diff --git a/src/qrc/QUI/icon/wireFrame.png b/src/qrc/QUI/icon/wireFrame.png index ac1d960..9b30287 100644 Binary files a/src/qrc/QUI/icon/wireFrame.png and b/src/qrc/QUI/icon/wireFrame.png differ diff --git a/src/qrc/QUI/icon/workdir.png b/src/qrc/QUI/icon/workdir.png index c29813b..11d5710 100644 Binary files a/src/qrc/QUI/icon/workdir.png and b/src/qrc/QUI/icon/workdir.png differ diff --git a/src/qrc/QUI/icon/xMinus.png b/src/qrc/QUI/icon/xMinus.png index fcb8755..db0d9c4 100644 Binary files a/src/qrc/QUI/icon/xMinus.png and b/src/qrc/QUI/icon/xMinus.png differ diff --git a/src/qrc/QUI/icon/xPlus.png b/src/qrc/QUI/icon/xPlus.png index a4dd383..f66db66 100644 Binary files a/src/qrc/QUI/icon/xPlus.png and b/src/qrc/QUI/icon/xPlus.png differ diff --git a/src/qrc/QUI/icon/yMinus.png b/src/qrc/QUI/icon/yMinus.png index 05b975d..8beb8e9 100644 Binary files a/src/qrc/QUI/icon/yMinus.png and b/src/qrc/QUI/icon/yMinus.png differ diff --git a/src/qrc/QUI/icon/yPlus.png b/src/qrc/QUI/icon/yPlus.png index efba671..b21c2d7 100644 Binary files a/src/qrc/QUI/icon/yPlus.png and b/src/qrc/QUI/icon/yPlus.png differ diff --git a/src/qrc/QUI/icon/zMinus.png b/src/qrc/QUI/icon/zMinus.png index d7a10c1..8b7cfde 100644 Binary files a/src/qrc/QUI/icon/zMinus.png and b/src/qrc/QUI/icon/zMinus.png differ diff --git a/src/qrc/QUI/icon/zPlus.png b/src/qrc/QUI/icon/zPlus.png index 7873579..8fbe91f 100644 Binary files a/src/qrc/QUI/icon/zPlus.png and b/src/qrc/QUI/icon/zPlus.png differ diff --git a/src/qrc/QUI/post/Reflection.png b/src/qrc/QUI/post/Reflection.png index 6b50fa9..cfce527 100644 Binary files a/src/qrc/QUI/post/Reflection.png and b/src/qrc/QUI/post/Reflection.png differ diff --git a/src/qrc/QUI/post/ScalarBar.png b/src/qrc/QUI/post/ScalarBar.png index 121731c..528a4fe 100644 Binary files a/src/qrc/QUI/post/ScalarBar.png and b/src/qrc/QUI/post/ScalarBar.png differ diff --git a/src/qrc/QUI/post/back.png b/src/qrc/QUI/post/back.png index 3800515..43bc44f 100644 Binary files a/src/qrc/QUI/post/back.png and b/src/qrc/QUI/post/back.png differ diff --git a/src/qrc/QUI/post/calculator.png b/src/qrc/QUI/post/calculator.png index 3c04e18..2c670b0 100644 Binary files a/src/qrc/QUI/post/calculator.png and b/src/qrc/QUI/post/calculator.png differ diff --git a/src/qrc/QUI/post/clip.png b/src/qrc/QUI/post/clip.png index 78261ba..9251dcb 100644 Binary files a/src/qrc/QUI/post/clip.png and b/src/qrc/QUI/post/clip.png differ diff --git a/src/qrc/QUI/post/counter.png b/src/qrc/QUI/post/counter.png index 121731c..528a4fe 100644 Binary files a/src/qrc/QUI/post/counter.png and b/src/qrc/QUI/post/counter.png differ diff --git a/src/qrc/QUI/post/editColor.png b/src/qrc/QUI/post/editColor.png index 9b1c6af..c17d718 100644 Binary files a/src/qrc/QUI/post/editColor.png and b/src/qrc/QUI/post/editColor.png differ diff --git a/src/qrc/QUI/post/end.png b/src/qrc/QUI/post/end.png index 0cc7299..c6a42ea 100644 Binary files a/src/qrc/QUI/post/end.png and b/src/qrc/QUI/post/end.png differ diff --git a/src/qrc/QUI/post/first.png b/src/qrc/QUI/post/first.png index 83724ca..f101bc0 100644 Binary files a/src/qrc/QUI/post/first.png and b/src/qrc/QUI/post/first.png differ diff --git a/src/qrc/QUI/post/fit.png b/src/qrc/QUI/post/fit.png index ec8eaf1..b713434 100644 Binary files a/src/qrc/QUI/post/fit.png and b/src/qrc/QUI/post/fit.png differ diff --git a/src/qrc/QUI/post/front.png b/src/qrc/QUI/post/front.png index d884963..e87475e 100644 Binary files a/src/qrc/QUI/post/front.png and b/src/qrc/QUI/post/front.png differ diff --git a/src/qrc/QUI/post/glyph.png b/src/qrc/QUI/post/glyph.png index 4f96ee0..0584eec 100644 Binary files a/src/qrc/QUI/post/glyph.png and b/src/qrc/QUI/post/glyph.png differ diff --git a/src/qrc/QUI/post/isocurve.png b/src/qrc/QUI/post/isocurve.png index 270462c..a56c6e1 100644 Binary files a/src/qrc/QUI/post/isocurve.png and b/src/qrc/QUI/post/isocurve.png differ diff --git a/src/qrc/QUI/post/isosurf.png b/src/qrc/QUI/post/isosurf.png index 7192cfa..0e50c01 100644 Binary files a/src/qrc/QUI/post/isosurf.png and b/src/qrc/QUI/post/isosurf.png differ diff --git a/src/qrc/QUI/post/last.png b/src/qrc/QUI/post/last.png index 05492df..07e6ea1 100644 Binary files a/src/qrc/QUI/post/last.png and b/src/qrc/QUI/post/last.png differ diff --git a/src/qrc/QUI/post/next.png b/src/qrc/QUI/post/next.png index 378321e..92baf72 100644 Binary files a/src/qrc/QUI/post/next.png and b/src/qrc/QUI/post/next.png differ diff --git a/src/qrc/QUI/post/open.png b/src/qrc/QUI/post/open.png index 9f08113..9ddbb61 100644 Binary files a/src/qrc/QUI/post/open.png and b/src/qrc/QUI/post/open.png differ diff --git a/src/qrc/QUI/post/point.png b/src/qrc/QUI/post/point.png index e9cf0e0..d1b5dda 100644 Binary files a/src/qrc/QUI/post/point.png and b/src/qrc/QUI/post/point.png differ diff --git a/src/qrc/QUI/post/post.png b/src/qrc/QUI/post/post.png index 9b1c6af..c17d718 100644 Binary files a/src/qrc/QUI/post/post.png and b/src/qrc/QUI/post/post.png differ diff --git a/src/qrc/QUI/post/previous.png b/src/qrc/QUI/post/previous.png index 05492df..07e6ea1 100644 Binary files a/src/qrc/QUI/post/previous.png and b/src/qrc/QUI/post/previous.png differ diff --git a/src/qrc/QUI/post/rep_point.png b/src/qrc/QUI/post/rep_point.png index 56fd407..01e94cf 100644 Binary files a/src/qrc/QUI/post/rep_point.png and b/src/qrc/QUI/post/rep_point.png differ diff --git a/src/qrc/QUI/post/rep_surface.png b/src/qrc/QUI/post/rep_surface.png index f2c0342..7d1b757 100644 Binary files a/src/qrc/QUI/post/rep_surface.png and b/src/qrc/QUI/post/rep_surface.png differ diff --git a/src/qrc/QUI/post/rep_surfaceWithEdge.png b/src/qrc/QUI/post/rep_surfaceWithEdge.png index d0fe0ec..b351f43 100644 Binary files a/src/qrc/QUI/post/rep_surfaceWithEdge.png and b/src/qrc/QUI/post/rep_surfaceWithEdge.png differ diff --git a/src/qrc/QUI/post/rep_wireFrame.png b/src/qrc/QUI/post/rep_wireFrame.png index d1ffa6d..bde1c62 100644 Binary files a/src/qrc/QUI/post/rep_wireFrame.png and b/src/qrc/QUI/post/rep_wireFrame.png differ diff --git a/src/qrc/QUI/post/run.png b/src/qrc/QUI/post/run.png index e7f9c3f..c1678ea 100644 Binary files a/src/qrc/QUI/post/run.png and b/src/qrc/QUI/post/run.png differ diff --git a/src/qrc/QUI/post/saveImage.png b/src/qrc/QUI/post/saveImage.png index 1d37ea2..839f0af 100644 Binary files a/src/qrc/QUI/post/saveImage.png and b/src/qrc/QUI/post/saveImage.png differ diff --git a/src/qrc/QUI/post/slice.png b/src/qrc/QUI/post/slice.png index 8b8e5e2..c49bf66 100644 Binary files a/src/qrc/QUI/post/slice.png and b/src/qrc/QUI/post/slice.png differ diff --git a/src/qrc/QUI/post/stop.png b/src/qrc/QUI/post/stop.png index 7366286..e0e5827 100644 Binary files a/src/qrc/QUI/post/stop.png and b/src/qrc/QUI/post/stop.png differ diff --git a/src/qrc/QUI/post/streamline.png b/src/qrc/QUI/post/streamline.png index 1d829d1..8022491 100644 Binary files a/src/qrc/QUI/post/streamline.png and b/src/qrc/QUI/post/streamline.png differ diff --git a/src/qrc/QUI/post/up.png b/src/qrc/QUI/post/up.png index 984ff15..41b63e9 100644 Binary files a/src/qrc/QUI/post/up.png and b/src/qrc/QUI/post/up.png differ diff --git a/src/qrc/QUI/post/val_on_cell.png b/src/qrc/QUI/post/val_on_cell.png index 90b1388..fbee062 100644 Binary files a/src/qrc/QUI/post/val_on_cell.png and b/src/qrc/QUI/post/val_on_cell.png differ diff --git a/src/qrc/QUI/post/val_on_point.png b/src/qrc/QUI/post/val_on_point.png index 3e6de43..81885e5 100644 Binary files a/src/qrc/QUI/post/val_on_point.png and b/src/qrc/QUI/post/val_on_point.png differ diff --git a/src/qrc/QUI/post/vector.png b/src/qrc/QUI/post/vector.png index 4f96ee0..0584eec 100644 Binary files a/src/qrc/QUI/post/vector.png and b/src/qrc/QUI/post/vector.png differ diff --git a/src/qrc/QUI/post/video.png b/src/qrc/QUI/post/video.png index a7d411b..f5d8989 100644 Binary files a/src/qrc/QUI/post/video.png and b/src/qrc/QUI/post/video.png differ diff --git a/src/qrc/QUI/window/2dplot.png b/src/qrc/QUI/window/2dplot.png index 6fe767c..e55bd5b 100644 Binary files a/src/qrc/QUI/window/2dplot.png and b/src/qrc/QUI/window/2dplot.png differ diff --git a/src/qrc/QUI/window/3dgraph.png b/src/qrc/QUI/window/3dgraph.png index b3202d4..3aaa3c9 100644 Binary files a/src/qrc/QUI/window/3dgraph.png and b/src/qrc/QUI/window/3dgraph.png differ diff --git a/src/qrc/QUI/window/preWindow.png b/src/qrc/QUI/window/preWindow.png index 5ae42cd..654b5fb 100644 Binary files a/src/qrc/QUI/window/preWindow.png and b/src/qrc/QUI/window/preWindow.png differ diff --git a/src/qrc/QUI/window/startpage.png b/src/qrc/QUI/window/startpage.png index 7ef6c9c..6b5e3c4 100644 Binary files a/src/qrc/QUI/window/startpage.png and b/src/qrc/QUI/window/startpage.png differ