VTK  9.4.20241112
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
vtkSparseArray< T > Class Template Reference

Sparse, independent coordinate storage for N-way arrays. More...

#include <vtkSparseArray.h>

Inheritance diagram for vtkSparseArray< T >:
[legend]
Collaboration diagram for vtkSparseArray< T >:
[legend]

Public Types

typedef vtkArray::CoordinateT CoordinateT
 
typedef vtkArray::DimensionT DimensionT
 
typedef vtkArray::SizeT SizeT
 
- Public Types inherited from vtkTypedArray< T >
typedef vtkArray::CoordinateT CoordinateT
 
typedef vtkArray::SizeT SizeT
 
- Public Types inherited from vtkArray
enum  { DENSE = 0 , SPARSE = 1 }
 
typedef vtkObject Superclass
 
typedef vtkArrayExtents::CoordinateT CoordinateT
 
typedef vtkArrayExtents::DimensionT DimensionT
 
typedef vtkArrayExtents::SizeT SizeT
 

Public Member Functions

 vtkTemplateTypeMacro (vtkSparseArray< T >, vtkTypedArray< T >)
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses.
 
bool IsDense () override
 Returns true iff the underlying array storage is "dense", i.e.
 
const vtkArrayExtentsGetExtents () override
 Returns the extents (the number of dimensions and size along each dimension) of the array.
 
SizeT GetNonNullSize () override
 Returns the number of non-null values stored in the array.
 
void GetCoordinatesN (SizeT n, vtkArrayCoordinates &coordinates) override
 Returns the coordinates of the n-th value in the array, where n is in the range [0, GetNonNullSize()).
 
vtkArrayDeepCopy () override
 Returns a new array that is a deep copy of this array.
 
const T & GetValue (CoordinateT i) override
 Returns the value stored in the array at the given coordinates.
 
const T & GetValue (CoordinateT i, CoordinateT j) override
 Returns the value stored in the array at the given coordinates.
 
const T & GetValue (CoordinateT i, CoordinateT j, CoordinateT k) override
 Returns the value stored in the array at the given coordinates.
 
const T & GetValue (const vtkArrayCoordinates &coordinates) override
 Returns the value stored in the array at the given coordinates.
 
const T & GetValueN (SizeT n) override
 Returns the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
 
void SetValue (CoordinateT i, const T &value) override
 Overwrites the value stored in the array at the given coordinates.
 
void SetValue (CoordinateT i, CoordinateT j, const T &value) override
 Overwrites the value stored in the array at the given coordinates.
 
void SetValue (CoordinateT i, CoordinateT j, CoordinateT k, const T &value) override
 Overwrites the value stored in the array at the given coordinates.
 
void SetValue (const vtkArrayCoordinates &coordinates, const T &value) override
 Overwrites the value stored in the array at the given coordinates.
 
void SetValueN (SizeT n, const T &value) override
 Overwrites the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
 
void SetNullValue (const T &value)
 Set the value that will be returned by GetValue() for nullptr areas of the array.
 
const T & GetNullValue ()
 Returns the value that will be returned by GetValue() for nullptr areas of the array.
 
void Clear ()
 Remove all non-null elements from the array, leaving the number of dimensions, the extent of each dimension, and the label for each dimension unchanged.
 
void Sort (const vtkArraySort &sort)
 Sorts array values so that their coordinates appear in some well-defined order.
 
std::vector< CoordinateTGetUniqueCoordinates (DimensionT dimension)
 Returns the set of unique coordinates along the given dimension.
 
const CoordinateTGetCoordinateStorage (DimensionT dimension) const
 Return a read-only reference to the underlying coordinate storage.
 
CoordinateTGetCoordinateStorage (DimensionT dimension)
 Return a mutable reference to the underlying coordinate storage.
 
const T * GetValueStorage () const
 Return a read-only reference to the underlying value storage.
 
T * GetValueStorage ()
 Return a mutable reference to the underlying value storage.
 
