[vtkusers] GetFieldData segfaults
David Doria
daviddoria at gmail.com
Thu Apr 23 13:14:57 EDT 2009
On Thu, Apr 23, 2009 at 12:58 PM, Berk Geveci <berk.geveci at kitware.com>wrote:
> Maybe the polydata pointer is invalid? Or maybe there is some issues
> with using smart pointers. Try this:
>
> vtkFieldData* FieldData = polydata->GetFieldData();
>
> where polydata is not a smart pointer.
>
> -berk
>
Berk,
It still crashed without using the smartpointer.
However, it stops crashing if I comment the following code (immediately
before the FieldData call):
vtkSmartPointer<vtkPolyDataNormals> normalGenerator =
vtkSmartPointer<vtkPolyDataNormals>::New();
normalGenerator->SetInput(polydata);
normalGenerator->SetComputePointNormals(1);
normalGenerator->SetComputeCellNormals(0);
normalGenerator->SetSplitting(0);
normalGenerator->Update();
polydata = normalGenerator->GetOutput();
I tried it in a simplified example and the field data seemed to be intact
after this normal extraction, but in my "real" code the FieldData call is
causing a segmentation fault.
I put this
cerr << "Number of points after normal extraction: " <<
polydata->GetNumberOfPoints() << endl;
after the normalGenerator->GetOutput() and it shows the correct number of
points, so it seems like the polydata pointer is still valid.
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090423/828c323a/attachment.htm>
More information about the vtkusers
mailing list