It already has occurred to me a few times that, while developing a filter for VTK, I would need to iterate on points in a generic vtkDataSet. This can currently be done by calling void vtkDataSet::GetPoint(vtkIdType, double[3]), which copies into the passed buffer the point coordinates. If the data structure is a vtkPointSet or inherits from it, those point coordinates are taken from an explicit list of points. If it is something else (vtkImageData for instance), points being likely implicit, the point associated to the point id is computed on the fly.
Since a few months, AcceleratorsVTKm, which was a heavy module to compile, is split into 3 modules: Core, DataModel, and Filters. Core holds vtkmDataArray, DataModel holds vtkmDataSet, and Filters holds filters (which is the part that is expensive to compile).
What I’m interested in, in this module, is vtkmDataArray, which is a data structure inheriting from vtkDataArray that allows to define implicit arrays. Data set types such as vtkImageData or vtkRectilinearGrid could benefit from that and store their implicit point arrays through a vtkmDataArray, at near zero cost memory-wise.
This would allow us to expose a read-only data array storing points in vtkDataSet, which could have the following signature:
vtkDataArray* GetPointsDataArray() const
The nice thing about having access to such a buffer (explicit or implicit), is that, from that point, algorithms needing to iterate over points could use the nice range interface and alleviate a lot of tiny 3-vector copies that would happen within the vtkDataSet::GetPoint method.
There would be a need to overload this method in vtkImageData, vtkRectilinearGrid, and vtkPointSet.
Please feel free to give an opinion on that proposal.
Right now we are (fortunately) slammed - there’s nothing like a paying customer to help set priorities