From: Afeef Date: Tue, 30 Mar 2021 12:08:25 +0000 (+0200) Subject: Primary commit for improving smesh GUI display() speed for viewing mesh X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6011af60d140d08d92c04d5f27137225904e1792;p=modules%2Fgui.git Primary commit for improving smesh GUI display() speed for viewing mesh 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 --- diff --git a/src/VTKViewer/VTKViewer_GeometryFilter.cxx b/src/VTKViewer/VTKViewer_GeometryFilter.cxx index a4ce3be23..f2c3292d4 100644 --- a/src/VTKViewer/VTKViewer_GeometryFilter.cxx +++ b/src/VTKViewer/VTKViewer_GeometryFilter.cxx @@ -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 diff --git a/src/VTKViewer/VTKViewer_GeometryFilter.h b/src/VTKViewer/VTKViewer_GeometryFilter.h index 9a641896f..8c1d44188 100644 --- a/src/VTKViewer/VTKViewer_GeometryFilter.h +++ b/src/VTKViewer/VTKViewer_GeometryFilter.h @@ -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;