[vtkusers] Correct way to save the output of vtkProbeFilter
Siming Bayer
siming.bayer at gmail.com
Wed Sep 27 12:36:55 EDT 2017
Dear all,
Could somebody please provide a correct way to save the output of vtkProbeFilter?
I used the following code to save it as vtkStructuredGrid (probe ist a vtkProbeFilter)
vtkSmartPointer<vtkProbeFilter> probe = vtkSmartPointer<vtkProbeFilter>::New();
…...
//save the output of probefileter as .vtu file
vtkSmartPointer<vtkStructuredGrid> sgrid = vtkSmartPointer<vtkStructuredGrid>::New();
sgrid->SetDimensions(256, 256, 256);
sgrid->SetPoints(probePoints);
unsigned int numberOfArrays = probe->GetOutput()->GetPointData()->GetNumberOfArrays();
std::cout << "Copying arrays:" << std::endl;
for (unsigned int i = 0; i < numberOfArrays; i++)
{
std::cout << "\t" << probe->GetOutput()->GetPointData()->GetArray(i)->GetName() << std::endl;
sgrid->GetPointData()->AddArray(probe->GetOutput()->GetPointData()->GetArray(i));
}
std::cout << "Writing .vts output" << std::endl;
vtkSmartPointer<vtkXMLStructuredGridWriter> sWriter = vtkSmartPointer<vtkXMLStructuredGridWriter>::New();
sWriter->SetFileName("test.vts");
sWriter->SetInputData(sgrid);
sWriter->Write();
But I got errors when I try to load the .vts file in paraview:
ERROR: In C:\bbd\7cc78367\build\superbuild\paraview\src\VTK\IO\XML\vtkXMLStructuredDataReader.cxx, line 360
vtkXMLStructuredGridReader (000000000BA5C060): Error reading extent 0 255 0 255 0 255 from piece 0
ERROR: In C:\bbd\7cc78367\build\superbuild\paraview\src\VTK\IO\XML\vtkXMLDataReader.cxx, line 443
vtkXMLStructuredGridReader (000000000BA5C060): Cannot read point data array "position" from PointData in piece 0. The data array in the element may be too short.
What do I do wrong?
Thanks!
best,
Siming
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170927/63c4f160/attachment.html>
More information about the vtkusers
mailing list