66 #ifndef vtkGenericDataArray_h 67 #define vtkGenericDataArray_h 71 #include "vtkConfigure.h" 78 template <
class DerivedT,
class ValueTypeT>
109 return static_cast<const DerivedT*
>(
this)->
GetValue(valueIdx);
136 static_cast<const DerivedT*
>(
this)->
GetTypedTuple(tupleIdx, tuple);
150 static_cast<DerivedT*
>(
this)->
SetTypedTuple(tupleIdx, tuple);
281 this->Superclass::SetTuple(tupleIdx, tuple);
285 this->Superclass::SetTuple(tupleIdx, tuple);
294 this->Superclass::InsertTuples(dstStart, n, srcStart,
source);
309 double* weights)
override;
414 template <
typename A,
typename R,
typename T>
416 template <
typename A,
typename R>
418 template <
typename A,
typename R>
422 #include "vtkGenericDataArray.txx" 430 #define vtkAOSArrayNewInstanceMacro(thisClass) \ 432 vtkObjectBase* NewInstanceInternal() const override \ 434 if (vtkDataArray* da = vtkDataArray::CreateDataArray(thisClass::VTK_DATA_TYPE)) \ 438 return thisClass::New(); \ 454 #ifdef VTK_GDA_VALUERANGE_INSTANTIATING 457 template <
typename ValueType>
459 template <
typename ValueType>
462 #ifdef VTK_USE_SCALED_SOA_ARRAYS 463 template <
typename ValueType>
467 #define VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \ 468 template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \ 469 ArrayType*, ValueType*, vtkDataArrayPrivate::vtkAllValues); \ 470 template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \ 471 ArrayType*, ValueType*, vtkDataArrayPrivate::FiniteValues); \ 472 template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange( \ 473 ArrayType*, ValueType[2], vtkDataArrayPrivate::vtkAllValues); \ 474 template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange( \ 475 ArrayType*, ValueType[2], vtkDataArrayPrivate::FiniteValues); 477 #ifdef VTK_USE_SCALED_SOA_ARRAYS 479 #define VTK_INSTANTIATE_VALUERANGE_VALUETYPE(ValueType) \ 480 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \ 481 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) \ 482 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<ValueType>, ValueType) 484 #else // VTK_USE_SCALED_SOA_ARRAYS 486 #define VTK_INSTANTIATE_VALUERANGE_VALUETYPE(ValueType) \ 487 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \ 488 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) 492 #elif defined(VTK_USE_EXTERN_TEMPLATE) // VTK_GDA_VALUERANGE_INSTANTIATING 494 #ifndef VTK_GDA_TEMPLATE_EXTERN 495 #define VTK_GDA_TEMPLATE_EXTERN 497 #pragma warning(push) 500 #pragma warning(disable : 4910) // extern and dllexport incompatible 504 template <
typename ValueType>
506 template <
typename ValueType>
509 #ifdef VTK_USE_SCALED_SOA_ARRAYS 510 template <
typename ValueType>
516 template <
typename A,
typename R,
typename T>
518 template <
typename A,
typename R>
520 template <
typename A,
typename R>
524 #define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \ 525 extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \ 526 ArrayType*, ValueType*, vtkDataArrayPrivate::vtkAllValues); \ 527 extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \ 528 ArrayType*, ValueType*, vtkDataArrayPrivate::FiniteValues); \ 529 extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange( \ 530 ArrayType*, ValueType[2], vtkDataArrayPrivate::vtkAllValues); \ 531 extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange( \ 532 ArrayType*, ValueType[2], vtkDataArrayPrivate::FiniteValues); 534 #ifdef VTK_USE_SCALED_SOA_ARRAYS 536 #define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType) \ 537 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \ 538 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) \ 539 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<ValueType>, ValueType) 541 #else // VTK_USE_SCALED_SOA_ARRAYS 543 #define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType) \ 544 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \ 545 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) 551 VTK_DECLARE_VALUERANGE_VALUETYPE(
long)
552 VTK_DECLARE_VALUERANGE_VALUETYPE(
unsigned long)
553 VTK_DECLARE_VALUERANGE_VALUETYPE(
long long)
554 VTK_DECLARE_VALUERANGE_VALUETYPE(
unsigned long long)
558 #undef VTK_DECLARE_VALUERANGE_ARRAYTYPE 559 #undef VTK_DECLARE_VALUERANGE_VALUETYPE 564 #endif // VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN 566 #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.
void SetTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
Set the tuple at dstTupleIdx in this array to the tuple at srcTupleIdx in the source array...
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...
vtkIdType GetNumberOfValues() const
Get the total number of values in the array.
vtkIdType GetNumberOfTuples() const
Get the number of complete tuples (a component group) in the array.
bool ComputeVectorValueRange(ValueType range[2])
Returns true if the range was computed.
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Get component compIdx of the tuple at tupleIdx.
void InsertValue(vtkIdType valueIdx, ValueType value)
Insert data at a specified position in the array.
vtkIdType InsertNextTuple(vtkIdType srcTupleIdx, vtkAbstractArray *source) override
Insert the tuple from srcTupleIdx in the source array at the end of this array.
internal class used by vtkGenericDataArray to support LookupValue.
int GetNumberOfComponents() const
Set/Get the dimension (n) of the components.
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.
bool ComputeFiniteScalarValueRange(ValueType *ranges)
Computes the range for each component of an array, the length of ranges must be two times the number ...
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
bool DoComputeScalarRange(A *, R *, T)
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 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
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.
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.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph *>::edge_descriptor e, vtkGraph *)
A atomic type representing the union of many types.
void SetTuple(vtkIdType tupleIdx, const double *tuple) override
Set the data tuple at tupleIdx.
int GetDataType() const override
Return the underlying data type.
void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
Insert the tuple at srcTupleIdx in the source array into this array at dstTupleIdx.
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])
Returns true if the range was computed.
void ComputeFiniteValueRange(ValueType range[2], int comp)
Compute the range for a specific component.
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.
int GetDataTypeSize() const override
Return the size of the underlying data type.
bool AllocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
abstract superclass for arrays of numeric data
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
Copy the tuples indexed in srcIds from the source array to the tuple locations indexed by dstIds in t...
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.
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
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.
#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
void DataChanged() override
Tell the array explicitly that the data has changed.
void * GetVoidPointer(vtkIdType valueIdx) override
Default implementation raises a runtime error.
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
Set this array's tuple at tupleIdx to the values in tuple.
std::vector< ValueType > LegacyValueRange
bool ComputeScalarValueRange(ValueType *ranges)
Computes the range for each component of an array, the length of ranges must be two times the number ...
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.
std::vector< double > LegacyTuple
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...
void InsertTypedTuple(vtkIdType tupleIdx, const ValueType *t)
Insert (memory allocation performed) the tuple t at tupleIdx.
void ComputeValueRange(ValueType range[2], int comp)
Compute the range for a specific component.
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
Copy n consecutive tuples starting at srcStart from the source array to this array, starting at the dstStart location.
Template defining traits of native types used by VTK.
bool DoComputeVectorRange(A *, R[2], vtkAllValues)
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...