Go to the documentation of this file.
66 #ifndef vtkGenericDataArray_h
67 #define vtkGenericDataArray_h
76 template<
class DerivedT,
class ValueTypeT>
103 return static_cast<const DerivedT*>(
this)->GetValue(valueIdx);
115 static_cast<DerivedT*>(
this)->SetValue(valueIdx,
value);
128 static_cast<const DerivedT*>(
this)->GetTypedTuple(tupleIdx, tuple);
141 static_cast<DerivedT*>(
this)->SetTypedTuple(tupleIdx, tuple);
151 return static_cast<const DerivedT*>(
this)->GetTypedComponent(tupleIdx,
163 static_cast<DerivedT*>(
this)->SetTypedComponent(tupleIdx, compIdx,
value);
249 { this->Superclass::SetTuple(tupleIdx, tuple); }
251 { this->Superclass::SetTuple(tupleIdx, tuple); }
259 { this->Superclass::InsertTuples(dstStart, n, srcStart,
source); }
266 double value) VTK_OVERRIDE;
279 double* weights) VTK_OVERRIDE;
307 return static_cast<DerivedT*>(
this)->AllocateTuples(numTuples);
317 return static_cast<DerivedT*>(
this)->ReallocateTuples(numTuples);
329 std::vector<double> LegacyTuple;
330 std::vector<ValueType> LegacyValueRange;
333 #include "vtkGenericDataArray.txx"
341 #define vtkAOSArrayNewInstanceMacro(thisClass) \
343 vtkObjectBase *NewInstanceInternal() const VTK_OVERRIDE \
345 if (vtkDataArray *da = \
346 vtkDataArray::CreateDataArray(thisClass::VTK_DATA_TYPE)) \
350 return thisClass::New(); \
virtual vtkIdType LookupTypedValue(ValueType value)
void Squeeze() override
Free any unnecessary memory.
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
void ClearLookup() override
Delete the associated fast lookup data structure on this array, if it exists.
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Get component compIdx of the tuple at tupleIdx.
internal class used by vtkGenericDataArray to support LookupValue.
Template defining traits of native types used by VTK.
int GetDataTypeSize() override
Return the size of the underlying data type.
void SetVariantValue(vtkIdType valueIdx, vtkVariant value) override
Set a value in the array from a variant.
void InsertTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType val)
Insert (memory allocation performed) the value at the specified tuple and component location.
void * GetVoidPointer(vtkIdType valueIdx) override
Default implementation raises a runtime error.
void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
Insert the tuple at srcTupleIdx in the source array into this array at dstTupleIdx.
void SetVoidArray(void *, vtkIdType, int) override
double GetComponent(vtkIdType tupleIdx, int compIdx) override
Return the data component at the location specified by tupleIdx and compIdx.
void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
Set component compIdx of the tuple at tupleIdx to value.
vtkIdType InsertNextTuple(vtkIdType srcTupleIdx, vtkAbstractArray *source) override
Insert the tuple from srcTupleIdx in the source array at the end of this array.
Base interface for all typed vtkDataArray subclasses.
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
abstract superclass for arrays of numeric data
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.
vtkGenericDataArrayLookupHelper< SelfType > Lookup
double * GetTuple(vtkIdType tupleIdx) override
Get the data tuple at tupleIdx.
void InsertTypedTuple(vtkIdType tupleIdx, const ValueType *t)
Insert (memory allocation performed) the tuple t at tupleIdx.
void DataChanged() override
Tell the array explicitly that the data has changed.
ValueType * GetValueRange()
Get the range of array values for the 0th component in the native data type.
vtkVariant GetVariantValue(vtkIdType valueIdx) override
Retrieve value from the array as a variant.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
int Resize(vtkIdType numTuples) override
Resize the array to the requested number of tuples and preserve 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...
void SetNumberOfTuples(vtkIdType number) override
Set the number of tuples (a component group) in the array.
bool AllocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
vtkTemplateTypeMacro(SelfType, vtkDataArray) enum
Compile time access to the VTK type identifier.
int Allocate(vtkIdType size, vtkIdType ext=1000) override
Allocate memory for this array.
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
VTK_NEWINSTANCE 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.
A atomic type representing the union of many types.
list of point or cell ids
bool EnsureAccessToTuple(vtkIdType tupleIdx)
void InsertValue(vtkIdType valueIdx, ValueType value)
Insert data at a specified position in the array.
vtkIdType InsertNextTypedTuple(const ValueType *t)
Insert (memory allocation performed) the tuple onto the end of the array.
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
Set this array's tuple at tupleIdx to the values in tuple.
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])
Abstract superclass for all arrays.
void GetTuples(vtkIdList *tupleIds, vtkAbstractArray *output) override
Given a list of tuple ids, return an array of tuples.
void InsertComponent(vtkIdType tupleIdx, int compIdx, double value) override
Insert value at the location specified by tupleIdx and compIdx.
ValueType * WritePointer(vtkIdType valueIdx, vtkIdType numValues)
void InsertVariantValue(vtkIdType valueIdx, vtkVariant value) override
Insert a value into the array from a variant.
Abstract superclass to iterate over elements in an vtkAbstractArray.
vtkIdType Capacity()
Return the capacity in typeof T units of the current array.
int GetDataType() override
Return the underlying data type.
void SetTuple(vtkIdType tupleIdx, const double *tuple) override
ValueType * GetPointer(vtkIdType valueIdx)
vtkIdType LookupValue(vtkVariant value) override
Return the value indices where a specific value appears.
void * WriteVoidPointer(vtkIdType valueIdx, vtkIdType numValues) override
Get the address of a particular data index.
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,...
bool HasStandardMemoryLayout() override
Returns true if this array uses the standard memory layout defined in the VTK user guide,...
vtkIdType InsertNextValue(ValueType value)
Insert data at the end of the array.
void Initialize() override
Release storage and reset array to initial state.
bool ReallocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
void SetNumberOfComponents(int num) override
Set/Get the dimension (n) of the components.
void SetComponent(vtkIdType tupleIdx, int compIdx, double value) override
Set the data component at the location specified by tupleIdx and compIdx to value.