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
57 #ifndef vtkGenericDataArray_h
58 #define vtkGenericDataArray_h
59 
60 #include "vtkDataArray.h"
61 
62 #include "vtkCompiler.h" // for VTK_USE_EXTERN_TEMPLATE
64 #include "vtkSmartPointer.h"
65 #include "vtkTypeTraits.h"
66 
67 #include <cassert>
68 
69 VTK_ABI_NAMESPACE_BEGIN
70 template <class DerivedT, class ValueTypeT>
72 {
74 
75 public:
76  typedef ValueTypeT ValueType;
78 
82  enum
83  {
85  };
86 
91 
99  inline ValueType GetValue(vtkIdType valueIdx) const
100  {
101  return static_cast<const DerivedT*>(this)->GetValue(valueIdx);
102  }
103 
111  void SetValue(vtkIdType valueIdx, ValueType value)
112  VTK_EXPECTS(0 <= valueIdx && valueIdx < GetNumberOfValues())
113  {
114  static_cast<DerivedT*>(this)->SetValue(valueIdx, value);
115  }
116 
125  void GetTypedTuple(vtkIdType tupleIdx, ValueType* tuple) const
126  VTK_EXPECTS(0 <= tupleIdx && tupleIdx < GetNumberOfTuples())
127  {
128  static_cast<const DerivedT*>(this)->GetTypedTuple(tupleIdx, tuple);
129  }
130 
139  void SetTypedTuple(vtkIdType tupleIdx, const ValueType* tuple)
140  VTK_EXPECTS(0 <= tupleIdx && tupleIdx < GetNumberOfTuples())
141  {
142  static_cast<DerivedT*>(this)->SetTypedTuple(tupleIdx, tuple);
143  }
144 
150  ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const VTK_EXPECTS(0 <= tupleIdx &&
151  tupleIdx < GetNumberOfTuples()) VTK_EXPECTS(0 <= compIdx && compIdx < GetNumberOfComponents())
152  {
153  return static_cast<const DerivedT*>(this)->GetTypedComponent(tupleIdx, compIdx);
154  }
155 
161  void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
162  VTK_EXPECTS(0 <= tupleIdx && tupleIdx < GetNumberOfTuples())
163  VTK_EXPECTS(0 <= compIdx && compIdx < GetNumberOfComponents())
164  {
165  static_cast<DerivedT*>(this)->SetTypedComponent(tupleIdx, compIdx, value);
166  }
167 
169 
173  void* GetVoidPointer(vtkIdType valueIdx) override;
174  ValueType* GetPointer(vtkIdType valueIdx);
175  void SetVoidArray(void*, vtkIdType, int) override;
176  void SetVoidArray(void*, vtkIdType, int, int) override;
177  void SetArrayFreeFunction(void (*callback)(void*)) override;
178  void* WriteVoidPointer(vtkIdType valueIdx, vtkIdType numValues) override;
179  ValueType* WritePointer(vtkIdType valueIdx, vtkIdType numValues);
181 
188  void RemoveTuple(vtkIdType tupleIdx) override;
189 
193  vtkIdType InsertNextValue(ValueType value);
194 
198  void InsertValue(vtkIdType valueIdx, ValueType value);
199 
203  void InsertTypedTuple(vtkIdType tupleIdx, const ValueType* t);
204 
208  vtkIdType InsertNextTypedTuple(const ValueType* t);
209 
214  void InsertTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType val);
215 
217 
228  void GetValueRange(
229  ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
230  void GetValueRange(ValueType range[2], int comp);
231  ValueType* GetValueRange(int comp) VTK_SIZEHINT(2);
233 
238  ValueType* GetValueRange() VTK_SIZEHINT(2) { return this->GetValueRange(0); }
239  void GetValueRange(ValueType range[2]) { this->GetValueRange(range, 0); }
240 
246  void GetFiniteValueRange(
247  ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
248  void GetFiniteValueRange(ValueType range[2], int comp);
249  ValueType* GetFiniteValueRange(int comp) VTK_SIZEHINT(2);
250  ValueType* GetFiniteValueRange() VTK_SIZEHINT(2) { return this->GetFiniteValueRange(0); }
251  void GetFiniteValueRange(ValueType range[2]) { this->GetFiniteValueRange(range, 0); }
258  vtkIdType Capacity() { return this->Size; }
259 
263  virtual void FillTypedComponent(int compIdx, ValueType value);
264 
268  virtual void FillValue(ValueType value);
269 
270  int GetDataType() const override;
271  int GetDataTypeSize() const override;
272  bool HasStandardMemoryLayout() const override;
273  vtkTypeBool Allocate(vtkIdType size, vtkIdType ext = 1000) override;
274  vtkTypeBool Resize(vtkIdType numTuples) override;
275  void SetNumberOfComponents(int num) override;
276  void SetNumberOfTuples(vtkIdType number) override;
277  void Initialize() override;
278  void Squeeze() override;
279  void SetTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray* source) override;
280  // MSVC doesn't like 'using' here (error C2487). Just forward instead:
281  // using Superclass::SetTuple;
282  void SetTuple(vtkIdType tupleIdx, const float* tuple) override
283  {
284  this->Superclass::SetTuple(tupleIdx, tuple);
285  }
286  void SetTuple(vtkIdType tupleIdx, const double* tuple) override
287  {
288  this->Superclass::SetTuple(tupleIdx, tuple);
289  }
290 
292  vtkIdType dstStart, vtkIdList* srcIds, vtkAbstractArray* source) override;
293  void InsertTuples(vtkIdList* dstIds, vtkIdList* srcIds, vtkAbstractArray* source) override;
294  // MSVC doesn't like 'using' here (error C2487). Just forward instead:
295  // using Superclass::InsertTuples;
297  vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray* source) override
298  {
299  this->Superclass::InsertTuples(dstStart, n, srcStart, source);
300  }
301 
302  void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray* source) override;
303  void InsertTuple(vtkIdType tupleIdx, const float* source) override;
304  void InsertTuple(vtkIdType tupleIdx, const double* source) override;
305  void InsertComponent(vtkIdType tupleIdx, int compIdx, double value) override;
307  vtkIdType InsertNextTuple(const float* tuple) override;
308  vtkIdType InsertNextTuple(const double* tuple) override;
309  void GetTuples(vtkIdList* tupleIds, vtkAbstractArray* output) override;
310  void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray* output) override;
311  double* GetTuple(vtkIdType tupleIdx) override;
312  void GetTuple(vtkIdType tupleIdx, double* tuple) override;
313  void InterpolateTuple(vtkIdType dstTupleIdx, vtkIdList* ptIndices, vtkAbstractArray* source,
314  double* weights) override;
315  void InterpolateTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx1, vtkAbstractArray* source1,
316  vtkIdType srcTupleIdx2, vtkAbstractArray* source2, double t) override;
317  void SetComponent(vtkIdType tupleIdx, int compIdx, double value) override;
318  double GetComponent(vtkIdType tupleIdx, int compIdx) override;
319  void SetVariantValue(vtkIdType valueIdx, vtkVariant value) override;
320  vtkVariant GetVariantValue(vtkIdType valueIdx) override;
321  void InsertVariantValue(vtkIdType valueIdx, vtkVariant value) override;
323  virtual vtkIdType LookupTypedValue(ValueType value);
324  void LookupValue(vtkVariant value, vtkIdList* valueIds) override;
325  virtual void LookupTypedValue(ValueType value, vtkIdList* valueIds);
326  void ClearLookup() override;
327  void DataChanged() override;
328  void FillComponent(int compIdx, double value) override;
330 
331 protected:
333  ~vtkGenericDataArray() override;
334 
340  inline bool AllocateTuples(vtkIdType numTuples)
341  {
342  return static_cast<DerivedT*>(this)->AllocateTuples(numTuples);
343  }
344 
350  inline bool ReallocateTuples(vtkIdType numTuples)
351  {
352  return static_cast<DerivedT*>(this)->ReallocateTuples(numTuples);
353  }
354 
355  // This method resizes the array if needed so that the given tuple index is
356  // valid/accessible.
357  bool EnsureAccessToTuple(vtkIdType tupleIdx);
358 
366  void ComputeValueRange(
367  ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
368 
377  ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
378 
386  ValueType* ranges, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
387 
393  ValueType range[2], const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
394 
402  ValueType* ranges, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
403 
409  ValueType range[2], const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
410 
411  std::vector<double> LegacyTuple;
412  std::vector<ValueType> LegacyValueRange;
413  std::vector<ValueType> LegacyValueRangeFull;
414 
416 
417 private:
418  vtkGenericDataArray(const vtkGenericDataArray&) = delete;
419  void operator=(const vtkGenericDataArray&) = delete;
420 };
421 VTK_ABI_NAMESPACE_END
422 
423 // these predeclarations are needed before the .txx include for MinGW
424 namespace vtkDataArrayPrivate
425 {
426 VTK_ABI_NAMESPACE_BEGIN
427 template <typename A, typename R, typename T>
428 VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(
429  A*, R*, T, const unsigned char* ghosts, unsigned char ghostsToSkip);
430 template <typename A, typename R>
431 VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
432  A*, R[2], AllValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
433 template <typename A, typename R>
434 VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
435  A*, R[2], FiniteValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
436 VTK_ABI_NAMESPACE_END
437 } // namespace vtkDataArrayPrivate
438 
439 #include "vtkGenericDataArray.txx"
440 
441 // Adds an implementation of NewInstanceInternal() that returns an AoS
442 // (unmapped) VTK array, if possible. This allows the pipeline to copy and
443 // propagate the array when the array data is not modifiable. Use this in
444 // combination with vtkAbstractTypeMacro or vtkAbstractTemplateTypeMacro
445 // (instead of vtkTypeMacro) to avoid adding the default NewInstance
446 // implementation.
447 #define vtkAOSArrayNewInstanceMacro(thisClass) \
448 protected: \
449  vtkObjectBase* NewInstanceInternal() const override \
450  { \
451  if (vtkDataArray* da = vtkDataArray::CreateDataArray(thisClass::VTK_DATA_TYPE)) \
452  { \
453  return da; \
454  } \
455  return thisClass::New(); \
456  } \
457  \
458 public:
459 
460 #endif
461 
462 // This portion must be OUTSIDE the include blockers. This is used to tell
463 // libraries other than vtkCommonCore that instantiations of
464 // the GetValueRange lookups can be found externally. This prevents each library
465 // from instantiating these on their own.
466 // Additionally it helps hide implementation details that pull in system
467 // headers.
468 // We only provide these specializations for the 64-bit integer types, since
469 // other types can reuse the double-precision mechanism in
470 // vtkDataArray::GetRange without losing precision.
471 #ifdef VTK_GDA_VALUERANGE_INSTANTIATING
472 
473 // Forward declare necessary stuffs:
474 VTK_ABI_NAMESPACE_BEGIN
475 template <typename ValueType>
477 template <typename ValueType>
479 
480 #ifdef VTK_USE_SCALED_SOA_ARRAYS
481 template <typename ValueType>
483 #endif
484 VTK_ABI_NAMESPACE_END
485 
486 #define VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
487  template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
488  ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
489  template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
490  vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
491  template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
492  vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
493  template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
494  vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
495 
496 #ifdef VTK_USE_SCALED_SOA_ARRAYS
497 
498 #define VTK_INSTANTIATE_VALUERANGE_VALUETYPE(ValueType) \
499  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
500  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) \
501  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<ValueType>, ValueType)
502 
503 #else // VTK_USE_SCALED_SOA_ARRAYS
504 
505 #define VTK_INSTANTIATE_VALUERANGE_VALUETYPE(ValueType) \
506  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
507  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
508 
509 #endif
510 
511 #elif defined(VTK_USE_EXTERN_TEMPLATE) // VTK_GDA_VALUERANGE_INSTANTIATING
512 
513 #ifndef VTK_GDA_TEMPLATE_EXTERN
514 #define VTK_GDA_TEMPLATE_EXTERN
515 #ifdef _MSC_VER
516 #pragma warning(push)
517 // The following is needed when the following is declared
518 // dllexport and is used from another class in vtkCommonCore
519 #pragma warning(disable : 4910) // extern and dllexport incompatible
520 #endif
521 
522 VTK_ABI_NAMESPACE_BEGIN
523 // Forward declare necessary stuffs:
524 template <typename ValueType>
526 template <typename ValueType>
528 
529 #ifdef VTK_USE_SCALED_SOA_ARRAYS
530 template <typename ValueType>
532 #endif
533 
534 VTK_ABI_NAMESPACE_END
535 
536 namespace vtkDataArrayPrivate
537 {
538 VTK_ABI_NAMESPACE_BEGIN
539 template <typename A, typename R, typename T>
540 VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(
541  A*, R*, T, const unsigned char* ghosts, unsigned char ghostsToSkip);
542 template <typename A, typename R>
543 VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
544  A*, R[2], AllValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
545 template <typename A, typename R>
546 VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
547  A*, R[2], FiniteValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
548 VTK_ABI_NAMESPACE_END
549 } // namespace vtkDataArrayPrivate
550 
551 #define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
552  extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
553  ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
554  extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
555  vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
556  extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
557  vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
558  extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
559  vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
560 
561 #ifdef VTK_USE_SCALED_SOA_ARRAYS
562 
563 #define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType) \
564  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
565  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) \
566  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<ValueType>, ValueType)
567 
568 #else // VTK_USE_SCALED_SOA_ARRAYS
569 
570 #define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType) \
571  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
572  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
573 
574 #endif
575 
576 namespace vtkDataArrayPrivate
577 {
578 VTK_ABI_NAMESPACE_BEGIN
579 // These are instantiated in vtkGenericDataArrayValueRange${i}.cxx
583 VTK_DECLARE_VALUERANGE_VALUETYPE(unsigned long long)
584 
585 // This is instantiated in vtkGenericDataArray.cxx
587 
588 // These are instantiated in vtkFloatArray.cxx, vtkDoubleArray.cxx, etc
602 
603 // These are instantiated in vtkSOADataArrayTemplateInstantiate${i}.cxx
617 
618 // These are instantiated in vtkScaledSOADataArrayTemplateInstantiate${i}.cxx
619 #ifdef VTK_USE_SCALED_SOA_ARRAYS
633 #endif // VTK_USE_SCALED_SOA_ARRAYS
634 
635 VTK_ABI_NAMESPACE_END
636 } // namespace vtkDataArrayPrivate
637 
638 #undef VTK_DECLARE_VALUERANGE_ARRAYTYPE
639 #undef VTK_DECLARE_VALUERANGE_VALUETYPE
640 
641 #ifdef _MSC_VER
642 #pragma warning(pop)
643 #endif
644 #endif // VTK_GDA_TEMPLATE_EXTERN
645 
646 #endif // VTK_GDA_VALUERANGE_INSTANTIATING
647 
648 // VTK-HeaderTest-Exclude: vtkGenericDataArray.h
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.
VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(A *, R *, T, const unsigned char *ghosts, unsigned char ghostsToSkip)
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.
VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(A *, R[2], AllValues, const unsigned char *ghosts, unsigned char ghostsToSkip)
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)
int vtkIdType
Definition: vtkType.h:315
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 type representing the union of many types.
Definition: vtkVariant.h:52
void SetTuple(vtkIdType tupleIdx, const double *tuple) override
Set the data tuple at tupleIdx.
int vtkTypeBool
Definition: vtkABI.h:64
vtkIdType GetNumberOfValues() const
Get the total number of values in the array.
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
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
Definition: vtkIdList.h:22
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
Definition: vtkDataArray.h:44
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.
#define VTK_NEWINSTANCE
void * GetVoidPointer(vtkIdType valueIdx) override
Default implementation raises a runtime error.
#define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType)
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)
#define VTK_EXPECTS(x)
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.
Definition: vtkTypeTraits.h:23
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.