56#ifndef vtkGenericDataArray_h
57#define vtkGenericDataArray_h
70VTK_ABI_NAMESPACE_BEGIN
71template <
class DerivedT,
class ValueTypeT,
int ArrayType = vtkArrayTypes::VTK_DATA_ARRAY>
76 "ArrayType must be a valid vtkAbstractArray::ArrayType enum value");
82 using DataTypeTag = std::integral_constant<int, vtkTypeTraits<ValueTypeT>::VTK_TYPE_ID>;
99 return static_cast<const DerivedT*
>(
this)->
GetValue(valueIdx);
112 static_cast<DerivedT*
>(
this)->
SetValue(valueIdx, value);
126 static_cast<const DerivedT*
>(
this)->
GetTypedTuple(tupleIdx, tuple);
140 static_cast<DerivedT*
>(
this)->
SetTypedTuple(tupleIdx, tuple);
152 return static_cast<const DerivedT*
>(
this)->GetTypedComponent(tupleIdx, compIdx);
164 static_cast<DerivedT*
>(
this)->SetTypedComponent(tupleIdx, compIdx, value);
179 "vtkAbstractArray::SetNumberOf[Values/Tuples]() instead")
182 "vtkAbstractArray::SetNumberOf[Values/Tuples]() instead")
233 ValueType range[2],
int comp, const
unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
251 ValueType range[2],
int comp,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
323 double* weights)
override;
352 return static_cast<DerivedT*
>(
this)->ReallocateTuples(numTuples);
367 ValueType range[2],
int comp,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
377 ValueType range[2],
int comp,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
386 ValueType* ranges,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
393 ValueType range[2],
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
402 ValueType* ranges,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
409 ValueType range[2],
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
422 std::unique_ptr<vtkInternals> Internals;
430#define vtkCreateGenericWrappedArrayReadInterface(T) \
431 int GetDataType() const override; \
432 T GetDataTypeValueMin() const; \
433 T GetDataTypeValueMax() const; \
434 T* GetValueRange(int comp) VTK_SIZEHINT(2); \
435 T* GetValueRange() VTK_SIZEHINT(2); \
436 void GetValueRange(T range[2], int comp);
437#define vtkCreateGenericWrappedArrayWriteInterface(T) \
438 void InsertTypedTuple(vtkIdType i, const T* tuple) VTK_EXPECTS(0 <= i); \
439 vtkIdType InsertNextTypedTuple(const T* tuple); \
440 void InsertValue(vtkIdType id, T f) VTK_EXPECTS(0 <= id); \
441 vtkIdType InsertNextValue(T f);
442#define vtkCreateGenericWrappedArrayInterface(T) \
443 vtkCreateGenericWrappedArrayReadInterface(T); \
444 vtkCreateGenericWrappedArrayWriteInterface(T);
449#define vtkCreateWrappedArrayReadInterface(T) \
450 vtkCreateGenericWrappedArrayReadInterface(T); \
451 void GetTypedTuple(vtkIdType i, T* tuple) VTK_EXPECTS(0 <= i && i < GetNumberOfTuples()); \
452 T GetTypedComponent(vtkIdType i, int c) const VTK_EXPECTS(0 <= c && c < GetNumberOfComponents()) \
453 VTK_EXPECTS(0 <= i && GetNumberOfComponents() * i + c < GetNumberOfValues()); \
454 T GetValue(vtkIdType id) const VTK_EXPECTS(0 <= id && id < GetNumberOfValues());
455#define vtkCreateWrappedArrayWriteInterface(T) \
456 vtkCreateGenericWrappedArrayWriteInterface(T); \
457 void SetTypedTuple(vtkIdType i, const T* tuple) VTK_EXPECTS(0 <= i && i < GetNumberOfTuples()); \
458 void SetTypedComponent(vtkIdType i, int c, T value); \
459 void SetValue(vtkIdType id, T value) VTK_EXPECTS(0 <= id && id < GetNumberOfValues()); \
460 bool SetNumberOfValues(vtkIdType number) override;
462#define VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
463 template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
464 ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
465 template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
466 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
467 template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
468 vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
469 template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
470 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
474VTK_ABI_NAMESPACE_BEGIN
475template <
typename A,
typename R,
typename T>
477 A*, R*, T,
const unsigned char* ghosts,
unsigned char ghostsToSkip);
478template <
typename A,
typename R>
480 A*, R[2],
AllValues,
const unsigned char* ghosts,
unsigned char ghostsToSkip);
481template <
typename A,
typename R>
483 A*, R[2],
FiniteValues,
const unsigned char* ghosts,
unsigned char ghostsToSkip);
487#define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
488 extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
489 ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
490 extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
491 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
492 extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
493 vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
494 extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
495 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
497#include "vtkGenericDataArray.txx"
505#define vtkAOSArrayNewInstanceMacro(thisClass) \
507 vtkObjectBase* NewInstanceInternal() const override \
509 if (vtkDataArray* da = vtkDataArray::CreateDataArray(thisClass::DataTypeTag::value)) \
513 return thisClass::New(); \
525#ifdef VTK_USE_EXTERN_TEMPLATE
527#ifndef VTK_GDA_TEMPLATE_EXTERN
528#define VTK_GDA_TEMPLATE_EXTERN
533#pragma warning(disable : 4910)
538VTK_ABI_NAMESPACE_BEGIN
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.
virtual void SetTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source)=0
Set the tuple at dstTupleIdx in this array to the tuple at srcTupleIdx in the source array.
virtual void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source)=0
Copy the tuples indexed in srcIds from the source array to the tuple locations indexed by dstIds in t...
vtkIdType GetNumberOfValues() const
Get the total number of values in the array.
Abstract superclass to iterate over elements in an vtkAbstractArray.
internal class used by vtkGenericDataArray to support LookupValue.
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,...
vtkIdType InsertNextValue(ValueType value)
ValueType * GetFiniteValueRange(int comp)
These methods are analogous to the GetValueRange methods, except that the only consider finite values...
void InsertValue(vtkIdType valueIdx, ValueType value)
void DataChanged() override
Tell the array explicitly that the data has changed.
virtual void LookupTypedValue(ValueType value, vtkIdList *valueIds)
void * GetVoidPointer(vtkIdType valueIdx) override
Default implementation raises a runtime error.
int GetDataTypeSize() const override
Return the size of the underlying data type.
void InsertComponent(vtkIdType tupleIdx, int compIdx, double value) override
Insert value at the location specified by tupleIdx and compIdx.
ValueType * GetValueRange()
Get the range of array values for the 0th component in the native data type.
void GetFiniteValueRange(ValueType range[2])
These methods are analogous to the GetValueRange methods, except that the only consider finite values...
void SetTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
bool HasStandardMemoryLayout() const override
Returns true if this array uses the standard memory layout defined in the VTK user guide,...
void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
void ComputeValueRange(ValueType range[2], int comp, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Compute the range for a specific component.
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...
void InsertTuple(vtkIdType tupleIdx, const float *source) override
Insert the data tuple at tupleIdx.
double GetComponent(vtkIdType tupleIdx, int compIdx) override
Return the data component at the location specified by tupleIdx and compIdx.
void LookupValue(vtkVariant value, vtkIdList *valueIds) override
Return the value indices where a specific value appears.
void * WriteVoidPointer(vtkIdType valueIdx, vtkIdType numValues) override
int GetArrayType() const override
Method for type-checking in FastDownCast implementations.
bool ComputeVectorValueRange(ValueType range[2], const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Returns true if the range was computed.
void SetComponent(vtkIdType tupleIdx, int compIdx, double value) override
Set the data component at the location specified by tupleIdx and compIdx to value.
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 ...
vtkTemplateTypeMacro(SelfType, vtkDataArray)
bool EnsureAccessToTuple(vtkIdType tupleIdx)
void ComputeFiniteValueRange(ValueType range[2], int comp, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Compute the range for a specific component.
vtkIdType InsertNextTypedTuple(const ValueType *t)
void GetValueRange(ValueType range[2], int comp, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
vtkIdType LookupValue(vtkVariant value) override
Return the value indices where a specific value appears.
ValueType GetDataTypeValueMin() const
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 InsertTypedTuple(vtkIdType tupleIdx, const ValueType *t)
vtkGenericDataArrayLookupHelper< SelfType > Lookup
bool ComputeFiniteVectorValueRange(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...
void InsertVariantValue(vtkIdType valueIdx, vtkVariant value) override
Insert a value into the array from a variant.
std::vector< ValueType > LegacyValueRange
void RemoveTuple(vtkIdType tupleIdx) override
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 SetTuple(vtkIdType tupleIdx, const double *tuple) override
Set the data tuple at tupleIdx.
void SetVariantValue(vtkIdType valueIdx, vtkVariant value) override
Set a value in the array from a variant.
void SetNumberOfComponents(int num) override
Set/Get the dimension (n) of the components.
void SetTuple(vtkIdType tupleIdx, const float *tuple) override
Set the data tuple at tupleIdx.
void SetVoidArray(void *, vtkIdType, int) override
virtual vtkIdType LookupTypedValue(ValueType value)
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 ...
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...
std::integral_constant< int, vtkTypeTraits< T >::VTK_TYPE_ID > DataTypeTag
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...
virtual void FillValue(ValueType value)
Set all the values in array to value.
vtkVariant GetVariantValue(vtkIdType valueIdx) override
Retrieve value from the array as a variant.
ValueType * WritePointer(vtkIdType valueIdx, vtkIdType numValues)
void InsertTuples(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray *source) override
See documentation from parent class.
double * GetTuple(vtkIdType tupleIdx) override
Get the data tuple at tupleIdx.
void GetValueRange(ValueType range[2])
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...
vtkTypeBool ReserveTuples(vtkIdType numTuples) override
Reserve the array to the requested number of tuples and preserve data.
virtual void FillTypedComponent(int compIdx, ValueType value)
Set component comp of all tuples to value.
void SetArrayFreeFunction(void(*callback)(void *)) override
void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
std::vector< double > LegacyTuple
void FillComponent(int compIdx, double value) override
Fill a component of a data array with a specified value.
void ClearLookup() override
Delete the associated fast lookup data structure on this array, if it exists.
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
vtkIdType InsertNextTuple(vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
void InsertTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType val)
ValueType * GetPointer(vtkIdType valueIdx)
std::integral_constant< int, ArrayType > ArrayTypeTag
void Squeeze() override
Free any unnecessary memory.
static DerivedT * FastDownCast(vtkAbstractArray *source)
Perform a fast, safe cast from a vtkAbstractArray to a DerivedT.
int GetDataType() const override
Return the underlying data type.
ValueType GetDataTypeValueMax() const
void InsertTuple(vtkIdType tupleIdx, const double *source) override
Insert the data tuple at tupleIdx.
void GetTuples(vtkIdList *tupleIds, vtkAbstractArray *output) override
Given a list of tuple ids, return an array of tuples.
ValueType * GetFiniteValueRange()
These methods are analogous to the GetValueRange methods, except that the only consider finite values...
vtkArrayIterator * NewIterator() override
vtkGenericDataArray< vtkmDataArray< T >, T, ArrayType > SelfType
std::vector< ValueType > LegacyValueRangeFull
list of point or cell ids
A type representing the union of many types.
void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
Set component compIdx of the tuple at tupleIdx to value.
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Get component compIdx of the tuple at tupleIdx.
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
Set this array's tuple at tupleIdx to the values in tuple.
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
bool ReallocateTuples(vtkIdType numTuples)
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(A *, R *, T, const unsigned char *ghosts, unsigned char ghostsToSkip)
VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(A *, R[2], AllValues, const unsigned char *ghosts, unsigned char ghostsToSkip)
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define VTK_DEPRECATED_IN_9_7_0(reason)
#define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType)
#define VTK_SIZEHINT(...)