]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Primary commit for improving smesh GUI display() speed for viewing mesh
authorAfeef <afeef.badri@gmail.com>
Tue, 30 Mar 2021 12:08:25 +0000 (14:08 +0200)
committerAfeef <afeef.badri@gmail.com>
Tue, 30 Mar 2021 12:08:25 +0000 (14:08 +0200)
Primarily, VTKViewer_GeometryFilter
is delegated  to  vtkGeometryFilter
used by ParaView.

At this point  typical  performance improvements are 5-10x over
the mesh display, this  dependes if  multithreaded  version  of
ParaView (consequently VTK) is used or not

src/VTKViewer/VTKViewer_GeometryFilter.cxx
src/VTKViewer/VTKViewer_GeometryFilter.h

index a4ce3be23c0d5b1610d4e8dea2cb11144fbc2001..f2c3292d40c7bcd3daa3b6f4472c34fb216be9b9 100644 (file)
@@ -151,29 +151,38 @@ VTKViewer_GeometryFilter
   vtkInformationVector **inputVector,
   vtkInformationVector *outputVector)
 {
-  // get the info objects
-  vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
-  vtkInformation *outInfo = outputVector->GetInformationObject(0);
 
-  // get the input and ouptut
-  vtkDataSet *input = vtkDataSet::SafeDownCast(
-    inInfo->Get(vtkDataObject::DATA_OBJECT()));
-  vtkPolyData *output = vtkPolyData::SafeDownCast(
-    outInfo->Get(vtkDataObject::DATA_OBJECT()));
-
-  vtkIdType numCells=input->GetNumberOfCells();
-
-  if (numCells == 0)
+  if (delegateToVtk)
     {
-      return 0;
+      int serror = vtkGeometryFilter::RequestData(request, inputVector , outputVector);
+      return serror;
     }
+  else
+    {
+     // get the info objects
+     vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
+     vtkInformation *outInfo = outputVector->GetInformationObject(0);
 
-  if (input->GetDataObjectType() == VTK_UNSTRUCTURED_GRID){
-    return this->UnstructuredGridExecute(input, output, outInfo);
-  }else
-    return Superclass::RequestData(request,inputVector,outputVector);
+     // get the input and ouptut
+     vtkDataSet *input = vtkDataSet::SafeDownCast(
+     inInfo->Get(vtkDataObject::DATA_OBJECT()));
+     vtkPolyData *output = vtkPolyData::SafeDownCast(
+     outInfo->Get(vtkDataObject::DATA_OBJECT()));
 
-  return 1;
+     vtkIdType numCells=input->GetNumberOfCells();
+
+     if (numCells == 0)
+       {
+        return 0;
+       }
+
+     if (input->GetDataObjectType() == VTK_UNSTRUCTURED_GRID){
+       return this->UnstructuredGridExecute(input, output, outInfo);
+     }else
+       return Superclass::RequestData(request,inputVector,outputVector);
+
+     return 1;
+    }
 }
 
 int
@@ -182,6 +191,15 @@ VTKViewer_GeometryFilter
                           vtkPolyData *output,
                           vtkInformation */*outInfo*/)
 {
+
+  if (delegateToVtk)
+    {
+      FastMode = true;
+      Merging = true;
+      int serror = vtkGeometryFilter::UnstructuredGridExecute( dataSetInput, output);
+      return serror;
+    }
+  else{
   vtkUnstructuredGrid *input= (vtkUnstructuredGrid *)dataSetInput;
   vtkCellArray *Connectivity = input->GetCells();
   // Check input
@@ -1223,6 +1241,7 @@ VTKViewer_GeometryFilter
   }
 
   return 1;
+  }
 }
 
 void
index 9a641896f382353d592089a8f20b43940d8927e0..8c1d44188e372740d0da7b0714d1ff126bdd6c46 100644 (file)
@@ -140,6 +140,9 @@ protected:
                          vtkPolyData *output,
                          TMapOfVectorId& theDimension2VTK2ObjIds,
                          bool triangulate = false);
+
+  // Delegate VTKViewer_GeometryFilter::UnstructuredGridExecute to vtkGeometryFilter::UnstructuredGridExecute
+  bool delegateToVtk = true;
     
 private:
   TVectorId myVTK2ObjIds;