[vtk-developers] vtkSortDataArray (Will Schroeder)

Andrew Maclean andrew.amaclean at gmail.com
Mon Jan 4 15:25:57 EST 2016


+1
This is going to be so useful.

It's great to see the older code being modernised.

Andrew


On Tue, Jan 5, 2016 at 7:12 AM, <vtk-developers-request at vtk.org> wrote:

> ---------- Forwarded message ----------
> From: Will Schroeder <will.schroeder at kitware.com>
> To: vtk-developers <vtk-developers at vtk.org>
> Cc:
> Date: Mon, 4 Jan 2016 12:57:39 -0500
> Subject: [vtk-developers] vtkSortDataArray
> A quick note on a potentially powerful but likely overlooked capability
> relative to sorting data in VTK. This is available from a recent merge.
>
> vtkSortDataArray has been revamped, a lot of what you'd expect: removed a
> static variable so it's thread-safe, significant code cleanup; new tests;
> uses std::sort instead of older C-based homegrown stuff; uses
> vtkSMPTools::Sort(),  so when the build is configured appropriately you'll
> see faster performance, etc.
>
> The interesting bit is that sorting has been broken out into separate
> steps. An initial sort creates a permutation / sort index of vtkIdType that
> indicates where the data ends up (after the sort). This sorting index can
> then be used to shuffle any associated data around, or the sort index can
> be queried to perform additional analysis on the data.
>
> Practically this means you can use any component of a tuple in a data
> array to generate a sort index. So for example, if you want to find the top
> N points with lowest/greatest scalar value; or the cells with largest
> z-velocity component; etc. it is quite easy to do. Look at
> Common/Core/Testing/Cxx/TestSortDataArray.cxx. I also thought about
> creating an extraction filter to sort, extract, and/or reorder cells/points
> based on data value; this is down on my todo list....
>
> There is also a new, related class vtkSortFieldData that enables you to
> simultaneously sort all the arrays contained in subclasses of vtkFieldData
> (e.g., vtkPointData and vtkCellData).
>
> Have fun and as always let me know if there are issues, concerns, or
> improvements to be made.
>
> Best,
> W
>
>
>
-- 
___________________________________________
Andrew J. P. Maclean

___________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20160105/2c41e4e3/attachment-0001.html>


More information about the vtk-developers mailing list