[vtkusers] value-based vtkExtractSelection

Favre Jean jfavre at cscs.ch
Mon Feb 25 11:48:19 EST 2013


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



More information about the vtkusers mailing list