66 #ifndef vtkGenericDataArray_h
67 #define vtkGenericDataArray_h
78 VTK_ABI_NAMESPACE_BEGIN
79 template <
class DerivedT,
class ValueTypeT>
110 return static_cast<const DerivedT*
>(
this)->
GetValue(valueIdx);
137 static_cast<const DerivedT*
>(
this)->
GetTypedTuple(tupleIdx, tuple);
151 static_cast<DerivedT*
>(
this)->
SetTypedTuple(tupleIdx, tuple);
238 ValueType range[2],
int comp,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
256 ValueType range[2],
int comp,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
293 this->Superclass::SetTuple(tupleIdx, tuple);
297 this->Superclass::SetTuple(tupleIdx, tuple);
308 this->Superclass::InsertTuples(dstStart, n, srcStart,
source);
323 double* weights)
override;
376 ValueType range[2],
int comp,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
386 ValueType range[2],
int comp,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
395 ValueType* ranges,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
402 ValueType range[2],
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
411 ValueType* ranges,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
418 ValueType range[2],
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
430 VTK_ABI_NAMESPACE_END
435 VTK_ABI_NAMESPACE_BEGIN
436 template <
typename A,
typename R,
typename T>
438 template <
typename A,
typename R>
440 A*, R[2],
AllValues,
const unsigned char* ghosts,
unsigned char ghostsToSkip);
441 template <
typename A,
typename R>
443 A*, R[2],
FiniteValues,
const unsigned char* ghosts,
unsigned char ghostsToSkip);
444 VTK_ABI_NAMESPACE_END
447 #include "vtkGenericDataArray.txx"
455 #define vtkAOSArrayNewInstanceMacro(thisClass) \
457 vtkObjectBase* NewInstanceInternal() const override \
459 if (vtkDataArray* da = vtkDataArray::CreateDataArray(thisClass::VTK_DATA_TYPE)) \
463 return thisClass::New(); \
479 #ifdef VTK_GDA_VALUERANGE_INSTANTIATING
482 VTK_ABI_NAMESPACE_BEGIN
483 template <
typename ValueType>
485 template <
typename ValueType>
488 #ifdef VTK_USE_SCALED_SOA_ARRAYS
489 template <
typename ValueType>
492 VTK_ABI_NAMESPACE_END
494 #define VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
495 template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
496 ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
497 template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
498 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
499 template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
500 vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
501 template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
502 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
504 #ifdef VTK_USE_SCALED_SOA_ARRAYS
506 #define VTK_INSTANTIATE_VALUERANGE_VALUETYPE(ValueType) \
507 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
508 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) \
509 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<ValueType>, ValueType)
513 #define VTK_INSTANTIATE_VALUERANGE_VALUETYPE(ValueType) \
514 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
515 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
519 #elif defined(VTK_USE_EXTERN_TEMPLATE)
521 #ifndef VTK_GDA_TEMPLATE_EXTERN
522 #define VTK_GDA_TEMPLATE_EXTERN
524 #pragma warning(push)
527 #pragma warning(disable : 4910)
530 VTK_ABI_NAMESPACE_BEGIN
532 template <
typename ValueType>
534 template <
typename ValueType>
537 #ifdef VTK_USE_SCALED_SOA_ARRAYS
538 template <
typename ValueType>
542 VTK_ABI_NAMESPACE_END
546 VTK_ABI_NAMESPACE_BEGIN
547 template <
typename A,
typename R,
typename T>
549 template <
typename A,
typename R>
551 A*, R[2], AllValues,
const unsigned char* ghosts,
unsigned char ghostsToSkip);
552 template <
typename A,
typename R>
554 A*, R[2], FiniteValues,
const unsigned char* ghosts,
unsigned char ghostsToSkip);
555 VTK_ABI_NAMESPACE_END
558 #define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
559 extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
560 ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
561 extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
562 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
563 extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
564 vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
565 extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
566 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
568 #ifdef VTK_USE_SCALED_SOA_ARRAYS
570 #define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType) \
571 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
572 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) \
573 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<ValueType>, ValueType)
577 #define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType) \
578 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
579 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
585 VTK_ABI_NAMESPACE_BEGIN
626 #ifdef VTK_USE_SCALED_SOA_ARRAYS
642 VTK_ABI_NAMESPACE_END
645 #undef VTK_DECLARE_VALUERANGE_ARRAYTYPE
646 #undef VTK_DECLARE_VALUERANGE_VALUETYPE
Array-Of-Structs implementation of vtkGenericDataArray.
Abstract superclass for all arrays.
int GetNumberOfComponents() const
Set/Get the dimension (n) of the components.
vtkIdType GetNumberOfTuples() const
Get the number of complete tuples (a component group) in the array.
vtkIdType GetNumberOfValues() const
Get the total number of values in the array.
Abstract superclass to iterate over elements in an vtkAbstractArray.
abstract superclass for arrays of numeric data
internal class used by vtkGenericDataArray to support LookupValue.
Base interface for all typed vtkDataArray subclasses.
ValueType * WritePointer(vtkIdType valueIdx, vtkIdType numValues)
Default implementation raises a runtime error.
vtkTypeBool Allocate(vtkIdType size, vtkIdType ext=1000) override
Allocate memory for this array.
virtual void FillValue(ValueType value)
Set all the values in array to value.
std::vector< ValueType > LegacyValueRange
void SetNumberOfComponents(int num) override
Set/Get the dimension (n) of the components.
void DataChanged() override
Tell the array explicitly that the data has changed.
ValueType * GetValueRange(int comp)
Get the range of array values for the given component in the native data type.
void InsertComponent(vtkIdType tupleIdx, int compIdx, double value) override
Insert value at the location specified by tupleIdx and compIdx.
void ComputeValueRange(ValueType range[2], int comp, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Compute the range for a specific component.
vtkIdType LookupValue(vtkVariant value) override
Return the value indices where a specific value appears.
double GetComponent(vtkIdType tupleIdx, int compIdx) override
Return the data component at the location specified by tupleIdx and compIdx.
void InsertVariantValue(vtkIdType valueIdx, vtkVariant value) override
Insert a value into the array from a variant.
void SetTuple(vtkIdType tupleIdx, const double *tuple) override
Set the data tuple at tupleIdx.
std::vector< ValueType > LegacyValueRangeFull
void InsertTuple(vtkIdType tupleIdx, const float *source) override
Insert the data tuple at tupleIdx.
bool ComputeScalarValueRange(ValueType *ranges, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Computes the range for each component of an array, the length of ranges must be two times the number ...
void RemoveTuple(vtkIdType tupleIdx) override
Removes a tuple at the given index.
void InsertTypedTuple(vtkIdType tupleIdx, const ValueType *t)
Insert (memory allocation performed) the tuple t at tupleIdx.
void SetNumberOfTuples(vtkIdType number) override
Set the number of tuples (a component group) in the array.
void * WriteVoidPointer(vtkIdType valueIdx, vtkIdType numValues) override
Default implementation raises a runtime error.
bool ComputeFiniteScalarValueRange(ValueType *ranges, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Computes the range for each component of an array, the length of ranges must be two times the number ...
vtkTypeBool Resize(vtkIdType numTuples) override
Resize the array to the requested number of tuples and preserve data.
void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
vtkTemplateTypeMacro(SelfType, vtkDataArray)
void FillComponent(int compIdx, double value) override
Fill a component of a data array with a specified value.
void GetValueRange(ValueType range[2], int comp)
Get the range of array values for the given component in the native data type.
void GetValueRange(ValueType range[2])
void GetFiniteValueRange(ValueType range[2], int comp, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
These methods are analogous to the GetValueRange methods, except that the only consider finite values...
double * GetTuple(vtkIdType tupleIdx) override
Get the data tuple at tupleIdx.
void SetVoidArray(void *, vtkIdType, int, int) override
Default implementation raises a runtime error.
vtkIdType Capacity()
Return the capacity in typeof T units of the current array.
void SetVariantValue(vtkIdType valueIdx, vtkVariant value) override
Set a value in the array from a variant.
ValueType * GetFiniteValueRange()
These methods are analogous to the GetValueRange methods, except that the only consider finite values...
vtkVariant GetVariantValue(vtkIdType valueIdx) override
Retrieve value from the array as a variant.
void InsertTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType val)
Insert (memory allocation performed) the value at the specified tuple and component location.
void ClearLookup() override
Delete the associated fast lookup data structure on this array, if it exists.
void GetTuple(vtkIdType tupleIdx, double *tuple) override
Get the data tuple at tupleIdx by filling in a user-provided array, Make sure that your array is larg...
vtkIdType InsertNextTuple(vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
virtual void LookupTypedValue(ValueType value, vtkIdList *valueIds)
vtkIdType InsertNextTuple(const double *tuple) override
Insert the data tuple at the end of the array and return the tuple index at which the data was insert...
void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output) override
Get the tuples for the range of tuple ids specified (i.e., p1->p2 inclusive).
void SetVoidArray(void *, vtkIdType, int) override
Default implementation raises a runtime error.
void InterpolateTuple(vtkIdType dstTupleIdx, vtkIdList *ptIndices, vtkAbstractArray *source, double *weights) override
Set the tuple at dstTupleIdx in this array to the interpolated tuple value, given the ptIndices in th...
void GetValueRange(ValueType range[2], int comp, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Get the range of array values for the given component in the native data type.
vtkIdType InsertNextTuple(const float *tuple) override
Insert the data tuple at the end of the array and return the tuple index at which the data was insert...
virtual vtkIdType LookupTypedValue(ValueType value)
virtual void FillTypedComponent(int compIdx, ValueType value)
Set component comp of all tuples to value.
bool HasStandardMemoryLayout() const override
Returns true if this array uses the standard memory layout defined in the VTK user guide,...
int GetDataTypeSize() const override
Return the size of the underlying data type.
void ComputeFiniteValueRange(ValueType range[2], int comp, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Compute the range for a specific component.
void SetArrayFreeFunction(void(*callback)(void *)) override
Default implementation raises a runtime error.
bool ComputeVectorValueRange(ValueType range[2], const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Returns true if the range was computed.
void GetFiniteValueRange(ValueType range[2], int comp)
These methods are analogous to the GetValueRange methods, except that the only consider finite values...
bool ComputeFiniteVectorValueRange(ValueType range[2], const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Returns true if the range was computed.
void SetTuple(vtkIdType tupleIdx, const float *tuple) override
Set the data tuple at tupleIdx.
~vtkGenericDataArray() override
void LookupValue(vtkVariant value, vtkIdList *valueIds) override
Return the value indices where a specific value appears.
void InsertValue(vtkIdType valueIdx, ValueType value)
Insert data at a specified position in the array.
ValueType * GetPointer(vtkIdType valueIdx)
Default implementation raises a runtime error.
void InterpolateTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx1, vtkAbstractArray *source1, vtkIdType srcTupleIdx2, vtkAbstractArray *source2, double t) override
Insert the tuple at dstTupleIdx in this array to the tuple interpolated from the two tuple indices,...
void InsertTuple(vtkIdType tupleIdx, const double *source) override
Insert the data tuple at tupleIdx.
void * GetVoidPointer(vtkIdType valueIdx) override
Default implementation raises a runtime error.
ValueType * GetFiniteValueRange(int comp)
These methods are analogous to the GetValueRange methods, except that the only consider finite values...
void InsertTuples(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray *source) override
See documentation from parent class.
void GetFiniteValueRange(ValueType range[2])
These methods are analogous to the GetValueRange methods, except that the only consider finite values...
vtkArrayIterator * NewIterator() override
Subclasses must override this method and provide the right kind of templated vtkArrayIteratorTemplate...
void Squeeze() override
Free any unnecessary memory.
bool EnsureAccessToTuple(vtkIdType tupleIdx)
vtkGenericDataArrayLookupHelper< SelfType > Lookup
std::vector< double > LegacyTuple
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
int GetDataType() const override
Return the underlying data type.
void GetTuples(vtkIdList *tupleIds, vtkAbstractArray *output) override
Given a list of tuple ids, return an array of tuples.
void SetComponent(vtkIdType tupleIdx, int compIdx, double value) override
Set the data component at the location specified by tupleIdx and compIdx to value.
ValueType * GetValueRange()
Get the range of array values for the 0th component in the native data type.
vtkIdType InsertNextValue(ValueType value)
Insert data at the end of the array.
vtkIdType InsertNextTypedTuple(const ValueType *t)
Insert (memory allocation performed) the tuple onto the end of the array.
void SetTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
void Initialize() override
Release storage and reset array to initial state.
list of point or cell ids
Struct-Of-Arrays implementation of vtkGenericDataArray.
Struct-Of-Arrays implementation of vtkGenericDataArray with a scaling factor.
A type representing the union of many types.
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
Set component compIdx of the tuple at tupleIdx to value.
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
Set this array's tuple at tupleIdx to the values in tuple.
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
bool ReallocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Get component compIdx of the tuple at tupleIdx.
bool AllocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
bool DoComputeScalarRange(A *, R *, T, const unsigned char *ghosts, unsigned char ghostsToSkip)
bool DoComputeVectorRange(A *, R[2], AllValues, const unsigned char *ghosts, unsigned char ghostsToSkip)
Template defining traits of native types used by VTK.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType)
#define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType)
#define VTK_SIZEHINT(...)