Browse Source

0413 加载ugrid文件

caizm 2 years ago
parent
commit
2eefdf30c3
64 changed files with 2868 additions and 12941 deletions
  1. 14 13
      CAE_Solution/src/Display/display.cpp
  2. 5 6
      CAE_Solution/src/VTK/Manager/Manager.pri
  3. 93 91
      CAE_Solution/src/VTK/Manager/meshmanager.cpp
  4. 17 9
      CAE_Solution/src/VTK/Manager/meshmanager.h
  5. 0 726
      CAE_Solution/src/VTK/Manager/resultmeshmanager.cpp
  6. 0 118
      CAE_Solution/src/VTK/Manager/resultmeshmanager.h
  7. 0 264
      CAE_Solution/src/VTK/Manager/xyplotmanager.cpp
  8. 0 40
      CAE_Solution/src/VTK/Manager/xyplotmanager.h
  9. 2 2
      CAE_Solution/src/VTK/QVTKRenderer/QVTKRenderer.pri
  10. 1 1
      CAE_Solution/src/VTK/QVTKRenderer/qvtkrenderer.cpp
  11. 1 1
      CAE_Solution/src/VTK/QVTKRenderer/qvtkrenderer.h
  12. 0 181
      CAE_Solution/src/VTK/mesh/cells.h
  13. 283 231
      CAE_Solution/src/VTK/mesh/mesh.cpp
  14. 24 24
      CAE_Solution/src/VTK/mesh/mesh.h
  15. 3 17
      CAE_Solution/src/VTK/mesh/mesh.pri
  16. 65 43
      CAE_Solution/src/VTK/mesh/mesh_adi.cpp
  17. 8 3
      CAE_Solution/src/VTK/mesh/mesh_adi.h
  18. 252 234
      CAE_Solution/src/VTK/mesh/mesh_tecplot.cpp
  19. 16 10
      CAE_Solution/src/VTK/mesh/mesh_tecplot.h
  20. 84 63
      CAE_Solution/src/VTK/mesh/mesh_ugrid.cpp
  21. 12 4
      CAE_Solution/src/VTK/mesh/mesh_ugrid.h
  22. 105 83
      CAE_Solution/src/VTK/mesh/meshbase.cpp
  23. 23 15
      CAE_Solution/src/VTK/mesh/meshbase.h
  24. 27 20
      CAE_Solution/src/VTK/mesh/meshstructured.cpp
  25. 8 4
      CAE_Solution/src/VTK/mesh/meshstructured.h
  26. 342 273
      CAE_Solution/src/VTK/mesh/meshunstructured.cpp
  27. 18 12
      CAE_Solution/src/VTK/mesh/meshunstructured.h
  28. 0 168
      CAE_Solution/src/VTK/mesh/points.cpp
  29. 0 63
      CAE_Solution/src/VTK/mesh/points.h
  30. 0 243
      CAE_Solution/src/VTK/visualization_VTK/loadxyplotdata.cpp
  31. 0 36
      CAE_Solution/src/VTK/visualization_VTK/loadxyplotdata.h
  32. 2 26
      CAE_Solution/src/VTK/visualization_VTK/visualization_VTK.pri
  33. 0 168
      CAE_Solution/src/VTK/visualization_VTK/vtkvisaddungriddatasource.cpp
  34. 0 42
      CAE_Solution/src/VTK/visualization_VTK/vtkvisaddungriddatasource.h
  35. 433 623
      CAE_Solution/src/VTK/visualization_VTK/vtkviscameramanager.cpp
  36. 14 13
      CAE_Solution/src/VTK/visualization_VTK/vtkviscameramanager.h
  37. 0 218
      CAE_Solution/src/VTK/visualization_VTK/vtkviscapturefigure.cpp
  38. 0 29
      CAE_Solution/src/VTK/visualization_VTK/vtkviscapturefigure.h
  39. 158 250
      CAE_Solution/src/VTK/visualization_VTK/vtkvismanager.cpp
  40. 11 9
      CAE_Solution/src/VTK/visualization_VTK/vtkvismanager.h
  41. 75 57
      CAE_Solution/src/VTK/visualization_VTK/vtkvismeshbasetovtksource.cpp
  42. 10 5
      CAE_Solution/src/VTK/visualization_VTK/vtkvismeshbasetovtksource.h
  43. 0 294
      CAE_Solution/src/VTK/visualization_VTK/vtkvismeshtovtksource.cpp
  44. 0 32
      CAE_Solution/src/VTK/visualization_VTK/vtkvismeshtovtksource.h
  45. 0 1614
      CAE_Solution/src/VTK/visualization_VTK/vtkvisuncontour.cpp
  46. 0 114
      CAE_Solution/src/VTK/visualization_VTK/vtkvisuncontour.h
  47. 0 1083
      CAE_Solution/src/VTK/visualization_VTK/vtkvisunglyph.cpp
  48. 0 107
      CAE_Solution/src/VTK/visualization_VTK/vtkvisunglyph.h
  49. 218 279
      CAE_Solution/src/VTK/visualization_VTK/vtkvisunshademesh.cpp
  50. 9 6
      CAE_Solution/src/VTK/visualization_VTK/vtkvisunshademesh.h
  51. 0 2612
      CAE_Solution/src/VTK/visualization_VTK/vtkvisunslice.cpp
  52. 0 213
      CAE_Solution/src/VTK/visualization_VTK/vtkvisunslice.h
  53. 110 165
      CAE_Solution/src/VTK/visualization_VTK/vtkvisunstructuredgridmanager.cpp
  54. 12 8
      CAE_Solution/src/VTK/visualization_VTK/vtkvisunstructuredgridmanager.h
  55. 386 432
      CAE_Solution/src/VTK/visualization_VTK/vtkvisunstructuredgridsource.cpp
  56. 15 13
      CAE_Solution/src/VTK/visualization_VTK/vtkvisunstructuredgridsource.h
  57. 0 838
      CAE_Solution/src/VTK/visualization_VTK/vtkvisxyplot.cpp
  58. 0 131
      CAE_Solution/src/VTK/visualization_VTK/vtkvisxyplot.h
  59. 0 493
      CAE_Solution/src/VTK/visualization_VTK/vtkxyplotvis.cpp
  60. 0 62
      CAE_Solution/src/VTK/visualization_VTK/vtkxyplotvis.h
  61. 9 3
      CAE_Solution/src/main.cpp
  62. 0 1
      CAE_Solution/src/src.pro
  63. 2 2
      CAE_Solution/src/widget.cpp
  64. 1 1
      CAE_Solution/src/widget.h

+ 14 - 13
CAE_Solution/src/Display/display.cpp

@@ -7,19 +7,20 @@ Display::Display()
 
 bool Display::renderMesh(QString &filePath)
 {
-    if(filePath.isEmpty())return false;
-    MeshManager* meshManager = MeshManager::getInstance();
-    bool f = meshManager->LoadData(filePath);
 
-    if(f)
-    {
-        QVTKRenderer* renderer = new QVTKRenderer();
-        this->widget->addTab(renderer->GetWidget(),"UGrid");
-        if(renderer){
-            meshManager->DisplayMesh(renderer);
-            renderer->ZoomToExtents();
-        }
-    }
-    widget->show();
+//    if(filePath.isEmpty())return false;
+//    MeshManager* meshManager = MeshManager::getInstance();
+//    bool f = meshManager->LoadData(filePath);
+
+//    if(f)
+//    {
+//        QVTKRenderer* renderer = new QVTKRenderer();
+//        this->widget->addTab(renderer->GetWidget(),"UGrid");
+//        if(renderer){
+//            meshManager->DisplayMesh(renderer);
+//            renderer->ZoomToExtents();
+//        }
+//    }
+//    widget->show();
     return true;
 }

+ 5 - 6
CAE_Solution/src/VTK/Manager/Manager.pri

@@ -1,11 +1,10 @@
 HEADERS += \ 
-    $$PWD/meshmanager.h \
-    $$PWD/resultmeshmanager.h \
-    $$PWD/xyplotmanager.h
+    $$PWD/*.h
+
+
 
 		
 		
 SOURCES += \ 
-    $$PWD/meshmanager.cpp \
-    $$PWD/resultmeshmanager.cpp \
-    $$PWD/xyplotmanager.cpp
+     $$PWD/*.cpp
+

+ 93 - 91
CAE_Solution/src/VTK/Manager/meshmanager.cpp

@@ -1,21 +1,29 @@
-#include "meshmanager.h"
 #include <algorithm>
 #include <set>
+#include <QString>
 #include <QFileInfo>
+
+#include "../qvtkrenderer/qvtkrenderer.h"
+#include "../mesh/mesh.h"
 #include "../mesh/mesh_ugrid.h"
-#include "../visualization_VTK/vtkvisunshademesh.h"
-#include "../visualization_VTK/vtkvisunstructuredgridsource.h"
+#include "../visualization_vtk//vtkvisunshademesh.h"
+#include "../visualization_vtk/vtkvisunstructuredgridsource.h"
+#include "../manager/meshmanager.h"
+#include "../visualization_vtk/vtkvismeshbasetovtksource.h"
 #include "../mesh/mesh_tecplot.h"
-#include "../visualization_VTK/vtkvismeshbasetovtksource.h"
+
+
 
 MeshManager* MeshManager::m_pInstance = 0;
 
-/*
- * @brief: singleton methed, get class instance.
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230324
- */
+/**
+  * @brief singleton methed, get class instance.
+  *
+  * @param[in] 
+  * @return the class instance.
+  * @author shiting
+  * @date 20220729
+  */
 MeshManager* MeshManager::getInstance()
 {
     if (m_pInstance == 0)
@@ -25,35 +33,41 @@ MeshManager* MeshManager::getInstance()
     return m_pInstance;
 }
 
-/*
- * @brief: the constructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230324
- */
+/**
+  * @brief the constructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220729
+  */
 MeshManager::MeshManager()
 {
     meshObj_ = 0;
 }
 
-/*
- * @brief: the destructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230324
- */
-MeshManager::~MeshManager()
+/**
+  * @brief the destructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220729
+  */
+MeshManager::~MeshManager() 
 {
     this->Clear();
 }
 
-/*
- * @brief: clear the mesh information
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230324
- */
-void MeshManager::Clear()
+/**
+  * @brief clear the mesh information.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220802
+  */
+void MeshManager::Clear() 
 {
     if (meshObj_)
     {
@@ -61,6 +75,24 @@ void MeshManager::Clear()
         meshObj_ = 0;
     }
 
+    //hoops vis procs.
+#ifdef USE_HOOPS
+    for(map<size_t, VisMesh*>::iterator it = visZoneMeshMap_.begin(); it != visZoneMeshMap_.end(); ++it)
+    {
+        delete it->second;
+    }
+    visZoneMeshMap_.clear();
+
+    for (map<size_t, map<int, VisMesh*> >::iterator it = visZonePatchesMap_.begin(); it != visZonePatchesMap_.end(); ++it)
+    {
+        for(map<int, VisMesh*>::iterator itin = it->second.begin(); itin != it->second.end(); ++itin)
+        {
+            delete itin->second;
+        }
+    }
+    visZonePatchesMap_.clear();
+#endif
+
     //vtk vis procs.
     for(map<size_t, vtkVISUnShadeMesh*>::iterator it = vtkVisZoneMeshMap_.begin(); it != vtkVisZoneMeshMap_.end(); ++it)
     {
@@ -78,12 +110,14 @@ void MeshManager::Clear()
     //visZonePatchesMap_.clear();
 }
 
-/*
- * @brief: load mesh from file(从文件中加载mesh)
- * @param: file name
- * @ret: load mesh is successful or not
- * @birth: created by czm in 20230324
- */
+/**
+  * @brief load mesh from file.
+  *
+  * @param[in] the mesh file path.
+  * @return loading mesh is sucessful or not.
+  * @author shiting
+  * @date 20220729
+  */
 bool MeshManager::LoadData(const QString &datafile)
 {
     this->Clear();  //clear the old mesh.
@@ -104,9 +138,8 @@ bool MeshManager::LoadData(const QString &datafile)
     else if (extType == "tec" || extType == "plt")
     {
         meshObj_ = new Mesh_Tecplot;
-        if (extType == "tec"){
-
-        }
+        if (extType == "tec")
+            ;
         else if (extType == "plt")
             loadstate = meshObj_->Load_Binary(datafile.toStdString());
     }
@@ -119,12 +152,16 @@ bool MeshManager::LoadData(const QString &datafile)
     return loadstate;
 }
 
-/*
- * @brief: display mesh in renderer. vtk vis mode.(在渲染器中显示网格。vtk-vis模式)
- * @param: the renderer to draw mesh
- * @ret: void
- * @birth: created by czm in 20230324
- */
+
+
+/**
+  * @brief display mesh in renderer. vtk vis mode.
+  *
+  * @param[in] the renderer to draw mesh.
+  * @return 
+  * @author shiting
+  * @date 20220729
+  */
 void MeshManager::DisplayMesh(QVTKRenderer *qvtkRenderer)
 {
     if (meshObj_ == 0)  return;
@@ -211,50 +248,15 @@ void MeshManager::DisplayMesh(QVTKRenderer *qvtkRenderer)
     }
 }
 
-/*
- * @brief: highlight patches of a zone.(高亮显示分区的面片。)//hoops
- * @param: the zone index and patches indices to be highlighted.
- * @ret: void
- * @birth: created by czm in 20230324
- */
-void MeshManager::HighlightZonePatches(size_t zoneId, const vector<int> &patches)
-{
-   /* if (visZonePatchesMap_.find(zoneId) == visZonePatchesMap_.end())
-    {
-        return;
-    }*/
-    if (patches.empty())
-    {
-        return;
-    }
-}
+/**
+  * @brief highlight patches of a zone.
+  *
+  * @param[in] the zone index and patches indices to be highlighted.
+  * @return 
+  * @author shiting
+  * @date 20220819
+  */
+
+
+
 
-/*
- * @brief: highlight patches of a zone. In vtk mode.(高亮显示分区的面片。在vtk模式下)
- * @param: the zone index and patches indices to be highlighted.
- * @ret: void
- * @birth: created by czm in 20230324
- */
-void MeshManager::HighlightZonePatches_VTK(size_t zoneId, const vector<int> &patches)
-{
-    /*if (visZonePatchesMap_.find(zoneId) == visZonePatchesMap_.end())
-    {
-        return;
-    }*/
-    if (patches.empty())
-    {
-        return;
-    }
-    map<int, vtkVISUnShadeMesh*> &patchesMap = vtkVisZonePatchesMap_[zoneId];
-    vtkVISUnShadeMesh *meshObj = 0;
-    for (map<int, vtkVISUnShadeMesh*>::const_iterator it = patchesMap.begin(); it != patchesMap.end(); ++it)
-    {
-        if (find(patches.begin(), patches.end(), it->first) != patches.end())
-        {
-            it->second->SetColor(0.0, 1.0, 0.0);
-            meshObj = it->second;
-        }
-        else  it->second->SetColor(0.0, 0.0, 1.0);
-    }
-    if (meshObj)  meshObj->Update();   //update only once.
-}

+ 17 - 9
CAE_Solution/src/VTK/Manager/meshmanager.h

@@ -1,14 +1,20 @@
 #ifndef MESHMANAGER_H
 #define MESHMANAGER_H
 
-#include <map>
 #include <vector>
-#include <QString>
-#include "../mesh/mesh.h"
-#include "../QVTKRenderer/qvtkrenderer.h"
-#include "../visualization_VTK/vtkvisunshademesh.h"
+#include <map>
+using namespace std;
+
+
+class QString;
+class vtkVISUnShadeMesh;
+
+
+class Mesh;
 
 
+class QVTKRenderer;
+
 
 class MeshManager
 {
@@ -19,22 +25,24 @@ public:
     static MeshManager* getInstance();
     ~MeshManager();
     bool LoadData(const QString &datafile);
-    //hoops vis functions.
-    void HighlightZonePatches(size_t zoneId, const vector<int> &patches);
+
 
     //vtk vis functions.
     void DisplayMesh(QVTKRenderer *qvtkRenderer = 0);
-    void HighlightZonePatches_VTK(size_t zoneId, const vector<int> &patches);
+
 
 private:
     void Clear();
 
 private:
     Mesh *meshObj_;  //mesh object.
+    //mesh vis objects.  hoops vis functions.
+
     //mesh vis objects.  vtk vis functions.
     //vtkVISUnstructuredGridSource *source;
     map<size_t, vtkVISUnShadeMesh*>   vtkVisZoneMeshMap_;  //zoneid, mesh.
     map<size_t, map<int, vtkVISUnShadeMesh*> >  vtkVisZonePatchesMap_;  //zoneid, <patchtag, mesh>.
 };
 
-#endif // MESHMANAGER_H
+#endif
+

+ 0 - 726
CAE_Solution/src/VTK/Manager/resultmeshmanager.cpp

@@ -1,726 +0,0 @@
-#include "resultmeshmanager.h"
-#include "../mesh/mesh_ugrid.h"
-#include "../mesh/mesh_tecplot.h"
-
-#include <QFileInfo>
-#include <algorithm>
-#include <QString>
-#include <vtkAppendFilter.h>
-
-
-ResultMeshManager::ResultMeshManager()
-{
-    meshObj_ = 0;
-    m_currId = -1;
-    scalarIndex = -1;
-    range_[0] = 0;
-    range_[1] = 0;
-    scalarLeave = 10;
-    titleSize_ = 6;
-    labelSize_ = 5;
-
-//    animationWidget_ = NULL;
-//    contourWidget_ = NULL;
-//    lineWidget_ = NULL;
-//    vectorWidget_ = NULL;
-
-    changeRangeFlag = false;
-    surfaceHideFlag = true;
-    displayType = -1;
-    scaleFactor_ = 0.02;
-
-    solveTimes_.clear();
-    zoneNameSet_.clear();
-    currShowZoneNameSet_.clear();
-    surfaceActorColor_.clear();
-    scalarName_.clear();
-    allZoneScalarName_.clear();
-
-    surfaceActorColor_.push_back(0);
-    surfaceActorColor_.push_back(0);
-    surfaceActorColor_.push_back(1);
-    surfaceActorTransparency_ = 1;
-
-    addDataSource_ = NULL;
-    unSlice_ = NULL;
-}
-
-
-ResultMeshManager::~ResultMeshManager()
-{
-    this->Clear();
-}
-
-void ResultMeshManager::Clear()
-{
-    if (meshObj_)
-    {
-        delete meshObj_;
-        meshObj_ = 0;
-    }
-
-    //vtk vis procs.
-    for(map<double, map<string, vtkVISUnContour*>>::iterator it = vtkVisZoneMeshMap_.begin(); it != vtkVisZoneMeshMap_.end(); ++it)
-    {
-        for(map<string, vtkVISUnContour*>::iterator itin = it->second.begin(); itin != it->second.end(); ++itin)
-        {
-            delete itin->second;
-        }
-        it->second.clear();
-    }
-    vtkVisZoneMeshMap_.clear();
-
-    for(map<double, map<string, vtkVISUnShadeMesh*>>::iterator it = vtkVisZoneUnShadeMeshMap_.begin(); it != vtkVisZoneUnShadeMeshMap_.end(); ++it)
-    {
-        for(map<string, vtkVISUnShadeMesh*>::iterator itin = it->second.begin(); itin != it->second.end(); ++itin)
-        {
-            delete itin->second;
-        }
-        it->second.clear();
-    }
-    vtkVisZoneMeshMap_.clear();
-    for(map<double, map<string, vtkVISUnGlyph*>>::iterator it = vtkVisZoneGlyphMap_.begin(); it != vtkVisZoneGlyphMap_.end(); ++it)
-    {
-        for(map<string, vtkVISUnGlyph*>::iterator itin = it->second.begin(); itin != it->second.end(); ++itin)
-        {
-            delete itin->second;
-        }
-        it->second.clear();
-    }
-    vtkVisZoneGlyphMap_.clear();
-
-    if (addDataSource_ != NULL)
-    {
-        delete addDataSource_;
-        addDataSource_ = NULL;
-    }
-
-    if (unSlice_ != NULL)
-    {
-        unSlice_->Delete();
-        unSlice_ = NULL;
-    }
-
-
-    changeRangeFlag = false;
-    solveTimes_.clear();
-    zoneNameSet_.clear();
-    currShowZoneNameSet_.clear();
-    surfaceActorColor_.clear();
-    displayType = -1;
-
-    scalarName_.clear();
-    allZoneScalarName_.clear();
-
-    surfaceActorColor_.push_back(0);
-    surfaceActorColor_.push_back(0);
-    surfaceActorColor_.push_back(1);
-    surfaceActorTransparency_ = 1;
-}
-
-bool ResultMeshManager::LoadData(QString name)
-{
-    bool loadstate = false;
-    QFileInfo meshinfo(name);
-    QString extType(meshinfo.completeSuffix().toLower());
-
-    if (extType == "tec" || extType == "plt")
-    {
-        meshObj_ = new Mesh_Tecplot;
-        if (extType == "tec")
-            ;
-        else if (extType == "plt")
-            loadstate = meshObj_->Load_Binary(name.toStdString());
-    }
-    else
-    {
-
-    }
-    return loadstate;
-}
-
-void ResultMeshManager::DisplayMesh(QVTKRenderer *qvtkRenderer)
-{
-    render_ = qvtkRenderer;
-    if (meshObj_ == 0)  return;
-    if (qvtkRenderer == 0)  return;
-    solveTimes_.insert(meshObj_->GetSovleTime());
-    size_t nzone = meshObj_->GetZoneNumber();
-    vtkVISMeshToVTKSource* source = new vtkVISMeshToVTKSource;
-    map<string, vtkVISUnContour*> contourMap;
-    map<string, vtkVISUnGlyph*> glyphMap;
-    map<string, vtkVISUnShadeMesh*> unMeshMap;
-
-    source->MeshToVTK(meshObj_);
-    int type = source->GetType();
-    if (type == -1)//unKnow
-    {
-
-    }else if (type == 0)//structured
-    {
-
-    }else if (type == 1)//unstructured
-    {
-        for (int i = 0; i < nzone; i ++)
-        {
-            if (source->GetVtkUnMesh(i) != NULL)
-            {
-                map<double, map<string, vtkVISUnContour*>>::iterator contourIt = vtkVisZoneMeshMap_.find(meshObj_->GetSovleTime());
-                if (contourIt != vtkVisZoneMeshMap_.end())
-                {
-                    contourMap = contourIt->second;
-                }
-                map<double, map<string, vtkVISUnShadeMesh*>>::iterator unMeshIt = vtkVisZoneUnShadeMeshMap_.find(meshObj_->GetSovleTime());
-                if (unMeshIt != vtkVisZoneUnShadeMeshMap_.end())
-                {
-                    unMeshMap = unMeshIt->second;
-                }
-                map<double, map<string, vtkVISUnGlyph*>>::iterator glyphIt = vtkVisZoneGlyphMap_.find(meshObj_->GetSovleTime());
-                if (glyphIt != vtkVisZoneGlyphMap_.end())
-                {
-                    glyphMap = glyphIt->second;
-                }
-                vtkVISUnstructuredGridSource* unGrid = source->GetVtkUnMesh(i);
-                vtkVISUnContour* visobj = vtkVISUnContour::New();//contour
-                visobj->SetRenderTo(qvtkRenderer->GetRenderer());
-                vtkVISUnGlyph* unGlyph = vtkVISUnGlyph::New();//glyph3d
-                unGlyph->SetRenderTo(qvtkRenderer->GetRenderer());
-                vtkVISUnShadeMesh* unMesh = vtkVISUnShadeMesh::New();//unShadeMesh
-                unMesh->SetRenderTo(qvtkRenderer->GetRenderer());
-                visobj->SetDataSource(unGrid);
-                unGlyph->SetDataSource(unGrid);
-                unMesh->SetDataSource(unGrid);
-                unMesh->CreateShadeMeshSurfaceDisplay(true);
-                string zoneName = meshObj_->GetZoneName().at(i);
-                zoneNameSet_.insert(zoneName);
-                contourMap[zoneName] = visobj;
-                glyphMap[zoneName] = unGlyph;
-                unMeshMap[zoneName] = unMesh;
-            }
-        }
-    }
-    vtkVisZoneMeshMap_[meshObj_->GetSovleTime()] = contourMap;
-    vtkVisZoneGlyphMap_[meshObj_->GetSovleTime()] = glyphMap;
-    vtkVisZoneUnShadeMeshMap_[meshObj_->GetSovleTime()] = unMeshMap;
-}
-
-void ResultMeshManager::SetShowHideState(vector<bool> vec)
-{
-    currShowZoneNameSet_.clear();
-    int i = 0;
-    for (set<string>::iterator it = zoneNameSet_.begin(); it != zoneNameSet_.end(); it ++)
-    {
-        if (vec.at(i))
-        {
-            currShowZoneNameSet_.insert(*it);
-        }
-        i ++;
-    }
-}
-
-void ResultMeshManager::ShowAll()
-{
-    if (meshObj_ == 0)  return;
-    currShowZoneNameSet_.clear();
-    currShowZoneNameSet_ = zoneNameSet_;
-}
-
-void ResultMeshManager::DisplayMeshByIndex(int index)
-{
-    bool scalarBarState = true;
-    m_currId = index;
-    render_->HideAllActors();
-
-    int num = 0;
-    double time = 0.0;
-    for(set<double>::iterator it = solveTimes_.begin(); it != solveTimes_.end(); it ++)
-    {
-        if (num == m_currId)
-        {
-            time = *it;
-            break;
-        }
-        num ++;
-    }
-
-    map<double, map<string, vtkVISUnShadeMesh*>>::iterator it5 = vtkVisZoneUnShadeMeshMap_.begin();
-    if (index >= 0 && index <= vtkVisZoneUnShadeMeshMap_.size())
-    {
-        if (surfaceHideFlag)
-        {
-            for (map<double, map<string, vtkVISUnShadeMesh*>>::iterator it = vtkVisZoneUnShadeMeshMap_.begin();
-                 it != vtkVisZoneUnShadeMeshMap_.end(); it ++)
-            {
-                if (it->first == time)
-                {
-                    for (map<string, vtkVISUnShadeMesh*>::iterator it2= it->second.begin();
-                         it2 != it->second.end(); it2 ++)
-                    {
-                        if (currShowZoneNameSet_.count(it2->first))
-                        {
-                            it2->second->SetColor(surfaceActorColor_[0], surfaceActorColor_[1], surfaceActorColor_[2]);
-                            it2->second->SetOpacity(surfaceActorTransparency_);
-                            it2->second->ShowOn();
-                        }
-                    }
-                }
-            }
-        }
-        if (displayType == 0 || displayType == 2)//contour or line
-        {
-            InitRange(index);
-            for (map<double, map<string, vtkVISUnContour*>>::iterator it = vtkVisZoneMeshMap_.begin();
-                 it != vtkVisZoneMeshMap_.end(); it ++)
-            {
-                if (it->first == time)
-                {
-                    for (map<string, vtkVISUnContour*>::iterator it2= it->second.begin();
-                         it2 != it->second.end(); it2 ++)
-                    {
-                        if (currShowZoneNameSet_.count(it2->first))
-                        {
-                            it2->second->SetContourType(displayType);
-                            it2->second->SetContourLevel(scalarLeave);
-                            if (scalarName_ != it2->second->GetScalarName())
-                            {
-                                char* name = (char*)scalarName_.c_str();
-                                it2->second->ModifyContourDisplay(name);
-                                it2->second->DeleteScalarBar();
-                                it2->second->CreateScalarBar();
-                            }
-                            it2->second->ModifyDisplayScalarRange(range_[0], range_[1]);
-                            it2->second->ShowOffScalarBar();
-                            it2->second->ShowOn();
-                            if (scalarBarState)
-                            {
-                                it2->second->ShowOnScalarBar();
-                                scalarBarState = false;
-                            }
-                        }
-                    }
-                }
-            }
-        }else if (displayType == 3)//unglyph
-        {
-            for (map<double, map<string, vtkVISUnGlyph*>>::iterator it = vtkVisZoneGlyphMap_.begin();
-                 it != vtkVisZoneGlyphMap_.end(); it ++)
-            {
-                if (it->first == time)
-                {
-                    for (map<string, vtkVISUnGlyph*>::iterator it2= it->second.begin();
-                         it2 != it->second.end(); it2 ++)
-                    {
-                        if (currShowZoneNameSet_.count(it2->first))
-                        {
-                            it2->second->CreateGlyphDisplay(vectorScalarIndexVec.at(0),
-                                    vectorScalarIndexVec.at(1),
-                                    vectorScalarIndexVec.at(2));
-                            it2->second->SetGlyphScaleFactor(scaleFactor_);
-                        }
-                    }
-                }
-            }
-        }
-
-    }
-    render_->ZoomToExtents();
-}
-
-void ResultMeshManager::SetSaveIndex(int index)
-{
-    m_currId = index;
-}
-
-int ResultMeshManager::GetCurrIndex()
-{
-    return m_currId;
-}
-
-set<string> ResultMeshManager::GetZoneNameVec()
-{
-    return zoneNameSet_;
-}
-
-set<double> ResultMeshManager::GetSolveTime()
-{
-    return solveTimes_;
-}
-
-void ResultMeshManager::SetNameTypeMap()
-{
-    if (meshObj_ == 0)  return;
-    for (int i = 0; i < meshObj_->GetScalarNumber(); i ++)
-    {
-        string name = meshObj_->GetScalarName().at(i);
-        nameTypeMap_[name] = meshObj_->GetZoneScalarType().at(0).at(i + 3);
-        //cout << name << ",  " << meshObj_->GetZoneScalarType().at(0).at(i + 3) << endl;
-    }
-}
-
-map<string, int> ResultMeshManager::GetNameTypeMap()
-{
-    return nameTypeMap_;
-}
-
-vector<string> ResultMeshManager::GetMeshScalarNameVec()
-{
-    if (meshObj_ == 0)
-    {
-        vector<string> nullVec;
-        return nullVec;
-    }
-    return meshObj_->GetScalarName();
-}
-
-void ResultMeshManager::InitRange(int index)
-{
-    if(changeRangeFlag)//user set range
-    {
-        changeRangeFlag = false;
-    }else// program calculated range
-    {
-        set<double> set_;
-
-        int num = 0;
-        double time = 0.0;
-        for(set<double>::iterator it = solveTimes_.begin(); it != solveTimes_.end(); it ++)
-        {
-            if (num == index)
-            {
-                time = *it;
-                break;
-            }
-            num ++;
-        }
-
-        map<double, map<string, vtkVISUnContour*>>::iterator it1 = vtkVisZoneMeshMap_.find(time);
-        set<double>::iterator it3;
-        for (map<string, vtkVISUnContour*>::iterator unIt = it1->second.begin(); unIt != it1->second.end(); unIt ++)
-        {
-            if (currShowZoneNameSet_.count(unIt->first))
-            {cout << scalarName_<< endl;
-                double range[2];
-                //string str = meshObj_->GetScalarName().at(scalarIndex);
-                char* scalarName = (char*)scalarName_.c_str();
-                unIt->second->GetScalarRange(range, scalarName);
-                set_.insert(range[0]);
-                set_.insert(range[1]);
-            }
-        }
-        if (set_.size() == 0)
-        {
-            range_[0] = 0;
-            range_[1] = 0;
-        }else
-        {
-            it3 = set_.begin();
-            range_[0] = *it3;
-            it3 = --set_.end();
-            range_[1] = *it3;
-            //cout << range_[0] << ",   " << range_[1] << endl;
-        }
-    }
-
-    //SetWidgetRange();//init widget range parameter*/
-}
-
-double* ResultMeshManager::GetScalarRange()
-{
-    return range_;
-}
-
-void ResultMeshManager::ModifyScalarDisplay(int index)
-{
-    if (scalarIndex != index)
-    {
-        scalarIndex = index;
-    }
-}
-
-void ResultMeshManager::ModifyScalarDisplay(string name)
-{
-    if (scalarName_ != name)
-    {
-        scalarName_ = name;
-        InitRange(m_currId);
-    }
-}
-
-int ResultMeshManager::GetScalarIndex()
-{
-    return scalarIndex;
-}
-
-void ResultMeshManager::SetContourLevel(int level)
-{
-    scalarLeave = level;
-}
-
-int ResultMeshManager::GetContourLevel()
-{
-    return scalarLeave;
-}
-
-//void ResultMeshManager::SetCotourWidget(ContourDisplayW* w)
-//{
-//    contourWidget_ = w;
-//    if (meshObj_ != NULL)
-//    {
-//        contourWidget_->SetNameTypeMap(GetNameTypeMap());
-//        contourWidget_->SetScalarNameVec(GetMeshScalarNameVec());
-//        SetWidgetRange();
-//        SetWidgetScalarName();
-//    }
-//}
-
-//void ResultMeshManager::SetLineWidget(LineDisplayW* w)
-//{
-//    lineWidget_ = w;
-//    if (meshObj_ != NULL)
-//    {
-//        lineWidget_->SetNameTypeMap(GetNameTypeMap());
-//        lineWidget_->SetScalarNameVec(GetMeshScalarNameVec());
-//        SetWidgetRange();
-//        SetWidgetScalarName();
-//    }
-//}
-
-//void ResultMeshManager::SetVectorWidget(VectorW* w)
-//{
-//    vectorWidget_ = w;
-//    if (meshObj_ != NULL)
-//    {
-//        vectorWidget_->GetData_u(GetMeshScalarNameVec());
-//        vectorWidget_->GetData_v(GetMeshScalarNameVec());
-//        vectorWidget_->GetData_w(GetMeshScalarNameVec());
-//        vectorWidget_->SetScaleFactor(scaleFactor_);
-//    }
-//}
-
-//void ResultMeshManager::SetAnimationWidget(ContourInimationW *w)
-//{
-//    animationWidget_ = w;
-//    if (meshObj_ != NULL)
-//    {
-//        animationWidget_->SetSolveTime(GetSolveTime());
-//        animationWidget_->SetZoneNameVector(zoneNameSet_);
-//    }
-//}
-
-//void ResultMeshManager::SetWidgetRange()
-//{
-//    if (contourWidget_ != NULL)
-//    {
-//        contourWidget_->SetRange(range_);
-//    }
-//    if (lineWidget_ != NULL)
-//    {
-//        lineWidget_->SetRange(range_);
-//    }
-//}
-
-//void ResultMeshManager::SetWidgetScalarName()
-//{
-//    if (meshObj_ != NULL && scalarIndex != -1)
-//    {
-//        string name = meshObj_->GetScalarName().at(scalarIndex);
-//        if (contourWidget_ != NULL)
-//        {
-//            contourWidget_->SetCurrScalar(name);
-//        }
-//        if (lineWidget_ != NULL)
-//        {
-//            lineWidget_->SetCurrScalar(name);
-//        }
-//    }
-//}
-
-void ResultMeshManager::SetTitleSize(double size)
-{
-    titleSize_ = size;
-    //SetWidgetTitleSize();
-}
-
-//void ResultMeshManager::SetWidgetTitleSize()
-//{
-//    if (contourWidget_ != NULL)
-//    {
-//        contourWidget_->SetTitleFont(titleSize_);
-//    }
-//}
-
-void ResultMeshManager::SetLabelSize(double size)
-{
-    labelSize_ = size;
-    //SetWidgetLabelSize();
-}
-
-//void ResultMeshManager::SetWidgetLabelSize()
-//{
-//    if (contourWidget_ != NULL)
-//    {
-//        contourWidget_->SetLabelFont(labelSize_);
-//    }
-//}
-
-void ResultMeshManager::SetLevel(int level)
-{
-    scalarLeave = level;
-    //SetWidgetLevel();
-}
-
-//void ResultMeshManager::SetWidgetLevel()
-//{
-//    if (contourWidget_ != NULL)
-//    {
-//        contourWidget_->SetLevel(scalarLeave);
-//    }
-//    if (lineWidget_ != NULL)
-//    {
-//        lineWidget_->SetLevel(scalarLeave);
-//    }
-//}
-
-void ResultMeshManager::SetRange(double* range)
-{
-    range_[0] = range[0];
-    range_[1] = range[1];
-    changeRangeFlag = true;
-}
-
-void ResultMeshManager::SetDisplayType(int type)
-{
-    displayType = type;
-}
-
-//void ResultMeshManager::InitWidgetsParameter()
-//{
-//    if (animationWidget_ != NULL)
-//    {
-//        animationWidget_->SetSolveTime(GetSolveTime());
-//        animationWidget_->SetZoneNameVector(zoneNameSet_);
-//    }
-//    if (contourWidget_ != NULL)
-//    {
-//        contourWidget_->SetNameTypeMap(GetNameTypeMap());
-//        contourWidget_->SetScalarNameVec(GetMeshScalarNameVec());
-//        SetWidgetRange();
-//        SetWidgetScalarName();
-//    }
-//    if (lineWidget_ != NULL)
-//    {
-//        lineWidget_->SetNameTypeMap(GetNameTypeMap());
-//        lineWidget_->SetScalarNameVec(GetMeshScalarNameVec());
-//        SetWidgetRange();
-//        SetWidgetScalarName();
-//    }
-//    if (vectorWidget_ != NULL)
-//    {
-//        vectorWidget_->GetData_u(GetMeshScalarNameVec());
-//        vectorWidget_->GetData_v(GetMeshScalarNameVec());
-//        vectorWidget_->GetData_w(GetMeshScalarNameVec());
-//        vectorWidget_->SetScaleFactor(scaleFactor_);
-//    }
-//}
-
-void ResultMeshManager::SetVectorScalarIndex(vector<int> indexVec)
-{
-    vectorScalarIndexVec.clear();
-    if (indexVec.at(0) == -1 ||
-            indexVec.at(1) == -1 ||
-            indexVec.at(2) == -1)
-    {
-        return;
-    }else
-    {
-        vectorScalarIndexVec = indexVec;
-        DisplayMeshByIndex(m_currId);
-    }
-}
-
-void ResultMeshManager::SetVectorScaleFactor(double factor)
-{
-    scaleFactor_ = factor;
-}
-
-void ResultMeshManager::SetSurfaceColor(vector<double> color)
-{
-    surfaceActorColor_ = color;
-}
-
-void ResultMeshManager::SetSurfaceTransparency(double value)
-{
-    surfaceActorTransparency_ = value;
-}
-
-void ResultMeshManager::SetSurfaceShowHideFlag(bool flag)
-{
-    surfaceHideFlag = flag;
-}
-
-void ResultMeshManager::SetScalarName(string name)
-{
-    scalarName_ = name;
-}
-
-void ResultMeshManager::MakeVISUnStructGrid(int index)
-{
-    if (meshObj_ == 0)  return;
-    int num = 0;
-    double time = 0.0;
-    for(set<double>::iterator it = solveTimes_.begin(); it != solveTimes_.end(); it ++)
-    {
-        if (num == index)
-        {
-            time = *it;
-            break;
-        }
-        num ++;
-    }
-
-    vector<vtkVISUnstructuredGridSource*> vec;
-    map<double, map<string, vtkVISUnContour*>>::iterator it = vtkVisZoneMeshMap_.find(time);
-    if (it != vtkVisZoneMeshMap_.end())
-    {
-        for (map<string, vtkVISUnContour*>::iterator it2= it->second.begin();
-             it2 != it->second.end(); it2 ++)
-        {
-            if (currShowZoneNameSet_.count(it2->first))
-            {
-                vtkVISUnstructuredGridSource* unGrid = vtkVISUnstructuredGridSource::New();
-                unGrid = it2->second->GetDatSource();
-                vec.push_back(unGrid);
-            }
-        }
-        if (addDataSource_ != NULL)
-        {
-            delete addDataSource_;
-            addDataSource_ = NULL;
-        }
-        addDataSource_ = new vtkVISAddUnGridDataSource();
-        addDataSource_->SetVISUnGridDataSource(vec);
-    }
-}
-
-void ResultMeshManager::DisplayUnstructGrid()
-{
-    if (render_ == NULL)
-    {
-        return;
-    }
-    if (unSlice_ != NULL)
-    {
-        unSlice_->Delete();
-        unSlice_ = NULL;
-    }
-    unSlice_ = vtkVISUnSlice::New();
-    unSlice_->SetRenderTo(render_->GetRenderer());
-    string name = GetMeshScalarNameVec().at(0);
-    unSlice_->SetDataSource(addDataSource_->GetSource());
-    char* s = (char*)(name.c_str());
-    char* v = NULL;
-    unSlice_->SetSliceSource(s, v);
-    unSlice_->CreateUnSliceContourDisplay();
-    unSlice_->CreateSliceWidget();
-}
-

+ 0 - 118
CAE_Solution/src/VTK/Manager/resultmeshmanager.h

@@ -1,118 +0,0 @@
-#ifndef RESULTMESHMANAGER_H
-#define RESULTMESHMANAGER_H
-#include <vector>
-#include <map>
-#include <QStringList>
-#include <QString>
-#include "../QVTKRenderer/qvtkrenderer.h"
-#include "../visualization_VTK/vtkvisaddungriddatasource.h"
-#include "../visualization_VTK/vtkvisunslice.h"
-#include "../visualization_VTK/vtkvisuncontour.h"
-#include "../visualization_VTK/vtkvisunglyph.h"
-#include "../visualization_VTK/vtkvisunshademesh.h"
-#include "../visualization_VTK/vtkvismeshtovtksource.h"
-#include "../mesh/mesh.h"
-
-using namespace std;
-#include <set>
-
-class ResultMeshManager
-{
-public:
-    ResultMeshManager();
-    ~ResultMeshManager();
-    bool LoadData(QString name);
-
-    //vtk vis functions.
-    void DisplayMesh(QVTKRenderer *qvtkRenderer = 0);
-    void DisplayMeshByIndex(int index = 0);
-
-    void SetSaveIndex(int index);
-    int GetCurrIndex();
-    set<double> GetSolveTime();
-    set<string> GetZoneNameVec();
-    void SetNameTypeMap();
-    map<string, int> GetNameTypeMap();
-    void Clear();
-    vector<string> GetMeshScalarNameVec();
-    void SetShowHideState(vector<bool> vec);
-    void ShowAll();
-    void InitRange(int index);
-    double* GetScalarRange();
-    void ModifyScalarDisplay(int index);
-    void ModifyScalarDisplay(string name);
-    int GetScalarIndex();
-    void SetContourLevel(int level);
-    int GetContourLevel();
-
-//    void SetCotourWidget(ContourDisplayW* w);
-//    void SetLineWidget(LineDisplayW* w);
-//    void SetVectorWidget(VectorW* w);
-//    void SetAnimationWidget(ContourInimationW* 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();
-
-    void SetVectorScalarIndex(vector<int> indexVec);
-    void SetVectorScaleFactor(double factor);
-
-    void SetSurfaceColor(vector<double> color);
-    void SetSurfaceTransparency(double value);
-    void SetSurfaceShowHideFlag(bool flag);
-
-    void SetScalarName(string name);
-
-    //vtkunslice
-    void MakeVISUnStructGrid(int index);
-    void DisplayUnstructGrid();
-
-private:
-    int m_currId;
-    Mesh *meshObj_;  //mesh object.
-    //mesh vis objects.  vtk vis functions.
-    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_;
-    map<string, int> nameTypeMap_;
-    QVTKRenderer* render_;
-    vector<bool> showHideVec_;
-    vtkVISAddUnGridDataSource* addDataSource_;
-    vtkVISUnSlice* unSlice_;
-    double range_[2];
-    int scalarIndex;
-    int scalarLeave;
-
-//    ContourDisplayW* contourWidget_;
-//    LineDisplayW* lineWidget_;
-//    VectorW* vectorWidget_;
-//    ContourInimationW* animationWidget_;
-
-    double titleSize_;
-    double labelSize_;
-
-    bool changeRangeFlag;
-    bool surfaceHideFlag; //true is hide, false is show
-
-    int displayType;//0 is contour; 2 is line; 3 is vector
-
-    double scaleFactor_;
-    vector<int> vectorScalarIndexVec;
-    vector<double> surfaceActorColor_;
-    double surfaceActorTransparency_;
-    string scalarName_;
-    string allZoneScalarName_;
-};
-
-#endif // RESULTMESHMANAGER_H

+ 0 - 264
CAE_Solution/src/VTK/Manager/xyplotmanager.cpp

@@ -1,264 +0,0 @@
-#include "xyplotmanager.h"
-#include <algorithm>
-#include <set>
-#include <QFileInfo>
-#include <QDebug>
-
-/*
- * @brief: the constructor
- * @param:
- * @ret:
- * @birth: created by czm in 20230411
- */
-XYPlotManager::XYPlotManager()
-{
-    plotData = NULL;
-    curveNum = 0;
-    plot = NULL;
-
-    xRange.clear();
-    xRange.push_back(0);
-    xRange.push_back(0);
-}
-
-/*
- * @brief: the destructor
- * @param:
- * @ret:
- * @birth: created by czm in 20230411
- */
-XYPlotManager::~XYPlotManager()
-{
-    this->Clear();
-    if (plot != NULL)
-    {
-        delete plot;
-    }
-    plot = NULL;
-}
-
-/*
- * @brief: clear(删除图表数据和坐标轴)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlotManager::Clear()
-{
-    if (plotData != NULL)
-    {
-        delete plotData;
-    }
-    plotData = NULL;
-    if (plot != NULL)
-    {
-        plot->DestroyXYPlot();
-        //delete plot;
-    }
-}
-
-/*
- * @brief: load data(加载数据)
- * @param: datafile
- * @ret: bool
- * @birth: created by czm in 20230411
- */
-bool XYPlotManager::LoadData(const QString &datafile)
-{
-    this->Clear();
-    QFileInfo info(datafile);
-    QString extType(info.completeSuffix().toLower());
-    bool loadstate = false;
-    plotData = new LoadXYPlotData();
-    string str = datafile.toStdString();
-    char* name = (char* )(str.c_str());
-    loadstate = plotData->LoadData(name);
-    return loadstate;
-}
-
-/*
- * @brief: init renderer(初始化renderer)
- * @param: qvtkrenderer
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlotManager::InitRenderer(QVTKRenderer *qvtkRenderer)
-{
-
-    if (qvtkRenderer == 0)  return;
-    render_ = qvtkRenderer;
-    plot = new XYPlot();
-    plot->SetVtkRender(qvtkRenderer->GetRenderer());
-    plot->DestroyXYPlot();
-    plot->AllocateXYPlot(1);
-    vector<bool> showFlag(1,true);
-    plot->CreateXYPlot(showFlag);
-}
-
-/*
- * @brief: allocate data(分配数据)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlotManager::AllocateData()
-{
-    xRange.clear();
-    plot->DestroyXYPlot();
-    showHideVec.clear();
-    vector<string> nameVec;
-    nameVec = plotData->GetYNameVec();
-    string xName = plotData->GetXName();
-    map<string, vtkDoubleArray*> nameDataMap = plotData->GetNameDataMap();
-    map<string, vtkDoubleArray*>::iterator it = nameDataMap.find(xName);
-
-    plot->AllocateXYPlot(nameVec.size());
-    plot->SetXDoubleArray(it->second);
-    double range[2];
-    it->second->GetRange(range);
-    xRange.push_back(range[0]);
-    xRange.push_back(range[1]);
-    for (int i = 0; i < nameVec.size(); i ++)
-    {
-        if (i == 0)
-        {
-            showHideVec.push_back(true);
-        }else
-        {
-            showHideVec.push_back(false);
-        }
-        it = nameDataMap.find(nameVec.at(i));
-        plot->SetYDoubleArray(i, it->second);
-    }
-    plot->CreateXYPlot(showHideVec);
-    plot->SetXAxisTitle((char*)(xName.c_str()));
-    plot->SetLegendLabel(0,(char*)(nameVec.at(0).c_str()));
-    char c[] = "";
-    plot->SetGlyphType(0,c);
-    render_->Update();
-}
-
-/*
- * @brief: set show hide vector(设置显示隐藏的容器)
- * @param: vector
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlotManager::SetShowHideVec(vector<bool> vec)
-{
-    showHideVec.clear();
-    showHideVec = vec;
-}
-
-/*
- * @brief: Display curve(展示曲线)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlotManager::DisplayCurve()
-{
-    if (plotData != NULL)
-    {
-        vector<string> nameVec;
-        nameVec = plotData->GetYNameVec();
-        map<string, vtkDoubleArray*> nameDataMap = plotData->GetNameDataMap();
-        plot->RemoveXYPlotActor();
-        string xName = plotData->GetXName();
-        plot->CreateXYPlot(showHideVec);
-        plot->SetXAxisTitle((char*)(xName.c_str()));
-
-        int showCurveId = 0;
-        for (int i = 0; i < showHideVec.size(); i ++)
-        {
-            if (showHideVec.at(i))
-            {
-                plot->SetLegendLabel(showCurveId,(char*)(nameVec.at(i).c_str()));
-                showCurveId ++;
-            }
-        }
-        render_->Update();
-    }
-}
-
-/*
- * @brief: set x range(设置x的范围)
- * @param: min and max
- * @ret:void
- * @birth: created by czm in 20230411
- */
-void XYPlotManager::SetXRange(double min, double max)
-{
-    plot->SetXRange(min,max);
-}
-
-/*
- * @brief: set xy plot type(设置xyplot 类型)
- * @param: type
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlotManager::SetXYPlotType(string type)
-{
-    plot->SetCurveType(type);
-    int id = 0;
-    if (type == "point")
-    {
-        for (int i = 0; i < showHideVec.size(); i ++)
-        {
-            if (showHideVec.at(i))
-            {
-                char p[] = "Point";
-                plot->SetGlyphType(id, p);
-                id ++;
-            }
-        }
-    }else if (type == "curve")
-    {
-        for (int i = 0; i < showHideVec.size(); i ++)
-        {
-            if (showHideVec.at(i))
-            {
-                char p[] = "";
-                plot->SetGlyphType(id, p);
-                id ++;
-            }
-        }
-    }
-}
-
-/*
- * @brief: set xy plot point size(设置xyplot 点大小)
- * @param: size
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlotManager::SetXyplotPointSize(double s)
-{
-    plot->SetPlotPointSize(s);
-}
-
-/*
- * @brief: Set XYPlot Line Width(设置xyplot线宽)
- * @param: line width
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlotManager::SetXYPlotLineWidth(double w)
-{
-    plot->SetPlotLineWidth(w);
-}
-
-/*
- * @brief: render update(渲染刷新)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlotManager::RenderUpdata()
-{
-    if (render_ != NULL)
-    {
-        render_->Update();
-    }
-}

+ 0 - 40
CAE_Solution/src/VTK/Manager/xyplotmanager.h

@@ -1,40 +0,0 @@
-#ifndef XYPLOTMANAGER_H
-#define XYPLOTMANAGER_H
-
-#include <iostream>
-using namespace std;
-#include "../visualization_VTK/loadxyplotdata.h"
-#include "../visualization_VTK/vtkxyplotvis.h"
-#include <QString>
-#include "../mesh/mesh.h"
-#include "../QVTKRenderer/qvtkrenderer.h"
-
-
-class XYPlotManager
-{
-public:
-    XYPlotManager();
-    ~XYPlotManager();
-    bool LoadData(const QString &datafile);
-    void InitRenderer(QVTKRenderer *qvtkRenderer = 0);
-    void AllocateData();
-    void DisplayCurve();
-    void Clear();
-
-    void SetShowHideVec(vector<bool> vec);
-    void SetXRange(double min, double max);
-    void SetXYPlotType(string type);
-    void SetXyplotPointSize(double s);
-    void SetXYPlotLineWidth(double w);
-    void RenderUpdata();
-private:
-    LoadXYPlotData* plotData;
-
-    vector<bool> showHideVec;
-    QVTKRenderer *render_;
-    int curveNum;
-    XYPlot* plot;
-    vector<double> xRange;
-};
-
-#endif // XYPLOTMANAGER_H

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

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

+ 1 - 1
CAE_Solution/src/VTK/QVTKRenderer/qvtkrenderer.cpp

@@ -51,7 +51,7 @@ void QVTKRenderer::init()
     renderer->SetBackground(1.0,1.0,1.0);
     this->renderWin->AddRenderer(this->renderer);
     qvtkWidget->SetRenderWindow(this->renderWin);
-    camera_ = vtkVisCameraManager::New();
+    camera_ = vtkVISCameraManager::New();
     camera_->SetRenderTo(this->renderer);
 
     surfaceVisible_ = true;

+ 1 - 1
CAE_Solution/src/VTK/QVTKRenderer/qvtkrenderer.h

@@ -82,7 +82,7 @@ public:
     QVTKOpenGLNativeWidget* qvtkWidget;
     vtkGenericOpenGLRenderWindow* renderWin;
     vtkRenderer* renderer;
-    vtkVisCameraManager* camera_;
+    vtkVISCameraManager* camera_;
 
     int curRenderMode_;
     bool surfaceVisible_;

+ 0 - 181
CAE_Solution/src/VTK/mesh/cells.h

@@ -1,181 +0,0 @@
-#ifndef CELLS_H
-#define CELLS_H
-
-#include <vector>
-#include <set>
-#define NULLTAG -1270
-
-using namespace std;
-
-enum CellType {
-    unknownCell = 1,
-    lineCell, //线单元
-    TriangleCell, //三角形单元
-    quadCell, //四边形单元
-    tetraCell, //四面体
-    pyramidCell,//锥形单元
-    prismCell,//棱柱单元
-    hexaCell //立方体单元
-};
-
-class CellBase {
-public:
-    CellBase() {
-        type_     = CellType::unknownCell;
-        pointNum_ = 0;
-        tag_      = NULLTAG;
-    }
-    virtual ~CellBase() {}
-    CellType GetCellType() const {
-        return type_;
-    }
-    size_t GetPointNumber() const {
-        return pointNum_;
-    }
-    int GetPoint(size_t id) const {
-        if (id >= pointNum_) return -1;
-        return pointsVec_[id];
-    }
-    void SetPoint(size_t id, size_t pointId) {
-        if (id >= pointNum_) return;
-        pointsVec_[id] = pointId;
-    }
-    int GetTag()const {
-        return tag_;
-    }
-    void SetTag(int tag) {
-        tag_ = tag;
-    }
-
-protected:
-    CellType       type_;
-    size_t         pointNum_;
-    vector<int>    pointsVec_;
-    int            tag_;
-};
-//line :two points 线
-/*
-        a------------b
-* */
-class CellLine :public CellBase
-{
-public:
-    CellLine() {
-        type_ = CellType::lineCell;
-        pointNum_ = 2;
-        pointsVec_.resize(pointNum_);
-    }
-};
-//triangle : three points 三角形
-/*
-                  a
-                 *  *
-               *      *
-              b********c
-* */
-class CellTriangle : public CellBase
-{
-public:
-    CellTriangle() {
-        type_ = CellType::TriangleCell;
-        pointNum_ = 3;
-        pointsVec_.resize(pointNum_);
-    }
-};
-//quad : four points 四边形
-/*
-*                A**********B
-*                *          *
-*                *          *
-*                *          *
-*				 *          *
-*                C**********D
-*
-* */
-class CellQuad : public CellBase
-{
-public:
-    CellQuad() {
-        type_ = CellType::quadCell;
-        pointNum_ = 4;
-        pointsVec_.resize(pointNum_);
-    }
-};
-//trtra : four points 四面体
-/*
- *                A
-*			   * *  *
-*             *   *   *
-*           *       *    *
-*         *           *     *
-*       *               *       D
-*     *                   *  *
-*    B * * * * * * * * * * C
-*/
-class CellTetra : public CellBase
-{
-public:
-    CellTetra() {
-        type_ = CellType::tetraCell;
-        pointNum_ = 4;
-        pointsVec_.resize(pointNum_);
-    }
-};
-//pyramid: five points 锥体
-/*
-*
-*         A*************B
-*         *     *       * *
-*         *           * *   *
-*         *             *   *  *
-*         *             *         E
-*         *             *   *  *
-*         *           * *   *
-*         *     *        * *
-*         C*************D
-*
-* */
-class CellPyramid : public CellBase
-{
-public:
-    CellPyramid() {
-        type_ = CellType::pyramidCell;
-        pointNum_ = 5;
-        pointsVec_.resize(pointNum_);
-    }
-};
-//prism: six point 三棱柱
-/*
-*
-*           A****************************D
-*           *  *                        ·  *
-*           *    C·····························F
-*           *   *                       ·    *
-*           * *                         ·  *
-*           B****************************E
-*
-*
-* */
-class CellPrism : public CellBase
-{
-public:
-    CellPrism()
-    {
-        type_ = CellType::prismCell;
-        pointNum_ = 6;
-        pointsVec_.resize(pointNum_);
-    }
-};
-//hexa : eight points 立方体
-class CellHexa : public CellBase
-{
-public:
-    CellHexa()
-    {
-        type_ = CellType::hexaCell;
-        pointNum_ = 8;
-        pointsVec_.resize(pointNum_);
-    }
-};
-
-#endif // CELLS_H

+ 283 - 231
CAE_Solution/src/VTK/mesh/mesh.cpp

@@ -1,51 +1,66 @@
-#include "mesh.h"
-
-/*
-* @brief: the constructor
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230317
-*/
-
+#include <set>
+#include "MeshBase.h"
+#include "MeshStructured.h"
+#include "MeshUnstructured.h"
+#include "Mesh.h"
+#include <iostream>
+
+
+
+/**
+  * @brief the constructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
 Mesh::Mesh()
 {
-    this->zoneNumber_ = 0;
-    this->solutionTime_ = 0;
-    this->title_ = 0;
-    this->scalarNumber_ = 0;
-    this->vectorNumber_ = 0;
+    zoneNumber_ = 0;
+    solutionTime_ = 0;
+    title_ = 0;
+    scalarNumber_ = 0;
+    vectorNumber_ = 0;
 }
 
-/*
-* @brief: the destructor
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230317
-*/
+/**
+  * @brief the destructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
 Mesh::~Mesh()
 {
-    for (vector<Points*>::iterator it = zonePointsVec_.begin(); it != zonePointsVec_.end(); it++) {
-        delete(*it);
+    for (vector<PointsDS*>::iterator it = zonePointsVec_.begin(); it != zonePointsVec_.end(); ++it)
+    {
+        delete (*it);
     }
-    this->zonePointsVec_.clear();
-    for (vector<MeshBase*>::iterator it = zoneMeshVec_.begin(); it != zoneMeshVec_.end(); it++) {
-        delete(*it);
+    zonePointsVec_.clear();
+    for (vector<MeshBase*>::iterator it = zoneMeshVec_.begin(); it != zoneMeshVec_.end(); ++it)
+    {
+        delete (*it);
     }
-    this->zoneMeshVec_.clear();
+    zoneMeshVec_.clear();
 
-    for (map<size_t, map<int, MeshBase*>>::iterator it = zonePatchesMap_.begin(); it != zonePatchesMap_.end(); it++) {
-        for (map<int, MeshBase*>::iterator itin = it->second.begin(); itin != it->second.end(); itin++)
+    for (map<size_t, map<int, MeshBase*> >::iterator it = zonePatchesMap_.begin(); it != zonePatchesMap_.end(); ++it)
+    {
+        for (map<int, MeshBase*>::iterator itin = it->second.begin(); itin != it->second.end(); ++itin)
         {
             delete itin->second;
         }
     }
     zonePatchesMap_.clear();
 
-    if (title_ != NULL) {
+    if (title_ != NULL)
+    {
         delete[] title_;
     }
 
-    if (!scalarName_.empty()) {
+    if (!scalarName_.empty())
+    {
         scalarName_.clear();
     }
 
@@ -54,32 +69,38 @@ Mesh::~Mesh()
         vectorName_.clear();
     }
 
-    if (!zoneName_.empty()) {
+    if (!zoneName_.empty())
+    {
         zoneName_.clear();
     }
 
     if (!zoneScalarType_.empty())
     {
-        for (int i = 0; i < zoneScalarType_.size(); i++) {
+        for (int i = 0; i < zoneScalarType_.size(); i ++)
+        {
             zoneScalarType_[i].clear();
         }
         zoneScalarType_.clear();
     }
 
-    if (!zoneScalarShareVec_.empty()) {
-        for (int i = 0; i < zoneScalarShareVec_.size(); i++) {
+    if (!zoneScalarShareVec_.empty())
+    {
+        for (int i = 0; i < zoneScalarShareVec_.size(); i ++)
+        {
             zoneScalarShareVec_[i].clear();
         }
         zoneScalarShareVec_.clear();
     }
 
-    if (!zoneScalarRange_.empty()){
-        for (int i = 0; i < zoneScalarRange_.size(); i++)
+    if (!zoneScalarRange_.empty())
+    {
+        for (int i = 0; i < zoneScalarRange_.size(); i ++)
         {
-            if (!zoneScalarRange_[i].empty()) {
-                for (int j = 0; j < zoneScalarRange_[i].size(); i++)
+            if (!zoneScalarRange_[i].empty())
+            {
+                for (int j = 0; j < zoneScalarRange_[i].size(); i ++)
                 {
-                    delete[] zoneScalarRange_[i][j];
+                    delete [] zoneScalarRange_[i][j];
                 }
                 zoneScalarRange_[i].clear();
             }
@@ -87,13 +108,15 @@ Mesh::~Mesh()
         }
     }
 
-    if (!ScalarsData_.empty()) {
-        for (int i = 0; i < ScalarsData_.size(); i++)
+    if (!ScalarsData_.empty())
+    {
+        for (int i = 0; i < ScalarsData_.size(); i ++)
         {
-            if (!ScalarsData_[i].empty()) {
-                for (int j = 0; j < ScalarsData_[i].size(); j++)
+            if (!ScalarsData_[i].empty())
+            {
+                for (int j = 0; j < ScalarsData_[i].size(); j ++)
                 {
-                    delete[] ScalarsData_[i][j];
+                    delete [] ScalarsData_[i][j];
                 }
                 ScalarsData_[i].clear();
             }
@@ -102,67 +125,69 @@ Mesh::~Mesh()
     }
 }
 
-/*
-* @brief: get zone number in mesh
-* @param: void
-* @ret: the zone number
-* @birth: created by czm in 20230317
-*/
+/**
+  * @brief get zone number in mesh.
+  *
+  * @param[in] 
+  * @return the zone number.
+  * @author shiting
+  * @date 20220721
+  */
 size_t Mesh::GetZoneNumber()
 {
-    return this->zoneNumber_;
+    return zoneNumber_;
 }
 
-/*
-* @brief: get the zone mesh by zone index
-* @param: zoneid
-* @ret: return the zone mesh
-* @birth: created by czm in 20230317
-*/
-MeshBase * Mesh::GetZoneMesh(size_t zoneId)
+/**
+  * @brief get the zone mesh by zone index.
+  *
+  * @param[in] zone id.
+  * @return return the zone mesh.
+  * @author shiting
+  * @date 20220801
+  */
+MeshBase* Mesh::GetZoneMesh(size_t zoneId)
 {
-    if (zoneId >= zoneNumber_)return 0;
+    if (zoneId >= zoneNumber_)  return 0;
     else return zoneMeshVec_.at(zoneId);
 }
 
-/*
-* @brief: get patch number in zone
-* @param: zoneid
-* @ret: the patch number
-* @birth: created by czm in 20230317
-*/
+/**
+  * @brief get patch number in zone.
+  *
+  * @param[in] zone id.
+  * @return the patch number.
+  * @author shiting
+  * @date 20220721
+  */
 size_t Mesh::GetZonePatchNumber(size_t zoneId)
 {
-    if (zoneId >= zoneNumber_) return 0;
-    MeshBase* zonemesh = zoneMeshVec_.at(zoneId);
+    if (zoneId >= zoneNumber_)  return 0;
+    MeshBase *zonemesh = zoneMeshVec_.at(zoneId);
     return zonemesh->GetPatchNumber();
 }
 
-/*
-* @brief:
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230317
-*/
 const set<int>* Mesh::GetZonePatchTags(size_t zoneId)
 {
-    if (zoneId >= zoneNumber_) return 0;
-    MeshBase* zonemesh = zoneMeshVec_.at(zoneId);
+    if (zoneId >= zoneNumber_)  return 0;
+    MeshBase *zonemesh = zoneMeshVec_.at(zoneId);
     return zonemesh->GetPatchTagsList();
 }
 
-/*
-* @brief: get the patch mesh in zone
-* @param: zoneid and patch tag
-* @ret: the patch mesh
-* @birth: created by czm in 20230317
-*/
-MeshBase * Mesh::GetZonePatchMesh(size_t zoneId,int patchTag)
+/**
+  * @brief get the patch mesh in zone.
+  *
+  * @param[in] zone id, patch tag.
+  * @return return the patch mesh.
+  * @author shiting
+  * @date 20220801
+  */
+MeshBase* Mesh::GetZonePatchMesh(size_t zoneId, int patchTag)
 {
-    MeshBase* patch = 0;
+    MeshBase *patch = 0;
     if (zonePatchesMap_.find(zoneId) != zonePatchesMap_.end())
     {
-        if(zonePatchesMap_[zoneId].find(patchTag) != zonePatchesMap_[zoneId].end())
+        if (zonePatchesMap_[zoneId].find(patchTag) != zonePatchesMap_[zoneId].end())
         {
             patch = zonePatchesMap_[zoneId][patchTag];
         }
@@ -170,151 +195,43 @@ MeshBase * Mesh::GetZonePatchMesh(size_t zoneId,int patchTag)
     return patch;
 }
 
-/*
-* @brief: get the scalar number in zone
-* @param: void
-* @ret:  scalar number
-* @birth: created by czm in 20230317
-*/
-size_t Mesh::GetScalarNumber()
-{
-    return this->scalarNumber_;
-}
-
-/*
-* @brief: get the vector number in zone
-* @param: void
-* @ret:  vector number
-* @birth: created by czm in 20230320
-*/
-size_t Mesh::GetVectorNumber()
-{
-    return this->vectorNumber_;
-}
-
-/*
-* @brief: get the scalar number in zone
-* @param: void
-* @ret:  zoneScalarType
-* @birth: created by czm in 20230320
-*/
-vector<vector<int>> Mesh::GetZoneScalarType()
-{
-    return this->zoneScalarType_;
-}
-
-/*
-* @brief: get the scalar name in zone
-* @param: void
-* @ret:  scalarname
-* @birth: created by czm in 20230320
-*/
-vector<string> Mesh::GetScalarName()
-{
-    return this->scalarName_;
-}
-
-/*
-* @brief: get the vector name in zone
-* @param: void
-* @ret:  vector name
-* @birth: created by czm in 20230320
-*/
-vector<string> Mesh::GetVectorName()
-{
-    return this->vectorName_;
-}
-
-/*
-* @brief: get  the zone name
-* @param: void
-* @ret:  zone number
-* @birth: created by czm in 20230320
-*/
-vector<string> Mesh::GetZoneName()
-{
-    return this->zoneName_;
-}
-
-
-/*
-* @brief: get the scalar range in zone
-* @param: void
-* @ret:  scalar range
-* @birth: created by czm in 20230320
-*/
-vector<vector<double*>> Mesh::GetScalarRange()
-{
-    return this->zoneScalarRange_;
-}
-
-
-/*
-* @brief: get the scalar data in zone
-* @param: void
-* @ret:  scalar number
-* @birth: created by czm in 20230320
-*/
-vector<vector<double*>> Mesh::GetScalarData()
-{
-    return this->ScalarsData_;
-}
-
-
-/*
-* @brief: get the scalar number in zone
-* @param: void
-* @ret:  ZoneScalarShareVec
-* @birth: created by czm in 20230320
-*/
-vector<vector<int>> Mesh::GetScalarShareVec()
-{
-    return this->zoneScalarShareVec_;
-}
-
-
-/*
-* @brief: get the solve time
-* @param: void
-* @ret:  sovle time
-* @birth: created by czm in 20230320
-*/
-double Mesh::GetSovleTime()
-{
-    return this->solutionTime_;
-}
-
-
-/*
-* @brief: save patches mesh of a zone
-* @param: void
-* @ret:  void
-* @birth: created by czm in 20230320
-*/
-void Mesh::BuildzonePatchesMesh()
+/**
+  * @brief save patches(bc) mesh of a zone.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220801
+  */
+void Mesh::BuildZonePatchesMesh()
 {
-    for (size_t i = 0; i < zoneNumber_; i++)
+    for (size_t i = 0; i < zoneNumber_; ++i)
     {
-        MeshBase*  zonemesh = zoneMeshVec_.at(i);
-        if (zonemesh->GetPatchNumber() < 2)continue;
-        if (zonePatchesMap_.find(i) != zonePatchesMap_.end())continue;
-        MeshType meshType = zonemesh->GetMeshType();
-        if (meshType == MeshType::Structured) {
-            BuildzonePatchesMesh_Str(i);
+        MeshBase *zonemesh = zoneMeshVec_.at(i);
+        if (zonemesh->GetPatchNumber() < 2)  continue;
+        if (zonePatchesMap_.find(i) != zonePatchesMap_.end()) continue;
+        MeshType meshType = zonemesh->GetType();
+
+        if (meshType == Structured)
+        {
+            BuildZonePatchesMesh_Str(i);
         }
-        else if (meshType == MeshType::Unstructured) {
-            BuildzonePatchesMesh_Uns(i);
+        else if (meshType == Unstructured)
+        {
+            BuildZonePatchesMesh_Uns(i);
         }
     }
 }
 
-/*
-* @brief: save patches mesh of a zone for unstructured
-* @param: id
-* @ret:  void
-* @birth: created by czm in 20230320
-*/
-void Mesh::BuildzonePatchesMesh_Uns(size_t zoneId)
+/**
+  * @brief save patches(bc) mesh of a zone for structured.
+  *
+  * @param[in] the zone mesh.
+  * @return 
+  * @author shiting
+  * @date 20220801
+  */
+void Mesh::BuildZonePatchesMesh_Uns(size_t zoneId)
 {
     MeshBase *zonemesh = zoneMeshVec_.at(zoneId);
     MeshUnstructured *mesh = dynamic_cast<MeshUnstructured*>(zonemesh);
@@ -345,13 +262,15 @@ void Mesh::BuildzonePatchesMesh_Uns(size_t zoneId)
     zonePatchesMap_[zoneId] = savedPatchMap;
 }
 
-/*
-* @brief: save patches mesh of a zone for structured
-* @param: id
-* @ret:  void
-* @birth: created by czm in 20230320
-*/
-void Mesh::BuildzonePatchesMesh_Str(size_t zoneId)
+/**
+  * @brief save patches(bc) mesh of a zone for unstructured.
+  *
+  * @param[in] the zone mesh.
+  * @return 
+  * @author shiting
+  * @date 20220801
+  */
+void Mesh::BuildZonePatchesMesh_Str(size_t zoneId)
 {
     MeshBase *zonemesh = zoneMeshVec_.at(zoneId);
     MeshStructured *mesh = dynamic_cast<MeshStructured*>(zonemesh);
@@ -364,8 +283,8 @@ void Mesh::BuildzonePatchesMesh_Str(size_t zoneId)
         patchMap[*it] = patchMesh;
     }
     /*
-    save patches here.
-    */
+       save patches here.
+       */
 
     map<int, MeshBase*> savedPatchMap;
     for (map<int, MeshStructured*>::iterator it = patchMap.begin(); it != patchMap.end(); ++it)
@@ -374,3 +293,136 @@ void Mesh::BuildzonePatchesMesh_Str(size_t zoneId)
     }
     zonePatchesMap_[zoneId] = savedPatchMap;
 }
+
+/**
+  * @brief get zone name.
+  *
+  * @param[in]
+  * @return zoneName_
+  * @author zhaoyu
+  * @date 20221130
+  */
+vector<string> Mesh::GetZoneName()
+{
+    return zoneName_;
+}
+
+/**
+  * @brief get scalar number.
+  *
+  * @param[in]
+  * @return scalarNumber_
+  * @author zhaoyu
+  * @date 20221130
+  */
+size_t Mesh::GetScalarNumber()
+{
+    return scalarNumber_;
+}
+
+/**
+  * @brief get vector number.
+  *
+  * @param[in]
+  * @return vectorNumber_
+  * @author zhaoyu
+  * @date 20221130
+  */
+size_t Mesh::GetVectorNumber()
+{
+    return vectorNumber_;
+}
+
+/**
+  * @brief get scalar type.
+  *
+  * @param[in]
+  * @return zoneScalarType_
+  * @author zhaoyu
+  * @date 20221130
+  */
+vector<vector<int>> Mesh::GetZoneScalarType()
+{
+    return zoneScalarType_;
+}
+
+/**
+  * @brief get scalar names.
+  *
+  * @param[in]
+  * @return scalarName_
+  * @author zhaoyu
+  * @date 20221130
+  */
+vector<string> Mesh::GetScalarName()
+{
+    return scalarName_;
+}
+
+/**
+  * @brief get vector name.
+  *
+  * @param[in]
+  * @return vectorName_
+  * @author zhaoyu
+  * @date 20221130
+  */
+vector<string> Mesh::GetVectorName()
+{
+    return vectorName_;
+}
+
+/**
+  * @brief get scalars data.
+  *
+  * @param[in]
+  * @return ScalarData_
+  * @author zhaoyu
+  * @date 20221130
+  */
+vector<vector<double*>> Mesh::GetScalarData()
+{
+    return ScalarsData_;
+}
+
+/**
+  * @brief get scalar range.
+  *
+  * @param[in]
+  * @return zoneScalarRange_
+  * @author zhaoyu
+  * @date 20221130
+  */
+vector<vector<double*>> Mesh::GetScalarRange()
+{
+    return zoneScalarRange_;
+}
+
+/**
+  * @brief get scalar share vector.
+  *
+  * @param[in]
+  * @return zoneScalarShareVec_
+  * @author zhaoyu
+  * @date 20221130
+  */
+vector<vector<int>> Mesh::GetScalarShareVec()
+{
+    return zoneScalarShareVec_;
+}
+
+/**
+  * @brief get solve time.
+  *
+  * @param[in]
+  * @return solutionTime_
+  * @author zhaoyu
+  * @date 20221206
+  */
+double Mesh::GetSovleTime()
+{
+    return solutionTime_;
+}
+
+
+

+ 24 - 24
CAE_Solution/src/VTK/mesh/mesh.h

@@ -1,34 +1,33 @@
-#ifndef MESH_H
-#define MESH_H
+#ifndef MESHIO_H
+#define MESHIO_H
 
-#include <fstream>
 #include <vector>
+#include <string>
 #include <map>
 #include <set>
-#include <string>
-#include "points.h"
-#include "meshbase.h"
-#include "meshunstructured.h"
-#include "meshstructured.h"
 using namespace std;
 
-class Mesh
+
+
+class PointsDS;
+class MeshBase;
+
+class  Mesh
 {
 public:
     Mesh();
     virtual ~Mesh();
-
-    virtual bool Load_Ascii(const string &meshFile) = 0;//Pure virtual function
+    virtual bool Load_Ascii(const string &meshFile) = 0;
     virtual bool Load_Binary(const string &meshFile) = 0;
     virtual bool Save_Ascii(const string &meshFile) = 0;
     virtual bool Save_Binary(const string &meshFile) = 0;
 
-    //info functions
+    //info functions.
     size_t GetZoneNumber();
-    MeshBase*  GetZoneMesh(size_t zoneId);
+    MeshBase* GetZoneMesh(size_t zoneId);
     size_t GetZonePatchNumber(size_t zoneId);
     const set<int>* GetZonePatchTags(size_t zoneId);
-    MeshBase* GetZonePatchMesh(size_t zoneId,int patchTag);
+    MeshBase* GetZonePatchMesh(size_t zoneId, int patchTag);
 
     size_t GetScalarNumber();
     size_t GetVectorNumber();
@@ -42,20 +41,20 @@ public:
     double GetSovleTime();
 
 protected:
-    void BuildzonePatchesMesh();
+    void BuildZonePatchesMesh();
 private:
-    void BuildzonePatchesMesh_Uns(size_t zoneId);
-    void BuildzonePatchesMesh_Str(size_t zoneId);
+    void BuildZonePatchesMesh_Uns(size_t zoneId);
+    void BuildZonePatchesMesh_Str(size_t zoneId);
 
 protected:
     size_t zoneNumber_;
     double solutionTime_;
     char* title_;
-    vector <Points*> zonePointsVec_;
-    vector<MeshBase*> zoneMeshVec_;
-    //patch info
-    //<zoneid,<patchtag,mesh>>
-    map<size_t, map<int, MeshBase*>> zonePatchesMap_;
+    vector<PointsDS*>  zonePointsVec_;
+    vector<MeshBase*>  zoneMeshVec_;
+    //patch info.
+    //<zoneid, <patchtag, mesh>>. for structured patchtag can define to any value, for unstructured patchtag is the face tag.
+    map<size_t, map<int, MeshBase*> >  zonePatchesMap_;
 
     vector<string> scalarName_;
     vector<string> vectorName_;
@@ -65,7 +64,8 @@ protected:
     size_t scalarNumber_;
     size_t vectorNumber_;
     vector<vector<double*>> ScalarsData_;
-    vector<vector<int>> zoneScalarShareVec_;//-1 is unShare,0 is share
+    vector<vector<int>> zoneScalarShareVec_;//-1 is unShare, 0 is share
 };
 
-#endif // MESH_H
+
+#endif

+ 3 - 17
CAE_Solution/src/VTK/mesh/mesh.pri

@@ -1,20 +1,6 @@
 HEADERS += \
-    $$PWD/points.h \
-    $$PWD/mesh.h \
-    $$PWD/cells.h \
-    $$PWD/meshbase.h \
-    $$PWD/meshstructured.h \
-    $$PWD/meshunstructured.h \
-    $$PWD/mesh_adi.h \
-    $$PWD/mesh_ugrid.h \
-    $$PWD/mesh_tecplot.h
+    $$PWD/*.h 
+
 
 SOURCES += \
-    $$PWD/points.cpp \
-    $$PWD/mesh.cpp \
-    $$PWD/meshbase.cpp \
-    $$PWD/meshstructured.cpp \
-    $$PWD/meshunstructured.cpp \
-    $$PWD/mesh_adi.cpp \
-    $$PWD/mesh_ugrid.cpp \
-    $$PWD/mesh_tecplot.cpp
+    $$PWD/*.cpp

+ 65 - 43
CAE_Solution/src/VTK/mesh/mesh_adi.cpp

@@ -1,71 +1,93 @@
-#include "mesh_adi.h"
+#include <fstream>
+using namespace std;
+#include "Mesh_ADI.h"
 
 
-/*
-* @brief: the constructor
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230320
-* */
-Mesh_ADI::Mesh_ADI():Mesh()
-{
 
+/**
+  * @brief the constructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
+Mesh_ADI::Mesh_ADI() : Mesh()
+{
 }
 
-/*
-* @brief: the destructor
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230320
-* */
+/**
+  * @brief the destructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
 Mesh_ADI::~Mesh_ADI()
 {
 }
 
-/*
-* @brief: load ascii structured file
-* @param: file name
-* @ret: void
-* @birth: created by czm in 20230320
-* */
-bool Mesh_ADI::Load_Ascii(const string & meshFile)
+/**
+  * @brief load ascii structured file.
+  *
+  * @param[in] the input grid file.
+  * @return loading is successful or not.
+  * @author shiting
+  * @date 20220721
+  */
+bool Mesh_ADI::Load_Ascii(const string &meshFile)
 {
+    //predefine interface, load custmized structured grid.
     ifstream infile(meshFile);
     return true;
 }
 
-/*
-* @brief: load binary structured file
-* @param: file name
-* @ret: void
-* @birth: created by czm in 20230320
-* */
-bool Mesh_ADI::Load_Binary(const string & meshFile)
+/**
+  * @brief load binary structured file.
+  *
+  * @param[in] the input grid file.
+  * @return loading is successful or not.
+  * @author shiting
+  * @date 20220721
+  */
+bool Mesh_ADI::Load_Binary(const string &meshFile)
 {
+    //predefine interface, load custmized structured grid.
     ifstream infile(meshFile);
     return true;
 }
 
-/*
-* @brief: save ascii structured file
-* @param: file name
-* @ret: void
-* @birth: created by czm in 20230320
-* */
-bool Mesh_ADI::Save_Ascii(const string & meshFile)
+
+/**
+  * @brief save ascii structured file.
+  *
+  * @param[in] the output grid file.
+  * @return saving is successful or not.
+  * @author shiting
+  * @date 20220721
+  */
+bool Mesh_ADI::Save_Ascii(const string &meshFile)
 {
+    //predefine interface, save custmized structured grid.
     ofstream outfile(meshFile);
     return true;
 }
 
-/*
-* @brief: load binary structured file
-* @param: file name
-* @ret: void
-* @birth: created by czm in 20230320
-* */
-bool Mesh_ADI::Save_Binary(const string & meshFile)
+/**
+  * @brief save binary structured file.
+  *
+  * @param[in] the output grid file.
+  * @return saving is successful or not.
+  * @author shiting
+  * @date 20220721
+  */
+bool Mesh_ADI::Save_Binary(const string &meshFile)
 {
+    //predefine interface, save custmized structured grid.
     ofstream outfile(meshFile);
     return true;
 }
+
+
+

+ 8 - 3
CAE_Solution/src/VTK/mesh/mesh_adi.h

@@ -1,8 +1,11 @@
 #ifndef MESH_ADI_H
 #define MESH_ADI_H
 
-#include "mesh.h"
-class Mesh_ADI:public Mesh
+#include "Mesh.h"
+
+
+
+class  Mesh_ADI : public Mesh
 {
 public:
     Mesh_ADI();
@@ -13,4 +16,6 @@ public:
     virtual bool Save_Binary(const string &meshFile);
 };
 
-#endif // MESH_ADI_H
+
+
+#endif

+ 252 - 234
CAE_Solution/src/VTK/mesh/mesh_tecplot.cpp

@@ -1,100 +1,92 @@
-#include "mesh_tecplot.h"
 
+#include "PointDS.h"
+#include "MeshUnstructured.h"
+#include "Mesh_Tecplot.h"
 
-/*
-* @brief: the constructor
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230320
-* */
-Mesh_Tecplot::Mesh_Tecplot():Mesh()
-{
-}
-
-/*
-* @brief: the destructor
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230320
-* */
-Mesh_Tecplot::~Mesh_Tecplot()
-{
 
-}
 
-/*
-* @brief: load tecplot ascii file
-* @param: file name
-* @ret: bool
-* @birth: created by czm in 20230320
-* */
-bool Mesh_Tecplot::Load_Ascii(const string & gridFile)
+/**
+  * @brief the constructor.
+  *
+  * @param[in]
+  * @return
+  * @author zhaoyu
+  * @date 20221118
+  */
+Mesh_Tecplot::Mesh_Tecplot() : Mesh()
 {
-    ifstream infile(gridFile);
-    return true;
 }
 
-/*
-* @brief: load tecplot binary file
-* @param: file name
-* @ret: bool
-* @birth: created by czm in 20230320
-* */
-bool Mesh_Tecplot::Load_Binary(const string & gridFile)
+/**
+  * @brief the destructor.
+  *
+  * @param[in]
+  * @return
+  * @author zhaoyu
+  * @date 20221118
+  */
+Mesh_Tecplot::~Mesh_Tecplot()
 {
-    ifstream infile(gridFile);
-    return true;
 }
 
-/*
-* @brief: save ascii ugrid file
-* @param: file name
-* @ret: bool
-* @birth: created by czm in 20230320
-* */
-bool Mesh_Tecplot::Save_Ascii(const string & gridFile)
+/**
+  * @brief load tecplot ascii file.
+  *
+  * @param[in] the input tecplot file.
+  * @return loading is successful or not.
+  * @author zhaoyu
+  * @date 20221118
+  */
+bool Mesh_Tecplot::Load_Ascii(const string &gridFile)
 {
-    ofstream outfile(gridFile);
+    ifstream infile(gridFile);
+    //return Load_Tecp_Ascii(infile);
     return true;
 }
 
-/*
-* @brief: save binary ugrid file
-* @param: file name
-* @ret: bool
-* @birth: created by czm in 20230320
-* */
-bool Mesh_Tecplot::Save_Binary(const string & gridFile)
+/**
+  * @brief load tecplot binary file.
+  *
+  * @param[in] the input tecplot file.
+  * @return loading is successful or not.
+  * @author zhaoyu
+  * @date 20221118
+  */
+bool Mesh_Tecplot::Load_Binary(const string &gridFile)
 {
-    ofstream outfile(gridFile);
-    return true;
+    cout << gridFile << endl;
+  //  ifstream infile(gridFile);
+    ifstream infile;
+    infile.open(gridFile, ios::binary);
+    return Load_Tecp_Binary(infile);
 }
 
-
-/*
-* @brief: load tecp ascii input file
-* @param: scalar name
-* @ret: scalar name
-* @birth: created by czm in 20230321
-* */
-bool Mesh_Tecplot::Load_Tecp_Ascii(ifstream & infile)
+/**
+  * @brief load tecplot Ascii input file.
+  *
+  * @param[in] input file stream.
+  * @return the input file is good or bad.
+  * @author zhaoyu
+  * @date 20221118
+  */
+bool Mesh_Tecplot::Load_Tecp_Ascii(ifstream &infile)
 {
     return true;
 }
 
-
-/*
-* @brief: load tecp binary input file
-* @param: scalar name
-* @ret: scalar name
-* @birth: created by czm in 20230321
-* */
-bool Mesh_Tecplot::Load_Tecp_Binary(ifstream & infile)
+/**
+  * @brief load tecplot binary input file.
+  *
+  * @param[in] input file stream.
+  * @return the input file is good or bad.
+  * @author zhaoyu
+  * @date 20221118
+  */
+bool Mesh_Tecplot:: Load_Tecp_Binary(ifstream &infile)
 {
-
-    if (!infile.good())
+    if(!infile.good())
     {
-        cout << "Source Tecplot File is not found!" << endl;
+        cout<<"Source Tecplot File is not found!"<<endl;
         return false;
     }
     //cout << "************Header Section Begin*************" << endl;
@@ -102,7 +94,7 @@ bool Mesh_Tecplot::Load_Tecp_Binary(ifstream & infile)
     infile.read(&version[0], 8);
     if (!infile.good() || version.find_first_of("#!TDV") == string::npos)
     {
-        cout << "Invalid tecplot binary file!" << endl;
+        cout<<"Invalid tecplot binary file!"<<endl;
         return false;
     }
     //cout << "version:  " << version << endl;
@@ -113,7 +105,7 @@ bool Mesh_Tecplot::Load_Tecp_Binary(ifstream & infile)
     infile.read((char*)&fileType, sizeof(fileType));
     //cout << "file type:   " << fileType << "    (0:full  1:grid  2:solution)" << endl;
     //title
-    // cout << "title:  ";
+   // cout << "title:  ";
     int title_char = -1;
     vector<char> title;
     while (true)
@@ -218,17 +210,16 @@ bool Mesh_Tecplot::Load_Tecp_Binary(ifstream & infile)
             int *pdummy = new int[nvar];
             infile.read((char*)pdummy, sizeof(int)*nvar);
             vector<int> vec;
-            for (int i = 0; i < nvar; i++)
+            for (int i = 0; i < nvar; i ++)
             {
                 vec.push_back(pdummy[i]);
             }
             delete[] pdummy;
             zoneScalarType_.push_back(vec);
-        }
-        else if (specifyVarLocation == 0)
+        }else if (specifyVarLocation == 0)
         {
             vector<int> vec;
-            for (int i = 0; i < nvar; i++)
+            for (int i = 0; i < nvar; i ++)
             {
                 vec.push_back(0);
             }
@@ -270,16 +261,16 @@ bool Mesh_Tecplot::Load_Tecp_Binary(ifstream & infile)
             cout << "Find unsupported data type, abort!" << endl;  //other markers are not supported now.
             return false;
         }
-        // cout << "----------zone " << zone_index+1 << " data----------" << endl;
-        // cout << "zone marker(299):  " << zoneMarker << endl;
+       // cout << "----------zone " << zone_index+1 << " data----------" << endl;
+       // cout << "zone marker(299):  " << zoneMarker << endl;
         zoneVarDataFormat[zone_index] = new int[nvar];
-        // cout << "variable data format(1=float, 2=double, others aren't supported): ";
+       // cout << "variable data format(1=float, 2=double, others aren't supported): ";
         infile.read((char*)zoneVarDataFormat[zone_index], sizeof(int)*nvar);
         for (int i = 0; i < nvar; ++i)
         {
-            //    cout << zoneVarDataFormat[zone_index][i] << " ";
+        //    cout << zoneVarDataFormat[zone_index][i] << " ";
         }
-        // cout << endl;
+       // cout << endl;
         int hasPassiveVariables, hasVariableSharing, zoneNumber_ShareConnectivity;
         infile.read((char*)&hasPassiveVariables, sizeof(hasPassiveVariables));
         //cout << "has passive variables:  " << hasPassiveVariables << endl;
@@ -296,14 +287,14 @@ bool Mesh_Tecplot::Load_Tecp_Binary(ifstream & infile)
         if (hasVariableSharing != 0)
         {
             infile.read((char*)zoneShareVec[zone_index], sizeof(int)*nvar);
-            for (int i = 0; i < nvar; i++)
+            for (int i = 0; i < nvar; i ++)
             {
                 vec.push_back(zoneShareVec[zone_index][i]);
             }
         }
         else
         {
-            for (int i = 0; i < nvar; i++)
+            for (int i = 0; i < nvar; i ++)
             {
                 zoneShareVec[zone_index][i] = -1;//-1 is a unshape scalar
                 vec.push_back(-1);
@@ -320,8 +311,8 @@ bool Mesh_Tecplot::Load_Tecp_Binary(ifstream & infile)
         }
         infile.read((char*)&zoneNumber_ShareConnectivity, sizeof(zoneNumber_ShareConnectivity));
         //cout << "zone number to share connectivity:  " << zoneNumber_ShareConnectivity << endl;
-        double *varMinMaxPairs = new double[zoneUnShareVec.size() * 2];//every scalar range
-        infile.read((char*)varMinMaxPairs, sizeof(double)*zoneUnShareVec.size() * 2);
+        double *varMinMaxPairs = new double[zoneUnShareVec.size()*2];//every scalar range
+        infile.read((char*)varMinMaxPairs, sizeof(double)*zoneUnShareVec.size()*2);
         zoneScalarRange[zone_index] = new double*[nvar];
         vector<double*> range;
         int shareNum = 0;
@@ -330,12 +321,11 @@ bool Mesh_Tecplot::Load_Tecp_Binary(ifstream & infile)
             zoneScalarRange[zone_index][i] = new double[2];
             if (zoneShareVec[zone_index][i] == -1)
             {
-                zoneScalarRange[zone_index][i][0] = varMinMaxPairs[(i - shareNum) * 2];
-                zoneScalarRange[zone_index][i][1] = varMinMaxPairs[(i - shareNum) * 2 + 1];
-            }
-            else if (zoneShareVec[zone_index][i] == 0)
+                zoneScalarRange[zone_index][i][0] = varMinMaxPairs[(i-shareNum) * 2];
+                zoneScalarRange[zone_index][i][1] = varMinMaxPairs[(i-shareNum) * 2 + 1];
+            }else if (zoneShareVec[zone_index][i] == 0)
             {
-                shareNum++;
+                shareNum ++;
                 zoneScalarRange[zone_index][i][0] = zoneScalarRange[0][i][0];
                 zoneScalarRange[zone_index][i][1] = zoneScalarRange[0][i][1];
             }
@@ -375,8 +365,7 @@ bool Mesh_Tecplot::Load_Tecp_Binary(ifstream & infile)
                     }
                     else { /* dummy */ }
                 }
-            }
-            else    //cell scalar
+            }else    //cell scalar
             {
                 double* zoneVar = new double[ne];
                 if (zoneShareVec[zone_index][i] == -1)
@@ -407,35 +396,27 @@ bool Mesh_Tecplot::Load_Tecp_Binary(ifstream & infile)
         //element connectivity
         int ele_np;
         if (zoneType_Vec.at(zone_index) == 2)  //FETRIANGLE
-        {
-            ele_np = 3;
-        }
+        {ele_np = 3;}
         else if (zoneType_Vec.at(zone_index) == 3)  //FEQUADRILATERAL
-        {
-            ele_np = 4;
-        }
+        {ele_np = 4;}
         else if (zoneType_Vec.at(zone_index) == 4)  //FETETRAHEDRON
-        {
-            ele_np = 4;
-        }
+        {ele_np = 4;}
         else if (zoneType_Vec.at(zone_index) == 5)  //FEBRICK
-        {
-            ele_np = 8;
-        }
+        {ele_np = 8;}
         else  ele_np = 0;
         if (ele_np == 0)  return false;
         int idNum = zoneNE_Vec.at(zone_index)*ele_np;
         zoneEleConnectivity[zone_index] = new int[idNum];
-        infile.read((char*)zoneEleConnectivity[zone_index], idNum * 4);
+        infile.read((char*)zoneEleConnectivity[zone_index], idNum*4);
         /*cout << "the first ele's connectivity(zero based indices): ";
         for (int i = 0; i < ele_np; ++i)
         {
-        cout << zoneEleConnectivity[zone_index][i] << "  ";
+            cout << zoneEleConnectivity[zone_index][i] << "  ";
         }
         cout << endl << "the last  ele's connectivity(zero based indices): ";
         for (int i = idNum-ele_np; i < idNum; ++i)
         {
-        cout << zoneEleConnectivity[zone_index][i] << "  ";
+            cout << zoneEleConnectivity[zone_index][i] << "  ";
         }
         cout << endl << "--------------end---------------" << endl;*/
     }
@@ -451,17 +432,19 @@ bool Mesh_Tecplot::Load_Tecp_Binary(ifstream & infile)
     }
     delete[] zoneScalarRange;
     delete[] zoneEleConnectivity;
-    cout << "over" << endl;
+cout << "over" << endl;
     return true;
 }
 
-/*
-* @brief: refine scalar name
-* @param: scalar name
-* @ret: scalar name
-* @birth: created by czm in 20230321
-* */
-string Mesh_Tecplot::RefineScalarsName(const string & scalarsName)
+/**
+  * @brief refine scalar name.
+  *
+  * @param[in] scalar name.
+  * @return filter out "<...>" scalar name.
+  * @author zhaoyu
+  * @date 20221118
+  */
+string Mesh_Tecplot::RefineScalarsName(const string &scalarsName)
 {
     //<greek>r</greek> p <greek>t</greek> to r p t
     string s;
@@ -486,144 +469,179 @@ string Mesh_Tecplot::RefineScalarsName(const string & scalarsName)
     return s;
 }
 
-/*
-* @brief: save ascii ugrid file
-* @param: scalarName vector, zoneName vector, zoneType vector, zonePointNumber vector, zoneElementNumber vector,double scalarsData,EleConnectivity,scalarType
-* @ret: void
-* @birth: created by czm in 20230320
-* */
-void Mesh_Tecplot::SaveData_Binary(vector<int>& zoneType_Vec, vector<int>& zoneNP_Vec, vector<int>& zoneNE_Vec, int ** zoneEleConnectivity)
+/**
+  * @brief save ascii ugrid file.
+  *
+  * @param[in] scalarName vector, zoneName vector, zoneType vector, zonePointNumber vector, zoneElementNumber vector,double scalarsData,EleConnectivity,scalarType
+  * @return null
+  * @author zhaoyu
+  * @date 20221118
+  */
+void Mesh_Tecplot::SaveData_Binary(
+        vector<int> &zoneType_Vec,
+        vector<int> &zoneNP_Vec,
+        vector<int> &zoneNE_Vec,
+        int **zoneEleConnectivity
+        )
 {
     for (int blockIndex = 0; blockIndex < zoneNumber_; ++blockIndex)
     {
+        MeshUnstructured* unMesh = new MeshUnstructured;
 
+        int nvar = scalarNumber_ + 3;
+        int scalarNumber = scalarNumber_;
 
-    MeshUnstructured* unMesh = new MeshUnstructured;
-
-    int nvar = scalarNumber_ + 3;
-    int scalarNumber = scalarNumber_;
+        int pointNum = zoneNP_Vec.at(blockIndex);
+        int cellNum = zoneNE_Vec.at(blockIndex);
 
-    int pointNum = zoneNP_Vec.at(blockIndex);
-    int cellNum = zoneNE_Vec.at(blockIndex);
-
-    if (zoneScalarShareVec_[blockIndex][0] == -1 &&
-        zoneScalarShareVec_[blockIndex][1] == -1 &&
-        zoneScalarShareVec_[blockIndex][2] == -1)
-    {
-        Points *points = new Points;
-        points->SetPointNumber(pointNum);
-        for (int i = 0; i < pointNum; ++i)
+        if (zoneScalarShareVec_[blockIndex][0] == -1 &&
+                zoneScalarShareVec_[blockIndex][1] == -1 &&
+                zoneScalarShareVec_[blockIndex][2] == -1)
         {
-            points->SetPoint(i, ScalarsData_[blockIndex][0][i], ScalarsData_[blockIndex][1][i], ScalarsData_[blockIndex][2][i]);
+            PointsDS *points = new PointsDS;
+            points->SetPointNumber(pointNum);
+            for (int i = 0; i < pointNum; ++i)
+            {
+                points->SetPoint(i, ScalarsData_[blockIndex][0][i], ScalarsData_[blockIndex][1][i], ScalarsData_[blockIndex][2][i]);
+            }
+            zonePointsVec_.push_back(points);
+            unMesh->SetPoints(points);
+        }else
+        {
+            unMesh->SetPoints(zonePointsVec_[0]);
         }
-        zonePointsVec_.push_back(points);
-        unMesh->SetPoints(points);
-    }
-    else
-    {
-        unMesh->SetPoints(zonePointsVec_[0]);
-    }
 
-    CellBase* cell = 0;
-    unMesh->SetCellNumber(cellNum);
-    if (zoneType_Vec.at(blockIndex) == 2)  //FETRIANGLE
-    {
-        for (int i = 0; i < cellNum; ++i)
+        CellBase* cell = 0;
+        unMesh->SetCellNumber(cellNum);
+        if (zoneType_Vec.at(blockIndex) == 2)  //FETRIANGLE
         {
-            int start = i * 3;
-            if (zoneEleConnectivity[blockIndex][start] == zoneEleConnectivity[blockIndex][start + 1] &&
-                zoneEleConnectivity[blockIndex][start] == zoneEleConnectivity[blockIndex][start + 2])
+            for (int i = 0; i < cellNum; ++i)
             {
-                /////////point
-                //vtkIdList* list = vtkIdList::New();
-                //list->InsertNextId(zoneEleConnectivity[blockIndex][start]);
-                //uGrid_[blockIndex]->InsertNextCell(1, list);
-                //list->Delete();
-            }
-            else
-            {
-                cell = new CellTriangle;
-                cell->SetPoint(0, zoneEleConnectivity[blockIndex][start]);
-                cell->SetPoint(1, zoneEleConnectivity[blockIndex][start + 1]);
-                cell->SetPoint(2, zoneEleConnectivity[blockIndex][start + 2]);
-                unMesh->SetCell(i, cell);
+                int start = i * 3;
+                if (zoneEleConnectivity[blockIndex][start] == zoneEleConnectivity[blockIndex][start + 1] &&
+                    zoneEleConnectivity[blockIndex][start] == zoneEleConnectivity[blockIndex][start + 2])
+                {
+                    /////////point
+                    //vtkIdList* list = vtkIdList::New();
+                    //list->InsertNextId(zoneEleConnectivity[blockIndex][start]);
+                    //uGrid_[blockIndex]->InsertNextCell(1, list);
+                    //list->Delete();
+                }
+                else
+                {
+                    cell = new CellTriangle;
+                    cell->SetPoint(0,zoneEleConnectivity[blockIndex][start]);
+                    cell->SetPoint(1,zoneEleConnectivity[blockIndex][start+1]);
+                    cell->SetPoint(2,zoneEleConnectivity[blockIndex][start+2]);
+                    unMesh->SetCell(i,cell);
+                }
             }
         }
-    }
-    else if (zoneType_Vec.at(blockIndex) == 3) //FEQUADRILATERAL
-    {
-        for (int i = 0; i < cellNum; ++i)
+        else if (zoneType_Vec.at(blockIndex) == 3) //FEQUADRILATERAL
         {
-            int start = i * 4;
-            if (zoneEleConnectivity[blockIndex][start + 2] == zoneEleConnectivity[blockIndex][start + 3])
+            for (int i = 0; i < cellNum; ++i)
             {
-                cell = new CellTriangle;
-                cell->SetPoint(0, zoneEleConnectivity[blockIndex][start]);
-                cell->SetPoint(1, zoneEleConnectivity[blockIndex][start + 1]);
-                cell->SetPoint(2, zoneEleConnectivity[blockIndex][start + 2]);
-                unMesh->SetCell(i, cell);
-                delete cell;
+                int start = i * 4;
+                if (zoneEleConnectivity[blockIndex][start + 2] == zoneEleConnectivity[blockIndex][start + 3])
+                {
+                    cell = new CellTriangle;
+                    cell->SetPoint(0,zoneEleConnectivity[blockIndex][start]);
+                    cell->SetPoint(1,zoneEleConnectivity[blockIndex][start+1]);
+                    cell->SetPoint(2,zoneEleConnectivity[blockIndex][start+2]);
+                    unMesh->SetCell(i,cell);
+                    delete cell;
+                }
+                else
+                {
+                    cell = new CellQuad;
+                    cell->SetPoint(0,zoneEleConnectivity[blockIndex][start]);
+                    cell->SetPoint(1,zoneEleConnectivity[blockIndex][start+1]);
+                    cell->SetPoint(2,zoneEleConnectivity[blockIndex][start+2]);
+                    cell->SetPoint(3,zoneEleConnectivity[blockIndex][start+3]);
+                    unMesh->SetCell(i,cell);
+                    delete cell;
+                }
             }
-            else
+        }else if (zoneType_Vec.at(0) == 4)  //FETETRAHEDRON
+        {
+            for (int i = 0; i < cellNum; ++i)
             {
-                cell = new CellQuad;
-                cell->SetPoint(0, zoneEleConnectivity[blockIndex][start]);
-                cell->SetPoint(1, zoneEleConnectivity[blockIndex][start + 1]);
-                cell->SetPoint(2, zoneEleConnectivity[blockIndex][start + 2]);
-                cell->SetPoint(3, zoneEleConnectivity[blockIndex][start + 3]);
-                unMesh->SetCell(i, cell);
+                int start = i * 4;
+                cell = new CellTetra;
+                cell->SetPoint(0,zoneEleConnectivity[blockIndex][start]);
+                cell->SetPoint(1,zoneEleConnectivity[blockIndex][start+1]);
+                cell->SetPoint(2,zoneEleConnectivity[blockIndex][start+2]);
+                cell->SetPoint(3,zoneEleConnectivity[blockIndex][start+3]);
+                unMesh->SetCell(i,cell);
                 delete cell;
             }
         }
-    }
-    else if (zoneType_Vec.at(0) == 4)  //FETETRAHEDRON
-    {
-        for (int i = 0; i < cellNum; ++i)
-        {
-            int start = i * 4;
-            cell = new CellTetra;
-            cell->SetPoint(0, zoneEleConnectivity[blockIndex][start]);
-            cell->SetPoint(1, zoneEleConnectivity[blockIndex][start + 1]);
-            cell->SetPoint(2, zoneEleConnectivity[blockIndex][start + 2]);
-            cell->SetPoint(3, zoneEleConnectivity[blockIndex][start + 3]);
-            unMesh->SetCell(i, cell);
-            delete cell;
-        }
-    }
-    else if (zoneType_Vec.at(blockIndex) == 5)  //FEBRICK
-    {
-        for (int i = 0; i < cellNum; ++i)
+        else if (zoneType_Vec.at(blockIndex) == 5)  //FEBRICK
         {
-            int start = i * 8;
-            int *p = zoneEleConnectivity[0] + start;
-            int *r = std::unique(p, p + 8);//去重
-            int cell_NP = r - p;
-            if (cell_NP == 6)  //wedge cell need swap the 3rd and 5th point id.
-            {
-                int tmp = p[2];
-                p[2] = p[4];
-                p[4] = tmp;
-            }
-            switch (cell_NP)
+            for (int i = 0; i < cellNum; ++i)
             {
-            case 4:
-                cell = new CellTetra; break;
-            case 5:
-                cell = new CellPyramid; break;
-            case 6:
-                cell = new CellPrism; break;
-            case 8:
-                cell = new CellHexa; break;
-            }
+                int start = i * 8;
+                int *p = zoneEleConnectivity[0] + start;
+                int *r = std::unique(p, p + 8);//去重
+                int cell_NP = r - p;
+                if (cell_NP == 6)  //wedge cell need swap the 3rd and 5th point id.
+                {
+                    int tmp = p[2];
+                    p[2] = p[4];
+                    p[4] = tmp;
+                }
+                switch (cell_NP)
+                {
+                case 4:
+                    cell = new CellTetra; break;
+                case 5:
+                    cell = new CellPyramid; break;
+                case 6:
+                    cell = new CellPrism; break;
+                case 8:
+                    cell = new CellHexa; break;
+                }
 
-            for (int j = 0; j < cell_NP; ++j)
-            {
-                cell->SetPoint(j, zoneEleConnectivity[blockIndex][start + j]);
+                for (int j = 0; j < cell_NP; ++j)
+                {
+                    cell->SetPoint(j, zoneEleConnectivity[blockIndex][start + j]);
+                }
+                unMesh->SetCell(i,cell);
+                delete cell;
             }
-            unMesh->SetCell(i, cell);
-            delete cell;
-        }
-    }//cell
-    zoneMeshVec_.push_back(unMesh);
+        }//cell
+        zoneMeshVec_.push_back(unMesh);
+    }
+}
+
+/**
+  * @brief save ascii ugrid file.
+  *
+  * @param[in] the output grid file.
+  * @return saving is successful or not.
+  * @author zhaoyu
+  * @date 20221118
+  */
+bool Mesh_Tecplot::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 20221118
+  */
+bool Mesh_Tecplot::Save_Binary(const string &gridFile)
+{
+    //predefine interface.
+    ofstream outfile(gridFile);
+    return true;
 }
+
+

+ 16 - 10
CAE_Solution/src/VTK/mesh/mesh_tecplot.h

@@ -1,11 +1,16 @@
 #ifndef MESH_TECPLOT_H
 #define MESH_TECPLOT_H
-#include "mesh.h"
-#include <algorithm>
-#include <math.h>
+
+#include <fstream>
 #include <iostream>
+using namespace std;
+#include "Mesh.h"
+
+class vtkDoubleArray;
+
 
-class Mesh_Tecplot:public Mesh
+
+class  Mesh_Tecplot : public Mesh
 {
 public:
     Mesh_Tecplot();
@@ -23,11 +28,12 @@ private:
     string RefineScalarsName(const string &scalarsName);
 
     void SaveData_Binary(
-            vector<int> &zoneType_Vec,
-            vector<int> &zoneNP_Vec,
-            vector<int> &zoneNE_Vec,
-            int **zoneEleConnectivity
-            );
+        vector<int> &zoneType_Vec,
+        vector<int> &zoneNP_Vec,
+        vector<int> &zoneNE_Vec,
+        int **zoneEleConnectivity
+    );
 };
 
-#endif // MESH_TECPLOT_H
+
+#endif

+ 84 - 63
CAE_Solution/src/VTK/mesh/mesh_ugrid.cpp

@@ -1,87 +1,75 @@
-#include "mesh_ugrid.h"
+#include "PointDS.h"
+#include "MeshUnstructured.h"
+#include "Mesh_UGrid.h"
 
 
-/*
-* @brief: the constructor
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230320
-* */
-Mesh_UGrid::Mesh_UGrid():Mesh()
-{
 
+/**
+  * @brief the constructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
+Mesh_UGrid::Mesh_UGrid() : Mesh()
+{
 }
 
-/*
-* @brief: the destructor
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230320
-* */
+/**
+  * @brief the destructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
 Mesh_UGrid::~Mesh_UGrid()
 {
 }
 
-/*
-* @brief: load ugrid ascii File
-* @param: file name
-* @ret: void
-* @birth: created by czm in 20230320
-* */
-bool Mesh_UGrid::Load_Ascii(const string & gridFile)
+/**
+  * @brief load ugrid ascii file.
+  *
+  * @param[in] the input ugrid file.
+  * @return loading is successful or not.
+  * @author shiting
+  * @date 20220721
+  */
+bool Mesh_UGrid::Load_Ascii(const string &gridFile)
 {
     ifstream infile(gridFile);
     return Load_2DBlock_Ascii(infile);
 }
 
-/*
-* @brief: load ugrid binary File
-* @param: file name
-* @ret: void
-* @birth: created by czm in 20230320
-* */
-bool Mesh_UGrid::Load_Binary(const string & gridFile)
+/**
+  * @brief load ugrid binary file.
+  *
+  * @param[in] the input ugrid file.
+  * @return loading is successful or not.
+  * @author shiting
+  * @date 20220721
+  */
+bool Mesh_UGrid::Load_Binary(const string &gridFile)
 {
     ifstream infile(gridFile);
     return true;
 }
 
-/*
-* @brief: save ugrid ascii File
-* @param: file name
-* @ret: void
-* @birth: created by czm in 20230320
-* */
-bool Mesh_UGrid::Save_Ascii(const string & gridFile)
-{
-    ofstream outfile(gridFile);
-    return true;
-}
-
-/*
-* @brief: save ugrid binary File
-* @param: file name
-* @ret: void
-* @birth: created by czm in 20230320
-* */
-bool Mesh_UGrid::Save_Binary(const string & gridFile)
-{
-    ofstream outfile(gridFile);
-    return true;
-}
-
-/*
-* @brief: save ugrid binary File
-* @param: file name
-* @ret: void
-* @birth: created by czm in 20230320
-* */
-bool Mesh_UGrid::Load_2DBlock_Ascii(ifstream & infile)
+/**
+  * @brief load 2d data from input file.
+  *
+  * @param[in] input file stream.
+  * @return the input file is good or bad.
+  * @author shiting
+  * @date 20220721
+  */
+bool Mesh_UGrid::Load_2DBlock_Ascii(ifstream &infile)
 {
     int nPoint, nTri, nQuad, nTetra, nPyramid, nPrism, nHexa;
-    infile >> nPoint >> nTri >> nQuad >> nTetra >> nPyramid >> nPrism >> nHexa;
+    infile >> nPoint >> nTri >> nQuad >> nTetra >> nPyramid  >> nPrism >> nHexa;
     if (!infile.good())  return false;
-    Points *points = new Points;
+    PointsDS *points = new PointsDS;
 
     points->SetPointNumber(nPoint);
     double x, y, z;
@@ -156,6 +144,39 @@ bool Mesh_UGrid::Load_2DBlock_Ascii(ifstream & infile)
     zonePointsVec_.push_back(points);
     zoneMeshVec_.push_back(unMesh);
     zoneNumber_ = 1;
-    BuildzonePatchesMesh();
+    BuildZonePatchesMesh();
     return true;
 }
+
+/**
+  * @brief save ascii ugrid file.
+  *
+  * @param[in] the output grid file.
+  * @return saving is successful or not.
+  * @author shiting
+  * @date 20220721
+  */
+bool Mesh_UGrid::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 shiting
+  * @date 20220721
+  */
+bool Mesh_UGrid::Save_Binary(const string &gridFile)
+{
+    //predefine interface.
+    ofstream outfile(gridFile);
+    return true;
+}
+
+
+

+ 12 - 4
CAE_Solution/src/VTK/mesh/mesh_ugrid.h

@@ -1,9 +1,12 @@
 #ifndef MESH_UGRID_H
 #define MESH_UGRID_H
-#include "mesh.h"
-#include "points.h"
+#include <fstream>
+using namespace std;
+#include "Mesh.h"
 
-class Mesh_UGrid : public Mesh
+
+
+class  Mesh_UGrid : public Mesh
 {
 public:
     Mesh_UGrid();
@@ -14,6 +17,11 @@ public:
     virtual bool Save_Ascii(const string &gridFile);
     virtual bool Save_Binary(const string &gridFile);
     bool Load_2DBlock_Ascii(ifstream &infile);
+private:
+
 };
 
-#endif // MESH_UGRID_H
+
+
+#endif
+

+ 105 - 83
CAE_Solution/src/VTK/mesh/meshbase.cpp

@@ -1,121 +1,143 @@
-#include "meshbase.h"
+#include "MeshBase.h"
 
 
-/*
-*@brief: the constructor
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230315
-*/
+
+/**
+  * @brief the constructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
 MeshBase::MeshBase()
 {
-    this->meshType_ = MeshType::UnknownType;
-    this->meshPoints_ = NULL;
-    this->patchNumber_ = 0;
+    meshType_ = UnknowType;
+    meshPoints_ = 0;
+    patchNumber_ = 0;
 }
 
-/*
-*@brief: the destructor
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230315
-*/
+/**
+  * @brief the destructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
 MeshBase::~MeshBase()
 {
-    if (!this->patchTagsSet_.empty()) {
-        this->patchTagsSet_.clear();
+    if (!patchTagsSet_.empty())
+    {
+        patchTagsSet_.clear();
     }
 }
 
-/*
-*@brief: get the mesh type
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-MeshType MeshBase::GetMeshType()
+/**
+  * @brief get mesh type.
+  *
+  * @param[in] 
+  * @return the mesh type: Structured/Unstructured/Unknow.
+  * @author shiting
+  * @date 20220721
+  */
+MeshType MeshBase::GetType()
 {
-    return this->meshType_;
+    return meshType_;
 }
 
-/*
-*@brief: set the mesh type
-* @param: mesh type
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-void MeshBase::SetMeshType(MeshType type)
+/**
+  * @brief set mesh type.
+  *
+  * @param[in] the mesh type: Structured/Unstructured/Unknow.
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
+void MeshBase::SetType(MeshType type)
 {
-    this->meshType_ = type;
+    meshType_ = type;
 }
 
-/*
-*@brief: get the pointer of the points
-* @param: void
-* @ret: the pointer of the points
-* @birth: created by czm in 20230315
-*/
-Points * MeshBase::GetPoints()
+/**
+  * @brief get the mesh points.
+  *
+  * @param[in] 
+  * @return the mesh points.
+  * @author shiting
+  * @date 20220801
+  */
+PointsDS* MeshBase::GetPoints()
 {
-    return this->meshPoints_;
+    return meshPoints_;
 }
 
-/*
-*@brief: set the points by the pointer of the points
-* @param: pointer of the points
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-void MeshBase::SetPoints(Points * points)
+/**
+  * @brief set the mesh points.
+  *
+  * @param[in] the mesh points.
+  * @return 
+  * @author shiting
+  * @date 20220801
+  */
+void MeshBase::SetPoints(PointsDS *points)
 {
-    if (!points) return;
-    this->meshPoints_ = points;
+    meshPoints_ = points;
 }
 
-/*
-*@brief: get the point number(数量)
-* @param: void
-* @ret: the number of points
-* @birth: created by czm in 20230315
-*/
+/**
+  * @brief get point number of this mesh.
+  *
+  * @param[in]
+  * @return the point number.
+  * @author shiting
+  * @date 20220721
+  */
 size_t MeshBase::GetPointNumber()
 {
-    if (meshPoints_) return this->meshPoints_->GetPointNumber();
+    if (meshPoints_)  return meshPoints_->GetPointNumber();
     else return 0;
 }
 
-/*
-*@brief: get the patch number of the mesh
-* @param: void
-* @ret: the number of patch
-* @birth: created by czm in 20230315
-*/
+/**
+  * @brief get patch number of this mesh.
+  *
+  * @param[in]
+  * @return the patch number.
+  * @author shiting
+  * @date 20220721
+  */
 size_t MeshBase::GetPatchNumber()
 {
-    return this->patchNumber_;
+    return patchNumber_;
 }
 
+/**
+  * @brief update patch tag.
+  *
+  * @param[in] new patch tag.
+  * @return 
+  * @author shiting
+  * @date 20220802
+  */
+void MeshBase::InsertPatchTag(int tag)
+{
+    patchTagsSet_.insert(tag);
+    patchNumber_ = patchTagsSet_.size();
+}
 
-/*
-*@brief: get the patch list
-* @param: void
-* @ret: the pointer of the patch list
-* @birth: created by czm in 20230315
-*/
+/**
+  * @brief get patch tag list.
+  *
+  * @param[in] 
+  * @return patch tag list.
+  * @author shiting
+  * @date 20220801
+  */
 const set<int>* MeshBase::GetPatchTagsList()
 {
-    return &this->patchTagsSet_;
+    return &patchTagsSet_;
 }
 
 
-/*
-*@brief: insert a new tage into the set
-* @param: a new tag
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-void MeshBase::InsertPatchTag(int tag)
-{
-    this->patchTagsSet_.insert(tag);
-    ++this->patchNumber_;
-}
+

+ 23 - 15
CAE_Solution/src/VTK/mesh/meshbase.h

@@ -1,27 +1,34 @@
 #ifndef MESHBASE_H
 #define MESHBASE_H
-#include"points.h"
+
+#include <vector>
 #include <set>
+#include <string>
 using namespace std;
 
-enum MeshType {
-    UnknownType = -1,
+#include "PointDS.h"
+#include <vtkDoubleArray.h>
+
+
+
+enum MeshType
+{
+    UnknowType = -1,
     Structured,
     Unstructured
 };
 
-
-class MeshBase
+class  MeshBase
 {
 public:
     MeshBase();
     virtual ~MeshBase();
 
-    MeshType GetMeshType();
-    void SetMeshType(MeshType type);
+    MeshType GetType();
+    void SetType(MeshType type);
 
-    Points* GetPoints();
-    void SetPoints(Points* points);
+    PointsDS* GetPoints();
+    void SetPoints(PointsDS *points);
     size_t GetPointNumber();
 
     size_t GetPatchNumber();
@@ -31,11 +38,12 @@ protected:
     void InsertPatchTag(int tag);
 
 protected:
-    MeshType meshType_;
-    Points * meshPoints_;
-
-    size_t   patchNumber_;
-    set<int> patchTagsSet_;
+    MeshType  meshType_;
+    PointsDS  *meshPoints_;  //pass points by pointer. don't own the points object.
+    //mesh patch info.
+    size_t    patchNumber_;
+    set<int>  patchTagsSet_;
 };
 
-#endif // MESHBASE_H
+#endif
+

+ 27 - 20
CAE_Solution/src/VTK/mesh/meshstructured.cpp

@@ -1,27 +1,34 @@
-#include "meshstructured.h"
+#include "MeshStructured.h"
 
-/*
-*@brief: the constructor
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-MeshStructured::MeshStructured()
+
+
+/**
+  * @brief the constructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
+MeshStructured::MeshStructured() : MeshBase()
 {
-    this->meshType_ = MeshType::Structured;
-    this->ni_ = 0;
-    this->nj_ = 0;
-    this->nk_ = 0;
+    meshType_ = Structured;
+    ni_ = 0;
+    nj_ = 0;
+    nk_ = 0;
 }
 
-
-/*
-*@brief: the destructor
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230315
-*/
+/**
+  * @brief the destructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
 MeshStructured::~MeshStructured()
 {
-
 }
+
+
+

+ 8 - 4
CAE_Solution/src/VTK/mesh/meshstructured.h

@@ -1,17 +1,21 @@
 #ifndef MESHSTRUCTURED_H
 #define MESHSTRUCTURED_H
-#include "meshbase.h"
 
-class MeshStructured:public MeshBase
+#include "MeshBase.h"
+
+
+
+class  MeshStructured : public MeshBase
 {
 public:
     MeshStructured();
     virtual ~MeshStructured();
-
 protected:
     int ni_;
     int nj_;
     int nk_;
 };
 
-#endif // MESHSTRUCTURED_H
+
+
+#endif

+ 342 - 273
CAE_Solution/src/VTK/mesh/meshunstructured.cpp

@@ -1,283 +1,325 @@
-#include "meshunstructured.h"
+#include "CellDS.h"
+#include "MeshUnstructured.h"
 
 
-/*
-* @brief: the constructor
-* @param: void
-* @ret: void
-* @birth: created by czm in20230315
-*/
-MeshUnstructured::MeshUnstructured()
+
+/**
+  * @brief the constructor.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
+MeshUnstructured::MeshUnstructured() : MeshBase()
 {
-    meshType_ = MeshType::Unstructured;
-    this->nCell_ = 0;
-    this->nLine_ = 0;
-    this->nTri_ = 0;
-    this->nQuad_ = 0;
-    this->nTetra_ = 0;
-    this->nPyramid_ = 0;
-    this->nPrism_ = 0;
-    this->nHexa_ = 0;
+    meshType_ = Unstructured;
+    nCell_ = 0;
+    nLine_ = 0;
+    nTri_ = 0;
+    nQuad_ = 0;
+    nTetra_ = 0;
+    nPyramid_ = 0;
+    nPrism_ = 0;
+    nHexa_ = 0;
 }
 
-/*
-* @brief: the destructor
-* @param: void
-* @ret: void
-* @birth: created by czm in20230315
-*/
+/**
+  * @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);
+    for (vector<CellBase*>::iterator it = allCellsVec_.begin(); it != allCellsVec_.end(); ++it)
+    {
+        delete (*it);
     }
-    this->allCellsVec_.clear();
-    this->lineCellsVec_.clear();
-    this->triangleCellsVec_.clear();
-    this->quadCellsVec_.clear();
-    this->tetraCellsVec_.clear();
-    this->pyramidCellsVec_.clear();
-    this->prismCellsVec_.clear();
-    this->hexaCellsVec_.clear();
+    allCellsVec_.clear();
+    lineCellsVec_.clear();
+    triangleCellsVec_.clear();
+    quadCellsVec_.clear();
+    tetraCellsVec_.clear();
+    pyramidCellsVec_.clear();
+    prismCellsVec_.clear();
+    hexaCellsVec_.clear();
+    //
     DeallocateShellFaces();
 }
 
-/*
-* @brief: the number of cells
-* @param: void
-* @ret: number
-* @birth: created by czm in20230315
-*/
-size_t MeshUnstructured::GetCellNumber()
-{
-    return this->nCell_;
-}
-/*
-* @brief: set the vector size
-* @param: number
-* @ret: void
-* @birth: created by czm in20230315
-*/
+/**
+  * @brief get cell number in mesh.
+  *
+  * @param[in] 
+  * @return return cell number.
+  * @author shiting
+  * @date 20220721
+  */
 void MeshUnstructured::SetCellNumber(size_t num)
 {
-    this->allCellsVec_.resize(num,0);
+    allCellsVec_.resize(num, 0);
 }
 
-/*
-* @brief: update a cell
-* @param: cells' number and a cell
-* @ret: void
-* @birth: created by czm in20230315
-*/
-void MeshUnstructured::SetCell(size_t id, const CellBase * cell)
+/**
+  * @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->GetCellType();
-    CellBase* newCell = 0;
-    if (type == CellType::lineCell) {
-        newCell = new CellLine();
+    if (!cell)  return;
+    CellType type = cell->GetType();
+    CellBase *newCell = 0;
+    if (type == LineCell)
+    {
+        newCell = new CellLine;
         lineCellsVec_.push_back(newCell);
         ++nLine_;
     }
-    else if (type == CellType::TriangleCell)
+    else if (type == TriangleCell)
     {
-        newCell = new CellTriangle();
+        newCell = new CellTriangle;
         triangleCellsVec_.push_back(newCell);
         ++nTri_;
     }
-    else if (type == CellType::quadCell)
+    else if (type == QuadCell)
     {
-        newCell = new CellQuad();
+        newCell = new CellQuad;
         quadCellsVec_.push_back(newCell);
         ++nQuad_;
     }
-    else if (type == CellType::tetraCell)
+    else if (type == TetraCell)
     {
-        newCell = new CellTetra();
+        newCell = new CellTetra;
         tetraCellsVec_.push_back(newCell);
         ++nTetra_;
     }
-    else if (type == CellType::pyramidCell)
+    else if (type == PyramidCell)
     {
-        newCell = new CellPyramid();
+        newCell = new CellPyramid;
         pyramidCellsVec_.push_back(newCell);
         ++nPyramid_;
     }
-    else if (type == CellType::prismCell)
+    else if (type == PrismCell)
     {
-        newCell = new CellPrism();
+        newCell = new CellPrism;
         prismCellsVec_.push_back(newCell);
         ++nPrism_;
     }
-    else if (type == CellType::hexaCell)
+    else if (type == HexaCell)
     {
-        newCell = new CellHexa();
+        newCell = new CellHexa;
         hexaCellsVec_.push_back(newCell);
         ++nHexa_;
     }
     size_t np = cell->GetPointNumber();
-    for (int i = 0; i < np; ++i) {
-        newCell->SetPoint(i,cell->GetPoint(i));
+    for (size_t i = 0; i < np; ++i)
+    {
+        newCell->SetPoint(i, cell->GetPoint(i));
     }
     int tag = cell->GetTag();
-    if (tag != NULLTAG) {
+    if (tag != NULLTAG)
+    {
         newCell->SetTag(tag);
         InsertPatchTag(tag);
     }
-    if (id < allCellsVec_.size()) {
+    if (id < allCellsVec_.size()) //set cell.
+    {
         if (allCellsVec_[id]) delete allCellsVec_[id];
         allCellsVec_[id] = newCell;
     }
-    else
+    else  //append cell.
     {
         allCellsVec_.push_back(newCell);
-        ++nCell_;
     }
-    //++nCell_;
+    ++nCell_;
 }
 
-/*
-* @brief: append a cell into the vector
-* @param: a cell
-* @ret: void
-* @birth: created by czm in20230315
-*/
-void MeshUnstructured::AppendCell(const CellBase * cell)
+/**
+  * @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 by id
-* @param: the cell's id
-* @ret: void
-* @birth: created by czm in20230315
-*/
-const CellBase * MeshUnstructured::GetCell(size_t id)
+/**
+  * @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_[id];
+    if (id < allCellsVec_.size()) return allCellsVec_.at(id);
     return 0;
 }
 
-/*
-* @brief: get the number of lineCell
-* @param: void
-* @ret: number
-* @birth: created by czm in20230315
-*/
+/**
+  * @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 this->nLine_;
+    return nLine_;
 }
 
-/*
-* @brief: get the number of triangleCell
-* @param: void
-* @ret: number
-* @birth: created by czm in20230315
-*/
+/**
+  * @brief get triangle cell number in mesh.
+  *
+  * @param[in] 
+  * @return return triangle cell number.
+  * @author shiting
+  * @date 20220721
+  */
 size_t MeshUnstructured::GetTriangleNumber()
 {
-    return this->nTri_;
+    return nTri_;
 }
 
-/*
-* @brief: get the number of quadCell
-* @param: void
-* @ret: number
-* @birth: created by czm in20230315
-*/
+/**
+  * @brief get quad cell number in mesh.
+  *
+  * @param[in] 
+  * @return return quad cell number.
+  * @author shiting
+  * @date 20220721
+  */
 size_t MeshUnstructured::GetQuadNumber()
 {
-    return this->nQuad_;
+    return nQuad_;
 }
 
-/*
-* @brief: get the number of tetraCell
-* @param: void
-* @ret: number
-* @birth: created by czm in20230315
-*/
+/**
+  * @brief get tetra cell number in mesh.
+  *
+  * @param[in] 
+  * @return return tetra cell number.
+  * @author shiting
+  * @date 20220721
+  */
 size_t MeshUnstructured::GetTetraNumber()
 {
-    return this->nTetra_;
+    return nTetra_;
 }
 
-/*
-* @brief: get the number of pyramidCell
-* @param: void
-* @ret: number
-* @birth: created by czm in20230315
-*/
+/**
+  * @brief get pyramid cell number in mesh.
+  *
+  * @param[in] 
+  * @return return pyramid cell number.
+  * @author shiting
+  * @date 20220721
+  */
 size_t MeshUnstructured::GetPyramidNumber()
 {
-    return this->nPyramid_;
+    return nPyramid_;
 }
 
-/*
-* @brief: get the number of prismCell
-* @param: void
-* @ret: number
-* @birth: created by czm in20230315
-*/
+/**
+  * @brief get prism cell number in mesh.
+  *
+  * @param[in] 
+  * @return return prism cell number.
+  * @author shiting
+  * @date 20220721
+  */
 size_t MeshUnstructured::GetPrismNumber()
 {
-    return this->nPrism_;
+    return nPrism_;
 }
 
-/*
-* @brief: get the number of hexaCell
-* @param: void
-* @ret: number
-* @birth: created by czm in20230315
-*/
+/**
+  * @brief get hexa cell number in mesh.
+  *
+  * @param[in] 
+  * @return return hexa cell number.
+  * @author shiting
+  * @date 20220721
+  */
 size_t MeshUnstructured::GetHexaNumber()
 {
-    return this->nHexa_;
+    return nHexa_;
 }
 
-/*
-* @brief: set the tag of Cell by the id
-* @param: cell's id and its tag
-* @ret: void
-* @birth: created by czm in20230315
-*/
+/**
+  * @brief set cell tag.
+  *
+  * @param[in] cell id, tag.
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
 void MeshUnstructured::SetCellTag(size_t id, int tag)
 {
-    if (id >= this->nCell_)return;
-    allCellsVec_[id]->SetTag(tag);
+    if (id >= nCell_) return;
+    allCellsVec_.at(id)->SetTag(tag);
     InsertPatchTag(tag);
 }
 
-/*
-* @brief: get the cell's tag by id
-* @param: id
-* @ret: void
-* @birth: created by czm in20230315
-*/
+/**
+  * @brief get cell tag.
+  *
+  * @param[in] cell id
+  * @return cell tag.
+  * @author shiting
+  * @date 20220721
+  */
 int MeshUnstructured::GetCellTag(size_t id)
 {
-    if (id >= this->nCell_)return -999;
-    return allCellsVec_[id]->GetTag();
+    if (id >= nCell_) return -999;
+    return allCellsVec_.at(id)->GetTag();
 }
 
-/*
-* @brief: get the number of lineCell
-* @param: void
-* @ret: number
-* @birth: created by czm in20230315
-*/
+/**
+  * @brief allocate faces data for hoops shell display.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
 void MeshUnstructured::AllocateShellFaces()
 {
     size_t size = 0;
-    size += nLine_ * (1+2);//one number and two points
-    size += nTri_ * (1+3); //one number and three points
-    size += nQuad_ * (1+4);//one number and four points
-    size += nTetra_ * 4 *(1+3); //four faces and each face include one number and three points
-    size += nPyramid_*(4 * (1+3) + (1+4)); //four faces(each face include one number and three points) and one face(one number and four points)
-    size += nPrism_*((1+3)*2+3*(1+4)); //two faces(each face include one number and three points) and three faces(each face include one number and four points)
-    size += nHexa_*(6 * (1 + 4));
-    shellFacesVec_.resize(size);
+    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();
@@ -287,56 +329,66 @@ void MeshUnstructured::AllocateShellFaces()
     AllocatePrismCells();
     AllocateHexaCells();
 
-    shellFacesVec_.shrink_to_fit();
+    shellFacesVec_.shrink_to_fit();  /*c++11*/
 }
 
-/*
-* @brief: get hoops shell's list of this mesh
-* @param: the size of face list
-* @ret: the pointer of the facec list
-* @birth: created by czm in 20130316
-* */
-const int * MeshUnstructured::ShellFacesData(int & nface)
+/**
+  * @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();
+    return shellFacesVec_.data(); /*c++11*/
 }
 
-/*
-* @brief: deallocate hoops shell's list of this mesh
-* @param: void
-* @ret: void
-* @birth: created by czm in 20130316
-* */
+/**
+  * @brief deallocate faces data for hoops shell display.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
 void MeshUnstructured::DeallocateShellFaces()
 {
-    this->shellFacesVec_.clear();
+    shellFacesVec_.clear();
 }
 
-/*
-* @brief: allocate line cell for the hoops shell
-* @param: void
-* @ret: void
-* @birth: created by czm in 20130316
-* */
+/**
+  * @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++) {
+    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 the hoops shell
-* @param: void
-* @ret: void
-* @birth: created by czm in 20130316
-* */
+/**
+  * @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++) {
+    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));
@@ -344,15 +396,18 @@ void MeshUnstructured::AllocateTriangleCells()
     }
 }
 
-/*
-* @brief: allocate triangle cell for the hoops shell
-* @param: void
-* @ret: void
-* @birth: created by czm in 20130316
-* */
+/**
+  * @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++) {
+    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));
@@ -361,123 +416,132 @@ void MeshUnstructured::AllocateQuadCells()
     }
 }
 
-/*
-* @brief: allocate tetea cell for the hoops shell
-* @param: void
-* @ret: void
-* @birth: created by czm in 20130316
-* */
+/**
+  * @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++) {
+    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(p1);
         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(p0);
+        shellFacesVec_.push_back(p1);
         shellFacesVec_.push_back(p2);
         shellFacesVec_.push_back(p3);
-
+        //face4
         shellFacesVec_.push_back(3);
-        shellFacesVec_.push_back(p1);
-        shellFacesVec_.push_back(p2);
+        shellFacesVec_.push_back(p0);
         shellFacesVec_.push_back(p3);
+        shellFacesVec_.push_back(p2);
     }
 }
 
-/*
-* @brief: allocate pyramid cell for the hoops shell
-* @param: void
-* @ret: void
-* @birth: created by czm in 20130316
-* */
+/**
+  * @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++) {
+    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(p1);
-        shellFacesVec_.push_back(p2);
         shellFacesVec_.push_back(p3);
-
-        shellFacesVec_.push_back(3);
-        shellFacesVec_.push_back(p4);
+        shellFacesVec_.push_back(p2);
         shellFacesVec_.push_back(p1);
-        shellFacesVec_.push_back(p0);
-
+        //face2
         shellFacesVec_.push_back(3);
-        shellFacesVec_.push_back(p4);
-        shellFacesVec_.push_back(p2);
+        shellFacesVec_.push_back(p0);
         shellFacesVec_.push_back(p1);
-
+        shellFacesVec_.push_back(p4);
+        //face3
         shellFacesVec_.push_back(3);
-        shellFacesVec_.push_back(p3);
+        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 the hoops shell
-* @param: void
-* @ret: void
-* @birth: created by czm in 20130316
-* */
+/**
+  * @brief allocate prism cell for hoops shell.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
 void MeshUnstructured::AllocatePrismCells()
 {
-    for (vector<CellBase*>::iterator it = triangleCellsVec_.begin(); it != triangleCellsVec_.end(); it++) {
+    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);
@@ -486,16 +550,18 @@ void MeshUnstructured::AllocatePrismCells()
     }
 }
 
-/*
-* @brief: allocate hexa cell for the hoops shell
-* @param: void
-* @ret: void
-* @birth: created by czm in 20130316
-* */
+/**
+  * @brief allocate haxa cell for hoops shell.
+  *
+  * @param[in] 
+  * @return 
+  * @author shiting
+  * @date 20220721
+  */
 void MeshUnstructured::AllocateHexaCells()
 {
-    for (vector<CellBase*>::iterator it = triangleCellsVec_.begin(); it != triangleCellsVec_.end(); it++) {
-
+    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);
@@ -504,37 +570,37 @@ void MeshUnstructured::AllocateHexaCells()
         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);
@@ -542,3 +608,6 @@ void MeshUnstructured::AllocateHexaCells()
         shellFacesVec_.push_back(p6);
     }
 }
+
+
+

+ 18 - 12
CAE_Solution/src/VTK/mesh/meshunstructured.h

@@ -1,11 +1,16 @@
 #ifndef MESHUNSTRUCTURED_H
 #define MESHUNSTRUCTURED_H
-#include "meshbase.h"
-#include "cells.h"
+
 #include <vector>
+#include <set>
 using namespace std;
 
-class MeshUnstructured : public MeshBase
+#include "CellDS.h"
+#include "MeshBase.h"
+
+
+
+class  MeshUnstructured : public MeshBase
 {
 public:
     MeshUnstructured();
@@ -13,8 +18,8 @@ public:
 
     size_t GetCellNumber();
     void SetCellNumber(size_t num);
-    void SetCell(size_t id,const CellBase* cell);
-    void AppendCell(const CellBase* cell);
+    void SetCell(size_t id, const CellBase *cell);
+    void AppendCell(const CellBase *cell);
     const CellBase* GetCell(size_t id);
     size_t GetLineNumber();
     size_t GetTriangleNumber();
@@ -23,14 +28,14 @@ public:
     size_t GetPyramidNumber();
     size_t GetPrismNumber();
     size_t GetHexaNumber();
-    void SetCellTag(size_t id ,int tag);
+    void SetCellTag(size_t id, int tag);
     int GetCellTag(size_t id);
 
-    //faces info for hoops shell
+    //faces info for hoops shell.
     void AllocateShellFaces();
     const int* ShellFacesData(int &nface);
     void DeallocateShellFaces();
-
+    //
 private:
     void AllocateLineCells();
     void AllocateTriangleCells();
@@ -49,7 +54,6 @@ protected:
     size_t nPyramid_;
     size_t nPrism_;
     size_t nHexa_;
-
     vector<CellBase*> allCellsVec_;
     vector<CellBase*> lineCellsVec_;
     vector<CellBase*> triangleCellsVec_;
@@ -58,8 +62,10 @@ protected:
     vector<CellBase*> pyramidCellsVec_;
     vector<CellBase*> prismCellsVec_;
     vector<CellBase*> hexaCellsVec_;
-    //hoops shell faces list
-    vector<int> shellFacesVec_;
+    //hoops shell facees list.
+    vector<int>       shellFacesVec_;
 };
 
-#endif // MESHUNSTRUCTURED_H
+
+#endif
+

+ 0 - 168
CAE_Solution/src/VTK/mesh/points.cpp

@@ -1,168 +0,0 @@
-#include "points.h"
-
-/*
-* @brief: the constructor
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-Points::Points()
-{
-    this->nPoint_ = 0;
-}
-
-/*
-* @brief: the destructor
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-Points::~Points()
-{
-}
-
-/*
-* @brief: get the point number
-* @param: void
-* @ret: the point number
-* @birth: created by czm in 20230315
-*/
-size_t Points::GetPointNumber()
-{
-    return this->nPoint_;
-}
-
-/*
-* @brief: set the point number
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-void Points::SetPointNumber(int np)
-{
-    if (np < 0)return;
-    this->nPoint_ = np;
-    pointsvec_.resize(np);
-}
-
-/*
-* @brief: get point by id
-* @param: Xyz is the parameter of the point found by id
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-void Points::GetPoint(size_t id, double * x, double * y, double * z)
-{
-    if (!x || !y || !z)return;
-    GetPoint(id, *x, *y, *z);
-}
-
-/*
-* @brief: get point by id
-* @param: Xyz is the parameter of the point found by id
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-void Points::GetPoint(size_t id, double & x, double & y, double & z)
-{
-    if (id >= nPoint_) return;
-    x = pointsvec_[id].x;
-    y = pointsvec_[id].y;
-    z = pointsvec_[id].z;
-}
-
-/*
-* @brief: get point by id
-* @param: Xyz is the parameter of the point found by id
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-void Points::GetPoint(size_t id, double * xyz)
-{
-    if (!xyz)return;
-    GetPoint(id,xyz[0],xyz[1],xyz[2]);
-}
-
-/*
-* @brief: find point by id and set its xyz
-* @param: Xyz is the parameter of the point
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-void Points::SetPoint(size_t id, double x, double y, double z)
-{
-    if (id < 0 || id >= nPoint_)return;
-    pointsvec_[id] = Point(x, y, z);
-}
-
-/*
-* @brief: find point by id and set its xyz
-* @param: Xyz is the parameter of the point
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-void Points::SetPoint(size_t id, double * xyz)
-{
-    if (!xyz)return;
-    SetPoint(id, xyz[0], xyz[1], xyz[2]);
-}
-
-/*
-* @brief: find point by id and set its x
-* @param: x the param which needed to set the point
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-void Points::SetPoint_CoordX(size_t id, double x)
-{
-    if (id >= this->nPoint_) return;
-    pointsvec_[id].x = x;
-}
-
-/*
-* @brief: find point by id and set its y
-* @param: y the param which needed to set the point
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-void Points::SetPoint_CoordY(size_t id, double y)
-{
-    if (id >= this->nPoint_) return;
-    pointsvec_[id].y = y;
-}
-
-/*
-* @brief: find point by id and set its z
-* @param: z the param which needed to set the point
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-void Points::SetPoint_CoordZ(size_t id, double z)
-{
-    if (id >= this->nPoint_)return;
-    pointsvec_[id].z = z;
-}
-
-/*
-* @brief: add a point into the vector
-* @param:  the point's param xyz
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-void Points::AppendPoint(double x, double y, double z)
-{
-    pointsvec_.push_back(Point(x, y, z));
-    ++this->nPoint_;
-}
-
-/*
-* @brief: add a point into the vector
-* @param:  the point's param xyz ' pointer
-* @ret: void
-* @birth: created by czm in 20230315
-*/
-void Points::AppendPoint(double * xyz)
-{
-    AppendPoint(xyz[0], xyz[1], xyz[2]);
-}
-

+ 0 - 63
CAE_Solution/src/VTK/mesh/points.h

@@ -1,63 +0,0 @@
-#ifndef POINTS_H
-#define POINTS_H
-#include <vector>
-
-using namespace std;
-
-struct Point {
-    double x, y, z;
-    Point()
-    {
-        this->x = 0.0;
-        this->y = 0.0;
-        this->z = 0.0;
-    }
-    Point(double x, double y, double z)
-    {
-        this->x = x;
-        this->y = y;
-        this->z = z;
-    }
-    Point(const Point& p)
-    {
-        this->x = p.x;
-        this->y = p.y;
-        this->z = p.z;
-    }
-    Point &operator=(const Point& p)
-    {
-        this->x = p.x;
-        this->y = p.y;
-        this->z = p.z;
-        return *this;
-    }
-};
-
-class Points
-{
-public:
-    Points();
-    virtual ~Points();
-
-    size_t GetPointNumber();
-    void SetPointNumber(int np);
-    void GetPoint(size_t id, double *x, double *y, double *z);
-    void GetPoint(size_t id,double &x,double &y,double &z);
-    void GetPoint(size_t id, double *xyz);
-    void SetPoint(size_t id, double x, double y, double z);
-    void SetPoint(size_t id, double* xyz);
-    void SetPoint_CoordX(size_t id, double x);
-    void SetPoint_CoordY(size_t id, double y);
-    void SetPoint_CoordZ(size_t id, double z);
-    void AppendPoint(double x, double y, double z);
-    void AppendPoint(double* xyz);
-    const Point* Data() {
-        return pointsvec_.data();
-    }
-
-protected:
-    size_t nPoint_;//point number
-    vector<Point> pointsvec_;
-};
-
-#endif // POINTS_H

+ 0 - 243
CAE_Solution/src/VTK/visualization_VTK/loadxyplotdata.cpp

@@ -1,243 +0,0 @@
-#include "loadxyplotdata.h"
-
-/*
- * @brief: the constructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230322
- */
-LoadXYPlotData::LoadXYPlotData()
-{
-    this->step = 0;
-    this->title.clear();
-    this->nameDataMap.clear();
-    this->nameVec.clear();
-}
-
-/*
- * @brief: the destructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230322
- */
-LoadXYPlotData::~LoadXYPlotData()
-{
-    Clear();
-}
-
-/*
- * @brief: clear all data
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230322
- */
-void LoadXYPlotData::Clear()
-{
-    if(!this->nameDataMap.empty()){
-        for(auto it = nameDataMap.begin();it!=nameDataMap.end();it++){
-            it->second->RemoveAllObservers();
-        }
-    }
-    this->nameDataMap.clear();
-    this->nameVec.clear();
-}
-
-/*
- * @brief: analysis curve from file.
- * @param: void
- * @ret: bool
- * @birth: created by czm in 20230322
- */
-bool LoadXYPlotData::LoadData(char *fileName)
-{
-    bool flag = false;
-    string str = fileName;
-    string suffixStr = str.substr(str.find_last_of(".")+1);
-    if(suffixStr =="tec"){
-        flag = LoadTecplotData(fileName);
-    }else if(suffixStr == "plt"){
-        flag = LoadTecplotBinary(fileName);
-    }else if(suffixStr == "hist"){
-        flag = LoadHistData(fileName);
-    }else {
-    }
-    return flag;
-}
-
-/*
- * @brief: load curve from tecplot file.
- * @param: void
- * @ret: bool
- * @birth: created by czm in 20230322
- */
-bool LoadXYPlotData::LoadTecplotData(char *fileName)
-{
-    //Q_UNUSED(fileName);
-    return true;
-}
-
-/*
- * @brief: load curve from Tecplot Binary file.
- * @param: void
- * @ret: bool
- * @birth: created by czm in 20230322
- */
-bool LoadXYPlotData::LoadTecplotBinary(char *fileName)
-{
-    return true;
-}
-
-/*
- * @brief: load curve from hist file
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230322
- */
-bool LoadXYPlotData::LoadHistData(char *fileName)
-{
-    Clear();
-    ifstream ff;
-    ff.open(fileName, ios::in);
-    if (!ff.good())
-    {
-        cout << "File is not found" << endl;
-        return false;
-    }
-    string line;
-    line.clear();
-
-    while(line.empty())
-    {
-        getline(ff, line);// get title
-    }
-
-    int pos1 = line.find("\"");
-    int pos2 = line.find_last_of("\"");
-    title = line.substr(pos1+1, pos2-pos1-1);
-    //cout << title<< endl;
-
-    getline(ff, line);// get variableName
-    while(line.empty())
-    {
-        getline(ff, line);// get title
-    }
-    //cout << line<< endl;
-    int pos = 0;
-    int total = 0;
-
-    while (pos != line.find_last_of("\""))
-    {
-        int p1 = line.find("\"", pos+1);
-        pos = line.find("\"", p1+1);
-        string name = line.substr(p1 + 1, pos - p1 - 1);
-        //cout << name << endl;
-        nameVec.push_back(name);
-        total ++;
-    }
-
-    getline(ff, line);//get step and type
-    while(line.empty())
-    {
-        getline(ff, line);// get title
-    }
-    int ppos = line.find(" I=");
-    string str = line.substr(ppos +3, line.find(" ", ppos)-1);
-    step = atoi(str.c_str());
-    //cout << step << endl;
-    ppos = line.find(" F=");
-    type = line.substr(ppos +3, line.find(" ", ppos)-1);
-    //cout << type << endl;
-
-    //    vector<vector<double>> doubleVec;
-    //    for (int i = 0; i < nameVec.size(); i ++)
-    //    {
-    //        vector<double> vec;
-    //        doubleVec.push_back(vec);
-    //    }
-
-    vtkDoubleArray** doubleArray = new vtkDoubleArray*[nameVec.size()];
-    for (int i = 0; i < nameVec.size(); i ++)
-    {
-        doubleArray[i] = vtkDoubleArray::New();
-        doubleArray[i]->SetNumberOfValues(step);
-    }
-    double value;
-    std::stringstream stream;
-    set<double> set1;
-    int index = 0;
-    while (getline(ff,line))
-    {
-        if (line.empty())
-            continue;
-
-        stream.clear();
-        stream.str(line);
-
-        int j = 0;
-        while (stream >> value)
-        {
-            //doubleVec.at(j).push_back(value);
-            doubleArray[j]->SetValue(index, value);
-            j ++;
-        }
-        index ++;
-    }
-
-    //    for(int i = 0; i< doubleVec.size(); i ++)
-    //    {
-    //        nameDataMap[nameVec.at(i)] = doubleVec.at(i);
-    //    }
-
-    for (int i = 0; i < nameVec.size(); i ++)
-    {
-        nameDataMap[nameVec.at(i)] = doubleArray[i];
-    }
-
-    ff.close();
-    return true;
-}
-
-/*
- * @brief: get namedatamap
- * @param: void
- * @ret: map
- * @birth: created by czm in 20230322
- */
-map<string, vtkDoubleArray *> LoadXYPlotData::GetNameDataMap()
-{
-    return this->nameDataMap;
-}
-
-/*
- * @brief: get namevec(except first name,because first name is x asix name)
- * @param: void
- * @ret: vector
- * @birth: created by czm in 20230322
- */
-vector<string> LoadXYPlotData::GetYNameVec()
-{
-    if(this->nameVec.empty())return nameVec;
-    else {
-        vector<string> vec;
-        for(int i=1;i<nameVec.size();i++){
-            vec.push_back(nameVec.at(i));
-        }
-        return vec;
-    }
-
-}
-
-/*
- * @brief: get x asix name
- * @param: void
- * @ret: name
- * @birth: created by czm in 20230322
- */
-string LoadXYPlotData::GetXName()
-{
-    string name;
-    name.clear();
-    if(!this->nameVec.empty())
-        name = nameVec.at(0);
-    return name;
-}

+ 0 - 36
CAE_Solution/src/VTK/visualization_VTK/loadxyplotdata.h

@@ -1,36 +0,0 @@
-#ifndef LOADXYPLOTDATA_H
-#define LOADXYPLOTDATA_H
-
-#include <iostream>
-#include <string>
-#include <vector>
-#include <map>
-#include <set>
-#include <sstream>
-#include <vtkDoubleArray.h>
-using namespace std;
-
-class LoadXYPlotData
-{
-public:
-    LoadXYPlotData();
-    ~LoadXYPlotData();
-
-    void Clear();
-    bool LoadData(char* fileName);
-    bool LoadTecplotData(char* fileName);
-    bool LoadTecplotBinary(char* fileName);
-    bool LoadHistData(char* fileName);
-    map<string, vtkDoubleArray*> GetNameDataMap();
-    vector<string> GetYNameVec();
-    string GetXName();
-
-private:
-    string title;
-    int step;
-    vector<string> nameVec;
-    map<string,vtkDoubleArray*> nameDataMap;
-    string type;
-};
-
-#endif // LOADXYPLOTDATA_H

+ 2 - 26
CAE_Solution/src/VTK/visualization_VTK/visualization_VTK.pri

@@ -1,31 +1,7 @@
 HEADERS += \
      $$PWD/*.h
-#    $$PWD/loadxyplotdata.h \
-#    $$PWD/vtkvisunglyph.h \
-#    $$PWD/vtkvisunstructuredgridmanager.h \
-#    $$PWD/vtkvisunstructuredgridsource.h \
-#    $$PWD/vtkvisunshademesh.h \
-#    $$PWD/vtkvismeshbasetovtksource.h \
-#    $$PWD/vtkvismeshtovtksource.h \
-#    $$PWD/vtkvisaddungriddatasource.h \
-#    $$PWD/vtkvisunslice.h \
-#    $$PWD/vtkviscapturefigure.h \
-#    $$PWD/vtkvisuncontour.h \
-#    $$PWD/vtkvisxyplot.h \
-#    $$PWD/vtkxyplotvis.h
+
 
 SOURCES += \
      $$PWD/*.cpp
-#    $$PWD/loadxyplotdata.cpp \
-#    $$PWD/vtkvisunglyph.cpp \
-#    $$PWD/vtkvisunstructuredgridmanager.cpp \
-#    $$PWD/vtkvisunstructuredgridsource.cpp \
-#    $$PWD/vtkvisunshademesh.cpp \
-#    $$PWD/vtkvismeshbasetovtksource.cpp \
-#    $$PWD/vtkvismeshtovtksource.cpp \
-#    $$PWD/vtkvisaddungriddatasource.cpp \
-#    $$PWD/vtkvisunslice.cpp \
-#    $$PWD/vtkviscapturefigure.cpp \
-#    $$PWD/vtkvisuncontour.cpp \
-#    $$PWD/vtkvisxyplot.cpp \
-#    $$PWD/vtkxyplotvis.cpp
+

+ 0 - 168
CAE_Solution/src/VTK/visualization_VTK/vtkvisaddungriddatasource.cpp

@@ -1,168 +0,0 @@
-#include "vtkvisaddungriddatasource.h"
-#include <algorithm>
-#include <vtkDoubleArray.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkPointData.h>
-#include <vtkCellData.h>
-#include <vtkProperty.h>
-#include <vtkObject.h>
-#include <vtkObjectFactory.h>
-#include "vtkvisunstructuredgridsource.h"
-
-//vtkStandardNewMacro(vtkVISAddUnGridDataSource)
-/*
- * @brief: the constructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230324
- */
-vtkVISAddUnGridDataSource::vtkVISAddUnGridDataSource()
-{
-    unGridNumber_ = 0;
-    source_ = NULL;
-}
-
-/*
- * @brief: the destructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230324
- */
-vtkVISAddUnGridDataSource::~vtkVISAddUnGridDataSource()
-{
-    source_->Delete();
-}
-
-/*
- * @brief: set visunGridDataSource(设置vis非结构化源数据)
- * @param: vector
- * @ret: void
- * @birth: created by czm in 20230324
- */
-void vtkVISAddUnGridDataSource::SetVISUnGridDataSource(vector<vtkVISUnstructuredGridSource*> vec)
-{
-    if(vec.size() <=0)
-    {
-        return;
-    }
-    unGridNumber_ = vec.size();
-
-    source_ = vtkVISUnstructuredGridSource::New();
-    CreatUnGridGeomtry(vec);
-    AllocationSpace(vec);
-    CreatUnGridScaleSource(vec);
-}
-
-/*
- * @brief: creat unGrid Geomtry(创建unGrid几何图形)
- * @param: vector
- * @ret: void
- * @birth: created by czm in 20230324
- */
-void vtkVISAddUnGridDataSource::CreatUnGridGeomtry(vector<vtkVISUnstructuredGridSource*> vec)
-{
-    vtkAppendFilter* append = vtkAppendFilter::New();
-    for (int i = 0; i < unGridNumber_; i ++)
-    {
-        //vtkUnstructuredGrid* grid = vtkUnstructuredGrid::New();
-        //grid->DeepCopy();
-        append->AddInputData(vec.at(i)->unstruGrid);
-    }
-    append->Update();
-    source_->unstruGrid = vtkUnstructuredGrid::New();
-    source_->unstruGrid->DeepCopy(append->GetOutput());
-    append->Delete();
-}
-
-/*
- * @brief: Allocation Space(分配空间)
- * @param: vector
- * @ret: void
- * @birth: created by czm in 20230324
- */
-void vtkVISAddUnGridDataSource::AllocationSpace(vector<vtkVISUnstructuredGridSource*> vec)
-{
-    source_->scalarNumber_ = vec.at(0)->scalarNumber_;
-    source_->scalarRange = new double*[source_->scalarNumber_];
-    source_->scalarName = new const char*[source_->scalarNumber_];
-    source_->scalarSource = new vtkDoubleArray*[source_->scalarNumber_];
-    source_->cellScalarSource_ = new vtkDoubleArray*[source_->scalarNumber_];
-    for (int i = 0; i < source_->scalarNumber_; i ++)
-    {
-        source_->scalarSource[i] = vtkDoubleArray::New();
-        source_->cellScalarSource_[i] = vtkDoubleArray::New();
-    }
-}
-
-/*
- * @brief: Creat UnGrid Scale Source(创造非结构化网格标量源)
- * @param: vector
- * @ret: void
- * @birth: created by czm in 20230324
- */
-void vtkVISAddUnGridDataSource::CreatUnGridScaleSource(vector<vtkVISUnstructuredGridSource*> vec)
-{
-    bool flag = true;
-    int pointNum = source_->unstruGrid->GetNumberOfPoints();
-    int cellNum = source_->unstruGrid->GetNumberOfCells();
-    for (int i = 0; i < source_->scalarNumber_; i ++)
-    {
-        int id = 0;
-        //set scalar name
-        source_->scalarName[i] = vec.at(0)->GetScalarName(i);
-        cout << source_->scalarName[i] << endl;
-        if (vec.at(0)->scalarSource[i]->GetDataSize() != 0)
-        {
-            source_->scalarSource[i]->SetNumberOfValues(pointNum);
-            flag = true;
-        }else if (vec.at(0)->scalarSource[i]->GetDataSize() != 0)
-        {
-            source_->cellScalarSource_[i]->SetNumberOfValues(cellNum);
-            flag = false;
-        }else
-        {
-            return;
-        }
-        // set scalar source
-        for (int j = 0; j < vec.size(); j ++)
-        {
-            if (flag)
-            {
-                for (int k = 0; k < vec.at(j)->scalarSource[i]->GetDataSize(); k ++)
-                {
-                    source_->scalarSource[i]->SetValue(id, vec.at(j)->scalarSource[i]->GetValue(k));
-                    id ++;
-                }
-            }else
-            {
-                for (int k = 0; k < vec.at(j)->cellScalarSource_[i]->GetDataSize(); k ++)
-                {
-                    source_->cellScalarSource_[i]->SetValue(id, vec.at(j)->scalarSource[i]->GetValue(k));
-                    id ++;
-                }
-            }
-        }
-        //set scalar range
-        source_->scalarRange[i] = new double[2];
-        if (flag)
-        {
-            source_->scalarSource[i]->GetRange(source_->scalarRange[i]);
-        }else
-        {
-            source_->cellScalarSource_[i]->GetRange(source_->scalarRange[i]);
-        }
-        //cout << "min: " << source_->scalarRange[i][0] << "  max:  " << source_->scalarRange[i][1] << endl;
-    }
-
-}
-
-/*
- * @brief: get UnGrid data Source(获取非结构化网格源)
- * @param: void
- * @ret: vtkVISUnstructuredGrid Source
- * @birth: created by czm in 20230324
- */
-vtkVISUnstructuredGridSource* vtkVISAddUnGridDataSource::GetSource()
-{
-    return source_;
-}

+ 0 - 42
CAE_Solution/src/VTK/visualization_VTK/vtkvisaddungriddatasource.h

@@ -1,42 +0,0 @@
-#ifndef VTKVISADDUNGRIDDATASOURCE_H
-#define VTKVISADDUNGRIDDATASOURCE_H
-#include <iostream>
-#include "vtkvismanager.h"
-#include "vtkvisunstructuredgridsource.h"
-#include <vtkUnstructuredGridReader.h>
-#include <vtkPointData.h>
-#include <vtkCellData.h>
-#include <vtkAppendFilter.h>
-#include <vtkTriangle.h>
-#include <vtkQuad.h>
-#include <vtkCell.h>
-#include <vtkIdList.h>
-#include <vtkTetra.h>
-#include <vtkHexahedron.h>
-#include <vtkQuadraticTetra.h>
-#include <vtkLine.h>
-
-
-class vtkVISAddUnGridDataSource
-{
-public:
-    static vtkVISAddUnGridDataSource *New();
-    vtkVISAddUnGridDataSource();
-    ~vtkVISAddUnGridDataSource();
-
-    void AllocationSpace(vector<vtkVISUnstructuredGridSource*> vec);
-    void SetVISUnGridDataSource(vector<vtkVISUnstructuredGridSource*> vec);
-    void CreatUnGridGeomtry(vector<vtkVISUnstructuredGridSource*> vec);
-    void CreatUnGridScaleSource(vector<vtkVISUnstructuredGridSource*> vec);
-
-    vtkVISUnstructuredGridSource* GetSource();
-protected:
-
-
-private:
-
-    vtkVISUnstructuredGridSource* source_;
-    int unGridNumber_;
-};
-
-#endif // VTKVISADDUNGRIDDATASOURCE_H

+ 433 - 623
CAE_Solution/src/VTK/visualization_VTK/vtkviscameramanager.cpp

@@ -1,627 +1,437 @@
-#include "vtkviscameramanager.h"
-
-/*
- * @brief: the constructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-vtkStandardNewMacro(vtkVisCameraManager)
-vtkVisCameraManager::vtkVisCameraManager()
-{
-    camera_ = NULL;
-    xIndex = 0;
-    yIndex = 0;
-    dFlag = 2;
-    trans_ = NULL;
-}
-
-/*
- * @brief: the destructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-vtkVisCameraManager::~vtkVisCameraManager()
-{
-
-}
-
-/*
- * @brief: get the camera
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::GetCamera()//鑾峰彇鎽勫儚鏈�
-{
-    if (_renderer == NULL) {
-        ErrorInfo(1, "Set render window first!");
-        return;
-    }
-    camera_ = _renderer->GetActiveCamera();
-}
-
-/*
- * @brief: zoom out
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::ZoomOut()//缂╁皬
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    camera_->Zoom(0.95);
-    _renWin->Render();
-}
-
-/*
- * @brief: zoom in
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::ZoomIn()//鏀惧ぇ
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    camera_->Zoom(1.05);
-    _renWin->Render();
-}
-
-/*
- * @brief: relocate
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::Relocate()//鑷�€傚簲
-{
-    if (_renderer == NULL)
-    {
-        ErrorInfo(1, "Set render window first!");
-        return;
-    }
-    _renderer->ResetCamera();
-    _renWin->Render();
-}
-
-/*
- * @brief: relocate to center
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::RelocateToCenter()//鍥炲埌涓�績
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-
-    xIndex = 0;
-    yIndex = 0;
-
-    vtkTransform *trans = vtkTransform::New();
-    trans->Translate(0, 0, 0);
-
-    camera_->SetUserTransform(trans);
-    _renWin->Render();
-}
-
-/*
- * @brief: Align To Plus Axis X(涓庢�x杞村�榻�)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::AlignToPlusAxisX()
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    camera_->SetViewUp(0, 0, 1);
-    camera_->SetFocalPoint(0, 0, 0);
-    camera_->SetPosition(1, 0, 0);
-
-    _renderer->ResetCamera();
-    _renWin->Render();
-
-    dFlag = 0;
-}
-
-/*
- * @brief: Align To Plus Axis Y(涓庢�y杞村�榻�)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::AlignToPlusAxisY()
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    camera_->SetViewUp(0, 0, 1);
-    camera_->SetFocalPoint(0, 0, 0);
-    camera_->SetPosition(0, 1, 0);
-
-    _renderer->ResetCamera();
-    _renWin->Render();
-
-    dFlag = 1;
-}
-
-/*
- * @brief: Align To Plus Axis Z(涓庢�z杞村�榻�)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::AlignToPlusAxisZ()
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    camera_->SetViewUp(0, -1, 0);
-    camera_->SetFocalPoint(0, 0, 0);
-    camera_->SetPosition(0, 0, 1);
-
-    _renderer->ResetCamera();
-    _renWin->Render();
-
-    dFlag = 2;
-}
-
-/*
- * @brief: Align To minus Axis X(涓庤礋x杞村�榻�)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::AlignToMinusAxisX()
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    camera_->SetViewUp(0, 0, 1);
-    camera_->SetFocalPoint(0, 0, 0);
-    camera_->SetPosition(-1, 0, 0);
-
-    _renderer->ResetCamera();
-    _renWin->Render();
-
-    dFlag = 0;
-}
-
-/*
- * @brief: Align To minus Axis Y(涓庤礋y杞村�榻�)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::AlignToMinusAxisY()
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    camera_->SetViewUp(0, 0, 1);
-    camera_->SetFocalPoint(0, 0, 0);
-    camera_->SetPosition(0, -1, 0);
-
-    _renderer->ResetCamera();
-    _renWin->Render();
-
-    dFlag = 1;
-}
-
-/*
- * @brief: Align To minus Axis Z(涓庤礋z杞村�榻�)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::AlignToMinusAxisZ()
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    camera_->SetViewUp(0, -1, 0);
-    camera_->SetFocalPoint(0, 0, 0);
-    camera_->SetPosition(0, 0, -1);
-
-    _renderer->ResetCamera();
-    _renWin->Render();
-
-    dFlag = 2;
-}
-
-/*
- * @brief: transform to left
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::TransformToLeft()//鍚戝乏骞崇Щ
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    --xIndex;
-
-    vtkTransform *trans = vtkTransform::New();
-    trans->Translate(0.1*xIndex, 0.1*yIndex, 0);
-
-    camera_->SetUserTransform(trans);
-    _renWin->Render();
-}
-
-/*
- * @brief: transform to right
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::TransformToRight()//鍚戝彸骞崇Щ
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    ++xIndex;
-
-    vtkTransform *trans = vtkTransform::New();
-    trans->Translate(0.1*xIndex, 0.1*yIndex, 0);
-
-    camera_->SetUserTransform(trans);
-    _renWin->Render();
-}
-
-/*
- * @brief: transform to up
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::TransformToUp()//涓婄Щ
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    ++yIndex;
-
-    vtkTransform *trans = vtkTransform::New();
-    trans->Translate(0.1*xIndex, 0.1*yIndex, 0);
-
-    camera_->SetUserTransform(trans);
-    _renWin->Render();
-}
-
-/*
- * @brief: transform to down
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::TransformToDown()//涓嬬Щ
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    --yIndex;
-
-    vtkTransform *trans = vtkTransform::New();
-    trans->Translate(0.1*xIndex, 0.1*yIndex, 0);
-
-    camera_->SetUserTransform(trans);
-    _renWin->Render();
-}
-
-/*
- * @brief: interactor open
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::InteractorOn()//浜や簰鍣ㄥ紑
-{
-    _renWin->GetInteractor()->Enable();
-}
-
-/*
- * @brief: interactor close
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::InteractorOff()//浜や簰鍣ㄥ叧
-{
-    _renWin->GetInteractor()->Disable();
+#include <vtkRenderer.h>
+#include <vtkRenderWindow.h>
+#include <vtkCamera.h>
+#include <vtkTransform.h>
+#include <vtkObjectFactory.h>
+#include <vtkRenderWindowInteractor.h>
+#include <vtkInteractorStyleSwitch.h>
+#include "vtkVISCameraManager.h"
+
+vtkStandardNewMacro(vtkVISCameraManager)
+
+vtkVISCameraManager::vtkVISCameraManager()
+{
+	camera_ = NULL;
+	xIndex = 0;
+	yIndex = 0;
+	dFlag = 2;
+	trans_ = NULL;
+}
+
+vtkVISCameraManager::~vtkVISCameraManager()
+{
+
+}
+
+void vtkVISCameraManager::GetCamera()//获取摄像机
+{
+	if (_renderer == NULL) {
+		ErrorInfo(1, "Set render window first!");
+		return;
+	}
+	camera_ = _renderer->GetActiveCamera();
+}
+
+void vtkVISCameraManager::ZoomOut()//缩小
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	camera_->Zoom(0.95);
+	_renWin->Render();
+}
+
+void vtkVISCameraManager::ZoomIn()//放大
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	camera_->Zoom(1.05);
+	_renWin->Render();
+}
+
+void vtkVISCameraManager::Relocate()//自适应
+{
+	if (_renderer == NULL)
+	{
+		ErrorInfo(1, "Set render window first!");
+		return;
+	}
+	_renderer->ResetCamera();
+	_renWin->Render();
+}
+
+void vtkVISCameraManager::RelocateToCenter()//回到中心
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+
+	xIndex = 0;
+	yIndex = 0;
+
+	vtkTransform *trans = vtkTransform::New();
+	trans->Translate(0, 0, 0);
+
+	camera_->SetUserTransform(trans);
+	_renWin->Render();
+}
+
+void vtkVISCameraManager::AlignToPlusAxisX()
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	camera_->SetViewUp(0, 0, 1);
+	camera_->SetFocalPoint(0, 0, 0);
+	camera_->SetPosition(1, 0, 0);
+
+	_renderer->ResetCamera();
+	_renWin->Render();
+
+	dFlag = 0;
+}
+
+void vtkVISCameraManager::AlignToPlusAxisY()
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	camera_->SetViewUp(0, 0, 1);
+	camera_->SetFocalPoint(0, 0, 0);
+	camera_->SetPosition(0, 1, 0);
+
+	_renderer->ResetCamera();
+	_renWin->Render();
+
+	dFlag = 1;
+}
+
+void vtkVISCameraManager::AlignToPlusAxisZ()
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	camera_->SetViewUp(0, -1, 0);
+	camera_->SetFocalPoint(0, 0, 0);
+	camera_->SetPosition(0, 0, 1);
+
+	_renderer->ResetCamera();
+	_renWin->Render();
+
+	dFlag = 2;
+}
+
+void vtkVISCameraManager::AlignToMinusAxisX()
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	camera_->SetViewUp(0, 0, 1);
+	camera_->SetFocalPoint(0, 0, 0);
+	camera_->SetPosition(-1, 0, 0);
+
+	_renderer->ResetCamera();
+	_renWin->Render();
+
+	dFlag = 0;
+}
+
+void vtkVISCameraManager::AlignToMinusAxisY()
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	camera_->SetViewUp(0, 0, 1);
+	camera_->SetFocalPoint(0, 0, 0);
+	camera_->SetPosition(0, -1, 0);
+
+	_renderer->ResetCamera();
+	_renWin->Render();
+
+	dFlag = 1;
+}
+
+void vtkVISCameraManager::AlignToMinusAxisZ()
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	camera_->SetViewUp(0, -1, 0);
+	camera_->SetFocalPoint(0, 0, 0);
+	camera_->SetPosition(0, 0, -1);
+
+	_renderer->ResetCamera();
+	_renWin->Render();
+
+	dFlag = 2;
+}
+
+void vtkVISCameraManager::TransformToLeft()//向左平移
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	--xIndex;
+
+	vtkTransform *trans = vtkTransform::New();
+	trans->Translate(0.1*xIndex, 0.1*yIndex, 0);
+
+	camera_->SetUserTransform(trans);
+	_renWin->Render();
 }
 
-/*
- * @brief: get interactor status
- * @param: void
- * @ret: num(1/0)
- * @birth: created by czm in 20230321
- */
-int vtkVisCameraManager::GetInteractorStatus()//鑾峰彇浜や簰鍣ㄧ姸鎬�
+void vtkVISCameraManager::TransformToRight()//向右平移
 {
-    return _renWin->GetInteractor()->GetEnabled();
-}
-
-/*
- * @brief: Set Interactor Style To Joystick Camera(灏嗕簰鍔ㄥ櫒鏍峰紡璁剧疆涓烘憞鏉嗙浉鏈�)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::SetInteractorStyleToJoystickCamera()//鎽勫儚鏈烘搷绾垫潌
-{
-    vtkInteractorStyleSwitch *iass = vtkInteractorStyleSwitch::SafeDownCast(_renWin->GetInteractor()->GetInteractorStyle());
-    iass->SetCurrentStyleToJoystickCamera();
-}
-
-/*
- * @brief: Set Interactor Style To Joystick Actor(灏嗕簰鍔ㄥ櫒鏍峰紡璁剧疆涓烘搷绾垫潌婕斿憳)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::SetInteractorStyleToJoystickActor()//婕斿憳鎿嶇旱鏉�
-{
-    vtkInteractorStyleSwitch *iass = vtkInteractorStyleSwitch::SafeDownCast(_renWin->GetInteractor()->GetInteractorStyle());
-    iass->SetCurrentStyleToJoystickActor();
-}
-
-/*
- * @brief: Set Interactor Style To TrackballCamera(灏嗕氦浜掔▼搴忔牱寮忚�缃�负杞ㄨ抗鐞冩憚褰辨満)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::SetInteractorStyleToTrackballCamera()//鎽勫儚鏈鸿建杩圭悆
-{
-    vtkInteractorStyleSwitch *iass = vtkInteractorStyleSwitch::SafeDownCast(_renWin->GetInteractor()->GetInteractorStyle());
-    iass->SetCurrentStyleToTrackballCamera();
-}
-
-/*
- * @brief: Set Interactor Style To TrackballActor(灏嗕氦浜掔▼搴忔牱寮忚�缃�负杞ㄨ抗鐞冩紨鍛�)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::SetInteractorStyleToTrackballActor()//婕斿憳杞ㄨ抗鐞�
-{
-    vtkInteractorStyleSwitch *iass = vtkInteractorStyleSwitch::SafeDownCast(_renWin->GetInteractor()->GetInteractorStyle());
-    iass->SetCurrentStyleToTrackballActor();
-}
-
-/*
- * @brief: Parallel Projection On(骞宠�鎶曞奖鎵撳紑)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::ParallelProjectionOn()//骞宠�鎶曞奖寮€
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-
-    camera_->ParallelProjectionOn();
-    ErrorInfo(0, "Camera set to Parallel Projection!");
-
-    _renWin->Render();
-}
-
-/*
- * @brief: Parallel Projection Off(骞宠�鎶曞奖鍏抽棴)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::ParallelProjectionOff()//骞宠�鎶曞奖鍏�
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-
-    camera_->ParallelProjectionOff();
-    ErrorInfo(0, "Camera set to Perspective Projection!");
-
-    _renWin->Render();
-}
-
-/*
- * @brief: get projection method(鑾峰彇鎶曞奖鏂规硶)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-int vtkVisCameraManager::GetProjectionMethod()//鑾峰彇鎶曞奖鏂规硶
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return -1;
-    }
-    return camera_->GetParallelProjection();
-}
-
-/*
- * @brief: transform by xyz(骞崇Щ)
- * @param: [in] xyz's distance
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::TransformByXYZ(double x, double y, double z)//骞崇Щ
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    if (trans_ == NULL)
-    {
-        trans_ = vtkTransform::New();
-    }
-    trans_->Translate(x, y, z);
-
-    camera_->SetUserTransform(trans_);
-    _renWin->Render();
-}
-
-/*
- * @brief: scale by xyz(姣斾緥缂╂斁)
- * @param: [in] xyz
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::ScaleByXYZ(double x, double y, double z)//姣斾緥缂╂斁
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    if (trans_ == NULL)
-    {
-        trans_ = vtkTransform::New();
-    }
-
-    trans_->Scale(x, y, z);
-
-    camera_->SetUserTransform(trans_);
-    _renWin->Render();
-}
-
-/*
- * @brief: rotate by xyz(鏃嬭浆)
- * @param: angle x y z
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::RotateWXYZ(double angle, double x, double y, double z)//鏃嬭浆
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    if (trans_ == NULL)
-    {
-        trans_ = vtkTransform::New();
-    }
-
-    trans_->RotateWXYZ(angle, x, y, z);
-
-    camera_->SetUserTransform(trans_);
-    _renWin->Render();
-}
-
-/*
- * @brief: rotate by x(缁晉杞存棆杞�)
- * @param: angle
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::RotateX(double angle)//缁晉杞存棆杞�
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    if (trans_ == NULL)
-    {
-        trans_ = vtkTransform::New();
-    }
-
-    //vtkTransform *trans = vtkTransform::New();
-    trans_->RotateX(angle);
-
-    camera_->SetUserTransform(trans_);
-    _renWin->Render();
-}
-
-/*
- * @brief: rotate by y(缁晊杞存棆杞�)
- * @param: angle
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::RotateY(double angle)//缁晊杞存棆杞�
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    if (trans_ == NULL)
-    {
-        trans_ = vtkTransform::New();
-    }
-
-    //vtkTransform *trans = vtkTransform::New();
-    trans_->RotateY(angle);
-
-    camera_->SetUserTransform(trans_);
-    _renWin->Render();
-}
-
-/*
- * @brief: rotate by z(缁晍杞存棆杞�)
- * @param: angle
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVisCameraManager::RotateZ(double angle)//缁晍杞存棆杞�
-{
-    if (camera_ == NULL)
-    {
-        ErrorInfo(1, "Get camera first!");
-        return;
-    }
-    if (trans_ == NULL)
-    {
-        trans_ = vtkTransform::New();
-    }
-
-    //vtkTransform *trans = vtkTransform::New();
-    trans_->RotateZ(angle);
-
-    camera_->SetUserTransform(trans_);
-    _renWin->Render();
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	++xIndex;
+
+	vtkTransform *trans = vtkTransform::New();
+	trans->Translate(0.1*xIndex, 0.1*yIndex, 0);
+
+	camera_->SetUserTransform(trans);
+	_renWin->Render();
+}
+
+void vtkVISCameraManager::TransformToUp()//上移
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	++yIndex;
+
+	vtkTransform *trans = vtkTransform::New();
+	trans->Translate(0.1*xIndex, 0.1*yIndex, 0);
+
+	camera_->SetUserTransform(trans);
+	_renWin->Render();
+}
+
+void vtkVISCameraManager::TransformToDown()//下移
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	--yIndex;
+
+	vtkTransform *trans = vtkTransform::New();
+	trans->Translate(0.1*xIndex, 0.1*yIndex, 0);
+
+	camera_->SetUserTransform(trans);
+	_renWin->Render();
+}
+
+void vtkVISCameraManager::InteractorOn()//交互器开
+{
+	_renWin->GetInteractor()->Enable();
+}
+
+void vtkVISCameraManager::InteractorOff()//交互器关
+{
+	_renWin->GetInteractor()->Disable();
+}
+
+int vtkVISCameraManager::GetInteractorStatus()//获取交互器状态
+{
+	return _renWin->GetInteractor()->GetEnabled();
+}
+
+void vtkVISCameraManager::SetInteractorStyleToJoystickCamera()//摄像机操纵杆
+{
+	vtkInteractorStyleSwitch *iass = vtkInteractorStyleSwitch::SafeDownCast(_renWin->GetInteractor()->GetInteractorStyle());
+	iass->SetCurrentStyleToJoystickCamera();
+}
+
+void vtkVISCameraManager::SetInteractorStyleToJoystickActor()//演员操纵杆
+{
+	vtkInteractorStyleSwitch *iass = vtkInteractorStyleSwitch::SafeDownCast(_renWin->GetInteractor()->GetInteractorStyle());
+	iass->SetCurrentStyleToJoystickActor();
+}
+
+void vtkVISCameraManager::SetInteractorStyleToTrackballCamera()//摄像机轨迹球
+{
+	vtkInteractorStyleSwitch *iass = vtkInteractorStyleSwitch::SafeDownCast(_renWin->GetInteractor()->GetInteractorStyle());
+	iass->SetCurrentStyleToTrackballCamera();
+}
+
+void vtkVISCameraManager::SetInteractorStyleToTrackballActor()//演员轨迹球
+{
+	vtkInteractorStyleSwitch *iass = vtkInteractorStyleSwitch::SafeDownCast(_renWin->GetInteractor()->GetInteractorStyle());
+	iass->SetCurrentStyleToTrackballActor();
+}
+
+void vtkVISCameraManager::ParallelProjectionOn()//平行投影开
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+
+	camera_->ParallelProjectionOn();
+	ErrorInfo(0, "Camera set to Parallel Projection!");
+
+	_renWin->Render();
+}
+
+void vtkVISCameraManager::ParallelProjectionOff()//平行投影关
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+
+	camera_->ParallelProjectionOff();
+	ErrorInfo(0, "Camera set to Perspective Projection!");
+
+	_renWin->Render();
+}
+
+int vtkVISCameraManager::GetProjectionMethod()//获取投影方法
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return -1;
+	}
+	return camera_->GetParallelProjection();
+}
+
+void vtkVISCameraManager::TransformByXYZ(double x, double y, double z)//平移
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	if (trans_ == NULL)
+	{
+		trans_ = vtkTransform::New();
+	}
+	trans_->Translate(x, y, z);
+
+	camera_->SetUserTransform(trans_);
+	_renWin->Render();
+}
+
+void vtkVISCameraManager::ScaleByXYZ(double x, double y, double z)//比例缩放
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	if (trans_ == NULL)
+	{
+		trans_ = vtkTransform::New();
+	}
+
+	trans_->Scale(x, y, z);
+
+	camera_->SetUserTransform(trans_);
+	_renWin->Render();
+}
+
+void vtkVISCameraManager::RotateWXYZ(double angle, double x, double y, double z)//旋转
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	if (trans_ == NULL)
+	{
+		trans_ = vtkTransform::New();
+	}
+
+	trans_->RotateWXYZ(angle, x, y, z);
+
+	camera_->SetUserTransform(trans_);
+	_renWin->Render();
+}
+
+void vtkVISCameraManager::RotateX(double angle)//绕x轴旋转
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	if (trans_ == NULL)
+	{
+		trans_ = vtkTransform::New();
+	}
+
+	//vtkTransform *trans = vtkTransform::New();
+	trans_->RotateX(angle);
+
+	camera_->SetUserTransform(trans_);
+	_renWin->Render();
+}
+
+void vtkVISCameraManager::RotateY(double angle)//绕y轴旋转
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	if (trans_ == NULL)
+	{
+		trans_ = vtkTransform::New();
+	}
+
+	//vtkTransform *trans = vtkTransform::New();
+	trans_->RotateY(angle);
+
+	camera_->SetUserTransform(trans_);
+	_renWin->Render();
+}
+
+void vtkVISCameraManager::RotateZ(double angle)//绕z轴旋转
+{
+	if (camera_ == NULL)
+	{
+		ErrorInfo(1, "Get camera first!");
+		return;
+	}
+	if (trans_ == NULL)
+	{
+		trans_ = vtkTransform::New();
+	}
+
+	//vtkTransform *trans = vtkTransform::New();
+	trans_->RotateZ(angle);
+
+	camera_->SetUserTransform(trans_);
+	_renWin->Render();
 }

+ 14 - 13
CAE_Solution/src/VTK/visualization_VTK/vtkviscameramanager.h

@@ -1,18 +1,19 @@
-#ifndef VTKVISCAMERAMANAGER_H
-#define VTKVISCAMERAMANAGER_H
-#include "vtkvismanager.h"
-#include <vtkCamera.h>
-#include <vtkTransform.h>
-#include <vtkRenderWindowInteractor.h>
-#include <vtkInteractorStyleSwitch.h>
-#include <vtkObjectFactory.h>
+#ifndef vtkVISCameraManager_h
+#define vtkVISCameraManager_h
 
-class vtkVisCameraManager : public vtkVISManager
+
+#include "vtkVISManager.h"
+class vtkCamera;
+class vtkTransform;
+
+class  vtkVISCameraManager : public vtkVISManager
 {
 public:
-    static vtkVisCameraManager *New();
-    vtkVisCameraManager();
-    ~vtkVisCameraManager();
+    static vtkVISCameraManager *New();
+
+    vtkVISCameraManager();
+    ~vtkVISCameraManager();
+
     void GetCamera();
     void ZoomOut();
     void ZoomIn();
@@ -61,4 +62,4 @@ protected:
     int dFlag;
 };
 
-#endif // VTKVISCAMERAMANAGER_H
+#endif

+ 0 - 218
CAE_Solution/src/VTK/visualization_VTK/vtkviscapturefigure.cpp

@@ -1,218 +0,0 @@
-#include "vtkviscapturefigure.h"
-#include <vtkRenderer.h>
-#include <vtkRenderWindow.h>
-#include <vtkRenderLargeImage.h>
-#include <vtkJPEGWriter.h>
-#include <vtkBMPWriter.h>
-#include <vtkPNGWriter.h>
-#include <vtkTIFFWriter.h>
-#include <vtkPNMWriter.h>
-#include <vtkObjectFactory.h>
-
-vtkStandardNewMacro(vtkVISCaptureFigure)
-
-/*
- * @brief: the constructor
- * @param:
- * @ret:
- * @birth: created by czm in 20230330
- */
-vtkVISCaptureFigure::vtkVISCaptureFigure()
-{
-    magFactor_ = 1;
-
-    renderImage_ = NULL;
-}
-
-/*
- * @brief: the destructor
- * @param:
- * @ret:
- * @birth: created by czm in 20230330
- */
-vtkVISCaptureFigure::~vtkVISCaptureFigure()
-{
-    renderImage_->Delete();
-}
-
-/*
- * @brief: set Capture Figure Source(设置捕获图形源)
- * @param: renderer
- * @ret: void
- * @birth: created by czm in 20230330
- */
-void vtkVISCaptureFigure::SetCaptureFigureSource(vtkRenderer *render)
-{
-
-    int actorNum;
-
-    actorNum = render->VisibleActorCount();
-
-    if (actorNum == 0)
-    {
-        ErrorInfo(1, "There is no figure in renderWindow!");
-        return;
-    }
-
-    renderImage_ = vtkRenderLargeImage::New();
-    renderImage_->SetInput(render);
-    renderImage_->SetMagnification(magFactor_);
-    renderImage_->Update();
-}
-
-/*
- * @brief: Modify Magnification Factor(修改放大系数)
- * @param: factor
- * @ret: void
- * @birth: created by czm in 20230330
- */
-void vtkVISCaptureFigure::ModifyMagnificationFactor(int factor)
-{
-    if (renderImage_ == NULL)
-    {
-        ErrorInfo(1, "No Figure Source, Please Set Capture Figure Source First!");
-        return;
-    }
-    else
-    {
-        magFactor_ = factor;
-
-        renderImage_->SetMagnification(factor);
-        renderImage_->Update();
-        renderImage_->Modified();
-
-    }
-}
-
-/*
- * @brief: get Magnification Factor(获取放大系数)
- * @param: void
- * @ret: factor
- * @birth: created by czm in 20230330
- */
-int vtkVISCaptureFigure::GetMagnificationFactor()
-{
-    return this->magFactor_;
-}
-
-/*
- * @brief: Capture Render Figure As JPEG(捕获渲染图为JPEG)
- * @param: imageName
- * @ret: void
- * @birth: created by czm in 20230330
- */
-void vtkVISCaptureFigure::CaptureRenderFigureAsJPEG(char* imageName)
-{
-    if (renderImage_ == NULL)
-    {
-        ErrorInfo(1, "No Source, Please Set Capture Figure Source First!");
-        return;
-    }
-
-    renderImage_->Modified();
-
-    vtkJPEGWriter *writer = vtkJPEGWriter::New();
-    writer->SetInputData(renderImage_->GetOutput());
-    writer->SetFileName(imageName);
-    writer->SetQuality(100);
-    writer->ProgressiveOn();
-    writer->Write();
-
-    writer->Delete();
-}
-
-/*
- * @brief: Capture Render Figure As BMP(捕获渲染图为BMP)
- * @param: imageName
- * @ret: void
- * @birth: created by czm in 20230330
- */
-void vtkVISCaptureFigure::CaptureRenderFigureAsBMP(char* imageName)
-{
-    if (renderImage_ == NULL)
-    {
-        ErrorInfo(1, "No Source, Please Set Capture Figure Source First!");
-        return;
-    }
-
-    renderImage_->Modified();
-
-    vtkBMPWriter *writer = vtkBMPWriter::New();
-    writer->SetInputData(renderImage_->GetOutput());
-    writer->SetFileName(imageName);
-    writer->Write();
-
-    writer->Delete();
-}
-
-/*
- * @brief: Capture Render Figure As PNG(捕获渲染图为PNG)
- * @param: imageName
- * @ret: void
- * @birth: created by czm in 20230330
- */
-void vtkVISCaptureFigure::CaptureRenderFigureAsPNG(char* imageName)
-{
-    if (renderImage_ == NULL)
-    {
-        ErrorInfo(1, "No Source, Please Set Capture Figure Source First!");
-        return;
-    }
-
-    renderImage_->Modified();
-
-    vtkPNGWriter *writer = vtkPNGWriter::New();
-    writer->SetInputData(renderImage_->GetOutput());
-    writer->SetFileName(imageName);
-    writer->Write();
-
-    writer->Delete();
-}
-
-/*
- * @brief: Capture Render Figure As JPEG(捕获渲染图为JPEG)
- * @param: imageName
- * @ret: void
- * @birth: created by czm in 20230330
- */
-void vtkVISCaptureFigure::CaptureRenderFigureAsTIFF(char* imageName)
-{
-    if (renderImage_ == NULL)
-    {
-        ErrorInfo(1, "No Source, Please Set Capture Figure Source First!");
-        return;
-    }
-
-    renderImage_->Modified();
-
-    vtkTIFFWriter *writer = vtkTIFFWriter::New();
-    writer->SetInputData(renderImage_->GetOutput());
-    writer->SetFileName(imageName);
-    writer->Write();
-
-    writer->Delete();
-}
-
-/*
- * @brief: Capture Render Figure As PNM(捕获渲染图为PNM)
- * @param: imageName
- * @ret: void
- * @birth: created by czm in 20230330
- */
-void vtkVISCaptureFigure::CaptureRenderFigureAsPNM(char* imageName)
-{
-    if (renderImage_ == NULL)
-    {
-        ErrorInfo(1, "No Source, Please Set Capture Figure Source First!");
-        return;
-    }
-
-    renderImage_->Modified();
-
-    vtkPNMWriter *writer = vtkPNMWriter::New();
-    writer->SetInputData(renderImage_->GetOutput());
-    writer->SetFileName(imageName);
-    writer->Write();
-
-    writer->Delete();
-}

+ 0 - 29
CAE_Solution/src/VTK/visualization_VTK/vtkviscapturefigure.h

@@ -1,29 +0,0 @@
-#ifndef VTKVISCAPTUREFIGURE_H
-#define VTKVISCAPTUREFIGURE_H
-#include "vtkvismanager.h"
-#include <vtkRenderLargeImage.h>
-#include <vtkObjectFactory.h>
-
-class vtkVISCaptureFigure :public vtkVISManager
-{
-public:
-    static vtkVISCaptureFigure* New();
-    vtkVISCaptureFigure();
-    ~vtkVISCaptureFigure();
-
-    void SetCaptureFigureSource(vtkRenderer *render);
-    void ModifyMagnificationFactor(int factor);
-    int GetMagnificationFactor();
-
-    void CaptureRenderFigureAsJPEG(char* imageName);
-    void CaptureRenderFigureAsBMP(char* imageName);
-    void CaptureRenderFigureAsPNG(char* imageName);
-    void CaptureRenderFigureAsTIFF(char* imageName);
-    void CaptureRenderFigureAsPNM(char* imageName);
-
-protected:
-    vtkRenderLargeImage *renderImage_;
-    int magFactor_;
-};
-
-#endif // VTKVISCAPTUREFIGURE_H

+ 158 - 250
CAE_Solution/src/VTK/visualization_VTK/vtkvismanager.cpp

@@ -8,320 +8,228 @@ VTK_MODULE_INIT(vtkInteractionStyle)
 VTK_MODULE_INIT(vtkRenderingVolumeOpenGL2)
 VTK_MODULE_INIT(vtkRenderingFreeType)
 
-#include "vtkvismanager.h"
+#include "vtkVISManager.h"
 
 vtkStandardNewMacro(vtkVISManager)
 
-/*
- * @brief: the constructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
 vtkVISManager::vtkVISManager()
 {
-    colorPalette[0] = "#02f78e";
-    colorPalette[1] = "#ff0000";
-    colorPalette[2] = "#00ec00";
-    colorPalette[3] = "#2828ff";
-    colorPalette[4] = "#00ffff";
-    colorPalette[5] = "#ff8000";
-    colorPalette[6] = "#8600ff";
-    colorPalette[7] = "#02f78e";
-    colorPalette[8] = "#ff60af";
-    colorPalette[9] = "#2894ff";
-    colorPalette[10] = "#f9f900";
-    colorPalette[11] = "#b15bff";
-    colorPalette[12] = "#ff5809";
-    colorPalette[13] = "#9aff02";
-    colorPalette[14] = "#8600ff";
-    colorPalette[15] = "#ff44ff";
-    colorPalette[16] = "#ffff37";
-    colorPalette[17] = "#9aff02";
-    colorPalette[18] = "#ff6002";
-    colorPalette[19] = "#0080ff";
-
-    scalarName = NULL;
-    vectorName = NULL;
-
-    scalarNumber_ = 0;
-    vectorNumber_ = 0;
-
-    scalarNumber = NULL;
-    vectorNumber = NULL;
-
-    _renderer = NULL;
-    _renWin = NULL;
-
-
-    for (int i = 0; i < 20; ++i)
-    {
-        for (int j = 0; j < 3; ++j)
-        {
-            vtkColorPalette[i][j] = 0.0;
-        }
-    }
+	colorPalette[0] = "#02f78e";
+	colorPalette[1] = "#ff0000";
+	colorPalette[2] = "#00ec00";
+	colorPalette[3] = "#2828ff";
+	colorPalette[4] = "#00ffff";
+	colorPalette[5] = "#ff8000";
+	colorPalette[6] = "#8600ff";
+	colorPalette[7] = "#02f78e";
+	colorPalette[8] = "#ff60af";
+	colorPalette[9] = "#2894ff";
+	colorPalette[10] = "#f9f900";
+	colorPalette[11] = "#b15bff";
+	colorPalette[12] = "#ff5809";
+	colorPalette[13] = "#9aff02";
+	colorPalette[14] = "#8600ff";
+	colorPalette[15] = "#ff44ff";
+	colorPalette[16] = "#ffff37";
+	colorPalette[17] = "#9aff02";
+	colorPalette[18] = "#ff6002";
+	colorPalette[19] = "#0080ff";
+
+	scalarName = NULL;
+	vectorName = NULL;
+
+	scalarNumber_ = 0;
+	vectorNumber_ = 0;
+
+	scalarNumber = NULL;
+	vectorNumber = NULL;
+
+	_renderer = NULL;
+	_renWin = NULL;
+
+
+	for (int i = 0; i < 20; ++i)
+	{
+		for (int j = 0; j < 3; ++j)
+		{
+			vtkColorPalette[i][j] = 0.0;
+		}
+	}
 }
 
-/*
- * @brief: the destructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
 vtkVISManager::~vtkVISManager()
 {
-    ErrorInfo(0,"VIS object Destructure func ended here");
+	ErrorInfo(0, "VIS object Destructure func ended here");
 
-    scalarName = NULL;
-    vectorName = NULL;
+	scalarName = NULL;
+	vectorName = NULL;
 
-    scalarNumber = NULL;
-    vectorNumber = NULL;
+	scalarNumber = NULL;
+	vectorNumber = NULL;
 }
 
-/*
- * @brief: set data type
- * @param: type
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVISManager::SetDataType(char *type)
+void vtkVISManager::SetDataType(char* type)
 {
-    this->_dataType = type;
+	this->_dataType = type;
 }
 
-/*
- * @brief: set renderer to renderWindow
- * @param: [in] renderer and renderwindow
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVISManager::SetRenderTo(vtkRenderer *ren, vtkRenderWindow *renWin){
-    if (this->_renderer == NULL)
-    {
-
-        this->_renderer = ren;
-    }
-    if (this->_renWin == NULL)
-    {
-        this->_renWin = renWin;
-
-        this->_renWin->LineSmoothingOn();
-        this->_renWin->PointSmoothingOn();
-        this->_renWin->PolygonSmoothingOn();
-    }
+void vtkVISManager::SetRenderTo(vtkRenderer *ren, vtkRenderWindow *renWin)
+{
+	if (_renderer == NULL)
+	{
+		this->_renderer = ren;
+	}
+	if (_renWin == NULL)
+	{
+		this->_renWin = renWin;
+
+		this->_renWin->LineSmoothingOn();
+		this->_renWin->PointSmoothingOn();
+		this->_renWin->PolygonSmoothingOn();
+	}
 }
 
-/*
- * @brief: set renderer to renderWindow
- * @param: [in] renderer
- * @ret: void
- * @birth: created by czm in 20230321
- */
 void vtkVISManager::SetRenderTo(vtkRenderer *ren)
 {
     SetRenderTo(ren, ren->GetRenderWindow());
 }
 
-/*
- * @brief: update
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
 void vtkVISManager::Update()
 {
     if (_renWin)  _renWin->Render();
 }
 
-/*
- * @brief: translate colorcode to vtkcolorcode
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230321
- */
-void vtkVISManager::Translate_TkColorCode_To_VTKColorCode_All()//濉�厖璋冭壊鏉�
+void vtkVISManager::Translate_TkColorCode_To_VTKColorCode_All()//填充调色板
 {
-    for (int k = 0; k < 20; ++k)
-    {
-        string colorCode = colorPalette[k];
+	for (int k = 0; k < 20; ++k)
+	{
+		string colorCode = colorPalette[k];
 
-        string colCode;
-        colCode.append(colorCode.begin() + 1, colorCode.end());
+		string colCode;
+		colCode.append(colorCode.begin() + 1, colorCode.end());
 
-        int rgbLength;
-        rgbLength = colCode.length() / 3;
+		int rgbLength;
+		rgbLength = colCode.length() / 3;
 
-        string rCode;
-        string gCode;
-        string bCode;
+		string rCode;
+		string gCode;
+		string bCode;
 
-        int i;
-        i = rgbLength;
-        rCode.append(colCode.begin(), colCode.begin() + i);
+		int i;
+		i = rgbLength;
+		rCode.append(colCode.begin(), colCode.begin() + i);
 
-        i = 2 * rgbLength;
-        gCode.append(colCode.begin() + rgbLength, colCode.begin() + i);
+		i = 2 * rgbLength;
+		gCode.append(colCode.begin() + rgbLength, colCode.begin() + i);
 
-        int j;
-        i = 2 * rgbLength;
-        j = 3 * rgbLength;
-        bCode.append(colCode.begin() + i, colCode.begin() + j);
+		int j;
+		i = 2 * rgbLength;
+		j = 3 * rgbLength;
+		bCode.append(colCode.begin() + i, colCode.begin() + j);
 
-        int rgbBase;
-        rgbBase = pow(2.0, 4 * rgbLength) - 1;
+		int rgbBase;
+		rgbBase = pow(2.0, 4 * rgbLength) - 1;
 
-        stringstream r(rCode);
-        int rValue;
-        r >> hex >> rValue;
+		stringstream r(rCode);
+		int rValue;
+		r >> hex >> rValue;
 
-        stringstream g(gCode);
-        int gValue;
-        g >> hex >> gValue;
+		stringstream g(gCode);
+		int gValue;
+		g >> hex >> gValue;
 
-        stringstream b(bCode);
-        int bValue;
-        b >> hex >> bValue;
+		stringstream b(bCode);
+		int bValue;
+		b >> hex >> bValue;
 
-        double vtkRCode, vtkGCode, vtkBCode;
-        vtkRCode = (double)rValue / rgbBase;
-        vtkGCode = (double)gValue / rgbBase;
-        vtkBCode = (double)bValue / rgbBase;
+		double vtkRCode, vtkGCode, vtkBCode;
+		vtkRCode = (double)rValue / rgbBase;
+		vtkGCode = (double)gValue / rgbBase;
+		vtkBCode = (double)bValue / rgbBase;
 
-        this->vtkColorPalette[k][0] = vtkRCode;
-        this->vtkColorPalette[k][1] = vtkGCode;
-        this->vtkColorPalette[k][2] = vtkBCode;
-    }
+		this->vtkColorPalette[k][0] = vtkRCode;
+		this->vtkColorPalette[k][1] = vtkGCode;
+		this->vtkColorPalette[k][2] = vtkBCode;
+	}
 }
 
-/*
- * @brief: get scalar index by name
- * @param: name
- * @ret: void
- * @birth: created by czm in 20230321
- */
-int vtkVISManager::GetScalarIndex(const char* scalar)//閫氳繃鏍囬噺鍚嶈幏鍙栨爣閲忕储寮�
+int vtkVISManager::GetScalarIndex(const char* scalar)//通过标量名获取标量索引
 {
-    for (int i = 0; i < scalarNumber_; ++i)
-    {
-        if (strcmp(scalar, scalarName[i]) == 0)
-        {
-            return i;
-        }
-    }
-
-    return -1;
+	for (int i = 0; i < scalarNumber_; ++i)
+	{
+		if (strcmp(scalar, scalarName[i]) == 0)
+		{
+			return i;
+		}
+	}
+
+	return -1;
 }
 
-/*
- * @brief: get vector index by name
- * @param: name
- * @ret: void
- * @birth: created by czm in 20230321
- */
-int vtkVISManager::GetVectorIndex(const char* vector)//閫氳繃鐭㈤噺鍚嶈幏鍙栫煝閲忕储寮�
+int vtkVISManager::GetVectorIndex(const char* vector)//通过矢量名获取矢量索引
 {
-    for (int i = 0; i < vectorNumber_; ++i)
-    {
-        if (strcmp(vector, vectorName[i]) == 0)
-        {
-            return i;
-        }
-    }
-
-    return -1;
+	for (int i = 0; i < vectorNumber_; ++i)
+	{
+		if (strcmp(vector, vectorName[i]) == 0)
+		{
+			return i;
+		}
+	}
+
+	return -1;
 }
 
-/*
- * @brief: get scalar name by index
- * @param: index
- * @ret: void
- * @birth: created by czm in 20230321
- */
-const char* vtkVISManager::GetScalarName(int i)//閫氳繃鏍囬噺绱㈠紩鑾峰彇鏍囬噺鍚�
+const char* vtkVISManager::GetScalarName(int i)//通过标量索引获取标量名
 {
-    if (i < 0 || i >= scalarNumber_)
-    {
-        ErrorInfo(1, "ScalarIndex Out of Range, use the first scalar instead");
-        i = 0;
-    }
-    ErrorInfo(0, scalarName[i]);
-    return this->scalarName[i];
+	if (i < 0 || i >= scalarNumber_)
+	{
+		ErrorInfo(1, "ScalarIndex Out of Range, use the first scalar instead");
+		i = 0;
+	}
+	ErrorInfo(0, scalarName[i]);
+	return this->scalarName[i];
 }
 
-
-/*
- * @brief: get vector name by index
- * @param: index
- * @ret: void
- * @birth: created by czm in 20230321
- */
-const char* vtkVISManager::GetVectorName(int i)//閫氳繃鐭㈤噺绱㈠紩鑾峰彇鐭㈤噺鍚�
+const char* vtkVISManager::GetVectorName(int i)//通过矢量索引获取矢量名
 {
-    if (i < 0 || i >= vectorNumber_)
-    {
-        ErrorInfo(1, "VectorIndex Out of Range, use first vector instead");
-        i = 0;
-    }
-    ErrorInfo(0, vectorName[i]);
-    return this->vectorName[i];
+	if (i < 0 || i >= vectorNumber_)
+	{
+		ErrorInfo(1, "VectorIndex Out of Range, use first vector instead");
+		i = 0;
+	}
+	ErrorInfo(0, vectorName[i]);
+	return this->vectorName[i];
 }
-
-/*
- * @brief: get scalar number
- * @param: void
- * @ret: scalar num
- * @birth: created by czm in 20230321
- */
-int vtkVISManager::GetScalarNumber()//鑾峰彇鏍囬噺鏁伴噺
+int vtkVISManager::GetScalarNumber()//获取标量数量
 {
-    return this->scalarNumber_;
+	return this->scalarNumber_;
 }
 
-/*
- * @brief: get vector number
- * @param: void
- * @ret: vector num
- * @birth: created by czm in 20230321
- */
-int vtkVISManager::GetVectorNumber()//鑾峰彇鐭㈤噺鏁伴噺
+int vtkVISManager::GetVectorNumber()//获取矢量数量
 {
-    return this->vectorNumber_;
+	return this->vectorNumber_;
 }
 
-/*
- * @brief: get scalar index
- * @param: scalar num
- * @ret: scalar index
- * @birth: created by czm in 20230321
- */
 int vtkVISManager::GetScalarIndex(int scalarNum)
 {
-    for (int i = 0; i < scalarNumber_; ++i)
-    {
-        if (scalarNum == scalarNumber[i])
-        {
-            return i;
-        }
-    }
-    return -1;
+	for (int i = 0; i < scalarNumber_; ++i)
+	{
+		if (scalarNum == scalarNumber[i])
+		{
+			return i;
+		}
+	}
+	return -1;
 }
 
-/*
- * @brief: get vector index
- * @param: vector num
- * @ret: vector index
- * @birth: created by czm in 20230321
- */
 int vtkVISManager::GetVectorIndex(int vectorNum)
 {
-    for (int i = 0; i < vectorNumber_; ++i)
-    {
-        if (vectorNum == vectorNumber[i])
-        {
-            return i;
-        }
-    }
-    return -1;
+	for (int i = 0; i < vectorNumber_; ++i)
+	{
+		if (vectorNum == vectorNumber[i])
+		{
+			return i;
+		}
+	}
+	return -1;
 }

+ 11 - 9
CAE_Solution/src/VTK/visualization_VTK/vtkvismanager.h

@@ -1,23 +1,24 @@
-#ifndef VTKVISMANAGER_H
-#define VTKVISMANAGER_H
+#ifndef vtkVISManager_h
+#define vtkVISManager_h
 
 #include <string>
-#include <iostream>
 using namespace std;
+
 #include <vtkObject.h>
-#include <vtkRenderer.h>
-#include <vtkRenderWindow.h>
-#include <vtkObjectFactory.h>
+
+
 
 #define MAXLEVEL 50
+class vtkRenderer;
+class vtkRenderWindow;
 
-class vtkVISManager:public vtkObject
+class  vtkVISManager : public vtkObject
 {
 public:
     static vtkVISManager *New();
+
     vtkVISManager();
     ~vtkVISManager();
-
     void SetDataType(char* type);
     void SetRenderTo(vtkRenderer *ren, vtkRenderWindow *renWin);
     void SetRenderTo(vtkRenderer *ren);
@@ -72,4 +73,5 @@ inline void vtkVISManager::ErrorInfo(bool error, string message)
     }
     //#endif
 }
-#endif // VTKVISMANAGER_H
+
+#endif 

+ 75 - 57
CAE_Solution/src/VTK/visualization_VTK/vtkvismeshbasetovtksource.cpp

@@ -1,37 +1,43 @@
-#include "vtkvismeshbasetovtksource.h"
-#include <vtkUnstructuredGrid.h>
-#include <vtkPoints.h>
-#include <vtkLine.h>
-#include <vtkTriangle.h>
-#include <vtkQuad.h>
-#include <vtkTetra.h>
-#include <vtkPyramid.h>
-#include <vtkWedge.h>
 #include <vtkObjectFactory.h>
-#include <vtkHexahedron.h>
-#include "../mesh/meshbase.h"
-#include "../mesh/meshunstructured.h"
+#include "vtkVISMeshBaseToVTKSource.h"
+#include "../mesh/MeshBase.h"
+#include "../mesh/MeshUnstructured.h"
+#include "vtkUnstructuredGrid.h"
+#include "vtkPoints.h"
+#include "vtkLine.h"
+#include "vtkTriangle.h"
+#include "vtkQuad.h"
+#include "vtkTetra.h"
+#include "vtkPyramid.h"
+#include "vtkWedge.h"
+#include "vtkHexahedron.h"
+
+
 
 vtkStandardNewMacro(vtkVISMeshBaseToVTKSource)
 
-/*
- * @brief: the constructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230324
- */
+/**
+  * @brief the constructor.
+  *
+  * @param[in]
+  * @return
+  * @author zhaoyu
+  * @date 20221122
+  */
 vtkVISMeshBaseToVTKSource::vtkVISMeshBaseToVTKSource()
 {
     unGrid = 0;
     meshType = -1;
 }
 
-/*
- * @brief: the destructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230324
- */
+/**
+  * @brief the destructor.
+  *
+  * @param[in]
+  * @return
+  * @author zhaoyu
+  * @date 20221122
+  */
 vtkVISMeshBaseToVTKSource::~vtkVISMeshBaseToVTKSource()
 {
     if (unGrid != 0)
@@ -40,15 +46,17 @@ vtkVISMeshBaseToVTKSource::~vtkVISMeshBaseToVTKSource()
     }
 }
 
-/*
- * @brief: mesh to vtk(网格转vtk)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230324
- */
+/**
+  * @brief the MeshBae is converted to vtkData
+  *
+  * @param[in] meshBase
+  * @return
+  * @author zhaoyu
+  * @date 20221122
+  */
 void vtkVISMeshBaseToVTKSource::MeshToVTK(MeshBase* mesh)
 {
-    meshType = mesh->GetMeshType();
+    meshType = mesh->GetType();
     if (meshType == -1)//unKnow
     {
     }else if (meshType == 0)//structuredGrid
@@ -59,29 +67,33 @@ void vtkVISMeshBaseToVTKSource::MeshToVTK(MeshBase* mesh)
     }
 }
 
-/*
- * @brief: get type(获取网格类型)
- * @param: void
- * @ret: meshType
- * @birth: created by czm in 20230324
- */
+/**
+  * @brief get mesh type
+  *
+  * @param[in]
+  * @return mesh type
+  * @author zhaoyu
+  * @date 20221122
+  */
 size_t vtkVISMeshBaseToVTKSource::GetType()
 {
     return meshType;
 }
 
-/*
- * @brief: meshbase to unstructuredgrid(mashbase转非结构化网格)
- * @param: meshbase
- * @ret: void
- * @birth: created by czm in 20230324
- */
+/**
+  * @brief the MeshBae is converted to vtkVISUnstructuredGrid
+  *
+  * @param[in] meshBase
+  * @return
+  * @author zhaoyu
+  * @date 20221122
+  */
 void vtkVISMeshBaseToVTKSource::MeshBaseToUnstructuredGrid(MeshBase* mesh)
 {
     unGrid = vtkVISUnstructuredGridSource::New();
     unGrid->unstruGrid = vtkUnstructuredGrid::New();
     vtkPoints* points = vtkPoints::New();
-    Points* pointsDs = mesh->GetPoints();
+    PointsDS* pointsDs = mesh->GetPoints();
     points->SetNumberOfPoints(pointsDs->GetPointNumber());
     for (int i = 0; i < pointsDs->GetPointNumber(); i ++)
     {
@@ -95,7 +107,7 @@ void vtkVISMeshBaseToVTKSource::MeshBaseToUnstructuredGrid(MeshBase* mesh)
     unGrid->unstruGrid->Allocate(ncell,ncell);
     for (int i = 0; i < ncell; i ++)
     {
-        int type = meshUn->GetCell(i)->GetCellType();
+        int type = meshUn->GetCell(i)->GetType();
         if (type == 0)//unknow
         {
 
@@ -171,22 +183,28 @@ void vtkVISMeshBaseToVTKSource::MeshBaseToUnstructuredGrid(MeshBase* mesh)
     points->Delete();
 }
 
-/*
- * @brief: meshbase to structuredgrid(meshbase转结构化网格)
- * @param: meshbase
- * @ret: void
- * @birth: created by czm in 20230324
- */
+/**
+  * @brief the MeshBae is converted to vtkStructuredGrid
+  *
+  * @param[in] meshBase
+  * @return
+  * @author zhaoyu
+  * @date 20221122
+  */
 void vtkVISMeshBaseToVTKSource::MeshBaseToStructuredGrid(MeshBase* mesh)
 {}
 
-/*
- * @brief: get vtkvisUnstructuredGridsource(获取vtk非结构化网格源)
- * @param: void
- * @ret: vtkVisUnstructuredGridsource
- * @birth: created by czm in 20230324
- */
+/**
+  * @brief return vtkVISUnstructuredGrid
+  *
+  * @param[in]
+  * @return unGrid
+  * @author zhaoyu
+  * @date 20221122
+  */
 vtkVISUnstructuredGridSource* vtkVISMeshBaseToVTKSource::GetVtkUnMesh()
 {
     return unGrid;
 }
+
+

+ 10 - 5
CAE_Solution/src/VTK/visualization_VTK/vtkvismeshbasetovtksource.h

@@ -1,17 +1,21 @@
 #ifndef VTKVISMESHBASETOVTKSOURCE_H
 #define VTKVISMESHBASETOVTKSOURCE_H
-#include "vtkvismanager.h"
-#include "../mesh/meshbase.h"
-#include "vtkvisunstructuredgridsource.h"
+
+
+#include "vtkVISManager.h"
+#include "../mesh/MeshBase.h"
+#include "vtkVISUnstructuredGridSource.h"
 #include <iostream>
 #include <vector>
+using namespace std;
+
 
-class vtkVISMeshBaseToVTKSource: public vtkVISManager
+class  vtkVISMeshBaseToVTKSource : public vtkVISManager
 {
 public:
     static vtkVISMeshBaseToVTKSource *New();
-    vtkVISMeshBaseToVTKSource();
 
+    vtkVISMeshBaseToVTKSource();
     virtual ~vtkVISMeshBaseToVTKSource();
 
     void MeshToVTK(MeshBase* mesh);
@@ -31,4 +35,5 @@ private:
     vector<int> scalarType;
 };
 
+
 #endif // VTKVISMESHBASETOVTKSOURCE_H

+ 0 - 294
CAE_Solution/src/VTK/visualization_VTK/vtkvismeshtovtksource.cpp

@@ -1,294 +0,0 @@
-#include "vtkvismeshtovtksource.h"
-#include <vtkObjectFactory.h>
-#include "../mesh/meshunstructured.h"
-#include <vtkUnstructuredGrid.h>
-#include <vtkPoints.h>
-#include <vtkLine.h>
-#include <vtkTriangle.h>
-#include <vtkQuad.h>
-#include <vtkTetra.h>
-#include <vtkPyramid.h>
-#include <vtkWedge.h>
-#include <vtkHexahedron.h>
-#include <vtkIdList.h>
-
-vtkStandardNewMacro(vtkVISMeshToVTKSource)
-
-/*
- * @brief: the constructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230324
- */
-vtkVISMeshToVTKSource::vtkVISMeshToVTKSource()
-{
-    meshType = -1;
-}
-
-/*
- * @brief: the destructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230324
- */
-vtkVISMeshToVTKSource::~vtkVISMeshToVTKSource()
-{
-    if (!unGridVec.empty())
-    {
-        for (int i = 0; i < unGridVec.size(); i ++)
-        {
-            delete unGridVec.at(i);
-        }
-        unGridVec.clear();
-    }
-}
-
-/*
- * @brief: the Mesh is converted to vtkData(网格被转换为vtkData)
- * @param: meshbase
- * @ret: void
- * @birth: created by czm in 20230324
- */
-void vtkVISMeshToVTKSource::MeshToVTK(Mesh* mesh)
-{
-    int num = mesh->GetZoneNumber();
-    for (int i = 0; i <num; i ++)
-    {
-        meshType = mesh->GetZoneMesh(i)->GetMeshType();
-        if (meshType == -1)//unKnow
-        {
-        }else if (meshType == 0)//structuredGrid
-        {
-        }else if (meshType == 1)//unstructuredGrid
-        {
-            MeshBaseToUnstructuredGrid(mesh, i);
-        }
-    }
-}
-
-/*
- * @brief: the Mesh is converted to vtkVISUnstructuredGrid(网格被转换为vtkVisunstructuredGrid)
- * @param: meshbase
- * @ret: void
- * @birth: created by czm in 20230324
- */
-void vtkVISMeshToVTKSource::MeshBaseToUnstructuredGrid(Mesh* mesh, int index)
-{
-    vtkVISUnstructuredGridSource* unGrid = vtkVISUnstructuredGridSource::New();
-    unGrid->unstruGrid = vtkUnstructuredGrid::New();
-    vtkPoints* points = vtkPoints::New();
-    MeshBase* meshSource = mesh->GetZoneMesh(index);
-    Points* pointsDs = meshSource->GetPoints();
-    points->SetNumberOfPoints(pointsDs->GetPointNumber());
-    for (int i = 0; i < pointsDs->GetPointNumber(); i ++)
-    {
-        double xyz[3];
-        pointsDs->GetPoint(i,xyz);
-        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);
-
-    for (int i = 0; i < ncell; i ++)
-    {
-        int type = meshUn->GetCell(i)->GetCellType();
-        if (type == 2)//triangle
-        {
-            vtkIdList* list = vtkIdList::New();
-            list->SetNumberOfIds(3);
-            list->SetId(0,meshUn->GetCell(i)->GetPoint(0));
-            list->SetId(1,meshUn->GetCell(i)->GetPoint(1));
-            list->SetId(2,meshUn->GetCell(i)->GetPoint(2));
-            unGrid->unstruGrid->InsertNextCell(5, list);
-            list->Delete();
-        }else if (type == 3)//quad
-        {
-            vtkIdList* list = vtkIdList::New();
-            list->SetNumberOfIds(4);
-            list->SetId(0,meshUn->GetCell(i)->GetPoint(0));
-            list->SetId(1,meshUn->GetCell(i)->GetPoint(1));
-            list->SetId(2,meshUn->GetCell(i)->GetPoint(2));
-            list->SetId(3,meshUn->GetCell(i)->GetPoint(3));
-            unGrid->unstruGrid->InsertNextCell(9, list);
-            list->Delete();
-        }else if (type == 4)//tetra
-        {
-            vtkIdList* list = vtkIdList::New();
-            list->SetNumberOfIds(4);
-            list->SetId(0,meshUn->GetCell(i)->GetPoint(0));
-            list->SetId(1,meshUn->GetCell(i)->GetPoint(1));
-            list->SetId(2,meshUn->GetCell(i)->GetPoint(2));
-            list->SetId(3,meshUn->GetCell(i)->GetPoint(3));
-            unGrid->unstruGrid->InsertNextCell(10, list);
-            list->Delete();
-        }else if (type == 5)//pyramid
-        {
-            vtkIdList* list = vtkIdList::New();
-            list->SetNumberOfIds(5);
-            list->SetId(0,meshUn->GetCell(i)->GetPoint(0));
-            list->SetId(1,meshUn->GetCell(i)->GetPoint(1));
-            list->SetId(2,meshUn->GetCell(i)->GetPoint(2));
-            list->SetId(3,meshUn->GetCell(i)->GetPoint(3));
-            list->SetId(4,meshUn->GetCell(i)->GetPoint(4));
-            unGrid->unstruGrid->InsertNextCell(14, list);
-            list->Delete();
-        }else if (type == 6)//prism
-        {
-            vtkIdList* list = vtkIdList::New();
-            list->SetNumberOfIds(6);
-            list->SetId(0,meshUn->GetCell(i)->GetPoint(0));
-            list->SetId(1,meshUn->GetCell(i)->GetPoint(1));
-            list->SetId(2,meshUn->GetCell(i)->GetPoint(2));
-            list->SetId(3,meshUn->GetCell(i)->GetPoint(3));
-            list->SetId(4,meshUn->GetCell(i)->GetPoint(4));
-            list->SetId(5,meshUn->GetCell(i)->GetPoint(5));
-            unGrid->unstruGrid->InsertNextCell(13, list);
-            list->Delete();
-        }else if (type == 7)//hexa
-        {
-            vtkIdList* list = vtkIdList::New();
-            list->SetNumberOfIds(8);
-            list->SetId(0,meshUn->GetCell(i)->GetPoint(0));
-            list->SetId(1,meshUn->GetCell(i)->GetPoint(1));
-            list->SetId(2,meshUn->GetCell(i)->GetPoint(2));
-            list->SetId(3,meshUn->GetCell(i)->GetPoint(3));
-            list->SetId(4,meshUn->GetCell(i)->GetPoint(4));
-            list->SetId(5,meshUn->GetCell(i)->GetPoint(5));
-            list->SetId(6,meshUn->GetCell(i)->GetPoint(6));
-            list->SetId(7,meshUn->GetCell(i)->GetPoint(7));
-            unGrid->unstruGrid->InsertNextCell(12, list);
-            list->Delete();
-        }else if (type == 1)//line
-        {
-            vtkIdList* list = vtkIdList::New();
-            list->SetNumberOfIds(2);
-            list->SetId(0,meshUn->GetCell(i)->GetPoint(0));
-            list->SetId(1,meshUn->GetCell(i)->GetPoint(1));
-            unGrid->unstruGrid->InsertNextCell(3, list);
-            list->Delete();
-        }else if (type == 0)//unknow
-        {
-
-        }
-    }
-    points->Delete();
-
-    cout << "make mesh over" << endl;
-
-    //property
-    unGrid->scalarNumber_ = mesh->GetScalarNumber();
-    unGrid->scalarRange = new double*[unGrid->scalarNumber_];
-    unGrid->scalarName = new const char*[unGrid->scalarNumber_];
-    unGrid->scalarSource = new vtkDoubleArray*[unGrid->scalarNumber_];
-    unGrid->cellScalarSource_ = new vtkDoubleArray*[unGrid->scalarNumber_];
-    int pointNum = unGrid->unstruGrid->GetNumberOfPoints();
-    int cellNum = unGrid->unstruGrid->GetNumberOfCells();
-    for (int i = 0; i < unGrid->scalarNumber_; i ++)
-    {
-        unGrid->scalarSource[i] = vtkDoubleArray::New();
-        unGrid->cellScalarSource_[i] = vtkDoubleArray::New();
-    }
-    int share = 0;
-    for (int i = 0; i < unGrid->scalarNumber_+3; i ++)
-    {
-        if (i > 2)
-        {
-            unGrid->scalarRange[i - 3] = new double[2];
-            unGrid->scalarRange[i - 3] = mesh->GetScalarRange().at(index).at(i);
-            string name = mesh->GetScalarName().at(i - 3);
-            char* p = new char[name.size()];
-            for (int j = 0; j < name.size(); j ++)
-                p[j] = mesh->GetScalarName().at(i-3).at(j);
-            unGrid->scalarName[i-3] = p;
-            //cout << p << ": " << unGrid->scalarRange[i - 3][0] << ", " << unGrid->scalarRange[i - 3][1]<<endl;
-        }
-
-        if (mesh->GetScalarShareVec().at(index).at(i) == -1)//unshare
-        {
-            if (mesh->GetZoneScalarType().at(index).at(i) == 0)//pointScalar
-            {
-                if (i > 2)
-                {
-                    unGrid->scalarSource[i-3]->SetNumberOfValues(pointNum);
-                    for (int j = 0; j < pointNum; j ++)
-                    {
-                        unGrid->scalarSource[i - 3]->SetValue(j, mesh->GetScalarData()[index][i-share][j]);
-                    }
-                    unGrid->scalarSource[i-3]->SetName(unGrid->scalarName[i - 3]);
-                }
-            }else if (mesh->GetZoneScalarType().at(index).at(i) == 1)//cellScalar
-            {
-                if (i > 2)
-                {
-                    unGrid->cellScalarSource_[i-3]->SetNumberOfValues(cellNum);
-                    for (int j = 0; j < cellNum; j ++)
-                    {
-                        unGrid->cellScalarSource_[i-3]->SetValue(j, mesh->GetScalarData()[index][i-share][j]);
-                    }
-                    unGrid->cellScalarSource_[i-3]->SetName(unGrid->scalarName[i - 3]);
-                }
-            }
-        }else if (mesh->GetScalarShareVec().at(index).at(i) == 0)//share
-        {
-            if (mesh->GetZoneScalarType().at(index).at(i) == 0)//pointScalar
-            {
-                if (i > 2)
-                {
-                    unGrid->scalarSource[i-3] = unGridVec.at(0)->scalarSource[i-3];
-                }
-                share ++;
-            }else if (mesh->GetZoneScalarType().at(index).at(i+3) == 1)//cellScalar
-            {
-                if (i > 2)
-                {
-                    unGrid->cellScalarSource_[i-3] = unGridVec.at(0)->cellScalarSource_[i-3];
-                }
-                share ++;
-            }
-        }
-    }
-    unGridVec.push_back(unGrid);
-    /*for (int i = 0; i < unGridVec.at(index)->GetScalarNumber(); i ++)
-    {
-        cout << unGridVec.at(index)->GetScalarName(i) << ":  "
-             << unGridVec.at(index)->GetScalarRange(unGridVec.at(index)->GetScalarName(i))[0]
-             << ",   " <<unGridVec.at(index)->GetScalarRange(unGridVec.at(index)->GetScalarName(i))[1]<<endl;
-    }*/
-    cout << "scalarSource over"<<endl;
-}
-
-/*
- * @brief: the Mesh is converted to vtkStructuredGrid(网格被转换为结构化网格)
- * @param: meshbase
- * @ret: void
- * @birth: created by czm in 20230324
- */
-void vtkVISMeshToVTKSource::MeshBaseToStructuredGrid(Mesh* mesh, int i)
-{}
-
-
-/*
- * @brief: get vtkvisunstructuredGrid by index(通过索引获得vtkvisunstructuredGrid)
- * @param: meshbase
- * @ret: void
- * @birth: created by czm in 20230324
- */
-vtkVISUnstructuredGridSource* vtkVISMeshToVTKSource::GetVtkUnMesh(int index)
-{
-    return unGridVec.at(index);
-}
-
-
-/*
- * @brief: get mesh type(获得网格类型)
- * @param: meshbase
- * @ret: void
- * @birth: created by czm in 20230324
- */
-int vtkVISMeshToVTKSource::GetType()
-{
-    return meshType;
-}

+ 0 - 32
CAE_Solution/src/VTK/visualization_VTK/vtkvismeshtovtksource.h

@@ -1,32 +0,0 @@
-#ifndef VTKVISMESHTOVTKSOURCE_H
-#define VTKVISMESHTOVTKSOURCE_H
-#include "vtkvismanager.h"
-#include "../mesh/mesh.h"
-#include "../mesh/meshbase.h"
-#include "vtkvisunstructuredgridsource.h"
-#include <iostream>
-#include <vector>
-using namespace std;
-
-class vtkVISMeshToVTKSource:public vtkVISManager
-{
-public:
-    static vtkVISMeshToVTKSource *New();
-    vtkVISMeshToVTKSource();
-    virtual ~vtkVISMeshToVTKSource();
-
-    void MeshToVTK(Mesh* mesh);
-    void MeshBaseToUnstructuredGrid(Mesh* mesh, int i);
-    void MeshBaseToStructuredGrid(Mesh* mesh, int i);
-    vtkVISUnstructuredGridSource* GetVtkUnMesh(int i);
-    int GetType();
-    //GetVtkMesh();
-
-private:
-    size_t meshType;
-
-    //property
-    vector<vtkVISUnstructuredGridSource*> unGridVec;
-};
-
-#endif // VTKVISMESHTOVTKSOURCE_H

+ 0 - 1614
CAE_Solution/src/VTK/visualization_VTK/vtkvisuncontour.cpp

@@ -1,1614 +0,0 @@
-#include "vtkvisuncontour.h"
-#include <vtkCellDataToPointData.h>
-
-
-vtkStandardNewMacro(vtkVISUnContour)
-
-/*
- * @brief: the constructor
- * @param:
- * @ret:
- * @birth: created by czm in 20230410
- */
-vtkVISUnContour::vtkVISUnContour()
-{
-    contourLookupTable_ = NULL;
-    scalarBarWidget_ = NULL;
-    contourScalarIndex_ = 0;
-    vectorIndex_ = 0;
-    contourLevel_ = 10;
-
-    csdVectorWarp_ = NULL;
-
-    contourType_ = 0;
-    deformation_ = 0;
-    scaleFactor_ = 10.0;
-
-    conFilter_ = NULL;
-
-    scalarRange_[0] = 0;
-    scalarRange_[1] = 0;
-
-    representFlag_ = 1;
-
-    barEnable_ = 1;
-    scalarIndex_ = -1;
-}
-
-/*
- * @brief: the destructor
- * @param:
- * @ret:
- * @birth: created by czm in 20230410
- */
-vtkVISUnContour::~vtkVISUnContour()
-{
-     ErrorInfo(0, "destructure func 0");
-    if(scalarBarWidget_ != NULL)
-    {
-        scalarBarWidget_->Delete();
-        scalarBarWidget_ = NULL;
-    }
-
-    ErrorInfo(0, "destructure func 2");
-    if(csdVectorWarp_ != NULL)
-    {
-        csdVectorWarp_->Delete();
-        csdVectorWarp_ = NULL;
-    }
-
-    if(conFilter_ != NULL)
-    {
-        conFilter_->Delete();
-        conFilter_ = NULL;
-    }
-    //delete [] _vtkObjects;
-}
-
-/*
- * @brief: create contour display(创建等高线显示)
- * @param: scalar
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::CreateContourDisplay(char* scalarName)
-{
-    deformation_ = 0;
-    bool pointOrCell = true;
-
-    int scalarIndex = _source->GetScalarIndex(scalarName);
-
-    if (scalarIndex == -1)
-    {
-        ErrorInfo(1, "Scalar not exists, can't create contour.");
-        return;
-    }
-
-
-    if (_source->scalarSource[scalarIndex] == NULL)
-    {
-        ErrorInfo(1, "This Scalar Source is not exists, Please Load it First!");
-        return;
-    }
-
-    scalarIndex_ = scalarIndex;
-    scalarRange_[0] = _source->scalarRange[scalarIndex][0];
-    scalarRange_[1] = _source->scalarRange[scalarIndex][1];
-
-    vtkUnstructuredGrid *unGrid = vtkUnstructuredGrid::New();
-    unGrid->DeepCopy(_source->unstruGrid);
-    if (_source->scalarSource[scalarIndex]->GetDataSize() != 0)
-    {
-        pointOrCell = true;
-        (unGrid->GetPointData())->SetScalars(_source->scalarSource[scalarIndex]);
-    }
-    else
-    {
-        pointOrCell = false;
-        (unGrid->GetCellData())->SetScalars(_source->cellScalarSource_[scalarIndex]);
-    }
-    unGrid->Modified();
-
-    vtkCellDataToPointData* ctop = vtkCellDataToPointData::New();
-    if (!pointOrCell)
-    {
-
-        ctop->SetInputData(unGrid);
-        ctop->PassCellDataOn();
-        ctop->Update();
-    }
-
-    vtkGeometryFilter *geoFilter = vtkGeometryFilter::New();
-    if(pointOrCell)
-    {
-        geoFilter->SetInputData(unGrid);
-    }else
-    {
-        geoFilter->SetInputData(ctop->GetOutput());
-    }
-    //geoFilter->SetInputData(unGrid);
-
-    geoFilter->Modified();
-    geoFilter->Update();
-
-    vtkWarpVector* warp = vtkWarpVector::New();
-    warp->SetInputConnection(geoFilter->GetOutputPort());
-    warp->SetScaleFactor(scaleFactor_);
-    warp->Modified();
-
-    vtkContourFilter *conFilter = vtkContourFilter::New();
-    if (deformation_ == 0)
-    {
-        conFilter->SetInputData(geoFilter->GetOutput());
-    }
-    else if (deformation_ == 1)
-    {
-        conFilter->SetInputData(warp->GetOutput());
-    }
-    conFilter->GenerateValues(contourLevel_, _source->scalarRange[scalarIndex][0], _source->scalarRange[scalarIndex][1]);
-
-    vtkBandedPolyDataContourFilter *bConFilter = vtkBandedPolyDataContourFilter::New();
-    if (deformation_ == 0)
-    {
-        //cout<<"test no deformation: "<<(geoFilter->GetOutput())->GetNumberOfPoints()<<endl;
-
-        geoFilter->Modified();
-
-        bConFilter->SetInputConnection(geoFilter->GetOutputPort());
-    }
-    else if (deformation_ == 1)
-    {
-        bConFilter->SetInputData(warp->GetOutput());
-    }
-    bConFilter->GenerateValues(contourLevel_, _source->scalarRange[scalarIndex][0], _source->scalarRange[scalarIndex][1]);
-    bConFilter->ClippingOff();
-    bConFilter->Modified();
-    bConFilter->Update();
-
-    //cout<<"test contourFilter:; "<<(bConFilter->GetOutput())->GetNumberOfPoints()<<endl;
-
-    vtkDataSetMapper *mapper = vtkDataSetMapper::New();
-    if(_source->scalarRange[scalarIndex][0] == _source->scalarRange[scalarIndex][1])
-    {
-        mapper->SetInputConnection(geoFilter->GetOutputPort());
-    }
-    else
-    {
-        if(contourType_ == 2)
-        {
-            mapper->SetInputConnection(conFilter->GetOutputPort());
-        }
-        else
-        {
-            if (deformation_ == 0)
-            {
-                mapper->SetInputConnection(bConFilter->GetOutputPort());
-            }
-            else if (deformation_ == 1)
-            {
-                mapper->SetInputConnection(warp->GetOutputPort());
-            }
-        }
-    }
-    mapper->InterpolateScalarsBeforeMappingOn();
-    mapper->SetScalarRange(_source->scalarRange[scalarIndex][0], _source->scalarRange[scalarIndex][1]);
-
-    mapper->SetScalarModeToUsePointData();
-
-    double range[2];
-    vtkLookupTable *lut = (vtkLookupTable*)(mapper->GetLookupTable());
-    lut->GetHueRange(range);
-    lut->SetHueRange(range[1], range[0]);
-    lut->SetRange(_source->scalarRange[scalarIndex][0], _source->scalarRange[scalarIndex][1]);
-    if(contourType_ == 1)
-    {
-        lut->SetNumberOfColors(256);
-    }
-    else
-    {
-        lut->SetNumberOfColors(contourLevel_);
-    }
-
-
-    vtkActor *actor = vtkActor::New();
-    actor->SetMapper(mapper);
-
-    if(representFlag_ == 0)
-    {
-        (actor->GetProperty())->SetRepresentationToPoints();
-    }
-    else if(representFlag_ == 1)
-    {
-        (actor->GetProperty())->SetRepresentationToSurface();
-    }
-    else if (representFlag_ == 2)
-    {
-        (actor->GetProperty())->SetRepresentationToWireframe();
-    }
-
-
-    if (_renderer != NULL)
-    {
-        _renderer->AddActor(actor);
-    }
-
-    contourScalarIndex_ = scalarIndex;
-    contourLookupTable_ = lut;
-
-    conFilter_ = bConFilter;
-    _unActor = actor;
-
-    _vtkObjectsNum = 6;
-    _vtkObjects = new vtkObject*[_vtkObjectsNum];
-    _vtkObjects[0] = unGrid;
-    _vtkObjects[1] = geoFilter;
-    _vtkObjects[2] = conFilter;
-    _vtkObjects[3] = lut;
-    _vtkObjects[4] = mapper;
-    _vtkObjects[5] = warp;
-}
-
-/*
- * @brief: create contour display(创建等高线显示)
- * @param: scalar,vector
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::CreateContourDisplay(char* scalarName,char* vectorName)
-{
-    int scalarIndex = _source->GetScalarIndex(scalarName);
-    int vectorIndex = -1;
-
-    if (! string(vectorName).empty ())
-    {
-        vectorIndex = _source->GetVectorIndex(vectorName);
-    }
-
-    if (scalarIndex == -1)
-    {
-        ErrorInfo(1, "Scalar not exists, can't create contour.");
-        return;
-    }
-
-    if (_source->scalarSource[scalarIndex] == NULL)
-    {
-        ErrorInfo(1, "This Scalar Source is not exists, Please Load it First!");
-        return;
-    }
-
-    scalarIndex_ = scalarIndex;
-    scalarRange_[0] = _source->scalarRange[scalarIndex][0];
-    scalarRange_[1] = _source->scalarRange[scalarIndex][1];
-
-    int num = _source->scalarSource[scalarIndex]->GetDataSize();
-
-    vtkUnstructuredGrid *unGrid = vtkUnstructuredGrid::New();
-        unGrid->DeepCopy(_source->unstruGrid);
-
-        if (num != 0)
-        {
-            (unGrid->GetPointData())->SetScalars(_source->scalarSource[scalarIndex]);
-        }
-        else
-        {
-            (unGrid->GetCellData())->SetScalars(_source->cellScalarSource_[scalarIndex]);
-        }
-
-        if (vectorIndex != -1)
-        {
-            if( _source->vectorSource[vectorIndex]->GetDataSize() != 0)
-            {
-                (unGrid->GetPointData())->SetVectors(_source->vectorSource[vectorIndex]);
-            }
-            else
-            {
-                (unGrid->GetCellData())->SetVectors(_source->cellVectorSource_[vectorIndex]);
-            }
-        }
-        unGrid->Modified();
-
-        vtkCellDataToPointData* ctop = vtkCellDataToPointData::New();
-        if (num == 0)
-        {
-            ctop->SetInputData(unGrid);
-            ctop->PassCellDataOn();
-            ctop->Update();
-        }
-
-        vtkGeometryFilter *geoFilter = vtkGeometryFilter::New();
-        if(num != 0)
-        {
-            geoFilter->SetInputData(unGrid);
-        }else
-        {
-            geoFilter->SetInputData(ctop->GetOutput());
-        }
-
-    vtkWarpVector* warp = vtkWarpVector::New();
-        warp->SetInputConnection(geoFilter->GetOutputPort());
-        warp->SetScaleFactor(scaleFactor_);
-        warp->Update();
-
-
-    vtkContourFilter *conFilter = vtkContourFilter::New();
-        if (deformation_ == 0)
-        {
-            conFilter->SetInputData(geoFilter->GetOutput());
-        }
-        else if (deformation_ == 1)
-        {
-            conFilter->SetInputData(warp->GetOutput());
-        }
-        conFilter->GenerateValues(contourLevel_, _source->scalarRange[scalarIndex][0], _source->scalarRange[scalarIndex][1]);
-        conFilter->Modified();
-
-    vtkBandedPolyDataContourFilter *bConFilter = vtkBandedPolyDataContourFilter::New();
-        if (deformation_ == 0)
-        {
-            bConFilter->SetInputData(geoFilter->GetOutput());
-        }
-        else if (deformation_ == 1)
-        {
-
-            bConFilter->SetInputData(warp->GetOutput());
-        }
-        bConFilter->GenerateValues(contourLevel_, _source->scalarRange[scalarIndex][0], _source->scalarRange[scalarIndex][1]);
-        bConFilter->ClippingOn();
-        bConFilter->Modified();
-
-    vtkDataSetMapper *mapper = vtkDataSetMapper::New();
-    if(_source->scalarRange[scalarIndex][0] == _source->scalarRange[scalarIndex][1])
-    {
-        mapper->SetInputConnection(geoFilter->GetOutputPort());
-    }
-    else
-    {
-        if(contourType_ == 2)
-        {
-            mapper->SetInputConnection(conFilter->GetOutputPort());
-        }
-        else
-        {
-            if (deformation_ == 0)
-            {
-                mapper->SetInputConnection(bConFilter->GetOutputPort());
-            }
-            else if (deformation_ == 1)
-            {
-                mapper->SetInputConnection(warp->GetOutputPort());
-            }
-        }
-    }
-    mapper->InterpolateScalarsBeforeMappingOn();
-        mapper->SetScalarRange(_source->scalarRange[scalarIndex][0], _source->scalarRange[scalarIndex][1]);
-        mapper->SetScalarModeToUsePointData();
-
-    double range[2];
-    vtkLookupTable *lut = (vtkLookupTable*)(mapper->GetLookupTable());
-        lut->GetHueRange(range);
-        lut->SetHueRange(range[1], range[0]);
-        lut->SetRange(_source->scalarRange[scalarIndex][0], _source->scalarRange[scalarIndex][1]);
-        if(contourType_ == 1)
-        {
-            lut->SetNumberOfColors(256);
-        }
-        else
-        {
-            lut->SetNumberOfColors(contourLevel_);
-        }
-
-    vtkActor *actor = vtkActor::New();
-        actor->SetMapper(mapper);
-
-        if(representFlag_ == 0)
-        {
-            (actor->GetProperty())->SetRepresentationToPoints();
-        }
-        else if(representFlag_ == 1)
-        {
-            (actor->GetProperty())->SetRepresentationToSurface();
-        }
-        else if (representFlag_ == 2)
-        {
-            (actor->GetProperty())->SetRepresentationToWireframe();
-        }
-
-
-    if (_renderer != NULL)
-    {
-        _renderer->AddActor(actor);
-    }
-
-    contourScalarIndex_ = scalarIndex;
-    vectorIndex_ = vectorIndex;
-    contourLookupTable_ = lut;
-
-    conFilter_ = bConFilter;
-    _unActor = actor;
-
-    _vtkObjectsNum = 6;
-    _vtkObjects = new vtkObject*[_vtkObjectsNum];
-    _vtkObjects[0] = unGrid;
-    _vtkObjects[1] = geoFilter;
-    _vtkObjects[2] = conFilter;
-    _vtkObjects[3] = lut;
-    _vtkObjects[4] = mapper;
-    _vtkObjects[5] = warp;
-}
-
-/*
- * @brief: modify contour display type(修改轮廓显示类型)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::ModifyContourDisplayType()
-{
-    if (_vtkObjects == NULL)
-    {
-        ErrorInfo(1, "Contour Display Not Created.");
-        return;
-    }
-
-    ((vtkUnstructuredGrid*)_vtkObjects[0])->Modified();
-    ((vtkGeometryFilter*)_vtkObjects[1])->Modified();
-
-    if(contourType_ == 2)
-    {
-        if (deformation_ == 0)
-        {
-            ((vtkContourFilter*)_vtkObjects[2])->SetInputConnection(((vtkGeometryFilter*)_vtkObjects[1])->GetOutputPort());
-        }
-        else
-        {
-            ((vtkContourFilter*)_vtkObjects[2])->SetInputConnection(((vtkWarpVector*)_vtkObjects[5])->GetOutputPort());
-        }
-        ((vtkContourFilter*)_vtkObjects[2])->GenerateValues(contourLevel_, _source->scalarRange[contourScalarIndex_][0], _source->scalarRange[contourScalarIndex_][1]);
-        ((vtkContourFilter*)_vtkObjects[2])->Modified();
-
-        ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(((vtkContourFilter*)_vtkObjects[2])->GetOutputPort());
-    }
-    else
-    {
-        if (deformation_ == 0)
-        {
-            conFilter_->SetInputConnection(((vtkGeometryFilter*)_vtkObjects[1])->GetOutputPort());
-            conFilter_->Modified();
-
-            ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(conFilter_->GetOutputPort());
-        }
-        else
-        {
-            ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(((vtkWarpVector*)_vtkObjects[5])->GetOutputPort());
-        }
-    }
-    ((vtkDataSetMapper*)_vtkObjects[4])->Modified();
-
-    if(contourType_ == 1)
-    {
-        ((vtkLookupTable*)_vtkObjects[3])->SetNumberOfColors(256);
-    }
-    else
-    {
-        ((vtkLookupTable*)_vtkObjects[3])->SetNumberOfColors(contourLevel_);
-    }
-    ((vtkLookupTable*)_vtkObjects[3])->Modified();
-
-    if(representFlag_ == 0)
-    {
-        (_unActor->GetProperty())->SetRepresentationToPoints();
-    }
-    else if(representFlag_ == 1)
-    {
-        (_unActor->GetProperty())->SetRepresentationToSurface();
-    }
-    else if (representFlag_ == 2)
-    {
-        (_unActor->GetProperty())->SetRepresentationToWireframe();
-    }
-    _unActor->Modified();
-}
-
-/*
- * @brief: modify contour display(修改轮廓显示)
- * @param: scalar
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::ModifyContourDisplay(char* scalarName)
-{
-    DeleteObjects();
-    CreateContourDisplay(scalarName);
-    /*char* vectorName = NULL;
-    int vectorIndex = -1;
-
-    if (_vtkObjects != NULL)
-    {
-        int scalarIndex = _source->GetScalarIndex(scalarName);
-//        if (! string(vectorName).empty ())
-//        {
-//            vectorIndex = _source->GetVectorIndex(vectorName);
-//        }
-        if (scalarIndex == -1)
-        {
-            return;
-        }
-
-        contourScalarIndex_ = scalarIndex;
-        vectorIndex_ = -1;
-
-        if (_source->scalarSource[scalarIndex] == NULL)
-        {
-            ErrorInfo(1, "This Scalar Source is not exists, Please Load it First!");
-            return;
-        }
-    int num = _source->scalarSource[scalarIndex]->GetDataSize();
-
-        if (num != 0)
-        {
-            ((vtkUnstructuredGrid*)_vtkObjects[0])->GetPointData()->SetScalars(_source->scalarSource[scalarIndex]);
-        }
-        else
-        {
-            ((vtkUnstructuredGrid*)_vtkObjects[0])->GetCellData()->SetScalars(_source->cellScalarSource_[scalarIndex]);
-        }
-
-    if (vectorIndex != -1)
-        {
-        if(num != 0)
-        {
-        ((vtkUnstructuredGrid*)_vtkObjects[0])->GetPointData()->SetVectors(_source->vectorSource[vectorIndex]);
-        }
-        else
-        {
-        ((vtkUnstructuredGrid*)_vtkObjects[0])->GetCellData()->SetVectors(_source->cellVectorSource_[vectorIndex]);
-        }
-    }
-    scalarRange_[0] = _source->scalarRange[scalarIndex][0];
-    scalarRange_[1] = _source->scalarRange[scalarIndex][1];
-
-    ((vtkUnstructuredGrid*)_vtkObjects[0])->Modified();
-    ((vtkGeometryFilter*)_vtkObjects[1])->Modified();
-    if (deformation_ == 1)
-    {
-        ((vtkWarpVector*)_vtkObjects[5])->SetInputConnection(((vtkGeometryFilter*)_vtkObjects[1])->GetOutputPort());
-        ((vtkWarpVector*)_vtkObjects[5])->SetScaleFactor(scaleFactor_);
-        ((vtkWarpVector*)_vtkObjects[5])->Modified ();
-    }
-
-        if(contourType_ == 2)
-        {
-            if (deformation_ == 0)
-            {
-                ((vtkContourFilter*)_vtkObjects[2])->SetInputData(((vtkGeometryFilter*)_vtkObjects[1])->GetOutput());
-            }
-            else
-            {
-                ((vtkContourFilter*)_vtkObjects[2])->SetInputData(((vtkWarpVector*)_vtkObjects[5])->GetOutput());
-            }
-            ((vtkContourFilter*)_vtkObjects[2])->GenerateValues(contourLevel_, _source->scalarRange[scalarIndex][0], _source->scalarRange[scalarIndex][1]);
-            ((vtkContourFilter*)_vtkObjects[2])->Modified();
-            ((vtkContourFilter*)_vtkObjects[2])->Update();
-
-            if(_source->scalarRange[scalarIndex][0]==_source->scalarRange[scalarIndex][1])
-            {
-               ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(((vtkGeometryFilter*)_vtkObjects[1])->GetOutputPort());
-            }
-            else
-            {
-               ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(((vtkContourFilter*)_vtkObjects[2])->GetOutputPort());
-            }
-            ((vtkDataSetMapper*)_vtkObjects[4])->Modified();
-
-        }
-        else
-        {
-            conFilter_->SetInputData(((vtkGeometryFilter*)_vtkObjects[1])->GetOutput());
-            conFilter_->GenerateValues(contourLevel_, _source->scalarRange[scalarIndex][0], _source->scalarRange[scalarIndex][1]);
-            conFilter_->Modified();
-
-            if(_source->scalarRange[scalarIndex][0]==_source->scalarRange[scalarIndex][1])
-            {
-               ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(((vtkGeometryFilter*)_vtkObjects[1])->GetOutputPort());
-            }
-            else
-            {
-            if (deformation_ == 0)
-            {
-                ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(conFilter_->GetOutputPort());
-            }
-            else
-            {
-                ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(((vtkWarpVector*)_vtkObjects[5])->GetOutputPort());
-            }
-            }
-        }
-        ((vtkDataSetMapper*)_vtkObjects[4])->SetScalarModeToUsePointData();
-
-        ((vtkDataSetMapper*)_vtkObjects[4])->SetScalarRange(_source->scalarRange[scalarIndex][0], _source->scalarRange[scalarIndex][1]);
-        ((vtkDataSetMapper*)_vtkObjects[4])->Modified();
-
-
-        if(representFlag_ == 0)
-        {
-            (_unActor->GetProperty())->SetRepresentationToPoints();
-        }
-        else if(representFlag_ == 1)
-        {
-            (_unActor->GetProperty())->SetRepresentationToSurface();
-        }
-        else if (representFlag_ == 2)
-        {
-            (_unActor->GetProperty())->SetRepresentationToWireframe();
-        }
-
-        _unActor->Modified();
-
-        string temp = scalarName;
-        int length = temp.length();
-        string::size_type loc = temp.find( " ", 0 );
-        if( loc != string::npos ) {
-            temp.insert (loc,"\n");
-        }
-        string::size_type loc1 = temp.find_last_of( "-", length );
-        if( loc1 != string::npos ) {
-            temp.insert (loc1+1,"\n");
-        }
-        string::size_type loc2 = temp.find_last_of( "*", length );
-        if( loc2 != string::npos ) {
-            temp.insert (loc2+1,"\n");
-        }
-
-        if (scalarBarWidget_ != NULL)
-        {
-            for (int s = temp.size(); s < 10; ++s)  temp.append(" "); //add space to reduce font
-            scalarBarWidget_->GetScalarBarActor()->SetTitle(temp.c_str ());
-        }
-    }
-    else
-    {
-        ErrorInfo(1, "Contour Display Not Created.");
-        return;
-    }*/
-}
-
-/*
- * @brief: modify ontour display(修改等高线显示)
- * @param: scalar vector
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::ModifyContourDisplay(char* scalarName,char* vectorName)
-{
-    int vectorIndex = -1;
-
-    if (_vtkObjects != NULL)
-    {
-        int scalarIndex = _source->GetScalarIndex(scalarName);
-
-        if (! string(vectorName).empty ())
-        {
-           vectorIndex = _source->GetVectorIndex(vectorName);
-        }
-
-        if (scalarIndex == -1)
-        {
-            return;
-        }
-
-        contourScalarIndex_ = scalarIndex;
-
-        scalarRange_[0] = _source->scalarRange[scalarIndex][0];
-        scalarRange_[1] = _source->scalarRange[scalarIndex][1];
-
-        int num = _source->scalarSource[scalarIndex]->GetDataSize();
-
-        if (_source->scalarSource[scalarIndex] == NULL)
-        {
-            ErrorInfo(1, "This Scalar Source is not exists, Please Load it First!");
-            return;
-        }
-
-        if (num != 0)
-        {
-            ((vtkUnstructuredGrid*)_vtkObjects[0])->GetPointData()->SetScalars(_source->scalarSource[scalarIndex]);
-        }
-        else
-        {
-            ((vtkUnstructuredGrid*)_vtkObjects[0])->GetCellData()->SetScalars(_source->cellScalarSource_[scalarIndex]);
-        }
-
-        if (vectorIndex != -1)
-        {
-            vectorIndex_ = vectorIndex;
-
-            if(_source->vectorSource[vectorIndex]->GetDataSize() != 0)
-            {
-                ((vtkUnstructuredGrid*)_vtkObjects[0])->GetPointData()->SetVectors(_source->vectorSource[vectorIndex]);
-            }
-            else
-            {
-                ((vtkUnstructuredGrid*)_vtkObjects[0])->GetCellData()->SetVectors(_source->cellVectorSource_[vectorIndex]);
-            }
-        }
-
-        ((vtkUnstructuredGrid*)_vtkObjects[0])->Modified();
-        ((vtkGeometryFilter*)_vtkObjects[1])->Modified();
-
-
-        if (deformation_ == 1)
-        {
-            ((vtkWarpVector*)_vtkObjects[5])->SetInputConnection(((vtkGeometryFilter*)_vtkObjects[1])->GetOutputPort());
-            ((vtkWarpVector*)_vtkObjects[5])->SetScaleFactor(scaleFactor_);
-            ((vtkWarpVector*)_vtkObjects[5])->Modified ();
-        }
-
-        if(contourType_ == 2)
-        {
-            if (deformation_ == 0)
-            {
-                ((vtkContourFilter*)_vtkObjects[2])->SetInputData(((vtkGeometryFilter*)_vtkObjects[1])->GetOutput());
-            }
-            else
-            {
-                ((vtkContourFilter*)_vtkObjects[2])->SetInputData(((vtkWarpVector*)_vtkObjects[5])->GetOutput());
-            }
-            ((vtkContourFilter*)_vtkObjects[2])->GenerateValues(contourLevel_, _source->scalarRange[scalarIndex][0], _source->scalarRange[scalarIndex][1]);
-            ((vtkContourFilter*)_vtkObjects[2])->Modified();
-            ((vtkContourFilter*)_vtkObjects[2])->Update();
-
-            if(_source->scalarRange[scalarIndex][0]==_source->scalarRange[scalarIndex][1])
-            {
-               ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(((vtkGeometryFilter*)_vtkObjects[1])->GetOutputPort());
-            }
-            else
-            {
-               ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(((vtkContourFilter*)_vtkObjects[2])->GetOutputPort());
-            }
-            ((vtkDataSetMapper*)_vtkObjects[4])->Modified();
-
-        }
-        else
-        {
-            conFilter_->SetInputData(((vtkGeometryFilter*)_vtkObjects[1])->GetOutput());
-            conFilter_->GenerateValues(contourLevel_, _source->scalarRange[scalarIndex][0], _source->scalarRange[scalarIndex][1]);
-            conFilter_->Modified();
-
-            if(_source->scalarRange[scalarIndex][0]==_source->scalarRange[scalarIndex][1])
-            {
-               ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(((vtkGeometryFilter*)_vtkObjects[1])->GetOutputPort());
-            }
-            else
-            {
-            if (deformation_ == 0)
-            {
-                ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(conFilter_->GetOutputPort());
-            }
-            else
-            {
-                ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(((vtkWarpVector*)_vtkObjects[5])->GetOutputPort());
-            }
-            }
-        }
-        ((vtkDataSetMapper*)_vtkObjects[4])->SetScalarModeToUsePointData();
-
-        ((vtkDataSetMapper*)_vtkObjects[4])->SetScalarRange(_source->scalarRange[scalarIndex][0], _source->scalarRange[scalarIndex][1]);
-        ((vtkDataSetMapper*)_vtkObjects[4])->Modified();
-
-        if(representFlag_ == 0)
-        {
-            (_unActor->GetProperty())->SetRepresentationToPoints();
-        }
-        else if(representFlag_ == 1)
-        {
-            (_unActor->GetProperty())->SetRepresentationToSurface();
-        }
-        else if (representFlag_ == 2)
-        {
-            (_unActor->GetProperty())->SetRepresentationToWireframe();
-        }
-
-        _unActor->Modified();
-
-        string temp = scalarName;
-        int length = temp.length();
-        string::size_type loc = temp.find( " ", 0 );
-        if( loc != string::npos )
-        {
-            temp.insert (loc,"\n");
-        }
-        string::size_type loc1 = temp.find_last_of( "-", length );
-        if( loc1 != string::npos )
-        {
-            temp.insert (loc1+1,"\n");
-        }
-        string::size_type loc2 = temp.find_last_of( "*", length );
-        if( loc2 != string::npos )
-        {
-            temp.insert (loc2+1,"\n");
-        }
-
-        if (scalarBarWidget_ != NULL)
-        {
-            scalarBarWidget_->GetScalarBarActor()->SetTitle(temp.c_str());
-        }
-    }
-    else
-    {
-        ErrorInfo(1, "Contour Display Not Created.");
-        return;
-    }
-}
-
-/*
- * @brief: create scalar bar(创建缩放栏)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::CreateScalarBar()
-{
-    string temp = _source->GetScalarName(contourScalarIndex_);
-    int length = temp.length();
-    string::size_type loc = temp.find( " ", 0 );
-    if( loc != string::npos ) {
-        temp.insert (loc,"\n");
-    }
-    string::size_type loc1 = temp.find_last_of( "-", length );
-    if( loc1 != string::npos ) {
-        temp.insert (loc1+1,"\n");
-    }
-    string::size_type loc2 = temp.find_last_of( "*", length );
-    if( loc2 != string::npos ) {
-        temp.insert (loc2+1,"\n");
-    }
-
-    vtkScalarBarActor *barActor = vtkScalarBarActor::New();
-    if(contourLevel_<10)
-    {
-        barActor->SetNumberOfLabels(contourLevel_);
-    }
-    else
-    {
-        barActor->SetNumberOfLabels(10);
-    }
-        barActor->SetOrientationToVertical();
-        for (int s = temp.size(); s < 10; ++s)  temp.append(" ");   //add space to reduce font
-        barActor->SetTitle(temp.c_str());
-        barActor->SetLabelFormat("%1.2E");
-
-        barActor->GetTitleTextProperty()->SetFontFamilyToArial();
-        barActor->GetTitleTextProperty()->SetFontSize(6);
-        barActor->GetTitleTextProperty()->SetColor(0, 0, 0);
-        barActor->GetTitleTextProperty()->ItalicOff();
-
-        barActor->GetLabelTextProperty()->SetFontFamilyToArial();
-        barActor->GetLabelTextProperty()->SetFontSize(5);
-        barActor->GetLabelTextProperty()->SetColor(0, 0, 0);
-        barActor->GetLabelTextProperty()->ItalicOff();
-        barActor->SetLookupTable((vtkScalarsToColors*)contourLookupTable_);
-
-    vtkScalarBarRepresentation* rep = vtkScalarBarRepresentation::New();
-        rep->SetPosition(0.8, 0.1);
-        rep->SetPosition2(0.08, 0.8);
-        //rep->SetMaximumSize(10, 50);
-        rep->ProportionalResizeOff();
-        rep->SetScalarBarActor(barActor);
-
-    vtkScalarBarWidget *barWidget = vtkScalarBarWidget::New();
-    _renWin = _renderer->GetRenderWindow();
-        barWidget->SetInteractor(_renWin->GetInteractor());
-        barWidget->SetRepresentation(rep);
-        if(barEnable_ == 1)
-        {
-            barWidget->EnabledOn();
-        }
-        else
-        {
-            barWidget->EnabledOff();
-        }
-
-    scalarBarWidget_ = barWidget;
-    scalarBarWidget_->On();
-}
-
-/*
- * @brief: show on scalar bar(显示缩放栏)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::ShowOnScalarBar()
-{
-    if (scalarBarWidget_!=NULL)
-    {
-        barEnable_ = 1;
-
-        scalarBarWidget_->EnabledOn();
-    }
-}
-
-/*
- * @brief: show off scalar bar(关闭缩放栏)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::ShowOffScalarBar()
-{
-    if (scalarBarWidget_!=NULL)
-    {
-        barEnable_ = 0;
-
-        scalarBarWidget_->EnabledOff();
-    }
-}
-
-/*
- * @brief: update scalar bar(更新缩放栏)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::UpdataScalarBar()
-{
-    if (scalarBarWidget_==NULL)
-    {
-        CreateScalarBar();
-    }else
-    {
-        vtkScalarBarActor *barActor=scalarBarWidget_->GetScalarBarActor();
-        barActor->SetLookupTable((vtkScalarsToColors*)contourLookupTable_);
-    }
-}
-
-/*
- * @brief: modify scalar bar font(修改缩放栏字体)
- * @param: font
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::ModifyScalarBarFont(char* fontName)
-{
-    if (scalarBarWidget_!=NULL)
-    {
-        vtkScalarBarActor *barActor=scalarBarWidget_->GetScalarBarActor();
-
-        if (strcmp(fontName,"Arial")==0)
-        {
-            barActor->GetTitleTextProperty()->SetFontFamilyToArial();
-            barActor->GetLabelTextProperty()->SetFontFamilyToArial();
-        }
-        else if (strcmp(fontName,"Courier")==0)
-        {
-            barActor->GetTitleTextProperty()->SetFontFamilyToCourier();
-            barActor->GetLabelTextProperty()->SetFontFamilyToCourier();
-        }
-        else if (strcmp(fontName,"Times")==0)
-        {
-            barActor->GetTitleTextProperty()->SetFontFamilyToTimes();
-            barActor->GetLabelTextProperty()->SetFontFamilyToTimes();
-        }
-    }
-}
-
-/*
- * @brief: modify scalar bar color(修改缩放栏字体颜色)
- * @param: rgb
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::ModifyScalarBarFontColor(double r, double g, double b)
-{
-    if (scalarBarWidget_!=NULL)
-    {
-        vtkScalarBarActor *barActor=scalarBarWidget_->GetScalarBarActor();
-        barActor->GetTitleTextProperty()->SetColor(r, g, b);
-        barActor->GetLabelTextProperty()->SetColor(r, g, b);
-    }
-}
-
-/*
- * @brief: modify scalar bar title(修改缩放栏标题)
- * @param: title
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::ModifyScalarBarTitle(char *title)
-{
-    if (scalarBarWidget_!=NULL)
-    {
-        scalarBarWidget_->GetScalarBarActor()->SetTitle(title);
-        scalarBarWidget_->GetScalarBarActor()->GetTitleTextProperty()->SetFontSize(6);
-        scalarBarWidget_->GetScalarBarActor()->GetTitleTextProperty()->ItalicOff();
-    }
-}
-
-/*
- * @brief: delete scalar bar(删除缩放栏)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::DeleteScalarBar()
-{
-    if (scalarBarWidget_!=NULL)
-    {
-        scalarBarWidget_->Delete();
-        scalarBarWidget_=NULL;
-    }
-}
-
-/*
- * @brief: modify contour level (修改等高线标高)
- * @param: level
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::ModifyContourLevel(int level)
-{
-    if (level < 2)
-    {
-        ErrorInfo(0, "Contour Level must be within range: 2 to 50!, Using the Min Level 2 insteading!");
-
-        level = 2;
-    }
-    if(level>MAXLEVEL)
-    {
-        ErrorInfo(0, "Contour Level must be within range: 2 to 50!, Using the Max Level 50 insteading!");
-
-        level = MAXLEVEL;
-    }
-
-    contourLevel_ = level;
-
-    if(contourType_ == 2)
-    {
-        ((vtkContourFilter*)_vtkObjects[2])->GenerateValues(contourLevel_, scalarRange_[0], scalarRange_[1]);
-        ((vtkContourFilter*)_vtkObjects[2])->Modified();
-    }
-    else
-    {
-        conFilter_->GenerateValues(contourLevel_, scalarRange_[0], scalarRange_[1]);
-        conFilter_->Modified();
-    }
-
-    if (contourLookupTable_ != NULL)
-    {
-        if(contourType_ == 1)
-        {
-            contourLookupTable_->SetNumberOfColors(256);
-        }
-        else
-        {
-            contourLookupTable_->SetNumberOfColors(level);
-        }
-        contourLookupTable_->Modified();
-    }
-    if (scalarBarWidget_!=NULL)
-    {
-        if(level<10)
-        {
-            scalarBarWidget_->GetScalarBarActor()->SetNumberOfLabels(level);
-        }
-        else
-        {
-            scalarBarWidget_->GetScalarBarActor()->SetNumberOfLabels(10);
-        }
-    }
-}
-
-/*
- * @brief: set contour type (修改等高线类型)
- * @param: type
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::SetContourType(int type)
-{
-    this->contourType_ = type;
-}
-
-/*
- * @brief: set deformation (设置变形)
- * @param: flag
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::SetDeformation(int flag)
-{
-    this->deformation_ = flag;
-
-    //cout<<"test flag::" << deformation_<<endl;
-}
-
-/*
- * @brief: Modify Scale Factor (修改缩放因子)
- * @param: value
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::ModifyScaleFactor(double value)
-{
-    if ( _vtkObjects[5] != NULL )
-    {
-        scaleFactor_ = value;
-        ((vtkWarpVector*)_vtkObjects[5])->SetScaleFactor(scaleFactor_);
-        ((vtkWarpVector*)_vtkObjects[5])->Modified();
-    }
-}
-
-/*
- * @brief: Modify Contour Representation (修改轮廓表示)
- * @param: flag
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::ModifyContourRepresentation(int flag)
-{
-    if ( _unActor != NULL )
-    {
-        if (flag == 0)
-        {
-            representFlag_ = 0;
-
-            (_unActor->GetProperty())->SetRepresentationToPoints();
-
-        }
-        else if (flag == 1)
-        {
-            representFlag_ = 1;
-
-            (_unActor->GetProperty())->SetRepresentationToSurface();
-        }
-        else if (flag == 2)
-        {
-            representFlag_ = 2;
-
-            (_unActor->GetProperty())->SetRepresentationToWireframe();
-        }
-        else
-        {
-            ErrorInfo(1, "Wrong Flag!");
-            return;
-        }
-    }
-    else
-    {
-        ErrorInfo(1, "The Actor is not Created");
-        return;
-    }
-}
-
-/*
- * @brief: Get Warp Scale Factor (获取扭曲比例因子)
- * @param: vector
- * @ret: factor
- * @birth: created by czm in 20230410
- */
-double vtkVISUnContour::GetWarpScaleFactor(char* vectorName)
-{
-    if(_source == NULL)
-    {
-        return 0;
-    }
-
-    double *b = _source->GetSourceBounds();
-
-    double  l = sqrt((b[1]-b[0])*(b[1]-b[0]) + (b[3]-b[2])*(b[3]-b[2]) + (b[5]-b[4])*(b[5]-b[4]));
-
-    int vectorIndex = -1;
-    if (!string(vectorName).empty ())
-    {
-        vectorIndex = _source->GetVectorIndex(vectorName);
-    }
-
-    if(vectorIndex == -1)
-    {
-        vectorIndex = 0;
-    }
-
-    double *r;
-    if(_source->vectorSource[vectorIndex]->GetDataSize() != 0)
-    {
-        r = (_source->vectorSource[vectorIndex])->GetRange(-1);
-    }
-    else
-    {
-        r = (_source->cellVectorSource_[vectorIndex])->GetRange(-1);
-    }
-
-    scaleFactor_ = l/(r[1]-r[0])/10;
-
-    return scaleFactor_;
-}
-
-/*
- * @brief: Set Contour Level (设置等高线标高)
- * @param: level
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::SetContourLevel(int level)
-{
-    this->contourLevel_ = level;
-}
-
-/*
- * @brief: Clipping On Contour Display (打开轮廓显示上的剪裁)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::ClippingOnContourDisplay()
-{
-    if (_vtkObjects != NULL)
-    {
-        ((vtkUnstructuredGrid*)_vtkObjects[0])->Modified();
-        ((vtkGeometryFilter*)_vtkObjects[1])->Modified();
-
-        if(conFilter_ != NULL)
-        {
-            conFilter_->SetInputData(((vtkGeometryFilter*)_vtkObjects[1])->GetOutput());
-            conFilter_->GenerateValues(contourLevel_,scalarRange_[0], scalarRange_[1]);
-            conFilter_->ClippingOn();
-            conFilter_->Modified();
-        }
-
-        if (deformation_ == 0)
-        {
-            ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(conFilter_->GetOutputPort());
-        }
-        else
-        {
-            ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(((vtkWarpVector*)_vtkObjects[5])->GetOutputPort());
-        }
-
-        ((vtkDataSetMapper*)_vtkObjects[4])->SetScalarRange(scalarRange_[0], scalarRange_[1]);
-        ((vtkDataSetMapper*)_vtkObjects[4])->Modified();
-
-        if(representFlag_ == 0)
-        {
-            (_unActor->GetProperty())->SetRepresentationToPoints();
-        }
-        else if(representFlag_ == 1)
-        {
-            (_unActor->GetProperty())->SetRepresentationToSurface();
-        }
-        else if (representFlag_ == 2)
-        {
-            (_unActor->GetProperty())->SetRepresentationToWireframe();
-        }
-
-        _unActor->Modified();
-    }
-}
-
-/*
- * @brief: Clipping Off Contour Display (关闭轮廓显示上的剪裁)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::ClippingOffContourDisplay()
-{
-    if (_vtkObjects != NULL)
-    {
-        ((vtkUnstructuredGrid*)_vtkObjects[0])->Modified();
-        ((vtkGeometryFilter*)_vtkObjects[1])->Modified();
-
-        if(conFilter_ != NULL)
-        {
-            conFilter_->SetInputData(((vtkGeometryFilter*)_vtkObjects[1])->GetOutput());
-            conFilter_->GenerateValues(contourLevel_,scalarRange_[0], scalarRange_[1]);
-            conFilter_->ClippingOff();
-            conFilter_->Modified();
-        }
-
-        if (deformation_ == 0)
-        {
-            ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(conFilter_->GetOutputPort());
-        }
-        else
-        {
-            ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(((vtkWarpVector*)_vtkObjects[5])->GetOutputPort());
-        }
-
-        ((vtkDataSetMapper*)_vtkObjects[4])->SetScalarRange(scalarRange_[0], scalarRange_[1]);
-        ((vtkDataSetMapper*)_vtkObjects[4])->Modified();
-
-        if(representFlag_ == 0)
-        {
-            (_unActor->GetProperty())->SetRepresentationToPoints();
-        }
-        else if(representFlag_ == 1)
-        {
-            (_unActor->GetProperty())->SetRepresentationToSurface();
-        }
-        else if (representFlag_ == 2)
-        {
-            (_unActor->GetProperty())->SetRepresentationToWireframe();
-        }
-
-        _unActor->Modified();
-    }
-}
-
-/*
- * @brief: Modify Display Scalar Range (修改显示标量范围)
- * @param: min and max range
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::ModifyDisplayScalarRange(double min, double max)
-{
-    if (_vtkObjects != NULL)
-    {
-        ((vtkUnstructuredGrid*)_vtkObjects[0])->Modified();
-        ((vtkGeometryFilter*)_vtkObjects[1])->Modified();
-
-        if (deformation_ == 1)
-        {
-            ((vtkWarpVector*)_vtkObjects[5])->SetInputConnection(((vtkGeometryFilter*)_vtkObjects[1])->GetOutputPort());
-            ((vtkWarpVector*)_vtkObjects[5])->SetScaleFactor(scaleFactor_);
-            ((vtkWarpVector*)_vtkObjects[5])->Modified ();
-        }
-
-        if(contourType_ == 2)
-        {
-            if (deformation_ == 0)
-            {
-                ((vtkContourFilter*)_vtkObjects[2])->SetInputData(((vtkGeometryFilter*)_vtkObjects[1])->GetOutput());
-            }
-            else
-            {
-                ((vtkContourFilter*)_vtkObjects[2])->SetInputData(((vtkWarpVector*)_vtkObjects[5])->GetOutput());
-            }
-
-            ((vtkContourFilter*)_vtkObjects[2])->GenerateValues(contourLevel_, min, max);
-            ((vtkContourFilter*)_vtkObjects[2])->Modified();
-            ((vtkContourFilter*)_vtkObjects[2])->Update();
-
-            ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(((vtkContourFilter*)_vtkObjects[2])->GetOutputPort());
-        }
-        else
-        {
-            conFilter_->SetInputData(((vtkGeometryFilter*)_vtkObjects[1])->GetOutput());
-            conFilter_->GenerateValues(contourLevel_, min, max);
-            conFilter_->Modified();
-
-            if (deformation_ == 0)
-            {
-                ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(conFilter_->GetOutputPort());
-            }
-            else
-            {
-                ((vtkDataSetMapper*)_vtkObjects[4])->SetInputConnection(((vtkWarpVector*)_vtkObjects[5])->GetOutputPort());
-            }
-        }
-
-        ((vtkDataSetMapper*)_vtkObjects[4])->SetScalarRange(min, max);
-        ((vtkDataSetMapper*)_vtkObjects[4])->Modified();
-
-        if(representFlag_ == 0)
-        {
-            (_unActor->GetProperty())->SetRepresentationToPoints();
-        }
-        else if(representFlag_ == 1)
-        {
-            (_unActor->GetProperty())->SetRepresentationToSurface();
-        }
-        else if (representFlag_ == 2)
-        {
-            (_unActor->GetProperty())->SetRepresentationToWireframe();
-        }
-
-        _unActor->Modified();
-    }
-}
-
-/*
- * @brief: Set Contour Representation Flag (设置轮廓表示标志)
- * @param: flag
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::SetContourRepresentationFlag(int flag)
-{
-    if(flag == 0 || flag == 1 || flag==2)
-    {
-        this->representFlag_ = flag;
-    }
-    else
-    {
-            ErrorInfo(1, "Wrong Flag!");
-            return;
-    }
-}
-
-/*
- * @brief: Set Scalar Bar Enable(设置标量栏启用)
- * @param: bool
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::SetScalarBarEnable(bool enable)
-{
-    this->barEnable_ = enable;
-}
-
-/*
- * @brief: Set Warp Scale Factor(设置扭曲比例因子)
- * @param: value
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::SetWarpScaleFactor(double value)
-{
-    this->scaleFactor_ = value;
-}
-
-/*
- * @brief: DeleteObjects(删除对象)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::DeleteObjects()
-{
-    if (_unActor != 0)
-    {
-        if(_renderer != 0)
-        {
-            _renderer->RemoveActor(_unActor);
-        }
-        _unActor->Delete();
-        _unActor = 0;
-    }
-    if (_vtkObjects != 0)
-    {
-        if (_vtkObjects[0] != 0)
-        {
-            _vtkObjects[0]->Delete();
-            _vtkObjects[0] = 0;
-        }
-        if (_vtkObjects[2] != 0)
-        {
-            _vtkObjects[2]->Delete();
-            _vtkObjects[2] = 0;
-        }
-        if (_vtkObjects[4] != 0)
-        {
-            _vtkObjects[4]->Delete();
-            _vtkObjects[4] = 0;
-        }
-        if (_vtkObjects[5] != 0)
-        {
-            _vtkObjects[5]->Delete();
-            _vtkObjects[5] = 0;
-        }
-        //_vtkObjects[1] _vtkObjects[3] needn't be delete explicitly.
-    }
-}
-
-/*
- * @brief: get scalar range(获取标量范围)
- * @param: range and scalar
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::GetScalarRange(double *range, char*ScalarName)
-{
-    if (ScalarName == NULL)
-    {
-        range[0] = scalarRange_[0];
-        range[1] = scalarRange_[1];
-    }else
-    {
-        range[0] = _source->GetScalarRange(ScalarName)[0];
-        range[1] = _source->GetScalarRange(ScalarName)[1];
-    }
-
-}
-
-/*
- * @brief: Scalar Off Display(关闭标量显示)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::ScalarOffDisplay()
-{
-    if (_vtkObjects[4] != NULL)
-    {
-        ((vtkDataSetMapper*)_vtkObjects[4])->ScalarVisibilityOff();
-        ((vtkDataSetMapper*)_vtkObjects[4])->Modified();
-
-        if(representFlag_ == 0)
-        {
-            (_unActor->GetProperty())->SetRepresentationToPoints();
-        }
-        else if(representFlag_ == 1)
-        {
-            (_unActor->GetProperty())->SetRepresentationToSurface();
-        }
-        else if (representFlag_ == 2)
-        {
-            (_unActor->GetProperty())->SetRepresentationToWireframe();
-        }
-
-        (_unActor->GetProperty())->SetColor(0,0,1);
-
-        _unActor->Modified();
-    }
-    ShowOffScalarBar();
-}
-
-/*
- * @brief: Scalar On Display(打开标量显示)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISUnContour::ScalarOnDisplay()
-{
-    if (_vtkObjects[4] != NULL)
-    {
-        ((vtkDataSetMapper*)_vtkObjects[4])->ScalarVisibilityOn();
-        ((vtkDataSetMapper*)_vtkObjects[4])->Modified();
-
-        if(representFlag_ == 0)
-        {
-            (_unActor->GetProperty())->SetRepresentationToPoints();
-        }
-        else if(representFlag_ == 1)
-        {
-            (_unActor->GetProperty())->SetRepresentationToSurface();
-        }
-        else if (representFlag_ == 2)
-        {
-            (_unActor->GetProperty())->SetRepresentationToWireframe();
-        }
-
-        _unActor->Modified();
-    }
-    ShowOnScalarBar();
-}
-
-/*
- * @brief: Get Scalar Index(获取标量数值)
- * @param: void
- * @ret: index
- * @birth: created by czm in 20230410
- */
-int vtkVISUnContour::GetScalarIndex()
-{
-    return scalarIndex_;
-}
-
-/*
- * @brief: Get Scalar name(获取标量名)
- * @param: void
- * @ret: name
- * @birth: created by czm in 20230410
- */
-string vtkVISUnContour::GetScalarName()
-{
-    const char* str = _source->GetScalarName(scalarIndex_);
-    string name = (char*)str;
-    return name;
-}
-
-/*
- * @brief: Get Dat Source(获取数据源)
- * @param: void
- * @ret: source
- * @birth: created by czm in 20230410
- */
-vtkVISUnstructuredGridSource* vtkVISUnContour::GetDatSource()
-{
-    if (_source != NULL)
-    {
-        return _source;
-    }
-}

+ 0 - 114
CAE_Solution/src/VTK/visualization_VTK/vtkvisuncontour.h

@@ -1,114 +0,0 @@
-#ifndef VTKVISUNCONTOUR_H
-#define VTKVISUNCONTOUR_H
-#include <iostream>
-#include <string>
-#include <vtkObjectFactory.h>
-#include "vtkvismanager.h"
-#include "vtkvisunstructuredgridmanager.h"
-#include <vtkGeometryFilter.h>
-#include <vtkPolyDataNormals.h>
-#include <vtkFloatArray.h>
-#include <vtkWarpVector.h>
-#include <vtkVectorDot.h>
-#include <vtkScalarBarWidget.h>
-#include <vtkScalarBarActor.h>
-#include <vtkLookupTable.h>
-#include <vtkTextProperty.h>
-#include <vtkPointData.h>
-#include <vtkCellData.h>
-#include <vtkDataSetMapper.h>
-#include <vtkScalarBarRepresentation.h>
-#include <vtkContourFilter.h>
-#include <vtkBandedPolyDataContourFilter.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkActor.h>
-#include <vtkDoubleArray.h>
-#include "vtkvisunstructuredgridsource.h"
-#include <vtkProperty.h>
-#include <vtkRenderer.h>
-#include <vtkRenderWindow.h>
-#include <vtkCellCenters.h>
-using namespace std;
-
-class vtkVISUnContour : public vtkVISUnstructuredGridManager
-{
-public:
-    static vtkVISUnContour *New();
-    vtkVISUnContour();
-
-    ~vtkVISUnContour();
-
-    void CreateContourDisplay(char* scalarName);
-    void ModifyContourDisplay(char* scalarName);
-    void CreateContourDisplay(char* scalarName,char* vectorName);
-    void ModifyContourDisplay(char* scalarName,char* vectorName);
-    void CreateScalarBar();
-    void ShowOnScalarBar();
-    void ShowOffScalarBar();
-    void ModifyScalarBarFont(char *fontName);
-    void ModifyScalarBarFontColor(double r, double g, double b);
-    void ModifyScalarBarTitle(char *title);
-    void DeleteScalarBar();
-    void ModifyContourLevel(int level);
-    void SetScalarBarEnable(bool enable);
-    void UpdataScalarBar();
-
-    //---------------------------------------------
-    //0 -- banded
-    //1 -- continuous
-    //2 -- lines
-    void SetContourType(int type);
-    void ModifyContourDisplayType();
-    void SetDeformation(int flag);
-    void ModifyScaleFactor(double value);
-    void SetContourRepresentationFlag(int flag);
-    void ModifyContourRepresentation(int flag);
-    double GetWarpScaleFactor(char* vectorName);
-    void SetWarpScaleFactor(double value);
-    void SetContourLevel(int level);
-    void ClippingOnContourDisplay();
-    void ClippingOffContourDisplay();
-    void ModifyDisplayScalarRange(double min, double max);
-    //reimplement parent class method.
-    void DeleteObjects();
-    void ScalarOffDisplay();
-    void ScalarOnDisplay();
-    string GetScalarName();
-
-    int GetScalarIndex();
-    void GetScalarRange(double *range, char* name = NULL);
-
-    vtkVISUnstructuredGridSource* GetDatSource();
-protected:
-    vtkLookupTable* contourLookupTable_;
-    vtkScalarBarWidget* scalarBarWidget_;
-
-    int scalarIndex_;
-    int contourScalarIndex_;
-    int vectorIndex_;
-    int contourLevel_;
-    double scaleFactor_;
-    double scalarRange_[2];
-    vtkWarpVector* csdVectorWarp_;
-    vtkBandedPolyDataContourFilter* conFilter_;
-
-    //---------------------------------------------
-    //0 -- banded
-    //1 -- continuous
-    //2 -- lines
-    int contourType_;
-    // 0 -- no deformation
-    // 1 -- deformation
-    int deformation_;
-    // 0 -- points
-    // 1 -- surface
-    // 2 -- wireframe
-    int representFlag_;
-    // 0 -- off
-    // 1 -- on
-    bool barEnable_;
-
-private:
-};
-
-#endif // VTKVISUNCONTOUR_H

+ 0 - 1083
CAE_Solution/src/VTK/visualization_VTK/vtkvisunglyph.cpp

@@ -1,1083 +0,0 @@
-#include "vtkvisunglyph.h"
-#include <vtkArrowSource.h>
-#include <vtkCellDataToPointData.h>
-
-vtkStandardNewMacro(vtkVISUnGlyph)
-
-/*
- * @brief: the constructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
-vtkVISUnGlyph::vtkVISUnGlyph()
-{
-    ErrorInfo(0,"Glyph Constructrue.");
-
-    scaleMode[0] = "ScaleByScalar";
-    scaleMode[1] = "ScaleByVector";
-    scaleMode[2] = "ScaleByVectorComponents";
-    scaleMode[3] = "DataScalingOff";
-
-    colorMode[0] = "ColorByScale";
-    colorMode[1] = "ColorByScalar";
-    colorMode[2] = "ColorByVector";
-
-    vectorMode[0] = "UseVector";
-    vectorMode[1] = "UseNormal";
-    vectorMode[2] = "VectorRotationOff";
-
-    indexMode[0] = "IndexingOff";
-    indexMode[1] = "IndexingByScalar";
-    indexMode[2] = "IndexingByVector";
-
-    glyph2DType[0] = "None";
-    glyph2DType[1] = "Vertex";
-    glyph2DType[2] = "Dash";
-    glyph2DType[3] = "Cross";
-    glyph2DType[4] = "ThickCross";
-    glyph2DType[5] = "Triangle";
-    glyph2DType[6] = "Square";
-    glyph2DType[7] = "Circle";
-    glyph2DType[8] = "Diamond";
-    glyph2DType[9] = "Arrow";
-    glyph2DType[10] = "ThickArrow";
-    glyph2DType[11] = "HookedArrow";
-    glyph2DType[12] = "EdgeArrow";
-
-    glyphPos_[0]=0;
-    glyphPos_[1]=0;
-    glyphPos_[2]=0;
-
-    scaleFactor_ = 0.02;
-    vectorFlag_ = 1;
-    vectorType_ = -1;
-    glyphTypeIndex_ = 9;
-    glyphVtkObjects_ = vtkGlyph3D::New();
-
-    lineThickness_ = 1;
-    equalScaleFactor_ = -1;
-}
-
-
-/*
- * @brief: the destructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
-vtkVISUnGlyph::~vtkVISUnGlyph()
-{
-    glyphVtkObjects_->Delete();
-}
-
-/*
- * @brief: create glyph display(创建展示)
- * @param: scalar name and vector name
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::CreateGlyphDisplay(bool flag, char* scalarName, char* vectorName)
-{
-    int scalarIndex = -1;
-    int vectorIndex = -1;
-
-    scalarIndex = _source->GetScalarIndex(scalarName);
-    vectorIndex = _source->GetVectorIndex(vectorName);
-    vectorFlag_ = flag;
-
-    vtkUnstructuredGrid *unGrid = vtkUnstructuredGrid::New();
-    unGrid->DeepCopy(_source->unstruGrid);
-
-    if (flag == 1)
-    {
-        if (scalarIndex != -1 && _source->scalarSource[scalarIndex] != NULL)
-        {
-            if (_source->scalarSource[scalarIndex]->GetDataSize() != 0)
-            {
-                (unGrid->GetPointData())->SetScalars(_source->scalarSource[scalarIndex]);
-            }
-            else
-            {
-                (unGrid->GetCellData())->SetScalars(_source->cellScalarSource_[scalarIndex]);
-            }
-        }
-        if (vectorIndex != -1 && _source->vectorSource[vectorIndex] != NULL)
-        {
-            if(_source->vectorSource[vectorIndex]->GetDataSize() != 0)
-            {
-                (unGrid->GetPointData())->SetVectors(_source->vectorSource[vectorIndex]);
-            }
-            else
-            {
-                (unGrid->GetCellData())->SetVectors(_source->cellVectorSource_[vectorIndex]);
-            }
-        }
-        else
-        {
-            return;
-        }
-    }
-    unGrid->Modified();
-
-    vtkGlyphSource2D *glyph2D = vtkGlyphSource2D::New();
-    glyph2D->FilledOff();
-    glyph2D->SetScale(1.0);
-    glyph2D->SetScale2(1.5);
-    glyph2D->SetCenter(glyphPos_[0],glyphPos_[1],glyphPos_[2]);
-
-    if(flag == 0)
-    {
-        glyph2D->SetGlyphTypeToSquare();
-        glyphTypeIndex_ = 6;
-    }
-    else
-    {
-        glyph2D->SetGlyphTypeToArrow();
-        glyphTypeIndex_ = 9;
-    }
-
-    vtkGlyph3D *glyph3D = vtkGlyph3D::New();
-    glyph3D->SetInputData(unGrid);
-    glyph3D->SetSourceData(glyph2D->GetOutput());
-    glyph3D->SetScaleFactor(scaleFactor_);
-
-    vtkDataSetMapper *mapper = vtkDataSetMapper::New();
-    mapper->SetInputConnection(glyph3D->GetOutputPort());
-
-    if(scalarIndex != -1)
-    {
-        if (_source->scalarSource[scalarIndex]->GetDataSize() != 0)
-        {
-            mapper->SetScalarModeToUsePointData();
-        }
-        else
-        {
-            mapper->SetScalarModeToUseCellData();
-        }
-    }
-
-    if(flag == 0)
-    {
-        mapper->ScalarVisibilityOff();
-    }
-    else
-    {
-        if(scalarIndex != -1)
-        {
-            mapper->SetScalarRange(_source->scalarRange[scalarIndex]);
-        }
-        else
-        {
-            //no scalar data, use vector magnitude as color.
-            if (vectorIndex != -1 && _source->vectorSource[vectorIndex] != NULL)
-            {
-                double range[2];
-                if(_source->vectorSource[vectorIndex]->GetDataSize() != 0)
-                {
-                    _source->vectorSource[vectorIndex]->GetRange(range, -1);  //vector's magnitude
-                }
-                else
-                {
-                    _source->cellVectorSource_[vectorIndex]->GetRange(range, -1);;
-                }
-                mapper->SetScalarRange(range[0], range[1]);
-            }
-        }
-        mapper->ScalarVisibilityOn();
-    }
-
-
-    double range[2];
-    vtkLookupTable *lut = (vtkLookupTable*)(mapper->GetLookupTable());
-    lut->GetHueRange(range);
-    lut->SetHueRange(range[1], range[0]);
-    lut->SetNumberOfColors(256);
-
-
-    vtkActor *actor = vtkActor::New();
-    actor->SetMapper(mapper);
-
-    if (flag == 0)
-    {
-        (actor->GetProperty())->SetColor(vtkColorPalette[1][0],vtkColorPalette[1][1],vtkColorPalette[1][2]);
-    }
-
-    if (_renderer != NULL)
-    {
-        _renderer->AddActor(actor);
-    }
-
-    _unActor = actor;
-
-    glyphVtkObjects_ = glyph3D;
-
-    _vtkObjectsNum = 3;
-    _vtkObjects = new vtkObject*[_vtkObjectsNum];
-    _vtkObjects[0] = unGrid;
-    _vtkObjects[1] = glyph2D;
-    //_vtkObjects[2] = glyph3D;
-    _vtkObjects[2] = mapper;
-}
-
-/*
- * @brief: create vector that need to display(创建需要展示的矢量)
- * @param: three scalar index(u  v  w)
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::CreateGlyphDisplay(int uIndex, int vIndex, int wIndex)
-{
-    vtkUnstructuredGrid *unGrid = vtkUnstructuredGrid::New();
-    unGrid->DeepCopy(_source->unstruGrid);
-
-    vtkDoubleArray* uvwArray = vtkDoubleArray::New();
-    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;
-            cout << "" << endl;
-            return;
-        }
-    }
-
-    if(vectorType_ == 0)
-    {
-        //(unGrid->GetPointData())->SetScalars(_source->scalarSource[uIndex]);
-        (unGrid->GetPointData())->SetVectors(uvwArray);
-    }
-    else if(vectorType_ == 1)
-    {
-        //(unGrid->GetCellData())->SetScalars(_source->cellScalarSource_[uIndex]);
-        (unGrid->GetCellData())->SetVectors(uvwArray);
-    }
-    else
-    {
-        return;
-    }
-
-    /*vtkCellDataToPointData* ctop = vtkCellDataToPointData::New();
-        if (vectorType_ == 1)
-        {
-            ctop->SetInputData(unGrid);
-            ctop->PassCellDataOn();
-            ctop->Update();
-        }*/
-
-    unGrid->Modified();
-
-    vtkGlyphSource2D *glyph2D = vtkGlyphSource2D::New();
-    glyph2D->FilledOff();
-    glyph2D->SetScale(1.0);
-    glyph2D->SetScale2(1.5);
-    glyph2D->SetCenter(glyphPos_[0],glyphPos_[1],glyphPos_[2]);
-    glyph2D->SetGlyphTypeToArrow();
-    glyphTypeIndex_ = 9;
-
-    //vtkArrowSource* arrow = vtkArrowSource::New();
-    //arrow->Update();
-    vtkGlyph3D *glyph3D = vtkGlyph3D::New();
-
-    glyph3D->SetInputData(unGrid);
-    glyph3D->SetInputConnection(1,glyph2D->GetOutputPort());
-    //glyph3D->SetSourceData(glyph2D->GetOutput());
-    //glyph3D->SetSourceData(arrow->GetOutput());
-    /*if (vectorType_ == 0)
-        {
-             equalScaleFactor_ = GetScaleFactor(uvwArray->GetRange(-1));cout <<"scaleFactor: "<< scaleFactor_ <<endl;  //calculate the equal scaleFactor
-        }else
-        {
-            equalScaleFactor_ = -1;
-        }*/
-    glyph3D->SetScaleFactor(scaleFactor_);// set zoom factor
-    //glyph3D->SetScaleFactor(scaleFactor_);// set zoom factor
-    glyph3D->SetScaleModeToScaleByVector();
-    //glyph3D->SetScaleModeToDataScalingOff();
-    glyph3D->SetVectorModeToUseVector();
-    glyph3D->SetColorModeToColorByVector();
-    glyph3D->Update();
-
-    vtkDataSetMapper *mapper = vtkDataSetMapper::New();
-    mapper->SetInputConnection(glyph3D->GetOutputPort());
-
-    if (vectorType_ == 0)
-    {
-        mapper->SetScalarModeToUsePointData();
-    }
-    else if (vectorType_ == 1)
-    {
-        mapper->SetScalarModeToUseCellData();
-    }
-    /*if(flag == 0)
-        {
-            mapper->ScalarVisibilityOff();
-        }
-        else
-        {
-            if(scalarIndex != -1)
-            {
-                mapper->SetScalarRange(_source->scalarRange[scalarIndex]);
-            }
-            else
-            {
-                //no scalar data, use vector magnitude as color.
-                if (vectorIndex != -1 && _source->vectorSource[vectorIndex] != NULL)
-                {
-                    double range[2];
-                    if(_source->vectorSource[vectorIndex]->GetDataSize() != 0)
-                    {
-                        _source->vectorSource[vectorIndex]->GetRange(range, -1);  //vector's magnitude
-                    }
-                    else
-                    {
-                        _source->cellVectorSource_[vectorIndex]->GetRange(range, -1);;
-                    }
-                    mapper->SetScalarRange(range[0], range[1]);
-                }
-            }
-            mapper->ScalarVisibilityOn();
-        }*/
-
-
-    //no scalar data, use vector magnitude as color.
-    if (1)
-    {
-        double range[2];
-        if(vectorType_ == 0)
-        {
-            uvwArray->GetRange(range, -1);  //vector's magnitude
-        }
-        else if(vectorType_ == 1)
-        {
-            uvwArray->GetRange(range, -1);
-        }
-        mapper->SetScalarRange(range[0], range[1]);
-    }
-    mapper->ScalarVisibilityOn();
-    double range[2];
-    vtkLookupTable *lut = (vtkLookupTable*)(mapper->GetLookupTable());
-    lut->GetHueRange(range);
-    lut->SetHueRange(range[1], range[0]);
-    lut->SetRange(mapper->GetScalarRange());
-    lut->SetNumberOfColors(256);
-
-    vtkActor *actor = vtkActor::New();
-    actor->SetMapper(mapper);
-
-    /* if (flag == 0)
-        {
-            (actor->GetProperty())->SetColor(vtkColorPalette[1][0],vtkColorPalette[1][1],vtkColorPalette[1][2]);
-        }*/
-    (actor->GetProperty())->SetColor(vtkColorPalette[1][0],vtkColorPalette[1][1],vtkColorPalette[1][2]);
-    if (_renderer != NULL)
-    {
-        _renderer->AddActor(actor);
-    }
-
-    _unActor = actor;
-
-    glyphVtkObjects_ = glyph3D;
-
-    _vtkObjectsNum = 3;
-    _vtkObjects = new vtkObject*[_vtkObjectsNum];
-    _vtkObjects[0] = unGrid;
-    _vtkObjects[1] = glyph2D;
-    //_vtkObjects[2] = glyph3D;
-    _vtkObjects[2] = mapper;
-}
-
-/*
- * @brief: Change scalar that need to display(更改需要显示的标量,在CreateGlyphDisplay()之后使用)
- * @param: scalar name
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::ModifyGlyphScalar(char* scalarName)
-{
-    if (_vtkObjects != NULL)
-    {
-        int scalarIndex = _source->GetScalarIndex(scalarName);
-
-        if (scalarIndex == -1)
-        {
-            ErrorInfo(1,"Scalar data are not existed!");
-            return;
-        }
-        if(_source->scalarSource[scalarIndex]->GetDataSize() != 0)
-        {
-            (((vtkUnstructuredGrid*)_vtkObjects[0])->GetPointData())->SetScalars(_source->scalarSource[scalarIndex]);
-        }
-        else
-        {
-            (((vtkUnstructuredGrid*)_vtkObjects[0])->GetCellData())->SetScalars(_source->cellScalarSource_[scalarIndex]);
-        }
-        ((vtkUnstructuredGrid*)_vtkObjects[0])->Modified();
-
-        ((vtkDataSetMapper* )_vtkObjects[2])->SetScalarRange(_source->scalarRange[scalarIndex]);
-        ((vtkDataSetMapper* )_vtkObjects[2])->Modified();
-    }
-}
-
-/*
- * @brief: Change vector that need to display(更改需要显示的矢量,在CreateGlyphDisplay()之后使用)
- * @param: scalar name
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::ModifyGlyphVector(char* vectorName)
-{
-    if (_vtkObjects != NULL)
-    {
-
-        int vectorIndex = _source->GetVectorIndex(vectorName);
-
-        if (vectorIndex == -1)
-        {
-            ErrorInfo(1,"Vector data are not existed!");
-            return;
-        }
-
-        /*int num =((vtkUnstructuredGrid*)_vtkObjects[0])->GetNumberOfPoints();
-
-        double *v;
-
-        for(int i=0; i< num; i++)
-        {
-            v = _source->vectorSource[vectorIndex]->GetTuple3(i);
-
-            //cout<<v[0]<<" "<<v[1]<<"  "<<v[2]<<endl;
-        }
-        */
-
-        if(_source->vectorSource[vectorIndex]->GetDataSize() != 0)
-        {
-            (((vtkUnstructuredGrid*)_vtkObjects[0])->GetPointData())->SetVectors(_source->vectorSource[vectorIndex]);
-        }
-        else
-        {
-            (((vtkUnstructuredGrid*)_vtkObjects[0])->GetCellData())->SetVectors(_source->cellVectorSource_[vectorIndex]);
-        }
-
-        ((vtkUnstructuredGrid*)_vtkObjects[0])->Modified();
-    }
-}
-
-/*
- * @brief: Change vector that need to display(更改需要显示的矢量,在CreateGlyphDisplay()之后使用)
- * @param: three scalar index(u,v,w)
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::ModifyGlyphVector(int uIndex, int vIndex, int wIndex)
-{
-    if (_vtkObjects != NULL)
-    {
-        vtkDoubleArray* uvwArray = vtkDoubleArray::New();
-        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(((vtkUnstructuredGrid*)_vtkObjects[0])->GetNumberOfPoints());
-                vectorType_ = 0;
-                double uvw[3];
-                for (int i = 0; i < ((vtkUnstructuredGrid*)_vtkObjects[0])->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(((vtkUnstructuredGrid*)_vtkObjects[0])->GetNumberOfCells());
-                vectorType_ = 1;
-                double uvw[3];
-                for (int i = 0; i < ((vtkUnstructuredGrid*)_vtkObjects[0])->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;
-                cout << "" << endl;
-                return;
-            }
-        }
-
-        if(vectorType_ == 0)
-        {
-            (((vtkUnstructuredGrid*)_vtkObjects[0])->GetPointData())->SetVectors(uvwArray);
-        }
-        else
-        {
-            (((vtkUnstructuredGrid*)_vtkObjects[0])->GetCellData())->SetVectors(uvwArray);
-        }
-        ((vtkUnstructuredGrid*)_vtkObjects[0])->Modified();
-        if (vectorType_ == 0)
-        {
-            equalScaleFactor_ = GetScaleFactor(uvwArray->GetRange(-1));
-        }else
-        {
-            equalScaleFactor_ = -1;
-        }
-    }
-}
-
-/*
- * @brief: Show the scalar glyph(显示标量图示符)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetScalarVisibilityOn()
-{
-    if (_vtkObjects != NULL)
-    {
-        (_unActor->GetMapper())->ScalarVisibilityOn();
-    }
-}
-
-/*
- * @brief: hide the scalar glyph(隐藏标量图示符)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetScalarVisibilityOff()
-{
-    if (_vtkObjects != NULL)
-    {
-        (_unActor->GetMapper())->ScalarVisibilityOff();
-    }
-}
-
-/*
- * @brief: Filling the glyph symbol with color(用颜色填充字形符号)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetGlyphFilledOn()
-{
-    if (_vtkObjects!=NULL)
-    {
-        ((vtkGlyphSource2D*)_vtkObjects[1])->FilledOn();
-        ((vtkGlyphSource2D*)_vtkObjects[1])->Modified();
-    }
-}
-
-/*
- * @brief: Show only the edge of the glyph symbol(仅显示字形符号的边缘)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetGlyphFilledOff()
-{
-    if (_vtkObjects!=NULL)
-    {
-        ((vtkGlyphSource2D*)_vtkObjects[1])->FilledOff();
-        ((vtkGlyphSource2D*)_vtkObjects[1])->Modified();
-    }
-}
-
-/*
- * @brief: Set the relative position of the glyph symbol(设置字形符号的相对位置)
- * @param: position
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetGlyphPosition(double p1, double p2, double p3)
-{
-    if (_vtkObjects!=NULL)
-    {
-        glyphPos_[0] = p1;
-        glyphPos_[1] = p2;
-        glyphPos_[2] = p3;
-
-        ((vtkGlyphSource2D*)_vtkObjects[1])->SetCenter(p1,p2,p3);
-        ((vtkGlyphSource2D*)_vtkObjects[1])->Modified();
-    }
-}
-
-/*
- * @brief: Change the glyph scale mode(更改图示符比例模式)
- * @param: scalemode(ScaleByScalar/ScaleByVector/ScaleByVectorComponents/DataScalingOff)
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetGlyphScaleMode(char* scaleMode)
-{
-    if (_vtkObjects!=NULL)
-    {
-        int index = GetScaleModeIndex(scaleMode);
-
-        glyphVtkObjects_->SetScaleMode(index);
-        glyphVtkObjects_->Modified();
-    }
-}
-
-/*
- * @brief: Change the scale factor of the glyph symbol(更改字形符号的比例因子)
- * @param: factor
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetGlyphScaleFactor(double factor)
-{
-    if (_vtkObjects!=NULL)
-    {
-        scaleFactor_ = factor;
-
-        glyphVtkObjects_->SetScaleFactor(factor);
-        glyphVtkObjects_->Modified();
-    }
-}
-
-
-/*
- * @brief: Change the glyph color mode(更改字形颜色模式)
- * @param: color mode(colorbyscale/colorbyscalar/colorbyvector)
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetGlyphColorMode(char* colorMode)
-{
-    if (_vtkObjects!=NULL)
-    {
-        int index = GetColorModeIndex(colorMode);
-
-        glyphVtkObjects_->SetColorMode(index);
-        glyphVtkObjects_->Modified();
-    }
-}
-
-/*
- * @brief: Change the glyph vector mode(更改字形矢量模式)
- * @param: vector mode(UseVector/UseNormal/VectorRotationOff)
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetGlyphVectorMode(char* vectorMode)
-{
-    if (_vtkObjects!=NULL)
-    {
-        int index = GetVectorModeIndex(vectorMode);
-
-        glyphVtkObjects_->SetVectorMode(index);
-        glyphVtkObjects_->Modified();
-    }
-}
-
-/*
- * @brief: Change the glyph indexing mode(更改字形索引模式)
- * @param: index mode(IndexingOff/IndexingByScalar/IndexingByVector)
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetGlyphIndexMode(char* indexMode)
-{
-    if (_vtkObjects!=NULL)
-    {
-        int index = GetIndexModeIndex(indexMode);
-
-        glyphVtkObjects_->SetIndexMode(index);
-        glyphVtkObjects_->Modified();
-    }
-}
-
-/*
- * @brief: Change the glyph 2D symbol shape(更改图示符二维符号形状)
- * @param: glyphType(none/vertex/dash/cross/ThickCross/Triangle/Square/Circle/Diamond/Arrow/ThickArrow/HookedArrow/EdgeArrow)
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetGlyph2DType(char* glyphType)
-{
-    if (_vtkObjects!=NULL)
-    {
-        int gtIndex = GetGlyph2DTypeIndex(glyphType);
-
-        glyphTypeIndex_ = gtIndex;
-
-        ((vtkGlyphSource2D*)_vtkObjects[1])->SetGlyphType(gtIndex);
-        ((vtkGlyphSource2D*)_vtkObjects[1])->Modified();
-
-        ErrorInfo(0,"Set glyph type to " +glyph2DType[gtIndex]);
-    }
-}
-
-/*
- * @brief: Change line width(更改线的粗细)
- * @param: value
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::ChangeGlyphLineThickness(double value)
-{
-    if (_unActor != NULL)
-    {
-        lineThickness_ = value;
-
-        (_unActor->GetProperty())->SetLineWidth(value);
-    }
-}
-
-
-/*
- * @brief: get line width(获取线的粗细)
- * @param: void
- * @ret: value
- * @birth: created by czm in 20230323
- */
-double vtkVISUnGlyph::GetGlyphLineThickness()
-{
-    return lineThickness_;
-}
-
-/*
- * @brief: set clamping on(将字形夹紧设置为打开)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetGlyphClampingOn()
-{
-    if (glyphVtkObjects_ != NULL)
-    {
-        glyphVtkObjects_->ClampingOn();
-        glyphVtkObjects_->Modified();
-    }
-}
-
-/*
- * @brief: set clamping off(将字形夹紧设置为关闭)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetGlyphClampingOff()
-{
-    if (glyphVtkObjects_ != NULL)
-    {
-        glyphVtkObjects_->ClampingOff();
-        glyphVtkObjects_->Modified();
-    }
-}
-
-/*
- * @brief: set  orient on (设置方向)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetGlyphOrientOn()
-{
-    if (glyphVtkObjects_ != NULL)
-    {
-        glyphVtkObjects_->OrientOn();
-        glyphVtkObjects_->Modified();
-    }
-}
-
-/*
- * @brief: set  orient off (设置方向)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetGlyphOrientOff()
-{
-    if (glyphVtkObjects_ != NULL)
-    {
-        glyphVtkObjects_->OrientOff();
-        glyphVtkObjects_->Modified();
-    }
-}
-
-/*
- * @brief: set scaling on (设置缩放打开)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetGlyphScalingOn()
-{
-    if (glyphVtkObjects_ != NULL)
-    {
-        glyphVtkObjects_->ScalingOn();
-        glyphVtkObjects_->Modified();
-    }
-}
-
-/*
- * @brief: set scaling off (设置缩放关闭)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::SetGlyphScalingOff()
-{
-    if (glyphVtkObjects_ != NULL)
-    {
-        glyphVtkObjects_->ScalingOff();
-        glyphVtkObjects_->Modified();
-    }
-}
-
-/*
- * @brief: Get the scale for vector (获取矢量的比例)
- * @param: vector name
- * @ret: value
- * @birth: created by czm in 20230323
- */
-double vtkVISUnGlyph::GetScaleFactor(char* vectorName)
-{
-    if(_source == NULL)
-    {
-        return 0;
-    }
-
-    double *b = _source->GetSourceBounds();
-
-    double  l = sqrt((b[1]-b[0])*(b[1]-b[0]) + (b[3]-b[2])*(b[3]-b[2]) + (b[5]-b[4])*(b[5]-b[4]));
-
-    int vectorIndex = _source->GetVectorIndex(vectorName);
-
-    if(vectorIndex == -1)
-    {
-        vectorIndex = 0;
-    }
-
-    double *r;
-    if(_source->vectorSource[vectorIndex]->GetDataSize() != 0)
-    {
-        r = (_source->vectorSource[vectorIndex])->GetRange(-1);
-    }
-    else
-    {
-        r = (_source->cellVectorSource_[vectorIndex])->GetRange(-1);
-    }
-
-    //zhuqin modify code 2012.10.26
-    //
-    double factor=0;
-
-    if(r[1]==r[0])
-    {
-        factor = 0.5;
-    }
-    else
-    {
-        factor = l/(r[1]-r[0])/10;
-    }
-    //
-    //zhuqin modify code 2012.10.26
-
-    return factor;
-}
-
-/*
- * @brief: Get the scale for vector (获取矢量的比例)
- * @param: vector range
- * @ret: scaleFactor
- * @birth: created by czm in 20230323
- */
-double vtkVISUnGlyph::GetScaleFactor(double* range)
-{
-    if(_source == NULL)
-    {
-        return 0;
-    }
-
-    double *b = _source->GetSourceBounds();
-
-    double  l = sqrt((b[1]-b[0])*(b[1]-b[0]) + (b[3]-b[2])*(b[3]-b[2]) + (b[5]-b[4])*(b[5]-b[4]));
-
-    double factor=0;
-
-    if(range[1]==range[0])
-    {
-        factor = 0.5;
-    }
-    else
-    {
-        factor = l/(range[1]-range[0])/10;
-    }
-
-    return factor;
-}
-
-/*
- * @brief: Get the scale for vector (获取缩放因子)
- * @param: void
- * @ret: scaleFactor
- * @birth: created by czm in 20230323
- */
-double vtkVISUnGlyph::GetScaleFactor()
-{
-    return scaleFactor_;
-}
-
-/*
- * @brief: Get the scale for vector (获取相等比例因子)
- * @param: void
- * @ret: equalscaleFactor
- * @birth: created by czm in 20230323
- */
-double vtkVISUnGlyph::GetEqualScaleFactor()
-{
-    return equalScaleFactor_;
-}
-
-/*
- * @brief: Modify Display Scalar Range (修改显示标量范围)
- * @param: min scalar and max scalar
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnGlyph::ModifyDisplayScalarRange(double minScalar, double maxScalar)
-{
-    if (_vtkObjects != NULL)
-    {
-        ((vtkDataSetMapper* )_vtkObjects[2])->SetScalarRange(minScalar, maxScalar);
-        ((vtkDataSetMapper* )_vtkObjects[2])->Modified();
-    }
-}
-
-/*
- * @brief: Get Scale Mode Index (获取缩放模式索引)
- * @param: mode
- * @ret: index
- * @birth: created by czm in 20230323
- */
-int vtkVISUnGlyph::GetScaleModeIndex(string Mode)
-{
-    for(int i=0; i<4; i++)
-    {
-        if (Mode == (string)scaleMode[i])
-        {
-            return i;
-        }
-    }
-    ErrorInfo(1,"Wrong Scale Mode, Use ScaleByScalar instead");
-    return 0;
-}
-
-/*
- * @brief: Get color Mode Index (获取颜色模式索引)
- * @param: mode
- * @ret: index
- * @birth: created by czm in 20230323
- */
-int vtkVISUnGlyph::GetColorModeIndex(string Mode)
-{
-    for(int i=0; i<3; i++)
-    {
-        if (Mode == (string)colorMode[i])
-        {
-            return i;
-        }
-    }
-    ErrorInfo(1,"Wrong Color Mode, Use ColorByScale instead");
-    return 0;
-}
-
-/*
- * @brief: Get vector Mode Index (获取矢量模式索引)
- * @param: mode
- * @ret: index
- * @birth: created by czm in 20230323
- */
-int vtkVISUnGlyph::GetVectorModeIndex(string Mode)
-{
-    for(int i=0; i<3; i++)
-    {
-        if (Mode == (string)vectorMode[i])
-        {
-            return i;
-        }
-    }
-    ErrorInfo(1,"Wrong Vector Mode, Use UseVector instead");
-    return 0;
-}
-
-/*
- * @brief: Get index Mode Index (获取索引模式索引)
- * @param: mode
- * @ret: index
- * @birth: created by czm in 20230323
- */
-int vtkVISUnGlyph::GetIndexModeIndex(string Mode)
-{
-    for(int i=0; i<3; i++)
-    {
-        if (Mode == (string)indexMode[i])
-        {
-            return i;
-        }
-    }
-    ErrorInfo(1,"Wrong Indexing Mode, Use IndexingOff instead");
-    return 0;
-}
-
-/*
- * @brief: Get index Mode Index (获取Glyph 2D类型索引)
- * @param: type
- * 
- * @ret: index
- * @birth: created by czm in 20230323
- */
-int vtkVISUnGlyph::GetGlyph2DTypeIndex(string type)
-{
-    for(int i=0; i<13; i++)
-    {
-        if (type == (string)glyph2DType[i])
-        {
-            return i;
-        }
-    }
-    ErrorInfo(1,"Wrong Glyph 2D Type, Use Arrow instead");
-
-    return 0;
-}

+ 0 - 107
CAE_Solution/src/VTK/visualization_VTK/vtkvisunglyph.h

@@ -1,107 +0,0 @@
-#ifndef VTKVISUNGLYPH_H
-#define VTKVISUNGLYPH_H
-#include "vtkvisunstructuredgridmanager.h"
-#include "vtkGlyph3D.h"
-#include <iostream>
-#include "vtkvismanager.h"
-#include <vtkGeometryFilter.h>
-#include <vtkPolyDataNormals.h>
-#include <vtkFloatArray.h>
-#include <vtkWarpVector.h>
-#include <vtkVectorDot.h>
-#include <vtkScalarBarActor.h>
-#include <vtkScalarBarWidget.h>
-#include <vtkLookupTable.h>
-#include <vtkTextProperty.h>
-#include <vtkPointData.h>
-#include <vtkCellData.h>
-#include <vtkDataSetMapper.h>
-#include <vtkScalarBarRepresentation.h>
-#include <vtkContourFilter.h>
-#include <vtkBandedPolyDataContourFilter.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkActor.h>
-#include <vtkDoubleArray.h>
-#include "vtkvisunstructuredgridsource.h"
-#include <vtkProperty.h>
-#include <vtkRenderer.h>
-#include <vtkRenderWindow.h>
-#include <vtkCellCenters.h>
-#include <vtkDoubleArray.h>
-#include <vtkOutlineFilter.h>
-#include <vtkObjectFactory.h>
-#include <vtkGlyphSource2D.h>
-using namespace std;
-
-
-
-class vtkVISUnGlyph:public vtkVISUnstructuredGridManager
-{
-public:
-    static vtkVISUnGlyph *New();
-
-    vtkVISUnGlyph();
-    ~vtkVISUnGlyph();
-
-    void CreateGlyphDisplay(bool flag, char* scalarName, char* vectorName);
-    void CreateGlyphDisplay(int uIndex, int vIndex, int wIndex);
-    void ModifyGlyphScalar(char* scalarName);
-    void ModifyGlyphVector(char* vectorName);
-    void ModifyGlyphVector(int uIndex, int vIndex, int wIndex);
-    void SetScalarVisibilityOn();
-    void SetScalarVisibilityOff();
-    void SetGlyphFilledOn();
-    void SetGlyphFilledOff();
-    void SetGlyphPosition(double p1, double p2, double p3);
-
-    void SetGlyphScaleMode(char *scaleMode);
-    void SetGlyphScaleFactor(double factor);
-
-    void SetGlyphColorMode(char *colorMode);
-    void SetGlyphVectorMode(char *vectorMode);
-    void SetGlyphIndexMode(char *indexMode);
-    void SetGlyph2DType(char *glyphType);
-
-    void ChangeGlyphLineThickness(double value);
-    double GetGlyphLineThickness();
-
-    void SetGlyphClampingOn();
-    void SetGlyphClampingOff();
-    void SetGlyphOrientOn();
-    void SetGlyphOrientOff();
-    void SetGlyphScalingOn();
-    void SetGlyphScalingOff();
-
-    double GetScaleFactor(char* vectorName);
-    double GetScaleFactor(double* range);
-    double GetScaleFactor();
-    double GetEqualScaleFactor();
-
-    void ModifyDisplayScalarRange(double minScalar, double maxScalar);
-
-protected:
-    bool vectorFlag_;
-    int vectorType_;// 0 is point, 1 is cell
-    double scaleFactor_;
-    double equalScaleFactor_;
-    double glyphPos_[3];
-    double lineThickness_;
-
-    int glyphTypeIndex_;
-
-    vtkGlyph3D* glyphVtkObjects_;
-
-    string glyph2DType[13];
-    string scaleMode[4];
-    string colorMode[3];
-    string indexMode[3];
-    string vectorMode[3];
-
-    int GetScaleModeIndex(string Mode);
-    int GetColorModeIndex(string Mode);
-    int GetVectorModeIndex(string Mode);
-    int GetIndexModeIndex(string Mode);
-    int GetGlyph2DTypeIndex(string type);
-};
-
-#endif // VTKVISUNGLYPH_H

+ 218 - 279
CAE_Solution/src/VTK/visualization_VTK/vtkvisunshademesh.cpp

@@ -1,5 +1,3 @@
-#include "vtkvisunshademesh.h"
-#include "vtkvisunstructuredgridsource.h"
 #include <vtkRenderer.h>
 #include <vtkRenderWindow.h>
 #include <vtkDataSetMapper.h>
@@ -11,325 +9,266 @@
 #include <vtkProperty.h>
 #include <vtkActor.h>
 #include <vtkUnstructuredGrid.h>
+#include "vtkVISUnstructuredGridSource.h"
+#include "vtkVISUnShadeMesh.h"
 
 vtkStandardNewMacro(vtkVISUnShadeMesh)
 
-/*
- * @brief: the constructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230324
- */
 vtkVISUnShadeMesh::vtkVISUnShadeMesh()
 {
-    meshLineWidth_ = 1.0;
-    shadeFlag_ = true;
+	meshLineWidth_ = 1.0;
+	shadeFlag_ = true;
 
-    cellActor_ = NULL;
+	cellActor_ = NULL;
 }
-
-/*
- * @brief: the destructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230324
- */
 vtkVISUnShadeMesh::~vtkVISUnShadeMesh()
 {
-    //if(cellActor_)
-    //{
-    //	 cellActor_->Delete();
-    // }
+	//if(cellActor_)
+	//{
+	//	 cellActor_->Delete();
+	// }
 }
 
-/*
- * @brief: Create Shade Mesh Display(鍒涘缓鐫€鑹茬綉鏍兼樉绀�)
- * @param: flag
- * @ret: void
- * @birth: created by czm in 20230324
- */
-void vtkVISUnShadeMesh::CreateShadeMeshDisplay(bool flag)//鐪熷垯闃村奖鍥撅紝鍋囧垯绾挎�鍥�
+void vtkVISUnShadeMesh::CreateShadeMeshDisplay(bool flag)//真则阴影图,假则线框图
 {
-    shadeFlag_ = flag;
-
-    cout<< "shade mesh: " << _source->unstruGrid->GetNumberOfPoints()<<" "<<_source->unstruGrid->GetNumberOfCells()<<endl;
-
-    vtkExtractEdges *edge = vtkExtractEdges::New();
-    edge->SetInputData(_source->unstruGrid);
-    edge->Update();
-
-    vtkDataSetMapper *mapper = vtkDataSetMapper::New();
-    if (flag == 1)
-    {
-        mapper->SetInputData(_source->unstruGrid);
-        cout << "shade mesh" << endl;
-    }
-    else
-    {
-        mapper->SetInputData(edge->GetOutput());
-    }
-    mapper->ScalarVisibilityOff();
-
-    vtkActor *actor = vtkActor::New();
-    actor->SetMapper(mapper);
-    (actor->GetProperty())->SetColor(0,0,1);
-
-    /*
-    if(flag == 0)
-    {
-    (actor->GetProperty())->SetRepresentationToWireframe();
-    }
-    */
-
-    if (_renderer != NULL)
-    {
-        _renderer->AddActor(actor);
-    }
-
-    _unActor = actor;
-
-    _vtkObjectsNum = 1;
-    _vtkObjects = new vtkObject*[_vtkObjectsNum];
-    _vtkObjects[0] = mapper;
+	shadeFlag_ = flag;
+
+	cout<< "shade mesh: " << _source->unstruGrid->GetNumberOfPoints()<<" "<<_source->unstruGrid->GetNumberOfCells()<<endl;
+
+	vtkExtractEdges *edge = vtkExtractEdges::New();
+	edge->SetInputData(_source->unstruGrid);
+	edge->Update();
+
+	vtkDataSetMapper *mapper = vtkDataSetMapper::New();
+	if (flag == 1)
+	{
+		mapper->SetInputData(_source->unstruGrid);
+		cout << "shade mesh" << endl;
+	}
+	else
+	{
+		mapper->SetInputData(edge->GetOutput());
+	}
+	mapper->ScalarVisibilityOff();
+
+	vtkActor *actor = vtkActor::New();
+	actor->SetMapper(mapper);
+	(actor->GetProperty())->SetColor(0,0,1);
+
+	/*
+	if(flag == 0)
+	{
+	(actor->GetProperty())->SetRepresentationToWireframe();
+	}
+	*/
+
+	if (_renderer != NULL)
+	{
+		_renderer->AddActor(actor);
+	}
+
+	_unActor = actor;
+
+	_vtkObjectsNum = 1;
+	_vtkObjects = new vtkObject*[_vtkObjectsNum];
+	_vtkObjects[0] = mapper;
 }
 
-/*
- * @brief: Create Shade Mesh  surface Display(鍒涘缓鐫€鑹茬綉鏍艰〃闈㈡樉绀�)
- * @param: flag
- * @ret: void
- * @birth: created by czm in 20230324
- */
-void vtkVISUnShadeMesh::CreateShadeMeshSurfaceDisplay(bool flag)//鍜岀�涓€涓�湁浣曞尯鍒�紵
+void vtkVISUnShadeMesh::CreateShadeMeshSurfaceDisplay(bool flag)//和第一个有何区别?
 {
-    shadeFlag_ = flag;
+	shadeFlag_ = flag;
 
-    vtkDataSetMapper *mapper = vtkDataSetMapper::New();
-    mapper->SetInputData(_source->unstruGrid);
+	vtkDataSetMapper *mapper = vtkDataSetMapper::New();
+	mapper->SetInputData(_source->unstruGrid);
 
-    mapper->ScalarVisibilityOff();
+	mapper->ScalarVisibilityOff();
 
-    vtkActor *actor = vtkActor::New();
-    actor->SetMapper(mapper);
-    (actor->GetProperty())->SetColor(0,0,1);
+	vtkActor *actor = vtkActor::New();
+	actor->SetMapper(mapper);
+	(actor->GetProperty())->SetColor(0,0,1);
 
-    if (flag == 0)
-    {
-        (actor->GetProperty())->SetRepresentationToWireframe();
-    }
+	if (flag == 0)
+	{
+		(actor->GetProperty())->SetRepresentationToWireframe();
+	}
 
-    if (_renderer != NULL)
-    {
-        _renderer->AddActor(actor);
-    }
+	if (_renderer != NULL)
+	{
+		_renderer->AddActor(actor);
+	}
 
-    _unActor = actor;
+	_unActor = actor;
 
-    _vtkObjectsNum = 1;
-    _vtkObjects = new vtkObject*[_vtkObjectsNum];
-    _vtkObjects[0] = mapper;
+	_vtkObjectsNum = 1;
+	_vtkObjects = new vtkObject*[_vtkObjectsNum];
+	_vtkObjects[0] = mapper;
 }
 
-/*
- * @brief: Set Mesh Line Width(璁剧疆缃戞牸绾垮�)
- * @param: value
- * @ret: void
- * @birth: created by czm in 20230324
- */
 void vtkVISUnShadeMesh::SetMeshLineWidth(double widthValue)
 {
-    if (_unActor != NULL)
-    {
-        (_unActor->GetProperty())->SetLineWidth(widthValue);
-        meshLineWidth_ = widthValue;
-    }
+	if (_unActor != NULL)
+	{
+		(_unActor->GetProperty())->SetLineWidth(widthValue);
+		meshLineWidth_ = widthValue;
+	}
 }
 
-/*
- * @brief: Set Mesh Edge Visibility(璁剧疆缃戞牸杈瑰彲瑙佹€�)
- * @param: flag
- * @ret: void
- * @birth: created by czm in 20230324
- */
 void vtkVISUnShadeMesh::SetMeshEdgeVisibility(bool flag)
 {
-    if (_unActor != NULL)
-    {
-        if (flag)
-        {
-            (_unActor->GetProperty())->EdgeVisibilityOn();
-        }
-        else
-        {
-            (_unActor->GetProperty())->EdgeVisibilityOff();
-        }
-
-    }
+	if (_unActor != NULL)
+	{
+		if (flag)
+		{
+			(_unActor->GetProperty())->EdgeVisibilityOn();
+		}
+		else
+		{
+			(_unActor->GetProperty())->EdgeVisibilityOff();
+		}
+		
+	}
 }
 
-/*
- * @brief: get Mesh line width(鑾峰彇缃戞牸绾垮�)
- * @param: void
- * @ret: value
- * @birth: created by czm in 20230324
- */
 double vtkVISUnShadeMesh::GetMeshLineWidth()
 {
-    if (_unActor != NULL)
-    {
-        return (_unActor->GetProperty())->GetLineWidth();
-    }
-    else
-    {
-        return -1;
-    }
+	if (_unActor != NULL)
+	{
+		return (_unActor->GetProperty())->GetLineWidth();
+	}
+	else
+	{
+		return -1;
+	}
 }
-
-/*
- * @brief: Change MeshLine Pattern(鏇存敼缃戞牸绾垮舰)
- * @param: flag
- * @ret: void
- * @birth: created by czm in 20230324
- */
-void vtkVISUnShadeMesh::ChangeMeshLinePattern(char* pattern)//璁剧疆line鐨勭偣鐢绘ā寮忥紝1涓哄儚绱犳墦寮€锛�0涓哄叧闂�紝鍙�拡瀵筼penGL瀹炵幇锛宱penGL2鏃犳晥
+ 
+void vtkVISUnShadeMesh::ChangeMeshLinePattern(char* pattern)//设置line的点画模式,1为像素打开,0为关闭,只针对openGL实现,openGL2无效
 {
-    if (_unActor != NULL)
-    {
-        if (strcmp(pattern, "Dotted") == 0)
-        {
-            (_unActor->GetProperty())->SetLineStipplePattern(1);
-        }
-        else
-        {
-            (_unActor->GetProperty())->SetLineStipplePattern(0XFFFF);
-        }
-    }
+	if (_unActor != NULL)
+	{
+		if (strcmp(pattern, "Dotted") == 0)
+		{
+			(_unActor->GetProperty())->SetLineStipplePattern(1);
+		}
+		else
+		{
+			(_unActor->GetProperty())->SetLineStipplePattern(0XFFFF);
+		}
+	}
 }
 
-/*
- * @brief: Create CellId Display(鍒涘缓鍗曞厓鏍糏D鏄剧ず)
- * @param: ID
- * @ret: vtkactor
- * @birth: created by czm in 20230324
- */
 vtkActor* vtkVISUnShadeMesh::CreateCellIdDisplay(int id)
 {
-    //vtkIdType vid = (vtkIdType)id;
-    //ostringstream os;
-    //os<<id;
-    //string s = os.str();
-    //const char* cid = s.c_str();
-
-    if (_unActor != NULL)
-    {
-        cout << id << endl;
-
-        vtkCell* cell = _source->unstruGrid->GetCell(id);
-
-        vtkPoints* points = vtkPoints::New();
-        points->DeepCopy(cell->GetPoints());
-
-        int num = 0;
-        num = points->GetNumberOfPoints();
-
-        vtkIdList* idList = vtkIdList::New();
-        idList->SetNumberOfIds(num);
-        for (int i = 0; i<num; i++)
-        {
-            idList->InsertId(i, i);
-        }
-
-        vtkUnstructuredGrid *unGrid = vtkUnstructuredGrid::New();
-        unGrid->Allocate(1, 1);
-        unGrid->InsertNextCell(cell->GetCellType(), idList);
-        unGrid->SetPoints(points);
-
-        vtkDataSetMapper* mapper = vtkDataSetMapper::New();
-        mapper->SetInputData(unGrid);
-
-        cellActor_ = vtkActor::New();
-        cellActor_->SetMapper(mapper);
-        (cellActor_->GetProperty())->SetColor(0, 1, 0);
-        (cellActor_->GetProperty())->SetRepresentationToWireframe();
-
-        return cellActor_;
-    }
-
-    return NULL;
-
-    //_renderer->AddActor(actor);
-
-    //int num = 0;
-    //num = points->GetNumberOfPoints();
-
-    //double pos[3];
-    //pos[0] = 0;
-    //pos[1] = 0;
-    //pos[2] = 0;
-
-    //double* p;
-    //for(int i=0; i<num; i++)
-    //{
-    // p = points->GetPoint(i);
-    //pos[0] += p[0];
-    //pos[1] += p[1];
-    //pos[2] += p[2];
-    //}
-
-    //pos[0] = pos[0]/num;
-    //pos[1] = pos[1]/num;
-    //pos[2] = pos[2]/num;
-
-    //char* ptr;
-    //int decpt, sign;
-    // ptr = ecvt(id, 2, &decpt, &sign);
-
-    //vtkTextActor3D* textActor = vtkTextActor3D::New();
-    //textActor->SetInput(ptr);
-    //textActor->SetPosition(pos[0], pos[1], pos[2]);
-    //(textActor->GetTextProperty())->SetColor(0, 1, 0);
-    //(textActor->GetTextProperty())->SetFontFamilyToArial();
-    //(textActor->GetTextProperty())->SetFontSize(1);
-
-    //vtkTextSource* text = vtkTextSource::New();
-    //text->SetText(cid);
-    //vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
-    //mapper->SetInputConnection(text->GetOutputPort());
-    //mapper->ScalarVisibilityOn();
-    //vtkActor* actor = vtkActor::New();
-    //actor->SetMapper(mapper);
-    //actor->AddPosition(cell->GetPoints()->GetPoint(0));
-    //actor->SetScale(.05,.05,.05);
-
-    //vtkIdFilter* idf = vtkIdFilter::New();
-    //idf->SetInput(_source->unstruGrid);
-    //idf->PointIdsOff();
-    //idf->FieldDataOff();
-    //idf->CellIdsOn();
-    //vtkCellCenters* cc = vtkCellCenters::New();
-    //cc->SetInputConnection(idf->GetOutputPort());
-    //cc->SetInput(_source->unstruGrid);
-    //vtkLabeledDataMapper* mapper = vtkLabeledDataMapper::New();
-    //mapper->SetInputConnection(cc->GetOutputPort());
-    //mapper->SetLabelModeToLabelIds();
-    //mapper->GetLabelTextProperty()->SetColor(0,1,0);
-    //vtkActor2D* actor = vtkActor2D::New();
-    //actor->SetMapper(mapper);
+	//vtkIdType vid = (vtkIdType)id;
+	//ostringstream os;
+	//os<<id;
+	//string s = os.str();
+	//const char* cid = s.c_str();
+
+	if (_unActor != NULL)
+	{
+		cout << id << endl;
+
+		vtkCell* cell = _source->unstruGrid->GetCell(id);
+
+		vtkPoints* points = vtkPoints::New();
+		points->DeepCopy(cell->GetPoints());
+
+		int num = 0;
+		num = points->GetNumberOfPoints();
+
+		vtkIdList* idList = vtkIdList::New();
+		idList->SetNumberOfIds(num);
+		for (int i = 0; i<num; i++)
+		{
+			idList->InsertId(i, i);
+		}
+
+		vtkUnstructuredGrid *unGrid = vtkUnstructuredGrid::New();
+		unGrid->Allocate(1, 1);
+		unGrid->InsertNextCell(cell->GetCellType(), idList);
+		unGrid->SetPoints(points);
+
+		vtkDataSetMapper* mapper = vtkDataSetMapper::New();
+		mapper->SetInputData(unGrid);
+
+		cellActor_ = vtkActor::New();
+		cellActor_->SetMapper(mapper);
+		(cellActor_->GetProperty())->SetColor(0, 1, 0);
+		(cellActor_->GetProperty())->SetRepresentationToWireframe();
+
+		return cellActor_;
+	}
+
+	return NULL;
+
+	//_renderer->AddActor(actor);
+
+	//int num = 0;
+	//num = points->GetNumberOfPoints();
+
+	//double pos[3];
+	//pos[0] = 0;
+	//pos[1] = 0;
+	//pos[2] = 0;
+
+	//double* p;
+	//for(int i=0; i<num; i++)
+	//{
+	// p = points->GetPoint(i);
+	//pos[0] += p[0];
+	//pos[1] += p[1];
+	//pos[2] += p[2];
+	//}    
+
+	//pos[0] = pos[0]/num;
+	//pos[1] = pos[1]/num;
+	//pos[2] = pos[2]/num;
+
+	//char* ptr;
+	//int decpt, sign;
+	// ptr = ecvt(id, 2, &decpt, &sign);
+
+	//vtkTextActor3D* textActor = vtkTextActor3D::New();
+	//textActor->SetInput(ptr);
+	//textActor->SetPosition(pos[0], pos[1], pos[2]);
+	//(textActor->GetTextProperty())->SetColor(0, 1, 0);
+	//(textActor->GetTextProperty())->SetFontFamilyToArial();
+	//(textActor->GetTextProperty())->SetFontSize(1);
+
+	//vtkTextSource* text = vtkTextSource::New();
+	//text->SetText(cid);
+	//vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
+	//mapper->SetInputConnection(text->GetOutputPort());
+	//mapper->ScalarVisibilityOn();
+	//vtkActor* actor = vtkActor::New();
+	//actor->SetMapper(mapper);
+	//actor->AddPosition(cell->GetPoints()->GetPoint(0));
+	//actor->SetScale(.05,.05,.05);
+
+	//vtkIdFilter* idf = vtkIdFilter::New();
+	//idf->SetInput(_source->unstruGrid);
+	//idf->PointIdsOff();
+	//idf->FieldDataOff();
+	//idf->CellIdsOn();
+	//vtkCellCenters* cc = vtkCellCenters::New();
+	//cc->SetInputConnection(idf->GetOutputPort());
+	//cc->SetInput(_source->unstruGrid);
+	//vtkLabeledDataMapper* mapper = vtkLabeledDataMapper::New();
+	//mapper->SetInputConnection(cc->GetOutputPort());
+	//mapper->SetLabelModeToLabelIds();
+	//mapper->GetLabelTextProperty()->SetColor(0,1,0);
+	//vtkActor2D* actor = vtkActor2D::New();
+	//actor->SetMapper(mapper);
 }
 
-/*
- * @brief: ModifiedCellDisplayColor(淇�敼鐨勫崟鍏冩牸鏄剧ず棰滆壊)
- * @param: rgb
- * @ret: void
- * @birth: created by czm in 20230324
- */
 void vtkVISUnShadeMesh::ModifiedCellDisplayColor(double r, double g, double b)
 {
-    if (cellActor_ != NULL)
-    {
-        (cellActor_->GetProperty())->SetColor(r, g, b);
-    }
-    else
-    {
-        ErrorInfo(1, "No Cell Actor!");
-    }
+	if (cellActor_ != NULL)
+	{
+		(cellActor_->GetProperty())->SetColor(r, g, b);
+	}
+	else
+	{
+		ErrorInfo(1, "No Cell Actor!");
+	}
 }

+ 9 - 6
CAE_Solution/src/VTK/visualization_VTK/vtkvisunshademesh.h

@@ -1,12 +1,14 @@
-#ifndef VTKVISUNSHADEMESH_H
-#define VTKVISUNSHADEMESH_H
-#include "vtkvisunstructuredgridmanager.h"
-#include <vtkObjectFactory.h>
+#ifndef vtkVISUnShadeMesh_h
+#define vtkVISUnShadeMesh_h
 
-class vtkVISUnShadeMesh: public vtkVISUnstructuredGridManager
+
+#include "vtkVISUnstructuredGridManager.h"
+
+class  vtkVISUnShadeMesh : public vtkVISUnstructuredGridManager
 {
 public:
     static vtkVISUnShadeMesh *New();
+
     vtkVISUnShadeMesh();
     ~vtkVISUnShadeMesh();
 
@@ -29,4 +31,5 @@ protected:
     vtkActor* cellActor_;
 };
 
-#endif // VTKVISUNSHADEMESH_H
+#endif
+

+ 0 - 2612
CAE_Solution/src/VTK/visualization_VTK/vtkvisunslice.cpp

@@ -1,2612 +0,0 @@
-#include "vtkvisunslice.h"
-#include <vtkSortDataArray.h>
-#include <algorithm>
-#include <vtkCellArray.h>
-
-#include <vtkActor.h>
-#include <vtkRenderer.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkDoubleArray.h>
-#include <vtkPointData.h>
-#include <vtkCellData.h>
-#include <vtkRenderWindow.h>
-#include "vtkvisunstructuredgridsource.h"
-#include <vtkRenderWindowInteractor.h>
-#include <vtkProperty.h>
-#include <vtkObject.h>
-#include <vtkObjectFactory.h>
-vtkStandardNewMacro(vtkVISUnSlice)
-
-vtkVISUnSlice::vtkVISUnSlice()
-{
-    sliceActors_ = new vtkActor*[6];
-    sliceTable_ = new vtkLookupTable*[6];
-
-    for (int i = 0; i<6;i++)
-    {
-        sliceActors_[i] = vtkActor::New();
-        sliceActors_[i] = NULL;
-
-        sliceTable_[i] = vtkLookupTable::New();
-        sliceTable_[i] = NULL;
-    }
-
-    //sliceMapper_ = new vtkDataSetMapper*[6];
-    sliceMapper_ = vtkCollection::New();
-    sliceMapper_ = NULL;
-
-    contourLinesFilter_ = vtkContourFilter::New ();
-    contourLinesFilter_ = NULL;
-
-    contourLabelFilter_ = vtkContourFilter::New ();
-    contourLabelFilter_ = NULL;
-
-    sliceGlyph2D_ = vtkGlyphSource2D::New ();
-    sliceGlyph2D_ = NULL;
-
-    sliceGlyph3D_ = vtkGlyph3D::New();
-    sliceGlyph3D_ = NULL;
-
-    shadeColor_[0] = 1.0;
-    shadeColor_[1] = 0.0;
-    shadeColor_[2] = 0.0;
-
-    meshColor_[0] = 0.0;
-    meshColor_[1] = 1.0;
-    meshColor_[2] = 0.0;
-
-
-    planeNormal_[0] = 1.0;
-    planeNormal_[1] = 0.0;
-    planeNormal_[2] = 0.0;
-
-    conLevel_ = 5;
-    usedScalarIndex_ = -1;
-    usedVectorIndex_ = -1;
-
-    for (int i=0; i<3; i++)
-    {
-        planeOrigin_[i] = 0;
-    }
-
-    cutSource_ = NULL;
-    cutActor_ = NULL;
-    gridSource_ = NULL;
-
-    //cutMapper_ = NULL;
-
-    slicePlane_ = NULL;
-    planeWidget_ = NULL;
-
-    scalarRange_[0] = 0;
-    scalarRange_[1] = 0;
-
-    bandedContourFilter_ = 0;
-    contourLinesFilter_ = 0;
-    contourLabelFilter_ = 0;
-    scalarSource_ = 0;
-}
-
-vtkVISUnSlice::~vtkVISUnSlice()
-{
-    ErrorInfo(0, "destructure func 0");
-    if (cutActor_ != NULL)
-    {
-        if (_renderer != NULL)
-        {
-            _renderer->RemoveActor(cutActor_);
-        }
-        cutActor_->Delete();
-        cutActor_ = NULL;
-    }
-    ErrorInfo(0, "destructure func 1");
-
-    if(planeWidget_ != NULL)
-    {
-        //if(_renWin != NULL)
-        //{
-        //    planeWidget->SetInteractor(_renWin->GetInteractor());
-        //}
-        // planeWidget_->EnabledOff();
-        planeWidget_->Delete();
-        planeWidget_ = NULL;
-    }
-    ErrorInfo(0, "destructure func 2");
-
-    if (cutSource_ != NULL)
-    {
-        cutSource_->Delete();
-        cutSource_ = NULL;
-    }
-    ErrorInfo(0, "destructure func 3");
-    if (gridSource_ != NULL)
-    {
-        gridSource_->Delete();
-        gridSource_ = NULL;
-    }
-    ErrorInfo(0, "destructure func 4");
-
-    if(slicePlane_ != NULL)
-    {
-        slicePlane_->Delete();
-        slicePlane_ = NULL;
-    }
-    ErrorInfo(0, "destructure func 5");
-
-    /*if(cutMapper_ != NULL)
-    {
-        cutMapper_->Delete();
-        cutMapper_ = NULL;
-    }*/
-    for (int i=0;i<6;i++)
-    {
-        if (_renderer != NULL)
-        {
-            if (sliceActors_[i] != NULL)
-            {
-                _renderer->RemoveActor(sliceActors_[i]);
-                sliceActors_[i]->Delete();
-                sliceActors_[i] = NULL;
-            }
-        }
-    }
-    delete [] sliceActors_;
-
-    for (int i=0;i<6;i++)
-    {
-        if (sliceTable_[i] != NULL)
-        {
-            sliceTable_[i]->Delete();
-            sliceTable_[i] = NULL;
-        }
-    }
-    delete [] sliceTable_;
-
-    ErrorInfo(0, "destructure func 6");
-
-    if (sliceMapper_!= NULL)
-    {
-        sliceMapper_->Delete ();
-        sliceMapper_ = NULL;
-    }
-    if (contourLinesFilter_!= NULL)
-    {
-        contourLinesFilter_->Delete();
-        contourLinesFilter_ = NULL;
-    }
-    if (contourLabelFilter_!= NULL)
-    {
-        contourLabelFilter_->Delete();
-        contourLabelFilter_ = NULL;
-    }
-    if (sliceGlyph2D_!= NULL)
-    {
-        sliceGlyph2D_->Delete();
-        sliceGlyph2D_ = NULL;
-    }
-    if (sliceGlyph3D_!= NULL)
-    {
-        sliceGlyph3D_->Delete();
-        sliceGlyph3D_ = NULL;
-    }
-    if (scalarSource_ != 0)
-    {
-        scalarSource_->Delete();
-        scalarSource_ = 0;
-    }
-    ErrorInfo(0, "destructure func 7 end.");
-}
-
-/*
- * @brief:  Set the slice scalar/vector data source(设置切片标量/矢量数据源)
- * @param: vector data and scalar data
- * @ret: void
- * @birth: created by czm in 20230326
- */
-void vtkVISUnSlice::SetSliceSource(char* scalar, char* vector)
-{
-    int index1 = -1;
-    int index2 = -1;
-
-    if(scalar != NULL)
-    {
-        index1 = _source->GetScalarIndex(scalar);
-    }
-    if(vector != NULL)
-    {
-        index2 = _source->GetVectorIndex(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
-            {
-                (unGrid->GetCellData())->SetScalars(_source->cellScalarSource_[index1]);
-            }
-
-        }
-        if (index2 != -1)
-        {
-            usedVectorIndex_ = index2;
-
-            if(_source->vectorSource[index2]->GetDataSize() != 0)
-            {
-                (unGrid->GetPointData())->SetVectors(_source->vectorSource[index2]);
-            }
-            else
-            {
-                (unGrid->GetCellData())->SetVectors(_source->cellVectorSource_[index2]);
-            }
-        }
-        unGrid->Modified();
-
-    vtkPlane *plane = vtkPlane::New();
-        plane->SetNormal(planeNormal_[0], planeNormal_[1], planeNormal_[2]);
-
-    vtkCutter *cutter = vtkCutter::New();
-        cutter->SetInputData(unGrid);
-        cutter->SetCutFunction(plane);
-        cutter->GenerateCutScalarsOff();
-        cutter->SetSortByToSortByCell();
-        cutter->Update();
-
-        //cout<<"test here 1111"<<(cutter->GetOutput())->GetNumberOfPoints()<<endl;
-
-    gridSource_ = unGrid;
-    cutSource_ = cutter;
-    slicePlane_ =  plane;
-}
-
-/*
-* @brief: Write point,scalar and vector data to file.(将点、标量和矢量数据写入文件)
-* @param: filename
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::WriteScalarVectorData(const char* FileName)
-{
-    cutSource_->Update();
-
-    vtkFloatArray* cutScalar = vtkFloatArray::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();
-
-    vtkFloatArray* cutVector = vtkFloatArray::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];
-
-
-    int pointNum = 0;
-    pointNum = (cutSource_->GetOutput())->GetNumberOfPoints();
-
-    if (_source->vectorSource[usedVectorIndex_]->GetDataSize() == 0)
-    {
-        return;
-    }
-    double value;
-    double* v;
-    double p[3];
-
-    ofstream f(FileName);
-    if (!f)
-    {
-        return;
-    }
-    f<<std::setiosflags(ios::left)<<std::setw(30)<<"x"
-        <<std::setiosflags(ios::left)<<std::setw(30)<<"y"
-        <<std::setiosflags(ios::left)<<std::setw(30)<<"z"
-        <<std::setiosflags(ios::left)<<std::setw(20)<<"scalar"
-        <<std::setiosflags(ios::left)<<std::setw(20)<<"v0"
-        <<std::setiosflags(ios::left)<<std::setw(20)<<"v1"
-        <<std::setiosflags(ios::left)<<std::setw(20)<<"v2"
-        <<endl;
-
-    for(int j=0; j<pointNum; j++)
-    {
-        (cutSource_->GetOutput())->GetPoint(j, p);
-
-        value = cutScalar->GetValue(j);
-
-        v = cutVector->GetTuple3(j);
-
-        f<<std::setiosflags(ios::left)<<std::setw(20)<<p[0]
-            <<std::setiosflags(ios::left)<<std::setw(20)<<p[1]
-            <<std::setiosflags(ios::left)<<std::setw(20)<<p[2]
-            <<std::setiosflags(ios::left)<<std::setw(20)<<value
-            <<std::setiosflags(ios::left)<<std::setw(20)<<v[0]
-            <<std::setiosflags(ios::left)<<std::setw(20)<<v[1]
-            <<std::setiosflags(ios::left)<<std::setw(20)<<v[2]
-            <<endl;
-    }
-    f.close();
-}
-
-/*
-* @brief: Get cut scalar data.(获取切面标量数据。)
-* @param: void
-* @ret: float array
-* @birth: created by czm in 20230326
-*/
-vtkFloatArray* vtkVISUnSlice::GetCutScalarData(void)
-{
-    if(usedScalarIndex_ == -1)
-    {
-        return NULL;
-    }
-
-    cutSource_->Update();
-
-    vtkFloatArray* cutScalar = vtkFloatArray::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();
-
-    return cutScalar;
-}
-
-/*
-* @brief: Get cut vector data.(获取切面矢量数据。)
-* @param: index(index of the vector array)
-* @ret: float array
-* @birth: created by czm in 20230326
-*/
-vtkFloatArray* vtkVISUnSlice::GetCutVectorData(int index)
-{
-    if (index < 0 || index > 2)
-    {
-        return NULL;
-    }
-
-    if(usedVectorIndex_ == -1)
-    {
-        return NULL;
-    }
-
-    cutSource_->Update();
-
-    vtkFloatArray* vec = vtkFloatArray::New();
-        vec->SetNumberOfComponents(3);
-
-        if(usedVectorIndex_ != -1)
-        {
-            if(_source->vectorSource[usedVectorIndex_]->GetDataSize() != 0)
-            {
-                vec->DeepCopy((cutSource_->GetOutput())->GetPointData()->GetVectors());
-            }
-            else
-            {
-                vec->DeepCopy((cutSource_->GetOutput())->GetCellData()->GetVectors());
-            }
-        }
-        vec->Modified();
-
-    vtkFloatArray* cutVector = vtkFloatArray::New();
-        cutVector->SetNumberOfComponents(1);
-        cutVector->SetNumberOfTuples(vec->GetNumberOfTuples());
-        cutVector->CopyComponent(0, vec, index);
-        cutVector->Modified();
-
-    return cutVector;
-}
-
-/*
-* @brief: Get cut vector data.(获取切面矢量数据。)
-* @param: void
-* @ret: float array
-* @birth: created by czm in 20230326
-*/
-vtkFloatArray* vtkVISUnSlice::GetCutVectorData(void)
-{
-    if(usedVectorIndex_ == -1)
-    {
-        return NULL;
-    }
-
-    cutSource_->Update();
-
-    vtkFloatArray* cutVector = vtkFloatArray::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();
-
-    return cutVector;
-}
-
-/*
-* @brief: Get cut point data by index.(按索引获取切割点数据。)
-* @param: index Indicate the coordinate(0-x,1-y,2-z)
-* @ret: float array
-* @birth: created by czm in 20230326
-*/
-vtkFloatArray* vtkVISUnSlice::GetCutPointData(int index)
-{
-     if (index < 0 || index > 2)
-    {
-        return NULL;
-    }
-
-    cutSource_->Update();
-
-    vtkFloatArray* cutPointData = vtkFloatArray::New();
-       cutPointData->SetNumberOfComponents(1);
-
-    int pointNum = (cutSource_->GetOutput())->GetNumberOfPoints();
-
-    double point[3];
-
-    for(int j=0; j<pointNum; j++)
-    {
-        (cutSource_->GetOutput())->GetPoint(j, point);
-
-        cutPointData->InsertNextValue(point[index]);
-    }
-    cutPointData->Modified();
-
-    return cutPointData;
-}
-
-/*
-* @brief: Change slice scalar/vector data source(更改切片标量/矢量数据源)
-* @param: scalar
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ModifySliceSourceScalar(char* scalar)
-{
-    if (gridSource_ == NULL)
-    {
-        ErrorInfo(1,"Grid Source are not Setted!");
-        return;
-    }
-
-    int index = -1;
-    if(scalar != NULL)
-    {
-        index = _source->GetScalarIndex(scalar);
-    }
-    if (index == -1)
-    {
-        ErrorInfo(1,"Scalar data are not existed!");
-        return;
-    }
-    if (_source->scalarSource[index]->GetDataSize() != 0)
-    {
-        (gridSource_->GetPointData())->SetScalars(_source->scalarSource[index]);
-    }
-    else
-    {
-        (gridSource_->GetCellData())->SetScalars(_source->cellScalarSource_[index]);
-    }
-    gridSource_->Modified();
-
-    usedScalarIndex_ = index;
-
-    //2011-05-10 zhuqin add begin.
-    if(bandedContourFilter_ != NULL)
-    {
-        bandedContourFilter_->GenerateValues(conLevel_, _source->scalarRange[usedScalarIndex_][0],_source->scalarRange[usedScalarIndex_][1]);
-        bandedContourFilter_->ClippingOn();
-        bandedContourFilter_->Modified();
-    }
-    if (contourLinesFilter_ != NULL)
-    {
-      contourLinesFilter_->GenerateValues(conLevel_, _source->scalarRange[usedScalarIndex_][0],_source->scalarRange[usedScalarIndex_][1]);
-      contourLinesFilter_->Modified();
-    }
-    if (contourLabelFilter_!= NULL)
-    {
-        contourLabelFilter_->GenerateValues(conLevel_, _source->scalarRange[usedScalarIndex_][0],_source->scalarRange[usedScalarIndex_][1]);
-        contourLabelFilter_->Modified();
-    }
-    //2011-05-10 zhuqin add end.
-
-
-    for (int i= 0; i<6; i++)
-    {
-        if (i == 0 || i== 1 || i == 3)
-        {
-            if(sliceActors_[i] != NULL)
-            {
-                (sliceActors_[i]->GetMapper())->GetLookupTable()->SetRange(_source->scalarRange[usedScalarIndex_][0],_source->scalarRange[usedScalarIndex_][1]);
-                (sliceActors_[i]->GetMapper())->GetLookupTable()->Modified();
-
-                (sliceActors_[i]->GetMapper())->SetScalarRange(_source->scalarRange[usedScalarIndex_][0],_source->scalarRange[usedScalarIndex_][1]);
-
-                if (_source->scalarSource[usedScalarIndex_]->GetDataSize() != 0)
-                {
-                    (sliceActors_[i]->GetMapper())->SetScalarModeToUsePointData();
-                }
-                else
-                {
-                    (sliceActors_[i]->GetMapper())->SetScalarModeToUseCellData();
-                }
-
-                (sliceActors_[i]->GetMapper())->Modified();
-                sliceActors_[i]->Modified();
-            }
-        }
-
-    }
-
-}
-
-/*
-* @brief: Change slice scalar/vector data source(更改切片标量/矢量数据源)
-* @param: scalar
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ModifySliceSourceVector(char* vector)
-{
-    if (gridSource_ == NULL)
-    {
-        ErrorInfo(1,"Grid Source are not Setted!");
-        return;
-    }
-
-    int index = -1;
-
-    if(vector != NULL)
-    {
-        index = _source->GetVectorIndex(vector);
-    }
-    if (index == -1)
-    {
-        ErrorInfo(1,"Vector data are not existed!");
-        return;
-    }
-
-    usedVectorIndex_ = index;
-
-    if(_source->vectorSource[index]->GetDataSize() != 0)
-    {
-        (gridSource_->GetPointData())->SetVectors(_source->vectorSource[index]);
-    }
-    else
-    {
-        (gridSource_->GetCellData())->SetVectors(_source->cellVectorSource_[index]);
-    }
-    gridSource_->Modified();
-}
-
-/*
-* @brief: Create slice plane widget(创建切片平面小部件)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::CreateSliceWidget()
-{
-    if (cutSource_ == NULL)
-    {
-        ErrorInfo(1,"Slice Source Not Set");
-        return;
-    }
-    double* bounds;
-    bounds = _source->GetSourceBounds();
-
-    planeOrigin_[0] = (bounds[0]+bounds[1])/2;
-    planeOrigin_[1] = (bounds[2]+bounds[3])/2;
-    planeOrigin_[2] = (bounds[4]+bounds[5])/2;
-
-    vtkImplicitPlaneWidget* planeWidget = vtkImplicitPlaneWidget::New();
-        planeWidget->SetInteractor(_renWin->GetInteractor());
-        planeWidget->SetPlaceFactor(1.0);
-
-        planeWidget->SetHandleSize(0.005);
-        planeWidget->SetDiagonalRatio(0.2);
-
-        planeWidget->GetOutlineProperty()->SetOpacity(0.0);
-        planeWidget->GetEdgesProperty()->SetOpacity(0.0);
-
-        planeWidget->GetPlane(slicePlane_);
-        planeWidget->SetInputData(cutSource_->GetOutput());
-
-        planeWidget->TubingOff();
-        //planeWidget->OutsideBoundsOff();
-        planeWidget->SetOrigin(planeOrigin_[0], planeOrigin_[1], planeOrigin_[2]);
-        planeWidget->PlaceWidget(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
-        planeWidget->On();
-
-        planeWidget_ = planeWidget;
-
-        vtkCallbackCommand *cc = vtkCallbackCommand::New();
-            cc->SetCallback(GenerateSliceProData);
-            cc->SetClientData(this);
-
-        planeWidget->AddObserver(vtkCommand::InteractionEvent, cc);
-
-        ShowOffSlicePlane();
-}
-
-/*
-* @brief: Generate Slice ProData(生成切片ProData)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::GenerateSliceProData(vtkObject *caller, unsigned long, void* obj, void *)
-{
-    vtkVISUnSlice* usObj = (vtkVISUnSlice*)obj;
-
-    if (usObj->planeWidget_ == NULL)
-    {
-        usObj->ErrorInfo(1,"Plane Widget Not Created");
-        return;
-    }
-    usObj->planeWidget_->GetPlane(usObj->slicePlane_);
-
-    //int num;
-    //num = cutSource_->GetOutput()->GetNumberOfPoints();
-}
-
-/*
-* @brief: Show the slice plane(显示切片平面)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ShowOnSlicePlane()
-{
-    if (planeWidget_ != NULL)
-    {
-        planeWidget_->DrawPlaneOn();
-        planeWidget_->UpdatePlacement();
-    }
-
-}
-
-/*
-* @brief: hide the slice plane(隐藏切片平面)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ShowOffSlicePlane()
-{
-    if (planeWidget_ != NULL)
-    {
-        planeWidget_->DrawPlaneOff();
-        planeWidget_->UpdatePlacement();
-    }
-
-}
-
-/*
-* @brief: Show On Slice Plane Widget(显示切片平面小部件)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ShowOnSlicePlaneWidget()
-{
-    if (planeWidget_ != NULL)
-    {
-       planeWidget_->On();
-    }
-
-    if (cutActor_)
-    {
-        cutActor_->VisibilityOn();
-    }
-}
-
-/*
-* @brief: Show Off Slice Plane Widget(隐藏切片平面小部件)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ShowOffSlicePlaneWidget()
-{
-    if (planeWidget_ != NULL)
-    {
-        planeWidget_->Off();
-    }
-
-    if (cutActor_)
-    {
-        cutActor_->VisibilityOff();
-    }
-}
-
-/*
-* @brief: Set the normal of the slice plane(设置切片平面的法线)
-* @param: xyz
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::SetSlicePlaneNormal(double nx, double ny, double nz)
-{
-    if (nx == 0 && ny == 0 && nz == 0) {
-        return;
-    }
-
-    if (planeWidget_ != NULL)
-    {
-        planeNormal_[0] = nx;
-        planeNormal_[1] = ny;
-        planeNormal_[2] = nz;
-
-        slicePlane_->SetNormal(nx, ny, nz);
-        planeWidget_->SetNormal(nx, ny, nz);
-    }
-}
-
-/*
-* @brief: Set the normal of the slice plane(设置切片平面的法线到x坐标轴)
-* @param: x
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::SetSlicePlaneNormalToX()
-{
-    if (planeWidget_ != NULL)
-    {
-        slicePlane_->SetNormal(1, 0, 0);
-        planeWidget_->SetNormal(1, 0, 0);
-
-        planeNormal_[0] = 1.0;
-        planeNormal_[1] = 0;
-        planeNormal_[2] = 0;
-    }
-}
-
-/*
-* @brief: Set the normal of the slice plane(设置切片平面的法线到y坐标轴)
-* @param: y
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::SetSlicePlaneNormalToY()
-{
-    if (planeWidget_ == NULL)
-    {
-        ErrorInfo(1,"Plane Widget Not Created");
-        return;
-    }
-    slicePlane_->SetNormal(0, 1, 0);
-    planeWidget_->SetNormal(0, 1, 0);
-
-    planeNormal_[0] = 0;
-    planeNormal_[1] = 1.0;
-    planeNormal_[2] = 0;
-}
-
-/*
-* @brief: Set the normal of the slice plane(设置切片平面的法线到z坐标轴)
-* @param: z
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::SetSlicePlaneNormalToZ()
-{
-    if (planeWidget_ == NULL)
-    {
-        ErrorInfo(1,"Plane Widget Not Created");
-        return;
-    }
-    slicePlane_->SetNormal(0, 0, 1);
-    planeWidget_->SetNormal(0, 0, 1);
-
-    planeNormal_[0] = 0;
-    planeNormal_[1] = 0;
-    planeNormal_[2] = 1.0;
-}
-
-/*
-* @brief: Get the normal direction of the slice plane(获取切片平面的法线方向)
-* @param: y
-* @ret: double[3]contains the normal direction
-* @birth: created by czm in 20230326
-*/
-double* vtkVISUnSlice::GetSlicePlaneNormal()
-{
-    return this->planeNormal_;
-}
-
-/*
-* @brief: Set the slice plane origin(设置切片平面原点)
-* @param: xyz
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::SetSlicePlaneOrigin(double ox, double oy, double oz)
-{
-    if (planeWidget_ == NULL)
-    {
-        ErrorInfo(1,"Plane Widget Not Created");
-        return;
-    }
-    slicePlane_->SetOrigin(ox, oy, oz);
-    planeWidget_->SetOrigin(ox, oy, oz);
-
-    planeOrigin_[0] = ox;
-    planeOrigin_[0] = oy;
-    planeOrigin_[0] = oz;
-
-}
-
-/*
-* @brief: Get the slice plane origin(获取切片平面原点)
-* @param: void
-* @ret: double[3] contains the origin
-* @birth: created by czm in 20230326
-*/
-double* vtkVISUnSlice::GetSlicePlaneOrigin()
-{
-    return this->planeOrigin_;
-}
-
-/*
-* @brief: Create UnSlice display pipeline(创建UnSlice显示管线)
-* @param: void
-* @ret: double[3] contains the origin
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::CreateUnSliceContourDisplay()
-{
-    if (cutSource_ == NULL)
-    {
-        ErrorInfo(1,"Slice Source Not Set");
-        return;
-    }
-
-    double range[2];
-    if (usedScalarIndex_ != -1)
-    {
-        range[0] = _source->scalarRange[usedScalarIndex_][0];
-        range[1]  = _source->scalarRange[usedScalarIndex_][1];
-    }
-    else
-    {
-        range[0] = 0;
-        range[1] = 0;
-    }
-    cutSource_->Update();
-
-    //cout<<range[0]<<" "<<range[1]<<endl;
-
-    //cout<<"cut  num:  "<<(cutSource_->GetOutput())->GetNumberOfPoints()<<endl;
-
-    vtkGeometryFilter *geoFilter = vtkGeometryFilter::New();
-        geoFilter->SetInputData(cutSource_->GetOutput());
-        geoFilter->Update();
-
-    //cout<<"geo num: "<<(geoFilter->GetOutput())->GetNumberOfPoints()<<endl;
-
-    vtkBandedPolyDataContourFilter *conFilter = vtkBandedPolyDataContourFilter::New();
-        conFilter->SetInputData(geoFilter->GetOutput());
-        conFilter->GenerateValues(conLevel_, range[0], range[1]);
-        conFilter->ClippingOn();
-        conFilter->Modified();
-        conFilter->Update();
-
-    //cout<<"con num: "<<(conFilter->GetOutput())->GetNumberOfPoints()<<endl;
-
-
-    vtkDataSetMapper *mapper = vtkDataSetMapper::New();
-        /*mapper->InterpolateScalarsBeforeMappingOn();
-
-        if(_source->scalarSource[usedScalarIndex_]->GetDataSize() != 0)
-        {
-            //cout<<"test here 3333"<<endl;
-            mapper->SetInputConnection(conFilter->GetOutputPort());
-        }
-        else
-        {
-            mapper->SetInputConnection(geoFilter->GetOutputPort());
-        }
-        mapper->SetScalarRange(range[0],range[1]);
-
-        if (usedScalarIndex_ != -1)
-        {
-            if (_source->scalarSource[usedScalarIndex_]->GetDataSize() != 0)
-            {
-                mapper->SetScalarModeToUsePointData();
-            }
-            else
-            {
-                mapper->SetScalarModeToUseCellData();
-            }
-        }
-
-    vtkLookupTable *table = (vtkLookupTable*)mapper->GetLookupTable();
-        table->GetHueRange(range);
-        table->SetHueRange(range[1],range[0]);
-        table->SetNumberOfColors(conLevel_);*/
-    mapper->SetInputData(_source->unstruGrid);
-
-    vtkActor *actor = vtkActor::New();
-        actor->SetMapper(mapper);actor->GetProperty()->SetColor(1,0,0);
-
-    if (_renderer != NULL)
-    {
-        _renderer->AddActor(actor);
-    }
-
-    sliceActors_[0] = actor;
-
-    //sliceTable_[0] = table;
-
-    bandedContourFilter_ = conFilter;
-}
-
-/*
-* @brief: Show On UnSlice Display(显示UNslice)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ShowOnUnSliceContourDisplay()
-{
-    if (sliceActors_[0] != NULL)
-    {
-        sliceActors_[0]->VisibilityOn();
-    }
-}
-
-/*
-* @brief: Show Off UnSlice Display(关闭UNslice显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ShowOffUnSliceContourDisplay()
-{
-    if (sliceActors_[0] != NULL)
-    {
-
-        sliceActors_[0]->VisibilityOff();
-
-    }
-}
-
-/*
-* @brief: Delete UnSlice Display(删除UNslice显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::DeleteUnSliceContourDisplay()
-{
-    if (sliceActors_[0] != NULL)
-    {
-        sliceActors_[0]->VisibilityOff();
-
-        if (_renderer != NULL)
-        {
-            _renderer->RemoveActor(sliceActors_[0]);
-        }
-
-        sliceActors_[0]->Delete();
-    }
-}
-
-/*
-* @brief: Create UnSlice Contour Lines Display(创建取消切片等高线显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::CreateUnSliceContourLinesDisplay()
-{
-    if (cutSource_ == NULL)
-    {
-        ErrorInfo(1,"Slice Source Not Set");
-        return;
-    }
-
-    double range[2];
-    if (usedScalarIndex_ != -1)
-    {
-        range[0] = _source->scalarRange[usedScalarIndex_][0];
-        range[1] = _source->scalarRange[usedScalarIndex_][1];
-    }
-    else
-    {
-        range[0] = 0;
-        range[1] = 0;
-    }
-
-    vtkContourFilter *conFilter = vtkContourFilter::New();
-        conFilter->SetInputConnection(cutSource_->GetOutputPort());
-        conFilter->GenerateValues(conLevel_, range[0],range[1]);
-        conFilter->Update();
-
-    vtkDataSetMapper *mapper = vtkDataSetMapper::New();
-        mapper->InterpolateScalarsBeforeMappingOn();
-        mapper->SetInputConnection(conFilter->GetOutputPort());
-        mapper->SetScalarRange(range[0],range[1]);
-
-        if (usedScalarIndex_ != -1)
-        {
-            if (_source->scalarSource[usedScalarIndex_]->GetDataSize() != 0)
-            {
-                mapper->SetScalarModeToUsePointData();
-            }
-            else
-            {
-                mapper->SetScalarModeToUseCellData();
-            }
-        }
-
-    vtkLookupTable *table = (vtkLookupTable*)mapper->GetLookupTable();
-        table->GetHueRange(range);
-        table->SetHueRange(range[1],range[0]);
-        table->SetNumberOfColors(conLevel_);
-
-    vtkActor *actor = vtkActor::New();
-        actor->SetMapper(mapper);
-
-    if (_renderer != NULL)
-    {
-        _renderer->AddActor(actor);
-    }
-
-    contourLinesFilter_ = conFilter;
-    /*if (sliceMapper_ != NULL)
-    {
-        sliceMapper_->AddItem (mapper);
-    }*/
-    sliceActors_[1] = actor;
-    sliceTable_[1] = table;
-}
-
-/*
-* @brief: Show On UnSlice Contour Lines Display(等高线显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ShowOnUnSliceContourLinesDisplay()
-{
-    if(sliceActors_[1] != NULL)
-    {
-        sliceActors_[1]->VisibilityOn();
-    }
-}
-
-/*
-* @brief: Show On UnSlice Contour Lines Display(关闭等高线显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ShowOffUnSliceContourLinesDisplay()
-{
-    if(sliceActors_[1] != NULL)
-    {
-        sliceActors_[1]->VisibilityOff();
-    }
-}
-
-/*
-* @brief: Delete UnSlice Contour Lines Display(删除等高线显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::DeleteUnSliceCOntourLinesDisplay()
-{
-    if (sliceActors_[1] != NULL)
-    {
-        sliceActors_[1]->VisibilityOff();
-
-        if (_renderer != NULL)
-        {
-            _renderer->RemoveActor(sliceActors_[1]);
-        }
-
-        sliceActors_[1]->Delete();
-    }
-}
-
-/*
-* @brief: Create UnSlice Contour Lines Label Display(创建UNslice等高线标签显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::CreateUnSliceContourLinesLabelDisplay()
-{
-    if (cutSource_ == NULL)
-    {
-        ErrorInfo(1,"Slice Source Not Set");
-        return;
-    }
-
-    double range[2];
-    if (usedScalarIndex_ != -1)
-    {
-        range[0] = _source->scalarRange[usedScalarIndex_][0];
-        range[1] = _source->scalarRange[usedScalarIndex_][1];
-    }
-    else
-    {
-        range[0] = 0;
-        range[1] = 0;
-    }
-
-
-    vtkContourFilter *labelFilter = vtkContourFilter::New();
-        labelFilter->SetInputConnection(cutSource_->GetOutputPort());
-        labelFilter->GenerateValues(conLevel_, range[0],range[1]);
-        labelFilter->Update();
-
-    int numPoints = labelFilter->GetOutput()->GetNumberOfPoints();
-    vtkMaskPoints *mask = vtkMaskPoints::New();
-        mask->SetInputConnection(labelFilter->GetOutputPort());
-        mask->SetOnRatio((double)numPoints/conLevel_);
-        mask->SetMaximumNumberOfPoints(50);
-        mask->RandomModeOn();
-
-    vtkSelectVisiblePoints *visPoints = vtkSelectVisiblePoints::New();
-        visPoints->SetInputConnection(mask->GetOutputPort());
-        visPoints->SetRenderer(_renderer);
-
-    vtkLabeledDataMapper *mapper = vtkLabeledDataMapper::New();
-        mapper->GlobalWarningDisplayOff();
-        mapper->SetInputConnection(mask->GetOutputPort());
-        mapper->SetLabelModeToLabelScalars();
-        mapper->GetLabelTextProperty()->SetFontFamilyToArial();
-        mapper->GetLabelTextProperty()->SetFontSize(10);
-        mapper->GetLabelTextProperty()->SetColor(1,1,1);
-
-    vtkActor2D *actor = vtkActor2D::New();
-        actor->SetMapper(mapper);
-
-    if (_renderer != NULL)
-    {
-        _renderer->AddActor2D(actor);
-    }
-
-    contourLabelFilter_ = labelFilter;
-    sliceActors_[2] = (vtkActor*) actor;
-    /*if (sliceMapper_ != NULL)
-    {
-        sliceMapper_->AddItem (mapper);
-    }*/
-    sliceTable_[2] = NULL;
-
-}
-
-/*
-* @brief: Show on UnSlice Contour Lines Label Display(打开UNslice等高线标签显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ShowOnUnSliceContourLinesLabelDisplay()
-{
-    if(sliceActors_[2] != NULL)
-    {
-        sliceActors_[2]->VisibilityOn();
-    }
-}
-
-/*
-* @brief: Show off UnSlice Contour Lines Label Display(关闭UNslice等高线标签显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ShowOffUnSliceContourLinesLabelDisplay()
-{
-    if(sliceActors_[2] != NULL)
-    {
-        sliceActors_[2]->VisibilityOff();
-    }
-}
-
-/*
-* @brief: delete UnSlice Contour Lines Label Display(删除UNslice等高线标签显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::DeleteUnSliceContourLinesLabelDisplay()
-{
-    if (sliceActors_[2] != NULL)
-    {
-        sliceActors_[2]->VisibilityOff();
-
-        if (_renderer != NULL)
-        {
-            _renderer->RemoveActor(sliceActors_[2]);
-        }
-
-        sliceActors_[2]->Delete();
-    }
-}
-
-/*
-* @brief: Create UnSlice Vector Display(创建UNslice矢量显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::CreateUnSliceVectorDisplay()
-{
-    if (cutSource_ == NULL)
-    {
-        ErrorInfo(1,"Slice Source Not Set");
-        return;
-    }
-
-   double range[2];
-    if (usedScalarIndex_ != -1)
-    {
-        range[0] = _source->scalarRange[usedScalarIndex_][0];
-        range[1] = _source->scalarRange[usedScalarIndex_][1];
-    }
-    else
-    {
-        range[0] = 0;
-        range[1] = 0;
-    }
-
-    vtkGlyphSource2D *glyph2D = vtkGlyphSource2D::New();
-        glyph2D->SetGlyphTypeToArrow();
-        glyph2D->SetScale(1.0);
-        glyph2D->SetScale2(1.5);
-        glyph2D->SetCenter(0, 0, 0);
-        glyph2D->FilledOff();
-
-    vtkGlyph3D *glyph3D = vtkGlyph3D::New();
-        glyph3D->SetInputConnection(cutSource_->GetOutputPort());
-        glyph3D->SetSourceData(glyph2D->GetOutput());
-        glyph3D->ScalingOn();
-        glyph3D->ClampingOn();
-        glyph3D->GeneratePointIdsOff();
-        glyph3D->SetIndexModeToOff();
-        glyph3D->SetVectorModeToUseVector();
-        glyph3D->SetScaleFactor(0.2);
-
-    vtkDataSetMapper *mapper = vtkDataSetMapper::New();
-        mapper->SetInputData(glyph3D->GetOutput());
-        mapper->SetScalarRange(range[0], range[1]);
-        mapper->InterpolateScalarsBeforeMappingOn();
-
-        if (usedScalarIndex_ != -1)
-        {
-            if (_source->scalarSource[usedScalarIndex_]->GetDataSize() != 0)
-            {
-                mapper->SetScalarModeToUsePointData();
-            }
-            else
-            {
-                mapper->SetScalarModeToUseCellData();
-            }
-        }
-
-    vtkLookupTable *table = (vtkLookupTable*)mapper->GetLookupTable();
-        table->GetHueRange(range);
-        table->SetHueRange(range[1], range[0]);
-        table->SetNumberOfColors(conLevel_);
-
-    vtkActor *actor = vtkActor::New();
-        actor->SetMapper(mapper);
-
-    if (_renderer != NULL)
-    {
-        _renderer->AddActor(actor);
-    }
-    /*if (sliceMapper_ != NULL)
-    {
-        sliceMapper_->AddItem (mapper);
-    }*/
-    sliceActors_[3] = actor;
-    sliceTable_[3] = table;
-    sliceGlyph2D_ = glyph2D;
-    sliceGlyph3D_ = glyph3D;
-
-}
-
-/*
-* @brief: show on UnSlice Vector Display(打开UNslice矢量显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ShowOnUnSliceVectorDisplay()
-{
-    if(sliceActors_[3] != NULL)
-    {
-        sliceActors_[3]->VisibilityOn();
-    }
-}
-
-/*
-* @brief: show off UnSlice Vector Display(关闭UNslice矢量显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ShowOffUnSliceVectorDisplay()
-{
-    if(sliceActors_[3] != NULL)
-    {
-        sliceActors_[3]->VisibilityOff();
-    }
-}
-
-/*
-* @brief: Delete UnSlice Vector Display(删除UNslice矢量显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::DeleteUnSliceVectorDisplay()
-{
-    if (sliceActors_[3] != NULL)
-    {
-        sliceActors_[3]->VisibilityOff();
-
-        if (_renderer != NULL)
-        {
-            _renderer->RemoveActor(sliceActors_[3]);
-        }
-
-        sliceActors_[3]->Delete();
-    }
-}
-
-/*
-* @brief: Create UnSlice Shade Display(创建UnSlice着色显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::CreateUnSliceShadeDisplay()
-{
-    if (cutSource_ == NULL)
-    {
-        ErrorInfo(1,"Slice Source Not Set");
-        return;
-    }
-
-    vtkGeometryFilter *geoFilter=vtkGeometryFilter::New();
-        geoFilter->SetInputData(cutSource_->GetOutput());
-
-    vtkDataSetMapper *mapper=vtkDataSetMapper::New();
-        mapper->SetInputConnection(geoFilter->GetOutputPort());
-        mapper->ScalarVisibilityOff();
-
-    vtkActor *actor=vtkActor::New();
-        actor->SetMapper(mapper);
-        actor->GetProperty()->SetColor(shadeColor_[0], shadeColor_[1], shadeColor_[2]);
-
-    if (_renderer != NULL)
-    {
-        _renderer->AddActor(actor);
-    }
-
-    if (sliceMapper_ != NULL)
-    {
-        sliceMapper_->AddItem (mapper);
-    }
-    sliceTable_[4] = NULL;
-    sliceActors_[4] = actor;
-
-}
-
-/*
-* @brief: Modify UnSlice Shade Color(修改UnSlice着色颜色)
-* @param: c0-r c1-g c2-b
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ModifyUnSliceShadeColor(double c0, double c1, double c2)
-{
-    if (sliceActors_[4]!=NULL)
-    {
-        shadeColor_[0] = c0;
-        shadeColor_[1] = c1;
-        shadeColor_[2] = c2;
-
-        (sliceActors_[4]->GetProperty())->SetColor(c0, c1, c2);
-    }
-}
-
-/*
-* @brief: show on UnSlice Shade Color(打开UnSlice着色颜色)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ShowOnUnSliceShade()
-{
-    if(sliceActors_[4] != NULL)
-    {
-        sliceActors_[4]->VisibilityOn();
-    }
-}
-
-/*
-* @brief: show off UnSlice Shade Color(关闭UnSlice着色颜色)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ShowOffUnSliceShade()
-{
-    if(sliceActors_[4] != NULL)
-    {
-        sliceActors_[4]->VisibilityOff();
-    }
-}
-
-/*
-* @brief: Create UnSlice Mesh Display(创建unslice网格显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::CreateUnSliceMeshDisplay()
-{
-    if (cutSource_ == NULL)
-    {
-        ErrorInfo(1,"Slice Source Not Set");
-        return;
-    }
-
-    vtkGeometryFilter *geoFilter=vtkGeometryFilter::New();
-        geoFilter->SetInputData(cutSource_->GetOutput());
-
-    vtkDataSetMapper *mapper=vtkDataSetMapper::New();
-        mapper->SetInputConnection(geoFilter->GetOutputPort());
-        mapper->ScalarVisibilityOff();
-
-    vtkActor *actor=vtkActor::New();
-        actor->SetMapper(mapper);
-        actor->GetProperty()->SetColor(meshColor_[0], meshColor_[1], meshColor_[2]);
-        (actor->GetProperty())->SetRepresentationToWireframe();
-
-    if (_renderer != NULL)
-    {
-        _renderer->AddActor(actor);
-    }
-
-    if (sliceMapper_ != NULL)
-    {
-        sliceMapper_->AddItem (mapper);
-    }
-    sliceTable_[5] = NULL;
-    sliceActors_[5] = actor;
-}
-
-/*
-* @brief: Modify UnSlice Mesh Color(修改unslice网格显示)
-* @param: c0-r c1-g c2-b
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ModifyUnSliceMeshColor(double c0, double c1, double c2)
-{
-    if (sliceActors_[5]!=NULL)
-    {
-        shadeColor_[0] = c0;
-        shadeColor_[1] = c1;
-        shadeColor_[2] = c2;
-
-        (sliceActors_[5]->GetProperty())->SetColor(c0, c1, c2);
-    }
-}
-
-/*
-* @brief: show on UnSlice Mesh Color(打开unslice网格显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ShowOnUnSliceMesh()
-{
-    if(sliceActors_[5] != NULL)
-    {
-        sliceActors_[5]->VisibilityOn();
-    }
-}
-
-/*
-* @brief: show off UnSlice Mesh Color(关闭unslice网格显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ShowOffUnSliceMesh()
-{
-    if(sliceActors_[5] != NULL)
-    {
-        sliceActors_[5]->VisibilityOff();
-    }
-}
-
-/*
-* @brief: Set UnSlice Contour Opacity(设置UnSlice轮廓不透明度)
-* @param: value -- opacity value
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::SetUnSliceContourOpacity(double value)
-{
-    if (sliceActors_[0] != NULL)
-    {
-        (sliceActors_[0]->GetProperty())->SetOpacity(value);
-    }
-}
-
-/*
-* @brief: Get UnSlice Contour Opacity(获取UnSlice轮廓不透明度)
-* @param: void
-* @ret: opacity value
-* @birth: created by czm in 20230326
-*/
-double vtkVISUnSlice::GetUnSliceContourOpacity()
-{
-    if (sliceActors_[0] != NULL)
-    {
-        return (sliceActors_[0]->GetProperty())->GetOpacity();
-    }
-    return NULL;
-}
-
-/*
-* @brief: Modify UnSlice Vector Color Mode(修改UnSlice矢量颜色模式)
-* @param: ColorByScale ColorByScalar ColorByVector
-* @ret: opacity value
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ModifyUnSliceVectorColorMode(char* mode)
-{
-
-    if (sliceGlyph3D_ != NULL)
-    {
-        if (strcmp(mode, "ColorByScale") == 0)
-        {
-            sliceGlyph3D_->SetColorModeToColorByScale();
-        }
-        else if (strcmp(mode, "ColorByScalar") == 0)
-        {
-            sliceGlyph3D_->SetColorModeToColorByScalar();
-        }
-        else if (strcmp(mode, "ColorByVector") == 0)
-        {
-            sliceGlyph3D_->SetColorModeToColorByVector();
-        }
-        else
-        {
-            sliceGlyph3D_->SetColorModeToColorByScalar();
-        }
-    }
-}
-
-/*
-* @brief: Modify UnSlice Vector Scale Mode(修改UnSlice矢量缩放模式)
-* @param: mode -- Scale mode "ScaleByScalar" "ScaleByVector" "ScaleByVectorComponents" "DataScalingOff"
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ModifyUnSliceVectorScaleMode(char* mode)
-{
-
-    if (sliceGlyph3D_ != NULL)
-    {
-        if (strcmp(mode, "ScaleByScalar") == 0)
-        {
-            sliceGlyph3D_->SetScaleModeToScaleByScalar();
-        }
-        else if (strcmp(mode, "ScaleByVectorComponents") == 0)
-        {
-            sliceGlyph3D_->SetScaleModeToScaleByVector();
-        }
-        else if (strcmp(mode, "ColorByVector") == 0)
-        {
-            sliceGlyph3D_->SetScaleModeToScaleByVectorComponents();
-        }
-        else if (strcmp(mode, "DataScalingOff") == 0)
-        {
-            sliceGlyph3D_->SetScaleModeToDataScalingOff ();
-        }
-        else
-        {
-            sliceGlyph3D_->SetScaleModeToScaleByScalar();
-        }
-    }
-}
-
-/*
-* @brief: Modify UnSlice Vector Scale factor(修改UnSlice矢量缩放因子)
-* @param: scale -- Scale factor
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ModifyUnSliceVectorScaleFactor(double scaleFactor)
-{
-
-    if (sliceGlyph3D_ != NULL)
-    {
-        sliceGlyph3D_->SetScaleFactor(scaleFactor);
-    }
-}
-
-/*
-* @brief: Set UnSlice Vector Filled On(将UnSlice矢量填充设置为打开)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::SetUnSliceVectorFilledOn()
-{
-    if (sliceGlyph2D_ != NULL)
-    {
-        sliceGlyph2D_->FilledOn();
-    }
-}
-
-/*
-* @brief: Set UnSlice Vector Filled Off(将UnSlice矢量填充设置为关闭)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::SetUnSliceVectorFilledOff()
-{
-    if (sliceGlyph2D_ != NULL)
-    {
-        sliceGlyph2D_->FilledOff();
-    }
-}
-
-/*
-* @brief: Modify UnSlice Vector Position(修改UNslice矢量位置)
-* @param: p0-x p1-y p2-z
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ModifyUnSliceVectorPosition(double p0, double p1, double p2)
-{
-
-    if (sliceGlyph2D_ != NULL)
-    {
-        sliceGlyph2D_->SetCenter(p0, p1, p2);
-    }
-}
-
-/*
-* @brief: Modify UnSlice Shade(修改UNslice着色)
-* @param: value -- opacity value
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ModifyUnSliceShadeOpacity(double value)
-{
-    if (sliceActors_[4] != NULL)
-    {
-        (sliceActors_[4]->GetProperty())->SetOpacity(value);
-    }
-}
-
-/*
-* @brief: Modify UnSlice Contour Level(修改UNslice等高线水准)
-* @param: level
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ModifyUnSliceContourLevel(int level)
-{
-    if (level < 2)
-    {
-        ErrorInfo(0, "Contour Level must be within range: 2 to 50!, Using the Min Level 2 insteading!");
-
-        level = 2;
-    }
-    if(level>MAXLEVEL)
-    {
-        ErrorInfo(0, "Contour Level must be within range: 2 to 50!, Using the Max Level 50 insteading!");
-
-        level = MAXLEVEL;
-    }
-
-    conLevel_ = level;
-
-    if (sliceTable_[0] != NULL)
-    {
-        sliceTable_[0]->SetNumberOfColors(conLevel_);
-    }
-
-    if(bandedContourFilter_ != NULL)
-    {
-        bandedContourFilter_->GenerateValues(conLevel_, scalarRange_[0], scalarRange_[1]);
-        bandedContourFilter_->ClippingOn();
-    }
-
-    if (contourLinesFilter_ != NULL)
-    {
-        contourLinesFilter_->GenerateValues(conLevel_, scalarRange_[0], scalarRange_[1]);
-    }
-
-    if (sliceTable_[1] != NULL)
-    {
-        sliceTable_[1]->SetNumberOfColors(conLevel_);
-    }
-
-    if (contourLabelFilter_!= NULL)
-    {
-        contourLabelFilter_->GenerateValues(conLevel_, scalarRange_[0], scalarRange_[1]);
-    }
-
-}
-
-/*
-* @brief: Modify UnSlice Vector Position(修改UNslice矢量位置)
-* @param: lineWidth -- line width
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ModifyUnSliceMeshLineWidth(double lineWidth)
-{
-    if (sliceActors_[5]!=NULL)
-    {
-        (sliceActors_[5]->GetProperty())->SetLineWidth(lineWidth);
-    }
-}
-
-/*
-* @brief: Modify UnSlice Lines Width(修改UNslice等高线宽度)
-* @param: lineWidth -- line width
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ModifyUnSliceContourLinesWidth(double lineWidth)
-{
-    if (sliceActors_[1]!=NULL)
-    {
-        (sliceActors_[1]->GetProperty())->SetLineWidth(lineWidth);
-    }
-}
-
-/*
-* @brief: Get slice plane widget(获取切片平面小部件)
-* @param:   void
-* @ret: vtkImplicitPlaneWidget
-* @birth: created by czm in 20230326
-*/
-vtkImplicitPlaneWidget* vtkVISUnSlice::GetSlicePlaneWidget()
-{
-    if (planeWidget_ != NULL)
-    {
-        return this->planeWidget_;
-    }
-
-    return NULL;
-}
-
-/*
-* @brief: Get slice plane(获取切片平面)
-* @param:   void
-* @ret: vtkPlane
-* @birth: created by czm in 20230326
-*/
-vtkPlane* vtkVISUnSlice::GetSlicePlane()
-{
-    if(slicePlane_ != NULL)
-    {
-        return this->slicePlane_;
-    }
-
-    return NULL;
-}
-
-/*
-* @brief: Set Slice PlaneWidget Handle Size(设置切片平面小部件句柄大小)
-* @param: size
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ModifySlicePlaneWidgetHandleSize(double size)
-{
-    if (planeWidget_ != NULL)
-    {
-        planeWidget_->SetHandleSize(size);
-        planeWidget_->UpdatePlacement();
-    }
-}
-
-/*
-* @brief: Modify Display Scalar Range(修改显示标量范围)
-* @param: min Scalar max Scalar
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ModifyDisplayScalarRange(double min,double max)
-{
-    scalarRange_[0] = min;
-    scalarRange_[1] = max;
-    if (min == max) {
-        return;
-    }
-
-    if(bandedContourFilter_ != NULL)
-    {
-        //cout<<"test here 4444"<<endl;
-
-        bandedContourFilter_->GenerateValues(conLevel_, min, max);
-        bandedContourFilter_->Modified();
-    }
-
-
-    for (int i= 0; i<6; i++)
-    {
-        if (i == 0 || i== 1 || i == 3)
-        {
-
-            if(sliceActors_[i] != NULL)
-            {
-                (sliceActors_[i]->GetMapper())->GetLookupTable()->SetRange(min, max);
-                (sliceActors_[i]->GetMapper())->GetLookupTable()->Modified();
-
-                (sliceActors_[i]->GetMapper())->SetScalarRange(min, max);
-                (sliceActors_[i]->GetMapper())->Modified();
-
-                sliceActors_[i]->Modified();
-
-            }
-        }
-    }
-}
-
-/*
-* @brief: Clipping On Slice Contour Display(切片轮廓显示上的剪裁)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ClippingOnSliceContourDisplay()
-{
-
-    if(bandedContourFilter_ != NULL)
-    {
-        bandedContourFilter_->GenerateValues(conLevel_, scalarRange_[0], scalarRange_[1] );
-        bandedContourFilter_->ClippingOn();
-        bandedContourFilter_->Modified();
-    }
-
-
-    for (int i= 0; i<6; i++)
-    {
-        if (i == 0 || i== 1 || i == 3)
-        {
-            if(sliceActors_[i] != NULL)
-            {
-                (sliceActors_[i]->GetMapper())->GetLookupTable()->SetRange(scalarRange_[0], scalarRange_[1]);
-                (sliceActors_[i]->GetMapper())->GetLookupTable()->Modified();
-
-                (sliceActors_[i]->GetMapper())->SetScalarRange(scalarRange_[0], scalarRange_[1]);
-                (sliceActors_[i]->GetMapper())->Modified();
-
-                sliceActors_[i]->Modified();
-
-            }
-        }
-    }
-}
-
-/*
-* @brief: Clipping Off Slice Contour Display(剪裁切片轮廓显示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ClippingOffSliceContourDisplay()
-{
-
-    if(bandedContourFilter_ != NULL)
-    {
-        bandedContourFilter_->GenerateValues(conLevel_, scalarRange_[0], scalarRange_[1] );
-        bandedContourFilter_->ClippingOff();
-        bandedContourFilter_->Modified();
-    }
-
-    for (int i= 0; i<6; i++)
-    {
-        if (i == 0 || i== 1 || i == 3)
-        {
-            if(sliceActors_[i] != NULL)
-            {
-                (sliceActors_[i]->GetMapper())->GetLookupTable()->SetRange(scalarRange_[0], scalarRange_[1]);
-                (sliceActors_[i]->GetMapper())->GetLookupTable()->Modified();
-
-                (sliceActors_[i]->GetMapper())->SetScalarRange(scalarRange_[0], scalarRange_[1]);
-                (sliceActors_[i]->GetMapper())->Modified();
-
-                sliceActors_[i]->Modified();
-            }
-        }
-    }
-}
-
-/*
-* @brief: Set slice source(设置切片源)
-* @param: uGrid:slice source.  yValue:slice value of y.
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-bool vtkVISUnSlice::SetBoundSliceSource(vtkUnstructuredGrid* uGrid , double yValue)
-{
-    if (uGrid==NULL)
-    {
-        return false;
-    }
-    uGrid->Modified();
-
-    double pBound[6];
-    uGrid->GetBounds(pBound);
-
-    if (yValue<pBound[2] || yValue>pBound[3])
-    {
-        return false;
-    }
-
-    vtkPlane *plane = vtkPlane::New();
-    double planeNormal[3];
-    planeNormal[0] = 0.0;
-    planeNormal[1] = 1.0;
-    planeNormal[2] = 0.0;
-    plane->SetNormal(planeNormal[0], planeNormal[1], planeNormal[2]);
-
-    double planeCoord[3];
-    planeCoord[0] = 0.0;
-    planeCoord[1] = yValue;
-    planeCoord[2] = 0.0;
-    plane->SetOrigin(planeCoord[0],planeCoord[1],planeCoord[2]);
-
-    vtkCutter *cutter = vtkCutter::New();
-    cutter->SetInputData(uGrid);
-    cutter->SetCutFunction(plane);
-    cutter->GenerateCutScalarsOff();
-    cutter->SetSortByToSortByCell();
-    cutter->Update();
-
-    vtkIdType n = cutter->GetOutput()->GetNumberOfPoints();
-    cutSource_  = cutter;
-    return true;
-}
-
-/*
-* @brief: Get max value of X,and Set the point data source.(获取X的最大值,然后设置点数据源。)
-* @param: Points:point data source. max value of X.
-* @ret: bool
-* @birth: created by czm in 20230326
-*/
-bool vtkVISUnSlice::GetXMaxPointData(double* xMax,vtkPoints* Points)
-{
-    cutSource_->Update();
-    vtkFloatArray* cutPointData = vtkFloatArray::New();
-    cutPointData->SetNumberOfComponents(1);
-
-    int pointNum = (cutSource_->GetOutput())->GetNumberOfPoints();
-    if (pointNum <= 0)
-    {
-        return false;
-    }
-
-    vtkDoubleArray* xVector = vtkDoubleArray::New();
-    double point[3];
-
-    for (int j=0; j<pointNum; j++)
-    {
-        (cutSource_->GetOutput())->GetPoint(j, point);
-        xVector->InsertNextValue(point[0]);
-        Points->InsertNextPoint(point[0],point[1],point[2]);
-    }
-    vtkSortDataArray::Sort(xVector);
-    //cout<<"x max ="<<xVector[xVector.size()-1]<<endl;
-    cutPointData->Modified();
-    (*xMax) = xVector->GetValue(xVector->GetMaxId());
-    return true;
-}
-
-/*
-* @brief: SetSliceSource_FD(设置切片源。)
-* @param: scalar vector
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::SetSliceSource_FD(char* scalar, char* vector)
-{
-    int index1 = -1;
-    int index2 = -1;
-
-    if(scalar != NULL)
-    {
-        index1 = _source->GetScalarIndex(scalar);
-    }
-    if(vector != NULL)
-    {
-        index2 = _source->GetVectorIndex(vector);
-    }
-
-    vtkUnstructuredGrid *unGrid = vtkUnstructuredGrid::New();
-        unGrid->DeepCopy(_source->unstruGrid);
-
-        if (index1 != -1)
-        {
-            usedScalarIndex_ = index1;
-
-            scalarSource_ = vtkDoubleArray::New();
-            if(_source->scalarSource[index1]->GetDataSize() != 0)
-            {
-                scalarSource_->DeepCopy(_source->scalarSource[index1]);
-                (unGrid->GetPointData())->SetScalars(scalarSource_);
-            }
-            else
-            {
-                scalarSource_->DeepCopy(_source->cellScalarSource_[index1]);
-                (unGrid->GetCellData())->SetScalars(scalarSource_);
-            }
-
-        }
-        if (index2 != -1)
-        {
-            usedVectorIndex_ = index2;
-
-            if(_source->vectorSource[index2]->GetDataSize() != 0)
-            {
-                (unGrid->GetPointData())->SetVectors(_source->vectorSource[index2]);
-            }
-            else
-            {
-                (unGrid->GetCellData())->SetVectors(_source->cellVectorSource_[index2]);
-            }
-        }
-        unGrid->Modified();
-
-    vtkPlane *plane = vtkPlane::New();
-        plane->SetNormal(planeNormal_[0], planeNormal_[1], planeNormal_[2]);
-
-    vtkCutter *cutter = vtkCutter::New();
-        cutter->SetInputData(unGrid);
-        cutter->SetCutFunction(plane);
-        cutter->GenerateCutScalarsOff();
-        cutter->SetSortByToSortByCell();
-        cutter->Update();
-
-        //cout<<"test here 1111"<<(cutter->GetOutput())->GetNumberOfPoints()<<endl;
-
-    gridSource_ = unGrid;
-    cutSource_ = cutter;
-    slicePlane_ =  plane;
-}
-
-/*
-* @brief:Create Slice Widget_FD(创造切片窗口)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::CreateSliceWidget_FD()
-{
-    if (cutSource_ == NULL)
-    {
-        ErrorInfo(1,"Slice Source Not Set");
-        return;
-    }
-    double* bounds;
-    bounds = _source->GetSourceBounds();
-
-    planeOrigin_[0] = (bounds[0]+bounds[1])/2;
-    planeOrigin_[1] = (bounds[2]+bounds[3])/2;
-    planeOrigin_[2] = (bounds[4]+bounds[5])/2;
-
-    vtkImplicitPlaneWidget* planeWidget = vtkImplicitPlaneWidget::New();
-        planeWidget->SetInteractor(_renWin->GetInteractor());
-        planeWidget->SetPlaceFactor(1.0);
-
-        planeWidget->SetHandleSize(0.005);
-        planeWidget->SetDiagonalRatio(0.2);
-
-        planeWidget->GetPlane(slicePlane_);
-        planeWidget->SetInputData(cutSource_->GetOutput());
-
-        planeWidget->TubingOff();
-        //add begin
-        planeWidget->GetEdgesProperty()->SetLineWidth(2.0);
-        planeWidget->GetPlaneProperty()->SetColor(0.5, 0.5, 0.5);
-        planeWidget->GetPlaneProperty()->SetOpacity(0.5);
-        planeWidget->GetSelectedPlaneProperty()->SetOpacity(0.5);
-        planeWidget->OutlineTranslationOff();
-
-        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();
-
-        planeWidget_ = planeWidget;
-
-        vtkCallbackCommand *cc = vtkCallbackCommand::New();
-            cc->SetCallback(GenerateSliceProData_FD);
-            cc->SetClientData(this);
-
-        planeWidget->AddObserver(vtkCommand::InteractionEvent, cc);
-}
-
-/*
-* @brief: GenerateSliceProData_FD(生成切片数据)
-* @param: vtkObject
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::GenerateSliceProData_FD(vtkObject *caller, unsigned long, void* obj, void *)
-{
-    vtkVISUnSlice* usObj = (vtkVISUnSlice*)obj;
-
-    if (usObj->planeWidget_ == NULL)
-    {
-        usObj->ErrorInfo(1,"Plane Widget Not Created");
-        return;
-    }
-    usObj->planeWidget_->GetPlane(usObj->slicePlane_);
-    //add begin. when cut plane moving, update the cut plane's scalar range
-    double r[2];
-    vtkFloatArray *arry = usObj->GetCutScalarData();
-    if (arry)  arry->GetRange(r);
-    usObj->ModifyDisplayScalarRange_FD(r[0], r[1]);
-    //add end
-}
-
-/*
-* @brief: Create UnSlice Contour Display_FD(创造切片等高线展示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::CreateUnSliceContourDisplay_FD()
-{
-    if (cutSource_ == NULL)
-    {
-        ErrorInfo(1,"Slice Source Not Set");
-        return;
-    }
-
-    double range[2];
-    if (usedScalarIndex_ != -1)
-    {
-        //range[0] = _source->scalarRange[usedScalarIndex_][0];
-        //range[1]  = _source->scalarRange[usedScalarIndex_][1];
-        range[0]  = scalarRange_[0];   //use current cut plane's scalar range,
-        range[1]  = scalarRange_[1];   //instead of the whole input's scalar range.
-    }
-    else
-    {
-        range[0] = 0;
-        range[1] = 0;
-    }
-    cutSource_->Update();
-
-    vtkGeometryFilter *geoFilter = vtkGeometryFilter::New();
-        geoFilter->SetInputData(cutSource_->GetOutput());
-        geoFilter->Update();
-
-    vtkBandedPolyDataContourFilter *conFilter = vtkBandedPolyDataContourFilter::New();
-        conFilter->GlobalWarningDisplayOff();
-        conFilter->SetInputData(geoFilter->GetOutput());
-        conFilter->GenerateValues(conLevel_, range[0], range[1]);
-        conFilter->ClippingOn();
-        conFilter->Modified();
-        conFilter->Update();
-
-    vtkDataSetMapper *mapper = vtkDataSetMapper::New();
-        mapper->InterpolateScalarsBeforeMappingOn();
-
-        if(_source->scalarSource[usedScalarIndex_]->GetDataSize() != 0)
-        {
-            mapper->SetInputConnection(conFilter->GetOutputPort());
-        }
-        else
-        {
-            mapper->SetInputConnection(geoFilter->GetOutputPort());
-        }
-        mapper->SetScalarRange(range[0],range[1]);
-
-        if (usedScalarIndex_ != -1)
-        {
-            if (_source->scalarSource[usedScalarIndex_]->GetDataSize() != 0)
-            {
-                mapper->SetScalarModeToUsePointData();
-            }
-            else
-            {
-                mapper->SetScalarModeToUseCellData();
-            }
-        }
-
-    vtkLookupTable *table = (vtkLookupTable*)mapper->GetLookupTable();
-        table->GetHueRange(range);
-        table->SetHueRange(range[1],range[0]);
-        table->SetNumberOfColors(conLevel_);
-
-    vtkActor *actor = vtkActor::New();
-        actor->SetMapper(mapper);
-
-    if (_renderer != NULL)
-    {
-        _renderer->AddActor(actor);
-    }
-
-    sliceActors_[0] = actor;
-
-    sliceTable_[0] = table;
-
-    bandedContourFilter_ = conFilter;
-}
-
-/*
-* @brief: Create UnSlice Contour Lines Display_FD(创造切片等高线轮廓展示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::CreateUnSliceContourLinesDisplay_FD()
-{
-    if (cutSource_ == NULL)
-    {
-        ErrorInfo(1,"Slice Source Not Set");
-        return;
-    }
-
-    double range[2];
-    if (usedScalarIndex_ != -1)
-    {
-        //range[0] = _source->scalarRange[usedScalarIndex_][0];
-        //range[1] = _source->scalarRange[usedScalarIndex_][1];
-        range[0]  = scalarRange_[0];   //use current cut plane's scalar range,
-        range[1]  = scalarRange_[1];   //instead of the whole input's scalar range.
-    }
-    else
-    {
-        range[0] = 0;
-        range[1] = 0;
-    }
-
-    vtkContourFilter *conFilter = vtkContourFilter::New();
-        conFilter->GlobalWarningDisplayOff();
-        conFilter->SetInputConnection(cutSource_->GetOutputPort());
-        conFilter->GenerateValues(conLevel_, range[0],range[1]);
-        conFilter->Update();
-
-    vtkDataSetMapper *mapper = vtkDataSetMapper::New();
-        mapper->InterpolateScalarsBeforeMappingOn();
-        mapper->SetInputConnection(conFilter->GetOutputPort());
-        mapper->SetScalarRange(range[0],range[1]);
-
-        if (usedScalarIndex_ != -1)
-        {
-            if (_source->scalarSource[usedScalarIndex_]->GetDataSize() != 0)
-            {
-                mapper->SetScalarModeToUsePointData();
-            }
-            else
-            {
-                mapper->SetScalarModeToUseCellData();
-            }
-        }
-
-    vtkLookupTable *table = (vtkLookupTable*)mapper->GetLookupTable();
-        table->GetHueRange(range);
-        table->SetHueRange(range[1],range[0]);
-        table->SetNumberOfColors(conLevel_);
-
-    vtkActor *actor = vtkActor::New();
-        actor->SetMapper(mapper);
-
-    if (_renderer != NULL)
-    {
-        _renderer->AddActor(actor);
-    }
-
-    contourLinesFilter_ = conFilter;
-    sliceActors_[1] = actor;
-    sliceTable_[1] = table;
-}
-
-/*
-* @brief: Create UnSlice Contour Lines Lable Display_FD(创造切片等高线轮廓标签展示)
-* @param: void
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::CreateUnSliceContourLinesLabelDisplay_FD()
-{
-    if (cutSource_ == NULL)
-    {
-        ErrorInfo(1,"Slice Source Not Set");
-        return;
-    }
-
-    double range[2];
-    if (usedScalarIndex_ != -1)
-    {
-        //range[0] = _source->scalarRange[usedScalarIndex_][0];
-        //range[1] = _source->scalarRange[usedScalarIndex_][1];
-        range[0]  = scalarRange_[0];   //use current cut plane's scalar range,
-        range[1]  = scalarRange_[1];   //instead of the whole input's scalar range.
-    }
-    else
-    {
-        range[0] = 0;
-        range[1] = 0;
-    }
-
-    vtkContourFilter *labelFilter = vtkContourFilter::New();
-        labelFilter->GlobalWarningDisplayOff();
-        labelFilter->SetInputConnection(cutSource_->GetOutputPort());
-        labelFilter->GenerateValues(conLevel_, range[0],range[1]);
-        labelFilter->Update();
-
-    int numPoints = labelFilter->GetOutput()->GetNumberOfPoints();
-    vtkMaskPoints *mask = vtkMaskPoints::New();
-        mask->SetInputConnection(labelFilter->GetOutputPort());
-        mask->SetOnRatio((double)numPoints/conLevel_);
-        mask->SetMaximumNumberOfPoints(50);
-        mask->RandomModeOn();
-
-    vtkSelectVisiblePoints *visPoints = vtkSelectVisiblePoints::New();
-        visPoints->SetInputConnection(mask->GetOutputPort());
-        visPoints->SetRenderer(_renderer);
-
-    vtkLabeledDataMapper *mapper = vtkLabeledDataMapper::New();
-        mapper->GlobalWarningDisplayOff();
-        mapper->SetInputConnection(mask->GetOutputPort());
-        mapper->SetLabelModeToLabelScalars();
-        mapper->GetLabelTextProperty()->SetFontFamilyToArial();
-        mapper->GetLabelTextProperty()->SetFontSize(10);
-        mapper->GetLabelTextProperty()->SetColor(1,1,1);
-
-    vtkActor2D *actor = vtkActor2D::New();
-        actor->SetMapper(mapper);
-
-    if (_renderer != NULL)
-    {
-        _renderer->AddActor2D(actor);
-    }
-
-    contourLabelFilter_ = labelFilter;
-    sliceActors_[2] = (vtkActor*) actor;
-    sliceTable_[2] = NULL;
-
-}
-
-/*
-* @brief:Modify Display Scalar Range_FD(修改展示标量范围)
-* @param: min and max scalar
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ModifyDisplayScalarRange_FD(double min,double max)
-{
-    scalarRange_[0] = min;
-    scalarRange_[1] = max;
-    if (min == max) {
-        return;
-    }
-
-    if(bandedContourFilter_ != NULL)
-    {
-        bandedContourFilter_->GenerateValues(conLevel_, min, max);
-        bandedContourFilter_->Modified();
-    }
-    //add begin. update contour lines/labels values
-    if (contourLinesFilter_ != NULL)
-    {
-        contourLinesFilter_->GenerateValues(conLevel_, min, max);
-        contourLinesFilter_->Modified();
-    }
-    if (contourLabelFilter_!= NULL)
-    {
-        contourLabelFilter_->GenerateValues(conLevel_, min, max);
-        contourLabelFilter_->Modified();
-    }
-    //add end
-
-    for (int i= 0; i<6; i++)
-    {
-        if (i == 0 || i== 1 || i == 3)
-        {
-
-            if(sliceActors_[i] != NULL)
-            {
-                (sliceActors_[i]->GetMapper())->GetLookupTable()->SetRange(min, max);
-                (sliceActors_[i]->GetMapper())->GetLookupTable()->Modified();
-
-                (sliceActors_[i]->GetMapper())->SetScalarRange(min, max);
-                (sliceActors_[i]->GetMapper())->Modified();
-
-                sliceActors_[i]->Modified();
-
-            }
-        }
-    }
-}
-
-/*
-* @brief:Modify slice scalar source_FD(修改切片标量源)
-* @param: scalar
-* @ret: void
-* @birth: created by czm in 20230326
-*/
-void vtkVISUnSlice::ModifySliceSourceScalar_FD(char* scalar)
-{
-    if (gridSource_ == NULL)
-    {
-        ErrorInfo(1,"Grid Source are not Setted!");
-        return;
-    }
-
-    int index = -1;
-    if(scalar != NULL)
-    {
-        index = _source->GetScalarIndex(scalar);
-    }
-    if (index == -1)
-    {
-        ErrorInfo(1,"Scalar data are not existed!");
-        return;
-    }
-    if (scalarSource_ != 0)
-    {
-        scalarSource_->Delete();
-        scalarSource_ = 0;
-    }
-    scalarSource_ = vtkDoubleArray::New();
-    if (_source->scalarSource[index]->GetDataSize() != 0)
-    {
-        scalarSource_->DeepCopy(_source->scalarSource[index]);
-        (gridSource_->GetPointData())->SetScalars(scalarSource_);
-    }
-    else
-    {
-        scalarSource_->DeepCopy(_source->cellScalarSource_[index]);
-        (gridSource_->GetCellData())->SetScalars(scalarSource_);
-    }
-    gridSource_->Modified();
-
-    usedScalarIndex_ = index;
-
-    vtkFloatArray *arry = GetCutScalarData();
-    if (arry)  arry->GetRange(scalarRange_);
-    //2011-05-10 zhuqin add begin.
-    if(bandedContourFilter_ != NULL)
-    {
-        bandedContourFilter_->GenerateValues(conLevel_, scalarRange_[0],scalarRange_[1]);
-        bandedContourFilter_->ClippingOn();
-        bandedContourFilter_->Modified();
-    }
-    if (contourLinesFilter_ != NULL)
-    {
-      contourLinesFilter_->GenerateValues(conLevel_, scalarRange_[0],scalarRange_[1]);
-      contourLinesFilter_->Modified();
-    }
-    if (contourLabelFilter_!= NULL)
-    {
-        contourLabelFilter_->GenerateValues(conLevel_, scalarRange_[0],scalarRange_[1]);
-        contourLabelFilter_->Modified();
-    }
-    //2011-05-10 zhuqin add end.
-
-
-    for (int i= 0; i<6; i++)
-    {
-        if (i == 0 || i== 1 || i == 3)
-        {
-            if(sliceActors_[i] != NULL)
-            {
-                (sliceActors_[i]->GetMapper())->GetLookupTable()->SetRange(scalarRange_[0],scalarRange_[1]);
-                (sliceActors_[i]->GetMapper())->GetLookupTable()->Modified();
-
-                (sliceActors_[i]->GetMapper())->SetScalarRange(scalarRange_[0],scalarRange_[1]);
-
-                if (_source->scalarSource[usedScalarIndex_]->GetDataSize() != 0)
-                {
-                    (sliceActors_[i]->GetMapper())->SetScalarModeToUsePointData();
-                }
-                else
-                {
-                    (sliceActors_[i]->GetMapper())->SetScalarModeToUseCellData();
-                }
-
-                (sliceActors_[i]->GetMapper())->Modified();
-                sliceActors_[i]->Modified();
-            }
-        }
-
-    }
-
-}
-
-/*
-* @brief:Get Source Bounds_FD(获取源边界)
-* @param: bounds
-* @ret: bool
-* @birth: created by czm in 20230326
-*/
-bool vtkVISUnSlice::GetSourceBounds_FD(double *bounds)
-{
-    if (cutSource_ == NULL)
-    {
-        ErrorInfo(1,"Slice Source Not Set");
-        return false;
-    }
-    double *range = _source->GetSourceBounds();
-    for (int i = 0; i < 6; ++i)
-    {
-        bounds[i] = range[i];
-    }
-    return true;
-}

+ 0 - 213
CAE_Solution/src/VTK/visualization_VTK/vtkvisunslice.h

@@ -1,213 +0,0 @@
-#ifndef VTKVISUNSLICE_H
-#define VTKVISUNSLICE_H
-#include <iostream>
-#include "vtkvismanager.h"
-#include "vtkvisunstructuredgridmanager.h"
-#include <vtkPlane.h>
-#include <vtkCutter.h>
-#include <vtkImplicitPlaneWidget.h>
-#include <vtkCallbackCommand.h>
-#include <vtkExtractCells.h>
-#include <vtkExtractEdges.h>
-#include <vtkDataSetMapper.h>
-#include <vtkContourFilter.h>
-#include <vtkLookupTable.h>
-#include <vtkLabeledDataMapper.h>
-#include <vtkTextProperty.h>
-#include <vtkPoints.h>
-#include <vtkMaskPoints.h>
-#include <vtkSelectVisiblePoints.h>
-#include <vtkActor2D.h>
-#include <vtkCollection.h>
-#include <vtkGlyphSource2D.h>
-#include <vtkGlyph3D.h>
-#include <vtkUnstructuredGridGeometryFilter.h>
-#include <vtkBandedPolyDataContourFilter.h>
-#include <vtkGeometryFilter.h>
-#include <vtkFloatArray.h>
-//Class that manage slice rendering
-//
-//To CreateSliceDisplay(), you need to do these first \n
-// SetDataSource(), then SetSliceSource(),CreateSliceWidget()
-
-class vtkVISUnSlice :public vtkVISUnstructuredGridManager
-{
-public:
-    static vtkVISUnSlice *New();
-    vtkVISUnSlice();
-    ~vtkVISUnSlice();
-
-    void SetSliceSource(char* scalar, char* vector);
-    void ModifySliceSourceScalar(char* scalar);
-    void ModifySliceSourceVector(char* vector);
-
-    void CreateSliceWidget();
-
-    void ShowOnSlicePlane();
-    void ShowOffSlicePlane();
-
-    void ShowOnSlicePlaneWidget();
-    void ShowOffSlicePlaneWidget();
-
-    void ModifySlicePlaneWidgetHandleSize(double size);
-
-    void SetSlicePlaneNormal(double nx, double ny, double nz);
-    void SetSlicePlaneNormalToX();
-    void SetSlicePlaneNormalToY();
-    void SetSlicePlaneNormalToZ();
-
-    double* GetSlicePlaneNormal();
-
-    void SetSlicePlaneOrigin(double ox, double oy, double oz);
-    double* GetSlicePlaneOrigin();
-
-    //--------------------------------------------
-    // 2011.01.08
-
-    //void CreateSliceDisplay();
-    void CreateUnSliceContourDisplay();
-    void ShowOnUnSliceContourDisplay();
-    void ShowOffUnSliceContourDisplay();
-    void DeleteUnSliceContourDisplay();
-
-    void CreateUnSliceContourLinesDisplay();
-    void ShowOnUnSliceContourLinesDisplay();
-    void ShowOffUnSliceContourLinesDisplay();
-    void DeleteUnSliceCOntourLinesDisplay();
-
-
-    void CreateUnSliceContourLinesLabelDisplay();
-    void ShowOnUnSliceContourLinesLabelDisplay();
-    void ShowOffUnSliceContourLinesLabelDisplay();
-    void DeleteUnSliceContourLinesLabelDisplay();
-
-
-    void CreateUnSliceVectorDisplay();
-    void ShowOnUnSliceVectorDisplay();
-    void ShowOffUnSliceVectorDisplay();
-    void DeleteUnSliceVectorDisplay();
-
-
-    void CreateUnSliceShadeDisplay();
-    void ModifyUnSliceShadeColor(double c0, double c1, double c2);
-    void ShowOnUnSliceShade();
-    void ShowOffUnSliceShade();
-
-
-    void CreateUnSliceMeshDisplay();
-    void ModifyUnSliceMeshColor(double c0, double c1, double c2);
-    void ShowOnUnSliceMesh();
-    void ShowOffUnSliceMesh();
-
-
-    void SetUnSliceContourOpacity(double value);
-    double GetUnSliceContourOpacity();
-
-    void ModifyUnSliceVectorColorMode(char* mode);
-    void ModifyUnSliceVectorScaleMode(char* mode);
-    void ModifyUnSliceVectorScaleFactor(double scale);
-
-    void SetUnSliceVectorFilledOn();
-    void SetUnSliceVectorFilledOff();
-
-    void ModifyUnSliceVectorPosition(double d0, double d1, double d2);
-
-    void ModifyUnSliceShadeOpacity(double value);
-    void ModifyUnSliceMeshLineWidth(double lineWidth);
-    void ModifyUnSliceContourLevel(int level);
-
-    void ModifyUnSliceContourLinesWidth(double lineWidth);
-
-    vtkImplicitPlaneWidget* GetSlicePlaneWidget();
-    vtkPlane* GetSlicePlane();
-
-
-    void WriteScalarVectorData(const char* FileName);
-    vtkFloatArray* GetCutScalarData(void);
-    /*
-         * cutVector[index]
-         * 0    v0
-         * 1    v1
-         * 2    v2
-         */
-    vtkFloatArray* GetCutVectorData(int index);
-    vtkFloatArray* GetCutVectorData(void);
-    /*
-         * cutPointData[index]
-         * 0    x
-         * 1    y
-         * 2    z
-         */
-    vtkFloatArray* GetCutPointData(int index);
-
-    //ZHUQin 2011.03.24
-    void ModifyDisplayScalarRange(double min,double max);
-    void ClippingOnSliceContourDisplay();
-    void ClippingOffSliceContourDisplay();
-    //add by HaoJingjing 2015.12.11 begin.
-    bool SetBoundSliceSource(vtkUnstructuredGrid* uGrid,double y);
-    bool GetXMaxPointData(double *xMax,vtkPoints* Points);
-    //add by HaoJingjing 2015.12.11 end.
-
-    ///////
-    void SetSliceSource_FD(char* scalar, char* vector);
-    void CreateSliceWidget_FD();
-    static void GenerateSliceProData_FD(vtkObject *caller, unsigned long, void *, void *);
-    void CreateUnSliceContourDisplay_FD();
-    void CreateUnSliceContourLinesDisplay_FD();
-    void CreateUnSliceContourLinesLabelDisplay_FD();
-    void ModifyDisplayScalarRange_FD(double min,double max);
-    void ModifySliceSourceScalar_FD(char* scalar);
-    bool GetSourceBounds_FD(double *bounds);
-    ///////
-protected:
-
-    double planeNormal_[3];
-    double planeOrigin_[3];
-
-    int conLevel_;
-    int usedScalarIndex_;
-    int usedVectorIndex_;
-
-    vtkUnstructuredGrid* gridSource_;
-    vtkCutter* cutSource_;
-    vtkActor* cutActor_;
-    //vtkDataSetMapper* cutMapper_;
-
-    double scalarRange_[2];
-    vtkBandedPolyDataContourFilter* bandedContourFilter_;
-
-    /*
-         * sliceActor[blockIndex]
-         * 0 contour
-         * 1 contourlines
-         * 2 contourlineslabel
-         * 3 vector
-         * 4 shade
-         * 5 mesh
-         */
-    vtkActor** sliceActors_;
-    vtkCollection* sliceMapper_;
-    vtkLookupTable** sliceTable_;
-
-
-    vtkContourFilter* contourLinesFilter_;
-    vtkContourFilter* contourLabelFilter_;
-
-    vtkGlyphSource2D* sliceGlyph2D_;
-    vtkGlyph3D* sliceGlyph3D_;
-
-    double shadeColor_[3];
-    double meshColor_[3];
-
-
-    vtkPlane* slicePlane_;
-    vtkImplicitPlaneWidget* planeWidget_;
-    static void GenerateSliceProData(vtkObject *caller, unsigned long, void *, void *);
-
-
-private:
-    vtkDoubleArray *scalarSource_;
-};
-
-#endif // VTKVISUNSLICE_H

+ 110 - 165
CAE_Solution/src/VTK/visualization_VTK/vtkvisunstructuredgridmanager.cpp

@@ -1,220 +1,165 @@
-#include "vtkvisunstructuredgridmanager.h"
 #include <vtkRenderer.h>
 #include <vtkRenderWindow.h>
 #include <vtkObjectFactory.h>
 #include <vtkProperty.h>
 #include <vtkActor.h>
+#include "vtkVISUnstructuredGridSource.h"
+#include "vtkVISUnstructuredGridManager.h"
 
 vtkStandardNewMacro(vtkVISUnstructuredGridManager)
 
-/*
- * @brief: the constructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
 vtkVISUnstructuredGridManager::vtkVISUnstructuredGridManager()
 {
-    _vtkObjectsNum = 0;
+	_vtkObjectsNum = 0;
 
-    _source = NULL;
-    _unActor = NULL;
-    _vtkObjects = NULL;
-}
+	_source = NULL;
+	_unActor = NULL;
+	_vtkObjects = NULL;
 
-/*
- * @brief: the destructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
+}
 vtkVISUnstructuredGridManager::~vtkVISUnstructuredGridManager()
 {
-
+	//    //delete _source;
+	//    
+	//    ErrorInfo(0, "destructure func 0");
+	//	
+	//	if (_unActor != NULL)
+	//	{  
+	//		if(_renderer != NULL)
+	//	    {
+	//	        //_renderer->RemoveActor(_unActor);
+	//        }
+	//		_unActor->Delete();
+	//		_unActor = NULL;
+	//	}
+	//
+	//	ErrorInfo(0, "destructure func 1");
+	//
+	//	if (_vtkObjects != NULL)
+	//	{
+	//#ifndef NDEBUG
+	//		cout<<_vtkObjectsNum<<endl;
+	//#endif
+	//		if(_vtkObjectsNum > 0)
+	//		{		    
+	//			for (int j=0; j<_vtkObjectsNum; j++)
+	//			{			    
+	//				if (_vtkObjects[j] != NULL)
+	//				{				    
+	//					//_vtkObjects[j]->Delete();
+	//				}
+	//			}
+	//		}
+	//		delete [] _vtkObjects;
+	//		_vtkObjects = NULL;
+	//	}
+	//	
+	//	ErrorInfo(0, "destructure func 2");
 }
 
-/*
- * @brief: set data source
- * @param: vtkVISUnstructuredGridSource
- * @ret: void
- * @birth: created by czm in 20230323
- */
 void vtkVISUnstructuredGridManager::SetDataSource(vtkVISUnstructuredGridSource *object)
 {
-    this->_source = object;
+	this->_source = object;
 }
 
-/*
- * @brief: set vtk actor show on
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
 void vtkVISUnstructuredGridManager::ShowOn()
 {
-    if (_unActor != NULL)
-    {
-        _unActor->VisibilityOn();
-    }
+	if (_unActor != NULL)
+	{
+		_unActor->VisibilityOn();
+	}
 }
 
-/*
- * @brief: set vtk actor show off
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
 void vtkVISUnstructuredGridManager::ShowOff()
 {
-    if (_unActor != NULL)
-    {
-        _unActor->VisibilityOff();
-    }
+	if (_unActor != NULL)
+	{
+		_unActor->VisibilityOff();
+	}
 }
 
-/*
- * @brief: change representation(更改表示法)
- * @param: style(点/线框/表�)
- * @ret: void
- * @birth: created by czm in 20230323
- */
 void vtkVISUnstructuredGridManager::ChangeRepresentation(char* style)
 {
-    if (_unActor != NULL)
-    {
-        if (strcmp(style, "Points") == 0)
-        {
-            (_unActor->GetProperty())->SetRepresentationToPoints();
-        }
-        else if (strcmp(style, "Wireframe") == 0)
-        {
-            (_unActor->GetProperty())->SetRepresentationToWireframe();
-        }
-        else
-        {
-            (_unActor->GetProperty())->SetRepresentationToSurface();
-        }
-    }
+	if (_unActor != NULL)
+	{
+		if (strcmp(style, "Points") == 0)
+		{
+			(_unActor->GetProperty())->SetRepresentationToPoints();
+		}
+		else if (strcmp(style, "Wireframe") == 0)
+		{
+			(_unActor->GetProperty())->SetRepresentationToWireframe();
+		}
+		else
+		{
+			(_unActor->GetProperty())->SetRepresentationToSurface();
+		}
+	}
 }
 
-/*
- * @brief: set opacity(设置�明度)
- * @param: value
- * @ret: void
- * @birth: created by czm in 20230323
- */
-void vtkVISUnstructuredGridManager::SetOpacity(double value)
+void vtkVISUnstructuredGridManager::SetOpacity(double value)//ÉèÖÃ͸Ã÷¶È
 {
-    if (_unActor != NULL)
-    {
-        (_unActor->GetProperty())->SetOpacity(value);
-    }
+	if (_unActor != NULL)
+	{
+		(_unActor->GetProperty())->SetOpacity(value);
+	}
 }
 
-/*
- * @brief: get opacity(获��明度)
- * @param: void
- * @ret: opacity value
- * @birth: created by czm in 20230323
- */
 double vtkVISUnstructuredGridManager::GetOpacity()
 {
-    if (_unActor != NULL)
-    {
-        return (_unActor->GetProperty())->GetOpacity();
-    }
-    else
-    {
-        return -1;
-    }
+	if (_unActor != NULL)
+	{
+		return (_unActor->GetProperty())->GetOpacity();
+	}
+	else
+	{
+		return -1;
+	}
 }
 
-/*
- * @brief: set color(设置颜色)
- * @param: rgb
- * @ret: void
- * @birth: created by czm in 20230323
- */
 void vtkVISUnstructuredGridManager::SetColor(double r, double g, double b)
 {
-    if (_unActor != NULL)
-    {
-        (_unActor->GetProperty())->SetColor(r, g, b);
-    }
+	if (_unActor != NULL)
+	{
+		(_unActor->GetProperty())->SetColor(r, g, b);
+	}
 }
 
-/*
- * @brief: get color(获�颜色)
- * @param: void
- * @ret: rgb
- * @birth: created by czm in 20230323
- */
 double* vtkVISUnstructuredGridManager::GetColor()
 {
-    if (_unActor != NULL)
-    {
-        return (_unActor->GetProperty())->GetColor();
-    }
-    return NULL;
+	if (_unActor != NULL)
+	{
+		return (_unActor->GetProperty())->GetColor();
+	}
+	return NULL;
 }
 
-/*
- * @brief: delete objects(删除对象)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
 void vtkVISUnstructuredGridManager::DeleteObjects()
 {
-    if (_unActor != NULL)
-    {
-        if (_renderer != NULL)
-        {
-            _renderer->RemoveActor(_unActor);
-        }
-        _unActor->Delete();
-    }
-
-    for (int i = 0; i < _vtkObjectsNum; i++)
-    {
-        if (_vtkObjects[i] != NULL)
-        {
-            _vtkObjects[i]->Delete();
-        }
-    }
+	if (_unActor != NULL)
+	{
+		if (_renderer != NULL)
+		{
+			_renderer->RemoveActor(_unActor);
+		}
+		_unActor->Delete();
+	}
+
+	for (int i = 0; i < _vtkObjectsNum; i++)
+	{
+		if (_vtkObjects[i] != NULL)
+		{
+			_vtkObjects[i]->Delete();
+		}
+	}
 }
 
-/*
- * @brief: get actor(获�vtkactor)
- * @param: void
- * @ret: actor
- * @birth: created by czm in 20230323
- */
 vtkActor* vtkVISUnstructuredGridManager::GetActor()
 {
-    if (_unActor != NULL)
-    {
-        return _unActor;
-    }
+	if (_unActor != NULL)
+	{
+		return _unActor;
+	}
 
-    return NULL;
+	return NULL;
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

+ 12 - 8
CAE_Solution/src/VTK/visualization_VTK/vtkvisunstructuredgridmanager.h

@@ -1,14 +1,15 @@
-#ifndef VTKVISUNSTRUCTUREDGRIDMANAGER_H
-#define VTKVISUNSTRUCTUREDGRIDMANAGER_H
-#include "vtkvismanager.h"
-#include <vtkActor.h>
-#include <vtkObjectFactory.h>
-#include "vtkvisunstructuredgridsource.h"
+#ifndef vtkVISUnstructuredGridManager_h
+#define vtkVISUnstructuredGridManager_h
 
 
-class vtkVISUnstructuredGridManager : public vtkVISManager
+#include "vtkVISManager.h"
+class vtkActor;
+class vtkVISUnstructuredGridSource;
+
+class  vtkVISUnstructuredGridManager : public vtkVISManager
 {
 public:
+
     static vtkVISUnstructuredGridManager *New();
 
     vtkVISUnstructuredGridManager();
@@ -38,6 +39,9 @@ protected:
     vtkActor* _unActor;
     vtkObject** _vtkObjects;
 
+
+
+private:
 };
 
-#endif // VTKVISUNSTRUCTUREDGRIDMANAGER_H
+#endif 

+ 386 - 432
CAE_Solution/src/VTK/visualization_VTK/vtkvisunstructuredgridsource.cpp

@@ -1,572 +1,526 @@
-#include "vtkvisunstructuredgridsource.h"
+#include <vtkUnstructuredGridReader.h>
+#include <vtkUnstructuredGrid.h>
+#include <vtkDoubleArray.h>
 #include <vtkPointData.h>
-#include <vtkIdList.h>
 #include <vtkCellData.h>
+#include <vtkIdList.h>
 #include <vtkUnstructuredGridWriter.h>
 #include <vtkObjectFactory.h>
+#include "vtkVISUnstructuredGridSource.h"
 
 vtkStandardNewMacro(vtkVISUnstructuredGridSource)
 
-/*
- * @brief: the constructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
 vtkVISUnstructuredGridSource::vtkVISUnstructuredGridSource()
 {
-    unstruReader_ = NULL;
+	unstruReader_ = NULL;
 
-    unstruGrid = NULL;
-    scalarSource = NULL;
-    vectorSource = NULL;
-    scalarRange = NULL;
+	unstruGrid = NULL;
+	scalarSource = NULL;
+	vectorSource = NULL;
+	scalarRange = NULL;
 
-    cellScalarSource_ = NULL;
-    cellVectorSource_ = NULL;
+	cellScalarSource_ = NULL;
+	cellVectorSource_ = NULL;
 }
-
-/*
- * @brief: the destructor
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
 vtkVISUnstructuredGridSource::~vtkVISUnstructuredGridSource()
 {
-
+	//ErrorInfo(0, "destructure func 0");
+	//       
+	//   for (int i=0; i<scalarNumber_; ++i)
+	//   {
+	//    ErrorInfo(0, "destructure func 1");
+	//    
+	//	if (scalarSource[i] != NULL)
+	//	{   
+	//		scalarSource[i]->Delete();   
+	//	}
+	//	//if (cellScalarSource_[i] != NULL)
+	//	//{
+	//		//cellScalarSource_[i]->Delete(); //zhuqin note 2012.10.26
+	//	//}
+	//	//if (scalarRange[i] != NULL)
+	//	//{
+	//		//delete [] scalarRange[i]; //zhuqin note 2012.10.29
+	//	//}
+	//   }
+	//ErrorInfo(0, "destructure func 2");
+	//   delete [] scalarSource;
+	//   delete [] scalarRange;
+	//   delete [] cellScalarSource_;
+	//   
+	//ErrorInfo(0, "destructure func 3");
+	//   for (int i=0; i<vectorNumber_; i++)
+	//   {
+	//	if (vectorSource[i] != NULL)
+	//	{
+	//		vectorSource[i]->Delete();
+	//	}
+	//	//if (cellVectorSource_[i] != NULL)
+	//	//{
+	//		//cellVectorSource_[i]->Delete(); //zhuqin note 2012.10.26
+	//	//}
+	//   }
+	//ErrorInfo(0, "destructure func 4");
+	//   delete [] vectorSource;
+	//   delete [] cellVectorSource_;
+	//   
+	//   delete [] scalarName;
+	//   delete [] vectorName;
+
+	//ErrorInfo(0, "destructure func 5");
+	//
+	///*
+	//if(unstruGrid != NULL)
+	//   {
+	//       unstruGrid->Delete();
+	//       unstruGrid = NULL;
+	//   }
+	//   ErrorInfo(0, "destructure func 6");
+	//   
+	//if(unstruReader_ != NULL)
+	//   {
+	//       unstruReader_->Delete();
+	//       unstruReader_ = NULL;
+	//   }*/
+	//   
+	//   ErrorInfo(0, "destructure func 7 end.");
 }
 
-/*
- * @brief: load data(加载文件)
- * @param: file name
- * @ret: void
- * @birth: created by czm in 20230323
- */
 void vtkVISUnstructuredGridSource::LoadData(char* fileName)
 {
     vtkUnstructuredGridReader* reader = vtkUnstructuredGridReader::New();
-    reader->SetFileName(fileName);
-
-    if (!(reader->IsFileUnstructuredGrid()))
-    {
-        ErrorInfo(1, "Please check you loaded data, it is not Unstructured Grid!");
-        return;
-    }
-    reader->ReadAllScalarsOff();
-    reader->ReadAllVectorsOff();
-    reader->Update();
-
-    unstruReader_ = reader;
-
-    unstruGrid = vtkUnstructuredGrid::New();
-    //unstruGrid->ReleaseDataFlagOn();
-    unstruGrid->CopyStructure(reader->GetOutput());
-
-    scalarNumber_ = reader->GetNumberOfScalarsInFile();
-    vectorNumber_ = reader->GetNumberOfVectorsInFile();
-
-    scalarName = new const char*[scalarNumber_];
-    vectorName = new const char*[vectorNumber_];
-
-    for (int i = 0; i<scalarNumber_; i++)
-    {
-        scalarName[i] = reader->GetScalarsNameInFile(i);
-    }
-    for (int i = 0; i<vectorNumber_; i++)
-    {
-        vectorName[i] = reader->GetVectorsNameInFile(i);
-    }
-
-    scalarSource = new vtkDoubleArray*[scalarNumber_];
-    scalarRange = new double*[scalarNumber_];
-    cellScalarSource_ = new vtkDoubleArray*[scalarNumber_];
-
-    for (int i = 0; i<scalarNumber_; i++)
-    {
-        scalarSource[i] = vtkDoubleArray::New();
-        scalarSource[i]->SetNumberOfComponents(1);
-
-        scalarRange[i] = new double[2];
-
-        cellScalarSource_[i] = vtkDoubleArray::New();
-        cellScalarSource_[i]->SetNumberOfComponents(1);
-    }
-
-    vectorSource = new vtkDoubleArray*[vectorNumber_];
-    cellVectorSource_ = new vtkDoubleArray*[vectorNumber_];
-    for (int i = 0; i<vectorNumber_; i++)
-    {
-        vectorSource[i] = vtkDoubleArray::New();
-        vectorSource[i]->SetNumberOfComponents(3);
-
-        cellVectorSource_[i] = vtkDoubleArray::New();
-        cellVectorSource_[i]->SetNumberOfComponents(3);
-    }
+	reader->SetFileName(fileName);
+
+	if (!(reader->IsFileUnstructuredGrid()))
+	{
+		ErrorInfo(1, "Please check you loaded data, it is not Unstructured Grid!");
+		return;
+	}
+	reader->ReadAllScalarsOff();
+	reader->ReadAllVectorsOff();
+	reader->Update();
+
+	unstruReader_ = reader;
+
+	unstruGrid = vtkUnstructuredGrid::New();
+	//unstruGrid->ReleaseDataFlagOn();
+	unstruGrid->CopyStructure(reader->GetOutput());//���ƶ���ļ��κ�����
+
+	scalarNumber_ = reader->GetNumberOfScalarsInFile();
+	vectorNumber_ = reader->GetNumberOfVectorsInFile();
+
+	scalarName = new const char*[scalarNumber_];
+	vectorName = new const char*[vectorNumber_];
+
+	for (int i = 0; i<scalarNumber_; i++)
+	{
+		scalarName[i] = reader->GetScalarsNameInFile(i);
+	}
+	for (int i = 0; i<vectorNumber_; i++)
+	{
+		vectorName[i] = reader->GetVectorsNameInFile(i);
+	}
+
+	scalarSource = new vtkDoubleArray*[scalarNumber_];
+	scalarRange = new double*[scalarNumber_];
+	cellScalarSource_ = new vtkDoubleArray*[scalarNumber_];
+
+	for (int i = 0; i<scalarNumber_; i++)
+	{
+		scalarSource[i] = vtkDoubleArray::New();
+		scalarSource[i]->SetNumberOfComponents(1);
+
+		scalarRange[i] = new double[2];
+
+		cellScalarSource_[i] = vtkDoubleArray::New();
+		cellScalarSource_[i]->SetNumberOfComponents(1);
+	}
+
+	vectorSource = new vtkDoubleArray*[vectorNumber_];
+	cellVectorSource_ = new vtkDoubleArray*[vectorNumber_];
+	for (int i = 0; i<vectorNumber_; i++)
+	{
+		vectorSource[i] = vtkDoubleArray::New();
+		vectorSource[i]->SetNumberOfComponents(3);
+
+		cellVectorSource_[i] = vtkDoubleArray::New();
+		cellVectorSource_[i]->SetNumberOfComponents(3);
+	}
 }
 
-/*
- * @brief: load scalar data(载入标量数据)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
 void vtkVISUnstructuredGridSource::LoadScalarData()
 {
-    if (unstruReader_ == NULL)
-    {
-        return;
-    }
+	if (unstruReader_ == NULL)
+	{
+		return;
+	}
 
-    double range[2];
+	double range[2];
 
-    for (int i = 0; i< scalarNumber_; i++)
-    {
-        unstruReader_->SetScalarsName(scalarName[i]);
-        unstruReader_->Update();
+	for (int i = 0; i< scalarNumber_; i++)
+	{
+		unstruReader_->SetScalarsName(scalarName[i]);
+		unstruReader_->Update();
 
-        scalarSource[i]->DeepCopy(((unstruReader_->GetOutput())->GetPointData())->GetScalars());
+		scalarSource[i]->DeepCopy(((unstruReader_->GetOutput())->GetPointData())->GetScalars());
 
-        //(unstruReader_->GetOutput())->GetScalarRange(range);
-        scalarSource[i]->GetRange(range);
-        scalarRange[i][0] = range[0];
-        scalarRange[i][1] = range[1];
+		//(unstruReader_->GetOutput())->GetScalarRange(range);
+		scalarSource[i]->GetRange(range);
+		scalarRange[i][0] = range[0];
+		scalarRange[i][1] = range[1];
 
-        std::cout << scalarRange[i][0] << " " << scalarRange[i][1] << std::endl;
-    }
+		cout << scalarRange[i][0] << " " << scalarRange[i][1] << endl;
+	}
 }
 
-/*
- * @brief: load vector data(载入矢量数据)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
 void vtkVISUnstructuredGridSource::LoadVectorData()
 {
-    if (unstruReader_ == NULL)
-    {
-        return;
-    }
-
-    for (int i = 0; i<vectorNumber_; i++)
-    {
-        unstruReader_->SetVectorsName(vectorName[i]);
-        unstruReader_->Update();
-
-        vectorSource[i]->DeepCopy(((unstruReader_->GetOutput())->GetPointData())->GetVectors());
-    }
+	if (unstruReader_ == NULL)
+	{
+		return;
+	}
+
+	for (int i = 0; i<vectorNumber_; i++)
+	{
+		unstruReader_->SetVectorsName(vectorName[i]);
+		unstruReader_->Update();
+
+		vectorSource[i]->DeepCopy(((unstruReader_->GetOutput())->GetPointData())->GetVectors());
+	}
 }
 
-/*
- * @brief: load one scalar data(载入一个标量数据)
- * @param: scalar name
- * @ret: void
- * @birth: created by czm in 20230323
- */
 void vtkVISUnstructuredGridSource::LoadOneScalarData(const char* scalar)
 {
-    double range[2];
+	double range[2];
+
 
-    int index = GetScalarIndex(scalar);
+	int index = GetScalarIndex(scalar);
 
-    if (unstruReader_ == NULL || index == -1)
-    {
-        return;
-    }
+	if (unstruReader_ == NULL || index == -1)
+	{
+		return;
+	}
 
-    unstruReader_->SetScalarsName(scalarName[index]);
-    unstruReader_->Update();
+	unstruReader_->SetScalarsName(scalarName[index]);
+	unstruReader_->Update();
 
-    scalarSource[index]->DeepCopy(((unstruReader_->GetOutput())->GetPointData())->GetScalars());
+	scalarSource[index]->DeepCopy(((unstruReader_->GetOutput())->GetPointData())->GetScalars());
 
-    scalarSource[index]->GetRange(range);
-    scalarRange[index][0] = range[0];
-    scalarRange[index][1] = range[1];
+	scalarSource[index]->GetRange(range);
+	scalarRange[index][0] = range[0];
+	scalarRange[index][1] = range[1];
 
 }
 
-/*
- * @brief: load one vector data(载入一个矢量数据)
- * @param: vector name
- * @ret: void
- * @birth: created by czm in 20230323
- */
 void vtkVISUnstructuredGridSource::LoadOneVectorData(const char* vecName)
 {
-    int index = GetVectorIndex(vecName);
+	int index = GetVectorIndex(vecName);
 
-    if (unstruReader_ == NULL || index == -1)
-    {
-        return;
-    }
+	if (unstruReader_ == NULL || index == -1)
+	{
+		return;
+	}
 
-    unstruReader_->SetVectorsName(vectorName[index]);
-    unstruReader_->Update();
+	unstruReader_->SetVectorsName(vectorName[index]);
+	unstruReader_->Update();
 
-    vectorSource[index]->DeepCopy(((unstruReader_->GetOutput())->GetPointData())->GetVectors());
+	vectorSource[index]->DeepCopy(((unstruReader_->GetOutput())->GetPointData())->GetVectors());
 }
 
-/*
- * @brief: load cell scalar data(载入单元标量数据)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
 void vtkVISUnstructuredGridSource::LoadCellScalarData()
 {
-    if (unstruReader_ == NULL)
-    {
-        return;
-    }
+	if (unstruReader_ == NULL)
+	{
+		return;
+	}
 
-    double range[2];
+	double range[2];
 
-    for (int i = 0; i<scalarNumber_; i++)
-    {
-        unstruReader_->SetScalarsName(scalarName[i]);
-        unstruReader_->Update();
+	for (int i = 0; i<scalarNumber_; i++)
+	{
+		unstruReader_->SetScalarsName(scalarName[i]);
+		unstruReader_->Update();
 
-        cellScalarSource_[i]->DeepCopy(((unstruReader_->GetOutput())->GetCellData())->GetScalars());
+		cellScalarSource_[i]->DeepCopy(((unstruReader_->GetOutput())->GetCellData())->GetScalars());
 
-        //(unstruReader_->GetOutput())->GetScalarRange(range);
-        cellScalarSource_[i]->GetRange(range);
-        scalarRange[i][0] = range[0];
-        scalarRange[i][1] = range[1];
-    }
+		//(unstruReader_->GetOutput())->GetScalarRange(range);
+		cellScalarSource_[i]->GetRange(range);
+		scalarRange[i][0] = range[0];
+		scalarRange[i][1] = range[1];
+	}
 }
 
-/*
- * @brief: load cell vector data(载入单元矢量数据)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
 void vtkVISUnstructuredGridSource::LoadCellVectorData()
 {
-    if (unstruReader_ == NULL)
-    {
-        return;
-    }
-
-    for (int i = 0; i<vectorNumber_; i++)
-    {
-        unstruReader_->SetVectorsName(vectorName[i]);
-        unstruReader_->Update();
-
-        cellVectorSource_[i]->DeepCopy(((unstruReader_->GetOutput())->GetCellData())->GetVectors());
-    }
+	if (unstruReader_ == NULL)
+	{
+		return;
+	}
+
+	for (int i = 0; i<vectorNumber_; i++)
+	{
+		unstruReader_->SetVectorsName(vectorName[i]);
+		unstruReader_->Update();
+
+		cellVectorSource_[i]->DeepCopy(((unstruReader_->GetOutput())->GetCellData())->GetVectors());
+	}
 }
 
-/*
- * @brief: load one cell scalar data(载入一个单元标量量数据)
- * @param: scalar name
- * @ret: void
- * @birth: created by czm in 20230323
- */
 void vtkVISUnstructuredGridSource::LoadOneCellScalarData(const char* scalar)
 {
-    int index = GetScalarIndex(scalar);
+	int index = GetScalarIndex(scalar);
 
-    if (unstruReader_ == NULL || index == -1)
-    {
-        return;
-    }
+	if (unstruReader_ == NULL || index == -1)
+	{
+		return;
+	}
 
-    double range[2];
+	double range[2];
 
-    unstruReader_->SetScalarsName(scalarName[index]);
-    unstruReader_->Update();
+	unstruReader_->SetScalarsName(scalarName[index]);
+	unstruReader_->Update();
 
-    cellScalarSource_[index]->DeepCopy(((unstruReader_->GetOutput())->GetCellData())->GetScalars());
+	cellScalarSource_[index]->DeepCopy(((unstruReader_->GetOutput())->GetCellData())->GetScalars());
 
-    //(unstruReader_->GetOutput())->GetScalarRange(range);
-    cellScalarSource_[index]->GetRange(range);
-    scalarRange[index][0] = range[0];
-    scalarRange[index][1] = range[1];
+	//(unstruReader_->GetOutput())->GetScalarRange(range);
+	cellScalarSource_[index]->GetRange(range);
+	scalarRange[index][0] = range[0];
+	scalarRange[index][1] = range[1];
 
 }
 
-/*
- * @brief: load one cell vector data(载入一个单元矢量量数据)
- * @param: vector name
- * @ret: void
- * @birth: created by czm in 20230323
- */
 void vtkVISUnstructuredGridSource::LoadOneCellVectorData(const char* vecName)
 {
-    int index = GetVectorIndex(vecName);
+	int index = GetVectorIndex(vecName);
 
-    if (unstruReader_ == NULL || index == -1)
-    {
-        return;
-    }
+	if (unstruReader_ == NULL || index == -1)
+	{
+		return;
+	}
 
-    unstruReader_->SetVectorsName(vectorName[index]);
-    unstruReader_->Update();
+	unstruReader_->SetVectorsName(vectorName[index]);
+	unstruReader_->Update();
 
-    cellVectorSource_[index]->DeepCopy(((unstruReader_->GetOutput())->GetCellData())->GetVectors());
+	cellVectorSource_[index]->DeepCopy(((unstruReader_->GetOutput())->GetCellData())->GetVectors());
 }
 
-/*
- * @brief: get source bounds(获取源边界)
- * @param: void
- * @ret: the point pf bounds
- * @birth: created by czm in 20230323
- */
 double* vtkVISUnstructuredGridSource::GetSourceBounds()
 {
-    if (unstruGrid != NULL)
-    {
-        return unstruGrid->GetBounds();
-    }
-    return NULL;
+	if (unstruGrid != NULL)
+	{
+		return unstruGrid->GetBounds();//����ָ�򼸺α߿��ָ�루xmin��xmax��ymin��ymax��zmin��zmax��
+	}
+	return NULL;
 }
 
-/*
- * @brief: get source center(获取源中心)
- * @param: void
- * @ret: the point pf center
- * @birth: created by czm in 20230323
- */
 double* vtkVISUnstructuredGridSource::GetSourceCenter()
 {
-    if (unstruGrid != NULL)
-    {
-        return unstruGrid->GetCenter();
-    }
-    return NULL;
+	if (unstruGrid != NULL)
+	{
+		return unstruGrid->GetCenter();//���ر߽������
+	}
+	return NULL;
 
 }
 
-/*
- * @brief: get unstructored grid(获取非结构化网格)
- * @param: void
- * @ret: the point pf grid
- * @birth: created by czm in 20230323
- */
 vtkUnstructuredGrid* vtkVISUnstructuredGridSource::GetGrid()
 {
+	//unstruGrid->Update();//vtkObjectû�����ƺ���
 
-    std::cout << unstruGrid->GetNumberOfPoints() << "  " << unstruGrid->GetNumberOfCells() << endl;
+	cout << unstruGrid->GetNumberOfPoints() << "  " << unstruGrid->GetNumberOfCells() << endl;
 
-    return unstruGrid;
+	return unstruGrid;
 }
 
-/*
- * @brief: get scalar range(获取标量范围)
- * @param: scalar name
- * @ret: the pointer of scalar range
- * @birth: created by czm in 20230323
- */
 double* vtkVISUnstructuredGridSource::GetScalarRange(const char* scalarName)
 {
-    int index = GetScalarIndex(scalarName);
+	int index = GetScalarIndex(scalarName);
 
-    //cout<<"scalar index:: "<<index<<endl;
+	//cout<<"scalar index:: "<<index<<endl;
 
-    if (index == -1)
-    {
-        return NULL;
-    }
+	if (index == -1)
+	{
+		return NULL;
+	}
 
-    return scalarRange[index];
+	return scalarRange[index];
 }
 
-/*
- * @brief: clean ungrid data(清理非结构化网格数据)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230323
- */
 void vtkVISUnstructuredGridSource::CleanUnGridData()
 {
-    vtkUnstructuredGrid* unGrid = vtkUnstructuredGrid::New();
-    unGrid->CopyStructure(unstruGrid);
+	vtkUnstructuredGrid* unGrid = vtkUnstructuredGrid::New();
+	unGrid->CopyStructure(unstruGrid);
 
-    vtkPoints* points = vtkPoints::New();
-    points->DeepCopy(unGrid->GetPoints());
+	vtkPoints* points = vtkPoints::New();
+	points->DeepCopy(unGrid->GetPoints());
 
-    int cellNum = unGrid->GetNumberOfCells();
-    int pointNum = unGrid->GetNumberOfPoints();
+	int cellNum = unGrid->GetNumberOfCells();
+	int pointNum = unGrid->GetNumberOfPoints();
 
-    //cout<<"point num::  "<<pointNum<<"   cell number:: "<<cellNum<<endl;
+	//cout<<"point num::  "<<pointNum<<"   cell number:: "<<cellNum<<endl;
 
-    vtkIdType *pts, npts;
-    vtkIdList* idList = vtkIdList::New();
+	vtkIdType *pts, npts;
+	vtkIdList* idList = vtkIdList::New();
 
-    int num = 0;
-    int cellIndex = -1;
+	int num = 0;
+	int cellIndex = -1;
 
-    vtkIdList* pointIndexList = vtkIdList::New(); //the Points List will be deleted
-    vtkIdList* cellIndexList = vtkIdList::New(); //the cells List will be deleted
+	vtkIdList* pointIndexList = vtkIdList::New(); //the Points List will be deleted
+	vtkIdList* cellIndexList = vtkIdList::New(); //the cells List will be deleted
 
-    for (int i = 0; i<pointNum; i++)
-    {
-        unGrid->GetPointCells(i, idList);
+	for (int i = 0; i<pointNum; i++)
+	{
+		unGrid->GetPointCells(i, idList);
 
-        if (idList->GetNumberOfIds() == 1)
-        {
-            cellIndex = idList->GetId(0);
+		if (idList->GetNumberOfIds() == 1)
+		{
+			cellIndex = idList->GetId(0);
 
-            unGrid->GetCellPoints(cellIndex, npts, pts);
+			unGrid->GetCellPoints(cellIndex, npts, pts);
 
-            if (npts == 1)
-            {
-                //cout<<"pointID:: "<<i<<"  cellID:: "<<cellIndex<<"  pts[0]::  "<<pts[0]<<endl;
+			if (npts == 1)
+			{
+				//cout<<"pointID:: "<<i<<"  cellID:: "<<cellIndex<<"  pts[0]::  "<<pts[0]<<endl;
 
-                pointIndexList->InsertNextId(i);
-                cellIndexList->InsertNextId(cellIndex);
-            }
-        }
-    }
+				pointIndexList->InsertNextId(i);
+				cellIndexList->InsertNextId(cellIndex);
+			}
+		}
+	}
 
-    vtkUnstructuredGrid* newUnGrid = vtkUnstructuredGrid::New();
-    vtkPoints* newPoints = vtkPoints::New();
+	vtkUnstructuredGrid* newUnGrid = vtkUnstructuredGrid::New();
+	vtkPoints* newPoints = vtkPoints::New();
 
-    int isE = 0;
+	int isE = 0;
 
-    for (int i = 0; i<cellNum; i++)
-    {
-        isE = cellIndexList->IsId(i);
+	for (int i = 0; i<cellNum; i++)
+	{
+		isE = cellIndexList->IsId(i);
 
-        if (isE == -1)
-        {
-            unGrid->GetCellPoints(i, npts, pts);
+		if (isE == -1)
+		{
+			unGrid->GetCellPoints(i, npts, pts);
 
-            newUnGrid->InsertNextCell(unGrid->GetCellType(i), npts, pts);
-            newUnGrid->Modified();
-        }
-    }
+			newUnGrid->InsertNextCell(unGrid->GetCellType(i), npts, pts);
+			newUnGrid->Modified();
+		}
+	}
 
-    int kk = 0;
+	int kk = 0;
 
-    for (int i = 0; i<pointNum; i++)
-    {
-        isE = pointIndexList->IsId(i);
+	for (int i = 0; i<pointNum; i++)
+	{
+		isE = pointIndexList->IsId(i);
 
-        if (isE == -1)
-        {
-            newPoints->InsertNextPoint(points->GetPoint(i));
-            newPoints->Modified();
-        }
-        else
-        {
-            //remove corresponding scalar and vector
-            //
-            num = i - kk;
+		if (isE == -1)
+		{
+			newPoints->InsertNextPoint(points->GetPoint(i));
+			newPoints->Modified();
+		}
+		else
+		{
+			//remove corresponding scalar and vector
+			//
+			num = i - kk;
 
-            //cout<<"num:::: "<<i<<"  "<<kk<<"  "<<num<<endl;
+			//cout<<"num:::: "<<i<<"  "<<kk<<"  "<<num<<endl;
 
-            for (int m = 0; m<scalarNumber_; m++)
-            {
-                if (scalarSource[m] != NULL)
-                {
-                    //cout<<"m::: "<<scalarSource[m]->GetNumberOfTuples()<<endl;
+			for (int m = 0; m<scalarNumber_; m++)
+			{
+				if (scalarSource[m] != NULL)
+				{
+					//cout<<"m::: "<<scalarSource[m]->GetNumberOfTuples()<<endl;
 
-                    //cout<<scalarSource[m]->GetTuple1(scalarSource[m]->GetNumberOfTuples()-1)<<endl;
+					//cout<<scalarSource[m]->GetTuple1(scalarSource[m]->GetNumberOfTuples()-1)<<endl;
 
-                    scalarSource[m]->RemoveTuple(num);
-                }
-            }
-            for (int n = 0; n<vectorNumber_; n++)
-            {
-                if (vectorSource[n] != NULL)
-                {
-                    //cout<<"n::: "<<vectorSource[n]->GetNumberOfTuples()<<endl;
+					scalarSource[m]->RemoveTuple(num);
+				}
+			}
+			for (int n = 0; n<vectorNumber_; n++)
+			{
+				if (vectorSource[n] != NULL)
+				{
+					//cout<<"n::: "<<vectorSource[n]->GetNumberOfTuples()<<endl;
 
-                    //cout<<vectorSource[n]->GetTuple3(vectorSource[n]->GetNumberOfTuples()-1)<<endl;
+					//cout<<vectorSource[n]->GetTuple3(vectorSource[n]->GetNumberOfTuples()-1)<<endl;
 
-                    vectorSource[n]->RemoveTuple(num);
-                }
-            }
-            kk++;
-        }
-    }
+					vectorSource[n]->RemoveTuple(num);
+				}
+			}
+			kk++;
+		}
+	}
 
-    cout << "new point num:::  " << newPoints->GetNumberOfPoints() << endl;
+	cout << "new point num:::  " << newPoints->GetNumberOfPoints() << endl;
 
-    int ptsNum = pointIndexList->GetNumberOfIds();
-    //cout<<"The number of points deleted is:  "<<ptsNum<<endl;
+	int ptsNum = pointIndexList->GetNumberOfIds();
+	//cout<<"The number of points deleted is:  "<<ptsNum<<endl;
 
-    int newCellNum = newUnGrid->GetNumberOfCells();
-    //cout<<"new cell num::  "<<newCellNum<<endl;
-
-    int pointId = -1;
-
-    for (int i = 0; i<ptsNum; i++)
-    {
-        pointId = pointIndexList->GetId(i);
-
-        //cout<<"pointIndex::"<< i<<"  "<<pointId<<endl;
-
-        num = pointId - i;
-
-        for (int j = 0; j<newCellNum; j++)
-        {
-            newUnGrid->GetCellPoints(j, npts, pts);
-
-            for (int k = 0; k<npts; k++)
-            {
-                if (pts[k] > num)
-                {
-                    pts[k] = pts[k] - 1;
-                }
-            }
-            newUnGrid->ReplaceCell(j, npts, pts);
-            newUnGrid->Modified();
-        }
-    }
-
-    newUnGrid->SetPoints(newPoints);
-    newUnGrid->Modified();
-
-    this->unstruGrid = newUnGrid;
-
-    //cout<<unstruGrid->GetNumberOfPoints()<<"  "<<unstruGrid->GetNumberOfCells()<<endl;
-
-    /*
-    vtkUnstructuredGridWriter* writer = vtkUnstructuredGridWriter::New();
-    writer->SetInput(newUnGrid);
-    writer->SetFileName("outtest.vtk");
-    writer->Write();
-    */
-
-    //delete objects
-    //
-    unGrid->Delete();
-    points->Delete();
-    //newUnGrid->Delete();
-    newPoints->Delete();
-    idList->Delete();
+	int newCellNum = newUnGrid->GetNumberOfCells();
+	//cout<<"new cell num::  "<<newCellNum<<endl;
+
+	int pointId = -1;
+
+	for (int i = 0; i<ptsNum; i++)
+	{
+		pointId = pointIndexList->GetId(i);
+
+		//cout<<"pointIndex::"<< i<<"  "<<pointId<<endl;
+
+		num = pointId - i;
+
+		for (int j = 0; j<newCellNum; j++)
+		{
+			newUnGrid->GetCellPoints(j, npts, pts);
+
+			for (int k = 0; k<npts; k++)
+			{
+				if (pts[k] > num)
+				{
+					pts[k] = pts[k] - 1;
+				}
+			}
+			newUnGrid->ReplaceCell(j, npts, pts);
+			newUnGrid->Modified();
+		}
+	}
+
+	newUnGrid->SetPoints(newPoints);
+	newUnGrid->Modified();
+
+	this->unstruGrid = newUnGrid;
+
+	//cout<<unstruGrid->GetNumberOfPoints()<<"  "<<unstruGrid->GetNumberOfCells()<<endl;
+
+	/*
+	vtkUnstructuredGridWriter* writer = vtkUnstructuredGridWriter::New();
+	writer->SetInput(newUnGrid);
+	writer->SetFileName("outtest.vtk");
+	writer->Write();
+	*/
+
+	//delete objects
+	//
+	unGrid->Delete();
+	points->Delete();
+	//newUnGrid->Delete();
+	newPoints->Delete();
+	idList->Delete();
 }
 
-/*
- * @brief: get scalar source by index(通过索引获取标量源)
- * @param: index
- * @ret: the pointer of scalar
- * @birth: created by czm in 20230323
- */
 vtkDoubleArray* vtkVISUnstructuredGridSource::GetScalarSource(int index)
 {
-    if (index<0 || index>scalarNumber_)
-    {
-        return NULL;
-    }
-    return this->scalarSource[index];
+	if (index<0 || index>scalarNumber_)
+	{
+		return NULL;
+	}
+	return this->scalarSource[index];
 }
-
-/*
- * @brief: get vector source by index(通过索引获取矢量源)
- * @param: index
- * @ret: the pointer of vector
- * @birth: created by czm in 20230323
- */
 vtkDoubleArray* vtkVISUnstructuredGridSource::GetVectorSource(int index)
 {
-    if (index<0 || index>vectorNumber_)
-    {
-        return NULL;
-    }
-    return this->vectorSource[index];
+	if (index<0 || index>vectorNumber_)
+	{
+		return NULL;
+	}
+	return this->vectorSource[index];
 }

+ 15 - 13
CAE_Solution/src/VTK/visualization_VTK/vtkvisunstructuredgridsource.h

@@ -1,21 +1,24 @@
-#ifndef VTKVISUNSTRUCTUREDGRIDSOURCE_H
-#define VTKVISUNSTRUCTUREDGRIDSOURCE_H
-#include "vtkvismanager.h"
-#include <vtkUnstructuredGridReader.h>
-#include <vtkUnstructuredGrid.h>
-#include <vtkDoubleArray.h>
-#include <vtkObjectFactory.h>
-#include <vtkPoints.h>
+#ifndef vtkVISUnstructuredGridSource_h
+#define vtkVISUnstructuredGridSource_h
 
 
-class vtkVISUnstructuredGridSource : public vtkVISManager
+#include "vtkVISManager.h"
+
+class vtkUnstructuredGridReader;
+class vtkUnstructuredGrid;
+class vtkDoubleArray;
+class vtkPoints;
+
+class  vtkVISUnstructuredGridSource : public vtkVISManager
 {
 public:
+
     static vtkVISUnstructuredGridSource *New();
+
     vtkVISUnstructuredGridSource();
     ~vtkVISUnstructuredGridSource();
 
-    vtkUnstructuredGrid *unstruGrid;
+    vtkUnstructuredGrid* unstruGrid;
     vtkDoubleArray** scalarSource;
     vtkDoubleArray** vectorSource;
     double** scalarRange;
@@ -53,8 +56,7 @@ protected:
     vtkUnstructuredGridReader *unstruReader_;
 
     void DeleteOnePoint(vtkPoints* &points, int index);
-
-
 };
 
-#endif // VTKVISUNSTRUCTUREDGRIDSOURCE_H
+
+#endif

+ 0 - 838
CAE_Solution/src/VTK/visualization_VTK/vtkvisxyplot.cpp

@@ -1,838 +0,0 @@
-#include "vtkvisxyplot.h"
-#include "vtkRenderWindowInteractor.h"
-#include "vtkAxisActor2D.h"
-#include <vtkRenderer.h>
-
-vtkStandardNewMacro(vtkVISXYPlot)
-
-/*
- * @brief: the constructor
- * @param:
- * @ret:
- * @birth: created by czm in 20230410
- */
-vtkVISXYPlot::vtkVISXYPlot()
-{
-    XYPlot_ = NULL;
-
-    legend_ = NULL;
-
-    plotNumber_ = 0;
-
-    xValues[0] = "Index";
-    xValues[1] = "ArcLength";
-    xValues[2] = "NormalizedArcLength";
-    xValues[3] = "Value";
-}
-
-/*
- * @brief: the destructor
- * @param:
- * @ret:
- * @birth: created by czm in 20230410
- */
-vtkVISXYPlot::~vtkVISXYPlot()
-{
-    if(XYPlot_ != NULL)
-    {
-        if(_renderer != NULL)
-        {
-            _renderer->RemoveActor2D(XYPlot_);
-        }
-        XYPlot_->Delete();
-    }
-    XYPlot_ = NULL;
-
-    if(legend_ != NULL)
-    {
-        if(_renderer != NULL)
-        {
-            _renderer->RemoveActor2D(legend_);
-        }
-        legend_->Delete();
-    }
-    legend_ = NULL;
-
-}
-
-/*
- * @brief: create a blank xy plot actor (创造一个空白的xy坐标的actor)An actor XYPlotActor_ will create and save as protected variable.
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::CreateBlankXYPlotActor()
-{
-    XYPlot_ = vtkXYPlotActor::New();
-
-    XYPlot_->SetXLabelFormat("%.1lf");
-    XYPlot_->SetYLabelFormat("%1.1E");
-
-    XYPlot_->LegendOff();
-
-    XYPlot_->SetNumberOfXMinorTicks(4);
-    XYPlot_->SetNumberOfYMinorTicks(4);
-
-    XYPlot_->AdjustTitlePositionOff();
-    XYPlot_->SetAdjustXLabels(1);
-    XYPlot_->SetAdjustYLabels(1);
-
-    XYPlot_->PlotLinesOn();
-    XYPlot_->PlotPointsOff();
-
-    vtkTextProperty *prop = XYPlot_->GetTitleTextProperty();
-    prop->SetFontFamilyToTimes();
-    prop->SetFontSize(5);
-    prop->ShadowOff();
-    prop->ItalicOff();
-    prop->SetColor((XYPlot_->GetProperty())->GetColor());
-
-    XYPlot_->SetAxisTitleTextProperty(prop);
-    XYPlot_->SetAxisLabelTextProperty(prop);
-
-    if (_renderer != NULL)
-    {
-        _renderer->AddActor2D(XYPlot_);
-    }
-}
-
-/*
- * @brief: Change glyph using on plot point to specified type(将绘图点上使用的图示符更改为指定类型)
- * @param: index and below type(point /cross square/square/Other string will turn the plot point off)
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetGlyphTypeTo(int index, char* type)
-{
-    vtkSphereSource *vertexGlyph = vtkSphereSource::New();
-    vertexGlyph->Update();
-
-    vtkCubeSource *cube = vtkCubeSource::New();
-    cube->Update();
-    vtkConeSource *triangle = vtkConeSource::New();
-    triangle->SetDirection(0, 1, 0);
-    triangle->Update();
-    //vtkLineSource *none = vtkLineSource::New();
-
-    vtkGlyphSource2D *none = vtkGlyphSource2D::New();
-    none->SetGlyphTypeToNone();
-    none->Update();
-    //--------------------------------
-    vtkSphereSource *vertexGlyph2 = vtkSphereSource::New();
-    vertexGlyph2->SetCenter(0, 0.5, 0);
-    vertexGlyph2->Update();
-
-    vtkCubeSource *cube2 = vtkCubeSource::New();
-    cube2->SetCenter(0, 0.5, 0);
-    cube2->Update();
-
-    vtkConeSource *triangle2 = vtkConeSource::New();
-    triangle2->SetDirection(0, 1, 0);
-    triangle2->SetCenter(0, 0.5, 0);
-    triangle2->Update();
-
-    vtkLineSource *none2 = vtkLineSource::New();
-    none2->SetPoint1(-0.25, 0.25, 0);
-    none2->SetPoint2(0.25, 0.25, 0);
-    none2->Update();
-
-
-    if (XYPlot_ != NULL)
-    {
-        //        XYPlot_->PlotPointsOn();
-        //        XYPlot_->SetGlyphSize(0.015);
-        //
-        //        if (strcmp(type, "Point") == 0)
-        //        {
-        //            XYPlot_->SetPlotSymbol(index, vertexGlyph->GetOutput());
-        //        }
-        //        else if (strcmp(type, "Square") == 0)
-        //        {
-        //            XYPlot_->SetPlotSymbol(index, cube->GetOutput());
-        //        }
-        //        else if (strcmp(type, "Triangle") == 0)
-        //        {
-        //            XYPlot_->SetPlotSymbol(index, triangle->GetOutput());
-        //        }
-        //        else
-        //        {
-        //            XYPlot_->SetPlotSymbol(index, none->GetOutput());
-        //        }
-    }
-    if(legend_ != NULL)
-    {
-        if (strcmp(type, "Point") == 0)
-        {
-            legend_->SetEntrySymbol(index,vertexGlyph2->GetOutput());
-        }
-        else if (strcmp(type, "Square") == 0)
-        {
-            legend_->SetEntrySymbol(index, cube2->GetOutput());
-        }
-        else if (strcmp(type, "Triangle") == 0)
-        {
-            legend_->SetEntrySymbol(index, triangle2->GetOutput());
-        }
-        else
-        {
-            legend_->SetEntrySymbol(index, none2->GetOutput());
-        }
-    }
-    XYPlot_->Modified();
-    /*XYPlot_->Modified();
-    legend_->Modified ();*/
-}
-
-/*
- * @brief: Add data via vtkDataSet object(通过vtkDataSet对象添加数据)
- * @param: data
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::AddXYPlotData(vtkDataSet *data)
-{
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->AddDataSetInput(data);
-    }
-}
-
-/*
- * @brief: remove data(移除数据)
- * @param: data
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::RemoveXYPlotData(vtkDataSet *data)
-{
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->RemoveDataSetInput(data);
-    }
-}
-
-/*
- * @brief: Set X's label number(设置X的标签编号,设置将在x轴上放置的标签数量)
- * @param: num
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetXLabelsNumber(int num)
-{
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->SetNumberOfXLabels(num);
-    }
-}
-
-/*
- * @brief: Set Y's label number(设置Y的标签编号,设置将在y轴上放置的标签数量)
- * @param: num
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetYLabelsNumber(int num)
-{
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->SetNumberOfYLabels(num);
-    }
-}
-
-/*
- * @brief: Set position coordinate(设置位置坐标)
- * @param:  a b
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetPositionCoordinate(double a, double b)
-{
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->SetPosition(a, b);
-    }
-}
-
-/*
- * @brief: Set position2 coordinate(设置位置坐标)
- * @param:  a b
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetPosition2Coordinate(double a, double b)
-{
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->SetPosition2(a, b);
-    }
-}
-
-/*
- * @brief: Set x value(设置x值)
- * @param: value
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetXValuesTo(char* xValue)
-{
-    int index = GetXValueIndex(xValue);
-
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->SetXValues(index);
-    }
-}
-
-/*
- * @brief: Set figure title(设置xy绘图标题)
- * @param: title
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetXYPlotTitle(char* title)
-{
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->SetTitle(title);
-    }
-}
-
-/*
- * @brief: Set plot label title on x axis(在x轴上设置绘图标签标题)
- * @param: xtitle
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetXYPlotXTitle(char* xTitle)
-{
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->SetXTitle(xTitle);
-    }
-}
-
-/*
- * @brief: Set plot label title on y axis(在y轴上设置绘图标签标题)
- * @param: ytitle
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetXYPlotYTitle(char* yTitle)
-{
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->SetYTitle(yTitle);
-    }
-}
-
-/*
- * @brief: Set color for drawing the figure (Axis, title, labels)(设置绘制图形的颜色)
- * @param: rgb
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetXYPlotActorColor(double r, double g, double b)
-{
-    if (XYPlot_ != NULL)
-    {
-        (XYPlot_->GetProperty())->SetColor(r, g, b);
-        (XYPlot_->GetTitleTextProperty())->SetColor(r, g, b);
-
-        XYPlot_->SetAxisTitleTextProperty(XYPlot_->GetTitleTextProperty());
-        XYPlot_->SetAxisLabelTextProperty(XYPlot_->GetTitleTextProperty());
-    }
-}
-
-/*
- * @brief: Set plot legend label(设置绘图图例标签)
- * @param: index and label
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetXYPlotLable(int index, char* label)
-{
-   /*
-   if (XYPlot_ != NULL)
-    {
-        XYPlot_->SetPlotLabel(index, label);
-    }
-    */
-
-    if(legend_ != NULL)
-    {
-        legend_->SetEntryString(index, label);
-    }
-}
-
-/*
- * @brief: Set plotting color (lines and plot points)(设置打印颜色(线和打印点))
- * @param: index and rgb
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetXYPlotColor(int index, double r, double g, double b)
-{
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->GetLegendActor()->SetEntryColor(index, r, g, b);
-        XYPlot_->Modified();
-    }
-    if(legend_ != NULL)
-    {
-        legend_->SetEntryColor(index, r, g, b);
-    }
-}
-
-/*
- * @brief: Add data for plotting (via vtkDataObject)(添加用于打印的数据)
- * @param: index and dataobj
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::AddXYPlotDataObject(int index, vtkDataObject *dataObj)
-{
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->AddDataObjectInput(dataObj);
-        XYPlot_->SetDataObjectXComponent(index, 0);
-        XYPlot_->SetDataObjectYComponent(index, 1);
-    }
-}
-
-/*
- * @brief: Remove plotting data(删除打印数据)
- * @param: dataobj
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::RemoveXYPlotDataObject( vtkDataObject *dataObj)
-{
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->RemoveDataObjectInput(dataObj);
-    }
-}
-
-/*
- * @brief: Set x range in plot(在绘图中设置x范围)
- * @param: range
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetPlotXRange(double min, double max)
-{
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->SetXRange(min, max);
-    }
-}
-
-/*
- * @brief: Set y range in plot(在绘图中设置y范围)
- * @param: range
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetPlotYRange(double min, double max)
-{
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->SetYRange(min, max);
-    }
-}
-
-/*
- * @brief: Get X Value Index(获取X值索引)
- * @param: tyep(index/arclength/normalizedarclength/value)
- * @ret: void
- * @birth: created by czm in 20230410
- */
-int vtkVISXYPlot::GetXValueIndex(char* type)
-{
-    for (int i=0; i<4; i++)
-    {
-        if( strcmp(type, xValues[i].c_str()) == 0)
-        {
-            return i;
-        }
-    }
-    ErrorInfo(1, "Error x value!");
-
-    return 0;
-}
-
-/*
- * @brief: Modify Plot Line Width(修改打印线宽)
- * @param: value
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::ModifyPlotLineWidth(double value)
-{
-    if (XYPlot_ != NULL)
-    {
-        if (value == 0)
-        {
-            XYPlot_->PlotLinesOff();
-            (XYPlot_->GetProperty())->SetLineWidth(0);
-        }
-        else
-        {
-            XYPlot_->PlotLinesOn();
-            (XYPlot_->GetProperty())->SetLineWidth(value);
-        }
-    }
-}
-
-/*
- * @brief: Set XYPlot Legend Position(设置XYPlot图例位置)
- * @param: a---x  b---y
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetXYPlotLegendPosition(double a, double b)
-{
-    if (legend_ != NULL)
-    {
-        legend_->SetPosition(a, b);
-    }
-}
-
-/*
- * @brief: Set XYPlot Legend Position2(设置XYPlot图例位置2)
- * @param: a---x  b---y
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetXYPlotLegendPosition2(double a, double b)
-{
-    if (legend_ != NULL)
-    {
-        legend_->SetPosition2(a, b);
-    }
-}
-
-/*
- * @brief: Set XYPlot Title Position(设置XYPlot标题位置)
- * @param: a---x  b---y
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetXYPlotTitlePosition(double a, double b)
-{
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->SetTitlePosition(a, b);
-    }
-}
-
-/*
- * @brief: Get XYPlot Color(获取XYPlot颜色)
- * @param: index
- * @ret: color
- * @birth: created by czm in 20230410
- */
-double* vtkVISXYPlot::GetXYPlotColor(int index)
-{
-    if (XYPlot_ != NULL)
-    {
-         return XYPlot_->GetPlotColor(index);
-    }
-    return NULL;
-}
-
-/*
- * @brief: Get XYPlot line width(获取XYPlot线宽)
- * @param: void
- * @ret: line width
- * @birth: created by czm in 20230410
- */
-double vtkVISXYPlot::GetPlotLineWidth()
-{
-    if (XYPlot_ != NULL)
-    {
-         return (XYPlot_->GetProperty())->GetLineWidth();
-    }
-    return -1;
-}
-
-/*
- * @brief: set XYPlot glyph size(设置XYPlot字形大小)
- * @param: size
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetXYPlotGlyphSize(double size)
-{
-    if (XYPlot_ != NULL)
-    {
-        XYPlot_->SetGlyphSize(size);
-    }
-}
-
-/*
- * @brief: get XYPlot glyph size(获取XYPlot字形大小)
- * @param: void
- * @ret: size
- * @birth: created by czm in 20230410
- */
-double vtkVISXYPlot::GetXYPlotGlyphSize()
-{
-    if (XYPlot_ != NULL)
-    {
-         return XYPlot_->GetGlyphSize();
-    }
-
-    return 0;
-}
-
-/*
- * @brief: get XYPlot label(获取XYPlot标签)
- * @param: index
- * @ret: const char*
- * @birth: created by czm in 20230410
- */
-const char* vtkVISXYPlot::GetXYPlotLable(int index)
-{
-   /*
-   if (XYPlot_ != NULL)
-    {
-         return XYPlot_->GetPlotLabel(index);
-    }
-    */
-    if(legend_ != NULL)
-    {
-        return legend_->GetEntryString(index);
-    }
-
-    return NULL;
-}
-
-/*
- * @brief: remove XYPlot all input(移除XYPlot所有输入)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::RemoveXYPlotAllInputs()
-{
-    if (XYPlot_ != NULL)
-    {
-         XYPlot_->RemoveAllDataSetInputConnections();
-    }
-}
-
-/*
- * @brief: set XYPlot number(设置XYPlot编号)
- * @param: num
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetXYPlotNumber(int num)
-{
-    plotNumber_ = num;
-
-    /*
-    if (XYPlot_ != NULL)
-    {
-         (XYPlot_->GetLegendActor())->SetNumberOfEntries(num);
-    }
-    */
-    if(legend_ != NULL)
-    {
-        return legend_->SetNumberOfEntries(num);
-    }
-}
-
-/*
- * @brief: get XYPlot number(获取XYPlot编号)
- * @param: void
- * @ret: num
- * @birth: created by czm in 20230410
- */
-int vtkVISXYPlot::GetXYPlotNumber()
-{
-    return this->plotNumber_;
-}
-
-/*
- * @brief: remove XYPlot actor(移除XYPlot actor)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::RemoveXYPlotActor()
-{
-    if (_renderer != NULL && XYPlot_ != NULL)
-    {
-        _renderer->RemoveActor2D(XYPlot_);
-    }
-}
-
-/*
- * @brief: Create Legend Box Actor(创建图例框演员)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::CreateLegendBoxActor()
-{
-    if(legend_ != NULL)
-    {
-        if(_renderer != NULL)
-        {
-            _renderer->RemoveActor2D(legend_);
-        }
-        legend_->Delete();
-        legend_ = NULL;
-    }
-
-    legend_ = vtkLegendBoxActor::New();
-
-    //(legend_->GetPositionCoordinate())->Set
-    //(legend_->GetPosition2Coordinate())->SetCoordinateSystemToViewport();
-
-    legend_->BorderOff();
-
-    if(_renderer != NULL)
-    {
-        _renderer->AddActor2D(legend_);
-    }
-
-}
-
-/*
- * @brief: GetCurrentRange(获取最近的范围)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::GetCurrentRange()
-{
-    if (GetXYPlotActor()->GetAdjustXLabels())
-    {
-        GetXYPlotActor()->GetXAxisActor2D()->GetAdjustedRange(XRange_);
-    }
-    else
-    {
-        GetXYPlotActor()->GetXAxisActor2D()->GetRange(XRange_);
-    }
-    if (GetXYPlotActor()->GetAdjustYLabels())
-    {
-        GetXYPlotActor()->GetYAxisActor2D()->GetAdjustedRange(YRange_);
-    }
-    else
-    {
-        GetXYPlotActor()->GetYAxisActor2D()->GetRange(YRange_);
-    }
-}
-
-/*
- * @brief: show on(打开显示)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::ShowOn()
-{
-   if (XYPlot_ != NULL)
-   {
-        XYPlot_->VisibilityOn();
-   }
-   if (legend_!=NULL)
-   {
-       legend_->VisibilityOn();
-   }
-}
-
-/*
- * @brief: show off(关闭显示)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::ShowOff()
-{
-   if (XYPlot_ != NULL)
-   {
-        XYPlot_->VisibilityOff();
-   }
-   if (legend_!=NULL)
-   {
-       legend_->VisibilityOff();
-   }
-}
-
-/*
- * @brief: Get XYPlot Actor(获取xypolt actor)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-vtkXYPlotActor* vtkVISXYPlot::GetXYPlotActor()
-{
-   if (XYPlot_ != NULL)
-   {
-        return XYPlot_;
-   }
-   return NULL;
-}
-
-
-/*
- * @brief: reset range(充值xy范围)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::ResetRange()
-{
-    SetPlotXRange(min(XRange_[0],XRange_[1]), max(XRange_[0],XRange_[1]));
-    SetPlotYRange(min(YRange_[0],YRange_[1]), max(YRange_[0],YRange_[1]));
-}
-
-/*
- * @brief: set point type(设置点类型)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetPointType()
-{
-    XYPlot_->PlotPointsOn();
-    XYPlot_->PlotLinesOff();
-}
-
-/*
- * @brief: set curve type(设置曲线类型)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetCurveType()
-{
-    XYPlot_->PlotPointsOff();
-    XYPlot_->PlotLinesOn();
-}
-
-/*
- * @brief: set point size(设置点大小)
- * @param: size
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetPointSize(double s)
-{
-    XYPlot_->GetProperty()->SetPointSize(s);
-}
-
-/*
- * @brief: set line width(设置线宽)
- * @param: width
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void vtkVISXYPlot::SetLineWidth(double w)
-{
-    XYPlot_->GetProperty()->SetLineWidth(w);
-}

+ 0 - 131
CAE_Solution/src/VTK/visualization_VTK/vtkvisxyplot.h

@@ -1,131 +0,0 @@
-#ifndef VTKVISXYPLOT_H
-#define VTKVISXYPLOT_H
-
-#include <vector>
-
-#include <iostream>
-
-using namespace std;
-
-#include "vtkvismanager.h"
-#include "vtkObjectFactory.h"
-
-#include "vtkXYPlotActor.h"
-#include "vtkProperty2D.h"
-#include "vtkTextProperty.h"
-#include "vtkDataSet.h"
-#include "vtkGlyphSource2D.h"
-#include "vtkSphereSource.h"
-#include "vtkFieldData.h"
-#include "vtkDataObject.h"
-#include "vtkFloatArray.h"
-#include "vtkProperty2D.h"
-#include "vtkLegendBoxActor.h"
-
-#include "vtkConeSource.h"
-#include "vtkCubeSource.h"
-#include "vtkLineSource.h"
-//#include "vtkVISInteractorStyle.h"
-class vtkVISInteractorStyle;
-/// Class that manage xy plot figure rendering
-///
-/// CreateBlankXYPlotActor() first
-/// so we get an vtkXYPlotActor XYPlot_ \n
-/// Then adds data via AddXYPlotDataObject \n
-/// Set the properties afterwards.
-
-class vtkVISXYPlot : public vtkVISManager
-{
-public:
-    static vtkVISXYPlot *New();
-
-    vtkVISXYPlot();
-    ~vtkVISXYPlot();
-    void CreateBlankXYPlotActor();
-
-    void AddXYPlotData(vtkDataSet* data);
-    void RemoveXYPlotData(vtkDataSet *data);
-
-    void AddXYPlotDataObject(int index, vtkDataObject *dataObj);
-    void RemoveXYPlotDataObject(vtkDataObject *dataObj);
-
-    void SetPositionCoordinate(double a, double b);
-    void SetPosition2Coordinate(double a, double b);
-
-    void SetXYPlotTitle(char* title);
-    void SetXYPlotXTitle(char* xTitle);
-    void SetXYPlotYTitle(char* yTitle);
-
-    void SetXYPlotActorColor(double r, double g, double b);
-
-    void SetXLabelsNumber(int num);
-    void SetYLabelsNumber(int num);
-
-    void SetXValuesTo(char* xValue);
-    void SetGlyphTypeTo(int index, char* type);
-
-    void SetXYPlotLable(int index, char* label);
-    void SetXYPlotColor(int index, double r, double g, double b);
-
-    void SetPlotXRange(double min, double max);
-    void SetPlotYRange(double min, double max);
-
-    void ModifyPlotLineWidth(double Value);
-
-    void SetXYPlotLegendPosition(double a, double b);
-    void SetXYPlotLegendPosition2(double a, double b);
-
-    void SetXYPlotTitlePosition(double a, double b);
-
-    void ResetRange();
-    void GetCurrentRange();
-
-    const char* GetXYPlotLable(int index);
-    double* GetXYPlotColor(int index);
-    double GetPlotLineWidth();
-
-    void SetXYPlotGlyphSize(double size);
-    double GetXYPlotGlyphSize();
-
-    void RemoveXYPlotAllInputs();
-
-    void SetXYPlotNumber(int num);
-    int GetXYPlotNumber();
-
-    void RemoveXYPlotActor();
-
-    void  CreateLegendBoxActor();
-
-    void ShowOn();
-    void ShowOff();
-    vtkXYPlotActor* GetXYPlotActor();
-
-    void SetPointType();
-    void SetCurveType();
-    void SetPointSize(double s);
-    void SetLineWidth(double w);
-
-    double XRange_[2];
-    double YRange_[2];
-
-protected:
-
-    vtkXYPlotActor* XYPlot_;
-
-    //vtkFieldData* fieldData_;
-
-    string xValues[4];
-
-    int plotNumber_;
-
-    int GetXValueIndex(char* type);
-
-
-    vtkLegendBoxActor* legend_;
-    vtkVISInteractorStyle* InteractorStyle_;
-
-private:
-
-};
-
-#endif // VTKVISXYPLOT_H

+ 0 - 493
CAE_Solution/src/VTK/visualization_VTK/vtkxyplotvis.cpp

@@ -1,493 +0,0 @@
-#include "vtkxyplotvis.h"
-
-double ColorListXY[20][3]={{0.0,0.5019607843137255,1.0},
-        {0.1333333333333333,0.6941176470588235,0.2980392156862745},
-        {1.0,0.0,0.0},
-        {0.6941176470588235,0.3568627450980392,1.0},
-        {0.1568627450980392,0.1568627450980392,1.0},
-        {0.1333333333333333,0.6941176470588235,0.2980392156862745},
-        {1.0,0.5019607843137255,0.0},
-        {0.5254901960784314,0.0,1.0},
-        {0.8666666666666667,0.0,0.4352941176470588},
-        {1.0, 0.3764705882352941,0.6862745098039216},
-        {0.1568627450980392,0.5803921568627451,1.0},
-        {0.9764705882352941,0.9764705882352941,0.0},
-        {0.0,0.9254901960784314,0.0},
-        {1.0,0.34509803921568627,0.03529411764705882},
-        {0.6039215686274509,1.0,0.00784313725490196},
-        {0.5254901960784314,0.0,1.0},
-        {1.0,0.26666666666666666,1.0},
-        {1.0,1.0,0.21568627450980393},
-        {0.6039215686274509,1.0,0.00784313725490196},
-        {1.0,0.3764705882352941,0.00784313725490196}};
-
-/*
- * @brief: the constructor
- * @param:
- * @ret:
- * @birth: created by czm in 20230410
- */
-XYPlot::XYPlot(): renderer_(0), renderWindow_(0), xyPlot_(0), curveNum_(0), xValues_(0), yValues_(0), curveDataObject_(0)
-{
-
-}
-
-/*
- * @brief: the destructor
- * @param:
- * @ret:
- * @birth: created by czm in 20230410
- */
-XYPlot::~XYPlot()
-{
-    DestroyXYPlot();
-}
-
-/*
- * @brief: set vtk renderer(设置vtk renderer)
- * @param: renderer
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void XYPlot::SetVtkRender(vtkRenderer *renderer)
-{
-    renderer_ = renderer;
-    renderWindow_ = renderer_->GetRenderWindow();
-}
-
-/*
- * @brief: update(刷新)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void XYPlot::Update()
-{
-    if (renderWindow_)  renderWindow_->Render();
-}
-
-/*
- * @brief: allocate xyplot
- * @param: totalCurveNum
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void XYPlot::AllocateXYPlot(int totalCurveNum)
-{
-    curveNum_ = totalCurveNum;
-    xValues_ = vtkDoubleArray::New();
-    yValues_ = new vtkDoubleArray*[curveNum_];
-    curveDataObject_ = new vtkDataObject*[curveNum_];
-    for (int i = 0; i < curveNum_; ++i)
-    {
-        yValues_[i] = vtkDoubleArray::New();
-
-        vtkFieldData *fd = vtkFieldData::New();
-        fd->AllocateArrays(2);
-        fd->AddArray(xValues_);
-        fd->AddArray(yValues_[i]);
-        curveDataObject_[i] = vtkDataObject::New();
-        curveDataObject_[i]->SetFieldData(fd);
-
-        fd->Delete();
-    }
-}
-
-/*
- * @brief: destory xyplot(销毁xy坐标轴)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void XYPlot::DestroyXYPlot()
-{
-    if (xyPlot_ != 0)
-    {
-        xyPlot_->RemoveXYPlotActor();
-        xyPlot_->RemoveXYPlotAllInputs();
-        xyPlot_->Delete();
-        xyPlot_ = 0;
-    }
-    if (xValues_ != 0)
-    {
-        xValues_->Delete();
-        xValues_ = 0;
-    }
-    for (int i = 0; i < curveNum_; ++i)
-    {
-        yValues_[i]->Delete();
-        curveDataObject_[i]->Delete();
-    }
-    delete[] yValues_;
-    yValues_ = 0;
-    delete[] curveDataObject_;
-    curveDataObject_ = 0;
-}
-
-/*
- * @brief: remove xyplot actor(移除xyplot actor)
- * @param: void
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void XYPlot::RemoveXYPlotActor()
-{
-    if (xyPlot_ != 0)
-    {
-        xyPlot_->RemoveXYPlotActor();
-        xyPlot_->RemoveXYPlotAllInputs();
-        xyPlot_->Delete();
-        xyPlot_ = 0;
-    }
-}
-
-/*
- * @brief: create xyplot(创造xyplot)
- * @param: vector
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void XYPlot::CreateXYPlot(vector<bool> &curveShowOnFlagVec)
-{
-    int n = curveShowOnFlagVec.size();
-    if ( n != curveNum_)  return;
-    vector<int> visibleCurveIds;
-    for (int i = 0; i < n; ++i)
-    {
-        if (curveShowOnFlagVec.at(i))
-        {
-            visibleCurveIds.push_back(i);
-        }
-    }
-    int visibleNum = visibleCurveIds.size();
-    xyPlot_ = vtkVISXYPlot::New();
-    xyPlot_->SetRenderTo(renderer_, renderWindow_);
-    xyPlot_->CreateBlankXYPlotActor();
-    xyPlot_->SetPositionCoordinate(0.05, 0.05);
-    xyPlot_->SetPosition2Coordinate(0.8, 0.8);
-    xyPlot_->SetXYPlotTitlePosition(0.5, 0.9);
-    xyPlot_->SetXLabelsNumber(8);
-    xyPlot_->SetYLabelsNumber(6);
-    xyPlot_->SetXYPlotXTitle(const_cast<char*>("Step"));
-    xyPlot_->SetXYPlotYTitle(const_cast<char*>(""));
-    xyPlot_->SetXYPlotActorColor(0.0, 0.0, 0.0);
-    xyPlot_->SetXValuesTo(const_cast<char*>("Value"));
-    xyPlot_->CreateLegendBoxActor();
-    xyPlot_->SetXYPlotLegendPosition(0.88, 0.53-0.03*visibleNum/2);
-    xyPlot_->SetXYPlotLegendPosition2(0.1, 0.04*visibleNum);
-    xyPlot_->SetXYPlotNumber(visibleNum);
-    for (int i = 0; i < visibleNum; ++i)
-    {
-        xyPlot_->AddXYPlotDataObject(i, curveDataObject_[visibleCurveIds.at(i)]);
-        xyPlot_->SetGlyphTypeTo(i, const_cast<char*>(""));
-        xyPlot_->SetXYPlotColor(i, ColorListXY[i%20][0], ColorListXY[i%20][1], ColorListXY[i%20][2]);
-    }
-    xyPlot_->SetPointSize(1.5);
-    xyPlot_->SetLineWidth(1);
-    xyPlot_->SetCurveType();
-}
-
-/*
- * @brief: Add Point X Value
- * @param: step  update x range
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void XYPlot::AddPointXValue(double step, bool updateXRange)
-{
-    xValues_->InsertNextValue(step);
-    //if (updateXRange)
-    {
-        //if (step > 49)
-         xyPlot_->SetPlotXRange(0, step);
-    }
-}
-
-/*
- * @brief: Add Point X Value
- * @param: step  update x range
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void XYPlot::AddPointXValue(double startstep, double step, bool updateXRange)
-{
-    xValues_->InsertNextValue(step);
-    //if (updateXRange)
-    {
-        //if (step > 49)
-         xyPlot_->SetPlotXRange(startstep, step);
-    }
-}
-
-/*
- * @brief: Add Point y Value
- * @param: step  update x range
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void XYPlot::AddPointYValue(int curveId, double value)
-{
-    if (curveId < 0 || curveId >= curveNum_)  return;
-    yValues_[curveId]->InsertNextValue(value);
-    xyPlot_->SetPlotYRange(0,value);
-}
-
-/*
- * @brief: Add Point y Value
- * @param: step  update x range
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void XYPlot::AddPointYValue(double starty,int curveId, double value)
-{
-    if (curveId < 0 || curveId >= curveNum_)  return;
-    yValues_[curveId]->InsertNextValue(value);
-    //qDebug() << "starty594 = " << starty;
-    xyPlot_->SetPlotYRange(starty,value);
-}
-////////////property setting//////////////
-/*
- * @brief: set Point X title
- * @param: title
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void XYPlot::SetXAxisTitle(char *title)
-{
-    if (xyPlot_)  xyPlot_->SetXYPlotXTitle(title);
-}
-
-/*
- * @brief: set y axis title(设置y轴标题)
- * @param: step  update x range
- * @ret: void
- * @birth: created by czm in 20230410
- */
-void XYPlot::SetYAxisTitle(char *title)
-{
-    if (xyPlot_)  xyPlot_->SetXYPlotYTitle(title);
-}
-
-/*
- * @brief: set glyph type(设置字形类型)
- * @param: curveid and type
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlot::SetGlyphType(int curveId, char *title)
-{
-    if (curveId < 0 || curveId >= curveNum_)  return;
-    if (xyPlot_)  xyPlot_->SetGlyphTypeTo(curveId, title);
-}
-
-/*
- * @brief: set color(设置颜色)
- * @param: curveid and rgb
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlot::SetColor(int curveId, double r, double g, double b)
-{
-    if (curveId < 0 || curveId >= curveNum_)  return;
-    if (xyPlot_)  xyPlot_->SetXYPlotColor(curveId, r, g, b);
-}
-
-/*
- * @brief: set plot curve lines(设置图表曲线)
- * @param: flag
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlot::SetPlotCurveLines(bool flag)
-{
-    if (xyPlot_)
-    {
-        vtkXYPlotActor *plotActor = xyPlot_->GetXYPlotActor();
-        if (flag)  plotActor->PlotCurveLinesOn();
-        else  plotActor->PlotCurveLinesOff();
-    }
-}
-
-/*
- * @brief: set plot lines(设置图表线)
- * @param: flag
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlot::SetPlotLines(bool flag)
-{
-    if (xyPlot_)
-    {
-        vtkXYPlotActor *plotActor = xyPlot_->GetXYPlotActor();
-        if (flag)  plotActor->PlotLinesOn();
-        else  plotActor->PlotLinesOff();
-    }
-}
-
-/*
- * @brief: set visiable(设置可见性)
- * @param: bool
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlot::SetVisiable(bool visiable)
-{
-    if (xyPlot_)
-    {
-        if (visiable)  xyPlot_->ShowOn();
-        else  xyPlot_->ShowOff();
-    }
-}
-
-/*
- * @brief: set legend label(设置说明标签)
- * @param: curveid and label
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlot::SetLegendLabel(int curveId, char *lable)
-{
-    if (curveId < 0 || curveId >= curveNum_)  return;
-    if (xyPlot_)  xyPlot_->SetXYPlotLable(curveId, lable);
-}
-
-/*
- * @brief: Set Line Stipple(设置线点画)
- * @param: pattern
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlot::SetLineStipple(int pattern)
-{
-    if (xyPlot_)
-    {
-        vtkXYPlotActor *plotActor = xyPlot_->GetXYPlotActor();
-        plotActor->GetProperty()->SetLineStipplePattern(pattern);
-    }
-}
-/////////////////////////////////////
-/*
- * @brief: get x range(获取x范围)
- * @param: min and max
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlot::GetXRange(double &xmin, double &xmax)
-{
-    if (xValues_)
-    {
-        double range[2];
-        xValues_->GetRange(range);
-        xmin = range[0];
-        xmax = range[1];
-    }
-}
-
-/*
- * @brief: Set curve visiable(设置曲线可视化)
- * @param: vector
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlot::SetCurveVisible(vector<int> &visibleCurveIds)
-{
-    if (xyPlot_)
-    {
-        for (int i = 0; i < curveNum_; ++i)
-        {
-            xyPlot_->RemoveXYPlotDataObject(curveDataObject_[i]);
-        }
-        int n = visibleCurveIds.size();
-        xyPlot_->SetXYPlotNumber(n);
-        for (int i = 0; i < n; ++i)
-        {
-            int curveId = visibleCurveIds[i];
-            xyPlot_->AddXYPlotDataObject(i, curveDataObject_[curveId]);
-            xyPlot_->SetGlyphTypeTo(i, const_cast<char*>("Line"));
-            xyPlot_->SetXYPlotColor(i, ColorListXY[curveId%20][0], ColorListXY[curveId%20][1], ColorListXY[curveId%20][2]);
-        }
-    }
-}
-
-/*
- * @brief: Set x double array(设置xdouble数组)
- * @param: array
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlot::SetXDoubleArray(vtkDoubleArray* array)
-{
-    xValues_->DeepCopy(array);
-}
-
-/*
- * @brief: Set y double array(设置y double数组)
- * @param: array
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlot::SetYDoubleArray(int id, vtkDoubleArray* array)
-{
-    yValues_[id]->DeepCopy(array);
-}
-
-/*
- * @brief: Set x range(设置x 范围)
- * @param: min and max
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlot::SetXRange(double min, double max)
-{
-    xyPlot_->SetPlotXRange(min, max);
-}
-
-/*
- * @brief: Set y range(设置y 范围)
- * @param: min and max
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlot::SetYRange(double min, double max)
-{
-    xyPlot_->SetPlotYRange(min, max);
-}
-
-/*
- * @brief: Set curve type(设置曲线类型)
- * @param: type
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlot::SetCurveType(string type)
-{
-    if (type == "point")
-    {
-        xyPlot_->SetPointType();
-    }else if (type == "curve")
-    {
-        xyPlot_->SetCurveType();
-    }
-}
-
-/*
- * @brief: Set plot point size (设置图表点尺寸)
- * @param: size
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlot::SetPlotPointSize(double s)
-{
-    xyPlot_->SetPointSize(s);
-}
-
-/*
- * @brief: Set plot line size (设置图表线尺寸)
- * @param: size
- * @ret: void
- * @birth: created by czm in 20230411
- */
-void XYPlot::SetPlotLineWidth(double w)
-{
-    xyPlot_->SetLineWidth(w);
-}

+ 0 - 62
CAE_Solution/src/VTK/visualization_VTK/vtkxyplotvis.h

@@ -1,62 +0,0 @@
-#ifndef VTKXYPLOTVIS_H
-#define VTKXYPLOTVIS_H
-
-#include <vector>
-#include <vtkRenderer.h>
-#include <vtkRenderWindow.h>
-#include "vtkvisxyplot.h"
-#include <vtkDoubleArray.h>
-#include <vtkDataObject.h>
-using namespace std;
-
-class XYPlot
-{
-public:
-    XYPlot();
-    ~XYPlot();
-
-    void SetVtkRender(vtkRenderer *renderer);
-    void Update();
-    void AllocateXYPlot(int totalCurveNum);
-    void CreateXYPlot(vector<bool> &curveShowOnFlagVec);
-    void AddPointXValue(double step, bool updateXRange = false);
-    void AddPointYValue(double,int, double);
-    void AddPointYValue(int, double);
-    void DestroyXYPlot();
-    void RemoveXYPlotActor();
-    void GetXRange(double &xmin, double &xmax);
-
-    void SetXDoubleArray(vtkDoubleArray* array);
-    void SetYDoubleArray(int id, vtkDoubleArray* array);
-
-    void SetXRange(double min, double max);
-    void SetYRange(double min, double max);
-    ////////////////xyplot property setting//////////
-    void SetXAxisTitle(char *title);
-    void SetYAxisTitle(char *title);
-    void SetGlyphType(int curveId, char *type);
-    void SetColor(int curveId, double r, double g, double b);
-    void SetPlotLines(bool flag);
-    void SetPlotCurveLines(bool flag);
-    void SetVisiable(bool visiable);
-    void SetLegendLabel(int curveId, char *lable);
-    void SetLineStipple(int pattern);
-    void AddPointXValue(double startstep, double step, bool updateXRange);
-
-    void SetCurveVisible(vector<int> &visibleCurveIds);
-    void SetCurveType(string type);
-    void SetPlotPointSize(double s);
-    void SetPlotLineWidth(double w);
-
-private:
-    vtkRenderer *renderer_;
-    vtkRenderWindow *renderWindow_;
-    vtkVISXYPlot *xyPlot_;
-    int curveNum_;
-
-    vtkDoubleArray *xValues_;
-    vtkDoubleArray **yValues_;
-    vtkDataObject **curveDataObject_;
-};
-
-#endif // VTKXYPLOTVIS_H

+ 9 - 3
CAE_Solution/src/main.cpp

@@ -38,6 +38,7 @@ int main(int argc, char *argv[])
 
     w.resize(QApplication::desktop()->availableGeometry().size());//最大化
     w.move(0,0);
+    //QWidget *w_=new QWidget;
     w.show();
 //初始化状态机
 //    stateMachine* recvstate= new stateMachine("recvClient");
@@ -59,10 +60,11 @@ int main(int argc, char *argv[])
 //    QObject::connect(handle,SIGNAL(sendWidget_handlePoolToWidget(QWidget*)),&w,SLOT(getWidget_handlePoolToWidget(QWidget*)));
     QVTKRenderer* render_ = new QVTKRenderer();
     render_->init();
-    w.addTab(render_->GetWidget(),"test");
-    QString m_filePath="/cephfs/hcfd/solverdown/31f117acb7e74232a3267b091391eab2/hcfd/data_in/hcfd.ugrid";
+
+    QString m_filePath="F:\\czm\\adicode\\CAE_Solution\\CAE_Solution\\tf.ugrid";
     //if(m_filePath.isEmpty())return;
     MeshManager *meshmanager = MeshManager::getInstance();
+
     bool f = meshmanager->LoadData(m_filePath);
     cout<<"f:"<<f<<endl;
     if(f){
@@ -71,6 +73,10 @@ int main(int argc, char *argv[])
             render_->ZoomToExtents();
         }
     }
-    render_->Update();
+    //w.addTab(render_->GetWidget(),"test");
+    //render_->Update();
+    //render_->GetWidget()->show();
+
+     w.addTab(render_->GetWidget(),"test");
     return a.exec();
 }

+ 0 - 1
CAE_Solution/src/src.pro

@@ -50,7 +50,6 @@ COPIES += conf_
 win32:lib_install.files += $$PWD/../Libs/vtk8.2/win/bin/* \
                      $$PWD/../Libs/gmsh/win/lib/gmsh-4.11.dll
 
-
 windows{
     CONFIG(debug,debug|release){
         lib_install.files += $$PWD/../Libs/rabbitmq/win/debug/bin/*

+ 2 - 2
CAE_Solution/src/widget.cpp

@@ -9,8 +9,8 @@ Widget::~Widget(){
 
 }
 
-void Widget::getWidget_handlePoolToWidget(QWidget *widget)
+void Widget::getWidget_handlePoolToWidget(QTabWidget *widget)
 {
     num++;
-    this->addTab(widget,"test"+QString::number(num));
+    //this->addTab(widget,"test"+QString::number(num));
 }

+ 1 - 1
CAE_Solution/src/widget.h

@@ -13,7 +13,7 @@ public:
 
     int num;
 public slots:
-    void getWidget_handlePoolToWidget(QWidget*);
+    void getWidget_handlePoolToWidget(QTabWidget*);
 };
 
 #endif // WIDGET_H