Эх сурвалжийг харах

0420 更换resultmanager以及mesh,MeshDS和部分visualization_vtk

caizm 2 жил өмнө
parent
commit
d39c439679
53 өөрчлөгдсөн 6241 нэмэгдсэн , 948 устгасан
  1. 888 196
      CAE_Solution/src/VTK/Manager/ResultMeshManager.cpp
  2. 97 17
      CAE_Solution/src/VTK/Manager/ResultMeshManager.h
  3. 0 0
      CAE_Solution/src/VTK/MeshDS/CellDS.h
  4. 1 1
      CAE_Solution/src/VTK/MeshDS/MeshBase.h
  5. 9 0
      CAE_Solution/src/VTK/MeshDS/MeshDS.pri
  6. 2 2
      CAE_Solution/src/VTK/MeshDS/PointDS.cpp
  7. 0 0
      CAE_Solution/src/VTK/MeshDS/PointDS.h
  8. 1 1
      CAE_Solution/src/VTK/MeshDS/meshbase.cpp
  9. 1 1
      CAE_Solution/src/VTK/MeshDS/meshstructured.cpp
  10. 1 1
      CAE_Solution/src/VTK/MeshDS/meshstructured.h
  11. 401 0
      CAE_Solution/src/VTK/MeshDS/meshunstructured.cpp
  12. 8 17
      CAE_Solution/src/VTK/MeshDS/meshunstructured.h
  13. 2 1
      CAE_Solution/src/VTK/VTK.pri
  14. 42 0
      CAE_Solution/src/VTK/display/contourdisplay.cpp
  15. 24 0
      CAE_Solution/src/VTK/display/contourdisplay.h
  16. 10 0
      CAE_Solution/src/VTK/display/display.pri
  17. 37 0
      CAE_Solution/src/VTK/display/linedisplay.cpp
  18. 22 0
      CAE_Solution/src/VTK/display/linedisplay.h
  19. 35 0
      CAE_Solution/src/VTK/display/slicewidget.cpp
  20. 16 0
      CAE_Solution/src/VTK/display/slicewidget.h
  21. 32 0
      CAE_Solution/src/VTK/display/solidsurfacewidget.cpp
  22. 18 0
      CAE_Solution/src/VTK/display/solidsurfacewidget.h
  23. 38 0
      CAE_Solution/src/VTK/display/streamwidget.cpp
  24. 21 0
      CAE_Solution/src/VTK/display/streamwidget.h
  25. 29 0
      CAE_Solution/src/VTK/display/vectordisplay.cpp
  26. 18 0
      CAE_Solution/src/VTK/display/vectordisplay.h
  27. 342 0
      CAE_Solution/src/VTK/mesh/Mesh_CSDInp.cpp
  28. 32 0
      CAE_Solution/src/VTK/mesh/Mesh_CSDInp.h
  29. 1155 0
      CAE_Solution/src/VTK/mesh/Mesh_Frd.cpp
  30. 75 0
      CAE_Solution/src/VTK/mesh/Mesh_Frd.h
  31. 159 6
      CAE_Solution/src/VTK/mesh/mesh.cpp
  32. 13 0
      CAE_Solution/src/VTK/mesh/mesh.h
  33. 1 1
      CAE_Solution/src/VTK/mesh/mesh_adi.cpp
  34. 1 1
      CAE_Solution/src/VTK/mesh/mesh_adi.h
  35. 4 4
      CAE_Solution/src/VTK/mesh/mesh_tecplot.cpp
  36. 1 1
      CAE_Solution/src/VTK/mesh/mesh_tecplot.h
  37. 4 5
      CAE_Solution/src/VTK/mesh/mesh_ugrid.cpp
  38. 2 3
      CAE_Solution/src/VTK/mesh/mesh_ugrid.h
  39. 0 613
      CAE_Solution/src/VTK/mesh/meshunstructured.cpp
  40. 16 5
      CAE_Solution/src/VTK/visualization_VTK/vtkVISMeshToVTKSource.cpp
  41. 1 1
      CAE_Solution/src/VTK/visualization_VTK/vtkVISMeshToVTKSource.h
  42. 53 0
      CAE_Solution/src/VTK/visualization_VTK/vtkVISMouseInteractorStyle.cpp
  43. 34 0
      CAE_Solution/src/VTK/visualization_VTK/vtkVISMouseInteractorStyle.h
  44. 35 7
      CAE_Solution/src/VTK/visualization_VTK/vtkVISUnContour.cpp
  45. 1 1
      CAE_Solution/src/VTK/visualization_VTK/vtkVISUnContour.h
  46. 12 0
      CAE_Solution/src/VTK/visualization_VTK/vtkVISUnGlyph.cpp
  47. 1 0
      CAE_Solution/src/VTK/visualization_VTK/vtkVISUnGlyph.h
  48. 182 49
      CAE_Solution/src/VTK/visualization_VTK/vtkVISUnSlice.cpp
  49. 12 11
      CAE_Solution/src/VTK/visualization_VTK/vtkVISUnSlice.h
  50. 2178 0
      CAE_Solution/src/VTK/visualization_VTK/vtkVISUnStreamTrace.cpp
  51. 171 0
      CAE_Solution/src/VTK/visualization_VTK/vtkVISUnStreamTrace.h
  52. 2 2
      CAE_Solution/src/VTK/visualization_VTK/vtkvismeshbasetovtksource.cpp
  53. 1 1
      CAE_Solution/src/VTK/visualization_VTK/vtkvismeshbasetovtksource.h

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 888 - 196
CAE_Solution/src/VTK/Manager/ResultMeshManager.cpp


+ 97 - 17
CAE_Solution/src/VTK/Manager/ResultMeshManager.h

@@ -4,12 +4,17 @@
 #include <vector>
 #include <map>
 #include <QStringList>
-//#include "contourdispaly.h"
-//#include "linedisplay.h"
+#include "../display/contourdisplay.h"
+#include "../display/linedisplay.h"
 //#include "vectorwidget.h"
 #include "../QVTKRenderer/qvtkrenderer.h"
 #include "../visualization_VTK/vtkVISAddUnGridDataSource.h"
 #include "../visualization_VTK/vtkVISUnSlice.h"
+#include "../display/solidsurfacewidget.h"
+#include "../visualization_VTK/vtkVISUnStreamTrace.h"
+
+
+#include "../meshds/PointDS.h"
 using namespace std;
 
 #include <set>
@@ -19,13 +24,14 @@ class vtkVISUnContour;
 class vtkVISUnGlyph;
 class vtkVISUnShadeMesh;
 
-
 class Mesh;
-class VisMesh;
 class QVTKRenderer;
+class MeshBase;
 
-
-//class ContourInimationW;
+class ContourInimationW;
+class SsliceWidget;
+class StreamWidget;
+class XYPlot_2D;
 
 class ResultMeshManager
 {
@@ -40,11 +46,12 @@ public:
     //vtk vis functions.
     void DisplayMesh(QVTKRenderer *qvtkRenderer = 0);
     void DisplayMeshByIndex(int index = 0);
+    QVTKRenderer *GetQVtkRender();
 
     void SetSaveIndex(int index);
     int GetCurrIndex();
     set<double> GetSolveTime();
-    set<string> GetZoneNameVec();
+    vector<string> GetZoneNameVec();
     void SetNameTypeMap();
     map<string, int> GetNameTypeMap();
     void Clear();
@@ -59,7 +66,27 @@ public:
     void SetContourLevel(int level);
     int GetContourLevel();
 
-
+    //void SetCotourWidget(ContourDisplayW* w);
+    //void SetLineWidget(LineDisplayW* w);
+    //void SetVectorWidget(VectorW* w);
+    //void SetAnimationWidget(ContourInimationW* w);
+    //void SetSurfaceSolidWidget(SolidSurfaceWidget* w);
+    void SetSliceWidget(SsliceWidget* w);
+    void SetStremWidget(StreamWidget* w);
+    //void SetTextWidget(TextWidget* w);
+    void SetXyplotWidget(XYPlot_2D* w);
+    //void SetWidgetRange();
+    //void SetWidgetScalarName();
+    void SetTitleSize(double size);
+    //void SetWidgetTitleSize();
+    void SetLabelSize(double size);
+    //void SetWidgetLabelSize();
+    void SetLevel(int level);
+    //void SetWidgetLevel();
+    void SetRange(double* range);
+    void SetDisplayType(int type);
+    //void InitWidgetsParameter();
+    vector<int> GetShowZoneId();
 
     void SetVectorScalarIndex(vector<int> indexVec);
     void SetVectorScaleFactor(double factor);
@@ -69,11 +96,44 @@ public:
     void SetSurfaceShowHideFlag(bool flag);
 
     void SetScalarName(string name);
-
     //vtkunslice
-    void MakeVISUnStructGrid(int index);
+    void MakeVISUnStructGrid();
     void DisplayUnstructGrid();
-
+    void InitSliceWidget();
+    vector<double> GetUnslicePosition(int index);
+    vector<double> GetUnsliceSourceBounds(int index);
+    void SetAllSliceState(vector<int> sliceId, vector<bool> solidState, vector<bool> planeWidgetState, vector<vector<double>> nomal,
+                          vector<vector<double>> posision, vector<string> type, vector<string> contourName, vector<int> level,
+                          vector<bool> planeState, vector<bool>labelState);
+    void UpdataSliceWidgetParameter();
+
+    //vtkstreamtrace
+    void UpdataCurrUnstructSource();
+    void CreatVectorSource(string u, string v, string w);
+    void DisplayStreamLine(string direction, string type, double initStrp, double maxPropgation, double minStep, bool showState, bool ToolState);
+    void SetStreamSelectState(bool flag);
+    void DeleteAllStream();
+
+    ///hide actors
+    void HideAllActors();
+    void HideAllUnshadeMeshActors();
+    void HideAllContourActors();
+    void HideAllGlyphActors();
+    void HideSliceActors();
+    void HideStreamActors();
+    void HideXyplot2dSliceActors();
+
+    void GetExportPictures(QString file);
+    void GetActorText(string text_,vector<double> position_XY,double fontsize,vector<double> color);
+    void UpdataZoomModel(double factor);
+    void ChangeMeshType(int type);
+    void DisplayXyplot2dSlice(int meshIndex, int scalarIndex);
+    vector<double> GetXyplot2dUnslicePosition();
+    void SetXyplot2dSliceNormal(int normalIndex);
+    void SetXyplot2dSliceScalarIndex(int index);
+    void SetXyplot2dSlicePosition(vector<double> p);
+    vector<vector<double>> GetXyplot2dUnsliceData();
+    vector<string> GetXyplot2dAxisName();
 private:
     int m_currId;
     Mesh *meshObj_;  //mesh object.
@@ -81,21 +141,28 @@ private:
     map<double, map<string, vtkVISUnContour*>>  vtkVisZoneMeshMap_;  //id, <zoneid, mesh>.
     map<double, map<string, vtkVISUnGlyph*>> vtkVisZoneGlyphMap_; //id, <zoneid, mesh>.
     map<double, map<string, vtkVISUnShadeMesh*>> vtkVisZoneUnShadeMeshMap_;//solveTime zoneName unShadeMesh
-    vector<double> solveTime_;
     set<double> solveTimes_;
-    set<string> zoneNameSet_;
     set<string> currShowZoneNameSet_;
+    vector<string> zoneNameVec_;
     map<string, int> nameTypeMap_;
     QVTKRenderer* render_;
     vector<bool> showHideVec_;
     vtkVISAddUnGridDataSource* addDataSource_;
-    vtkVISUnSlice* unSlice_;
+    vtkVISAddUnGridDataSource* currAddDataSource_;
     double range_[2];
     int scalarIndex;
     int scalarLeave;
-
-
-
+    vtkVISUnStreamTrace* streamLine_;
+
+    //ContourDisplayW* contourWidget_;
+    //LineDisplayW* lineWidget_;
+    //VectorW* vectorWidget_;
+    //ContourInimationW* animationWidget_;
+    //SolidSurfaceWidget* solidSurfaceW_;
+    //SsliceWidget* sliceW_;
+   // StreamWidget* streamW_;
+    //TextWidget* textW_;
+    //XYPlot_2D* xyplot2dW_;
     double titleSize_;
     double labelSize_;
 
@@ -110,6 +177,19 @@ private:
     double surfaceActorTransparency_;
     string scalarName_;
     string allZoneScalarName_;
+    vector<vtkVISUnSlice*> unSliceVec_;
+
+    //vtkVISCaptureFigure *captureF;
+    vtkTextActor *titleText_;
+    vector<Mesh*> MeshVec_;//frd format analys result
+    vector<Mesh*> TimeMeshVec_;
+    vector<Mesh*> ModalMeshVec_;
+    PointsDS* initPointsData;
+    vector<string> dispNameVec;
+    bool HaveModalMeshFlag;
+    int meshType;//0 is time step, 1 is modal step
+    vtkVISUnSlice* xyplot2dSlice_;
+    vector<vtkVISAddUnGridDataSource*> currentVISGridVec_;
 };
 
 

+ 0 - 0
CAE_Solution/src/VTK/mesh/CellDS.h → CAE_Solution/src/VTK/MeshDS/CellDS.h


+ 1 - 1
CAE_Solution/src/VTK/mesh/meshbase.h → CAE_Solution/src/VTK/MeshDS/MeshBase.h

@@ -7,7 +7,6 @@
 using namespace std;
 
 #include "PointDS.h"
-#include <vtkDoubleArray.h>
 
 
 
@@ -45,5 +44,6 @@ protected:
     set<int>  patchTagsSet_;
 };
 
+
 #endif
 

+ 9 - 0
CAE_Solution/src/VTK/MeshDS/MeshDS.pri

@@ -0,0 +1,9 @@
+HEADERS += \ 
+    $$PWD/*.h
+
+
+
+		
+		
+SOURCES += \ 
+     $$PWD/*.cpp

+ 2 - 2
CAE_Solution/src/VTK/mesh/PointDS.cpp → CAE_Solution/src/VTK/MeshDS/PointDS.cpp

@@ -1,4 +1,4 @@
-#include "PointDS.h".h"
+#include "PointDS.h"
 
 
 
@@ -52,7 +52,7 @@ void PointsDS::SetPointNumber(int np)
 {
     if (np < 0)  return;
     nPoint_ = np;
-        pointsVec_.resize(np);
+    pointsVec_.resize(np);
 }
 
 /**

+ 0 - 0
CAE_Solution/src/VTK/mesh/PointDS.h → CAE_Solution/src/VTK/MeshDS/PointDS.h


+ 1 - 1
CAE_Solution/src/VTK/mesh/meshbase.cpp → CAE_Solution/src/VTK/MeshDS/meshbase.cpp

@@ -1,4 +1,4 @@
-#include "meshbase.h"
+#include "MeshBase.h"
 
 
 

+ 1 - 1
CAE_Solution/src/VTK/mesh/meshstructured.cpp → CAE_Solution/src/VTK/MeshDS/meshstructured.cpp

@@ -1,4 +1,4 @@
-#include "meshstructured.h"
+#include "MeshStructured.h"
 
 
 

+ 1 - 1
CAE_Solution/src/VTK/mesh/meshstructured.h → CAE_Solution/src/VTK/MeshDS/meshstructured.h

@@ -1,7 +1,7 @@
 #ifndef MESHSTRUCTURED_H
 #define MESHSTRUCTURED_H
 
-#include "meshbase.h"
+#include "MeshBase.h"
 
 
 

+ 401 - 0
CAE_Solution/src/VTK/MeshDS/meshunstructured.cpp

@@ -0,0 +1,401 @@
+#include "CellDS.h"
+#include "MeshUnstructured.h"
+
+
+
+/**
+  * @brief the constructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
+MeshUnstructured::MeshUnstructured() : MeshBase()
+{
+    meshType_ = Unstructured;
+    nCell_ = 0;
+    nLine_ = 0;
+    nTri_ = 0;
+    nQuad_ = 0;
+    nTetra_ = 0;
+    nPyramid_ = 0;
+    nPrism_ = 0;
+    nHexa_ = 0;
+}
+
+/**
+  * @brief the destructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
+MeshUnstructured::~MeshUnstructured()
+{
+    for (vector<CellBase*>::iterator it = allCellsVec_.begin(); it != allCellsVec_.end(); ++it)
+    {
+        delete (*it);
+    }
+    allCellsVec_.clear();
+    lineCellsVec_.clear();
+    triangleCellsVec_.clear();
+    quadCellsVec_.clear();
+    tetraCellsVec_.clear();
+    pyramidCellsVec_.clear();
+    prismCellsVec_.clear();
+    hexaCellsVec_.clear();
+}
+
+/**
+  * @brief get cell number in mesh.
+  *
+  * @param[in] 
+  * @return return cell number.
+  * @author shiting
+  * @date 20220721
+  */
+void MeshUnstructured::SetCellNumber(size_t num)
+{
+    allCellsVec_.resize(num, 0);
+}
+
+/**
+  * @brief update a cell.
+  *
+  * @param[in] the input cell, cell position.
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
+void MeshUnstructured::SetCell(size_t id, const CellBase *cell)
+{
+    if (!cell)  return;
+    CellType type = cell->GetType();
+    CellBase *newCell = 0;
+    if (type == LineCell)
+    {
+        newCell = new CellLine;
+        lineCellsVec_.push_back(newCell);
+        ++nLine_;
+    }
+    else if (type == TriangleCell)
+    {
+        newCell = new CellTriangle;
+        triangleCellsVec_.push_back(newCell);
+        ++nTri_;
+    }
+    else if (type == QuadCell)
+    {
+        newCell = new CellQuad;
+        quadCellsVec_.push_back(newCell);
+        ++nQuad_;
+    }
+    else if (type == TetraCell)
+    {
+        newCell = new CellTetra;
+        tetraCellsVec_.push_back(newCell);
+        ++nTetra_;
+    }
+    else if (type == PyramidCell)
+    {
+        newCell = new CellPyramid;
+        pyramidCellsVec_.push_back(newCell);
+        ++nPyramid_;
+    }
+    else if (type == PrismCell)
+    {
+        newCell = new CellPrism;
+        prismCellsVec_.push_back(newCell);
+        ++nPrism_;
+    }
+    else if (type == HexaCell)
+    {
+        newCell = new CellHexa;
+        hexaCellsVec_.push_back(newCell);
+        ++nHexa_;
+    }
+    size_t np = cell->GetPointNumber();
+    for (size_t i = 0; i < np; ++i)
+    {
+        newCell->SetPoint(i, cell->GetPoint(i));
+    }
+    int tag = cell->GetTag();
+    if (tag != NULLTAG)
+    {
+        newCell->SetTag(tag);
+        InsertPatchTag(tag);
+    }
+    if (id < allCellsVec_.size()) //set cell.
+    {
+        if (allCellsVec_[id]) delete allCellsVec_[id];
+        allCellsVec_[id] = newCell;
+    }
+    else  //append cell.
+    {
+        allCellsVec_.push_back(newCell);
+    }
+    ++nCell_;
+}
+
+/**
+  * @brief append a cell to this mesh.
+  *
+  * @param[in] the input cell.
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
+void MeshUnstructured::AppendCell(const CellBase *cell)
+{
+    SetCell(nCell_, cell);
+}
+
+/**
+  * @brief get a cell from mesh.
+  *
+  * @param[in] the cell id.
+  * @return the cell.
+  * @author shiting
+  * @date 20220721
+  */
+const CellBase* MeshUnstructured::GetCell(size_t id)
+{
+    if (id < allCellsVec_.size()) return allCellsVec_.at(id);
+    return 0;
+}
+
+/**
+  * @brief get the cell number.
+  *
+  * @param[in] 
+  * @return the cell number in mesh.
+  * @author shiting
+  * @date 20220801
+  */
+size_t MeshUnstructured::GetCellNumber()
+{
+    return nCell_;
+}
+
+/**
+  * @brief get line cell number in mesh.
+  *
+  * @param[in] 
+  * @return return line cell number.
+  * @author shiting
+  * @date 20220721
+  */
+size_t MeshUnstructured::GetLineNumber()
+{
+    return nLine_;
+}
+
+/**
+  * @brief get triangle cell number in mesh.
+  *
+  * @param[in] 
+  * @return return triangle cell number.
+  * @author shiting
+  * @date 20220721
+  */
+size_t MeshUnstructured::GetTriangleNumber()
+{
+    return nTri_;
+}
+
+/**
+  * @brief get quad cell number in mesh.
+  *
+  * @param[in] 
+  * @return return quad cell number.
+  * @author shiting
+  * @date 20220721
+  */
+size_t MeshUnstructured::GetQuadNumber()
+{
+    return nQuad_;
+}
+
+/**
+  * @brief get tetra cell number in mesh.
+  *
+  * @param[in] 
+  * @return return tetra cell number.
+  * @author shiting
+  * @date 20220721
+  */
+size_t MeshUnstructured::GetTetraNumber()
+{
+    return nTetra_;
+}
+
+/**
+  * @brief get pyramid cell number in mesh.
+  *
+  * @param[in] 
+  * @return return pyramid cell number.
+  * @author shiting
+  * @date 20220721
+  */
+size_t MeshUnstructured::GetPyramidNumber()
+{
+    return nPyramid_;
+}
+
+/**
+  * @brief get prism cell number in mesh.
+  *
+  * @param[in] 
+  * @return return prism cell number.
+  * @author shiting
+  * @date 20220721
+  */
+size_t MeshUnstructured::GetPrismNumber()
+{
+    return nPrism_;
+}
+
+/**
+  * @brief get hexa cell number in mesh.
+  *
+  * @param[in] 
+  * @return return hexa cell number.
+  * @author shiting
+  * @date 20220721
+  */
+size_t MeshUnstructured::GetHexaNumber()
+{
+    return nHexa_;
+}
+
+/**
+  * @brief set cell tag.
+  *
+  * @param[in] cell id, tag.
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
+void MeshUnstructured::SetCellTag(size_t id, int tag)
+{
+    if (id >= nCell_) return;
+    allCellsVec_.at(id)->SetTag(tag);
+    InsertPatchTag(tag);
+}
+
+/**
+  * @brief get cell tag.
+  *
+  * @param[in] cell id
+  * @return cell tag.
+  * @author shiting
+  * @date 20220721
+  */
+int MeshUnstructured::GetCellTag(size_t id)
+{
+    if (id >= nCell_) return -999;
+    return allCellsVec_.at(id)->GetTag();
+}
+
+/**
+  * @brief get a line cell from mesh.
+  *
+  * @param[in] the line cell id.
+  * @return the line cell.
+  * @author shiting
+  * @date 20230413
+  */
+const CellBase* MeshUnstructured::GetLineCell(size_t lineId)
+{
+    if (lineId < lineCellsVec_.size()) return lineCellsVec_.at(lineId);
+    return 0;
+}
+
+/**
+  * @brief get a tri cell from mesh.
+  *
+  * @param[in] the tri cell id.
+  * @return the tri cell.
+  * @author shiting
+  * @date 20230413
+  */
+const CellBase* MeshUnstructured::GetTriangleCell(size_t triId)
+{
+    if (triId < triangleCellsVec_.size()) return triangleCellsVec_.at(triId);
+    return 0;
+}
+
+/**
+  * @brief get a quad cell from mesh.
+  *
+  * @param[in] the quad cell id.
+  * @return the quad cell.
+  * @author shiting
+  * @date 20230413
+  */
+const CellBase* MeshUnstructured::GetQuadCell(size_t quadId)
+{
+    if (quadId < quadCellsVec_.size()) return quadCellsVec_.at(quadId);
+    return 0;
+}
+
+/**
+  * @brief get a tetra cell from mesh.
+  *
+  * @param[in] the tetra cell id.
+  * @return the tetra cell.
+  * @author shiting
+  * @date 20230413
+  */
+const CellBase* MeshUnstructured::GetTetraCell(size_t tetraId)
+{
+    if (tetraId < tetraCellsVec_.size()) return tetraCellsVec_.at(tetraId);
+    return 0;
+}
+
+/**
+  * @brief get a pyramid cell from mesh.
+  *
+  * @param[in] the pyramid cell id.
+  * @return the pyramid cell.
+  * @author shiting
+  * @date 20230413
+  */
+const CellBase* MeshUnstructured::GetPyramidCell(size_t pyramidId)
+{
+    if (pyramidId < pyramidCellsVec_.size()) return pyramidCellsVec_.at(pyramidId);
+    return 0;
+}
+
+/**
+  * @brief get a prism cell from mesh.
+  *
+  * @param[in] the prism cell id.
+  * @return the prism cell.
+  * @author shiting
+  * @date 20230413
+  */
+const CellBase* MeshUnstructured::GetPrismCell(size_t prismId)
+{
+    if (prismId < prismCellsVec_.size()) return prismCellsVec_.at(prismId);
+    return 0;
+}
+
+/**
+  * @brief get a hexa cell from mesh.
+  *
+  * @param[in] the hexa cell id.
+  * @return the hexa cell.
+  * @author shiting
+  * @date 20230413
+  */
+const CellBase* MeshUnstructured::GetHexaCell(size_t hexaId)
+{
+    if (hexaId < hexaCellsVec_.size()) return hexaCellsVec_.at(hexaId);
+    return 0;
+}
+
+
+

+ 8 - 17
CAE_Solution/src/VTK/mesh/meshunstructured.h → CAE_Solution/src/VTK/MeshDS/meshunstructured.h

@@ -6,7 +6,7 @@
 using namespace std;
 
 #include "CellDS.h"
-#include "meshbase.h"
+#include "MeshBase.h"
 
 
 
@@ -30,20 +30,13 @@ public:
     size_t GetHexaNumber();
     void SetCellTag(size_t id, int tag);
     int GetCellTag(size_t id);
-
-    //faces info for hoops shell.
-    void AllocateShellFaces();
-    const int* ShellFacesData(int &nface);
-    void DeallocateShellFaces();
-    //
-private:
-    void AllocateLineCells();
-    void AllocateTriangleCells();
-    void AllocateQuadCells();
-    void AllocateTeteaCells();
-    void AllocatePyramidCells();
-    void AllocatePrismCells();
-    void AllocateHexaCells();
+    const CellBase* GetLineCell(size_t lineId);
+    const CellBase* GetTriangleCell(size_t triId);
+    const CellBase* GetQuadCell(size_t quadId);
+    const CellBase* GetTetraCell(size_t tetraId);
+    const CellBase* GetPyramidCell(size_t pyramidId);
+    const CellBase* GetPrismCell(size_t prismId);
+    const CellBase* GetHexaCell(size_t hexaId);
 
 protected:
     size_t nCell_;
@@ -62,8 +55,6 @@ protected:
     vector<CellBase*> pyramidCellsVec_;
     vector<CellBase*> prismCellsVec_;
     vector<CellBase*> hexaCellsVec_;
-    //hoops shell facees list.
-    vector<int>       shellFacesVec_;
 };
 
 

+ 2 - 1
CAE_Solution/src/VTK/VTK.pri

@@ -2,4 +2,5 @@ include( $$PWD/Manager/Manager.pri)#管理类
 include( $$PWD/mesh/mesh.pri)#存储几何数据的类
 include( $$PWD/QVTKRenderer/QVTKRenderer.pri)#封装vtkrenderer的渲染类
 include( $$PWD/visualization_VTK/visualization_VTK.pri)#接口,切片,管理相机,数据存储,捕获渲染图等
-
+include( $$PWD/display/display.pri)#等值线、标量等
+include( $$PWD/meshds/meshds.pri)

+ 42 - 0
CAE_Solution/src/VTK/display/contourdisplay.cpp

