VTK  9.7.1
vtkGenericDataArray.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
56 #ifndef vtkGenericDataArray_h
57 #define vtkGenericDataArray_h
58 
59 #include "vtkDataArray.h"
60 
61 #include "vtkCompiler.h" // for VTK_USE_EXTERN_TEMPLATE
62 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_6_0
64 #include "vtkSmartPointer.h"
65 #include "vtkTypeTraits.h"
66 
67 #include <cassert> // for assert
68 #include <memory> // for std::unique_ptr
69 
70 VTK_ABI_NAMESPACE_BEGIN
71 template <class DerivedT, class ValueTypeT, int ArrayType = vtkArrayTypes::VTK_DATA_ARRAY>
73 {
74  static_assert(ArrayType >= vtkArrayTypes::VTK_ABSTRACT_ARRAY &&
76  "ArrayType must be a valid vtkAbstractArray::ArrayType enum value");
77 
78 public:
81  using ArrayTypeTag = std::integral_constant<int, ArrayType>;
82  using DataTypeTag = std::integral_constant<int, vtkTypeTraits<ValueTypeT>::VTK_TYPE_ID>;
83  using ValueType = ValueTypeT;
84 
88  enum
89  {
90  VTK_DATA_TYPE VTK_DEPRECATED_IN_9_6_0("Use DataTypeTag::value") =
92  };
93 
98 
106  ValueType GetValue(vtkIdType valueIdx) const
107  {
108  return static_cast<const DerivedT*>(this)->GetValue(valueIdx);
109  }
110 
119  VTK_EXPECTS(0 <= valueIdx && valueIdx < GetNumberOfValues())
120  {
121  static_cast<DerivedT*>(this)->SetValue(valueIdx, value);
122  }
123 
132  void GetTypedTuple(vtkIdType tupleIdx, ValueType* tuple) const
133  VTK_EXPECTS(0 <= tupleIdx && tupleIdx < GetNumberOfTuples())
134  {
135  static_cast<const DerivedT*>(this)->GetTypedTuple(tupleIdx, tuple);
136  }
137 
146  void SetTypedTuple(vtkIdType tupleIdx, const ValueType* tuple)
147  VTK_EXPECTS(0 <= tupleIdx && tupleIdx < GetNumberOfTuples())
148  {
149  static_cast<DerivedT*>(this)->SetTypedTuple(tupleIdx, tuple);
150  }
151 
157  ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
158  VTK_EXPECTS(0 <= tupleIdx && GetNumberOfComponents() * tupleIdx + compIdx < GetNumberOfValues())
159  VTK_EXPECTS(0 <= compIdx && compIdx < GetNumberOfComponents())
160  {
161  return static_cast<const DerivedT*>(this)->GetTypedComponent(tupleIdx, compIdx);
162  }
163 
169  void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
170  VTK_EXPECTS(0 <= tupleIdx && GetNumberOfComponents() * tupleIdx + compIdx < GetNumberOfValues())
171  VTK_EXPECTS(0 <= compIdx && compIdx < GetNumberOfComponents())
172  {
173  static_cast<DerivedT*>(this)->SetTypedComponent(tupleIdx, compIdx, value);
174  }
175 
177 
181  void* GetVoidPointer(vtkIdType valueIdx) override;
182  VTK_DEPRECATED_IN_9_7_0("Use vtkAOSDataArrayTemplate::GetPointer(valueIdx) instead")
183  ValueType* GetPointer(vtkIdType valueIdx);
184  void SetVoidArray(void*, vtkIdType, int) override;
185  void SetVoidArray(void*, vtkIdType, int, int) override;
186  void SetArrayFreeFunction(void (*callback)(void*)) override;
187  VTK_DEPRECATED_IN_9_7_0("Use vtkAOSDataArrayTemplate::WritePointer(valueIdx, numValues) or "
188  "vtkAbstractArray::SetNumberOf[Values/Tuples]() instead")
189  void* WriteVoidPointer(vtkIdType valueIdx, vtkIdType numValues) override;
190  VTK_DEPRECATED_IN_9_7_0("Use vtkAOSDataArrayTemplate::WritePointer(valueIdx, numValues) or "
191  "vtkAbstractArray::SetNumberOf[Values/Tuples]() instead")
192  ValueType* WritePointer(vtkIdType valueIdx, vtkIdType numValues);
194 
201  void RemoveTuple(vtkIdType tupleIdx) override;
202 
206  vtkIdType InsertNextValue(ValueType value);
207 
211  void InsertValue(vtkIdType valueIdx, ValueType value);
212 
216  void InsertTypedTuple(vtkIdType tupleIdx, const ValueType* t);
217 
221  vtkIdType InsertNextTypedTuple(const ValueType* t);
222 
227  void InsertTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType val);
228 
230 
241  void GetValueRange(
242  ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
243  void GetValueRange(ValueType range[2], int comp);
244  ValueType* GetValueRange(int comp) VTK_SIZEHINT(2);
246 
251  ValueType* GetValueRange() VTK_SIZEHINT(2) { return this->GetValueRange(0); }
252  void GetValueRange(ValueType range[2]) { this->GetValueRange(range, 0); }
253 
259  void GetFiniteValueRange(
260  ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
261  void GetFiniteValueRange(ValueType range[2], int comp);
270  virtual void FillTypedComponent(int compIdx, ValueType value);
271 
275  virtual void FillValue(ValueType value);
276 
277 #ifndef __VTK_WRAP__
278 
285  static DerivedT* FastDownCast(vtkAbstractArray* source);
287 #endif
288  int GetArrayType() const override;
289  int GetDataType() const override;
292  int GetDataTypeSize() const override;
293  bool HasStandardMemoryLayout() const override;
294  vtkTypeBool ReserveTuples(vtkIdType numTuples) override;
295  void SetNumberOfComponents(int num) override;
296  void Squeeze() override;
297  void SetTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray* source) override;
298  // MSVC doesn't like 'using' here (error C2487). Just forward instead:
299  // using Superclass::SetTuple;
300  void SetTuple(vtkIdType tupleIdx, const float* tuple) override
301  {
302  this->Superclass::SetTuple(tupleIdx, tuple);
303  }
304  void SetTuple(vtkIdType tupleIdx, const double* tuple) override
305  {
306  this->Superclass::SetTuple(tupleIdx, tuple);
307  }
308 
310  vtkIdType dstStart, vtkIdList* srcIds, vtkAbstractArray* source) override;
311  void InsertTuples(vtkIdList* dstIds, vtkIdList* srcIds, vtkAbstractArray* source) override;
312  // MSVC doesn't like 'using' here (error C2487). Just forward instead:
313  // using Superclass::InsertTuples;
315  vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray* source) override
316  {
317  this->Superclass::InsertTuples(dstStart, n, srcStart, source);
318  }
319 
320  void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray* source) override;
321  void InsertTuple(vtkIdType tupleIdx, const float* source) override;
322  void InsertTuple(vtkIdType tupleIdx, const double* source) override;
323  void InsertComponent(vtkIdType tupleIdx, int compIdx, double value) override;
325  vtkIdType InsertNextTuple(const float* tuple) override;
326  vtkIdType InsertNextTuple(const double* tuple) override;
327  void GetTuples(vtkIdList* tupleIds, vtkAbstractArray* output) override;
328  void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray* output) override;
329  double* GetTuple(vtkIdType tupleIdx) override;
330  void GetTuple(vtkIdType tupleIdx, double* tuple) override;
331  void InterpolateTuple(vtkIdType dstTupleIdx, vtkIdList* ptIndices, vtkAbstractArray* source,
332  double* weights) override;
333  void InterpolateTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx1, vtkAbstractArray* source1,
334  vtkIdType srcTupleIdx2, vtkAbstractArray* source2, double t) override;
335  void SetComponent(vtkIdType tupleIdx, int compIdx, double value) override;
336  double GetComponent(vtkIdType tupleIdx, int compIdx) override;
337  void SetVariantValue(vtkIdType valueIdx, vtkVariant value) override;
338  vtkVariant GetVariantValue(vtkIdType valueIdx) override;
339  void InsertVariantValue(vtkIdType valueIdx, vtkVariant value) override;
342  void LookupValue(vtkVariant value, vtkIdList* valueIds) override;
343  virtual void LookupTypedValue(ValueType value, vtkIdList* valueIds);
344  void ClearLookup() override;
345  void DataChanged() override;
346  void FillComponent(int compIdx, double value) override;
347  VTK_DEPRECATED_IN_9_7_0("Use vtk::DataArrayValueRange, or the array directly")
349 
350 protected:
352  ~vtkGenericDataArray() override;
353 
359  bool ReallocateTuples(vtkIdType numTuples)
360  {
361  return static_cast<DerivedT*>(this)->ReallocateTuples(numTuples);
362  }
363 
364  // This method resizes the array if needed so that the given tuple index is
365  // valid/accessible.
366  bool EnsureAccessToTuple(vtkIdType tupleIdx);
367 
375  void ComputeValueRange(
376  ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
377 
386  ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
387 
395  ValueType* ranges, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
396 
402  ValueType range[2], const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
403 
411  ValueType* ranges, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
412 
418  ValueType range[2], const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
419 
420  std::vector<double> LegacyTuple;
421  std::vector<ValueType> LegacyValueRange;
422  std::vector<ValueType> LegacyValueRangeFull;
423 
425 
426 private:
427  vtkGenericDataArray(const vtkGenericDataArray&) = delete;
428  void operator=(const vtkGenericDataArray&) = delete;
429 
430  struct vtkInternals;
431  std::unique_ptr<vtkInternals> Internals;
432 };
433 VTK_ABI_NAMESPACE_END
434 
435 // These macros define the vtkGenericDataArray methods that aren't redefined
436 // in vtkAOSDataArrayTemplate and vtkSOADataArrayTemplate. The wrappers do
437 // not see vtkGenericDataArray as a superclass of AOS/SOA arrays, so these
438 // macros are used to fill in the missing parts of the inherited interface.
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);
455 
456 // This macro is used by the subclasses to create dummy
457 // declarations for these functions such that the wrapper
458 // can see them. The wrappers ignore vtkGenericDataArray.
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;
471 
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);
481 
482 namespace vtkDataArrayPrivate
483 {
484 VTK_ABI_NAMESPACE_BEGIN
485 template <typename A, typename R, typename T>
486 VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(
487  A*, R*, T, const unsigned char* ghosts, unsigned char ghostsToSkip);
488 template <typename A, typename R>
489 VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
490  A*, R[2], AllValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
491 template <typename A, typename R>
492 VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
493  A*, R[2], FiniteValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
494 VTK_ABI_NAMESPACE_END
495 } // namespace vtkDataArrayPrivate
496 
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);
506 
507 #include "vtkGenericDataArray.txx"
508 
509 // Adds an implementation of NewInstanceInternal() that returns an AoS
510 // (unmapped) VTK array, if possible. This allows the pipeline to copy and
511 // propagate the array when the array data is not modifiable. Use this in
512 // combination with vtkAbstractTypeMacro or vtkAbstractTemplateTypeMacro
513 // (instead of vtkTypeMacro) to avoid adding the default NewInstance
514 // implementation.
515 #define vtkAOSArrayNewInstanceMacro(thisClass) \
516 protected: \
517  vtkObjectBase* NewInstanceInternal() const override \
518  { \
519  if (vtkDataArray* da = vtkDataArray::CreateDataArray(thisClass::DataTypeTag::value)) \
520  { \
521  return da; \
522  } \
523  return thisClass::New(); \
524  } \
525  \
526 public:
527 
528 #endif
529 
530 // This is used to tell libraries other than vtkCommonCore that instantiations of
531 // the GetValueRange lookups can be found externally. This prevents each library
532 // from instantiating these on their own.
533 // Additionally, it helps hide implementation details that pull in system
534 // headers.
535 #ifdef VTK_USE_EXTERN_TEMPLATE
536 
537 #ifndef VTK_GDA_TEMPLATE_EXTERN
538 #define VTK_GDA_TEMPLATE_EXTERN
539 #ifdef _MSC_VER
540 #pragma warning(push)
541 // The following is needed when the following is declared
542 // dllexport and is used from another class in vtkCommonCore
543 #pragma warning(disable : 4910) // extern and dllexport incompatible
544 #endif
545 
546 namespace vtkDataArrayPrivate
547 {
548 VTK_ABI_NAMESPACE_BEGIN
549 // This is instantiated in vtkGenericDataArray.cxx
551 
552 VTK_ABI_NAMESPACE_END
553 } // namespace vtkDataArrayPrivate
554 
555 #ifdef _MSC_VER
556 #pragma warning(pop)
557 #endif
558 #endif // VTK_GDA_TEMPLATE_EXTERN
559 
560 #endif // VTK_USE_EXTERN_TEMPLATE
561 
562 // VTK-HeaderTest-Exclude: vtkGenericDataArray.h
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.
int vtkIdType
Definition: vtkType.h:363
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.
Definition: vtkVariant.h:52
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...
int vtkTypeBool
Definition: vtkABI.h:64
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
Definition: vtkIdList.h:25
ValueType * GetPointer(vtkIdType valueIdx)
Default implementation raises a runtime error.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
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 *)
#define VTK_NEWINSTANCE
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_EXPECTS(x)
#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.
Definition: vtkTypeTraits.h:25
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...