vtkImageData/vtkRectilinearGrid/vtkStructuredGrid: Improve performance using structured Points, Cells, CellTypes#
vtkStructuredPointArray<ValueType> has been implemented to enable fast query of structured points.
vtkStructuredCellArray has been implemented to enable fast query of structured cells. vtkStructuredCellArray and
vtkCellArray have vtkAbstractCellArray as their parent class.
vtkStructuredPointArray<ValueType>, vtkStructuredCellArray, and vtkConstantArray<int> are used to implement
the following three functions in vtkStructuredData.
vtkSmartPointer<vtkPoints> GetPoints(vtkDataArray* xCoords, vtkDataArray* yCoords, vtkDataArray* zCoords, int extent[6], double dirMatrix[9])vtkSmartPointer<vtkStructuredCellArray> GetCellArray(int extent[6], bool usePixelVoxelOrientation)vtkSmartPointer<vtkConstantArray<int>> GetCellTypesArray(int extent[6], bool usePixelVoxelOrientation)
The above functions are used to build the structured Points, Cells, and CellTypes
for vtkImageData/vtkRectilinearGrid,
and to build the structured Cells, and CellTypes for vtkStructuredGrid.
Using these structured classes, the performance of the following functions has been optimized.
GetPointforvtkImageData/vtkRectilinearGridGetCellBoundsforvtkImageData/vtkRectilinearGrid/vtkStructuredGridGetCellSizeforvtkImageData/vtkRectilinearGrid/vtkStructuredGridGetCellTypeforvtkImageData/vtkRectilinearGrid/vtkStructuredGridGetCellPointsforvtkImageData/vtkRectilinearGrid/vtkStructuredGridGetCellforvtkImageData/vtkRectilinearGrid/vtkStructuredGrid
vtkImageData and vtkRectilinearGrid now check for cell visibility when using the GetCell, GetCellSize, and
GetCellType functions. Also they have blanking, and un-blanking capabilities of points and cells. Thanks to these
changes, the implementation of vtkUniformGrid has been greatly simplified.
Since vtkImageData and vtkRectilinearGrid now have structured points, vtkDataSet has a function GetPoints that
returns the structured/explicit points, if present, else it creates an internally copy of the points using GetPoint
and returns that. Thanks to this addition void vtkRectilinearGrid::GetPoints(vtkPoints* points) has been deprecated.
Additionally, vtkImageData/vtkRectilinearGrid/vtkStructuredGrid now also have GetCells and GetCellTypesArray
functions.
To effectively utilize the structured Points. vtkDataArrayRange now has GetTuple and SetTuple functions
that can efficiently query the structured Points when it has been dispatched.
To that end, the following classes/functions have been updated to efficiently query the structured Points, Cells, and CellTypes.
vtkTableBasedClipDataSetvtkStructuredDataPlaneCuttervtkExtractGeometryvtkExtractCellsvtkElevationFiltervtkPoints::GetPointsvtkBoundingBox::ComputeBoundsvtkIOSSModel::StructuredPointsOperator
Moreover, in vtkStructuredDataPlaneCutter when vtkFlyingEdgesPlaneCutter is used, if scalars are not present, then
a constant array is created instead of using vtkElevationFilter for better performance. If ghosts are present,
and InterpolateAttributes is on then vtkFlyingEdgesPlaneCutter is used and the ghosts are removed afterward.
Finally, in vtkContourFilter, when vtkFlyingEdges3D or vtkSynchronizedTemplates3D is used, if ghosts are present.
then ghosts will be removed afterward.