@@ -0,0 +1,42 @@
+#include "contourdisplay.h"
+#include <QDebug>
+
+
+ContourDisplay::ContourDisplay()
+{
+    //ResultMeshManager::getInstance()->SetCotourWidget(static_cast<ContourDisplayW*>(m_pWidget));
+    //ResultMeshManager::getInstance()->SetWidgetRange();       //设置从页面获取的范围 range maxrange minrange
+    //ResultMeshManager::getInstance()->SetWidgetScalarName();   //获取页面上的combox的scalarname
+}
+
+ContourDisplay::~ContourDisplay()
+{
+}
+
+void ContourDisplay::updateFromInters()
+{
+    //update setting data from widgets.
+}
+
+void ContourDisplay::updateToInters()
+{
+
+}
+
+void ContourDisplay::updateFromParams()
+{
+    //update setting data from params.
+}
+
+void ContourDisplay::contourdisplay_execute()
+{
+
+    //apply setting data.
+    //ResultMeshManager::getInstance()->ModifyScalarDisplay(static_cast<ContourDisplayW*>(m_pWidget)->GetScalarName());//传入参数combox的current text(scalar name)
+    //ResultMeshManager::getInstance()->SetLevel(static_cast<ContourDisplayW*>(m_pWidget)->GetLevel());//传level的值,初始默认值为10
+    //ResultMeshManager::getInstance()->SetRange(static_cast<ContourDisplayW*>(m_pWidget)->GetRange());//
+
+    //ResultMeshManager::getInstance()->SetDisplayType(0);
+    //ResultMeshManager::getInstance()->DisplayMeshByIndex(ResultMeshManager::getInstance()->GetCurrIndex());
+}
+

+ 24 - 0
CAE_Solution/src/VTK/display/contourdisplay.h

@@ -0,0 +1,24 @@
+#ifndef CONTOURDISPLAY_H
+#define CONTOURDISPLAY_H
+
+#include <QObject>
+#include "../Manager/ResultMeshManager.h"
+
+
+class ContourDisplay
+{
+public:
+    ContourDisplay();
+    ~ContourDisplay();
+    QString getName() {
+        return QObject::tr("Contour");
+    }
+    void updateFromInters();
+    void updateFromParams();
+    void updateToInters();
+    void contourdisplay_execute();
+private:
+    //ResultMeshManager* Cmanager;
+};
+
+#endif

+ 10 - 0
CAE_Solution/src/VTK/display/display.pri

@@ -0,0 +1,10 @@
+HEADERS += \ 
+    $$PWD/*.h
+
+
+
+		
+		
+SOURCES += \ 
+     $$PWD/*.cpp
+

+ 37 - 0
CAE_Solution/src/VTK/display/linedisplay.cpp

@@ -0,0 +1,37 @@
+#include "linedisplay.h"
+
+
+
+LineDisplay::LineDisplay()
+{
+    //ResultMeshManager::getInstance()->SetLineWidget(static_cast<LineDisplayW*>(m_pWidget));
+}
+
+LineDisplay::~LineDisplay()
+{
+}
+
+
+
+void LineDisplay::updateFromInters()
+{
+    //update setting data from widgets.
+}
+
+void LineDisplay::updateFromParams()
+{
+}
+
+void LineDisplay::linedisplay_execute()
+{ 
+    //string str = static_cast<LineDisplayW*>(m_pWidget)->GetScalarName();
+    //if (!str.empty())
+        //{
+    //ResultMeshManager::getInstance()->ModifyScalarDisplay(static_cast<LineDisplayW*>(m_pWidget)->GetScalarName());
+    //ResultMeshManager::getInstance()->SetLevel(static_cast<LineDisplayW*>(m_pWidget)->GetLevel());
+    //ResultMeshManager::getInstance()->SetRange(static_cast<LineDisplayW*>(m_pWidget)->GetRange());
+    //ResultMeshManager::getInstance()->SetDisplayType(2);
+    //ResultMeshManager::getInstance()->DisplayMeshByIndex(ResultMeshManager::getInstance()->GetCurrIndex());
+    //}
+}
+

+ 22 - 0
CAE_Solution/src/VTK/display/linedisplay.h

@@ -0,0 +1,22 @@
+#pragma once
+
+#include <QObject>
+
+#include "../manager/ResultMeshManager.h"
+
+
+
+class LineDisplay
+{
+public:
+    LineDisplay();
+    virtual ~LineDisplay();
+    virtual QString getName() { return QObject::tr("Line"); }
+
+    virtual void updateFromInters();
+    virtual void updateFromParams();
+    virtual void linedisplay_execute();
+private:
+
+};
+

+ 35 - 0
CAE_Solution/src/VTK/display/slicewidget.cpp

@@ -0,0 +1,35 @@
+#include "slicewidget.h"
+#include "../manager/ResultMeshManager.h"
+
+
+SliceWidget::SliceWidget()
+{
+}
+
+SliceWidget::~SliceWidget()
+{
+}
+
+void SliceWidget::updateFromInters()
+{
+    //update setting data from widgets.
+}
+
+void SliceWidget::updateFromParams()
+{
+
+}
+
+void SliceWidget::slicewidget_execute()
+{
+    //apply setting data.
+//    ResultMeshManager::getInstance()->InitSliceWidget();
+//        int index = static_cast<SsliceWidget*>(m_pWidget)->GetOldIndex();
+//        ResultMeshManager::getInstance()->SetAllSliceState(static_cast<SsliceWidget*>(m_pWidget)->GetSliceId(), static_cast<SsliceWidget*>(m_pWidget)->GetSolidState(),
+//                                                           static_cast<SsliceWidget*>(m_pWidget)->GetPlaneWidgetState(), static_cast<SsliceWidget*>(m_pWidget)->GetNormal(),
+//                                                           static_cast<SsliceWidget*>(m_pWidget)->GetPosition(), static_cast<SsliceWidget*>(m_pWidget)->GetType(),
+//                                                           static_cast<SsliceWidget*>(m_pWidget)->GetVName(),static_cast<SsliceWidget*>(m_pWidget)->GetLevel(),
+//                                                           static_cast<SsliceWidget*>(m_pWidget)->GetPlaneState(), static_cast<SsliceWidget*>(m_pWidget)->GetLabelState());
+//        static_cast<SsliceWidget*>(m_pWidget)->SetCurrWidget(index);
+}
+

+ 16 - 0
CAE_Solution/src/VTK/display/slicewidget.h

@@ -0,0 +1,16 @@
+#pragma once
+#include <QObject>
+
+class SliceWidget
+{
+public:
+    SliceWidget();
+    virtual ~SliceWidget();
+    virtual QString getName() { return QObject::tr("Slice"); }
+
+    virtual void updateFromInters();
+    virtual void updateFromParams();
+    virtual void slicewidget_execute();
+private:
+
+};

+ 32 - 0
CAE_Solution/src/VTK/display/solidsurfacewidget.cpp

@@ -0,0 +1,32 @@
+#include "solidsurfacewidget.h"
+
+SolidSurface::SolidSurface()
+{
+//ResultMeshManager::getInstance()->SetSurfaceSolidWidget(static_cast<SolidSurfaceWidget*>(m_pWidget));
+}
+
+SolidSurface::~SolidSurface()
+{
+}
+
+void SolidSurface::updateFromInters()
+{
+    //update setting data from widgets.
+}
+
+void SolidSurface::updateFromParams()
+{
+
+}
+
+void SolidSurface::solidsurfce_execute()
+{
+    //apply setting data.
+//    ResultMeshManager::getInstance()->SetSurfaceShowHideFlag(static_cast<SolidSurfaceWidget*>(m_pWidget)->GetShowHideState());
+//        ResultMeshManager::getInstance()->SetSurfaceColor(static_cast<SolidSurfaceWidget*>(m_pWidget)->GetColor());
+//        ResultMeshManager::getInstance()->SetSurfaceTransparency(static_cast<SolidSurfaceWidget*>(m_pWidget)->GetTransparency());
+//        ResultMeshManager::getInstance()->DisplayMeshByIndex(ResultMeshManager::getInstance()->GetCurrIndex());
+
+}
+
+

+ 18 - 0
CAE_Solution/src/VTK/display/solidsurfacewidget.h

@@ -0,0 +1,18 @@
+#pragma once
+#include <QObject>
+#include "../manager/ResultMeshManager.h"
+
+class SolidSurface
+{
+public:
+    SolidSurface();
+    virtual ~SolidSurface();
+    virtual QString getName() { return QObject::tr("SolidSurface"); }
+
+    virtual void updateFromInters();
+    virtual void updateFromParams();
+    virtual void solidsurfce_execute();
+private:
+
+};
+

+ 38 - 0
CAE_Solution/src/VTK/display/streamwidget.cpp

@@ -0,0 +1,38 @@
+#include "streamwidget.h"
+#include "../manager/ResultMeshManager.h"
+
+StreamWidget::StreamWidget()
+{
+
+   // ResultMeshManager::getInstance()->SetStremWidget(static_cast<StreamWidget*>(m_pWidget));
+}
+StreamWidget::~StreamWidget()
+{
+}
+
+
+void StreamWidget::updateFromInters()
+{
+    //update setting data from widgets.
+}
+
+void StreamWidget::updateFromParams()
+{
+    //update setting data from params.
+
+}
+
+void StreamWidget::StreamWidget_execute()
+{
+
+    //apply setting data.
+//    ResultMeshManager::getInstance()->DisplayStreamLine(static_cast<StreamWidget*>(m_pWidget)->GetDirection(),
+//                                                        static_cast<StreamWidget*>(m_pWidget)->GetType(),
+//                                                        static_cast<StreamWidget*>(m_pWidget)->GetInitStepData(),
+//                                                        static_cast<StreamWidget*>(m_pWidget)->GetMaxPropgationData(),
+//                                                        static_cast<StreamWidget*>(m_pWidget)->GetMinStepData(),
+//                                                        static_cast<StreamWidget*>(m_pWidget)->GetShowHideState(),
+//                                                        static_cast<StreamWidget*>(m_pWidget)->GetToolState());
+
+}
+

+ 21 - 0
CAE_Solution/src/VTK/display/streamwidget.h

@@ -0,0 +1,21 @@
+#pragma once
+
+#include <QObject>
+
+
+
+
+class StreamWidget
+{
+public:
+    StreamWidget();
+    virtual ~StreamWidget();
+    virtual QString getName() { return QObject::tr("Stream"); }
+
+    virtual void updateFromInters();
+    virtual void updateFromParams();
+    virtual void StreamWidget_execute();
+private:
+
+};
+

+ 29 - 0
CAE_Solution/src/VTK/display/vectordisplay.cpp

@@ -0,0 +1,29 @@
+#include "vectordisplay.h"
+
+Vectordisplay::Vectordisplay()
+{
+    //ResultMeshManager::getInstance()->SetVectorWidget(static_cast<VectorW*>(m_pWidget));
+}
+Vectordisplay::~Vectordisplay()
+{
+}
+
+void Vectordisplay::updateFromInters()
+{
+    //update setting data from widgets.
+}
+
+void Vectordisplay::updateFromParams()
+{
+
+}
+
+void Vectordisplay::vectordisplay_execute()
+{
+
+    //apply setting data.
+    //ResultMeshManager::getInstance()->SetDisplayType(3);
+    //ResultMeshManager::getInstance()->SetVectorScaleFactor(static_cast<VectorW*>(m_pWidget)->GetScaleFactor());
+    //ResultMeshManager::getInstance()->SetVectorScalarIndex(static_cast<VectorW*>(m_pWidget)->GetUVWIndex());
+}
+

+ 18 - 0
CAE_Solution/src/VTK/display/vectordisplay.h

@@ -0,0 +1,18 @@
+#pragma once
+#include <QObject>
+#include "../manager/ResultMeshManager.h"
+
+class Vectordisplay
+{
+public:
+    Vectordisplay();
+    virtual ~Vectordisplay();
+    virtual QString getName() { return QObject::tr("Contour"); }
+
+    virtual void updateFromInters();
+    virtual void updateFromParams();
+    virtual void vectordisplay_execute();
+private:
+
+};
+

+ 342 - 0
CAE_Solution/src/VTK/mesh/Mesh_CSDInp.cpp

@@ -0,0 +1,342 @@
+//#include <iostream>
+#include <fstream>
+#include <algorithm>
+#include <sstream>
+#include "../MeshDS/PointDS.h"
+#include "../MeshDS/MeshUnstructured.h"
+#include "Mesh_CSDInp.h"
+
+
+
+/**
+  * @brief the constructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20230407
+  */
+Mesh_CSDInp::Mesh_CSDInp() : Mesh()
+{
+}
+
+/**
+  * @brief the destructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20230407
+  */
+Mesh_CSDInp::~Mesh_CSDInp()
+{
+}
+
+/**
+  * @brief load inp ascii file.
+  *
+  * @param[in] the input inp file.
+  * @return loading is successful or not.
+  * @author shiting
+  * @date 20230407
+  */
+bool Mesh_CSDInp::Load_Ascii(const string &gridFile)
+{
+    ifstream infile(gridFile);
+    string line;
+    while (getline(infile, line))
+    {
+        line.erase(0, line.find_first_not_of(' '));
+        if (line.substr(0, 5) == "*NODE")
+        {
+            loadNodes(infile);
+            break;
+        }
+    }
+    if (!infile.good())  return false;
+
+    zoneNumber_ = 1;
+    MeshUnstructured *unMesh = new MeshUnstructured;
+    unMesh->SetPoints(zonePointsVec_.at(0));
+    zoneMeshVec_.push_back(unMesh);
+
+    while (getline(infile, line))
+    {
+        line.erase(0, line.find_first_not_of(' '));
+        if (line.substr(0, 8) == "*ELEMENT")
+        {
+            //cout << line << endl;
+            string eleType = getElementType(line);
+            //cout << eleType << endl;
+            loadElements(infile, eleType);
+        }
+    }
+    return true;
+}
+
+/**
+  * @brief load node data from inp.
+  *
+  * @param[in] the input stream.
+  * @return load successfully or not.
+  * @author: shiting
+  * @date: 20230407
+  * @reviser: 
+  * @date: 
+  */
+bool Mesh_CSDInp::loadNodes(ifstream &infile)
+{
+    if (infile.peek() == '*')  return true;
+    map<int, vector<double> > idNodeMap;
+    string line;
+    while (getline(infile, line))
+    {
+        line.erase(0, line.find_first_not_of(' '));
+        string::size_type pos = line.find_first_of(',');
+        if (pos != std::string::npos)
+        {
+            std::replace(line.begin(), line.end(), ',', ' ');
+        }
+        int id;
+        vector<double> xyz(3);
+        stringstream ss(line);
+        if (ss >> id >> xyz[0] >> xyz[1] >> xyz[2])
+        {
+            idNodeMap[id] = xyz;
+        }
+
+        if (infile.peek() == '*')
+        {
+            break;
+        }
+    }
+
+    int nPoint = idNodeMap.size();
+    //cout << "np = " << nPoint << endl;
+    PointsDS *points = new PointsDS;
+    points->SetPointNumber(nPoint);
+    nodeId2PointIdMap_.clear();
+    int i = 0;
+    for (map<int, vector<double> >::iterator it = idNodeMap.begin(); it != idNodeMap.end(); ++it)
+    {
+        points->SetPoint(i, it->second.at(0), it->second.at(1), it->second.at(2));
+        nodeId2PointIdMap_[it->first] = i;
+        ++i;
+    }
+    zonePointsVec_.push_back(points);
+
+    return true;
+}
+
+/**
+  * @brief load element data from inp.
+  *
+  * @param[in] the input stream.
+  * @return load successfully or not.
+  * @author: shiting
+  * @date: 20230407
+  * @reviser: 
+  * @date: 
+  */
+bool Mesh_CSDInp::loadElements(ifstream &infile, const string &eleType)
+{
+    if (infile.peek() == '*')  return true;
+    int nn;
+    int np;
+    CellBase *cell = 0;
+    if (eleType == "C3D8" || eleType == "F3D8" || eleType == "C3D8R" || eleType == "C3D8I")
+    {
+        nn = 8+1;
+        np = 8;
+        cell = new CellHexa;
+    }
+    else if (eleType == "C3D20" || eleType == "C3D20R")
+    {
+        nn = 20+1;
+        np = 8;
+        cell = new CellHexa;
+    }
+    else if (eleType == "C3D6" || eleType == "F3D6")
+    {
+        nn = 6+1;
+        np = 6;
+        cell = new CellPyramid;
+    }
+    else if (eleType == "C3D15")
+    {
+        nn = 15+1;
+        np = 6;
+        cell = new CellPyramid;
+    }
+    else if (eleType == "C3D4" || eleType == "F3D4")
+    {
+        nn = 4+1;
+        np = 4;
+        cell = new CellTetra;
+    }
+    else if (eleType == "C3D10" || eleType == "C3D10T")
+    {
+        nn = 10+1;
+        np = 4;
+        cell = new CellTetra;
+    }
+    else if (eleType == "S3")
+    {
+        nn = 3+1;
+        np = 3;
+        cell = new CellTriangle;
+    }
+    else if (eleType == "S6")
+    {
+        nn = 6+1;
+        np = 3;
+        cell = new CellTriangle;
+    }
+    else if (eleType == "S4" || eleType == "S4R")
+    {
+        nn = 4+1;
+        np = 4;
+        cell = new CellQuad;
+    }
+    else if (eleType == "S8" || eleType == "S8R")
+    {
+        nn = 8+1;
+        np = 4;
+        cell = new CellQuad;
+    }
+    else if (eleType == "B21" || eleType == "B31" || eleType == "B31R")
+    {
+        nn = 2+1;
+        np = 2;
+        cell = new CellLine;
+    }
+    else
+    {
+        //unsuppored type
+        return false;
+    }
+
+    MeshUnstructured *mesh = dynamic_cast<MeshUnstructured*>(zoneMeshVec_.at(0));
+    int curNN = 0;
+    int curNP = 0;
+    string line;
+    while (getline(infile, line))
+    {
+        line.erase(0, line.find_first_not_of(' '));
+        string::size_type pos = line.find_first_of(',');
+        if (pos != std::string::npos)
+        {
+            std::replace(line.begin(), line.end(), ',', ' ');
+        }
+        stringstream ss(line);
+        int id;
+        while (curNN < nn)
+        {
+            if (curNN == 0)
+            {
+                ss >> id;
+                ++curNN;
+                continue;
+            }
+            while (ss >> id)
+            {
+                if (curNP < np)
+                {
+                    cell->SetPoint(curNP, nodeId2PointIdMap_[id]);
+                    ++curNP;
+                }
+                ++curNN;
+            }
+            break;
+        }
+        if (curNN == nn)
+        {
+            mesh->AppendCell(cell);
+            curNN = 0;
+            curNP = 0;
+        }
+
+        if (infile.peek() == '*')
+        {
+            break;
+        }
+    }
+    delete cell;
+    //cout << "ne = " << mesh->GetCellNumber() << endl;
+    return true;
+}
+
+/**
+  * @brief get element type from element line.
+  *
+  * @param[in] element header line.
+  * @return the element type
+  * @author: shiting
+  * @date: 20230410
+  * @reviser: 
+  * @date: 
+  */
+string Mesh_CSDInp::getElementType(const string &eleLine)
+{
+    string line(eleLine);
+    line.erase(std::remove(line.begin(), line.end(), ' '), line.end());
+    string key("TYPE");
+    string::iterator pos = std::search(line.begin(), line.end(), key.begin(), key.end());
+    if (pos == line.end())  return "none";
+    string::iterator start = pos + 5;
+    int n = 0;
+    for (string::iterator it = start; it != line.end(); ++it)
+    {
+        if (*it != ',')  ++n;
+        else break;
+    }
+    if (n == 0)  return "none";
+    return line.substr(start-line.begin(), n);
+}
+
+/**
+  * @brief load inp binary file.
+  *
+  * @param[in] the input inp file.
+  * @return loading is successful or not.
+  * @author shiting
+  * @date 20230407
+  */
+bool Mesh_CSDInp::Load_Binary(const string &gridFile)
+{
+    ifstream infile(gridFile);
+    return true;
+}
+
+/**
+  * @brief save ascii inp file.
+  *
+  * @param[in] the output inp file.
+  * @return saving is successful or not.
+  * @author shiting
+  * @date 20230407
+  */
+bool Mesh_CSDInp::Save_Ascii(const string &gridFile)
+{
+    //predefine interface.
+    ofstream outfile(gridFile);
+    return true;
+}
+
+/**
+  * @brief save binary inp file.
+  *
+  * @param[in] the output inp file.
+  * @return saving is successful or not.
+  * @author shiting
+  * @date 20230407
+  */
+bool Mesh_CSDInp::Save_Binary(const string &gridFile)
+{
+    //predefine interface.
+    ofstream outfile(gridFile);
+    return true;
+}
+
+
+

+ 32 - 0
CAE_Solution/src/VTK/mesh/Mesh_CSDInp.h

@@ -0,0 +1,32 @@
+#ifndef MESH_CSDInp_H
+#define MESH_CSDInp_H
+#include <string>
+#include <fstream>
+#include <map>
+using namespace std;
+#include "Mesh.h"
+
+
+
+class  Mesh_CSDInp : public Mesh
+{
+public:
+    Mesh_CSDInp();
+    virtual ~Mesh_CSDInp();
+
+    virtual bool Load_Ascii(const string &inpFile);
+    virtual bool Load_Binary(const string &inpFile);
+    virtual bool Save_Ascii(const string &inpFile);
+    virtual bool Save_Binary(const string &inpFile);
+private:
+    bool loadNodes(ifstream &infile);
+    bool loadElements(ifstream &infile, const string &eleType);
+    string getElementType(const string &eleLine);
+private:
+    map<int, int>  nodeId2PointIdMap_;
+};
+
+
+
+#endif
+

+ 1155 - 0
CAE_Solution/src/VTK/mesh/Mesh_Frd.cpp

