56 #ifndef vtkGenericDataArray_h
57 #define vtkGenericDataArray_h
70 VTK_ABI_NAMESPACE_BEGIN
71 template <
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>;
108 return static_cast<const DerivedT*
>(
this)->
GetValue(valueIdx);
135 static_cast<const DerivedT*
>(
this)->
GetTypedTuple(tupleIdx, tuple);
149 static_cast<DerivedT*
>(
this)->
SetTypedTuple(tupleIdx, tuple);
242 ValueType range[2],
int comp, const
unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
260 ValueType range[2],
int comp,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
302 this->Superclass::SetTuple(tupleIdx, tuple);
306 this->Superclass::SetTuple(tupleIdx, tuple);
317 this->Superclass::InsertTuples(dstStart, n, srcStart, source);
332 double* weights)
override;
352 ~vtkGenericDataArray() 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);
431 std::unique_ptr<vtkInternals> Internals;
433 VTK_ABI_NAMESPACE_END
439 #define vtkCreateGenericWrappedArrayReadInterface(T) \
440 int GetDataType() const override; \
441 T GetDataTypeValueMin() const; \
442 T GetDataTypeValueMax() const; \
443 T* GetValueRange(int comp) VTK_SIZEHINT(2); \
444 T* GetValueRange() VTK_SIZEHINT(2); \
445 void GetValueRange(T range[2], int comp); \
446 void GetValueRange(T range[2], int comp);
447 #define vtkCreateGenericWrappedArrayWriteInterface(T) \
448 void InsertTypedTuple(vtkIdType i, const T* tuple) VTK_EXPECTS(0 <= i); \
449 vtkIdType InsertNextTypedTuple(const T* tuple); \
450 void InsertValue(vtkIdType id, T f) VTK_EXPECTS(0 <= id); \
451 vtkIdType InsertNextValue(T f);
452 #define vtkCreateGenericWrappedArrayInterface(T) \
453 vtkCreateGenericWrappedArrayReadInterface(T); \
454 vtkCreateGenericWrappedArrayWriteInterface(T);
459 #define vtkCreateWrappedArrayReadInterface(T) \
460 vtkCreateGenericWrappedArrayReadInterface(T); \
461 void GetTypedTuple(vtkIdType i, T* tuple) VTK_EXPECTS(0 <= i && i < GetNumberOfTuples()); \
462 T GetTypedComponent(vtkIdType i, int c) const VTK_EXPECTS(0 <= c && c < GetNumberOfComponents()) \
463 VTK_EXPECTS(0 <= i && GetNumberOfComponents() * i + c < GetNumberOfValues()); \
464 T GetValue(vtkIdType id) const VTK_EXPECTS(0 <= id && id < GetNumberOfValues());
465 #define vtkCreateWrappedArrayWriteInterface(T) \
466 vtkCreateGenericWrappedArrayWriteInterface(T); \
467 void SetTypedTuple(vtkIdType i, const T* tuple) VTK_EXPECTS(0 <= i && i < GetNumberOfTuples()); \
468 void SetTypedComponent(vtkIdType i, int c, ValueType value); \
469 void SetValue(vtkIdType id, T value) VTK_EXPECTS(0 <= id && id < GetNumberOfValues()); \
470 bool SetNumberOfValues(vtkIdType number) override;
472 #define VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
473 template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
474 ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
475 template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
476 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
477 template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
478 vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
479 template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
480 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
484 VTK_ABI_NAMESPACE_BEGIN
485 template <
typename A,
typename R,
typename T>
487 A*, R*, T,
const unsigned char* ghosts,
unsigned char ghostsToSkip);
488 template <
typename A,
typename R>
490 A*, R[2], AllValues,
const unsigned char* ghosts,
unsigned char ghostsToSkip);
491 template <
typename A,
typename R>
493 A*, R[2], FiniteValues,
const unsigned char* ghosts,
unsigned char ghostsToSkip);
494 VTK_ABI_NAMESPACE_END
497 #define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
498 extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
499 ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
500 extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
501 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
502 extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
503 vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
504 extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
505 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
507 #include "vtkGenericDataArray.txx"
515 #define vtkAOSArrayNewInstanceMacro(thisClass) \
517 vtkObjectBase* NewInstanceInternal() const override \
519 if (vtkDataArray* da = vtkDataArray::CreateDataArray(thisClass::DataTypeTag::value)) \
523 return thisClass::New(); \
535 #ifdef VTK_USE_EXTERN_TEMPLATE
537 #ifndef VTK_GDA_TEMPLATE_EXTERN
538 #define VTK_GDA_TEMPLATE_EXTERN
540 #pragma warning(push)
543 #pragma warning(disable : 4910) // extern and dllexport incompatible
548 VTK_ABI_NAMESPACE_BEGIN
552 VTK_ABI_NAMESPACE_END
558 #endif // VTK_GDA_TEMPLATE_EXTERN
560 #endif // VTK_USE_EXTERN_TEMPLATE
void SetNumberOfComponents(int num) override
Set/Get the dimension (n) of the components.
std::vector< ValueType > LegacyValueRange
void InsertTuples(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray *source) override
See documentation from parent class.
void FillComponent(int compIdx, double value) override
Fill a component of a data array with a specified value.
void InsertTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType val)
Insert (memory allocation performed) the value at the specified tuple and component location...
bool EnsureAccessToTuple(vtkIdType tupleIdx)
void InsertVariantValue(vtkIdType valueIdx, vtkVariant value) override
Insert a value into the array from a variant.
int GetNumberOfComponents() const
Set/Get the dimension (n) of the components.
internal class used by vtkGenericDataArray to support LookupValue.
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
std::vector< ValueType > LegacyValueRangeFull
Abstract superclass for all arrays.
vtkIdType LookupValue(vtkVariant value) override
Return the value indices where a specific value appears.
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)
void InsertTypedTuple(vtkIdType tupleIdx, const ValueType *t)
Insert (memory allocation performed) the tuple t at tupleIdx.
void Squeeze() override
Free any unnecessary memory.
#define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType)
void ClearLookup() override
Delete the associated fast lookup data structure on this array, if it exists.
Base interface for all typed vtkDataArray subclasses.
bool ComputeVectorValueRange(ValueType range[2], const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Returns true if the range was computed.
ValueType * WritePointer(vtkIdType valueIdx, vtkIdType numValues)
Default implementation raises a runtime error.
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.
ValueType GetDataTypeValueMin() const
vtkTypeBool ReserveTuples(vtkIdType numTuples) override
Reserve the array to the requested number of tuples and preserve data.
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
A type representing the union of many types.
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
void * WriteVoidPointer(vtkIdType valueIdx, vtkIdType numValues) 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...
virtual vtkIdType LookupTypedValue(ValueType value)
vtkIdType GetNumberOfValues() const
Get the total number of values in the array.
bool ComputeFiniteVectorValueRange(ValueType range[2], const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Returns true if the range was computed.
void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
void SetComponent(vtkIdType tupleIdx, int compIdx, double value) override
Set the data component at the location specified by tupleIdx and compIdx to value.
#define VTK_DEPRECATED_IN_9_6_0(reason)
void SetArrayFreeFunction(void(*callback)(void *)) override
Default implementation raises a runtime error.
bool ReallocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
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 ...
vtkGenericDataArrayLookupHelper< SelfType > Lookup
Array-Of-Structs implementation of vtkGenericDataArray.
list of point or cell ids
ValueType * GetPointer(vtkIdType valueIdx)
Default implementation raises a runtime error.
abstract superclass for arrays of numeric data
ValueType * GetValueRange()
Get the range of array values for the 0th 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.
Abstract superclass to iterate over elements in an vtkAbstractArray.
void ComputeFiniteValueRange(ValueType range[2], int comp, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Compute the range for a specific component.
vtkIdType InsertNextTuple(vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
Set component compIdx of the tuple at tupleIdx to value.
vtkIdType GetNumberOfTuples() const
Get the number of complete tuples (a component group) in the array.
#define VTK_SIZEHINT(...)
vtkTemplateTypeMacro(SelfType, vtkDataArray)
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
void ComputeValueRange(ValueType range[2], int comp, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Compute the range for a specific component.
static DerivedT * FastDownCast(vtkAbstractArray *source)
Perform a fast, safe cast from a vtkAbstractArray to a DerivedT.
void GetTuples(vtkIdList *tupleIds, vtkAbstractArray *output) override
Given a list of tuple ids, return an array of tuples.
int GetDataTypeSize() const override
Return the size of the underlying data type.
int GetArrayType() const override
Method for type-checking in FastDownCast implementations.
std::integral_constant< int, VTK_OPAQUE > DataTypeTag
virtual void FillValue(ValueType value)
Set all the values in array to value.
void SetTuple(vtkIdType tupleIdx, const double *tuple) override
Set the data tuple at tupleIdx.
vtkArrayIterator * NewIterator() override
Subclasses must override this method and provide the right kind of templated vtkArrayIteratorTemplate...
void RemoveTuple(vtkIdType tupleIdx) override
Removes a tuple at the given index.
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Get component compIdx of the tuple at tupleIdx.
void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
double GetComponent(vtkIdType tupleIdx, int compIdx) override
Return the data component at the location specified by tupleIdx and compIdx.
int GetDataType() const override
Return the underlying data type.
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 ...
double * GetTuple(vtkIdType tupleIdx) override
Get the data tuple at tupleIdx.
std::integral_constant< int, vtkArrayTypes::VTK_ABSTRACT_ARRAY > ArrayTypeTag
void DataChanged() override
Tell the array explicitly that the data has changed.
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.
void GetValueRange(ValueType range[2])
virtual void FillTypedComponent(int compIdx, ValueType value)
Set component comp of all tuples to value.
void InsertValue(vtkIdType valueIdx, ValueType value)
Insert data at a specified position in the array.
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
Set this array's tuple at tupleIdx to the values in tuple.
#define VTK_DEPRECATED_IN_9_7_0(reason)
vtkIdType InsertNextValue(ValueType value)
Insert data at the end of the array.
void SetVoidArray(void *, vtkIdType, int) override
Default implementation raises a runtime error.
void SetTuple(vtkIdType tupleIdx, const float *tuple) override
Set the data tuple at tupleIdx.
Template defining traits of native types used by VTK.
vtkIdType InsertNextTypedTuple(const ValueType *t)
Insert (memory allocation performed) the tuple onto the end of the array.
std::vector< double > LegacyTuple
ValueType GetDataTypeValueMax() const
void * GetVoidPointer(vtkIdType valueIdx) override
Default implementation raises a runtime error.
void SetVariantValue(vtkIdType valueIdx, vtkVariant value) override
Set a value in the array from a variant.
bool HasStandardMemoryLayout() const override
Returns true if this array uses the standard memory layout defined in the VTK user guide...