VTK  9.1.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
vtkSOADataArrayTemplate< ValueTypeT > Class Template Reference

Struct-Of-Arrays implementation of vtkGenericDataArray. More...

#include <vtkSOADataArrayTemplate.h>

Collaboration diagram for vtkSOADataArrayTemplate< ValueTypeT >:
[legend]

Public Types

enum  DeleteMethod { VTK_DATA_ARRAY_FREE = vtkAbstractArray::VTK_DATA_ARRAY_FREE, VTK_DATA_ARRAY_DELETE = vtkAbstractArray::VTK_DATA_ARRAY_DELETE, VTK_DATA_ARRAY_ALIGNED_FREE = vtkAbstractArray::VTK_DATA_ARRAY_ALIGNED_FREE, VTK_DATA_ARRAY_USER_DEFINED = vtkAbstractArray::VTK_DATA_ARRAY_USER_DEFINED }
 
typedef vtkSOADataArrayTemplate< ValueTypeT > SelfType
 
typedef Superclass::ValueType ValueType
 

Public Member Functions

 vtkTemplateTypeMacro (SelfType, GenericDataArrayType)
 
void GetTypedTuple (vtkIdType tupleIdx, ValueType *tuple) const
 Copy the tuple at tupleIdx into tuple. More...
 
void SetTypedTuple (vtkIdType tupleIdx, const ValueType *tuple)
 Set this array's tuple at tupleIdx to the values in tuple. More...
 
ValueType GetTypedComponent (vtkIdType tupleIdx, int comp) const
 Get component comp of the tuple at tupleIdx. More...
 
void SetTypedComponent (vtkIdType tupleIdx, int comp, ValueType value)
 Set component comp of the tuple at tupleIdx to value. More...
 
void FillTypedComponent (int compIdx, ValueType value) override
 Set component comp of all tuples to value. More...
 
void SetArray (int comp, ValueType *array, vtkIdType size, bool updateMaxId=false, bool save=false, int deleteMethod=VTK_DATA_ARRAY_FREE)
 Use this API to pass externally allocated memory to this instance. More...
 
void SetArrayFreeFunction (void(*callback)(void *)) override
 This method allows the user to specify a custom free function to be called when the array is deallocated. More...
 
void SetArrayFreeFunction (int comp, void(*callback)(void *))
 This method allows the user to specify a custom free function to be called when the array is deallocated. More...
 