@@ -0,0 +1,1155 @@
+#include <vtkDoubleArray.h>
+#include <cmath>
+
+#include "Mesh_Frd.h"
+#include <stdlib.h>
+
+
+
+/**
+  * @brief the constructor.
+  *
+  * @param[in]
+  * @return
+  * @author zhaoyu
+  * @date 20230323
+  */
+Mesh_Frd::Mesh_Frd() : Mesh()
+{
+    pointIdMap.clear();
+    cellIdMap.clear();
+    vectorNameVec.clear();
+    matrixNameVec.clear();
+    solveTimeVecl.clear();
+    scalarNameVec.clear();
+    solveTimeSet.clear();
+    meshVec.clear();
+    StepNameVec.clear();
+    timeNameMap.clear();
+    StepScalarMap.clear();
+    dispNameVec.clear();
+    cellVec.clear();
+    scalarType.clear();
+
+    modalTimeSet.clear();
+    modalMeshVec.clear();
+    StepModalNameVec.clear();
+    modalTimeNameMap.clear();
+    modalStepScalarMap.clear();
+}
+
+/**
+  * @brief the destructor.
+  *
+  * @param[in]
+  * @return
+  * @author zhaoyu
+  * @date 20230323
+  */
+Mesh_Frd::~Mesh_Frd()
+{
+    pointIdMap.clear();
+    cellIdMap.clear();
+    vectorNameVec.clear();
+    matrixNameVec.clear();
+    solveTimeVecl.clear();
+    scalarNameVec.clear();
+    solveTimeSet.clear();
+    StepScalarMap.clear();
+    for(int i = 0; i < meshVec.size(); i ++)
+    {
+        if (meshVec.at(i) != NULL)
+        {
+            delete meshVec.at(i);
+            meshVec.at(i) = NULL;
+        }
+    }
+    meshVec.clear();
+
+    StepNameVec.clear();
+    timeNameMap.clear();
+    dispNameVec.clear();
+    if (cellVec.size() != 0)
+    {
+        for (int i = 0; i < cellVec.size(); i ++)
+        {
+            delete cellVec.at(i);
+        }
+    }cellVec.clear();
+    scalarType.clear();
+
+    modalTimeSet.clear();
+    for(int i = 0; i < modalMeshVec.size(); i ++)
+    {
+        if (modalMeshVec.at(i) != NULL)
+        {
+            delete modalMeshVec.at(i);
+            modalMeshVec.at(i) = NULL;
+        }
+    }
+    modalMeshVec.clear();
+    StepModalNameVec.clear();
+    modalTimeNameMap.clear();
+    modalStepScalarMap.clear();
+}
+
+/**
+  * @brief load Frd ascii file.
+  *
+  * @param[in] the input frd file.
+  * @return loading is successful or not.
+  * @author zhaoyu
+  * @date 20230323
+  */
+bool Mesh_Frd::Load_Ascii(const string &gridFile)
+{
+    //cout << gridFile << endl;
+    ifstream infile;
+    infile.open(gridFile);
+    if (!infile.good())
+    {
+        cout<<"Source Frd File is not found!"<<endl;
+        return false;
+    }
+    string line;
+    line.clear();
+    title_ = (char*)MyGetFileName(gridFile).c_str();
+    unMesh = new MeshUnstructured;
+    //////////////////////////////////////////////////
+    //此版本默认读入模型只有一个zone
+    zoneNumber_ = 1;
+    zoneName_.clear();
+    zoneName_.push_back(MyGetFileName(gridFile));
+    //////////////////////////////////////////////////
+    while (line != "9999" && line != " 9999" && infile.peek() != EOF)
+    {
+        getline(infile, line);
+        RemoveSpace(line);
+        //cout << line << endl;
+        string flag = line.substr(0,3);
+        if (flag.find("1C") != string::npos || flag.find("1c")!= string::npos)
+        {
+
+        }else if (flag.find("2C")!= string::npos || flag.find("2c")!= string::npos)
+        {
+            string flag;
+            int nodesNum;
+            int format = 0;
+            vector<string> vec = MySplit(line, " ");
+            if (vec.size() < 3)
+            {
+                return false;
+            }
+
+            flag = vec.at(0);
+            nodesNum = atoi(vec.at(1).c_str());
+
+            format = atoi(vec.at(2).c_str());
+            //cout << flag << ", " << nodesNum << ", " << format << endl;
+
+            if (format != 2)//not binary
+            {
+                PointsDS* points = new PointsDS;
+                points->SetPointNumber(nodesNum);
+                getline(infile, line);
+                vec.clear();
+                MyReplace(line, "-", " -");
+                MyReplace(line, "E -", "E-");
+                RemoveSpace(line);
+                vec = MySplit(line, " ");
+                int i = 0;
+                while (vec.at(0) != "-3")
+                {
+                    if(vec.at(0) == "-1")
+                    {
+                        int pointId = stoi(vec.at(1));
+                        pointIdMap[pointId] = i;
+                        points->SetPoint(i, stod(vec.at(2)), stod(vec.at(3)), stod(vec.at(4)));
+                        i ++;
+                        getline(infile, line);
+                        vec.clear();
+                        MyReplace(line, "-", " -");
+                        MyReplace(line, "E -", "E-");
+                        RemoveSpace(line);
+                        vec = MySplit(line, " ");
+                    }
+                }
+                if (vec.at(0) == "-3")
+                {
+                    unMesh->SetPoints(points);
+                    zonePointsVec_.push_back(points);
+                    //cout << "the points data is read " << endl;
+                }
+            }
+        }else if (flag.find("3C")!= string::npos || flag.find("3c")!= string::npos)
+        {
+            string flag;
+            int elementNum = 0;
+            int format = 0;
+            int cellId = 0;
+
+            vector<string> vec = MySplit(line, " ");
+            if (vec.size() < 3)
+            {
+                return false;
+            }
+
+            flag = vec.at(0);
+            elementNum = atoi(vec.at(1).c_str());
+
+            format = atoi(vec.at(2).c_str());
+            //cout << flag << ", " << elementNum << ", " << format << endl;
+
+            if (format != 2)//not binary
+            {
+                unMesh->SetCellNumber(elementNum);
+                getline(infile, line);
+                vec.clear();
+                RemoveSpace(line);
+                vec = MySplit(line, " ");
+
+                int elmId = 0;
+                int elmType = 0;
+                int elmGroup = 0;
+                int elmMaterial = 0;
+                while (vec.at(0) != "-3")
+                {
+                    if (vec.at(0) == "-1")
+                    {
+                        elmId = stoi(vec.at(1));
+                        cellIdMap[elmId] = cellId;
+                        elmType = stoi(vec.at(2));
+                        elmGroup = stoi(vec.at(3));
+                        elmMaterial = stoi(vec.at(4));
+
+                        getline(infile, line);
+                        vec.clear();
+                        RemoveSpace(line);
+                        vec = MySplit(line, " ");
+                    }else if (vec.at(0) == "-2")
+                    {
+                        vector<double> dateVec;
+
+                        while (vec.at(0) == "-2")
+                        {
+                            for (int i = 1; i < vec.size(); i ++)
+                            {
+                                double value = stod(vec.at(i));
+                                dateVec.push_back(value);
+                            }
+                            getline(infile, line);
+                            vec.clear();
+                            RemoveSpace(line);
+                            vec = MySplit(line, " ");
+                        }
+                        SetCellData(unMesh, cellId, elmType, dateVec);
+                        cellId ++;
+                    }
+
+                    if (vec.at(0) == "-3")
+                    {
+                        zoneMeshVec_.push_back(unMesh);
+                        //cout << "the cells data is read " << endl;
+                    }
+                }
+            }
+        }else if (flag.find("1P")!= string::npos || flag.find("1p")!= string::npos)
+        {
+            vector<string> vec = MySplit(line, " ");
+            if (vec.size() < 4)
+            {
+                //cout << "parameter header load false"<<endl;
+                return false;
+            }
+            int id = stoi(vec.at(1));
+            int inc = stoi(vec.at(2));
+            int step = stoi(vec.at(3));
+            //cout << vec.at(0) << ", " << id << ", " << inc << ", " << step<<endl;
+            getline(infile, line);
+            RemoveSpace(line);
+            vec.clear();
+            vec = MySplit(line, " ");
+
+            int valueType = 0;
+            map<string, vector<string>> nameVec;
+            vector<string> scalarNameVec2;
+            string valueName_;
+            string strName;
+            vector<vector<double>> dataVec;
+            int sType = 0;
+            bool flagModel = false;
+            while (vec.at(0) != "-3")
+            {
+                if (vec.at(0).find("100C") != string::npos || vec.at(0).find("100c") != string::npos)
+                {
+                    if(vec.size() < 7)
+                    {
+                        cout << "result block load false"<<endl;
+                        return false;
+                    }
+
+                    string analysType = vec.at(5);
+                    if ((analysType.find("MODAL")!= string::npos) || (analysType.find("modal") != string::npos))
+                    {
+                        flagModel = true;
+                    }
+
+                    strName = vec.at(0).substr(4);
+                    strName += vec.at(1);
+
+                    //cout << strName<<endl;
+                    double timeVal = stod(vec.at(2));
+
+                    if (flagModel)
+                    {
+                        vector<string>::iterator it = find(StepModalNameVec.begin(), StepModalNameVec.end(), strName);
+                        if (it == StepModalNameVec.end())
+                        {
+                            StepModalNameVec.push_back(strName);
+                            modalTimeNameMap[timeVal] = strName;
+                        }
+                        modalTimeSet.insert(timeVal);
+                    }else
+                    {
+                        vector<string>::iterator it = find(StepNameVec.begin(), StepNameVec.end(), strName);
+                        if (it == StepNameVec.end())
+                        {
+                            StepNameVec.push_back(strName);
+                            timeNameMap[timeVal] = strName;
+                        }
+                        solveTimeSet.insert(timeVal);
+                    }
+                    int number = stoi(vec.at(3));
+                    if (number == unMesh->GetPoints()->GetPointNumber())
+                    {
+                        sType = 0;
+                    }else if (number == unMesh->GetCellNumber())
+                    {
+                        sType = 1;
+                    }
+                    int format = stoi(vec.at(6));
+                }else if (vec.at(0) == "-4")
+                {
+                    valueName_ = vec.at(1);
+                    int entitiesNum = stoi(vec.at(2));
+                    int irType = stoi(vec.at(3));//1 nodal data, material independent, 2 nodal data, material dependant, 3 element data at nodes
+                }else if (vec.at(0) == "-5")
+                {
+                    int menu = stoi(vec.at(2));
+                    valueType = stoi(vec.at(3));
+                    if (vec.at(1) != "ALL" && vec.at(1) != "all")
+                    {
+                        scalarNameVec2.push_back(vec.at(1));
+                    }
+                }else if (vec.at(0) == "-1")
+                {
+                    vector<double> dVec;
+                    dVec.clear();
+                    for (int i = 2; i < vec.size(); i ++)
+                    {
+                        dVec.push_back(stod(vec.at(i)));
+                    }
+                    dataVec.push_back(dVec);
+                }
+                getline(infile, line);
+                MyReplace(line, "-", " -");
+                MyReplace(line, "E -", "E-");
+                RemoveSpace(line);
+                vec.clear();
+                vec = MySplit(line, " ");
+            }
+            if (vec.at(0) == "-3")
+            {
+                nameVec[valueName_] = scalarNameVec2;
+
+                if (flagModel)
+                {
+                    if (modalStepScalarMap.count(strName) == 0)
+                    {
+                        vector<map<string, double*>> vec;
+                        vec.push_back(SetScalarData(valueName_, scalarNameVec2, valueType, dataVec, sType));
+                        modalStepScalarMap[strName] = vec;
+                    }else
+                    {
+                        map<string, vector<map<string, double*>>>::iterator it;
+                        it = modalStepScalarMap.find(strName);
+                        it->second.push_back(SetScalarData(valueName_, scalarNameVec2, valueType, dataVec, sType));
+                    }
+                }else
+                {
+                    if (StepScalarMap.count(strName) == 0)
+                    {
+                        vector<map<string, double*>> vec;
+                        vec.push_back(SetScalarData(valueName_, scalarNameVec2, valueType, dataVec, sType));
+                        StepScalarMap[strName] = vec;
+                    }else
+                    {
+                        map<string, vector<map<string, double*>>>::iterator it;
+                        it = StepScalarMap.find(strName);
+                        it->second.push_back(SetScalarData(valueName_, scalarNameVec2, valueType, dataVec, sType));
+                    }
+                }
+
+                //cout << "result load down"<<endl;
+            }
+        }else
+        {
+
+        }
+    }cout << "over" << endl;
+    infile.close();
+
+    AllocateMeshSpace();
+    if (modalStepScalarMap.size() != 0)
+    {
+        AllocateModalMeshSpace();
+    }
+
+    cout << "analys over" << endl;
+    return true;
+}
+
+/**
+  * @brief load frd binary file.
+  *
+  * @param[in] the input frd file.
+  * @return loading is successful or not.
+  * @author zhaoyu
+  * @date 20230323
+  */
+bool Mesh_Frd::Load_Binary(const string &gridFile)
+{
+    ifstream infile;
+    infile.open(gridFile, ios::binary);
+
+    return true;
+}
+
+/**
+  * @brief save ascii ugrid file.
+  *
+  * @param[in] the output grid file.
+  * @return saving is successful or not.
+  * @author zhaoyu
+  * @date 20230323
+  */
+bool Mesh_Frd::Save_Ascii(const string &gridFile)
+{
+    //predefine interface.
+    ofstream outfile(gridFile);
+    return true;
+}
+
+/**
+  * @brief save binary ugrid file.
+  *
+  * @param[in] the output grid file.
+  * @return saving is successful or not.
+  * @author zhaoyu
+  * @date 20230323
+  */
+bool Mesh_Frd::Save_Binary(const string &gridFile)
+{
+    //predefine interface.
+    ofstream outfile(gridFile);
+    return true;
+}
+
+/**
+  * @brief remove extra space.
+  *
+  * @param[in]
+  * @return
+  * @author zhaoyu
+  * @date 20230323
+  */
+void Mesh_Frd::RemoveSpace(string &str)
+{
+    string::iterator it = str.begin();
+    while (it !=str.end()-1)
+    {
+        if(*it == ' ' && *(it+1) == ' ')
+        {
+            it = str.erase(it);
+        }else
+        {
+            it ++;
+        }
+    }
+}
+
+/**
+  * @brief split string.
+  *
+  * @param[in] string str
+  * @return vector<string> vec
+  * @author zhaoyu
+  * @date 20230324
+  */
+vector<string> Mesh_Frd::MySplit(string str, string split)
+{
+    vector<string> vec;
+    if ("" == str)
+        return vec;
+    char* strs = new char[str.length() + 1];
+    strcpy(strs, str.c_str());
+    char* s = new char[split.length() + 1];
+    strcpy(s, split.c_str());
+    char* p = strtok(strs, s);
+    while (p)
+    {
+        string str2 = p;
+        vec.push_back(str2);
+        p = strtok(NULL, s);
+    }
+    return vec;
+}
+
+/**
+  * @brief replace the oldStr with the nreStr in str, return the process str.
+  *
+  * @param[in] string str, string oldStr, string newStr
+  * @return return the process str
+  * @author zhaoyu
+  * @date 20230327
+  */
+string& Mesh_Frd::MyReplace(string& str, string oldStr, string newStr)
+{
+    for (string::size_type pos(0); pos != string::npos; pos += newStr.length())
+    {
+        if ((pos = str.find(oldStr, pos)) != string::npos)
+        {
+            str.replace(pos, oldStr.length(), newStr);
+        }else break;
+    }
+    return str;
+}
+
+/**
+  * @brief get the file name with the suffix removed.
+  *
+  * @param[in] string str
+  * @return return the fileName
+  * @author zhaoyu
+  * @date 20230327
+  */
+string Mesh_Frd::MyGetFileName(string str)
+{
+    int ps = str.find_last_of("/");
+    int pe = str.find_last_of(".");
+    string name = str.substr(ps+1, pe - ps - 1);
+    return name;
+}
+
+/**
+  * @brief creat cells to insert into un through the cellid, celltype, and celldata
+  *
+  * @param[in] MeshUnstructured* un, int cellId,int cellType, vector<double> pointIdData
+  * @return
+  * @author zhaoyu
+  * @date 20230328
+  */
+void Mesh_Frd::SetCellData(MeshUnstructured* un, int cellId,int cellType, vector<double> pointIdData)
+{
+    CellBase* cell = 0;
+    map<int, int>::iterator iter = pointIdMap.begin();
+    switch (cellType)
+    {
+    case 1:
+    {
+        cell = new CellHexa;
+        for (int i = 0; i < 8; i ++)
+        {
+            iter = pointIdMap.find(pointIdData.at(i));
+            if (iter != pointIdMap.end())
+            {
+                cell->SetPoint(i, iter->second);
+            }
+        }
+        break;
+    }
+    case 2:
+    {
+        cell = new CellPrism;
+        for (int i = 0; i < 6; i ++)
+        {
+            iter = pointIdMap.find(pointIdData.at(i));
+            if (iter != pointIdMap.end())
+            {
+                cell->SetPoint(i, iter->second);
+            }
+        }
+        break;
+    }
+    case 3:
+    {
+        cell = new CellTetra;
+        for (int i = 0; i < 4; i ++)
+        {
+            iter = pointIdMap.find(pointIdData.at(i));
+            if (iter != pointIdMap.end())
+            {
+                cell->SetPoint(i, iter->second);
+            }
+        }
+        break;
+    }
+    case 4:
+    {
+        cell = NULL;
+        break;
+    }
+    case 5:
+    {
+        cell = NULL;
+        break;
+    }
+    case 6:
+    {
+        cell = NULL;
+        break;
+    }
+    case 7:
+    {
+        cell = new CellTriangle;
+        for (int i = 0; i < 3; i ++)
+        {
+            iter = pointIdMap.find(pointIdData.at(i));
+            if (iter != pointIdMap.end())
+            {
+                cell->SetPoint(i, iter->second);
+            }
+        }
+        break;
+    }
+    case 8:
+    {
+        cell = NULL;
+        break;
+    }
+    case 9:
+    {
+        cell = new CellQuad;
+        for (int i = 0; i < 4; i ++)
+        {
+            iter = pointIdMap.find(pointIdData.at(i));
+            if (iter != pointIdMap.end())
+            {
+                cell->SetPoint(i, iter->second);
+            }
+        }
+        break;
+    }
+    case 10:
+    {
+        cell = NULL;
+        break;
+    }
+    default:
+    {
+        cell = NULL;
+        break;
+    }
+    }
+    if (un != NULL && cell != NULL)
+    {
+        cellVec.push_back(cell);
+        un->SetCell(cellId, cell);
+    }
+}
+
+MeshUnstructured* Mesh_Frd::GetBase()
+{
+    return unMesh;
+}
+
+/**
+  * @brief the return result is obtained by calculating the x,y,z given
+  *
+  * @param[in] double x, double y, double z
+  * @return double result
+  * @author zhaoyu
+  * @date 20230329
+  */
+double Mesh_Frd::GetDISPAllValue(double x, double y, double z)
+{
+    double result = sqrt(pow(x,2) + pow(y,2) + pow(z,2));
+    return result;
+}
+
+/**
+  * @brief the return result is obtained by calculating the m1,m2,m3,m4,m5,m6 given
+  *
+  * @param[in] double m1, double m2, double m3, double m4, double m5, double m6
+  * @return double result
+  * @author zhaoyu
+  * @date 20230329
+  */
+double Mesh_Frd::GetStressValue(double m1, double m2, double m3, double m4, double m5, double m6)
+{
+    double value = 0.0;
+    value = 1.0/sqrt(2.0)*sqrt(pow(m1-m2,2)+
+            pow(m2-m3,2)+pow(m3-m1,2)+6*(m4*m4+m5*m5+m6*m6));
+    return value;
+}
+
+/**
+  * @brief the return result is obtained by calculating the m1,m2,m3,m4,m5,m6 given
+  *
+  * @param[in] double m1, double m2, double m3, double m4, double m5, double m6
+  * @return double result
+  * @author zhaoyu
+  * @date 20230330
+  */
+double Mesh_Frd::GetTostrainValue(double m1, double m2, double m3, double m4, double m5, double m6)
+{
+    double value = 0.0;
+    value = 2.0/3.0/sqrt(2.0)*sqrt(pow(m1-m2,2)+
+            pow(m2-m3,2)+pow(m3-m1,2)+6*(m4*m4+m5*m5+m6*m6));
+    return value;
+}
+
+map<string, double*> Mesh_Frd::SetScalarData(string totalName, vector<string> sName, int type, vector<vector<double>>data, int sType)
+{
+    map<string, vector<double>> nameDataMap;
+    vector<vector<double>> totalVec;
+    map<string, double*> nameDataMap_;
+    vector<double*> totalVec_;
+    if (type == 1)
+    {
+        for (int i = 0; i < sName.size(); i ++)
+        {
+            vector<double> dataVec;
+            nameDataMap[sName.at(i)] = dataVec;
+            totalVec.push_back(dataVec);
+
+            double* value = new double[data.size()];
+            nameDataMap_[sName.at(i)] = value;
+            totalVec_.push_back(value);
+
+            scalarType[sName.at(i)] = sType;
+        }
+        for (int i = 0; i < data.size(); i ++)
+        {
+            for (int j = 0; j < data.at(i).size(); j ++)
+            {
+                totalVec.at(j).push_back(data.at(i).at(j));
+                totalVec_.at(j)[i] = data.at(i).at(j);
+            }
+        }
+    }else if (type == 2)
+    {
+        for (int i = 0; i < sName.size(); i ++)
+        {
+            vector<double> dataVec;
+            nameDataMap[sName.at(i)] = dataVec;
+            totalVec.push_back(dataVec);
+
+            double* value = new double[data.size()];
+            nameDataMap_[sName.at(i)] = value;
+            totalVec_.push_back(value);
+
+            scalarType[sName.at(i)] = sType;
+        }
+        if (totalName == "DISP" || totalName == "disp")//if vectorName is DISP, add a total value vector
+        {
+            dispNameVec = sName;
+            vector<double> dataVec;
+            nameDataMap[totalName] = dataVec;
+            totalVec.push_back(dataVec);
+
+            double* value = new double[data.size()];
+            nameDataMap_[totalName] = value;
+            totalVec_.push_back(value);
+
+            scalarType[totalName] = sType;
+        }
+        for (int i = 0; i < data.size(); i ++)
+        {
+            int j = 0;
+            for (j = 0; j < data.at(i).size(); j ++)
+            {
+                totalVec.at(j).push_back(data.at(i).at(j));
+                totalVec_.at(j)[i] = data.at(i).at(j);
+            }
+            if (totalName == "DISP" || totalName == "disp")
+            {
+                double value = GetDISPAllValue(data.at(i).at(0), data.at(i).at(1), data.at(i).at(2));
+                totalVec.at(j).push_back(value);
+                totalVec_.at(j)[i] = value;
+            }
+        }
+    }else if (type == 4)
+    {
+        for (int i = 0; i < sName.size(); i ++)
+        {
+            vector<double> dataVec;
+            nameDataMap[sName.at(i)] = dataVec;
+            totalVec.push_back(dataVec);
+
+            double* value = new double[data.size()];
+            nameDataMap_[sName.at(i)] = value;
+            totalVec_.push_back(value);
+
+            scalarType[sName.at(i)] = sType;
+        }
+        if (totalName == "STRESS" || totalName == "stress")
+        {
+            vector<double> dataVec;
+            nameDataMap[totalName] = dataVec;
+            totalVec.push_back(dataVec);
+
+            double* value = new double[data.size()];
+            nameDataMap_[totalName] = value;
+            totalVec_.push_back(value);
+
+            scalarType[totalName] = sType;
+        }
+        if (totalName == "TOSTRAIN" || totalName == "tostrain")
+        {
+            vector<double> dataVec;
+            nameDataMap[totalName] = dataVec;
+            totalVec.push_back(dataVec);
+
+            double* value = new double[data.size()];
+            nameDataMap_[totalName] = value;
+            totalVec_.push_back(value);
+
+            scalarType[totalName] = sType;
+        }
+        for (int i = 0; i < data.size(); i ++)
+        {
+            int j = 0;
+            for (j = 0; j < data.at(i).size(); j ++)
+            {
+                totalVec.at(j).push_back(data.at(i).at(j));
+                totalVec_.at(j)[i] = data.at(i).at(j);
+            }
+            if (totalName == "STRESS" || totalName == "stress")
+            {
+                double value = GetStressValue(data.at(i).at(0), data.at(i).at(1), data.at(i).at(2),
+                                              data.at(i).at(3), data.at(i).at(4), data.at(i).at(5));
+                totalVec.at(j).push_back(value);
+                totalVec_.at(j)[i] = value;
+            }
+            if (totalName == "TOSTRAIN" || totalName == "tostrain")
+            {
+                double value = GetTostrainValue(data.at(i).at(0), data.at(i).at(1), data.at(i).at(2),
+                                              data.at(i).at(3), data.at(i).at(4), data.at(i).at(5));
+                totalVec.at(j).push_back(value);
+                totalVec_.at(j)[i] = value;
+            }
+        }
+    }
+    return nameDataMap_;
+}
+
+void Mesh_Frd::AllocateMeshSpace()
+{
+    bool firstFlag = true;
+
+    for (int i = 0; i < solveTimeSet.size(); i ++)
+    {
+        Mesh* mesh = new Mesh_Frd;
+        meshVec.push_back(mesh);
+    }
+    set<double>::iterator it;
+
+    int meshId = 0;
+    for (it = solveTimeSet.begin(); it != solveTimeSet.end(); it ++)
+    {
+        meshVec.at(meshId)->SetZoneNumber(GetZoneNumber());//目前默认frd读出来是一个zone
+        meshVec.at(meshId)->SetZoneName(GetZoneName());
+        meshVec.at(meshId)->SetSovleTime(*it);
+
+        map<double, string>::iterator it2 = timeNameMap.find(*it);
+        if (it2 == timeNameMap.end())
+        {
+            cout << "not found" << endl;
+            return;
+        }
+        string stepName = it2->second;
+
+        map<string, vector<map<string, double*>>>::iterator it3 = StepScalarMap.find(stepName);//某一时间步的所有标量值
+        vector<map<string, double*>> scalarVec = it3->second;
+        MeshUnstructured* unMesh2 = new MeshUnstructured;
+
+        double *X = new double[unMesh->GetPoints()->GetPointNumber()];
+        double *Y = new double[unMesh->GetPoints()->GetPointNumber()];
+        double *Z = new double[unMesh->GetPoints()->GetPointNumber()];
+
+        PointsDS* p = new PointsDS;
+        p->SetPointNumber(unMesh->GetPoints()->GetPointNumber());
+        if (dispNameVec.size() != 0)
+        {
+            double* x;
+            double* y;
+            double* z;
+            for (int i = 0; i < scalarVec.size(); i ++)
+            {
+                if(scalarVec.at(i).count(dispNameVec.at(0)))
+                {
+                    map<string, double*>::iterator it3 = scalarVec.at(i).find(dispNameVec.at(0));
+                    x = it3->second;
+                    it3 = scalarVec.at(i).find(dispNameVec.at(1));
+                    y = it3->second;
+                    it3 = scalarVec.at(i).find(dispNameVec.at(2));
+                    z = it3->second;
+                }
+            }
+            PointsDS* p2 = unMesh->GetPoints();
+            for (int i = 0; i < p2->GetPointNumber(); i ++)
+            {
+                double xyz[3];
+                p2->GetPoint(i, xyz);
+                X[i] = xyz[0] + x[i];
+                Y[i] = xyz[1] + y[i];
+                Z[i] = xyz[2] + z[i];
+                p->SetPoint(i,X[i],Y[i],Z[i]);
+            }
+        }else
+        {
+            PointsDS* p2 = unMesh->GetPoints();
+            for (int i = 0; i < p2->GetPointNumber(); i ++)
+            {
+                double xyz[3];
+                p2->GetPoint(i, xyz);
+                X[i] = xyz[0];
+                Y[i] = xyz[1];
+                Z[i] = xyz[2];
+                p->SetPoint(i,X[i],Y[i],Z[i]);
+            }
+        }
+        unMesh2->SetPoints(p);
+
+        unMesh2->SetCellNumber(unMesh->GetCellNumber());
+        for (int i = 0; i < unMesh->GetCellNumber(); i ++)
+        {
+            unMesh2->SetCell(i, cellVec.at(i));
+        }
+        meshVec.at(meshId)->SetZoneMesh(unMesh2);
+
+        vector<double*> scalarData;
+        scalarData.clear();
+        scalarData.push_back(X);
+        scalarData.push_back(Y);
+        scalarData.push_back(Z);
+
+        if (firstFlag)//获取第一个mesh的标量名和顺序
+        {
+            for(int i = 0; i < scalarVec.size(); i ++)
+            {
+                map<string, double*>::iterator it4;
+                for (it4= scalarVec.at(i).begin(); it4 != scalarVec.at(i).end(); it4++)
+                {
+                    string name = it4->first;
+                    scalarName_.push_back(name);
+                }
+            }
+            firstFlag = false;
+        }
+        meshVec.at(meshId)->SetScalarNumber(scalarName_.size());
+        meshVec.at(meshId)->SetScalarName(scalarName_);
+        for (int i = 0; i < scalarName_.size(); i ++)
+        {
+            for (int j = 0; j < scalarVec.size(); j ++)
+            {
+                if(scalarVec.at(j).count(scalarName_.at(i)))
+                {
+                    map<string, double*>::iterator it4 = scalarVec.at(j).find(scalarName_.at(i));
+                    scalarData.push_back(it4->second);
+                }
+            }
+        }
+        vector<vector<double*>> vec;
+        vec.push_back(scalarData);
+        meshVec.at(meshId)->SetScalarData(vec);
+        vector<int> shareVec;
+        for (int i = 0; i < scalarName_.size() + 3; i ++)
+        {
+            shareVec.push_back(-1);
+        }
+        vector<vector<int>> vec2;
+        vec2.push_back(shareVec);
+        meshVec.at(meshId)->SetScalarShareVec(vec2);
+
+        vector<int> myScalarType;
+        myScalarType.push_back(0);//x
+        myScalarType.push_back(0);//y
+        myScalarType.push_back(0);//z
+        for (int i = 0; i < scalarName_.size(); i ++)
+        {
+             map<string, int>::iterator it5 = scalarType.find(scalarName_.at(i));
+             myScalarType.push_back(it5->second);
+        }
+        vector<vector<int>> vec3;
+        vec3.push_back(myScalarType);
+        meshVec.at(meshId)->SetZoneScalarType(vec3);
+
+        meshId ++;
+    }
+}
+
+void Mesh_Frd::AllocateModalMeshSpace()
+{
+    bool firstFlag = true;
+
+    for (int i = 0; i < modalTimeSet.size(); i ++)
+    {
+        Mesh* mesh = new Mesh_Frd;
+        modalMeshVec.push_back(mesh);
+    }
+    set<double>::iterator it;
+    vector<string> myScalarName;
+
+    int meshId = 0;
+    for (it = modalTimeSet.begin(); it != modalTimeSet.end(); it ++)
+    {
+        modalMeshVec.at(meshId)->SetZoneNumber(GetZoneNumber());//目前默认frd读出来是一个zone
+        modalMeshVec.at(meshId)->SetZoneName(GetZoneName());
+        modalMeshVec.at(meshId)->SetSovleTime(*it);
+
+        map<double, string>::iterator it2 = modalTimeNameMap.find(*it);
+        if (it2 == modalTimeNameMap.end())
+        {
+            cout << "not found" << endl;
+            return;
+        }
+        string stepName = it2->second;
+
+        map<string, vector<map<string, double*>>>::iterator it3 = modalStepScalarMap.find(stepName);//某一时间步的所有标量值
+        vector<map<string, double*>> scalarVec = it3->second;
+        MeshUnstructured* unMesh2 = new MeshUnstructured;
+
+        double *X = new double[unMesh->GetPoints()->GetPointNumber()];
+        double *Y = new double[unMesh->GetPoints()->GetPointNumber()];
+        double *Z = new double[unMesh->GetPoints()->GetPointNumber()];
+
+        PointsDS* p = new PointsDS;
+        p->SetPointNumber(unMesh->GetPoints()->GetPointNumber());
+        if (dispNameVec.size() != 0)
+        {
+            double* x;
+            double* y;
+            double* z;
+            for (int i = 0; i < scalarVec.size(); i ++)
+            {
+                if(scalarVec.at(i).count(dispNameVec.at(0)))
+                {
+                    map<string, double*>::iterator it3 = scalarVec.at(i).find(dispNameVec.at(0));
+                    x = it3->second;
+                    it3 = scalarVec.at(i).find(dispNameVec.at(1));
+                    y = it3->second;
+                    it3 = scalarVec.at(i).find(dispNameVec.at(2));
+                    z = it3->second;
+                }
+            }
+            PointsDS* p2 = unMesh->GetPoints();
+            for (int i = 0; i < p2->GetPointNumber(); i ++)
+            {
+                double xyz[3];
+                p2->GetPoint(i, xyz);
+                X[i] = xyz[0] + x[i];
+                Y[i] = xyz[1] + y[i];
+                Z[i] = xyz[2] + z[i];
+                p->SetPoint(i,X[i],Y[i],Z[i]);
+            }
+        }else
+        {
+            PointsDS* p2 = unMesh->GetPoints();
+            for (int i = 0; i < p2->GetPointNumber(); i ++)
+            {
+                double xyz[3];
+                p2->GetPoint(i, xyz);
+                X[i] = xyz[0];
+                Y[i] = xyz[1];
+                Z[i] = xyz[2];
+                p->SetPoint(i,X[i],Y[i],Z[i]);
+            }
+        }
+        unMesh2->SetPoints(p);
+
+        unMesh2->SetCellNumber(unMesh->GetCellNumber());
+        for (int i = 0; i < unMesh->GetCellNumber(); i ++)
+        {
+            unMesh2->SetCell(i, cellVec.at(i));
+        }
+        modalMeshVec.at(meshId)->SetZoneMesh(unMesh2);
+
+        vector<double*> scalarData;
+        scalarData.clear();
+        scalarData.push_back(X);
+        scalarData.push_back(Y);
+        scalarData.push_back(Z);
+
+        if (firstFlag)//获取第一个mesh的标量名和顺序
+        {
+            for(int i = 0; i < scalarVec.size(); i ++)
+            {
+                map<string, double*>::iterator it4;
+                for (it4= scalarVec.at(i).begin(); it4 != scalarVec.at(i).end(); it4++)
+                {
+                    string name = it4->first;
+                    myScalarName.push_back(name);
+                }
+            }
+            firstFlag = false;
+        }
+        modalMeshVec.at(meshId)->SetScalarNumber(myScalarName.size());
+        modalMeshVec.at(meshId)->SetScalarName(myScalarName);
+        for (int i = 0; i < myScalarName.size(); i ++)
+        {
+            for (int j = 0; j < scalarVec.size(); j ++)
+            {
+                if(scalarVec.at(j).count(myScalarName.at(i)))
+                {
+                    map<string, double*>::iterator it4 = scalarVec.at(j).find(myScalarName.at(i));
+                    scalarData.push_back(it4->second);
+                }
+            }
+        }
+        vector<vector<double*>> vec;
+        vec.push_back(scalarData);
+        modalMeshVec.at(meshId)->SetScalarData(vec);
+        vector<int> shareVec;
+        for (int i = 0; i < myScalarName.size() + 3; i ++)
+        {
+            shareVec.push_back(-1);
+        }
+        vector<vector<int>> vec2;
+        vec2.push_back(shareVec);
+        modalMeshVec.at(meshId)->SetScalarShareVec(vec2);
+
+        vector<int> myScalarType;
+        myScalarType.push_back(0);//x
+        myScalarType.push_back(0);//y
+        myScalarType.push_back(0);//z
+        for (int i = 0; i < myScalarName.size(); i ++)
+        {
+             map<string, int>::iterator it5 = scalarType.find(myScalarName.at(i));
+             myScalarType.push_back(it5->second);
+        }
+        vector<vector<int>> vec3;
+        vec3.push_back(myScalarType);
+        modalMeshVec.at(meshId)->SetZoneScalarType(vec3);
+
+        meshId ++;
+    }
+}
+
+vector<Mesh*> Mesh_Frd::GetMeshVec()
+{
+    return meshVec;
+}
+
+vector<Mesh*> Mesh_Frd::GetModalMeshVec()
+{
+    return modalMeshVec;
+}
+
+vector<string> Mesh_Frd::GetDispVec()
+{
+    return dispNameVec;
+}
+
+

