浏览代码

0620 修改bug 文件流读取dat

caizm 2 年之前
父节点
当前提交
0135652bee

+ 2 - 1
CAE_Solution/src/VTK/mesh/mesh_tecplot.cpp

@@ -124,6 +124,8 @@ bool Mesh_Tecplot::Load_Tecp_Ascii(ifstream &infile)
                 variables = variables.substr(variables.find("t=\"")+3);
                 variables = variables.substr(variables.find("t=\"")+3);
                 zoneName_temp+=variables;
                 zoneName_temp+=variables;
             }
             }
+            celltype_empty = false;
+            celltype.clear();
             while(true){
             while(true){
                 infile>>variables;
                 infile>>variables;
                 zoneName_temp+=" ";
                 zoneName_temp+=" ";
@@ -967,7 +969,6 @@ void Mesh_Tecplot::SaveData_Ascii(int numofpoint, int numofcell, string celltype
             delete cell;
             delete cell;
         }
         }
     }
     }
-    celltype_empty = false;//再置回来
     /*************************************/
     /*************************************/
     //方便使用meshtovtksource这个接口进行转换拓扑
     //方便使用meshtovtksource这个接口进行转换拓扑
     vector<int> scalar_share_tmp;
     vector<int> scalar_share_tmp;

+ 12 - 0
CAE_Solution/src/VTK/visualization_VTK/vtkVISMeshToVTKSource.cpp

@@ -13,6 +13,7 @@
 #include "vtkHexahedron.h"
 #include "vtkHexahedron.h"
 #include "vtkIdList.h"
 #include "vtkIdList.h"
 #include <vtkDoubleArray.h>
 #include <vtkDoubleArray.h>
+#include <vtkUnstructuredGridWriter.h>
 
 
 
 
 
 
@@ -273,6 +274,17 @@ void vtkVISMeshToVTKSource::MeshBaseToUnstructuredGrid(Mesh* mesh, int index)
         }
         }
     }
     }
     unGridVec.push_back(unGrid);
     unGridVec.push_back(unGrid);
+    /*
+    vtkUnstructuredGridWriter *writer = vtkUnstructuredGridWriter::New();
+    string name;
+    name+="vtktest";
+    name+=to_string(index);
+    name+=".vtk";
+    writer->SetFileName(name.c_str());
+    writer->SetInputData(unGrid->unstruGrid);
+    writer->Write();
+    writer->Delete();
+    */
     /*for (int i = 0; i < unGridVec.at(index)->GetScalarNumber(); i ++)
     /*for (int i = 0; i < unGridVec.at(index)->GetScalarNumber(); i ++)
     {
     {
         cout << unGridVec.at(index)->GetScalarName(i) << ":  "
         cout << unGridVec.at(index)->GetScalarName(i) << ":  "

+ 3 - 1
CAE_Solution/src/threadPool_and_statemachine/dealWith/handlepool.cpp

@@ -291,7 +291,8 @@ void handlePool::judgeLoaddata(boostJsonObject *object, QVTKRenderer *render_)
 bool handlePool::resultImport(boostJsonObject *object_, QVTKRenderer *renderer_)
 bool handlePool::resultImport(boostJsonObject *object_, QVTKRenderer *renderer_)
 {
 {
     string type_;
     string type_;
-    //object_->fileName = "hcfd_part1_tec_volume_timestep100.dat,hcfd_part2_tec_volume_timestep100.dat";
+    //object_->fileName = "test1.dat";
+    //object_->fileName = "hcfd_tec_boundary_timestep100.dat";
     //object_->fileName = "whole_part1.plt,whole_part2.plt";
     //object_->fileName = "whole_part1.plt,whole_part2.plt";
     size_t found = object_->fileName.find_first_of(',');
     size_t found = object_->fileName.find_first_of(',');
     if(found==string::npos){//单个文件
     if(found==string::npos){//单个文件
@@ -349,6 +350,7 @@ bool handlePool::resultImport(boostJsonObject *object_, QVTKRenderer *renderer_)
             renderer_->RemoveAllActors();
             renderer_->RemoveAllActors();
         }
         }
     }
     }
+    //object_->filePath = "F:\\czm\\vtkfile";
     //object_->filePath = "C:\\Users\\Administrator\\Desktop\\Postprocess_Binary";//测试路径
     //object_->filePath = "C:\\Users\\Administrator\\Desktop\\Postprocess_Binary";//测试路径
     //object_->filePath = "C:\\Users\\Administrator\\Documents\\WeChat Files\\wxid_18qjhi0tq90d22\\FileStorage\\File\\2023-06";//测试路径
     //object_->filePath = "C:\\Users\\Administrator\\Documents\\WeChat Files\\wxid_18qjhi0tq90d22\\FileStorage\\File\\2023-06";//测试路径
     QDir dir(QString::fromStdString(object_->filePath));
     QDir dir(QString::fromStdString(object_->filePath));