void ReserveStorage (SizeT value_count)
 Reserve storage for a specific number of values.
 
void SetExtentsFromContents ()
 Update the array extents to match its contents, so that the extent along each dimension matches the maximum index value along that dimension.
 
void SetExtents (const vtkArrayExtents &extents)
 Specify arbitrary array extents, without altering the contents of the array.
 
bool Validate ()
 Validate the contents of the array, returning false if there are any problems.
 
void AddValue (CoordinateT i, const T &value)
 Adds a new non-null element to the array.
 
void AddValue (CoordinateT i, CoordinateT j, const T &value)
 Adds a new non-null element to the array.
 
void AddValue (CoordinateT i, CoordinateT j, CoordinateT k, const T &value)
 Adds a new non-null element to the array.
 
void AddValue (const vtkArrayCoordinates &coordinates, const T &value)
 Adds a new non-null element to the array.
 
- Public Member Functions inherited from vtkTypedArray< T >
 vtkTemplateTypeMacro (vtkTypedArray< T >, vtkArray)
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses.
 
vtkVariant GetVariantValue (const vtkArrayCoordinates &coordinates) override
 Returns the value stored in the array at the given coordinates.
 
vtkVariant GetVariantValueN (SizeT n) override
 Returns the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
 
void SetVariantValue (const vtkArrayCoordinates &coordinates, const vtkVariant &value) override
 Overwrites the value stored in the array at the given coordinates.
 
void SetVariantValueN (SizeT n, const vtkVariant &value) override
 Overwrites the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
 
void CopyValue (vtkArray *source, const vtkArrayCoordinates &source_coordinates, const vtkArrayCoordinates &target_coordinates) override
 Overwrites a value with a value retrieved from another array.
 
void CopyValue (vtkArray *source, SizeT source_index, const vtkArrayCoordinates &target_coordinates) override
 Overwrites a value with a value retrieved from another array.
 
void CopyValue (vtkArray *source, const vtkArrayCoordinates &source_coordinates, SizeT target_index) override
 Overwrites a value with a value retrieved from another array.
 
virtual const T & GetValueN (SizeT n)=0
 Returns the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
 
virtual void SetValueN (SizeT n, const T &value)=0
 Overwrites the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
 
vtkVariant GetVariantValue (CoordinateT i)
 Returns the value stored in the array at the given coordinates.
 
vtkVariant GetVariantValue (CoordinateT i, CoordinateT j)
 
vtkVariant GetVariantValue (CoordinateT i, CoordinateT j, CoordinateT k)
 
virtual vtkVariant GetVariantValue (const vtkArrayCoordinates &coordinates)=0
 Returns the value stored in the array at the given coordinates.
 
void SetVariantValue (CoordinateT i, const vtkVariant &value)
 Overwrites the value stored in the array at the given coordinates.
 
void SetVariantValue (CoordinateT i, CoordinateT j, const vtkVariant &value)
 
void SetVariantValue (CoordinateT i, CoordinateT j, CoordinateT k, const vtkVariant &value)
 
virtual void SetVariantValue (const vtkArrayCoordinates &coordinates, const vtkVariant &value)=0
 Overwrites the value stored in the array at the given coordinates.
 
- Public Member Functions inherited from vtkArray
virtual vtkTypeBool IsA (const char *type)
 Return 1 if this class is the same type of (or a subclass of) the named class.
 
vtkArrayNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses.
 
virtual bool IsDense ()=0
 Returns true iff the underlying array storage is "dense", i.e.
 
vtkArrayRange GetExtent (DimensionT dimension)
 Returns the extent (valid coordinate range) along the given dimension.
 
virtual const vtkArrayExtentsGetExtents ()=0
 Returns the extents (the number of dimensions and size along each dimension) of the array.
 
DimensionT GetDimensions ()
 Returns the number of dimensions stored in the array.
 
SizeT GetSize ()
 Returns the number of values stored in the array.
 