+ 75 - 0
CAE_Solution/src/VTK/mesh/Mesh_Frd.h

@@ -0,0 +1,75 @@
+#ifndef MESH_FRD_H
+#define MESH_FRD_H
+
+#include <fstream>
+#include <iostream>
+using namespace std;
+#include "Mesh.h"
+#include <vector>
+#include <map>
+#include <set>
+#include "../MeshDS/PointDS.h"
+#include "../MeshDS/MeshUnstructured.h"
+
+
+class vtkDoubleArray;
+
+
+
+class  Mesh_Frd : public Mesh
+{
+public:
+    Mesh_Frd();
+    virtual ~Mesh_Frd();
+
+    virtual bool Load_Ascii(const string &gridFile);
+    virtual bool Load_Binary(const string &gridFile);
+    virtual bool Save_Ascii(const string &gridFile);
+    virtual bool Save_Binary(const string &gridFile);
+
+    double GetDISPAllValue(double x, double y, double z);
+    double GetStressValue(double m1, double m2, double m3, double m4, double m5, double m6);
+    double GetTostrainValue(double m1, double m2, double m3, double m4, double m5, double m6);
+
+    void RemoveSpace(string &str);
+    vector<string> MySplit(string str, string split);
+    string& MyReplace(string& str, string oldStr, string newStr);
+    string MyGetFileName(string str);
+    void SetCellData(MeshUnstructured* un, int cellId,int cellType, vector<double> pointIdData);
+    map<string, double*> SetScalarData(string totalName, vector<string> sName, int type, vector<vector<double>>data, int sType);
+    MeshUnstructured* GetBase();
+    void AllocateMeshSpace();
+    void AllocateModalMeshSpace();
+    vector<Mesh*> GetMeshVec();
+    vector<Mesh*> GetModalMeshVec();
+    vector<string> GetDispVec();
+private:
+    bool Load_Frd_Ascii(ifstream &infile);
+    bool Load_Frd_Binary(ifstream &infile);
+    map<int, int> pointIdMap;
+    map<int, int> cellIdMap;
+    vector<double> solveTimeVecl;
+    MeshUnstructured* unMesh;
+    vector<map<string, vector<string>>> vectorNameVec;
+    vector<map<string, vector<string>>> matrixNameVec;
+    vector<string> scalarNameVec;
+    set<double> solveTimeSet;
+    vector<Mesh*> meshVec;
+    vector<string> StepNameVec;
+    map<double, string> timeNameMap;
+    map<string, vector<map<string, double*>>> StepScalarMap;
+
+    set<double> modalTimeSet;
+    vector<Mesh*> modalMeshVec;
+    vector<string> StepModalNameVec;
+    map<double, string> modalTimeNameMap;
+    map<string, vector<map<string, double*>>> modalStepScalarMap;
+
+    vector<string> dispNameVec;
+    vector<CellBase*> cellVec;
+    map<string, int> scalarType;
+    map<string, int> modelScalarType;
+};
+
+
+#endif // MESH_FRD_H

+ 159 - 6
CAE_Solution/src/VTK/mesh/mesh.cpp

@@ -1,8 +1,8 @@
 #include <set>
-#include "meshbase.h"
-#include "meshstructured.h"
-#include "meshunstructured.h"
-#include "mesh.h"
+#include "../MeshDS/MeshBase.h"
+#include "../MeshDS/MeshStructured.h"
+#include "../MeshDS/MeshUnstructured.h"
+#include "Mesh.h"
 #include <iostream>
 
 
@@ -104,8 +104,8 @@ Mesh::~Mesh()
                 }
                 zoneScalarRange_[i].clear();
             }
-            zoneScalarRange_.clear();
         }
+        zoneScalarRange_.clear();
     }
 
     if (!ScalarsData_.empty())
@@ -138,6 +138,19 @@ size_t Mesh::GetZoneNumber()
     return zoneNumber_;
 }
 
+/**
+  * @brief set zone number in mesh.
+  *
+  * @param[in] the zone number.
+  * @return
+  * @author zhaoyu
+  * @date 20230330
+  */
+void Mesh::SetZoneNumber(size_t num)
+{
+    zoneNumber_ = num;
+}
+
 /**
   * @brief get the zone mesh by zone index.
   *
@@ -152,6 +165,19 @@ MeshBase* Mesh::GetZoneMesh(size_t zoneId)
     else return zoneMeshVec_.at(zoneId);
 }
 
+/**
+  * @brief set the zone mesh.
+  *
+  * @param[in] zone mesh.
+  * @return
+  * @author zhaoyu
+  * @date 20230330
+  */
+void Mesh::SetZoneMesh(MeshBase* base)
+{
+    zoneMeshVec_.push_back(base);
+}
+
 /**
   * @brief get patch number in zone.
   *
@@ -211,7 +237,6 @@ void Mesh::BuildZonePatchesMesh()
         if (zonemesh->GetPatchNumber() < 2)  continue;
         if (zonePatchesMap_.find(i) != zonePatchesMap_.end()) continue;
         MeshType meshType = zonemesh->GetType();
-
         if (meshType == Structured)
         {
             BuildZonePatchesMesh_Str(i);
@@ -307,6 +332,19 @@ vector<string> Mesh::GetZoneName()
     return zoneName_;
 }
 
+/**
+  * @brief Set zone name.
+  *
+  * @param[in]vector<string> vec
+  * @return
+  * @author zhaoyu
+  * @date 20230330
+  */
+void Mesh::SetZoneName(vector<string> vec)
+{
+    zoneName_ = vec;
+}
+
 /**
   * @brief get scalar number.
   *
@@ -320,6 +358,19 @@ size_t Mesh::GetScalarNumber()
     return scalarNumber_;
 }
 
+/**
+  * @brief set scalar number.
+  *
+  * @param[in] num
+  * @return
+  * @author zhaoyu
+  * @date 20230330
+  */
+void Mesh::SetScalarNumber(size_t num)
+{
+    scalarNumber_ = num;
+}
+
 /**
   * @brief get vector number.
   *
@@ -332,6 +383,18 @@ size_t Mesh::GetVectorNumber()
 {
     return vectorNumber_;
 }
+/**
+  * @brief set vector number.
+  *
+  * @param[in] num
+  * @return
+  * @author zhaoyu
+  * @date 20230330
+  */
+void Mesh::SetVectorNumber(size_t num)
+{
+    vectorNumber_ = num;
+}
 
 /**
   * @brief get scalar type.
@@ -346,6 +409,19 @@ vector<vector<int>> Mesh::GetZoneScalarType()
     return zoneScalarType_;
 }
 
+/**
+  * @brief set scalar type.
+  *
+  * @param[in] vector<vector<int>> vec
+  * @return
+  * @author zhaoyu
+  * @date 20230330
+  */
+void Mesh::SetZoneScalarType(vector<vector<int>> vec)
+{
+    zoneScalarType_ = vec;
+}
+
 /**
   * @brief get scalar names.
   *
@@ -359,6 +435,19 @@ vector<string> Mesh::GetScalarName()
     return scalarName_;
 }
 
+/**
+  * @brief set scalar names.
+  *
+  * @param[in] vector<string> vec
+  * @return
+  * @author zhaoyu
+  * @date 20230330
+  */
+void Mesh::SetScalarName(vector<string> vec)
+{
+    scalarName_ = vec;
+}
+
 /**
   * @brief get vector name.
   *
@@ -372,6 +461,19 @@ vector<string> Mesh::GetVectorName()
     return vectorName_;
 }
 
+/**
+  * @brief Set vector name.
+  *
+  * @param[in] vector<string> vec
+  * @return
+  * @author zhaoyu
+  * @date 20221130
+  */
+void Mesh::SetVectorName(vector<string> vec)
+{
+    vectorName_ = vec;
+}
+
 /**
   * @brief get scalars data.
   *
@@ -385,6 +487,19 @@ vector<vector<double*>> Mesh::GetScalarData()
     return ScalarsData_;
 }
 
+/**
+  * @brief set scalars data.
+  *
+  * @param[in] vector<vector<double*>> vec
+  * @return
+  * @author zhaoyu
+  * @date 20230330
+  */
+void Mesh::SetScalarData(vector<vector<double*>> vec)
+{
+    ScalarsData_ = vec;
+}
+
 /**
   * @brief get scalar range.
   *
@@ -398,6 +513,19 @@ vector<vector<double*>> Mesh::GetScalarRange()
     return zoneScalarRange_;
 }
 
+/**
+  * @brief Set scalar range.
+  *
+  * @param[in] vector<vector<double*>> vec
+  * @return
+  * @author zhaoyu
+  * @date 20230330
+  */
+void Mesh::SetScalarRange(vector<vector<double*>> vec)
+{
+    zoneScalarRange_ = vec;
+}
+
 /**
   * @brief get scalar share vector.
   *
@@ -410,6 +538,18 @@ vector<vector<int>> Mesh::GetScalarShareVec()
 {
     return zoneScalarShareVec_;
 }
+/**
+  * @brief set scalar share vector.
+  *
+  * @param[in] vector<vector<int>> vec
+  * @return
+  * @author zhaoyu
+  * @date 20230330
+  */
+void Mesh::SetScalarShareVec(vector<vector<int>> vec)
+{
+    zoneScalarShareVec_ =  vec;
+}
 
 /**
   * @brief get solve time.
@@ -424,5 +564,18 @@ double Mesh::GetSovleTime()
     return solutionTime_;
 }
 
+/**
+  * @brief Set solve time.
+  *
+  * @param[in] double time
+  * @return
+  * @author zhaoyu
+  * @date 20230330
+  */
+void Mesh::SetSovleTime(double time)
+{
+    solutionTime_ = time;
+}
+
 
 

+ 13 - 0
CAE_Solution/src/VTK/mesh/mesh.h

@@ -24,21 +24,34 @@ public:
 
     //info functions.
     size_t GetZoneNumber();
+    void SetZoneNumber(size_t);
     MeshBase* GetZoneMesh(size_t zoneId);
+    void SetZoneMesh(MeshBase* base);
+
     size_t GetZonePatchNumber(size_t zoneId);
     const set<int>* GetZonePatchTags(size_t zoneId);
     MeshBase* GetZonePatchMesh(size_t zoneId, int patchTag);
 
     size_t GetScalarNumber();
+    void SetScalarNumber(size_t);
     size_t GetVectorNumber();
+    void SetVectorNumber(size_t);
     vector<vector<int>> GetZoneScalarType();
+    void SetZoneScalarType(vector<vector<int>>);
     vector<string> GetScalarName();
+    void SetScalarName(vector<string> vec);
     vector<string> GetVectorName();
+    void SetVectorName(vector<string> vec);
     vector<string> GetZoneName();
+    void SetZoneName(vector<string> vec);
     vector<vector<double*>> GetScalarRange();
+    void SetScalarRange(vector<vector<double*>> vec);
     vector<vector<double*>> GetScalarData();
+    void SetScalarData(vector<vector<double*>> vec);
     vector<vector<int>> GetScalarShareVec();
+    void SetScalarShareVec(vector<vector<int>> vec);
     double GetSovleTime();
+    void SetSovleTime(double time);
 
 protected:
     void BuildZonePatchesMesh();

+ 1 - 1
CAE_Solution/src/VTK/mesh/mesh_adi.cpp

@@ -1,6 +1,6 @@
 #include <fstream>
 using namespace std;
-#include "mesh_adi.h"
+#include "Mesh_ADI.h"
 
 
 

+ 1 - 1
CAE_Solution/src/VTK/mesh/mesh_adi.h

@@ -1,7 +1,7 @@
 #ifndef MESH_ADI_H
 #define MESH_ADI_H
 
-#include "mesh.h"
+#include "Mesh.h"
 
 
 

+ 4 - 4
CAE_Solution/src/VTK/mesh/mesh_tecplot.cpp

@@ -1,7 +1,7 @@
-
-#include "PointDS.h"
-#include "meshunstructured.h"
-#include "mesh_tecplot.h"
+#include <vtkDoubleArray.h>
+#include "../MeshDS/PointDS.h"
+#include "../MeshDS/MeshUnstructured.h"
+#include "Mesh_Tecplot.h"
 
 
 

+ 1 - 1
CAE_Solution/src/VTK/mesh/mesh_tecplot.h

@@ -4,7 +4,7 @@
 #include <fstream>
 #include <iostream>
 using namespace std;
-#include "mesh.h"
+#include "Mesh.h"
 
 class vtkDoubleArray;
 

+ 4 - 5
CAE_Solution/src/VTK/mesh/mesh_ugrid.cpp

@@ -1,6 +1,6 @@
-#include "PointDS.h"
-#include "meshunstructured.h"
-#include "mesh_ugrid.h"
+#include "../MeshDS/PointDS.h"
+#include "../MeshDS/MeshUnstructured.h"
+#include "Mesh_UGrid.h"
 
 
 
@@ -70,7 +70,6 @@ bool Mesh_UGrid::Load_2DBlock_Ascii(ifstream &infile)
     infile >> nPoint >> nTri >> nQuad >> nTetra >> nPyramid  >> nPrism >> nHexa;
     if (!infile.good())  return false;
     PointsDS *points = new PointsDS;
-
     points->SetPointNumber(nPoint);
     double x, y, z;
     for (int i = 0; i < nPoint; ++i)
@@ -135,7 +134,7 @@ bool Mesh_UGrid::Load_2DBlock_Ascii(ifstream &infile)
         infile >> tag;
         unMesh->SetCellTag(i, tag);
     }
-    if (!infile.good())
+    if (infile.fail())
     {
         delete points;
         delete unMesh;

+ 2 - 3
CAE_Solution/src/VTK/mesh/mesh_ugrid.h

@@ -2,7 +2,7 @@
 #define MESH_UGRID_H
 #include <fstream>
 using namespace std;
-#include "mesh.h"
+#include "Mesh.h"
 
 
 
@@ -16,9 +16,8 @@ public:
     virtual bool Load_Binary(const string &gridFile);
     virtual bool Save_Ascii(const string &gridFile);
     virtual bool Save_Binary(const string &gridFile);
-    bool Load_2DBlock_Ascii(ifstream &infile);
 private:
-
+    bool Load_2DBlock_Ascii(ifstream &infile);
 };
 
 

+ 0 - 613
CAE_Solution/src/VTK/mesh/meshunstructured.cpp

@@ -1,613 +0,0 @@
-#include "CellDS.h"
-#include "meshunstructured.h"
-
-
-
-/**
-  * @brief the constructor.
-  *
-  * @param[in] 
-  * @return 
-  * @author shiting
-  * @date 20220721
-  */
-MeshUnstructured::MeshUnstructured() : MeshBase()
-{
-    meshType_ = Unstructured;
-    nCell_ = 0;
-    nLine_ = 0;
-    nTri_ = 0;
-    nQuad_ = 0;
-    nTetra_ = 0;
-    nPyramid_ = 0;
-    nPrism_ = 0;
-    nHexa_ = 0;
-}
-
-/**
-  * @brief the destructor.
-  *
-  * @param[in] 
-  * @return 
-  * @author shiting
-  * @date 20220721
-  */
-MeshUnstructured::~MeshUnstructured()
-{
-    for (vector<CellBase*>::iterator it = allCellsVec_.begin(); it != allCellsVec_.end(); ++it)
-    {
-        delete (*it);
-    }
-    allCellsVec_.clear();
-    lineCellsVec_.clear();
-    triangleCellsVec_.clear();
-    quadCellsVec_.clear();
-    tetraCellsVec_.clear();
-    pyramidCellsVec_.clear();
-    prismCellsVec_.clear();
-    hexaCellsVec_.clear();
-    //
-    DeallocateShellFaces();
-}
-
-/**
-  * @brief get cell number in mesh.
-  *
-  * @param[in] 
-  * @return return cell number.
-  * @author shiting
-  * @date 20220721
-  */
-void MeshUnstructured::SetCellNumber(size_t num)
-{
-    allCellsVec_.resize(num, 0);
-}
-
-/**
-  * @brief update a cell.
-  *
-  * @param[in] the input cell, cell position.
-  * @return 
-  * @author shiting
-  * @date 20220721
-  */
-void MeshUnstructured::SetCell(size_t id, const CellBase *cell)
-{
-    if (!cell)  return;
-    CellType type = cell->GetType();
-    CellBase *newCell = 0;
-    if (type == LineCell)
-    {
-        newCell = new CellLine;
-        lineCellsVec_.push_back(newCell);
-        ++nLine_;
-    }
-    else if (type == TriangleCell)
-    {
-        newCell = new CellTriangle;
-        triangleCellsVec_.push_back(newCell);
-        ++nTri_;
-    }
-    else if (type == QuadCell)
-    {
-        newCell = new CellQuad;
-        quadCellsVec_.push_back(newCell);
-        ++nQuad_;
-    }
-    else if (type == TetraCell)
-    {
-        newCell = new CellTetra;
-        tetraCellsVec_.push_back(newCell);
-        ++nTetra_;
-    }
-    else if (type == PyramidCell)
-    {
-        newCell = new CellPyramid;
-        pyramidCellsVec_.push_back(newCell);
-        ++nPyramid_;
-    }
-    else if (type == PrismCell)
-    {
-        newCell = new CellPrism;
-        prismCellsVec_.push_back(newCell);
-        ++nPrism_;
-    }
-    else if (type == HexaCell)
-    {
-        newCell = new CellHexa;
-        hexaCellsVec_.push_back(newCell);
-        ++nHexa_;
-    }
-    size_t np = cell->GetPointNumber();
-    for (size_t i = 0; i < np; ++i)
-    {
-        newCell->SetPoint(i, cell->GetPoint(i));
-    }
-    int tag = cell->GetTag();
-    if (tag != NULLTAG)
-    {
-        newCell->SetTag(tag);
-        InsertPatchTag(tag);
-    }
-    if (id < allCellsVec_.size()) //set cell.
-    {
-        if (allCellsVec_[id]) delete allCellsVec_[id];
-        allCellsVec_[id] = newCell;
-    }
-    else  //append cell.
-    {
-        allCellsVec_.push_back(newCell);
-    }
-    ++nCell_;
-}
-
-/**
-  * @brief append a cell to this mesh.
-  *
-  * @param[in] the input cell.
-  * @return 
-  * @author shiting
-  * @date 20220721
-  */
-void MeshUnstructured::AppendCell(const CellBase *cell)
-{
-    SetCell(nCell_, cell);
-}
-
-/**
-  * @brief get a cell from mesh.
-  *
-  * @param[in] the cell id.
-  * @return the cell.
-  * @author shiting
-  * @date 20220721
-  */
-const CellBase* MeshUnstructured::GetCell(size_t id)
-{
-    if (id < allCellsVec_.size()) return allCellsVec_.at(id);
-    return 0;
-}
-
-/**
-  * @brief get the cell number.
-  *
-  * @param[in] 
-  * @return the cell number in mesh.
-  * @author shiting
-  * @date 20220801
-  */
-size_t MeshUnstructured::GetCellNumber()
-{
-    return nCell_;
-}
-
-/**
-  * @brief get line cell number in mesh.
-  *
-  * @param[in] 
-  * @return return line cell number.
-  * @author shiting
-  * @date 20220721
-  */
-size_t MeshUnstructured::GetLineNumber()
-{
-    return nLine_;
-}
-
-/**
-  * @brief get triangle cell number in mesh.
-  *
-  * @param[in] 
-  * @return return triangle cell number.
-  * @author shiting
-  * @date 20220721
-  */
-size_t MeshUnstructured::GetTriangleNumber()
-{
-    return nTri_;
-}
-
-/**
-  * @brief get quad cell number in mesh.
-  *
-  * @param[in] 
-  * @return return quad cell number.
-  * @author shiting
-  * @date 20220721
-  */
-size_t MeshUnstructured::GetQuadNumber()
-{
-    return nQuad_;
-}
-
-/**
-  * @brief get tetra cell number in mesh.
-  *
-  * @param[in] 
-  * @return return tetra cell number.
-  * @author shiting
-  * @date 20220721
-  */
-size_t MeshUnstructured::GetTetraNumber()
-{
-    return nTetra_;
-}
-
-/**
-  * @brief get pyramid cell number in mesh.
-  *
-  * @param[in] 
-  * @return return pyramid cell number.
-  * @author shiting
-  * @date 20220721
-  */
-size_t MeshUnstructured::GetPyramidNumber()
-{
-    return nPyramid_;
-}
-
-/**
-  * @brief get prism cell number in mesh.
-  *
-  * @param[in] 
-  * @return return prism cell number.
-  * @author shiting
-  * @date 20220721
-  */
-size_t MeshUnstructured::GetPrismNumber()
-{
-    return nPrism_;
-}
-
-/**
-  * @brief get hexa cell number in mesh.
-  *
-  * @param[in] 
-  * @return return hexa cell number.
-  * @author shiting
-  * @date 20220721
-  */
-size_t MeshUnstructured::GetHexaNumber()
-{
-    return nHexa_;
-}
-
-/**
-  * @brief set cell tag.
-  *
-  * @param[in] cell id, tag.
-  * @return 
-  * @author shiting
-  * @date 20220721
-  */
-void MeshUnstructured::SetCellTag(size_t id, int tag)
-{
-    if (id >= nCell_) return;
-    allCellsVec_.at(id)->SetTag(tag);
-    InsertPatchTag(tag);
-}
-
-/**
-  * @brief get cell tag.
-  *
-  * @param[in] cell id
-  * @return cell tag.
-  * @author shiting
-  * @date 20220721
-  */
-int MeshUnstructured::GetCellTag(size_t id)
-{
-    if (id >= nCell_) return -999;
-    return allCellsVec_.at(id)->GetTag();
-}
-
-/**
-  * @brief allocate faces data for hoops shell display.
-  *
-  * @param[in] 
-  * @return 
-  * @author shiting
-  * @date 20220721
-  */
-void MeshUnstructured::AllocateShellFaces()
-{
-    size_t size = 0;
-    size += nLine_*3;
-    size += nTri_*4;
-    size += nQuad_*5;
-    size += nTetra_*4*4;
-    size += nPyramid_*(4*4+5);
-    size += nPrism_*(4*2+5*3);
-    size += nHexa_*5*6;
-    shellFacesVec_.reserve(size);
-
-    AllocateLineCells();
-    AllocateTriangleCells();
-    AllocateQuadCells();
-    AllocateTeteaCells();
-    AllocatePyramidCells();
-    AllocatePrismCells();
-    AllocateHexaCells();
-
-    shellFacesVec_.shrink_to_fit();  /*c++11*/
-}
-
-/**
-  * @brief get hoops shell's faces list of this mesh.
-  *
-  * @param[out] the size of faces list.
-  * @return faces list for hoops shell.
-  * @author shiting
-  * @date 20220721
-  */
-const int* MeshUnstructured::ShellFacesData(int &nface)
-{
-    nface = shellFacesVec_.size();
-    return shellFacesVec_.data(); /*c++11*/
-}
-
-/**
-  * @brief deallocate faces data for hoops shell display.
-  *
-  * @param[in] 
-  * @return 
-  * @author shiting
-  * @date 20220721
-  */
-void MeshUnstructured::DeallocateShellFaces()
-{
-    shellFacesVec_.clear();
-}
-
-/**
-  * @brief allocate line cell for hoops shell.
-  *
-  * @param[in] 
-  * @return 
-  * @author shiting
-  * @date 20220721
-  */
-void MeshUnstructured::AllocateLineCells()
-{
-    for (vector<CellBase*>::iterator it = lineCellsVec_.begin(); it != lineCellsVec_.end(); ++it)
-    {
-        shellFacesVec_.push_back(2);
-        shellFacesVec_.push_back((*it)->GetPoint(0));
-        shellFacesVec_.push_back((*it)->GetPoint(1));
-    }
-}
-
-/**
-  * @brief allocate triangle cell for hoops shell.
-  *
-  * @param[in] 
-  * @return 
-  * @author shiting
-  * @date 20220721
-  */
-void MeshUnstructured::AllocateTriangleCells()
-{
-    for (vector<CellBase*>::iterator it = triangleCellsVec_.begin(); it != triangleCellsVec_.end(); ++it)
-    {
-        shellFacesVec_.push_back(3);
-        shellFacesVec_.push_back((*it)->GetPoint(0));
-        shellFacesVec_.push_back((*it)->GetPoint(1));
-        shellFacesVec_.push_back((*it)->GetPoint(2));
-    }
-}
-
-/**
-  * @brief allocate quad cell for hoops shell.
-  *
-  * @param[in] 
-  * @return 
-  * @author shiting
-  * @date 20220721
-  */
-void MeshUnstructured::AllocateQuadCells()
-{
-    for (vector<CellBase*>::iterator it = quadCellsVec_.begin(); it != quadCellsVec_.end(); ++it)
-    {
-        shellFacesVec_.push_back(4);
-        shellFacesVec_.push_back((*it)->GetPoint(0));
-        shellFacesVec_.push_back((*it)->GetPoint(1));
-        shellFacesVec_.push_back((*it)->GetPoint(2));
-        shellFacesVec_.push_back((*it)->GetPoint(3));
-    }
-}
-
-/**
-  * @brief allocate tetra cell for hoops shell.
-  *
-  * @param[in] 
-  * @return 
-  * @author shiting
-  * @date 20220721
-  */
-void MeshUnstructured::AllocateTeteaCells()
-{
-    for (vector<CellBase*>::iterator it = tetraCellsVec_.begin(); it != tetraCellsVec_.end(); ++it)
-    {
-        int p0 = (*it)->GetPoint(0);
-        int p1 = (*it)->GetPoint(1);
-        int p2 = (*it)->GetPoint(2);
-        int p3 = (*it)->GetPoint(3);
-        //face1
-        shellFacesVec_.push_back(3);
-        shellFacesVec_.push_back(p0);
-        shellFacesVec_.push_back(p2);
-        shellFacesVec_.push_back(p1);
-        //face2
-        shellFacesVec_.push_back(3);
-        shellFacesVec_.push_back(p0);
-        shellFacesVec_.push_back(p1);
-        shellFacesVec_.push_back(p3);
-        //face3
-        shellFacesVec_.push_back(3);
-        shellFacesVec_.push_back(p1);
-        shellFacesVec_.push_back(p2);
-        shellFacesVec_.push_back(p3);
-        //face4
-        shellFacesVec_.push_back(3);
-        shellFacesVec_.push_back(p0);
-        shellFacesVec_.push_back(p3);
-        shellFacesVec_.push_back(p2);
-    }
-}
-
-/**
-  * @brief allocate pyramid cell for hoops shell.
-  *
-  * @param[in] 
-  * @return 
-  * @author shiting
-  * @date 20220721
-  */
-void MeshUnstructured::AllocatePyramidCells()
-{
-    for (vector<CellBase*>::iterator it = pyramidCellsVec_.begin(); it != pyramidCellsVec_.end(); ++it)
-    {
-        int p0 = (*it)->GetPoint(0);
-        int p1 = (*it)->GetPoint(1);
-        int p2 = (*it)->GetPoint(2);
-        int p3 = (*it)->GetPoint(3);
-        int p4 = (*it)->GetPoint(4);
-        //face1
-        shellFacesVec_.push_back(4);
-        shellFacesVec_.push_back(p0);
-        shellFacesVec_.push_back(p3);
-        shellFacesVec_.push_back(p2);
-        shellFacesVec_.push_back(p1);
-        //face2
-        shellFacesVec_.push_back(3);
-        shellFacesVec_.push_back(p0);
-        shellFacesVec_.push_back(p1);
-        shellFacesVec_.push_back(p4);
-        //face3
-        shellFacesVec_.push_back(3);
-        shellFacesVec_.push_back(p1);
-        shellFacesVec_.push_back(p2);
-        shellFacesVec_.push_back(p4);
-        //face4
-        shellFacesVec_.push_back(3);
-        shellFacesVec_.push_back(p2);
-        shellFacesVec_.push_back(p3);
-        shellFacesVec_.push_back(p4);
-        //face5
-        shellFacesVec_.push_back(3);
-        shellFacesVec_.push_back(p0);
-        shellFacesVec_.push_back(p4);
-        shellFacesVec_.push_back(p3);
-    }
-}
-
-/**
-  * @brief allocate prism cell for hoops shell.
-  *
-  * @param[in] 
-  * @return 
-  * @author shiting
-  * @date 20220721
-  */
-void MeshUnstructured::AllocatePrismCells()
-{
-    for (vector<CellBase*>::iterator it = prismCellsVec_.begin(); it != prismCellsVec_.end(); ++it)
-    {
-        int p0 = (*it)->GetPoint(0);
-        int p1 = (*it)->GetPoint(1);
-        int p2 = (*it)->GetPoint(2);
-        int p3 = (*it)->GetPoint(3);
-        int p4 = (*it)->GetPoint(4);
-        int p5 = (*it)->GetPoint(5);
-        //face1
-        shellFacesVec_.push_back(3);
-        shellFacesVec_.push_back(p0);
-        shellFacesVec_.push_back(p1);
-        shellFacesVec_.push_back(p2);
-        //face2
-        shellFacesVec_.push_back(3);
-        shellFacesVec_.push_back(p5);
-        shellFacesVec_.push_back(p4);
-        shellFacesVec_.push_back(p3);
-        //face3
-        shellFacesVec_.push_back(4);
-        shellFacesVec_.push_back(p0);
-        shellFacesVec_.push_back(p2);
-        shellFacesVec_.push_back(p5);
-        shellFacesVec_.push_back(p3);
-        //face4
-        shellFacesVec_.push_back(4);
-        shellFacesVec_.push_back(p0);
-        shellFacesVec_.push_back(p3);
-        shellFacesVec_.push_back(p4);
-        shellFacesVec_.push_back(p1);
-        //face5
-        shellFacesVec_.push_back(4);
-        shellFacesVec_.push_back(p1);
-        shellFacesVec_.push_back(p4);
-        shellFacesVec_.push_back(p5);
-        shellFacesVec_.push_back(p2);
-    }
-}
-
-/**
-  * @brief allocate haxa cell for hoops shell.
-  *
-  * @param[in] 
-  * @return 
-  * @author shiting
-  * @date 20220721
-  */
-void MeshUnstructured::AllocateHexaCells()
-{
-    for (vector<CellBase*>::iterator it = hexaCellsVec_.begin(); it != hexaCellsVec_.end(); ++it)
-    {
-        int p0 = (*it)->GetPoint(0);
-        int p1 = (*it)->GetPoint(1);
-        int p2 = (*it)->GetPoint(2);
-        int p3 = (*it)->GetPoint(3);
-        int p4 = (*it)->GetPoint(4);
-        int p5 = (*it)->GetPoint(5);
-        int p6 = (*it)->GetPoint(6);
-        int p7 = (*it)->GetPoint(7);
-        //face1
-        shellFacesVec_.push_back(4);
-        shellFacesVec_.push_back(p0);
-        shellFacesVec_.push_back(p3);
-        shellFacesVec_.push_back(p2);
-        shellFacesVec_.push_back(p1);
-        //face2
-        shellFacesVec_.push_back(4);
-        shellFacesVec_.push_back(p4);
-        shellFacesVec_.push_back(p5);
-        shellFacesVec_.push_back(p6);
-        shellFacesVec_.push_back(p7);
-        //face3
-        shellFacesVec_.push_back(4);
-        shellFacesVec_.push_back(p0);
-        shellFacesVec_.push_back(p4);
-        shellFacesVec_.push_back(p7);
-        shellFacesVec_.push_back(p3);
-        //face4
-        shellFacesVec_.push_back(4);
-        shellFacesVec_.push_back(p1);
-        shellFacesVec_.push_back(p2);
-        shellFacesVec_.push_back(p6);
-        shellFacesVec_.push_back(p5);
-        //face5
-        shellFacesVec_.push_back(4);
-        shellFacesVec_.push_back(p0);
-        shellFacesVec_.push_back(p1);
-        shellFacesVec_.push_back(p5);
-        shellFacesVec_.push_back(p4);
-        //face5
-        shellFacesVec_.push_back(4);
-        shellFacesVec_.push_back(p2);
-        shellFacesVec_.push_back(p3);
-        shellFacesVec_.push_back(p7);
-        shellFacesVec_.push_back(p6);
-    }
-}
-
-
-