ValueTypeGetComponentArrayPointer (int comp)
 Return a pointer to a contiguous block of memory containing all values for a particular components (ie. More...
 
void * GetVoidPointer (vtkIdType valueIdx) override
 Use of this method is discouraged, it creates a deep copy of the data into a contiguous AoS-ordered buffer and prints a warning. More...
 
void ExportToVoidPointer (void *ptr) override
 Export a copy of the data in AoS ordering to the preallocated memory buffer. More...
 
int GetArrayType () const override
 
vtkArrayIteratorNewIterator () override
 
void SetNumberOfComponents (int numComps) override
 
void ShallowCopy (vtkDataArray *other) override
 
void InsertTuples (vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray *source) override
 
void InsertTuples (vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
 
ValueType GetValue (vtkIdType valueIdx) const
 Get the value at valueIdx. More...
 
void SetValue (vtkIdType valueIdx, ValueType value)
 Set the value at valueIdx to value. More...
 

Static Public Member Functions

static vtkSOADataArrayTemplateNew ()
 
static vtkSOADataArrayTemplate< ValueType > * FastDownCast (vtkAbstractArray *source)
 Perform a fast, safe cast from a vtkAbstractArray to a vtkDataArray. More...
 

Protected Member Functions

 vtkSOADataArrayTemplate ()
 
 ~vtkSOADataArrayTemplate () override
 
bool AllocateTuples (vtkIdType numTuples)
 Allocate space for numTuples. More...
 
bool ReallocateTuples (vtkIdType numTuples)
 Allocate space for numTuples. More...
 

Protected Attributes

std::vector< vtkBuffer< ValueType > * > Data
 
vtkBuffer< ValueType > * AoSCopy
 

Friends

class vtkGenericDataArray< vtkSOADataArrayTemplate< ValueTypeT >, ValueTypeT >
 

Detailed Description

template<class ValueTypeT>
class vtkSOADataArrayTemplate< ValueTypeT >

Struct-Of-Arrays implementation of vtkGenericDataArray.

vtkSOADataArrayTemplate is the counterpart of vtkAOSDataArrayTemplate. Each component is stored in a separate array.

See also
vtkGenericDataArray vtkAOSDataArrayTemplate

Definition at line 39 of file vtkSOADataArrayTemplate.h.

Member Typedef Documentation

◆ SelfType

template<class ValueTypeT >
typedef vtkSOADataArrayTemplate<ValueTypeT> vtkSOADataArrayTemplate< ValueTypeT >::SelfType

Definition at line 45 of file vtkSOADataArrayTemplate.h.

◆ ValueType

template<class ValueTypeT >
typedef Superclass::ValueType vtkSOADataArrayTemplate< ValueTypeT >::ValueType

Definition at line 47 of file vtkSOADataArrayTemplate.h.

Member Enumeration Documentation

◆ DeleteMethod

template<class ValueTypeT >
enum vtkSOADataArrayTemplate::DeleteMethod
Enumerator
VTK_DATA_ARRAY_FREE 
VTK_DATA_ARRAY_DELETE 
VTK_DATA_ARRAY_ALIGNED_FREE 
VTK_DATA_ARRAY_USER_DEFINED 

Definition at line 49 of file vtkSOADataArrayTemplate.h.

Constructor & Destructor Documentation

◆ vtkSOADataArrayTemplate()

template<class ValueTypeT >
vtkSOADataArrayTemplate< ValueTypeT >::vtkSOADataArrayTemplate ( )
protected

◆ ~vtkSOADataArrayTemplate()

template<class ValueTypeT >
vtkSOADataArrayTemplate< ValueTypeT >::~vtkSOADataArrayTemplate ( )
overrideprotected

Member Function Documentation

◆ vtkTemplateTypeMacro()

template<class ValueTypeT >
vtkSOADataArrayTemplate< ValueTypeT >::vtkTemplateTypeMacro ( SelfType  ,
GenericDataArrayType   
)

◆ New()

template<class ValueTypeT >
static vtkSOADataArrayTemplate* vtkSOADataArrayTemplate< ValueTypeT >::New ( )
static

◆ GetValue()

template<class ValueTypeT >
ValueType vtkSOADataArrayTemplate< ValueTypeT >::GetValue ( vtkIdType  valueIdx) const
inline

Get the value at valueIdx.

valueIdx assumes AOS ordering.

Definition at line 63 of file vtkSOADataArrayTemplate.h.

◆ SetValue()

template<class ValueTypeT >
void vtkSOADataArrayTemplate< ValueTypeT >::SetValue ( vtkIdType  valueIdx,
ValueType  value 
)
inline

Set the value at valueIdx to value.

valueIdx assumes AOS ordering.

Definition at line 76 of file vtkSOADataArrayTemplate.h.

◆ GetTypedTuple()

template<class ValueTypeT >
void vtkSOADataArrayTemplate< ValueTypeT >::GetTypedTuple ( vtkIdType  tupleIdx,
ValueType tuple 
) const
inline

Copy the tuple at tupleIdx into tuple.

Definition at line 88 of file vtkSOADataArrayTemplate.h.

◆ SetTypedTuple()

template<class ValueTypeT >
void vtkSOADataArrayTemplate< ValueTypeT >::SetTypedTuple ( vtkIdType  tupleIdx,
const ValueType tuple 
)
inline

Set this array's tuple at tupleIdx to the values in tuple.

Definition at line 99 of file vtkSOADataArrayTemplate.h.

◆ GetTypedComponent()

template<class ValueTypeT >
ValueType vtkSOADataArrayTemplate< ValueTypeT >::GetTypedComponent ( vtkIdType  tupleIdx,
int  comp 
) const
inline

Get component comp of the tuple at tupleIdx.

Definition at line 110 of file vtkSOADataArrayTemplate.h.

◆ SetTypedComponent()

template<class ValueTypeT >
void vtkSOADataArrayTemplate< ValueTypeT >::SetTypedComponent ( vtkIdType  tupleIdx,
int  comp,
ValueType  value 
)
inline

Set component comp of the tuple at tupleIdx to value.

Definition at line 118 of file vtkSOADataArrayTemplate.h.

◆ FillTypedComponent()

template<class ValueTypeT >
void vtkSOADataArrayTemplate< ValueTypeT >::FillTypedComponent ( int  compIdx,
ValueType  value 
)
override

Set component comp of all tuples to value.

◆ SetArray()

template<class ValueTypeT >
void vtkSOADataArrayTemplate< ValueTypeT >::SetArray ( int  comp,
ValueType array,
vtkIdType  size,
bool  updateMaxId = false,
bool  save = false,
int  deleteMethod = VTK_DATA_ARRAY_FREE 
)

Use this API to pass externally allocated memory to this instance.

Since vtkSOADataArrayTemplate uses separate contiguous regions for each component, use this API to add arrays for each of the component. save: When set to true, vtkSOADataArrayTemplate will not release or realloc the memory even when the AllocatorType is set to RESIZABLE. If needed it will simply allow new memory buffers and "forget" the supplied pointers. When save is set to false, this will be the deleteMethod specified to release the array. If updateMaxId is true, the array's MaxId will be updated, and assumes that size is the number of tuples in the array. size is specified in number of elements of ScalarType.

◆ SetArrayFreeFunction() [1/2]

template<class ValueTypeT >
void vtkSOADataArrayTemplate< ValueTypeT >::SetArrayFreeFunction ( void(*)(void *)  callback)
override

This method allows the user to specify a custom free function to be called when the array is deallocated.

Calling this method will implicitly mean that the given free function will be called when the class cleans up or reallocates memory. This custom free function will be used for all components.

◆ SetArrayFreeFunction() [2/2]

template<class ValueTypeT >
void vtkSOADataArrayTemplate< ValueTypeT >::SetArrayFreeFunction ( int  comp,
void(*)(void *)  callback 
)

This method allows the user to specify a custom free function to be called when the array is deallocated.

Calling this method will implicitly mean that the given free function will be called when the class cleans up or reallocates memory.

◆ GetComponentArrayPointer()

template<class ValueTypeT >
ValueType* vtkSOADataArrayTemplate< ValueTypeT >::GetComponentArrayPointer ( int  comp)

Return a pointer to a contiguous block of memory containing all values for a particular components (ie.

a single array of the struct-of-arrays).

◆ GetVoidPointer()

template<class ValueTypeT >
void* vtkSOADataArrayTemplate< ValueTypeT >::GetVoidPointer ( vtkIdType  valueIdx)
override

Use of this method is discouraged, it creates a deep copy of the data into a contiguous AoS-ordered buffer and prints a warning.

◆ ExportToVoidPointer()

template<class ValueTypeT >
void vtkSOADataArrayTemplate< ValueTypeT >::ExportToVoidPointer ( void *  ptr)
override

Export a copy of the data in AoS ordering to the preallocated memory buffer.

◆ FastDownCast()

template<class ValueTypeT >
static vtkSOADataArrayTemplate<ValueType>* vtkSOADataArrayTemplate< ValueTypeT >::FastDownCast ( vtkAbstractArray source)
static

Perform a fast, safe cast from a vtkAbstractArray to a vtkDataArray.

This method checks if source->GetArrayType() returns DataArray or a more derived type, and performs a static_cast to return source as a vtkDataArray pointer. Otherwise, nullptr is returned.

◆ GetArrayType()

template<class ValueTypeT >
int vtkSOADataArrayTemplate< ValueTypeT >::GetArrayType ( ) const
inlineoverride

Definition at line 191 of file vtkSOADataArrayTemplate.h.

◆ NewIterator()

template<class ValueTypeT >
vtkArrayIterator* vtkSOADataArrayTemplate< ValueTypeT >::NewIterator ( )
override

◆ SetNumberOfComponents()

template<class ValueTypeT >
void vtkSOADataArrayTemplate< ValueTypeT >::SetNumberOfComponents ( int  numComps)
override

◆ ShallowCopy()

template<class ValueTypeT >
void vtkSOADataArrayTemplate< ValueTypeT >::ShallowCopy ( vtkDataArray other)
override

◆ InsertTuples() [1/2]

template<class ValueTypeT >
void vtkSOADataArrayTemplate< ValueTypeT >::InsertTuples ( vtkIdType  dstStart,
vtkIdType  n,
vtkIdType  srcStart,
vtkAbstractArray source 
)
override

◆ InsertTuples() [2/2]

template<class ValueTypeT >
void vtkSOADataArrayTemplate< ValueTypeT >::InsertTuples ( vtkIdList dstIds,
vtkIdList srcIds,
vtkAbstractArray source 
)
inlineoverride

Definition at line 201 of file vtkSOADataArrayTemplate.h.

◆ AllocateTuples()

template<class ValueTypeT >
bool vtkSOADataArrayTemplate< ValueTypeT >::AllocateTuples ( vtkIdType  numTuples)
protected

Allocate space for numTuples.

Old data is not preserved. If numTuples == 0, all data is freed.

◆ ReallocateTuples()

template<class ValueTypeT >
bool vtkSOADataArrayTemplate< ValueTypeT >::ReallocateTuples ( vtkIdType  numTuples)
protected

Allocate space for numTuples.

Old data is preserved. If numTuples == 0, all data is freed.

Friends And Related Function Documentation

◆ vtkGenericDataArray< vtkSOADataArrayTemplate< ValueTypeT >, ValueTypeT >

template<class ValueTypeT >
friend class vtkGenericDataArray< vtkSOADataArrayTemplate< ValueTypeT >, ValueTypeT >
friend

Definition at line 229 of file vtkSOADataArrayTemplate.h.

Member Data Documentation

◆ Data

template<class ValueTypeT >
std::vector<vtkBuffer<ValueType>*> vtkSOADataArrayTemplate< ValueTypeT >::Data
protected

Definition at line 222 of file vtkSOADataArrayTemplate.h.

◆ AoSCopy

template<class ValueTypeT >
vtkBuffer<ValueType>* vtkSOADataArrayTemplate< ValueTypeT >::AoSCopy
protected

Definition at line 223 of file vtkSOADataArrayTemplate.h.


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