VTK  9.3.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
66 #ifndef vtkGenericDataArray_h
67 #define vtkGenericDataArray_h
68 
69 #include "vtkDataArray.h"
70 
71 #include "vtkCompiler.h" // for VTK_USE_EXTERN_TEMPLATE
73 #include "vtkSmartPointer.h"
74 #include "vtkTypeTraits.h"
75 
76 #include <cassert>
77 
78 VTK_ABI_NAMESPACE_BEGIN
79 template <class DerivedT, class ValueTypeT>
81 {
83 
84 public:
85  typedef ValueTypeT ValueType;
87 
91  enum
92  {
94  };
95 
100 
108  inline ValueType GetValue(vtkIdType valueIdx) const
109  {
110  return static_cast<const DerivedT*>(this)->GetValue(valueIdx);
111  }
112 
121  VTK_EXPECTS(0 <= valueIdx && valueIdx < GetNumberOfValues())
122  {
123  static_cast<DerivedT*>(this)->SetValue(valueIdx, value);
124  }
125 
134  void GetTypedTuple(vtkIdType tupleIdx, ValueType* tuple) const
135  VTK_EXPECTS(0 <= tupleIdx && tupleIdx < GetNumberOfTuples())
136  {
137  static_cast<const DerivedT*>(this)->GetTypedTuple(tupleIdx, tuple);
138  }
139 
148  void SetTypedTuple(vtkIdType tupleIdx, const ValueType* tuple)
149  VTK_EXPECTS(0 <= tupleIdx && tupleIdx < GetNumberOfTuples())
150  {
151  static_cast<DerivedT*>(this)->SetTypedTuple(tupleIdx, tuple);
152  }
153 
159  ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const VTK_EXPECTS(0 <= tupleIdx &&
160  tupleIdx < GetNumberOfTuples()) VTK_EXPECTS(0 <= compIdx && compIdx < GetNumberOfComponents())
161  {
162  return static_cast<const DerivedT*>(this)->GetTypedComponent(tupleIdx, compIdx);
163  }
164 
170  void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
171  VTK_EXPECTS(0 <= tupleIdx && tupleIdx < GetNumberOfTuples())
172  VTK_EXPECTS(0 <= compIdx && compIdx < GetNumberOfComponents())
173  {
174  static_cast<DerivedT*>(this)->SetTypedComponent(tupleIdx, compIdx, value);
175  }
176 
178 
182  void* GetVoidPointer(vtkIdType valueIdx) override;
184  void SetVoidArray(void*, vtkIdType, int) override;
185  void SetVoidArray(void*, vtkIdType, int, int) override;
186  void SetArrayFreeFunction(void (*callback)(void*)) override;
187  void* WriteVoidPointer(vtkIdType valueIdx, vtkIdType numValues) override;
188  ValueType* WritePointer(vtkIdType valueIdx, vtkIdType numValues);
190 
197  void RemoveTuple(vtkIdType tupleIdx) override;
198 
203 
208 
212  void InsertTypedTuple(vtkIdType tupleIdx, const ValueType* t);
213 
218 
223  void InsertTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType val);
224 
226 
238  ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
239  void GetValueRange(ValueType range[2], int comp);
242 
248  void GetValueRange(ValueType range[2]) { this->GetValueRange(range, 0); }
249 
256  ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
257  void GetFiniteValueRange(ValueType range[2], int comp);
260  void GetFiniteValueRange(ValueType range[2]) { this->GetFiniteValueRange(range, 0); }
267  vtkIdType Capacity() { return this->Size; }
268 
272  virtual void FillTypedComponent(int compIdx, ValueType value);
273 
277  virtual void FillValue(ValueType value);
278 
279  int GetDataType() const override;
280  int GetDataTypeSize() const override;
281  bool HasStandardMemoryLayout() const override;
282  vtkTypeBool Allocate(vtkIdType size, vtkIdType ext = 1000) override;
283  vtkTypeBool Resize(vtkIdType numTuples) override;
284  void SetNumberOfComponents(int num) override;
285  void SetNumberOfTuples(vtkIdType number) override;
286  void Initialize() override;
287  void Squeeze() override;
288  void SetTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray* source) override;
289  // MSVC doesn't like 'using' here (error C2487). Just forward instead:
290  // using Superclass::SetTuple;
291  void SetTuple(vtkIdType tupleIdx, const float* tuple) override
292  {
293  this->Superclass::SetTuple(tupleIdx, tuple);
294  }
295  void SetTuple(vtkIdType tupleIdx, const double* tuple) override
296  {
297  this->Superclass::SetTuple(tupleIdx, tuple);
298  }
299 
301  vtkIdType dstStart, vtkIdList* srcIds, vtkAbstractArray* source) override;
302  void InsertTuples(vtkIdList* dstIds, vtkIdList* srcIds, vtkAbstractArray* source) override;
303  // MSVC doesn't like 'using' here (error C2487). Just forward instead:
304  // using Superclass::InsertTuples;
306  vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray* source) override
307  {
308  this->Superclass::InsertTuples(dstStart, n, srcStart, source);
309  }
310 
311  void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray* source) override;
312  void InsertTuple(vtkIdType tupleIdx, const float* source) override;
313  void InsertTuple(vtkIdType tupleIdx, const double* source) override;
314  void InsertComponent(vtkIdType tupleIdx, int compIdx, double value) override;
316  vtkIdType InsertNextTuple(const float* tuple) override;
317  vtkIdType InsertNextTuple(const double* tuple) override;
318  void GetTuples(vtkIdList* tupleIds, vtkAbstractArray* output) override;
319  void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray* output) override;
320  double* GetTuple(vtkIdType tupleIdx) override;
321  void GetTuple(vtkIdType tupleIdx, double* tuple) override;
323  double* weights) override;
324  void InterpolateTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx1, vtkAbstractArray* source1,
325  vtkIdType srcTupleIdx2, vtkAbstractArray* source2, double t) override;
326  void SetComponent(vtkIdType tupleIdx, int compIdx, double value) override;
327  double GetComponent(vtkIdType tupleIdx, int compIdx) override;
328  void SetVariantValue(vtkIdType valueIdx, vtkVariant value) override;
330  void InsertVariantValue(vtkIdType valueIdx, vtkVariant value) override;
333  void LookupValue(vtkVariant value, vtkIdList* valueIds) override;
334  virtual void LookupTypedValue(ValueType value, vtkIdList* valueIds);
335  void ClearLookup() override;
336  void DataChanged() override;
337  void FillComponent(int compIdx, double value) override;
339 
340 protected:
343 
349  inline bool AllocateTuples(vtkIdType numTuples)
350  {
351  return static_cast<DerivedT*>(this)->AllocateTuples(numTuples);
352  }
353 
359  inline 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.
367 
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 VTK_ABI_NAMESPACE_END
431 
432 // these predeclarations are needed before the .txx include for MinGW
433 namespace vtkDataArrayPrivate
434 {
435 VTK_ABI_NAMESPACE_BEGIN
436 template <typename A, typename R, typename T>
437 VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(
438  A*, R*, T, const unsigned char* ghosts, unsigned char ghostsToSkip);
439 template <typename A, typename R>
440 VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
441  A*, R[2], AllValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
442 template <typename A, typename R>
443 VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
444  A*, R[2], FiniteValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
445 VTK_ABI_NAMESPACE_END
446 } // namespace vtkDataArrayPrivate
447 
448 #include "vtkGenericDataArray.txx"
449 
450 // Adds an implementation of NewInstanceInternal() that returns an AoS
451 // (unmapped) VTK array, if possible. This allows the pipeline to copy and
452 // propagate the array when the array data is not modifiable. Use this in
453 // combination with vtkAbstractTypeMacro or vtkAbstractTemplateTypeMacro
454 // (instead of vtkTypeMacro) to avoid adding the default NewInstance
455 // implementation.
456 #define vtkAOSArrayNewInstanceMacro(thisClass) \
457 protected: \
458  vtkObjectBase* NewInstanceInternal() const override \
459  { \
460  if (vtkDataArray* da = vtkDataArray::CreateDataArray(thisClass::VTK_DATA_TYPE)) \
461  { \
462  return da; \
463  } \
464  return thisClass::New(); \
465  } \
466  \
467 public:
468 
469 #endif
470 
471 // This portion must be OUTSIDE the include blockers. This is used to tell
472 // libraries other than vtkCommonCore that instantiations of
473 // the GetValueRange lookups can be found externally. This prevents each library
474 // from instantiating these on their own.
475 // Additionally it helps hide implementation details that pull in system
476 // headers.
477 // We only provide these specializations for the 64-bit integer types, since
478 // other types can reuse the double-precision mechanism in
479 // vtkDataArray::GetRange without losing precision.
480 #ifdef VTK_GDA_VALUERANGE_INSTANTIATING
481 
482 // Forward declare necessary stuffs:
483 VTK_ABI_NAMESPACE_BEGIN
484 template <typename ValueType>
486 template <typename ValueType>
488 
489 #ifdef VTK_USE_SCALED_SOA_ARRAYS
490 template <typename ValueType>
492 #endif
493 VTK_ABI_NAMESPACE_END
494 
495 #define VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
496  template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
497  ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
498  template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
499  vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
500  template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
501  vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
502  template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
503  vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
504 
505 #ifdef VTK_USE_SCALED_SOA_ARRAYS
506 
507 #define VTK_INSTANTIATE_VALUERANGE_VALUETYPE(ValueType) \
508  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
509  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) \
510  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<ValueType>, ValueType)
511 
512 #else // VTK_USE_SCALED_SOA_ARRAYS
513 
514 #define VTK_INSTANTIATE_VALUERANGE_VALUETYPE(ValueType) \
515  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
516  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
517 
518 #endif
519 
520 #elif defined(VTK_USE_EXTERN_TEMPLATE) // VTK_GDA_VALUERANGE_INSTANTIATING
521 
522 #ifndef VTK_GDA_TEMPLATE_EXTERN
523 #define VTK_GDA_TEMPLATE_EXTERN
524 #ifdef _MSC_VER
525 #pragma warning(push)
526 // The following is needed when the following is declared
527 // dllexport and is used from another class in vtkCommonCore
528 #pragma warning(disable : 4910) // extern and dllexport incompatible
529 #endif
530 
531 VTK_ABI_NAMESPACE_BEGIN
532 // Forward declare necessary stuffs:
533 template <typename ValueType>
535 template <typename ValueType>
537 
538 #ifdef VTK_USE_SCALED_SOA_ARRAYS
539 template <typename ValueType>
541 #endif
542 
543 VTK_ABI_NAMESPACE_END
544 
545 namespace vtkDataArrayPrivate
546 {
547 VTK_ABI_NAMESPACE_BEGIN
548 template <typename A, typename R, typename T>
549 VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(
550  A*, R*, T, const unsigned char* ghosts, unsigned char ghostsToSkip);
551 template <typename A, typename R>
552 VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
553  A*, R[2], AllValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
554 template <typename A, typename R>
555 VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
556  A*, R[2], FiniteValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
557 VTK_ABI_NAMESPACE_END
558 } // namespace vtkDataArrayPrivate
559 
560 #define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
561  extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
562  ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
563  extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
564  vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
565  extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
566  vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
567  extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
568  vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
569 
570 #ifdef VTK_USE_SCALED_SOA_ARRAYS
571 
572 #define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType) \
573  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
574  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) \
575  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<ValueType>, ValueType)
576 
577 #else // VTK_USE_SCALED_SOA_ARRAYS
578 
579 #define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType) \
580  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
581  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
582 
583 #endif
584 
585 namespace vtkDataArrayPrivate
586 {
587 VTK_ABI_NAMESPACE_BEGIN
588 // These are instantiated in vtkGenericDataArrayValueRange${i}.cxx
592 VTK_DECLARE_VALUERANGE_VALUETYPE(unsigned long long)
593 
594 // This is instantiated in vtkGenericDataArray.cxx
596 
597 // These are instantiated in vtkFloatArray.cxx, vtkDoubleArray.cxx, etc
611 
612 // These are instantiated in vtkSOADataArrayTemplateInstantiate${i}.cxx
626 
627 // These are instantiated in vtkScaledSOADataArrayTemplateInstantiate${i}.cxx
628 #ifdef VTK_USE_SCALED_SOA_ARRAYS
642 #endif // VTK_USE_SCALED_SOA_ARRAYS
643 
644 VTK_ABI_NAMESPACE_END
645 } // namespace vtkDataArrayPrivate
646 
647 #undef VTK_DECLARE_VALUERANGE_ARRAYTYPE
648 #undef VTK_DECLARE_VALUERANGE_VALUETYPE
649 
650 #ifdef _MSC_VER
651 #pragma warning(pop)
652 #endif
653 #endif // VTK_GDA_TEMPLATE_EXTERN
654 
655 #endif // VTK_GDA_VALUERANGE_INSTANTIATING
656 
657 // VTK-HeaderTest-Exclude: vtkGenericDataArray.h
Array-Of-Structs implementation of vtkGenericDataArray.
Abstract superclass for all arrays.
int GetNumberOfComponents() const
Set/Get the dimension (n) of the components.
vtkIdType GetNumberOfTuples() const
Get the number of complete tuples (a component group) in the array.
vtkIdType GetNumberOfValues() const
Get the total number of values in the array.
Abstract superclass to iterate over elements in an vtkAbstractArray.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
internal class used by vtkGenericDataArray to support LookupValue.
Base interface for all typed vtkDataArray subclasses.
ValueType * WritePointer(vtkIdType valueIdx, vtkIdType numValues)
Default implementation raises a runtime error.
vtkTypeBool Allocate(vtkIdType size, vtkIdType ext=1000) override
Allocate memory for this array.
virtual void FillValue(ValueType value)
Set all the values in array to value.
std::vector< ValueType > LegacyValueRange
void SetNumberOfComponents(int num) override
Set/Get the dimension (n) of the components.
void DataChanged() override
Tell the array explicitly that the data has changed.
ValueType * GetValueRange(int comp)
Get the range of array values for the given 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.
void ComputeValueRange(ValueType range[2], int comp, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Compute the range for a specific component.
vtkIdType LookupValue(vtkVariant value) override
Return the value indices where a specific value appears.
double GetComponent(vtkIdType tupleIdx, int compIdx) override
Return the data component at the location specified by tupleIdx and compIdx.
void InsertVariantValue(vtkIdType valueIdx, vtkVariant value) override
Insert a value into the array from a variant.
void SetTuple(vtkIdType tupleIdx, const double *tuple) override
Set the data tuple at tupleIdx.
std::vector< ValueType > LegacyValueRangeFull
void InsertTuple(vtkIdType tupleIdx, const float *source) override
Insert the data tuple at tupleIdx.
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 RemoveTuple(vtkIdType tupleIdx) override
Removes a tuple at the given index.
void InsertTypedTuple(vtkIdType tupleIdx, const ValueType *t)
Insert (memory allocation performed) the tuple t at tupleIdx.
void SetNumberOfTuples(vtkIdType number) override
Set the number of tuples (a component group) in the array.
void * WriteVoidPointer(vtkIdType valueIdx, vtkIdType numValues) override
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 ...
vtkTypeBool Resize(vtkIdType numTuples) override
Resize the array to the requested number of tuples and preserve data.
void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
vtkTemplateTypeMacro(SelfType, vtkDataArray)
void FillComponent(int compIdx, double value) override
Fill a component of a data array with a specified value.
void GetValueRange(ValueType range[2], int comp)
Get the range of array values for the given component in the native data type.
void GetValueRange(ValueType range[2])
void GetFiniteValueRange(ValueType range[2], int comp, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
These methods are analogous to the GetValueRange methods, except that the only consider finite values...
double * GetTuple(vtkIdType tupleIdx) override
Get the data tuple at tupleIdx.
void SetVoidArray(void *, vtkIdType, int, int) override
Default implementation raises a runtime error.
vtkIdType Capacity()
Return the capacity in typeof T units of the current array.
void SetVariantValue(vtkIdType valueIdx, vtkVariant value) override
Set a value in the array from a variant.
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.
void InsertTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType val)
Insert (memory allocation performed) the value at the specified tuple and component location.
void ClearLookup() override
Delete the associated fast lookup data structure on this array, if it exists.
void GetTuple(vtkIdType tupleIdx, double *tuple) override
Get the data tuple at tupleIdx by filling in a user-provided array, Make sure that your array is larg...
vtkIdType InsertNextTuple(vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
virtual void LookupTypedValue(ValueType value, vtkIdList *valueIds)
vtkIdType InsertNextTuple(const double *tuple) override
Insert the data tuple at the end of the array and return the tuple index at which the data was insert...
void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output) override
Get the tuples for the range of tuple ids specified (i.e., p1->p2 inclusive).
void SetVoidArray(void *, vtkIdType, int) 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...
void GetValueRange(ValueType range[2], int comp, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Get the range of array values for the given component in the native data type.
vtkIdType InsertNextTuple(const float *tuple) override
Insert the data tuple at the end of the array and return the tuple index at which the data was insert...
virtual vtkIdType LookupTypedValue(ValueType value)
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,...
int GetDataTypeSize() const override
Return the size of the underlying data type.
void ComputeFiniteValueRange(ValueType range[2], int comp, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Compute the range for a specific component.
void SetArrayFreeFunction(void(*callback)(void *)) override
Default implementation raises a runtime error.
bool ComputeVectorValueRange(ValueType range[2], const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Returns true if the range was computed.
void GetFiniteValueRange(ValueType range[2], int comp)
These methods are analogous to the GetValueRange methods, except that the only consider finite values...
bool ComputeFiniteVectorValueRange(ValueType range[2], const unsigned char *ghosts, unsigned char ghostsToSkip=0xff)
Returns true if the range was computed.
void SetTuple(vtkIdType tupleIdx, const float *tuple) override
Set the data tuple at tupleIdx.
~vtkGenericDataArray() override
void LookupValue(vtkVariant value, vtkIdList *valueIds) override
Return the value indices where a specific value appears.
void InsertValue(vtkIdType valueIdx, ValueType value)
Insert data at a specified position in the array.
ValueType * GetPointer(vtkIdType valueIdx)
Default implementation raises a runtime error.
void InterpolateTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx1, vtkAbstractArray *source1, vtkIdType srcTupleIdx2, vtkAbstractArray *source2, double t) override
Insert the tuple at dstTupleIdx in this array to the tuple interpolated from the two tuple indices,...
void InsertTuple(vtkIdType tupleIdx, const double *source) override
Insert the data tuple at tupleIdx.
void * GetVoidPointer(vtkIdType valueIdx) override
Default implementation raises a runtime error.
ValueType * GetFiniteValueRange(int comp)
These methods are analogous to the GetValueRange methods, except that the only consider finite values...
void InsertTuples(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray *source) override
See documentation from parent class.
void GetFiniteValueRange(ValueType range[2])
These methods are analogous to the GetValueRange methods, except that the only consider finite values...
vtkArrayIterator * NewIterator() override
Subclasses must override this method and provide the right kind of templated vtkArrayIteratorTemplate...
void Squeeze() override
Free any unnecessary memory.
bool EnsureAccessToTuple(vtkIdType tupleIdx)
vtkGenericDataArrayLookupHelper< SelfType > Lookup
std::vector< double > LegacyTuple
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
int GetDataType() const override
Return the underlying data type.
void GetTuples(vtkIdList *tupleIds, vtkAbstractArray *output) override
Given a list of tuple ids, return an array of tuples.
void SetComponent(vtkIdType tupleIdx, int compIdx, double value) override
Set the data component at the location specified by tupleIdx and compIdx to value.
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.
vtkIdType InsertNextTypedTuple(const ValueType *t)
Insert (memory allocation performed) the tuple onto the end of the array.
void SetTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
void Initialize() override
Release storage and reset array to initial state.
list of point or cell ids
Definition: vtkIdList.h:32
Struct-Of-Arrays implementation of vtkGenericDataArray.
Struct-Of-Arrays implementation of vtkGenericDataArray with a scaling factor.
A type representing the union of many types.
Definition: vtkVariant.h:62
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
Set component compIdx of the tuple at tupleIdx to value.
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
Set this array's tuple at tupleIdx to the values in tuple.
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
bool ReallocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Get component compIdx of the tuple at tupleIdx.
bool AllocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
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)
@ value
Definition: vtkX3D.h:220
@ range
Definition: vtkX3D.h:238
@ size
Definition: vtkX3D.h:253
Template defining traits of native types used by VTK.
Definition: vtkTypeTraits.h:23
int vtkTypeBool
Definition: vtkABI.h:64
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType)
#define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType)
int vtkIdType
Definition: vtkType.h:315
#define VTK_SIZEHINT(...)
#define VTK_EXPECTS(x)
#define VTK_NEWINSTANCE