+ 16 - 5
CAE_Solution/src/VTK/visualization_VTK/vtkVISMeshToVTKSource.cpp

@@ -1,7 +1,7 @@
 #include <vtkObjectFactory.h>
 #include "vtkVISMeshToVTKSource.h"
-#include "../mesh/MeshBase.h"
-#include "../mesh/MeshUnstructured.h"
+#include "../MeshDS/MeshBase.h"
+#include "../MeshDS/MeshUnstructured.h"
 #include "vtkUnstructuredGrid.h"
 #include "vtkPoints.h"
 #include "vtkLine.h"
@@ -12,6 +12,7 @@
 #include "vtkWedge.h"
 #include "vtkHexahedron.h"
 #include "vtkIdList.h"
+#include <vtkDoubleArray.h>
 
 
 
@@ -98,7 +99,7 @@ void vtkVISMeshToVTKSource::MeshBaseToUnstructuredGrid(Mesh* mesh, int index)
         points->SetPoint(i,xyz);
     }
     unGrid->unstruGrid->SetPoints(points);
-    cout << "points over" << endl;
+
     MeshUnstructured* meshUn = static_cast<MeshUnstructured*>(meshSource);
     int ncell = meshUn->GetCellNumber();
     unGrid->unstruGrid->Allocate(ncell,ncell);
@@ -208,12 +209,17 @@ void vtkVISMeshToVTKSource::MeshBaseToUnstructuredGrid(Mesh* mesh, int index)
         if (i > 2)
         {
             unGrid->scalarRange[i - 3] = new double[2];
-            unGrid->scalarRange[i - 3] = mesh->GetScalarRange().at(index).at(i);
+            //unGrid->scalarRange[i - 3] = mesh->GetScalarRange().at(index).at(i);
             string name = mesh->GetScalarName().at(i - 3);
-            char* p = new char[name.size()];
+
+            char* p = new char[name.size() + 1];
             for (int j = 0; j < name.size(); j ++)
+            {
                 p[j] = mesh->GetScalarName().at(i-3).at(j);
+            }
+            p[name.size()] = '\0';
             unGrid->scalarName[i-3] = p;
+            string str = p;
             //cout << p << ": " << unGrid->scalarRange[i - 3][0] << ", " << unGrid->scalarRange[i - 3][1]<<endl;
         }
 
@@ -229,6 +235,8 @@ void vtkVISMeshToVTKSource::MeshBaseToUnstructuredGrid(Mesh* mesh, int index)
                         unGrid->scalarSource[i - 3]->SetValue(j, mesh->GetScalarData()[index][i-share][j]);
                     }
                     unGrid->scalarSource[i-3]->SetName(unGrid->scalarName[i - 3]);
+                    unGrid->scalarSource[i-3]->GetRange(unGrid->scalarRange[i - 3]);
+                    //cout << unGrid->scalarRange[i - 3][0] << ",  " << unGrid->scalarRange[i - 3][1] << endl;
                 }
             }else if (mesh->GetZoneScalarType().at(index).at(i) == 1)//cellScalar
             {
@@ -240,6 +248,7 @@ void vtkVISMeshToVTKSource::MeshBaseToUnstructuredGrid(Mesh* mesh, int index)
                         unGrid->cellScalarSource_[i-3]->SetValue(j, mesh->GetScalarData()[index][i-share][j]);
                     }
                     unGrid->cellScalarSource_[i-3]->SetName(unGrid->scalarName[i - 3]);
+                    unGrid->cellScalarSource_[i-3]->GetRange(unGrid->scalarRange[i - 3]);
                 }
             }
         }else if (mesh->GetScalarShareVec().at(index).at(i) == 0)//share
@@ -249,6 +258,7 @@ void vtkVISMeshToVTKSource::MeshBaseToUnstructuredGrid(Mesh* mesh, int index)
                 if (i > 2)
                 {
                     unGrid->scalarSource[i-3] = unGridVec.at(0)->scalarSource[i-3];
+                    unGrid->scalarSource[i-3]->GetRange(unGrid->scalarRange[i - 3]);
                 }
                 share ++;
             }else if (mesh->GetZoneScalarType().at(index).at(i+3) == 1)//cellScalar
@@ -256,6 +266,7 @@ void vtkVISMeshToVTKSource::MeshBaseToUnstructuredGrid(Mesh* mesh, int index)
                 if (i > 2)
                 {
                     unGrid->cellScalarSource_[i-3] = unGridVec.at(0)->cellScalarSource_[i-3];
+                    unGrid->cellScalarSource_[i-3]->GetRange(unGrid->scalarRange[i - 3]);
                 }
                 share ++;
             }

+ 1 - 1
CAE_Solution/src/VTK/visualization_VTK/vtkVISMeshToVTKSource.h

@@ -3,7 +3,7 @@
 
 
 #include "vtkVISManager.h"
-#include "../Mesh/MeshBase.h"
+#include "../MeshDS/MeshBase.h"
 #include "../Mesh/Mesh.h"
 #include "vtkVISUnstructuredGridSource.h"
 #include <iostream>

+ 53 - 0
CAE_Solution/src/VTK/visualization_VTK/vtkVISMouseInteractorStyle.cpp

@@ -0,0 +1,53 @@
+#include "vtkVISMouseInteractorStyle.h"
+vtkStandardNewMacro(MouseInteractorStyle)
+
+MouseInteractorStyle::MouseInteractorStyle()
+{
+    render_ = NULL;
+    renWin_ = NULL;
+    PositionVec.clear();
+}
+
+MouseInteractorStyle::~MouseInteractorStyle()
+{
+    render_ = NULL;
+    renWin_ = NULL;
+    PositionVec.clear();
+}
+
+void MouseInteractorStyle::OnLeftButtonDown()
+{
+    vtkInteractorStyleTrackballCamera::OnLeftButtonDown();
+    if (render_ == NULL)
+    {
+        return;
+    }
+
+    vtkPointPicker* picker = vtkPointPicker::New();
+    picker->SetTolerance(0.005);
+
+    int pos[3];
+    renWin_->GetInteractor()->GetEventPosition(pos);
+    picker->Pick(pos[0], pos[1], 0, render_);
+
+    PositionVec.clear();
+    if (picker->GetPointId() >= 0)
+    {
+        double p[3];
+        picker->GetPickPosition(p);
+        PositionVec.push_back(p[0]);
+        PositionVec.push_back(p[1]);
+        PositionVec.push_back(p[2]);
+    }
+}
+
+void MouseInteractorStyle::SetRender(vtkRenderer* r)
+{
+    render_ = r;
+    renWin_ = render_->GetRenderWindow();
+}
+
+vector<double> MouseInteractorStyle::GetPosition()
+{
+    return PositionVec;
+}

+ 34 - 0
CAE_Solution/src/VTK/visualization_VTK/vtkVISMouseInteractorStyle.h

@@ -0,0 +1,34 @@
+#ifndef VTKVISMOUSEINTERACTORSTYLE_H
+#define VTKVISMOUSEINTERACTORSTYLE_H
+
+#include <iostream>
+#include <vtkObject.h>
+
+using namespace std;
+#include "vtkObjectFactory.h"
+#include "vtkRenderWindowInteractor.h"
+#include "vtkPointPicker.h"
+#include "vtkRenderer.h"
+#include "vtkRenderWindow.h"
+#include "vtkInteractorStyleTrackballCamera.h"
+class  MouseInteractorStyle : public vtkInteractorStyleTrackballCamera
+{
+public:
+    static MouseInteractorStyle* New();
+    ~MouseInteractorStyle();
+    vtkTypeMacro(MouseInteractorStyle, vtkInteractorStyleTrackballCamera)
+
+    virtual void OnLeftButtonDown() override;
+    void SetRender(vtkRenderer* r);
+    vector<double> GetPosition();
+protected:
+    MouseInteractorStyle();
+private:
+    vtkRenderer* render_;
+    vtkRenderWindow* renWin_;
+    vector<double> PositionVec;
+
+
+};
+
+#endif // VTKVISMOUSEINTERACTORSTYLE_H

+ 35 - 7
CAE_Solution/src/VTK/visualization_VTK/vtkVISUnContour.cpp

@@ -1,6 +1,5 @@
 #include "vtkVISUnContour.h"
 #include "vtkCellDataToPointData.h"
-#include <vtkObjectFactory.h>
 
 vtkStandardNewMacro(vtkVISUnContour)
 
@@ -66,7 +65,6 @@ void vtkVISUnContour::CreateContourDisplay(char* scalarName)
         return;
     }
 
-
     if (_source->scalarSource[scalarIndex] == NULL)
     {
         ErrorInfo(1, "This Scalar Source is not exists, Please Load it First!");
@@ -884,15 +882,41 @@ void vtkVISUnContour::ShowOffScalarBar()
     }
 }
 
-void vtkVISUnContour::UpdataScalarBar()
+bool vtkVISUnContour::UpdataScalarBar()
 {
-    if (scalarBarWidget_==NULL)
+    double* sRange = ((vtkDataSetMapper*)_vtkObjects[4])->GetScalarRange();
+    double min = sRange[0];
+    double max = sRange[1];
+    double firstLeave = min + (max - min)/ contourLevel_;
+    double lastLeave = max - (max - min)/ contourLevel_;
+    double* lRange = contourLookupTable_->GetRange();
+    double lmin = lRange[0];
+    double lmax = lRange[1];
+    if (lmin < firstLeave && lmax > firstLeave)
+    {
+        if (scalarBarWidget_==NULL)
+        {
+            CreateScalarBar();
+        }else
+        {
+            vtkScalarBarActor *barActor=scalarBarWidget_->GetScalarBarActor();
+            barActor->SetLookupTable((vtkScalarsToColors*)contourLookupTable_);
+        }
+        return true;
+    }else if (lmax >lastLeave && lmin < lastLeave)
     {
-        CreateScalarBar();
+        if (scalarBarWidget_==NULL)
+        {
+            CreateScalarBar();
+        }else
+        {
+            vtkScalarBarActor *barActor=scalarBarWidget_->GetScalarBarActor();
+            barActor->SetLookupTable((vtkScalarsToColors*)contourLookupTable_);
+        }
+        return true;
     }else
     {
-        vtkScalarBarActor *barActor=scalarBarWidget_->GetScalarBarActor();
-        barActor->SetLookupTable((vtkScalarsToColors*)contourLookupTable_);
+        return false;
     }
 }
 
@@ -1240,6 +1264,10 @@ void vtkVISUnContour::ModifyDisplayScalarRange(double min, double max)
         ((vtkDataSetMapper*)_vtkObjects[4])->SetScalarRange(min, max);
         ((vtkDataSetMapper*)_vtkObjects[4])->Modified();
 
+        //((vtkDataSetMapper*)_vtkObjects[4])->GetLookupTable()->SetRange(min,max);
+        //contourLookupTable_->SetRange(min,max);
+        //double* r = ((vtkDataSetMapper*)_vtkObjects[4])->GetLookupTable()->GetRange();
+
         if(representFlag_ == 0)
         {
             (_unActor->GetProperty())->SetRepresentationToPoints();

+ 1 - 1
CAE_Solution/src/VTK/visualization_VTK/vtkVISUnContour.h

@@ -54,7 +54,7 @@ public:
     void DeleteScalarBar();
     void ModifyContourLevel(int level);
     void SetScalarBarEnable(bool enable);
-    void UpdataScalarBar();
+    bool UpdataScalarBar();
 
     //---------------------------------------------
     //0 -- banded

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

@@ -213,6 +213,7 @@ void vtkVISUnGlyph::CreateGlyphDisplay(int uIndex, int vIndex, int wIndex)
         unGrid->DeepCopy(_source->unstruGrid);
 
         vtkDoubleArray* uvwArray = vtkDoubleArray::New();
+        uvwArray->SetName("Vector");
         uvwArray->SetNumberOfComponents(3);
         if (_source->scalarSource[uIndex] != NULL && _source->scalarSource[vIndex] != NULL && _source->scalarSource[wIndex] != NULL)
         {
@@ -559,6 +560,17 @@ void vtkVISUnGlyph::ModifyGlyphVector(int uIndex, int vIndex, int wIndex)
     }
 }
 
+void vtkVISUnGlyph::InitGlyphDisplay(int uIndex, int vIndex, int wIndex)
+{
+    if (_vtkObjects != NULL)
+    {
+        ModifyGlyphVector(uIndex, vIndex, wIndex);
+    }else
+    {
+        CreateGlyphDisplay(uIndex, vIndex, wIndex);
+    }
+}
+
 // --------------------------------------------------------------------------
 /// Show the scalar glyph
 ///

+ 1 - 0
CAE_Solution/src/VTK/visualization_VTK/vtkVISUnGlyph.h

@@ -52,6 +52,7 @@ public:
     void ModifyGlyphScalar(char* scalarName);
     void ModifyGlyphVector(char* vectorName);
     void ModifyGlyphVector(int uIndex, int vIndex, int wIndex);
+    void InitGlyphDisplay(int uIndex, int vIndex, int wIndex);
     void SetScalarVisibilityOn();
     void SetScalarVisibilityOff();
     void SetGlyphFilledOn();

+ 182 - 49
CAE_Solution/src/VTK/visualization_VTK/vtkVISUnSlice.cpp

@@ -21,8 +21,6 @@
 //add by HaoJingjing 2023.2.14 end.
 //----------------------------------------------------------------------------
 
-
-
 vtkStandardNewMacro(vtkVISUnSlice)
 
 //----------------------------------------------------------------------------
@@ -70,7 +68,7 @@ vtkVISUnSlice::vtkVISUnSlice()
     planeNormal_[1] = 0.0;
     planeNormal_[2] = 0.0;
 
-    conLevel_ = 5;
+    conLevel_ = 20;
     usedScalarIndex_ = -1;
     usedVectorIndex_ = -1;
 
@@ -82,6 +80,7 @@ vtkVISUnSlice::vtkVISUnSlice()
     cutSource_ = NULL;
     cutActor_ = NULL;
     gridSource_ = NULL;
+    unShadeMehsActor_ = NULL;
 
     //cutMapper_ = NULL;
 
@@ -112,11 +111,11 @@ vtkVISUnSlice::~vtkVISUnSlice()
 
     if(planeWidget_ != NULL)
     {
-        //if(_renWin != NULL)
-        //{
-        //    planeWidget->SetInteractor(_renWin->GetInteractor());
-        //}
-        // planeWidget_->EnabledOff();
+        if(_renWin != NULL)
+        {
+            planeWidget_->SetInteractor(_renWin->GetInteractor());
+        }
+        planeWidget_->EnabledOff();
         planeWidget_->Delete();
         planeWidget_ = NULL;
     }
@@ -135,6 +134,7 @@ vtkVISUnSlice::~vtkVISUnSlice()
     }
     ErrorInfo(0, "destructure func 4");
 
+
     if(slicePlane_ != NULL)
     {
         slicePlane_->Delete();
@@ -142,6 +142,12 @@ vtkVISUnSlice::~vtkVISUnSlice()
     }
     ErrorInfo(0, "destructure func 5");
 
+    if(unShadeMehsActor_ != NULL)
+    {
+        unShadeMehsActor_->Delete();
+        unShadeMehsActor_ = NULL;
+    }
+
     /*if(cutMapper_ != NULL)
     {
         cutMapper_->Delete();
@@ -233,13 +239,12 @@ void vtkVISUnSlice::SetSliceSource(char* scalar, char* vector)
     vtkUnstructuredGrid *unGrid = vtkUnstructuredGrid::New();
         unGrid->DeepCopy(_source->unstruGrid);
 
-        cout << "point num:  " <<unGrid->GetNumberOfPoints() << ",   cell num:  " << unGrid->GetNumberOfCells() <<endl;
         if (index1 != -1)
         {
             usedScalarIndex_ = index1;
 
             if(_source->scalarSource[index1]->GetDataSize() != 0)
-            {cout << "scalar size : " <<_source->scalarSource[index1]->GetDataSize() << endl;
+            {
                 (unGrid->GetPointData())->SetScalars(_source->scalarSource[index1]);
             }
             else
@@ -264,11 +269,15 @@ void vtkVISUnSlice::SetSliceSource(char* scalar, char* vector)
         unGrid->Modified();
 
     vtkPlane *plane = vtkPlane::New();
-        plane->SetNormal(planeNormal_[0], planeNormal_[1], planeNormal_[2]);
+    plane->SetNormal(planeNormal_[0], planeNormal_[1], planeNormal_[2]);
 
     vtkCutter *cutter = vtkCutter::New();
         cutter->SetInputData(unGrid);
         cutter->SetCutFunction(plane);
+        //double a[6];
+        //unGrid->GetBounds(a);
+        //double xmin = a[0]; double xmax = a[1];
+        //cutter->GenerateValues(3,xmin,xmax);
         cutter->GenerateCutScalarsOff();
         cutter->SetSortByToSortByCell();
         cutter->Update();
@@ -704,9 +713,13 @@ void vtkVISUnSlice::CreateSliceWidget()
         planeWidget->SetInputData(cutSource_->GetOutput());
 
         planeWidget->TubingOff();
-        //planeWidget->OutsideBoundsOff();
+        planeWidget->OutsideBoundsOff();
         planeWidget->SetOrigin(planeOrigin_[0], planeOrigin_[1], planeOrigin_[2]);
         planeWidget->PlaceWidget(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
+
+        //cout << planeOrigin_[0] << " , " << planeOrigin_[1] << " , " << planeOrigin_[2] << endl;
+        //cout << bounds[0] << " , " << bounds[1] << " , " << bounds[2] << " , "<< bounds[3] << " , " << bounds[4] << " , " << bounds[5] << endl;
+
         planeWidget->On();
 
         planeWidget_ = planeWidget;
@@ -729,9 +742,6 @@ void vtkVISUnSlice::GenerateSliceProData(vtkObject *caller, unsigned long, void*
         return;
     }
     usObj->planeWidget_->GetPlane(usObj->slicePlane_);
-
-    //int num;
-    //num = cutSource_->GetOutput()->GetNumberOfPoints();
 }
 // --------------------------------------------------------------------------
 /// Show the slice plane
@@ -787,11 +797,6 @@ void vtkVISUnSlice::ShowOnSlicePlaneWidget()
     {
        planeWidget_->On();
     }
-
-    if (cutActor_)
-    {
-        cutActor_->VisibilityOn();
-    }
 }
 
 // --------------------------------------------------------------------------
@@ -810,11 +815,6 @@ void vtkVISUnSlice::ShowOffSlicePlaneWidget()
     {
         planeWidget_->Off();
     }
-
-    if (cutActor_)
-    {
-        cutActor_->VisibilityOff();
-    }
 }
 // --------------------------------------------------------------------------
 /// Set the normal of the slice plane
@@ -927,6 +927,7 @@ void vtkVISUnSlice::SetSlicePlaneNormalToZ()
 /// @reviser
 double* vtkVISUnSlice::GetSlicePlaneNormal()
 {
+    slicePlane_->GetNormal(planeNormal_);
     return this->planeNormal_;
 }
 // --------------------------------------------------------------------------
@@ -954,7 +955,6 @@ void vtkVISUnSlice::SetSlicePlaneOrigin(double ox, double oy, double oz)
     planeOrigin_[0] = ox;
     planeOrigin_[0] = oy;
     planeOrigin_[0] = oz;
-
 }
 // --------------------------------------------------------------------------
 /// Get the slice plane origin
@@ -968,6 +968,7 @@ void vtkVISUnSlice::SetSlicePlaneOrigin(double ox, double oy, double oz)
 /// @reviser
 double* vtkVISUnSlice::GetSlicePlaneOrigin()
 {
+    planeWidget_->GetOrigin(planeOrigin_);
     return this->planeOrigin_;
 }
 // --------------------------------------------------------------------------
@@ -1023,7 +1024,7 @@ void vtkVISUnSlice::CreateUnSliceContourDisplay()
 
 
     vtkDataSetMapper *mapper = vtkDataSetMapper::New();
-        /*mapper->InterpolateScalarsBeforeMappingOn();
+        mapper->InterpolateScalarsBeforeMappingOn();
 
         if(_source->scalarSource[usedScalarIndex_]->GetDataSize() != 0)
         {
@@ -1051,11 +1052,10 @@ void vtkVISUnSlice::CreateUnSliceContourDisplay()
     vtkLookupTable *table = (vtkLookupTable*)mapper->GetLookupTable();
         table->GetHueRange(range);
         table->SetHueRange(range[1],range[0]);
-        table->SetNumberOfColors(conLevel_);*/
-    mapper->SetInputData(_source->unstruGrid);
+        table->SetNumberOfColors(conLevel_);
 
     vtkActor *actor = vtkActor::New();
-        actor->SetMapper(mapper);actor->GetProperty()->SetColor(1,0,0);
+        actor->SetMapper(mapper);
 
     if (_renderer != NULL)
     {
@@ -1064,7 +1064,7 @@ void vtkVISUnSlice::CreateUnSliceContourDisplay()
 
     sliceActors_[0] = actor;
 
-    //sliceTable_[0] = table;
+    sliceTable_[0] = table;
 
     bandedContourFilter_ = conFilter;
 }
@@ -2320,6 +2320,8 @@ bool vtkVISUnSlice::GetXMaxPointData(double* xMax,vtkPoints* Points)
     return true;
 }
 
