69 #ifndef vtkGenericDataArray_h
70 #define vtkGenericDataArray_h
81 template <
class DerivedT,
class ValueTypeT>
112 return static_cast<const DerivedT*
>(
this)->
GetValue(valueIdx);
139 static_cast<const DerivedT*
>(
this)->
GetTypedTuple(tupleIdx, tuple);
153 static_cast<DerivedT*
>(
this)->
SetTypedTuple(tupleIdx, tuple);
240 ValueType
range[2],
int comp,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
258 ValueType
range[2],
int comp,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
295 this->Superclass::SetTuple(tupleIdx, tuple);
299 this->Superclass::SetTuple(tupleIdx, tuple);
310 this->Superclass::InsertTuples(dstStart, n, srcStart, source);
325 double* weights)
override;
378 ValueType
range[2],
int comp,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
388 ValueType
range[2],
int comp,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
397 ValueType* ranges,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
404 ValueType
range[2],
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
413 ValueType* ranges,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
420 ValueType
range[2],
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff);
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);
446 #include "vtkGenericDataArray.txx"
454 #define vtkAOSArrayNewInstanceMacro(thisClass) \
456 vtkObjectBase* NewInstanceInternal() const override \
458 if (vtkDataArray* da = vtkDataArray::CreateDataArray(thisClass::VTK_DATA_TYPE)) \
462 return thisClass::New(); \
478 #ifdef VTK_GDA_VALUERANGE_INSTANTIATING
481 template <
typename ValueType>
483 template <
typename ValueType>
486 #ifdef VTK_USE_SCALED_SOA_ARRAYS
487 template <
typename ValueType>
491 #define VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
492 template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
493 ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
494 template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
495 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
496 template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
497 vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
498 template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
499 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
501 #ifdef VTK_USE_SCALED_SOA_ARRAYS
503 #define VTK_INSTANTIATE_VALUERANGE_VALUETYPE(ValueType) \
504 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
505 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) \
506 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<ValueType>, ValueType)
508 #else // VTK_USE_SCALED_SOA_ARRAYS
510 #define VTK_INSTANTIATE_VALUERANGE_VALUETYPE(ValueType) \
511 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
512 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
516 #elif defined(VTK_USE_EXTERN_TEMPLATE) // VTK_GDA_VALUERANGE_INSTANTIATING
518 #ifndef VTK_GDA_TEMPLATE_EXTERN
519 #define VTK_GDA_TEMPLATE_EXTERN
521 #pragma warning(push)
524 #pragma warning(disable : 4910) // extern and dllexport incompatible
528 template <
typename ValueType>
530 template <
typename ValueType>
533 #ifdef VTK_USE_SCALED_SOA_ARRAYS
534 template <
typename ValueType>
540 template <
typename A,
typename R,
typename T>
542 template <
typename A,
typename R>
544 A*, R[2], AllValues,
const unsigned char* ghosts,
unsigned char ghostsToSkip);
545 template <
typename A,
typename R>
547 A*, R[2], FiniteValues,
const unsigned char* ghosts,
unsigned char ghostsToSkip);
550 #define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
551 extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
552 ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
553 extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
554 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
555 extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
556 vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
557 extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
558 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
560 #ifdef VTK_USE_SCALED_SOA_ARRAYS
562 #define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType) \
563 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
564 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) \
565 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<ValueType>, ValueType)
567 #else // VTK_USE_SCALED_SOA_ARRAYS
569 #define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType) \
570 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
571 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
617 #ifdef VTK_USE_SCALED_SOA_ARRAYS
631 #endif // VTK_USE_SCALED_SOA_ARRAYS
635 #undef VTK_DECLARE_VALUERANGE_ARRAYTYPE
636 #undef VTK_DECLARE_VALUERANGE_VALUETYPE
641 #endif // VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
643 #endif // VTK_GDA_VALUERANGE_INSTANTIATING
Struct-Of-Arrays implementation of vtkGenericDataArray with a scaling factor.
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
Struct-Of-Arrays implementation of vtkGenericDataArray.
bool ComputeVectorValueRange(ValueType range[2], const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Returns true if the range was computed.
void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
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 FillComponent(int compIdx, double value) override
Fill a component of a data array with a specified value.
vtkIdType InsertNextTypedTuple(const ValueType *t)
Insert (memory allocation performed) the tuple onto the end of the array.
void Squeeze() override
Free any unnecessary memory.
void GetFiniteValueRange(ValueType range[2])
These methods are analogous to the GetValueRange methods, except that the only consider finite values...
void InsertValue(vtkIdType valueIdx, ValueType value)
Insert data at a specified position in the array.
int GetNumberOfComponents() const
Set/Get the dimension (n) of the components.
vtkIdType InsertNextTuple(vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
internal class used by vtkGenericDataArray to support LookupValue.
Abstract superclass for all arrays.
ValueType * GetPointer(vtkIdType valueIdx)
Default implementation raises a runtime error.
vtkGenericDataArrayLookupHelper< SelfType > Lookup
void SetVariantValue(vtkIdType valueIdx, vtkVariant value) override
Set a value in the array from a variant.
void SetArrayFreeFunction(void(*callback)(void *)) override
Default implementation raises a runtime error.
vtkTypeBool Allocate(vtkIdType size, vtkIdType ext=1000) override
Allocate memory for this array.
void SetComponent(vtkIdType tupleIdx, int compIdx, double value) override
Set the data component at the location specified by tupleIdx and compIdx to value.
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
void Initialize() override
Release storage and reset array to initial state.
void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
Set component compIdx of the tuple at tupleIdx to value.
std::vector< ValueType > LegacyValueRangeFull
#define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType)
Base interface for all typed vtkDataArray subclasses.
ValueType * GetFiniteValueRange()
These methods are analogous to the GetValueRange methods, except that the only consider finite values...
void SetVoidArray(void *, vtkIdType, int) override
Default implementation raises a runtime error.
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 SetNumberOfTuples(vtkIdType number) override
Set the number of tuples (a component group) in the array.
void SetTuple(vtkIdType tupleIdx, const float *tuple) override
Set the data tuple at tupleIdx.
A atomic type representing the union of many types.
void SetTuple(vtkIdType tupleIdx, const double *tuple) override
Set the data tuple at tupleIdx.
vtkIdType GetNumberOfValues() const
Get the total number of values in the array.
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
bool DoComputeVectorRange(A *, R[2], AllValues, const unsigned char *ghosts, unsigned char ghostsToSkip)
void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
void InsertVariantValue(vtkIdType valueIdx, vtkVariant value) override
Insert a value into the array from a variant.
double * GetTuple(vtkIdType tupleIdx) override
Get the data tuple at tupleIdx.
vtkIdType Capacity()
Return the capacity in typeof T units of the current array.
bool ComputeFiniteVectorValueRange(ValueType range[2], const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Returns true if the range was computed.
Array-Of-Structs implementation of vtkGenericDataArray.
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.
list of point or cell ids
vtkVariant GetVariantValue(vtkIdType valueIdx) override
Retrieve value from the array as a variant.
bool AllocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
abstract superclass for arrays of numeric data
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
vtkTemplateTypeMacro(SelfType, vtkDataArray)
virtual void FillValue(ValueType value)
Set all the values in array to value.
void * WriteVoidPointer(vtkIdType valueIdx, vtkIdType numValues) override
Default implementation raises a runtime error.
ValueType * WritePointer(vtkIdType valueIdx, vtkIdType numValues)
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 ...
Abstract superclass to iterate over elements in an vtkAbstractArray.
void ClearLookup() override
Delete the associated fast lookup data structure on this array, if it exists.
vtkIdType GetNumberOfTuples() const
Get the number of complete tuples (a component group) in the array.
#define VTK_SIZEHINT(...)
void GetTuples(vtkIdList *tupleIds, vtkAbstractArray *output) override
Given a list of tuple ids, return an array of tuples.
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.
void GetValueRange(ValueType range[2])
~vtkGenericDataArray() override
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
void DataChanged() override
Tell the array explicitly that the data has changed.
int GetDataTypeSize() const override
Return the size of the underlying data type.
void * GetVoidPointer(vtkIdType valueIdx) override
Default implementation raises a runtime error.
#define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType)
bool DoComputeScalarRange(A *, R *, T, const unsigned char *ghosts, unsigned char ghostsToSkip)
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
Set this array's tuple at tupleIdx to the values in tuple.
std::vector< ValueType > LegacyValueRange
void ComputeFiniteValueRange(ValueType range[2], int comp, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Compute the range for a specific component.
double GetComponent(vtkIdType tupleIdx, int compIdx) override
Return the data component at the location specified by tupleIdx and compIdx.
vtkIdType LookupValue(vtkVariant value) override
Return the value indices where a specific value appears.
int GetDataType() const override
Return the underlying data type.
std::vector< double > LegacyTuple
virtual void FillTypedComponent(int compIdx, ValueType value)
Set component comp of all tuples to value.
void ComputeValueRange(ValueType range[2], int comp, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Compute the range for a specific component.
void InsertTypedTuple(vtkIdType tupleIdx, const ValueType *t)
Insert (memory allocation performed) the tuple t at tupleIdx.
void InsertComponent(vtkIdType tupleIdx, int compIdx, double value) override
Insert value at the location specified by tupleIdx and compIdx.
bool ReallocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
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)
void SetNumberOfComponents(int num) override
Set/Get the dimension (n) of the components.
vtkTypeBool Resize(vtkIdType numTuples) override
Resize the array to the requested number of tuples and preserve data.
void InsertTuples(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray *source) override
See documentation from parent class.
Template defining traits of native types used by VTK.
bool EnsureAccessToTuple(vtkIdType tupleIdx)
void InsertTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType val)
Insert (memory allocation performed) the value at the specified tuple and component location...
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Get component compIdx of the tuple at tupleIdx.