[vtkusers] slow vtkCleanPolyData filter

karl at elemtech.com karl at elemtech.com
Mon Aug 11 12:03:31 EDT 2008


I have a vtkPolyData with a couple of thousand quads that are approximately uniform size.   It is a relatively small set.   I apply the vtkPolyData filter with a real tolerance and it seems to take extraordinarily long.   I don't have exact timings at this point but it is on the order 5 to 10 seconds.  I understand that the vtkPointLocator is being used and that it is slower but with this number of points it would be faster to do an O(n^2) compare than the current logic.  

Here is just a code snippet of what I'm doing.  During the 5-10 second hang I can break into the debugger and it is typically doing lookups in the vtkPointLocator.   

    // data possibly contains nearly coincident points.  let's merge them
    // but don't merge smaller than the smallest mesh size.
    vtkSmartPointer<vtkCleanPolyData> cleanData = vtkSmartPointer<vtkCleanPolyData>::New();
    cleanData->SetInput(wellGrid);
    cleanData->SetToleranceIsAbsolute(1);
    cleanData->SetAbsoluteTolerance(minMeshSize*.54);
    cleanData->SetConvertLinesToPoints(1);  // convert degenerate lines to points
    cleanData->Update();

This gives me the desired results but it seems terribly slow.  The tolerance is quite high because I want to merge points that are close but I don't want to merge entire cells. Am I abusing this filter in some way?  Is there a better way to accomplish this kind of operation?

  Thanks,
     Karl



More information about the vtkusers mailing list