[vtkusers] loading string field data
Eszter Fehér
fehereszter at gmail.com
Mon Oct 3 16:43:13 EDT 2016
Dear Users,
I have a problem with string field data loading from ascii vtk files in c++. The file content is loaded to a vtkPolyData object from which I try to get the array of the string field data using the following:
vtkSmartPointer<vtkStringArray> array = vtkStringArray::vtkSafeDownCast(polydata->GetFieldData()->GetAbstractArray("strname",i));
The field data in the vtk file is like:
FIELD FieldData 1
strname 1 4 string
a
b
c
d
The problem is that the size of "array" (array->GetSize()) in the case above is 7 and all the elements 4..7 are empty and cause segfault if I try to read them.
The size of the array depends on the actual number of string values but it is really confusing:
actual size array->GetSize()
1 1
2 3
3 3
4 7
5 7
6 7
7 7
8 15
9 15
What am I doing wrong?
I use vtk7.0.0.
Any help would be much appreciated.
Regards, Eszter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161003/b66b6c3e/attachment.html>
More information about the vtkusers
mailing list