[Paraview-developers] Re: [vtk-developers] A PT mapper for VTK

Moreland, Kenneth kmorel at sandia.gov
Tue Dec 21 14:59:10 EST 2004


> 1) The sorting classes sound like they do something similar 
> to the existing polydata cell sorting class that already 
> exists. vtkDepthSort or something like that. How do these 
> classes relate to that class?

I assume you mean vtkDepthSortPolyData.  Yes, I originally looked into
using that, but quickly ruled it out.    vtkVisiblitySort and its
subclasses need to resort on a per-frame basis.  vtkDepthSortPolyData,
which of course is a filter, needs to build a new vtkDataSet and copy a
bunch of attributes every time.  vtkVisibilitySort, in contrast, just
returns a list of sorted cell ids, thereby minimizing the memory
shuffling.

> Can they be combined?

Yes.  vtkDepthSortPolyData can use a vtkVisibilitySort to get a sorted
list of cell ids, then build its output based on that.

> 2) vtkSort is a very generic name. If it is designed to sort 
> data arrays then can we call it vtkSortDataArray ? If it is 
> more generic then I would look at it from the other point of 
> view, what does it not sort?

vtkSort specifically sorts only vtkDataArray and vtkIdArray.  I have no
problem changing the name to vtkSortDataArray or the like.

> Does it encapsulate a single 
> sorting algorithm or many? E.g. is this a quicksort sorter?

vtkSort provides two ways to sort.  The first simply sorts the entries
in a vtkDataArray (or vtkIdList).  The implementation is to simple call
vtkstd::sort.

The second sorting takes an array of keys and an array of values.  The
array of keys is sorted and the array of values.  The keys are sorted
and the values are re-ordered to correspond the sorted keys.  This
sorting is implemented with quicksort.

Obviously, it is the key/value sorting that really provides any value
added.  If anyone knows of a quick and efficient way to do this with,
say, STL, then I have no problem getting rid of vtkSort altogether.

-Ken




More information about the vtk-developers mailing list