[vtkusers] String Arrays

Maik maik at cs.uno.edu
Tue Jun 14 20:06:17 EDT 2005


Hi there,

I've noticed a few weeks ago that a vtkStringArray class was added to 
VTK in the CVS repository
and I wanted to know what the plans for this class were. It extends a 
class called vtkAbstractArray and isn't tied into vtkFieldData (at least 
not the last time I checked a 2-3 weeks ago.)

I have also written a class called vtkStringArray that extends the 
vtkCharArray class and uses the component dimensionality to store 
strings. It starts with a base component length (like 16) and every time 
a string is inserted that's longer than the array's number of 
components, the array is reallocated to the smallest power of two 
greater than the inserted string length (for smallest amortized cost) 
and the entire data array is copied back into the newly allocated array.

The downside is that all tuples have the same length, but on the plus 
side, this form of vtkStringArray works with all existing filters, 
except for the interpolating filters, like vtkSplineFilter.
(It may not work with vtkLabeledDataMapper either, but I haven't tried.) 
But my point is that adopting a string array based on vtkCharArray would 
save ya'll a lot of time and I would ask that you consider this approach.

I've put up a link below to my string-related classes. Please let me 
know what you think about this issue and where you are headed with 
respect to strings in VTK?

http://www.cs.uno.edu/~maik/vtk-ref/vtk_strings/

thanks,
Maik



More information about the vtkusers mailing list