[Paraview-developers] New vtkDataArray implementations, tools

David Lonie david.lonie at kitware.com
Mon Mar 7 13:03:42 EST 2016


Hi folks,

As part of the ongoing effort to support in-situ toolkits such as Catalyst
in VTK, we have made some changes to how vtkDataArrays are implemented and
used in VTK.

In a nutshell, the array-of-structs (AOS) memory layout should no longer be
assumed when using vtkDataArrays, and there are new SOA (struct-of-arrays)
vtkDataArray implementations included in VTK. This means that methods like
GetVoidPointer, WritePointer, etc should no longer be used, and may enter a
deprecation phase at some point in the future. This also means that
vtkTemplateMacro is no longer the preferred way of interacting with array
data efficiently, since it indirectly relies on GetVoidPointer. Existing
code using vtkTemplateMacro will continue to work, though it will be very
inefficient when used with some of the new array subclasses.

As a replacement for vtkTemplateMacro, there are some new tools that are
used to provide efficient, compile-time optimized access to array data.
These tools and their usage are detailed here:

http://www.vtk.org/Wiki/VTK/Tutorials/DataArrays (wiki version)
https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/Doxygen/ArrayDispatch-VTK-7-1.md
(raw doxygen markdown -- will replace wiki page eventually)

The new vtkArrayDispatch tool allows optimized algorithms to be written
that work on both vtkAOSDataArrayTemplate (the AOS replacement for
vtkDataArrayTemplate) and vtkSOADataArrayTemplate (the new SOA data array
backend). The vtkDataArrayAccessor wrapper will then allow the same
implementation to fallback to using the generic vtkDataArray API in cases
where template-explosion may be an issue.

Also note that there is an API change involved with this patch. The typed
vtkDataArrayTemplate API methods:

void GetTupleValue(vtkIdType tupleIdx, ValueType *tuple)
void SetTupleValue(vtkIdType tupleIdx, const ValueType *tuple)
void InsertTupleValue(vtkIdType tupleIdx, const ValueType *tuple)
vtkIdType InsertNextTupleValue(const ValueType *tuple)


have been renamed to more clearly indicate their purpose. They are now
"GetTypedTuple", etc, and there is a new set of corresponding
"GetTypedComponent"-style methods. The old signatures are still available
on vtkAOSDataArrayTemplate subclasses and have been marked deprecated. VTK
and ParaView have both been updated to use the new APIs.

The last iteration of in-situ data array interfaces, namely
vtkTypedDataArray and vtkMappedDataArray, will be deprecated at some point
due to performance concerns, but continue to be available for the time
being.

If you encounter any issues with the new implementations or have questions
about them, please do not hesitate to email the vtk-developers list and let
us know.

Best,
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20160307/bfb6707a/attachment.html>


More information about the Paraview-developers mailing list