+#include <vtkSphereSource.h>
+#include<vtkPolyDataMapper.h>
 //////////////////////////////////////////////////////
 void vtkVISUnSlice::SetSliceSource_FD(char* scalar, char* vector)
 {
@@ -2371,7 +2373,7 @@ void vtkVISUnSlice::SetSliceSource_FD(char* scalar, char* vector)
         unGrid->Modified();
 
     vtkPlane *plane = vtkPlane::New();
-        plane->SetNormal(planeNormal_[0], planeNormal_[1], planeNormal_[2]);
+    plane->SetNormal(planeNormal_[0], planeNormal_[1], planeNormal_[2]);
 
     vtkCutter *cutter = vtkCutter::New();
         cutter->SetInputData(unGrid);
@@ -2380,8 +2382,6 @@ void vtkVISUnSlice::SetSliceSource_FD(char* scalar, char* vector)
         cutter->SetSortByToSortByCell();
         cutter->Update();
 
-        //cout<<"test here 1111"<<(cutter->GetOutput())->GetNumberOfPoints()<<endl;
-
     gridSource_ = unGrid;
     cutSource_ = cutter;
     slicePlane_ =  plane;
@@ -2422,8 +2422,10 @@ void vtkVISUnSlice::CreateSliceWidget_FD()
         planeWidget->PlaceWidget(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
         planeWidget->SetOrigin(planeOrigin_[0], planeOrigin_[1], planeOrigin_[2]);
         slicePlane_->SetOrigin(planeOrigin_[0], planeOrigin_[1], planeOrigin_[2]);
+
         vtkFloatArray *arry = GetCutScalarData();
         if (arry)  arry->GetRange(scalarRange_);
+
         //add end
         planeWidget->On();
 
@@ -2435,6 +2437,24 @@ void vtkVISUnSlice::CreateSliceWidget_FD()
 
         planeWidget->AddObserver(vtkCommand::InteractionEvent, cc);
 }
+
+
+bool vtkVISUnSlice::GetSourceBounds_FD(double *bounds)
+{
+    if (cutSource_ == NULL)
+    {
+        ErrorInfo(1,"Slice Source Not Set");
+        return false;
+    }
+    double *bounds2;
+    bounds2 = _source->GetSourceBounds();
+    for (int i = 0; i < 6; i ++)
+    {
+        bounds[i] = bounds2[i];
+    }
+    return true;
+}
+
 void vtkVISUnSlice::GenerateSliceProData_FD(vtkObject *caller, unsigned long, void* obj, void *)
 {
     vtkVISUnSlice* usObj = (vtkVISUnSlice*)obj;
@@ -2442,14 +2462,20 @@ void vtkVISUnSlice::GenerateSliceProData_FD(vtkObject *caller, unsigned long, vo
     if (usObj->planeWidget_ == NULL)
     {
         usObj->ErrorInfo(1,"Plane Widget Not Created");
-        return;
+       // return;
+    }else
+    {
+        usObj->planeWidget_->GetPlane(usObj->slicePlane_);
     }
-    usObj->planeWidget_->GetPlane(usObj->slicePlane_);
     //add begin. when cut plane moving, update the cut plane's scalar range
+    usObj->ModifyDisplayScalarRange_FD(usObj->scalarRange_[0], usObj->scalarRange_[1]);
     double r[2];
     vtkFloatArray *arry = usObj->GetCutScalarData();
-    if (arry)  arry->GetRange(r);
-    usObj->ModifyDisplayScalarRange_FD(r[0], r[1]);
+    if (arry)
+    {
+        arry->GetRange(r);
+        usObj->ModifyDisplayScalarRange_FD(r[0], r[1]);
+    }
     //add end
 }
 
@@ -2460,7 +2486,6 @@ void vtkVISUnSlice::CreateUnSliceContourDisplay_FD()
         ErrorInfo(1,"Slice Source Not Set");
         return;
     }
-
     double range[2];
     if (usedScalarIndex_ != -1)
     {
@@ -2477,12 +2502,13 @@ void vtkVISUnSlice::CreateUnSliceContourDisplay_FD()
     cutSource_->Update();
 
     vtkGeometryFilter *geoFilter = vtkGeometryFilter::New();
-        geoFilter->SetInputData(cutSource_->GetOutput());
+        geoFilter->SetInputConnection(cutSource_->GetOutputPort());
+    //geoFilter->SetInputData(cutSource_->GetOutput());
         geoFilter->Update();
 
     vtkBandedPolyDataContourFilter *conFilter = vtkBandedPolyDataContourFilter::New();
         conFilter->GlobalWarningDisplayOff();
-        conFilter->SetInputData(geoFilter->GetOutput());
+        conFilter->SetInputConnection(geoFilter->GetOutputPort());
         conFilter->GenerateValues(conLevel_, range[0], range[1]);
         conFilter->ClippingOn();
         conFilter->Modified();
@@ -2499,6 +2525,7 @@ void vtkVISUnSlice::CreateUnSliceContourDisplay_FD()
         {
             mapper->SetInputConnection(geoFilter->GetOutputPort());
         }
+        //mapper->SetInputConnection(cutSource_->GetOutputPort());
         mapper->SetScalarRange(range[0],range[1]);
 
         if (usedScalarIndex_ != -1)
@@ -2520,6 +2547,7 @@ void vtkVISUnSlice::CreateUnSliceContourDisplay_FD()
 
     vtkActor *actor = vtkActor::New();
         actor->SetMapper(mapper);
+        actor->GetProperty()->SetColor(1,0,0);
 
     if (_renderer != NULL)
     {
@@ -2695,7 +2723,6 @@ void vtkVISUnSlice::ModifyDisplayScalarRange_FD(double min,double max)
                 (sliceActors_[i]->GetMapper())->Modified();
 
                 sliceActors_[i]->Modified();
-
             }
         }
     }
@@ -2738,9 +2765,12 @@ void vtkVISUnSlice::ModifySliceSourceScalar_FD(char* scalar)
     gridSource_->Modified();
 
     usedScalarIndex_ = index;
-
+///////////////////////2023.3.20 zhaoyu add ///////
     vtkFloatArray *arry = GetCutScalarData();
     if (arry)  arry->GetRange(scalarRange_);
+
+///////////////add end//////////////////////////////
+
     //2011-05-10 zhuqin add begin.
     if(bandedContourFilter_ != NULL)
     {
@@ -2790,17 +2820,120 @@ void vtkVISUnSlice::ModifySliceSourceScalar_FD(char* scalar)
 
 }
 
-bool vtkVISUnSlice::GetSourceBounds_FD(double *bounds)
+void vtkVISUnSlice::CreatUnShadeMeshDisplay()
 {
     if (cutSource_ == NULL)
     {
         ErrorInfo(1,"Slice Source Not Set");
-        return false;
+        return;
     }
-    double *range = _source->GetSourceBounds();
-    for (int i = 0; i < 6; ++i)
+    vtkDataSetMapper* mapper = vtkDataSetMapper::New();
+    mapper->SetInputData(gridSource_);
+    mapper->ScalarVisibilityOff();
+
+    unShadeMehsActor_ = vtkActor::New();
+    unShadeMehsActor_->GetProperty()->SetColor(0.5,0.5,0.5);
+    unShadeMehsActor_->GetProperty()->SetOpacity(0.4);
+    unShadeMehsActor_->SetMapper(mapper);
+
+    if (_renderer != NULL)
     {
-        bounds[i] = range[i];
+        _renderer->AddActor(unShadeMehsActor_);
     }
-    return true;
+
+}
+void vtkVISUnSlice::ShowOnUnshadeMesh()
+{
+    if (unShadeMehsActor_ != NULL)
+    {
+        unShadeMehsActor_->VisibilityOn();
+    }
+}
+
+void vtkVISUnSlice::ShowOffUnShadeMesh()
+{
+    if (unShadeMehsActor_ != NULL)
+    {
+        unShadeMehsActor_->VisibilityOff();
+    }
+}
+
+void vtkVISUnSlice::ShowOffCutActor()
+{
+    for (int i = 0; i < 6; i ++)
+    {
+        if(sliceActors_[i] != NULL)
+        {
+            sliceActors_[i]->VisibilityOff();
+        }
+    }
+}
+
+vector<vtkDoubleArray*> vtkVISUnSlice::GetSliceData()
+{
+    cutSource_->Update();
+
+    vector<vtkDoubleArray*> xyplot2dDataVec;
+    xyplot2dDataVec.clear();
+    vtkDoubleArray* cutScalar = vtkDoubleArray::New();
+        cutScalar->SetNumberOfComponents(1);
+
+        if(usedScalarIndex_ != -1)
+        {
+            if(_source->scalarSource[usedScalarIndex_]->GetDataSize() != 0)
+            {
+                cutScalar->DeepCopy((cutSource_->GetOutput())->GetPointData()->GetScalars());
+            }
+            else
+            {
+                cutScalar->DeepCopy((cutSource_->GetOutput())->GetCellData()->GetScalars());
+            }
+        }
+        cutScalar->Modified();
+
+    vtkDoubleArray* cutVector = vtkDoubleArray::New();
+        cutVector->SetNumberOfComponents(3);
+
+        if(usedVectorIndex_ != -1)
+        {
+            if(_source->vectorSource[usedVectorIndex_]->GetDataSize() != 0)
+            {
+                cutVector->DeepCopy((cutSource_->GetOutput())->GetPointData()->GetVectors());
+            }
+            else
+            {
+                cutVector->DeepCopy((cutSource_->GetOutput())->GetCellData()->GetVectors());
+            }
+        }
+        cutVector->Modified();
+
+    double range[2];
+    double cutScalarRange_[2];
+
+    (cutSource_->GetOutput())->GetScalarRange(range);
+    cutScalarRange_[0] = range[0];
+    cutScalarRange_[1] = range[1];
+
+
+    if(_source->scalarSource[usedScalarIndex_]->GetDataSize() != 0)
+    {
+        int pointNum = 0;
+        pointNum = (cutSource_->GetOutput())->GetNumberOfPoints();
+        //cout << pointNum << endl;
+        vtkDoubleArray* xyz = vtkDoubleArray::New();
+        xyz->SetNumberOfComponents(3);
+        xyz->SetName("xyz");
+        xyz->SetNumberOfTuples(pointNum);
+        vtkPoints* pdata = (cutSource_->GetOutput())->GetPoints();
+        for (int i = 0; i < pointNum; i ++)
+        {
+            double p[3];
+            pdata->GetPoint(i, p);
+            //cout << p[0] << ", " <<p[1]<< "," <<p[2]<< "    scalar : "<< cutScalar->GetValue(i) << endl;
+            xyz->SetTuple(i, p);
+        }
+        xyplot2dDataVec.push_back(xyz);
+        xyplot2dDataVec.push_back(cutScalar);
+    }
+    return xyplot2dDataVec;
 }

+ 12 - 11
CAE_Solution/src/VTK/visualization_VTK/vtkVISUnSlice.h

@@ -29,16 +29,8 @@ using namespace std;
 #include "vtkBandedPolyDataContourFilter.h"
 #include "vtkGeometryFilter.h"
 #include "vtkFloatArray.h"