virtual SizeT GetNonNullSize ()=0
 Returns the number of non-null values stored in the array.
 
void SetName (const vtkStdString &name)
 Sets the array name.
 
vtkStdString GetName ()
 Returns the array name.
 
void SetDimensionLabel (DimensionT i, const vtkStdString &label)
 Sets the label for the i-th array dimension.
 
vtkStdString GetDimensionLabel (DimensionT i)
 Returns the label for the i-th array dimension.
 
virtual void GetCoordinatesN (SizeT n, vtkArrayCoordinates &coordinates)=0
 Returns the coordinates of the n-th value in the array, where n is in the range [0, GetNonNullSize()).
 
virtual vtkVariant GetVariantValueN (SizeT n)=0
 Returns the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
 
virtual void SetVariantValueN (SizeT n, const vtkVariant &value)=0
 Overwrites the n-th value stored in the array, where n is in the range [0, GetNonNullSize()).
 
virtual vtkArrayDeepCopy ()=0
 Returns a new array that is a deep copy of this array.
 
void Resize (CoordinateT i)
 Resizes the array to the given extents (number of dimensions and size of each dimension).
 
void Resize (CoordinateT i, CoordinateT j)
 Resizes the array to the given extents (number of dimensions and size of each dimension).
 
void Resize (CoordinateT i, CoordinateT j, CoordinateT k)
 Resizes the array to the given extents (number of dimensions and size of each dimension).
 
void Resize (const vtkArrayRange &i)
 Resizes the array to the given extents (number of dimensions and size of each dimension).
 
void Resize (const vtkArrayRange &i, const vtkArrayRange &j)
 Resizes the array to the given extents (number of dimensions and size of each dimension).
 
void Resize (const vtkArrayRange &i, const vtkArrayRange &j, const vtkArrayRange &k)
 Resizes the array to the given extents (number of dimensions and size of each dimension).
 
void Resize (const vtkArrayExtents &extents)
 Resizes the array to the given extents (number of dimensions and size of each dimension).
 
vtkVariant GetVariantValue (CoordinateT i)
 Returns the value stored in the array at the given coordinates.
 
vtkVariant GetVariantValue (CoordinateT i, CoordinateT j)
 Returns the value stored in the array at the given coordinates.
 
vtkVariant GetVariantValue (CoordinateT i, CoordinateT j, CoordinateT k)
 Returns the value stored in the array at the given coordinates.
 
void SetVariantValue (CoordinateT i, const vtkVariant &value)
 Overwrites the value stored in the array at the given coordinates.
 
void SetVariantValue (CoordinateT i, CoordinateT j, const vtkVariant &value)
 Overwrites the value stored in the array at the given coordinates.
 
void SetVariantValue (CoordinateT i, CoordinateT j, CoordinateT k, const vtkVariant &value)
 Overwrites the value stored in the array at the given coordinates.
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 Turn debugging output on.
 
virtual void DebugOff ()
 Turn debugging output off.
 
bool GetDebug ()
 Get the value of the debug flag.
 
void SetDebug (bool debugFlag)
 Set the value of the debug flag.
 
virtual void Modified ()
 Update the modification time for this object.
 
virtual vtkMTimeType GetMTime ()
 Return this object's modified time.
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses.
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
vtkTypeBool HasObserver (unsigned long event)
 
vtkTypeBool HasObserver (const char *event)
 
vtkTypeBool InvokeEvent (unsigned long event)
 
vtkTypeBool InvokeEvent (const char *event)
 
