[vtkusers] value-based vtkExtractSelection

David E DeMarle dave.demarle at kitware.com
Mon Feb 25 12:04:03 EST 2013


This came up once before.

The values selection extraction code path was optimized for the use case of
extracting relatively long lists of values. Before doing the seek it sorts
the data and the list. The sort is slow, but once done, the seek is fast
and with a long list the cost is amortized and you end up winning overall.
With a small list you don't.

The thresholds code path wasn't optimized, so for small lists it is faster.


David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909


On Mon, Feb 25, 2013 at 11:48 AM, Favre Jean <jfavre at cscs.ch> wrote:

>
> Dear list
>
> I need to extract subsets of an unstructured grid, based on a cell-based
> material id (an integer).
>
> I use the following:
>
> selectionNode->SetFieldType(vtkSelectionNode::CELL);
> selectionNode->SetContentType(vtkSelectionNode::THRESHOLDS);
>
> and a vtkDoubleArray with two tuples, holding the same value as min and
> max, equal to my material id.
>
> this works fine and is quite fast. However, I thought it should be even
> faster, not having to threshold between a min and max values which, in this
> case, are equal, and to instead directly select by the integer value.
>
> So I changed the code to use a vtkIntArray with 1 tuple equal to the
> material id, and changed my selectionNode:
> selectionNode->SetContentType(vtkSelectionNode::VALUES);
>
> this new version produces the correct and identical selection as the first
> version, but the execution times is 20 seconds vs. 0.16 seconds. This is a
> huge difference and I'd like to have some insight about it. Why should
> value-based selection be so much slower? This small test only has 80k
> cells. [My real data has 10+ million cells, :-( ]
>
> I took the example benchmark in
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ExtractSelectionCells,
> and modified it to test, so I can share the updated benchmark.
>
> -----------------
> Jean/CSCS
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130225/582db62f/attachment.htm>


More information about the vtkusers mailing list