vtkArray Class Reference

#include <vtkArray.h>

Inheritance diagram for vtkArray:

Inheritance graph
[legend]
Collaboration diagram for vtkArray:

Collaboration graph
[legend]

List of all members.


Detailed Description

Abstract interface for N-dimensional arrays.

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.

See also:
vtkTypedArray, vtkDenseArray, vtkSparseArray
Thanks:
Developed by Timothy M. Shead (tshead@sandia.gov) at Sandia National Laboratories.
Tests:
vtkArray (Tests)

Definition at line 61 of file vtkArray.h.


Public Types

enum  { DENSE = 0, SPARSE = 1 }
typedef vtkObject Superclass

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
void PrintSelf (ostream &os, vtkIndent indent)
virtual bool IsDense ()=0
void Resize (const vtkArrayRange &i)
void Resize (const vtkArrayRange &i, const vtkArrayRange &j)
void Resize (const vtkArrayRange &i, const vtkArrayRange &j, const vtkArrayRange &k)
void Resize (const vtkArrayExtents &extents)
vtkIdType GetDimensions ()
vtkIdType GetSize ()
virtual vtkIdType GetNonNullSize ()=0
void SetDimensionLabel (vtkIdType i, const vtkStdString &label)
vtkStdString GetDimensionLabel (vtkIdType i)
virtual void GetCoordinatesN (const vtkIdType n, vtkArrayCoordinates &coordinates)=0
virtual vtkVariant GetVariantValueN (const vtkIdType n)=0
virtual void SetVariantValueN (const vtkIdType n, const vtkVariant &value)=0
virtual vtkArrayDeepCopy ()=0
void Resize (const vtkIdType i)
void Resize (const vtkIdType i, const vtkIdType j)
void Resize (const vtkIdType i, const vtkIdType j, const vtkIdType k)
const vtkArrayRange GetExtent (vtkIdType dimension)
virtual const vtkArrayExtentsGetExtents ()=0
void SetName (const vtkStdString &name)
vtkStdString GetName ()
vtkVariant GetVariantValue (vtkIdType i)
vtkVariant GetVariantValue (vtkIdType i, vtkIdType j)
vtkVariant GetVariantValue (vtkIdType i, vtkIdType j, vtkIdType k)
virtual vtkVariant GetVariantValue (const vtkArrayCoordinates &coordinates)=0
void SetVariantValue (vtkIdType i, const vtkVariant &value)
void SetVariantValue (vtkIdType i, vtkIdType j, const vtkVariant &value)
void SetVariantValue (vtkIdType i, vtkIdType j, vtkIdType k, const vtkVariant &value)
virtual void SetVariantValue (const vtkArrayCoordinates &coordinates, const vtkVariant &value)=0
virtual void CopyValue (vtkArray *source, const vtkArrayCoordinates &source_coordinates, const vtkArrayCoordinates &target_coordinates)=0
virtual void CopyValue (vtkArray *source, const vtkIdType source_index, const vtkArrayCoordinates &target_coordinates)=0
virtual void CopyValue (vtkArray *source, const vtkArrayCoordinates &source_coordinates, const vtkIdType target_index)=0

Static Public Member Functions

static int IsTypeOf (const char *type)
static vtkArraySafeDownCast (vtkObject *o)
static vtkArrayCreateArray (int StorageType, int ValueType)

Protected Member Functions

 vtkArray ()
 ~vtkArray ()

Member Typedef Documentation


Member Enumeration Documentation

anonymous enum

Enumerator:
DENSE  Used with CreateArray() to create dense arrays.
SPARSE  Used with CreateArray() to create sparse arrays.

Definition at line 68 of file vtkArray.h.


Constructor & Destructor Documentation

vtkArray::vtkArray (  )  [protected]

vtkArray::~vtkArray (  )  [protected]


Member Function Documentation

virtual const char* vtkArray::GetClassName (  )  [virtual]

Reimplemented from vtkObject.

static int vtkArray::IsTypeOf ( const char *  name  )  [static]

Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkObject.

Reimplemented in vtkTypeTemplate< vtkSparseArray< T >, vtkTypedArray< T > >, vtkTypeTemplate< vtkTypedArray< T >, vtkArray >, and vtkTypeTemplate< vtkDenseArray< T >, vtkTypedArray< T > >.

virtual int vtkArray::IsA ( const char *  name  )  [virtual]

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkObject.

Reimplemented in vtkTypeTemplate< vtkSparseArray< T >, vtkTypedArray< T > >, vtkTypeTemplate< vtkTypedArray< T >, vtkArray >, and vtkTypeTemplate< vtkDenseArray< T >, vtkTypedArray< T > >.

static vtkArray* vtkArray::SafeDownCast ( vtkObject o  )  [static]

Reimplemented from vtkObject.

void vtkArray::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [virtual]

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkObject.

Reimplemented in vtkDenseArray< T >, vtkSparseArray< T >, and vtkTypedArray< T >.

static vtkArray* vtkArray::CreateArray ( int  StorageType,
int  ValueType 
) [static]

Creates a new array where StorageType is one of vtkArray::DENSE or vtkArray::SPARSE, and ValueType is one of VTK_CHAR, VTK_UNSIGNED_CHAR, VTK_SHORT, VTK_UNSIGNED_SHORT, VTK_INT, VTK_UNSIGNED_INT, VTK_LONG, VTK_UNSIGNED_LONG, VTK_DOUBLE, VTK_ID_TYPE, or VTK_STRING. The caller is responsible for the lifetime of the returned object.

virtual bool vtkArray::IsDense (  )  [pure virtual]

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".

Implemented in vtkDenseArray< T >, and vtkSparseArray< T >.

void vtkArray::Resize ( const 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.

void vtkArray::Resize ( const vtkIdType  i,
const 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.

void vtkArray::Resize ( const vtkIdType  i,
const vtkIdType  j,
const 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.

void vtkArray::Resize ( const vtkArrayRange i  ) 

void vtkArray::Resize ( const vtkArrayRange i,
const vtkArrayRange j 
)

void vtkArray::Resize ( const vtkArrayRange i,
const vtkArrayRange j,
const vtkArrayRange k 
)

void vtkArray::Resize ( const vtkArrayExtents extents  ) 

const vtkArrayRange vtkArray::GetExtent ( vtkIdType  dimension  ) 

Returns the extent (valid coordinate range) along the given dimension.

virtual const vtkArrayExtents& vtkArray::GetExtents (  )  [pure virtual]

Returns the extent (valid coordinate range) along the given dimension.

Implemented in vtkDenseArray< T >, and vtkSparseArray< T >.

vtkIdType vtkArray::GetDimensions (  ) 

Returns the number of dimensions stored in the array. Note that this is the same as calling GetExtents().GetDimensions().

vtkIdType vtkArray::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.

virtual vtkIdType vtkArray::GetNonNullSize (  )  [pure virtual]

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.

Implemented in vtkDenseArray< T >, and vtkSparseArray< T >.

void vtkArray::SetName ( const vtkStdString name  ) 

Sets the array name.

vtkStdString vtkArray::GetName (  ) 

Sets the array name.

void vtkArray::SetDimensionLabel ( vtkIdType  i,
const vtkStdString label 
)

Sets the label for the i-th array dimension.

vtkStdString vtkArray::GetDimensionLabel ( vtkIdType  i  ) 

Returns the label for the i-th array dimension.

virtual void vtkArray::GetCoordinatesN ( const vtkIdType  n,
vtkArrayCoordinates coordinates 
) [pure virtual]

Returns the coordinates of the n-th value in the array, where n is in the range [0, GetNonNullSize()). Note that the order in which coordinates are visited is undefined, but is guaranteed to match the order in which values are visited using vtkTypedArray::GetValueN() and vtkTypedArray::SetValueN().

Implemented in vtkDenseArray< T >, and vtkSparseArray< T >.

vtkVariant vtkArray::GetVariantValue ( vtkIdType  i  )  [inline]

Returns the value stored in the array at the given coordinates. Note that the number of dimensions in the supplied coordinates must match the number of dimensions in the array.

Definition at line 228 of file vtkArray.h.

vtkVariant vtkArray::GetVariantValue ( vtkIdType  i,
vtkIdType  j 
) [inline]

Returns the value stored in the array at the given coordinates. Note that the number of dimensions in the supplied coordinates must match the number of dimensions in the array.

Definition at line 233 of file vtkArray.h.

vtkVariant vtkArray::GetVariantValue ( vtkIdType  i,
vtkIdType  j,
vtkIdType  k 
) [inline]

Returns the value stored in the array at the given coordinates. Note that the number of dimensions in the supplied coordinates must match the number of dimensions in the array.

Definition at line 238 of file vtkArray.h.

virtual vtkVariant vtkArray::GetVariantValue ( const vtkArrayCoordinates coordinates  )  [pure virtual]

Returns the value stored in the array at the given coordinates. Note that the number of dimensions in the supplied coordinates must match the number of dimensions in the array.

Implemented in vtkTypedArray< T >.

virtual vtkVariant vtkArray::GetVariantValueN ( const vtkIdType  n  )  [pure virtual]

Returns the n-th value stored in the array, where n is in the range [0, GetNonNullSize()). This is useful for efficiently visiting every value in the array. Note that the order in which values are visited is undefined, but is guaranteed to match the order used by vtkArray::GetCoordinatesN().

Implemented in vtkTypedArray< T >.

void vtkArray::SetVariantValue ( vtkIdType  i,
const vtkVariant value 
) [inline]

Overwrites the value stored in the array at the given coordinates. Note that the number of dimensions in the supplied coordinates must match the number of dimensions in the array.

Definition at line 243 of file vtkArray.h.

void vtkArray::SetVariantValue ( vtkIdType  i,
vtkIdType  j,
const vtkVariant value 
) [inline]

Overwrites the value stored in the array at the given coordinates. Note that the number of dimensions in the supplied coordinates must match the number of dimensions in the array.

Definition at line 248 of file vtkArray.h.

void vtkArray::SetVariantValue ( vtkIdType  i,
vtkIdType  j,
vtkIdType  k,
const vtkVariant value 
) [inline]

Overwrites the value stored in the array at the given coordinates. Note that the number of dimensions in the supplied coordinates must match the number of dimensions in the array.

Definition at line 253 of file vtkArray.h.

virtual void vtkArray::SetVariantValue ( const vtkArrayCoordinates coordinates,
const vtkVariant value 
) [pure virtual]

Overwrites the value stored in the array at the given coordinates. Note that the number of dimensions in the supplied coordinates must match the number of dimensions in the array.

Implemented in vtkTypedArray< T >.

virtual void vtkArray::SetVariantValueN ( const vtkIdType  n,
const vtkVariant value 
) [pure virtual]

Overwrites the n-th value stored in the array, where n is in the range [0, GetNonNullSize()). This is useful for efficiently visiting every value in the array. Note that the order in which values are visited is undefined, but is guaranteed to match the order used by vtkArray::GetCoordinatesN().

Implemented in vtkTypedArray< T >.

virtual void vtkArray::CopyValue ( vtkArray source,
const vtkArrayCoordinates source_coordinates,
const vtkArrayCoordinates target_coordinates 
) [pure virtual]

Overwrites a value with a value retrieved from another array. Both arrays must store the same data types.

Implemented in vtkTypedArray< T >.

virtual void vtkArray::CopyValue ( vtkArray source,
const vtkIdType  source_index,
const vtkArrayCoordinates target_coordinates 
) [pure virtual]

Overwrites a value with a value retrieved from another array. Both arrays must store the same data types.

Implemented in vtkTypedArray< T >.

virtual void vtkArray::CopyValue ( vtkArray source,
const vtkArrayCoordinates source_coordinates,
const vtkIdType  target_index 
) [pure virtual]

Overwrites a value with a value retrieved from another array. Both arrays must store the same data types.

Implemented in vtkTypedArray< T >.

virtual vtkArray* vtkArray::DeepCopy (  )  [pure virtual]

Returns a new array that is a deep copy of this array.

Implemented in vtkDenseArray< T >, and vtkSparseArray< T >.


The documentation for this class was generated from the following file:

Generated on Mon Sep 27 18:18:00 2010 for VTK by  doxygen 1.5.6