std::string GetObjectDescription () const override
 The object description printed in messages and PrintSelf output.
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
vtkCommandGetCommand (unsigned long tag)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
void RemoveObserver (vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
void RemoveObservers (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
void RemoveObservers (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
vtkTypeBool HasObserver (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
vtkTypeBool HasObserver (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object.
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events.
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events.
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Allow user to set the AbortFlagOn() with the return value of the callback method.
 
vtkTypeBool InvokeEvent (unsigned long event, void *callData)
 This method invokes an event and return whether the event was aborted or not.
 
vtkTypeBool InvokeEvent (const char *event, void *callData)
 This method invokes an event and return whether the event was aborted or not.
 
virtual void SetObjectName (const std::string &objectName)
 Set/get the name of this object for reporting purposes.
 
virtual std::string GetObjectName () const
 Set/get the name of this object for reporting purposes.
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string.
 
virtual std::string GetObjectDescription () const
 The object description printed in messages and PrintSelf output.
 
virtual vtkTypeBool IsA (const char *name)
 Return 1 if this class is the same type of (or a subclass of) the named class.
 
virtual vtkIdType GetNumberOfGenerationsFromBase (const char *name)
 Given the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class).
 
virtual void Delete ()
 Delete a VTK object.
 
virtual void FastDelete ()
 Delete a reference to this object.
 
void InitializeObjectBase ()
 
void Print (ostream &os)
 Print an object to an ostream.
 
void Register (vtkObjectBase *o)
 Increase the reference count (mark as used by another object).
 
virtual void UnRegister (vtkObjectBase *o)
 Decrease the reference count (release by another object).
 
int GetReferenceCount ()
 Return the current reference count of this object.
 
void SetReferenceCount (int)
 Sets the reference count.
 
bool GetIsInMemkind () const
 A local state flag that remembers whether this object lives in the normal or extended memory space.
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses.
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses.
 
virtual bool UsesGarbageCollector () const
 Indicate whether the class uses vtkGarbageCollector or not.
 

Static Public Member Functions

static vtkSparseArray< T > * New ()
 
- Static Public Member Functions inherited from vtkArray
static vtkTypeBool IsTypeOf (const char *type)
 
static vtkArraySafeDownCast (vtkObjectBase *o)
 
static vtkArrayCreateArray (int StorageType, int ValueType)
 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.
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
 
static void BreakOnError ()
 This method is called when vtkErrorMacro executes.
 
static void SetGlobalWarningDisplay (vtkTypeBool val)
 This is a global flag that controls whether any debug, warning or error messages are displayed.
 
static void GlobalWarningDisplayOn ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
 
static void GlobalWarningDisplayOff ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
 
static vtkTypeBool GetGlobalWarningDisplay ()
 This is a global flag that controls whether any debug, warning or error messages are displayed.
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 Return 1 if this class type is the same type of (or a subclass of) the named class.
 
static vtkIdType GetNumberOfGenerationsFromBaseType (const char *name)
 Given a the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class).
 
static vtkObjectBaseNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
 
static void SetMemkindDirectory (const char *directoryname)
 The name of a directory, ideally mounted -o dax, to memory map an extended memory space within.
 
static bool GetUsingMemkind ()
 A global state flag that controls whether vtkObjects are constructed in the usual way (the default) or within the extended memory space.
 

Protected Member Functions

 vtkSparseArray ()
 
 ~vtkSparseArray () override
 
- Protected Member Functions inherited from vtkTypedArray< T >
 vtkTypedArray ()=default
 
 ~vtkTypedArray () override=default
 
- Protected Member Functions inherited from vtkArray
virtual vtkObjectBaseNewInstanceInternal () const
 
 vtkArray ()
 
 ~vtkArray () override
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
 ~vtkObject () override
 
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
 These methods allow a command to exclusively grab all events.
 
void InternalReleaseFocus ()
 These methods allow a command to exclusively grab all events.
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void RegisterInternal (vtkObjectBase *, vtkTypeBool check)
 
virtual void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
virtual void ObjectFinalize ()
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Additional Inherited Members

- Static Protected Member Functions inherited from vtkObjectBase
static vtkMallocingFunction GetCurrentMallocFunction ()
 
static vtkReallocingFunction GetCurrentReallocFunction ()
 
static vtkFreeingFunction GetCurrentFreeFunction ()
 
static vtkFreeingFunction GetAlternateFreeFunction ()
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
std::string ObjectName
 
- Protected Attributes inherited from vtkObjectBase
std::atomic< int32_t > ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Detailed Description

template<typename T>
class vtkSparseArray< T >

Sparse, independent coordinate storage for N-way arrays.

vtkSparseArray is a concrete vtkArray implementation that stores values using sparse independent coordinate storage. This means that the array stores the complete set of coordinates and the value for each non-null value in the array. While this approach requires slightly more storage than other sparse storage schemes (such as Compressed-Row or Compressed-Column), it is easier and more efficient to work with when implementing algorithms, and it generalizes well for arbitrary numbers of dimensions.

In addition to the value retrieval and update methods provided by vtkTypedArray, vtkSparseArray provides methods to:

Get and set a special 'null' value that will be returned when retrieving values for undefined coordinates.

Clear the contents of the array so that every set of coordinates is undefined.

Sort the array contents so that value coordinates can be visited in a specific order.

Retrieve pointers to the value- and coordinate-storage memory blocks.

Reserve storage for a specific number of non-null values, for efficiency when the number of non-null values is known in advance.

Recompute the array extents so that they bound the largest set of non-nullptr values along each dimension.

Specify arbitrary array extents.

Add values to the array in amortized-constant time.

Validate that the array does not contain duplicate coordinates.

See also
vtkArray, vtkTypedArray, vtkDenseArray
Thanks:
Developed by Timothy M. Shead (tshea.nosp@m.d@sa.nosp@m.ndia..nosp@m.gov) at Sandia National Laboratories.
Online Examples:

Tests:
vtkSparseArray (Tests)

Definition at line 81 of file vtkSparseArray.h.

Member Typedef Documentation

◆ CoordinateT

template<typename T >
typedef vtkArray::CoordinateT vtkSparseArray< T >::CoordinateT

Definition at line 88 of file vtkSparseArray.h.

◆ DimensionT

template<typename T >
typedef vtkArray::DimensionT vtkSparseArray< T >::DimensionT

Definition at line 89 of file vtkSparseArray.h.

◆ SizeT

template<typename T >
typedef vtkArray::SizeT vtkSparseArray< T >::SizeT

Definition at line 90 of file vtkSparseArray.h.

Constructor & Destructor Documentation

◆ vtkSparseArray()

template<typename T >
vtkSparseArray< T >::vtkSparseArray ( )
protected

◆ ~vtkSparseArray()

template<typename T >
vtkSparseArray< T >::~vtkSparseArray ( )
overrideprotected

Member Function Documentation

◆ vtkTemplateTypeMacro()

template<typename T >
vtkSparseArray< T >::vtkTemplateTypeMacro ( vtkSparseArray< T >  ,
vtkTypedArray< T >   
)

◆ New()

template<typename T >
static vtkSparseArray< T > * vtkSparseArray< T >::New ( )
static

◆ PrintSelf()

template<typename T >
void vtkSparseArray< T >::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
overridevirtual

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

◆ IsDense()

template<typename T >
bool vtkSparseArray< T >::IsDense ( )
overridevirtual

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

Implements vtkArray.

◆ GetExtents()

template<typename T >
const vtkArrayExtents & vtkSparseArray< T >::GetExtents ( )
overridevirtual

Returns the extents (the number of dimensions and size along each dimension) of the array.

Implements vtkArray.

◆ GetNonNullSize()

template<typename T >
SizeT vtkSparseArray< T >::GetNonNullSize ( )
overridevirtual

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.

Implements vtkArray.

◆ GetCoordinatesN()

template<typename T >
void vtkSparseArray< T >::GetCoordinatesN ( SizeT  n,
vtkArrayCoordinates coordinates 
)
overridevirtual

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().

Implements vtkArray.

◆ DeepCopy()

template<typename T >
vtkArray * vtkSparseArray< T >::DeepCopy ( )
overridevirtual

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

Implements vtkArray.

◆ GetValue() [1/4]

template<typename T >
const T & vtkSparseArray< T >::GetValue ( CoordinateT  i)
overridevirtual

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.

Implements vtkTypedArray< T >.

◆ GetValue() [2/4]

template<typename T >
const T & vtkSparseArray< T >::GetValue ( CoordinateT  i,
CoordinateT  j 
)
overridevirtual

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.

Implements vtkTypedArray< T >.

◆ GetValue() [3/4]

template<typename T >
const T & vtkSparseArray< T >::GetValue ( CoordinateT  i,
CoordinateT  j,
CoordinateT  k 
)
overridevirtual

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.

Implements vtkTypedArray< T >.

◆ GetValue() [4/4]

template<typename T >
const T & vtkSparseArray< T >::GetValue ( const vtkArrayCoordinates coordinates)
overridevirtual

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.

Implements vtkTypedArray< T >.

◆ GetValueN()

template<typename T >
const T & vtkSparseArray< T >::GetValueN ( SizeT  n)
overridevirtual

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().

Implements vtkTypedArray< T >.

◆ SetValue() [1/4]

template<typename T >
void vtkSparseArray< T >::SetValue ( CoordinateT  i,
const T &  value 
)
overridevirtual

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.

Implements vtkTypedArray< T >.

◆ SetValue() [2/4]

template<typename T >
void vtkSparseArray< T >::SetValue ( CoordinateT  i,
CoordinateT  j,
const T &  value 
)
overridevirtual

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.

Implements vtkTypedArray< T >.

◆ SetValue() [3/4]

template<typename T >
void vtkSparseArray< T >::SetValue ( CoordinateT  i,
CoordinateT  j,
CoordinateT  k,
const T &  value 
)
overridevirtual

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.

Implements vtkTypedArray< T >.

◆ SetValue() [4/4]

template<typename T >
void vtkSparseArray< T >::SetValue ( const vtkArrayCoordinates coordinates,
const T &  value 
)
overridevirtual

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.

Implements vtkTypedArray< T >.

◆ SetValueN()

template<typename T >
void vtkSparseArray< T >::SetValueN ( SizeT  n,
const T &  value 
)
overridevirtual

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().

Implements vtkTypedArray< T >.

◆ SetNullValue()

template<typename T >
void vtkSparseArray< T >::SetNullValue ( const T &  value)

Set the value that will be returned by GetValue() for nullptr areas of the array.

◆ GetNullValue()

template<typename T >
const T & vtkSparseArray< T >::GetNullValue ( )

Returns the value that will be returned by GetValue() for nullptr areas of the array.

◆ Clear()

template<typename T >
void vtkSparseArray< T >::Clear ( )

Remove all non-null elements from the array, leaving the number of dimensions, the extent of each dimension, and the label for each dimension unchanged.

◆ Sort()

template<typename T >
void vtkSparseArray< T >::Sort ( const vtkArraySort sort)

Sorts array values so that their coordinates appear in some well-defined order.

The supplied vtkArraySort object controls which dimensions are sorted, and in what order, and should contain one-or-more sort dimensions, up to the number of dimensions stored in the array.

◆ GetUniqueCoordinates()

template<typename T >
std::vector< CoordinateT > vtkSparseArray< T >::GetUniqueCoordinates ( DimensionT  dimension)

Returns the set of unique coordinates along the given dimension.

◆ GetCoordinateStorage() [1/2]

template<typename T >
const CoordinateT * vtkSparseArray< T >::GetCoordinateStorage ( DimensionT  dimension) const

Return a read-only reference to the underlying coordinate storage.

Coordinates for each dimension are stored contiguously as a one-dimensional array. The ordering of coordinates within the array depends on the order in which values were added to the array.

◆ GetCoordinateStorage() [2/2]

template<typename T >
CoordinateT * vtkSparseArray< T >::GetCoordinateStorage ( DimensionT  dimension)

Return a mutable reference to the underlying coordinate storage.

Coordinates for each dimension are stored contiguously as a one-dimensional array. The ordering of coordinates within the array depends on the order in which values were added to the array, and any subsequent sorting. Use at your own risk!

◆ GetValueStorage() [1/2]

template<typename T >
const T * vtkSparseArray< T >::GetValueStorage ( ) const

Return a read-only reference to the underlying value storage.

Values are stored contiguously, but in arbitrary order. Use GetCoordinateStorage() if you need to get the corresponding coordinates for a value.

◆ GetValueStorage() [2/2]

template<typename T >
T * vtkSparseArray< T >::GetValueStorage ( )

Return a mutable reference to the underlying value storage.

Values are stored contiguously, but in arbitrary order. Use GetCoordinateStorage() if you need to get the corresponding coordinates for a value. Use at your own risk!

◆ ReserveStorage()

template<typename T >
void vtkSparseArray< T >::ReserveStorage ( SizeT  value_count)

Reserve storage for a specific number of values.

This is useful for reading external data using GetCoordinateStorage() and GetValueStorage(), when the total number of non-nullptr values in the array can be determined in advance. Note that after calling ReserveStorage(), all coordinates and values will be undefined, so you must ensure that every set of coordinates and values is overwritten. It is the caller's responsibility to ensure that duplicate coordinates are not inserted into the array.

◆ SetExtentsFromContents()

template<typename T >
void vtkSparseArray< T >::SetExtentsFromContents ( )

Update the array extents to match its contents, so that the extent along each dimension matches the maximum index value along that dimension.

◆ SetExtents()

template<typename T >
void vtkSparseArray< T >::SetExtents ( const vtkArrayExtents extents)

Specify arbitrary array extents, without altering the contents of the array.

Note that the extents must be as-large-or-larger-than the extents of the actual values stored in the array. The number of dimensions in the supplied extents must match the number of dimensions currently stored in the array.

◆ AddValue() [1/4]

template<typename T >
void vtkSparseArray< T >::AddValue ( CoordinateT  i,
const T &  value 
)
inline

Adds a new non-null element to the array.

Does not test to see if an element with matching coordinates already exists. Useful for providing fast initialization of the array as long as the caller is prepared to guarantee that no duplicate coordinates are ever used.

◆ AddValue() [2/4]

template<typename T >
void vtkSparseArray< T >::AddValue ( CoordinateT  i,
CoordinateT  j,
const T &  value 
)
inline

Adds a new non-null element to the array.

Does not test to see if an element with matching coordinates already exists. Useful for providing fast initialization of the array as long as the caller is prepared to guarantee that no duplicate coordinates are ever used.

◆ AddValue() [3/4]

template<typename T >
void vtkSparseArray< T >::AddValue ( CoordinateT  i,
CoordinateT  j,
CoordinateT  k,
const T &  value 
)
inline

Adds a new non-null element to the array.

Does not test to see if an element with matching coordinates already exists. Useful for providing fast initialization of the array as long as the caller is prepared to guarantee that no duplicate coordinates are ever used.

◆ AddValue() [4/4]

template<typename T >
void vtkSparseArray< T >::AddValue ( const vtkArrayCoordinates coordinates,
const T &  value 
)

Adds a new non-null element to the array.

Does not test to see if an element with matching coordinates already exists. Useful for providing fast initialization of the array as long as the caller is prepared to guarantee that no duplicate coordinates are ever used.

◆ Validate()

template<typename T >
bool vtkSparseArray< T >::Validate ( )

Validate the contents of the array, returning false if there are any problems.

Potential problems include duplicate coordinates, which can be introduced into the array either through AddValue() or direct access to coordinates storage; and coordinates out-of-bounds given the current array extents.

Note that Validate() is a heavyweight O(N log N) operation that is intended for temporary use during debugging.


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