FreeMat
vtkArray

Section: Visualization Toolkit Common Classes

Usage

vtkArray is the root of a hierarchy of arrays that can be used to store data with any number of dimensions. It provides an abstract interface for retrieving and setting array attributes that are independent of the type of values stored in the array - such as the number of dimensions, extents along each dimension, and number of values stored in the array.

To get and set array values, the vtkTypedArray template class derives from vtkArray and provides type-specific methods for retrieval and update.

Two concrete derivatives of vtkTypedArray are provided at the moment: vtkDenseArray and vtkSparseArray, which provide dense and sparse storage for arbitrary-dimension data, respectively. Toolkit users can create their own concrete derivatives that implement alternative storage strategies, such as compressed-sparse-row, etc. You could also create an array that provided read-only access to 'virtual' data, such as an array that returned a Fibonacci sequence, etc.

To create an instance of class vtkArray, simply invoke its constructor as follows

  obj = vtkArray

Methods

The class vtkArray has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, obj is an instance of the vtkArray class.

  • string = obj.GetClassName ()
  • int = obj.IsA (string name)
  • vtkArray = obj.NewInstance ()
  • vtkArray = obj.SafeDownCast (vtkObject o)
  • bool = obj.IsDense () - Returns true iff the underlying array storage is "dense", i.e. that GetSize() and GetNonNullSize() will always return the same value. If not, the array is "sparse".
  • obj.Resize (vtkIdType i) - Resizes the array to the given extents (number of dimensions and size of each dimension). Note that concrete implementations of vtkArray may place constraints on the the extents that they will store, so you cannot assume that GetExtents() will always return the same value passed to Resize().

    The contents of the array are undefined after calling Resize() - you should initialize its contents accordingly. In particular, dimension-labels will be undefined, dense array values will be undefined, and sparse arrays will be empty.

  • obj.Resize (vtkIdType i, vtkIdType j) - Resizes the array to the given extents (number of dimensions and size of each dimension). Note that concrete implementations of vtkArray may place constraints on the the extents that they will store, so you cannot assume that GetExtents() will always return the same value passed to Resize().

    The contents of the array are undefined after calling Resize() - you should initialize its contents accordingly. In particular, dimension-labels will be undefined, dense array values will be undefined, and sparse arrays will be empty.

  • obj.Resize (vtkIdType i, vtkIdType j, vtkIdType k) - Resizes the array to the given extents (number of dimensions and size of each dimension). Note that concrete implementations of vtkArray may place constraints on the the extents that they will store, so you cannot assume that GetExtents() will always return the same value passed to Resize().

    The contents of the array are undefined after calling Resize() - you should initialize its contents accordingly. In particular, dimension-labels will be undefined, dense array values will be undefined, and sparse arrays will be empty.

  • vtkIdType = obj.GetDimensions () - Returns the number of dimensions stored in the array. Note that this is the same as calling GetExtents().GetDimensions().
  • vtkIdType = obj.GetSize () - Returns the number of values stored in the array. Note that this is the same as calling GetExtents().GetSize(), and represents the maximum number of values that could ever be stored using the current extents. This is equal to the number of values stored in a dense array, but may be larger than the number of values stored in a sparse array.
  • vtkIdType = obj.GetNonNullSize () - Returns the number of non-null values stored in the array. Note that this value will equal GetSize() for dense arrays, and will be less-than-or-equal to GetSize() for sparse arrays.
  • obj.SetName (vtkStdString &name) - Sets the array name.
  • vtkStdString = obj.GetName () - Returns the array name.
  • obj.SetDimensionLabel (vtkIdType i, vtkStdString &label) - Sets the label for the i-th array dimension.
  • vtkStdString = obj.GetDimensionLabel (vtkIdType i) - Returns the label for the i-th array dimension.
  • vtkArray = obj.DeepCopy () - Returns a new array that is a deep copy of this array.