-//#include "vtkVISUnPFrontAndPBehindSource.h"
-// --------------------------------------------------------------------------
-/// Class that manage slice rendering
-///
-/// To CreateSliceDisplay(), you need to do these first \n
-/// SetDataSource(), then SetSliceSource(),CreateSliceWidget()
-///
-/// @author HUANG Jiaqi
-/// @date 2010-06-01
-/// @reviser
+#include "vtkPolyData.h"
+
 class  vtkVISUnSlice : public vtkVISUnstructuredGridManager
 {
 public:
@@ -171,6 +163,15 @@ public:
     void ModifySliceSourceScalar_FD(char* scalar);
     bool GetSourceBounds_FD(double *bounds);
     ///////
+
+    ////
+    //void ShowOnCutActor();
+    void ShowOffCutActor();
+
+    void CreatUnShadeMeshDisplay();
+    void ShowOnUnshadeMesh();
+    void ShowOffUnShadeMesh();
+    vector<vtkDoubleArray*> GetSliceData();
 protected:
 
     double planeNormal_[3];
@@ -200,7 +201,7 @@ protected:
     vtkActor** sliceActors_;
     vtkCollection* sliceMapper_;
     vtkLookupTable** sliceTable_;
-
+    vtkActor* unShadeMehsActor_;
 
     vtkContourFilter* contourLinesFilter_;
     vtkContourFilter* contourLabelFilter_;

+ 2178 - 0
CAE_Solution/src/VTK/visualization_VTK/vtkVISUnStreamTrace.cpp

@@ -0,0 +1,2178 @@
+#include "vtkVISUnStreamTrace.h"
+
+//add by ZhaoYu 2023.2.28 begin.
+#include <vtkActor.h>
+#include <vtkRenderer.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkDoubleArray.h>
+#include "vtkVISUnstructuredGridSource.h"
+#include <vtkPointData.h>
+#include <vtkCellData.h>
+#include <vtkRenderWindow.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkProperty.h>
+#include <vtkObject.h>
+#include <vtkLineSource.h>
+#include <vtkGlyphSource2D.h>
+#include <vtkGlyph3D.h>
+#include <vtkUnstructuredGridWriter.h>
+#include <vtkMaskPoints.h>
+#include <vtkArrayCalculator.h>
+//add by HaoJingjing 2023.2.28 end.
+
+vtkStandardNewMacro(vtkVISUnStreamTrace)
+
+vtkVISUnStreamTrace::vtkVISUnStreamTrace()
+{
+    lineSeedsNumber = 5;
+
+    MinimumStep = 0.005;
+    MaxPropagation = 1000;
+    InitialStep = 0.05;
+
+    tubeRadius = 0.1;
+    tubeSides = 5;
+    ribbonWidth = 0.1;
+    ribbonFactor = 2.0;
+
+    sphereRadius = 0.5;
+    sphereTheta = 5;
+    spherePhi = 5;
+
+    SelectState_ = 0;
+
+    streamStyle_ = "Line";
+    InteDirection_ = "Both";
+
+    seedstype_ = "Line Source";
+
+    lineAlignAxis_ = "Y";
+
+    scalarIndex_ = 0;
+    vectorIndex_ = 0;
+    vectorType_ = -1;
+
+    for (int i=0; i<3; i++)
+    {
+        startPosition[i] = 0;
+    }
+
+    streamSource_ = NULL;
+    integrator4_ = NULL;
+    streamTracer_ = NULL;
+    tubeFilter_ = NULL;
+    ribbonFilter_ = NULL;
+    streamMapper_ = NULL;
+    streamActor_ = NULL;
+
+    streamSeeds_ = NULL;
+    pointWidget_= NULL;
+    lineWidget_= NULL;
+    planeWidget_= NULL;
+    sphereWidget_= NULL;
+
+    oneStreamActor_ = NULL;
+    oneStreamTracer_ = NULL;
+    oneTubeFilter_ = NULL;
+    oneRibbonFilter_ = NULL;
+    oneIntegrator4_ = NULL;
+    oneStreamMapper_ = NULL;
+    style_ = NULL;
+    positionVec_.clear();
+}
+vtkVISUnStreamTrace::~vtkVISUnStreamTrace()
+{
+    if (streamActor_ != NULL)
+    {
+        if (_renderer != NULL)
+        {
+            _renderer->RemoveActor(streamActor_);
+        }
+        streamActor_->Delete();
+    }
+
+    if (oneStreamActor_ != NULL)
+    {
+        oneStreamActor_->InitTraversal();
+
+        int num = oneStreamActor_->GetNumberOfItems();
+        vtkActor* actor = NULL;
+        for (int i=0; i< num;i++)
+        {
+            actor = (vtkActor* )oneStreamActor_->GetItemAsObject (i);
+            _renderer->RemoveActor(actor);
+        }
+        if (actor != NULL)
+        {
+            actor->Delete ();
+        }
+
+        oneStreamActor_->Delete ();
+    }
+    if (oneStreamTracer_ != NULL)
+    {
+        oneStreamTracer_->Delete ();
+    }
+    if (oneTubeFilter_ != NULL)
+    {
+        oneTubeFilter_->Delete ();
+    }
+    if (oneRibbonFilter_ != NULL)
+    {
+        oneRibbonFilter_->Delete ();
+    }
+    if (oneIntegrator4_ != NULL)
+    {
+        oneIntegrator4_->Delete ();
+    }
+    if (oneStreamMapper_ != NULL)
+    {
+        oneStreamMapper_->Delete ();
+    }
+
+    if (streamSeeds_ != NULL)
+    {
+        streamSeeds_->Delete();
+    }
+    if (pointWidget_ != NULL)
+    {
+
+        pointWidget_->Delete();
+    }
+    if (lineWidget_ != NULL)
+    {
+
+        lineWidget_->Delete();
+    }
+    if (planeWidget_ != NULL)
+    {
+
+        planeWidget_->Delete();
+    }
+    if (sphereWidget_ != NULL)
+    {
+
+        sphereWidget_->Delete();
+    }
+    if (streamSource_ != NULL)
+    {
+        streamSource_->Delete();
+    }
+    if (integrator4_ != NULL)
+    {
+        integrator4_->Delete();
+    }
+    if (streamTracer_ != NULL)
+    {
+        streamTracer_->Delete();
+    }
+    if (tubeFilter_ != NULL)
+    {
+        tubeFilter_->Delete();
+    }
+    if (ribbonFilter_ != NULL)
+    {
+        ribbonFilter_->Delete();
+    }
+    if (streamMapper_ != NULL)
+    {
+        streamMapper_->Delete();
+    }
+
+
+    if (style_ != NULL)
+    {
+        style_->Delete();
+        style_ = NULL;
+    }
+
+    streamSource_ = NULL;
+    integrator4_ = NULL;
+    streamTracer_ = NULL;
+    tubeFilter_ = NULL;
+    ribbonFilter_ = NULL;
+    streamMapper_ = NULL;
+    streamActor_ = NULL;
+
+    streamSeeds_ = NULL;
+    pointWidget_= NULL;
+    lineWidget_= NULL;
+    planeWidget_= NULL;
+    sphereWidget_= NULL;
+
+    oneStreamActor_ = NULL;
+    oneStreamTracer_ = NULL;
+    oneTubeFilter_ = NULL;
+    oneRibbonFilter_ = NULL;
+    oneIntegrator4_ = NULL;
+    oneStreamMapper_ = NULL;
+    positionVec_.clear();
+}
+// --------------------------------------------------------------------------
+/// Set the scalar/vector data source for stream/trace rendering
+///
+/// @param scalar scalar name
+/// @param vector vector name
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-01
+/// @reviser
+void vtkVISUnStreamTrace::SetStreamTraceSource(char* scalar, char* vector)
+{
+    int scalarIndex = _source->GetScalarIndex(scalar);
+    int vectorIndex = _source->GetVectorIndex(vector);
+
+    /*
+    if (scalarIndex == -1 && vectorIndex == -1)
+    {
+        ErrorInfo(1,"Both Scalar and vector data are not existed!");
+        return;
+    }
+    */
+
+    vtkUnstructuredGrid *unGrid = vtkUnstructuredGrid::New();
+        unGrid->DeepCopy(_source->unstruGrid);
+        if (scalarIndex != -1)
+        {
+            scalarIndex_ = scalarIndex;
+
+            if(_source->scalarSource[scalarIndex]->GetDataSize() != 0)
+            {
+                (unGrid->GetPointData())->SetScalars(_source->scalarSource[scalarIndex]);
+            }
+            else
+            {
+                (unGrid->GetCellData())->SetScalars(_source->cellScalarSource_[scalarIndex]);
+            }
+        }
+        if (vectorIndex != -1)
+        {
+            vectorIndex_ = vectorIndex;
+
+            if(_source->vectorSource[vectorIndex]->GetDataSize() != 0)
+            {
+                (unGrid->GetPointData())->SetVectors(_source->vectorSource[vectorIndex]);
+            }
+            else
+            {
+                (unGrid->GetCellData())->SetVectors(_source->cellVectorSource_[vectorIndex]);
+            }
+        }
+        else
+        {
+            ErrorInfo(1,"Vector data are not existed!");
+            return;
+        }
+        unGrid->Modified();
+
+    streamSource_ = unGrid;
+    scalarIndex_ = scalarIndex;
+    vectorIndex_ = vectorIndex;
+}
+
+// --------------------------------------------------------------------------
+/// creat data source
+///
+/// @param scalar name u、v、w
+///
+/// @return
+///
+/// @author zhaoyu
+/// @date 20230303
+void vtkVISUnStreamTrace::SetStreamTraceSource(char* u, char* v, char* w)
+{
+    //int scalarIndex = 0;
+    int uIndex = -1;
+    int vIndex = -1;
+    int wIndex = -1;
+    uIndex = _source->GetScalarIndex(u);
+    vIndex = _source->GetScalarIndex(v);
+    wIndex = _source->GetScalarIndex(w);
+    vtkUnstructuredGrid *unGrid = vtkUnstructuredGrid::New();
+    unGrid->DeepCopy(_source->unstruGrid);
+
+    vtkDoubleArray* uvwArray = vtkDoubleArray::New();
+    uvwArray->SetName("vector");
+    uvwArray->SetNumberOfComponents(3);
+    if (_source->scalarSource[uIndex] != NULL && _source->scalarSource[vIndex] != NULL && _source->scalarSource[wIndex] != NULL)
+    {
+        if (_source->scalarSource[uIndex]->GetDataSize() != 0 &&
+                _source->scalarSource[vIndex]->GetDataSize() != 0 &&
+                _source->scalarSource[wIndex]->GetDataSize() != 0)
+        {
+            uvwArray->SetNumberOfTuples(unGrid->GetNumberOfPoints());
+            vectorType_ = 0;
+            double uvw[3];
+            for (int i = 0; i < unGrid->GetNumberOfPoints(); i ++)
+            {
+                 uvw[0] = _source->scalarSource[uIndex]->GetTuple1(i);
+                 uvw[1] = _source->scalarSource[vIndex]->GetTuple1(i);
+                 uvw[2] = _source->scalarSource[wIndex]->GetTuple1(i);
+                 uvwArray->SetTuple(i, uvw);
+            }
+        }else if (_source->cellScalarSource_[uIndex]->GetDataSize() != 0 &&
+                  _source->cellScalarSource_[vIndex]->GetDataSize() != 0 &&
+                  _source->cellScalarSource_[wIndex]->GetDataSize() != 0)
+         {
+             uvwArray->SetNumberOfTuples(unGrid->GetNumberOfCells());
+             vectorType_ = 1;
+             double uvw[3];
+             for (int i = 0; i < unGrid->GetNumberOfCells(); i ++)
+             {
+                  uvw[0] = _source->cellScalarSource_[uIndex]->GetTuple1(i);
+                  uvw[1] = _source->cellScalarSource_[vIndex]->GetTuple1(i);
+                  uvw[2] = _source->cellScalarSource_[wIndex]->GetTuple1(i);
+                  uvwArray->SetTuple(i, uvw);
+             }
+         }else
+         {
+             vectorType_ = -1;
+             return;
+         }
+    }
+    /*if (scalarIndex != -1)
+    {
+        scalarIndex_ = scalarIndex;
+
+        if(_source->scalarSource[scalarIndex]->GetDataSize() != 0)
+        {
+            (unGrid->GetPointData())->SetScalars(_source->scalarSource[scalarIndex]);
+        }
+        else
+        {
+            (unGrid->GetCellData())->SetScalars(_source->cellScalarSource_[scalarIndex]);
+        }
+    }*/
+    if(vectorType_ == 0)
+    {
+        (unGrid->GetPointData())->SetVectors(uvwArray);
+    }
+    else if(vectorType_ == 1)
+    {
+        (unGrid->GetCellData())->SetVectors(uvwArray);
+    }
+    else
+    {
+        return;
+    }
+    uvwArray->GetRange(vectorRange, -1);
+    unGrid->Modified();
+
+    streamSource_ = unGrid;
+}
+// --------------------------------------------------------------------------
+/// Change scalar/vector data source
+///
+/// @param scalar
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-01
+/// @reviser Shen Jie
+/// @date 2011-01-08
+void vtkVISUnStreamTrace::ModifyStreamTraceScalar(char* scalar)
+{
+    double range[2];
+    int scalarIndex = -1;
+
+    range[0] = 0;
+    range[1] = 0;
+
+    if(scalar != NULL)
+    {
+        scalarIndex = _source->GetScalarIndex(scalar);
+    }
+    if (streamSource_ != NULL && scalarIndex != -1)
+    {
+        if (_source->scalarSource[scalarIndex] != NULL)
+        {
+            if(scalarIndex != -1)
+            {
+                scalarIndex_ = scalarIndex;
+
+                if(_source->scalarSource[scalarIndex]->GetDataSize() != 0)
+                {
+                    (streamSource_->GetPointData())->SetScalars(_source->scalarSource[scalarIndex]);
+                }
+                else
+                {
+                    (streamSource_->GetCellData())->SetScalars(_source->cellScalarSource_[scalarIndex]);
+                }
+            }
+            streamSource_->Modified();
+        }
+        else
+        {
+            ErrorInfo(1,"This Scalar is empty, Please Load First!");
+            return;
+        }
+    }
+    else
+    {
+        ErrorInfo(1,"StreamTrace source are not setted!");
+        return;
+    }
+    if(scalarIndex_ != -1)
+    {
+        range[0] = _source->scalarRange[scalarIndex_][0];
+        range[1] = _source->scalarRange[scalarIndex_][1];
+    }
+
+    if(streamMapper_ != NULL)
+    {
+        streamMapper_->SetScalarRange(range[0], range[1]);
+        streamMapper_->Modified();
+    }
+    /*if(oneStreamMapper_ != NULL)
+    {
+        oneStreamMapper_->SetScalarRange(range[0], range[1]);
+        oneStreamMapper_->Modified();
+    }*/
+    if (oneStreamActor_ != NULL)
+    {
+        oneStreamActor_->InitTraversal();//指针回到第一个actor
+
+        vtkActor * pActor = oneStreamActor_->GetNextActor();
+
+        while(pActor)
+        {
+            pActor->GetMapper()->SetScalarRange(range[0], range[1]);
+
+            pActor->GetMapper()->Modified();
+
+            pActor = oneStreamActor_->GetNextActor();
+        }
+    }
+}
+// --------------------------------------------------------------------------
+/// Change scalar/vector data source
+///
+/// @param vector
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-01
+/// @reviser
+void vtkVISUnStreamTrace::ModifyStreamTraceVector(char* vector)
+{
+    int vectorIndex = _source->GetVectorIndex(vector);
+
+    if (streamSource_ != NULL && vectorIndex != -1)
+    {
+        if (_source->vectorSource[vectorIndex] != NULL)
+        {
+            if(_source->vectorSource[vectorIndex]->GetDataSize() != 0)
+            {
+                (streamSource_->GetPointData())->SetVectors(_source->vectorSource[vectorIndex]);
+            }
+            else
+            {
+                (streamSource_->GetCellData())->SetVectors(_source->cellVectorSource_[vectorIndex]);
+            }
+            streamSource_->Modified();
+
+            vectorIndex_ = vectorIndex;
+        }
+        else
+        {
+            ErrorInfo(1,"This Vector is empty, Please Load First!");
+            return;
+        }
+    }
+    else
+    {
+        ErrorInfo(1,"StreamTrace source are not setted!");
+    }
+}
+// --------------------------------------------------------------------------
+/// Create stream trace display pipeline
+///
+/// @param
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-01
+/// @reviser Shen Jie
+/// @date 2011-01-08
+void vtkVISUnStreamTrace::CreateStreamTraceDisplay()
+{
+    /*if (scalarIndex_ == -1)
+        {
+            ErrorInfo(1, "Can't create stream line, scalar not exists.");
+            return;
+        }*/
+        /*double *range;
+        range = _source->scalarRange[scalarIndex_];*/
+
+        double range[2];
+
+        if (scalarIndex_ != -1)
+        {
+            range[0] =  _source->scalarRange[scalarIndex_][0];
+            range[1] =  _source->scalarRange[scalarIndex_][1];
+        }
+        else
+        {
+            range[0] = 0;
+            range[1] = 0;
+        }
+
+        vtkRungeKutta4 *kutta4 = vtkRungeKutta4::New();
+
+        integrator4_ = vtkRungeKutta4::New();
+        integrator4_ = kutta4;
+
+        vtkStreamTracer *streamer = vtkStreamTracer::New();
+
+            streamer->SetInputData(streamSource_);
+            streamer->SetSourceData(streamSeeds_);
+            streamer->SetIntegrator(integrator4_);
+            streamer->SetMaximumPropagation(MaxPropagation);
+             streamer->SetInitialIntegrationStep(InitialStep);
+            streamer->SetMinimumIntegrationStep(MinimumStep);
+
+            if (InteDirection_ == "Forward")
+            {
+                streamer->SetIntegrationDirectionToForward();
+            }
+            else if (InteDirection_ == "Backward")
+            {
+                streamer->SetIntegrationDirectionToBackward();
+            }
+            else
+            {
+                streamer->SetIntegrationDirectionToBoth();
+            }
+            streamer->Update();cout << streamer->GetOutput()->GetNumberOfPoints() << endl;
+
+        vtkTubeFilter *tFilter = vtkTubeFilter::New();
+            tFilter->SetInputConnection(streamer->GetOutputPort());
+            tFilter->SetVaryRadiusToVaryRadiusByVector();
+            tFilter->SetRadius(tubeRadius);
+            tFilter->SetNumberOfSides(tubeSides);
+
+        vtkRibbonFilter *rFilter = vtkRibbonFilter::New();
+            rFilter->SetInputConnection(streamer->GetOutputPort());
+            rFilter->SetWidth(ribbonWidth);
+            rFilter->SetWidthFactor(ribbonFactor);
+
+        vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
+        mapper->SetInputConnection(streamer->GetOutputPort());
+
+        vtkActor* actor = vtkActor::New();
+        actor->SetMapper(mapper);
+        actor->GetProperty()->SetColor(0,0,1);
+        _renderer->AddActor(actor);
+
+        streamTracer_ = streamer;
+        tubeFilter_ = tFilter;
+        ribbonFilter_ = rFilter;
+        streamMapper_ = mapper;
+
+        _unActor = actor;
+        _renWin->Render();
+
+            /*mapper->InterpolateScalarsBeforeMappingOn();
+            mapper->SetScalarRange(range[0], range[1]);
+
+            if (scalarIndex_ != -1)
+            {
+                if (_source->scalarSource[scalarIndex_]->GetDataSize() != 0)
+                {
+                    mapper->SetScalarModeToUsePointData();
+                }
+                else
+                {
+                    mapper->SetScalarModeToUseCellData();
+                }
+            }
+
+            if (streamStyle_ == "Tube")
+            {
+               // mapper->SetInputConnection(tFilter->GetOutputPort());
+            }
+            else if (streamStyle_ == "Ribbon")
+            {
+                //mapper->SetInputConnection(rFilter->GetOutputPort());
+            }
+            else
+            {
+                mapper->SetInputConnection(streamer->GetOutputPort());
+            }
+
+        vtkLookupTable *lut = (vtkLookupTable*)(mapper->GetLookupTable());
+            lut->GetHueRange(range);
+            lut->SetHueRange(range[1], range[0]);
+
+        vtkActor *actor = vtkActor::New();
+            actor->SetMapper(mapper);
+            actor->VisibilityOn();
+
+        _renderer->AddActor(actor);
+
+        streamTracer_ = streamer;
+        //tubeFilter_ = tFilter;
+        //ribbonFilter_ = rFilter;
+        streamMapper_ = mapper;
+
+        _unActor = actor;*/
+}
+
+void vtkVISUnStreamTrace::CreateStreamTraceDisplayByVector()
+{
+    vtkRungeKutta4 *kutta4 = vtkRungeKutta4::New();//算法
+
+    integrator4_ = vtkRungeKutta4::New();
+    integrator4_ = kutta4;
+
+    vtkStreamTracer *streamer = vtkStreamTracer::New();
+
+    streamer->SetInputData(streamSource_);
+    streamer->SetSourceData(streamSeeds_);
+    streamer->SetIntegrator(integrator4_);//设置积分方法
+    streamer->SetMaximumPropagation(MaxPropagation);//设置迭代次数
+    streamer->SetInitialIntegrationStep(InitialStep);//设置迭代步长
+    streamer->SetMinimumIntegrationStep(MinimumStep);
+    if (InteDirection_ == "Forward")
+    {
+        streamer->SetIntegrationDirectionToForward();//指定流线方向向前
+    }
+    else if (InteDirection_ == "Backward")
+    {
+        streamer->SetIntegrationDirectionToBackward();//指定流线方向向后
+    }
+    else
+    {
+        streamer->SetIntegrationDirectionToBoth();//指定流线在两个方向集成
+    }
+
+    streamer->Update();
+
+    vtkTubeFilter *tFilter = vtkTubeFilter::New();//在线条周围生成管道的过滤器
+        tFilter->SetInputConnection(streamer->GetOutputPort());
+        //tFilter->SetInputArrayToProcess(1,0,0,vtkDataObject::FIELD_ASSOCIATION_POINTS, "vector");
+        tFilter->SetRadius(tubeRadius);
+        tFilter->SetNumberOfSides(tubeSides);
+        tFilter->SetVaryRadiusToVaryRadiusByVector();
+        tFilter->Update();
+
+    vtkRibbonFilter *rFilter = vtkRibbonFilter::New();//从多边形数据集中定义的线创建定向色带
+        rFilter->SetInputConnection(streamer->GetOutputPort());
+        rFilter->SetWidth(ribbonWidth);
+        rFilter->SetWidthFactor(ribbonFactor);
+        rFilter->Update();
+
+        vtkArrayCalculator* calc = vtkArrayCalculator::New();
+        calc->SetInputConnection(streamer->GetOutputPort());
+        calc->AddVectorArrayName("vector");
+        calc->SetFunction("mag(vector)");
+        calc->SetResultArrayName("vector_mag");
+        calc->Update();
+
+    /*vtkMaskPoints* mask = vtkMaskPoints::New();
+    mask->SetInputConnection(streamer->GetOutputPort());
+    mask->SetRandomMode(1);
+    mask->SetRandomModeType(2);
+    mask->SetMaximumNumberOfPoints(50);
+    mask->Update();
+
+    vtkGlyphSource2D* source = vtkGlyphSource2D::New();
+    source->SetScale(1);//设置字形比例
+    source->SetGlyphTypeToArrow();
+    source->SetFilled(0);//关闭字形填充
+    source->SetOutputPointsPrecision(vtkAlgorithm::SINGLE_PRECISION);//为输入点设置精度
+    source->Update();
+
+    vtkGlyph3D* glyph = vtkGlyph3D::New();
+    glyph->SetSourceConnection(source->GetOutputPort());
+    glyph->SetInputData(mask->GetOutput());
+    glyph->OrientOn();//关闭向矢量/法线方向输入几何图形
+    //glyph->SetVectorMode(1);//指定用矢量还是法向量来执行操作
+    glyph->SetVectorModeToUseVector();
+    glyph->SetScaleMode(0);//打开缩放功能
+    glyph->SetScaleModeToScaleByVector();
+    glyph->SetScaleFactor(0.2);
+    glyph->SetColorModeToColorByVector();
+    glyph->Update();*/
+
+    vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
+    if (streamStyle_ == "Tube")
+    {
+        mapper->SetInputConnection(tFilter->GetOutputPort());
+    }
+    else if (streamStyle_ == "Ribbon")
+    {
+        mapper->SetInputConnection(rFilter->GetOutputPort());
+    }
+    else
+    {
+        /*vtkPolyDataMapper* mapper1 = vtkPolyDataMapper::New();
+        mapper1->SetInputConnection(glyph->GetOutputPort());
+        vtkActor* actor = vtkActor::New();
+        actor->SetMapper(mapper1);
+        actor->GetProperty()->SetColor(0,0,1);
+        _renderer->AddActor(actor);*/
+        mapper->SetInputConnection(streamer->GetOutputPort());
+    }
+
+    vtkActor* actor = vtkActor::New();
+    actor->SetMapper(mapper);
+    actor->GetProperty()->SetColor(0,0,1);
+    _renderer->AddActor(actor);
+
+    streamTracer_ = streamer;
+    tubeFilter_ = tFilter;
+    ribbonFilter_ = rFilter;
+    streamMapper_ = mapper;
+
+    _unActor = actor;
+    _renWin->Render();
+    /*vtkStreamTracer *streamer = vtkStreamTracer::New();
+
+        streamer->SetInputData(streamSource_);
+        //streamer->SetSourceData(streamSeeds_);//指定用于生成种子的源对象
+        streamer->SetSourceConnection(line->GetOutputPort());
+
+        streamer->SetMinimumIntegrationStep(MinimumStep);//指定线积分最小步长
+        //streamer->SetMinimumIntegrationStepUnitToLengthUnit();
+
+        streamer->SetMaximumPropagation(MaxPropagation);//指定流线最大长度
+        //streamer->SetMaximumPropagationUnitToCellLengthUnit();
+
+        streamer->SetInitialIntegrationStep(InitialStep);//指定用于线积分的初始步长
+        //streamer->SetInitialIntegrationStepUnitToCellLengthUnit();
+
+        streamer->SetIntegrator(integrator4_);//设置用于流线生成的整分器类型
+
+        if (InteDirection_ == "Forward")
+        {
+            streamer->SetIntegrationDirectionToForward();//指定流线方向向前
+        }
+        else if (InteDirection_ == "Backward")
+        {
+            streamer->SetIntegrationDirectionToBackward();//指定流线方向向后
+        }
+        else
+        {
+            streamer->SetIntegrationDirectionToBoth();//指定流线在两个方向集成
+        }
+
+    vtkTubeFilter *tFilter = vtkTubeFilter::New();//在线条周围生成管道的过滤器
+        tFilter->SetInputConnection(streamer->GetOutputPort());
+        tFilter->SetVaryRadiusToVaryRadiusByVector();
+        tFilter->SetRadius(tubeRadius);
+        tFilter->SetNumberOfSides(tubeSides);
+
+    vtkRibbonFilter *rFilter = vtkRibbonFilter::New();//从多边形数据集中定义的线创建定向色带
+        rFilter->SetInputConnection(streamer->GetOutputPort());
+        rFilter->SetWidth(ribbonWidth);
+        rFilter->SetWidthFactor(ribbonFactor);
+
+    vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
+        mapper->InterpolateScalarsBeforeMappingOn();//顶点颜色用于将颜色映射到表面
+        mapper->SetScalarRange(vectorRange[0], vectorRange[1]);
+
+        if (vectorType_ == 0)
+        {
+            mapper->SetScalarModeToUsePointData();
+        }
+        else if (vectorType_ == 1)
+        {
+            mapper->SetScalarModeToUseCellData();
+        }
+
+        if (streamStyle_ == "Tube")
+        {
+            mapper->SetInputConnection(tFilter->GetOutputPort());
+        }
+        else if (streamStyle_ == "Ribbon")
+        {
+            mapper->SetInputConnection(rFilter->GetOutputPort());
+        }
+        else
+        {
+            mapper->SetInputConnection(streamer->GetOutputPort());
+        }
+
+    vtkLookupTable *lut = (vtkLookupTable*)(mapper->GetLookupTable());
+        lut->GetHueRange(vectorRange);
+        lut->SetHueRange(vectorRange[1], vectorRange[0]);
+
+    vtkActor *actor = vtkActor::New();
+        actor->SetMapper(mapper);
+        actor->VisibilityOn();
+
+    _renderer->AddActor(actor);
+
+    streamTracer_ = streamer;
+    tubeFilter_ = tFilter;
+    ribbonFilter_ = rFilter;
+    streamMapper_ = mapper;
+
+    _unActor = actor;
+        //_renWin->Render();*/
+}
+
+void vtkVISUnStreamTrace::AlignLineWidget(vtkObject *caller, unsigned long, void *obj, void *)
+{
+    vtkVISUnStreamTrace *streamObj = reinterpret_cast<vtkVISUnStreamTrace*>(obj);
+
+    streamObj->lineWidget_->GetPolyData(streamObj->streamSeeds_);
+}
+
+void vtkVISUnStreamTrace::GenerateStreamLines(vtkObject *caller, unsigned long, void *obj, void *)
+{
+    vtkVISUnStreamTrace *streamObj = reinterpret_cast<vtkVISUnStreamTrace*>(obj);
+
+    if ( streamObj->seedstype_ == "Point Source")
+    {
+        streamObj->pointWidget_->GetPolyData(streamObj->streamSeeds_);
+    }
+    else if (streamObj->seedstype_ == "Plane Source")
+    {
+        streamObj->planeWidget_->GetPolyData(streamObj->streamSeeds_);
+    }
+    else if (streamObj->seedstype_ == "Sphere Source")
+    {
+        streamObj->sphereWidget_->GetPolyData(streamObj->streamSeeds_);
+    }
+    else
+    {
+        streamObj->lineWidget_->GetPolyData(streamObj->streamSeeds_);
+    }
+}
+// --------------------------------------------------------------------------
+/// Modify StreamTrace Minimum Step
+///
+/// @param minStep
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-01
+/// @reviser Shen Jie
+/// @date 2011-01-08
+void vtkVISUnStreamTrace::ModifyMinimumStep(double minStep)
+{
+    MinimumStep = minStep;
+    if (streamTracer_ != NULL)
+    {
+        streamTracer_->SetMinimumIntegrationStep(MinimumStep);
+    }
+    if (oneStreamTracer_ != NULL)
+    {
+        oneStreamTracer_->InitTraversal();
+
+        int num = oneStreamTracer_->GetNumberOfItems();
+
+        for (int i=0; i< num;i++)
+        {
+            ((vtkStreamTracer* )oneStreamTracer_->GetItemAsObject(i))->SetMinimumIntegrationStep(MinimumStep);
+
+        }
+    }
+}
+// --------------------------------------------------------------------------
+/// Modify StreamTrace Max Propagation
+///
+/// @param max
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-01
+/// @reviser Shen Jie
+/// @date 2011-01-08
+void vtkVISUnStreamTrace::ModifyMaxPropagation(double max)
+{
+    MaxPropagation = max;
+    if (streamTracer_ != NULL)
+    {
+        streamTracer_->SetMaximumPropagation(MaxPropagation);
+    }
+    if (oneStreamTracer_ != NULL)
+    {
+        oneStreamTracer_->InitTraversal();
+
+        int num = oneStreamTracer_->GetNumberOfItems();
+
+        for (int i=0; i< num;i++)
+        {
+            ((vtkStreamTracer* )oneStreamTracer_->GetItemAsObject(i))->SetMaximumPropagation(MaxPropagation);
+
+        }
+    }
+}
+// --------------------------------------------------------------------------
+/// Modify StreamTrace Initial Step
+///
+/// @param initiStep
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-01
+/// @reviser Shen Jie
+/// @date 2011-01-08
+void vtkVISUnStreamTrace::ModifyInitialStep(double initiStep)
+{
+    InitialStep = initiStep;
+    if (streamTracer_ != NULL)
+    {
+        streamTracer_->SetInitialIntegrationStep(InitialStep);
+    }
+    if (oneStreamTracer_ != NULL)
+    {
+        oneStreamTracer_->InitTraversal();
+
+        int num = oneStreamTracer_->GetNumberOfItems();
+
+        for (int i=0; i< num;i++)
+        {
+            ((vtkStreamTracer* )oneStreamTracer_->GetItemAsObject(i))->SetInitialIntegrationStep(InitialStep);
+        }
+    }
+}
+// --------------------------------------------------------------------------
+/// Modify Tube Sides Number
+///
+/// @param num
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-01
+/// @reviser Shen Jie
+/// @date 2011-01-08
+void vtkVISUnStreamTrace::ModifyTubeSides(int num)
+{
+    tubeSides = num;
+    if (tubeFilter_ != NULL)
+    {
+        tubeFilter_->SetNumberOfSides(tubeSides);
+    }
+    if (oneTubeFilter_ != NULL)
+    {
+        oneTubeFilter_->InitTraversal();
+
+        int num = oneTubeFilter_->GetNumberOfItems();
+
+        for (int i=0; i< num;i++)
+        {
+            ((vtkTubeFilter* )oneTubeFilter_->GetItemAsObject(i))->SetNumberOfSides(tubeSides);
+        }
+    }
+}
+// --------------------------------------------------------------------------
+/// Modify Tube Radius
+///
+/// @param radius
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-01
+/// @reviser Shen Jie
+/// @date 2011-01-08
+void vtkVISUnStreamTrace::ModifyTubeRadius(double radius)
+{
+    tubeRadius = radius;
+
+    if (tubeFilter_ != NULL)
+    {
+        tubeFilter_->SetRadius(tubeRadius);
+    }
+
+    if (oneTubeFilter_ != NULL)
+    {
+        oneTubeFilter_->InitTraversal();
+
+        int num = oneTubeFilter_->GetNumberOfItems();
+        for (int i=0; i< num;i++)
+        {
+            ((vtkTubeFilter* )oneTubeFilter_->GetItemAsObject(i))->SetRadius(tubeRadius);
+        }
+    }
+}
+// --------------------------------------------------------------------------
+/// Modify Ribbon Width
+///
+/// @param width
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-01
+/// @reviser Shen Jie
+/// @date 2011-01-08
+void vtkVISUnStreamTrace::ModifyRibbonWidth(double width)
+{
+    ribbonWidth = width;
+
+    if (ribbonFilter_ != NULL)
+    {
+        ribbonFilter_->SetWidth(ribbonWidth);
+    }
+
+    if (oneRibbonFilter_ != NULL)
+    {
+        oneRibbonFilter_->InitTraversal();
+        int num = oneRibbonFilter_->GetNumberOfItems();
+
+        for (int i=0; i< num;i++)
+        {
+            ((vtkRibbonFilter* )oneRibbonFilter_->GetItemAsObject(i))->SetWidth(ribbonWidth);
+
+        }
+    }
+}
+// --------------------------------------------------------------------------
+/// Modify Ribbon Width Factor
+///
+/// @param factor
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @reviser Shen Jie
+/// @date 2011-01-08
+void vtkVISUnStreamTrace::ModifyRibbonFactor(double factor)
+{
+    ribbonFactor = factor;
+    if (ribbonFilter_ != NULL)
+    {
+        ribbonFilter_->SetWidthFactor(ribbonFactor);
+    }
+    if (oneRibbonFilter_ != NULL)
+    {
+        oneRibbonFilter_->InitTraversal();
+        int num = oneRibbonFilter_->GetNumberOfItems();
+
+        for (int i=0; i< num;i++)
+        {
+            ((vtkRibbonFilter* )oneRibbonFilter_->GetItemAsObject(i))->SetWidthFactor(ribbonFactor);
+
+        }
+    }
+}
+// --------------------------------------------------------------------------
+/// Modify Stream Style
+///
+/// @param type
+/// @li "Tube"
+/// @li "Ribbon"
+/// @li "Line"
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-01
+/// @reviser Shen Jie
+/// @date 2011-01-08
+void vtkVISUnStreamTrace::ModifyStreamStyle (char* type)
+{
+    string s(type);
+
+    streamStyle_ = s;
+
+    if (streamMapper_ != NULL)
+    {
+        if (streamStyle_ == "Tube")
+        {
+            streamMapper_->SetInputConnection(tubeFilter_->GetOutputPort());
+
+        }
+        else if (streamStyle_ == "Ribbon")
+        {
+            streamMapper_->SetInputConnection(ribbonFilter_->GetOutputPort());
+        }
+        else {
+            streamMapper_->SetInputConnection(streamTracer_->GetOutputPort());
+        }
+        _unActor->SetMapper(streamMapper_);
+    }
+    if (oneStreamMapper_ != NULL)
+    {
+        oneStreamMapper_->InitTraversal();
+        oneStreamTracer_->InitTraversal();
+        oneTubeFilter_->InitTraversal();
+        oneRibbonFilter_->InitTraversal();
+        int num = oneStreamMapper_->GetNumberOfItems();
+
+        for (int i=0; i< num;i++)
+        {
+            if (streamStyle_ == "Tube")
+            {
+                ((vtkPolyDataMapper* )oneStreamMapper_->GetItemAsObject(i))->SetInputConnection(((vtkTubeFilter* )oneTubeFilter_->GetItemAsObject (i))->GetOutputPort());
+            }
+            else if (streamStyle_ == "Ribbon")
+            {
+                ((vtkPolyDataMapper* )oneStreamMapper_->GetItemAsObject(i))->SetInputConnection(((vtkRibbonFilter* )oneRibbonFilter_->GetItemAsObject (i))->GetOutputPort());
+            }
+            else {
+                ((vtkPolyDataMapper* )oneStreamMapper_->GetItemAsObject(i))->SetInputConnection(((vtkStreamTracer* )oneStreamTracer_->GetItemAsObject (i))->GetOutputPort());
+            }
+            ((vtkPolyDataMapper* )oneStreamMapper_->GetItemAsObject(i))->Modified ();
+        }
+
+        oneStreamActor_->InitTraversal();
+        vtkActor * pActor = oneStreamActor_->GetNextActor();
+        int i = 0;
+        while(pActor)
+        {
+            pActor->SetMapper((vtkPolyDataMapper* )oneStreamMapper_->GetItemAsObject(i));
+            i ++;
+            pActor = oneStreamActor_->GetNextActor();
+        }
+    }
+}
+// --------------------------------------------------------------------------
+/// Modify Integra Direction
+///
+/// @param direction
+/// @li "Forward"
+/// @li "Backward"
+/// @li "Both"
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-01
+/// @reviser Shen Jie
+/// @date 2011-01-08
+void vtkVISUnStreamTrace::ModifyIntegraDirection (char* direction)
+{
+    string s(direction);
+
+    InteDirection_ = s;
+
+    if (streamTracer_ != NULL)
+    {
+        if (InteDirection_ == "Forward")
+        {
+            streamTracer_->SetIntegrationDirectionToForward();
+        }
+        else if (InteDirection_ == "Backward")
+        {
+            streamTracer_->SetIntegrationDirectionToBackward();
+        }
+        else
+        {
+            streamTracer_->SetIntegrationDirectionToBoth();
+        }
+    }
+    if (oneStreamTracer_ != NULL)
+    {
+
+        oneStreamTracer_->InitTraversal();
+
+        int num = oneStreamTracer_->GetNumberOfItems();
+
+        for (int i=0; i< num;i++)
+        {
+
+            if (InteDirection_ == "Forward")
+            {
+                ((vtkStreamTracer* )oneStreamTracer_->GetItemAsObject(i))->SetIntegrationDirectionToForward();
+            }
+            else if (InteDirection_ == "Backward")
+            {
+                ((vtkStreamTracer* )oneStreamTracer_->GetItemAsObject(i))->SetIntegrationDirectionToBackward();
+            }
+            else
+            {
+
+                ((vtkStreamTracer* )oneStreamTracer_->GetItemAsObject(i))->SetIntegrationDirectionToBoth();
+            }
+            ((vtkStreamTracer* )oneStreamTracer_->GetItemAsObject(i))->Modified();
+        }
+
+    }
+}
+// --------------------------------------------------------------------------
+/// Set Seeds Type
+///
+/// @param type
+/// @li "Point Source"
+/// @li "Plane Source"
+/// @li "Sphere Source"
+/// @li "Line Source"
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-01
+/// @reviser Shen Jie
+/// @date 2011-01-08
+void vtkVISUnStreamTrace::SetSeedsType (string type)
+{
+    seedstype_ = type;
+
+    double bounds[6];
+    (_source->unstruGrid)->GetBounds(bounds);
+
+    vtkPolyData *seeds = vtkPolyData::New();
+
+    streamSeeds_ = vtkPolyData::New();
+    streamSeeds_ = seeds;
+
+    vtkCallbackCommand *callback = vtkCallbackCommand::New();
+        callback->SetCallback(GenerateStreamLines);
+        callback->SetClientData(this);
+
+    if ( seedstype_ == "Point Source")
+    {
+        if (pointWidget_ != NULL)
+        {
+            pointWidget_->GetPolyData(streamSeeds_);
+            pointWidget_->On();
+        }
+        else
+        {
+            vtkPointWidget *pointWidget= vtkPointWidget::New();
+                pointWidget_ = pointWidget;
+
+                pointWidget_->SetHandleSize(0.005);
+
+                pointWidget->SetInteractor(_renWin->GetInteractor());
+                pointWidget->SetPosition(-1.0, 0, 0);
+                pointWidget->TranslationModeOn();
+                pointWidget->GetPolyData(streamSeeds_);
+                pointWidget->AllOff();
+                pointWidget->AddObserver(vtkCommand::InteractionEvent, callback);
+                pointWidget->EnabledOn();
+
+             if (streamActor_ != NULL)
+             {
+                streamActor_->VisibilityOff();
+                ShowOffStreamTraceLines();
+             }
+        }
+        if (lineWidget_ != NULL)
+        {
+            lineWidget_->Off();
+        }
+        if (planeWidget_ != NULL)
+        {
+            planeWidget_->Off();
+        }
+        if (sphereWidget_ != NULL)
+        {
+            sphereWidget_->Off();
+        }
+    }
+    else if ( seedstype_ == "Plane Source")
+    {
+        if (planeWidget_ != NULL)
+        {
+            planeWidget_->GetPolyData(streamSeeds_);
+            planeWidget_->On();
+        }
+        else
+        {
+            vtkPlaneWidget *planeWidget= vtkPlaneWidget::New();
+                planeWidget_ = planeWidget;
+
+                planeWidget_->SetHandleSize(0.005);
+
+                planeWidget->SetInteractor(_renWin->GetInteractor());
+                planeWidget->PlaceWidget(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
+                planeWidget->SetRepresentationToWireframe();
+                planeWidget->NormalToYAxisOn();
+                planeWidget->GetPolyData(streamSeeds_);
+                planeWidget->AddObserver(vtkCommand::InteractionEvent, callback);
+                planeWidget->EnabledOn();
+
+            if (streamActor_ != NULL)
+             {
+                streamActor_->VisibilityOff();
+                ShowOffStreamTraceLines();
+             }
+        }
+        if (pointWidget_ != NULL)
+        {
+            pointWidget_->Off();
+        }
+        if (lineWidget_ != NULL)
+        {
+            lineWidget_->Off();
+        }
+        if (sphereWidget_ != NULL)
+        {
+            sphereWidget_->Off();
+        }
+    }
+    else if ( seedstype_ == "Sphere Source")
+    {
+        if (sphereWidget_ != NULL)
+        {
+            sphereWidget_->GetPolyData(streamSeeds_);
+            sphereWidget_->On();
+        }
+        else
+        {
+            vtkSphereWidget *sphereWidget= vtkSphereWidget::New();
+                sphereWidget_ = sphereWidget;
+
+                sphereWidget_->SetHandleSize(0.005);
+
+                sphereWidget->SetInteractor(_renWin->GetInteractor());
+                sphereWidget->PlaceWidget(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
+                sphereWidget->SetRepresentationToWireframe();
+                sphereWidget->SetThetaResolution(sphereTheta);
+                sphereWidget->SetPhiResolution(spherePhi);
+                sphereWidget->SetRadius(sphereRadius);
+                sphereWidget->GetPolyData(streamSeeds_);
+                sphereWidget->AddObserver(vtkCommand::InteractionEvent, callback);
+                sphereWidget->EnabledOn();
+
+            if (streamActor_ != NULL)
+             {
+                streamActor_->VisibilityOff();
+                ShowOffStreamTraceLines();
+             }
+        }
+        if (pointWidget_ != NULL)
+        {
+            pointWidget_->Off();
+        }
+        if (lineWidget_ != NULL)
+        {
+            lineWidget_->Off();
+        }
+        if (planeWidget_ != NULL)
+        {
+            planeWidget_->Off();
+        }
+    }
+    else
+    {
+        if (lineWidget_ != NULL) {
+            lineWidget_->GetPolyData(streamSeeds_);
+            lineWidget_->On();
+        }
+        else
+        {
+            vtkLineWidget *lineWidget= vtkLineWidget::New();
+                lineWidget_ = lineWidget;
+
+                lineWidget_->SetHandleSize(0.005);
+
+            vtkCallbackCommand *alignBack = vtkCallbackCommand::New();
+                alignBack->SetCallback(AlignLineWidget);
+                alignBack->SetClientData(this);
+
+                lineWidget->SetInteractor(_renWin->GetInteractor());
+                lineWidget->PlaceWidget(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
+                lineWidget->ClampToBoundsOn();
+                lineWidget->SetResolution(lineSeedsNumber);
+                lineWidget->GetPolyData(streamSeeds_);
+                lineWidget->AddObserver(vtkCommand::InteractionEvent, callback);
+                lineWidget->AddObserver(vtkCommand::ModifiedEvent, alignBack);
+                lineWidget->EnabledOn();
+
+                if (lineAlignAxis_ == "X")
+                {
+                    lineWidget->SetAlignToXAxis();
+                }
+                else if (lineAlignAxis_ == "Z")
+                {
+                    lineWidget->SetAlignToZAxis();
+                }
+                else
+                {
+                    lineWidget->SetAlignToYAxis();
+                }
+            if (streamActor_ != NULL)
+             {
+                streamActor_->VisibilityOff();
+                ShowOffStreamTraceLines();
+             }
+        }
+        if (pointWidget_ != NULL)
+        {
+            pointWidget_->Off();
+        }
+        if (planeWidget_ != NULL)
+        {
+            planeWidget_->Off();
+        }
+        if (sphereWidget_ != NULL)
+        {
+            sphereWidget_->Off();
+        }
+    }
+
+    streamSeeds_->Modified();
+
+    if (streamTracer_ != NULL)
+    {
+        streamTracer_->SetSourceData(streamSeeds_);
+        streamTracer_->Modified();
+        streamActor_->VisibilityOn();
+    }
+    if (oneStreamActor_ != NULL)
+    {
+        oneStreamActor_->InitTraversal();
+        oneStreamTracer_->InitTraversal();
+
+        int num = oneStreamActor_->GetNumberOfItems();
+
+        for (int i=0; i< num;i++)
+        {
+
+            vtkActor* actor = (vtkActor* )oneStreamActor_->GetItemAsObject (i);
+            vtkStreamTracer* streamTracer = (vtkStreamTracer* )oneStreamTracer_->GetItemAsObject (i);
+
+            streamTracer->SetSourceData(streamSeeds_);
+            streamTracer->Modified();
+            actor->VisibilityOn();
+
+            actor->Delete ();
+            streamTracer->Delete ();
+        }
+    }
+}
+// --------------------------------------------------------------------------
+/// Modify Sphere Widget Radius
+///
+/// @param radius
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-05-31
+/// @reviser
+void vtkVISUnStreamTrace::ModifySphereRadius(double radius)
+{
+    if (sphereWidget_ != NULL)
+    {
+        sphereRadius = radius;
+
+        sphereWidget_->SetRadius(sphereRadius);
+    }
+}
+// --------------------------------------------------------------------------
+/// Modify Sphere Widget Theta
+///
+/// @param theta
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-05-31
+/// @reviser
+void vtkVISUnStreamTrace::ModifySphereTheta(int theta)
+{
+    if (sphereWidget_ != NULL)
+    {
+        sphereTheta = theta;
+
+        sphereWidget_->SetThetaResolution(sphereTheta);
+    }
+}
+// --------------------------------------------------------------------------
+/// Modify Sphere Widget Phi
+///
+/// @param phi
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-05-31
+/// @reviser
+void vtkVISUnStreamTrace::ModifySpherePhi(int phi)
+{
+    spherePhi = phi;
+
+    if (sphereWidget_ != NULL)
+    {
+
+        sphereWidget_->SetPhiResolution(spherePhi);
+    }
+}
+// --------------------------------------------------------------------------
+/// Modify Line Seeds Number
+///
+/// @param axis
+/// @li "X"
+/// @li "Y"
+/// @li "Z"
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-01
+/// @reviser
+void vtkVISUnStreamTrace::ModifyLineAlignAxis(char* axis)
+{
+    string s(axis);
+
+    lineAlignAxis_ = s;
+
+    if (lineAlignAxis_ == "X")
+    {
+        if (lineWidget_ != NULL)
+        {
+            lineWidget_->SetAlignToXAxis();
+        }
+    }
+    else if (lineAlignAxis_ == "Z")
+    {
+        if (lineWidget_ != NULL)
+        {
+            lineWidget_->SetAlignToZAxis();
+        }
+    }
+    else
+    {
+        if (lineWidget_ != NULL)
+        {
+            lineWidget_->SetAlignToYAxis();
+        }
+    }
+}
+// --------------------------------------------------------------------------
+/// Modify Line Seeds Number
+///
+/// @param seeds num
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-01
+/// @reviser
+void vtkVISUnStreamTrace::ModifyLineSeedsNumber(int num)
+{
+    lineSeedsNumber = num;
+
+    if (lineWidget_ != NULL)
+    {
+        lineWidget_->SetResolution(lineSeedsNumber);
+        lineWidget_->Modified();
+    }
+}
+// --------------------------------------------------------------------------
+/// Get Line Seeds Number
+///
+/// @param
+///
+/// @return line seeds number
+///
+/// @author ZHU Qin
+/// @date 2010-06-01
+/// @reviser
+int vtkVISUnStreamTrace::GetLineSeedsNumber()
+{
+    return this->lineSeedsNumber;
+
+}
+// --------------------------------------------------------------------------
+/// Create One StreamLine
+///
+/// @param
+///
+/// @return vtkActor
+///
+/// @author ZHU Qin
+/// @date 2010-06-22
+/// @reviser Shen Jie
+/// @date 2011-01-08
+vtkActor* vtkVISUnStreamTrace::CreateOneStreamLine()
+{
+    vtkRungeKutta4 *kutta4 = vtkRungeKutta4::New();
+
+    vtkStreamTracer *streamer = vtkStreamTracer::New();
+
+        streamer->SetInputData(streamSource_);
+        streamer->SetStartPosition(startPosition[0], startPosition[1], startPosition[2]);
+        streamer->SetIntegrator(kutta4);
+        streamer->SetMaximumPropagation(MaxPropagation);
+        streamer->SetMinimumIntegrationStep(MinimumStep);
+        streamer->SetInitialIntegrationStep(InitialStep);
+        if (InteDirection_ == "Forward")
+        {
+            streamer->SetIntegrationDirectionToForward();
+        }
+        else if (InteDirection_ == "Backward")
+        {
+            streamer->SetIntegrationDirectionToBackward();
+        }
+        else
+        {
+            streamer->SetIntegrationDirectionToBoth();
+        }
+        streamer->Update();
+
+    vtkTubeFilter *tFilter = vtkTubeFilter::New();
+        tFilter->SetInputConnection(streamer->GetOutputPort());
+        tFilter->SetVaryRadiusToVaryRadiusByVector();
+        tFilter->SetRadius(tubeRadius);
+        tFilter->SetNumberOfSides(tubeSides);
+        tFilter->Update();
+
+    vtkRibbonFilter *rFilter = vtkRibbonFilter::New();
+        rFilter->SetInputConnection(streamer->GetOutputPort());
+        rFilter->SetWidth(ribbonWidth);
+        rFilter->SetWidthFactor(ribbonFactor);
+        rFilter->Update();
+
+        vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
+        if (streamStyle_ == "Tube")
+        {
+            mapper->SetInputConnection(tFilter->GetOutputPort());
+        }
+        else if (streamStyle_ == "Ribbon")
+        {
+            mapper->SetInputConnection(rFilter->GetOutputPort());
+        }
+        else
+        {
+            mapper->SetInputConnection(streamer->GetOutputPort());
+        }
+
+        vtkActor* actor = vtkActor::New();
+        actor->SetMapper(mapper);
+        actor->GetProperty()->SetColor(0,0,1);
+        _renderer->AddActor(actor);
+
+        if (oneIntegrator4_ == NULL)
+        {
+            oneIntegrator4_ = vtkCollection::New();
+            oneIntegrator4_->AddItem (kutta4);
+        }
+        else
+        {
+            oneIntegrator4_->AddItem (kutta4);
+        }
+
+        if (oneStreamTracer_ == NULL)
+        {
+            oneStreamTracer_ = vtkCollection::New();
+            oneStreamTracer_->AddItem (streamer);
+        }
+        else
+        {
+            oneStreamTracer_->AddItem (streamer);
+        }
+
+        if (oneTubeFilter_ == NULL)
+        {
+            oneTubeFilter_ = vtkCollection::New();
+            oneTubeFilter_->AddItem (tFilter);
+        }
+        else
+        {
+            oneTubeFilter_->AddItem (tFilter);
+        }
+
+        if (oneRibbonFilter_ == NULL)
+        {
+            oneRibbonFilter_ = vtkCollection::New();
+            oneRibbonFilter_->AddItem (rFilter);
+        }
+        else
+        {
+            oneRibbonFilter_->AddItem (rFilter);
+        }
+
+        if (oneStreamMapper_ == NULL)
+        {
+            oneStreamMapper_ = vtkActorCollection::New();
+            oneStreamMapper_->AddItem (mapper);
+        }
+        else
+        {
+            oneStreamMapper_->AddItem (mapper);
+        }
+
+
+        if (oneStreamActor_ == NULL)
+        {
+            oneStreamActor_ = vtkActorCollection::New();
+            oneStreamActor_->AddItem (actor);
+        }
+        else
+        {
+            oneStreamActor_->AddItem (actor);
+        }
+
+        kutta4->Delete();
+        streamer->Delete();
+        tFilter->Delete();
+        rFilter->Delete();
+        mapper->Delete();
+
+        return actor;
+
+    /*if (scalarIndex_ == -1)
+    {
+        ErrorInfo(1, "Can't create stream line, scalar not exists.");
+        return NULL;
+    }
+    double *range;
+    range = _source->scalarRange[scalarIndex_];*/
+
+    /*double range[2];
+
+    if (scalarIndex_ != -1)
+    {
+
+        range[0] = _source->scalarRange[scalarIndex_][0];
+        range[1] = _source->scalarRange[scalarIndex_][1];
+    }
+    else
+    {
+        range[0] = 0;
+        range[1] = 0;
+    }
+    streamSource_->GetPoint(1500, startPosition);
+
+
+    vtkRungeKutta4 *kutta4 = vtkRungeKutta4::New();
+
+    vtkStreamTracer *streamer = vtkStreamTracer::New();
+
+        streamer->SetInputData(streamSource_);
+        streamer->SetStartPosition(startPosition[0], startPosition[1], startPosition[2]);
+
+        //streamer->SetIntegrationStepUnit(vtkStreamTracer::CELL_LENGTH_UNIT);
+        streamer->SetMinimumIntegrationStep(MinimumStep);
+        //streamer->SetMinimumIntegrationStepUnitToLengthUnit();
+
+        streamer->SetMaximumPropagation(MaxPropagation);
+        //streamer->SetMaximumPropagationUnitToCellLengthUnit();
+
+        streamer->SetInitialIntegrationStep(InitialStep);
+        //streamer->SetInitialIntegrationStepUnitToCellLengthUnit();
+
+        streamer->SetIntegrator(kutta4);
+
+        if (InteDirection_ == "Forward")
+        {
+            streamer->SetIntegrationDirectionToForward();
+        }
+        else if (InteDirection_ == "Backward")
+        {
+            streamer->SetIntegrationDirectionToBackward();
+        }
+        else
+        {
+            streamer->SetIntegrationDirectionToBoth();
+        }
+        streamer->Update();
+
+    vtkTubeFilter *tFilter = vtkTubeFilter::New();
+        tFilter->SetInputConnection(streamer->GetOutputPort());
+        tFilter->SetVaryRadiusToVaryRadiusByVector();
+        tFilter->SetRadius(tubeRadius);
+        tFilter->SetNumberOfSides(tubeSides);
+
+    vtkRibbonFilter *rFilter = vtkRibbonFilter::New();
+        rFilter->SetInputConnection(streamer->GetOutputPort());
+        rFilter->SetWidth(ribbonWidth);
+        rFilter->SetWidthFactor(ribbonFactor);
+
+    vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
+        mapper->InterpolateScalarsBeforeMappingOn();
+        mapper->SetScalarRange(range[0], range[1]);
+
+        if (streamStyle_ == "Tube")
+        {
+            mapper->SetInputConnection(tFilter->GetOutputPort());
+        }
+        else if (streamStyle_ == "Ribbon")
+        {
+            mapper->SetInputConnection(rFilter->GetOutputPort());
+        }
+        else {
+            mapper->SetInputConnection(streamer->GetOutputPort());
+        }
+
+        if (scalarIndex_ != -1)
+        {
+            if (_source->scalarSource[scalarIndex_]->GetDataSize() != 0)
+            {
+                mapper->SetScalarModeToUsePointData();
+            }
+            else
+            {
+                mapper->SetScalarModeToUseCellData();
+            }
+        }
+
+    vtkLookupTable *lut = (vtkLookupTable*)(mapper->GetLookupTable());
+        lut->GetHueRange(range);
+        lut->SetHueRange(range[1], range[0]);
+
+    vtkActor *actor = vtkActor::New();
+        actor->SetMapper(mapper);
+        actor->VisibilityOn();
+
+    _renderer->AddActor(actor);
+
+   /* oneStreamActor_ = actor;
+    oneStreamMapper_ = mapper;
+
+    if (oneIntegrator4_ == NULL)
+    {
+        oneIntegrator4_ = vtkCollection::New();
+        oneIntegrator4_->AddItem (kutta4);
+    }
+    else
+    {
+        oneIntegrator4_->AddItem (kutta4);
+    }
+
+    if (oneStreamTracer_ == NULL)
+    {
+        oneStreamTracer_ = vtkCollection::New();
+        oneStreamTracer_->AddItem (streamer);
+    }
+    else
+    {
+        oneStreamTracer_->AddItem (streamer);
+    }
+
+    if (oneTubeFilter_ == NULL)
+    {
+        oneTubeFilter_ = vtkCollection::New();
+        oneTubeFilter_->AddItem (tFilter);
+    }
+    else
+    {
+        oneTubeFilter_->AddItem (tFilter);
+    }
+
+    if (oneRibbonFilter_ == NULL)
+    {
+        oneRibbonFilter_ = vtkCollection::New();
+        oneRibbonFilter_->AddItem (rFilter);
+    }
+    else
+    {
+        oneRibbonFilter_->AddItem (rFilter);
+    }
+
+    if (oneStreamMapper_ == NULL)
+    {
+        oneStreamMapper_ = vtkActorCollection::New();
+        oneStreamMapper_->AddItem (mapper);
+    }
+    else
+    {
+        oneStreamMapper_->AddItem (mapper);
+    }
+
+
+    if (oneStreamActor_ == NULL)
+    {
+        oneStreamActor_ = vtkActorCollection::New();
+        oneStreamActor_->AddItem (actor);
+    }
+    else
+    {
+        oneStreamActor_->AddItem (actor);
+    }
+
+    kutta4->Delete();
+    streamer->Delete();
+    tFilter->Delete();
+    rFilter->Delete();
+    mapper->Delete();
+
+    return actor;*/
+}
+// --------------------------------------------------------------------------
+/// Show On Stream Widget
+///
+/// @param
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-22
+/// @reviser
+void vtkVISUnStreamTrace::ShowOnStreamWidget()
+{
+    if ( seedstype_ == "Point Source")
+    {
+        if (pointWidget_ != NULL)
+        {
+            pointWidget_->On();
+        }
+    }
+    else if (seedstype_ == "Plane Source")
+    {
+        if (planeWidget_ != NULL)
+        {
+            planeWidget_->On();
+        }
+    }
+    else if (seedstype_ == "Sphere Source")
+    {
+        if (sphereWidget_ != NULL)
+        {
+            sphereWidget_->On();
+        }
+    }
+    else
+    {
+        if (lineWidget_ != NULL)
+        {
+            lineWidget_->On();
+        }
+    }
+}
+// --------------------------------------------------------------------------
+/// Show Off Stream Widget
+///
+/// @param
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-22
+/// @reviser
+void vtkVISUnStreamTrace::ShowOffStreamWidget()
+{
+    if ( seedstype_ == "Point Source")
+    {
+        if (pointWidget_ != NULL)
+        {
+            pointWidget_->Off();
+        }
+    }
+    else if (seedstype_ == "Plane Source")
+    {
+        if (planeWidget_ != NULL)
+        {
+            planeWidget_->Off();
+        }
+    }
+    else if (seedstype_ == "Sphere Source")
+    {
+        if (sphereWidget_ != NULL)
+        {
+            sphereWidget_->Off();
+        }
+    }
+    else
+    {
+        if (lineWidget_ != NULL)
+        {
+            lineWidget_->Off();
+        }
+    }
+}
+// --------------------------------------------------------------------------
+/// Show On Stream Lines
+///
+/// @param
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-22
+/// @reviser Shen Jie
+/// @date 2011-01-08
+void vtkVISUnStreamTrace::ShowOnStreamTraceLines()
+{
+    if (oneStreamActor_ != NULL)
+    {
+        oneStreamActor_->InitTraversal();
+        vtkActor * pActor = oneStreamActor_->GetNextActor();
+        while(pActor)
+        {
+            pActor->VisibilityOn();
+            pActor = oneStreamActor_->GetNextActor();
+        }
+    }
+    if (_unActor != NULL)
+    {
+        _unActor->VisibilityOn();
+    }
+    else
+    {
+        ErrorInfo(1, "stream Trace Actor is not Created!");
+        return;
+    }
+}
+// --------------------------------------------------------------------------
+/// Show Off Stream Lines
+///
+/// @param
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-22
+/// @reviser Shen Jie
+/// @date 2011-01-08
+void vtkVISUnStreamTrace::ShowOffStreamTraceLines()
+{
+    if (oneStreamActor_ != NULL)
+    {
+        oneStreamActor_->InitTraversal();
+        vtkActor * pActor = oneStreamActor_->GetNextActor();
+        while(pActor)
+        {
+            pActor->VisibilityOff();
+            pActor = oneStreamActor_->GetNextActor();
+        }
+    }
+
+    if (_unActor != NULL)
+    {
+        _unActor->VisibilityOff();
+    }
+    else
+    {
+        ErrorInfo(1, "stream Trace Actor is not Created!");
+        return;
+    }
+}
+// --------------------------------------------------------------------------
+/// Set StreamLine Start Position
+///
+/// @param p0 -- start position x
+/// @param p1 -- start position y
+/// @param p2 -- start position z
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-06-22
+/// @reviser
+void vtkVISUnStreamTrace::SetStreamLineStartPosition(double p0, double p1, double p2)
+{
+    startPosition[0] = p0;
+    startPosition[1] = p1;
+    startPosition[2] = p2;
+}
+// --------------------------------------------------------------------------
+/// Modify Seeds Widget Handle Size
+///
+/// @param size
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-12-15
+/// @reviser
+void vtkVISUnStreamTrace::ModifySeedsWidgetHandleSize(double size)
+{
+    if ( seedstype_ == "Point Source")
+    {
+        if (pointWidget_ != NULL)
+        {
+            pointWidget_->SetHandleSize(size);
+        }
+    }
+    else if (seedstype_ == "Plane Source")
+    {
+        if (planeWidget_ != NULL)
+        {
+            planeWidget_->SetHandleSize(size);
+            planeWidget_->UpdatePlacement();
+        }
+    }
+    else if (seedstype_ == "Sphere Source")
+    {
+        if (sphereWidget_ != NULL)
+        {
+            sphereWidget_->SetHandleSize(size);
+        }
+    }
+    else
+    {
+        if (lineWidget_ != NULL)
+        {
+            lineWidget_->SetHandleSize(size);
+        }
+    }
+}
+// --------------------------------------------------------------------------
+/// Modify Dispaly Scalar Range
+///
+/// @param size
+///
+/// @return
+///
+/// @author ZHU Qin
+/// @date 2010-12-15
+/// @reviser
+void vtkVISUnStreamTrace::ModifyDispalyScalarRange(double min, double max)
+{
+    if(streamMapper_ != NULL)
+    {
+        streamMapper_->SetScalarRange(min, max);
+        streamMapper_->Modified();
+    }
+    if (oneStreamActor_ != NULL)
+    {
+        oneStreamActor_->InitTraversal();
+
+        vtkActor * pActor = oneStreamActor_->GetNextActor();
+
+        while(pActor)
+        {
+            pActor->GetMapper()->SetScalarRange(min,max);
+
+            pActor->GetMapper()->Modified();
+
+            pActor = oneStreamActor_->GetNextActor();
+        }
+    }
+}
+
+void vtkVISUnStreamTrace::vtkSelectPointOn()
+{
+    if (style_ == NULL)
+    {
+        style_ = MouseInteractorStyle::New();
+        style_->SetRender(_renderer);
+    }
+    SelectState_ = 1;
+    _renWin->GetInteractor()->SetInteractorStyle(style_);
+    vtkCallbackCommand* selectCommand = vtkCallbackCommand::New();
+    selectCommand->SetCallback(DrawSelectStream);
+    selectCommand->SetClientData(this);
+    _renWin->GetInteractor()->AddObserver(vtkCommand::LeftButtonPressEvent, selectCommand);
+}
+
+void vtkVISUnStreamTrace::vtkSelectPointOff()
+{
+    SelectState_ = 0;
+    vtkInteractorStyleTrackballCamera* style = vtkInteractorStyleTrackballCamera::New();
+    _renWin->GetInteractor()->SetInteractorStyle(style);
+}
+
+void vtkVISUnStreamTrace::DrawSelectStream(vtkObject *caller, unsigned long, void *obj, void *)
+{
+    vtkVISUnStreamTrace *streamObj = reinterpret_cast<vtkVISUnStreamTrace*>(obj);
+    if (streamObj != NULL)
+    {
+        if (streamObj->SelectState_ == 1)
+        {
+            streamObj->positionVec_.clear();
+            streamObj->positionVec_ = streamObj->style_->GetPosition();
+            if (streamObj->positionVec_.size() == 3)
+            {
+                streamObj->SetStreamLineStartPosition(streamObj->positionVec_.at(0), streamObj->positionVec_.at(1), streamObj->positionVec_.at(2));
+                streamObj->CreateOneStreamLine();
+            }
+        }
+    }
+}
+
+vector<double> vtkVISUnStreamTrace::GetPosition()
+{
+    return positionVec_;
+}
+

+ 171 - 0
CAE_Solution/src/VTK/visualization_VTK/vtkVISUnStreamTrace.h

@@ -0,0 +1,171 @@
+#ifndef __vtkVISUnStreamTrace_h
+#define __vtkVISUnStreamTrace_h
+#include <iostream>
+using namespace std;
+
+
+#include "vtkVISManager.h"
+#include "vtkVISUnstructuredGridManager.h"
+
+#include "vtkLineWidget.h"
+#include "vtkMultiBlockDataSet.h"
+#include "vtkRungeKutta4.h"
+#include "vtkPolyData.h"
+#include "vtkStreamTracer.h"
+#include "vtkPolyDataMapper.h"
+
+#include "vtkTextWidget.h"
+#include "vtkRibbonFilter.h"
+#include "vtkCallbackCommand.h"
+#include "vtkCommand.h"
+#include "vtkPointWidget.h"
+#include "vtkTubeFilter.h"
+#include "vtkDataSet.h"
+#include "vtkPlaneWidget.h"
+#include "vtkSphereWidget.h"
+#include "vtkActorCollection.h"
+#include "vtkCollection.h"
+#include "vtkLookupTable.h"
+#include "vtkUnstructuredGrid.h"
+#include "vtkRenderWindowInteractor.h"
+#include "vtkVISMouseInteractorStyle.h"
+#include "vtkInteractorStyleTrackballCamera.h"
+
+class  vtkVISUnStreamTrace : public vtkVISUnstructuredGridManager
+{
+public:
+
+    static vtkVISUnStreamTrace *New();
+
+    vtkVISUnStreamTrace();
+    ~vtkVISUnStreamTrace();
+
+    void SetStreamTraceSource(char* scalar, char* vector);
+    void SetStreamTraceSource(char* u, char* v, char* w);
+
+    void ModifyStreamTraceScalar(char* scalar);
+    void ModifyStreamTraceVector(char* vector);
+
+    void CreateStreamTraceDisplay();
+    void CreateStreamTraceDisplayByVector();
+    vtkActor* CreateOneStreamLine();
+
+    void SetSeedsType (string type);
+
+    void ModifyStreamStyle (char* type);
+    void ModifyIntegraDirection (char* direction);//修改方向
+    void ModifyLineAlignAxis(char* axis);
+
+    void ModifyLineSeedsNumber(int num);
+    int GetLineSeedsNumber();
+
+    void ModifyMinimumStep(double minStep);
+    void ModifyMaxPropagation(double max);//修改最大传播
+    void ModifyInitialStep(double initiStep);//修改初始步
+
+    void ModifyTubeSides(int num);
+    void ModifyTubeRadius(double radius);
+    void ModifyRibbonWidth(double width);
+    void ModifyRibbonFactor(double factor);//修改管道因数
+
+    void ModifySphereTheta(int theta);
+    void ModifySpherePhi(int phi);
+    void ModifySphereRadius(double radius);
+
+    void ShowOnStreamWidget();
+    void ShowOffStreamWidget();
+
+    void ModifySeedsWidgetHandleSize(double size);
+
+    void ShowOnStreamTraceLines();
+    void ShowOffStreamTraceLines();
+
+    void SetStreamLineStartPosition(double p0, double p1, double p2);
+    void vtkSelectPointOn();
+    void vtkSelectPointOff();
+    vector<double> GetPosition();
+
+    vtkGetVector3Macro(startPosition,double)
+
+    vtkGetMacro(MinimumStep, double)
+    vtkGetMacro(MaxPropagation, double)
+    vtkGetMacro(InitialStep, double)
+
+    vtkGetMacro(tubeRadius, double)
+    vtkGetMacro(tubeSides, int)
+
+    vtkGetMacro(ribbonWidth, double)
+    vtkGetMacro(ribbonFactor, double)
+
+    vtkGetMacro(sphereRadius, double)
+    vtkGetMacro(sphereTheta, int)
+    vtkGetMacro(spherePhi, int)
+
+    void ModifyDispalyScalarRange(double min, double max);
+    int SelectState_;
+
+protected:
+    int lineSeedsNumber;
+
+    double MinimumStep;
+    double MaxPropagation;
+    double InitialStep;
+
+    double tubeRadius;
+    int tubeSides;
+    double ribbonWidth;
+    double ribbonFactor;
+
+    int sphereTheta;
+    int spherePhi;
+    double sphereRadius;
+
+    double startPosition[3];
+
+    int scalarIndex_;
+    int vectorIndex_;
+
+    int vectorType_;
+    double vectorRange[2];
+
+    string streamStyle_;
+    string InteDirection_;
+
+    string lineAlignAxis_;
+
+    vtkUnstructuredGrid* streamSource_;
+    vtkRungeKutta4* integrator4_;
+    vtkStreamTracer* streamTracer_;
+    vtkTubeFilter* tubeFilter_;
+    vtkRibbonFilter* ribbonFilter_;
+    vtkPolyDataMapper* streamMapper_;
+    vtkActor* streamActor_;
+
+ //   vtkActor* oneStreamActor_;
+    //vtkPolyDataMapper* oneStreamMapper_;
+    vtkCollection* oneIntegrator4_;
+    vtkCollection* oneStreamMapper_;
+    vtkActorCollection* oneStreamActor_;
+    vtkCollection* oneStreamTracer_;
+    vtkCollection* oneTubeFilter_;
+    vtkCollection* oneRibbonFilter_;
+
+    string seedstype_;
+    vtkPolyData* streamSeeds_;
+
+    vtkPointWidget* pointWidget_;
+    vtkLineWidget* lineWidget_;
+    vtkPlaneWidget* planeWidget_;
+    vtkSphereWidget* sphereWidget_;
+
+    static void GenerateStreamLines(vtkObject *caller, unsigned long, void *, void *);
+    static void AlignLineWidget(vtkObject *caller, unsigned long, void *, void *);
+    static void DrawSelectStream(vtkObject *caller, unsigned long, void *, void *);
+
+private:
+    MouseInteractorStyle* style_;
+    vector <double> positionVec_;
+
+};
+
+#endif

+ 2 - 2
CAE_Solution/src/VTK/visualization_VTK/vtkvismeshbasetovtksource.cpp

@@ -1,7 +1,7 @@
 #include <vtkObjectFactory.h>
 #include "vtkvismeshbasetovtksource.h"
-#include "../mesh/meshbase.h"
-#include "../mesh/meshunstructured.h"
+#include "../meshds/meshbase.h"
+#include "../meshds/meshunstructured.h"
 #include "vtkUnstructuredGrid.h"
 #include "vtkPoints.h"
 #include "vtkLine.h"

+ 1 - 1
CAE_Solution/src/VTK/visualization_VTK/vtkvismeshbasetovtksource.h

@@ -3,7 +3,7 @@
 
 
 #include "vtkvismanager.h"
-#include "../mesh/meshbase.h"
+#include "../meshds/meshbase.h"
 #include "vtkvisunstructuredgridsource.h"
 #include <iostream>
 #include <vector>

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно