[vtk-developers] Proposal for array classes
David C Thompson
dcthomp at sandia.gov
Thu Sep 13 21:00:55 EDT 2007
Hi all,
I would like to propose adding a vtkInformation pointer to the
vtkAbstractArray class. It need not be allocated at construction, simply
publicly accessible:
class vtkAbstractArray : public vtkObject
{
public:
// ...
vtkSetObjectMacro(Information,vtkInformation);
vtkGetObjectMacro(Information,vtkInformation);
// ...
protected:
vtkInformation* Information;
};
I can think of several uses:
1. storing units associated with values in an array;
2. keeping/suggesting a window (which need not be the same as the data
range -- it might be a superset of the range if data is being streamed
or handled in parallel or a subset if used for feature tracking) used
when rendering scalars as colors;
3. annotating the components of an array (i.e., storing a string naming
each component in addition to the name of the array as a whole -- which
should be of increasing use as VTK is used for information
visualization); and
4. storing summary statistics (mean, variance, ...) of array values.
I know that vtkAbstractArray should be kept as lightweight as possible
since many instances of its subclasses are typically in use at the same
time. However, this should only add 4-8 bytes. For reference, these are
the sizes of vtkAbstractArray and some descendants on my 64-bit machine:
sizeof(vtkAbstractArray): 64 bytes
sizeof(vtkStringArray): 80 bytes
sizeof(vtkDataArray): 352 bytes
sizeof(vtkDoubleArray): 384 bytes
As far as operations go, only one initialization (to zero the pointer)
in the constructor and one branch + function call (to delete the
information object) in the destructor would be required.
Does anyone have any thoughts/objections? Especially someone at Kitware
who has the authority to say yea or nay?
Thanks,
David
More information about the vtk-developers
mailing list