VTK  9.2.6
vtkGenericDataArray.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGenericDataArray.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
69 #ifndef vtkGenericDataArray_h
70 #define vtkGenericDataArray_h
71 
72 #include "vtkDataArray.h"
73 
74 #include "vtkCompiler.h" // for VTK_USE_EXTERN_TEMPLATE
76 #include "vtkSmartPointer.h"
77 #include "vtkTypeTraits.h"
78 
79 #include <cassert>
80 
81 template <class DerivedT, class ValueTypeT>
83 {
85 
86 public:
87  typedef ValueTypeT ValueType;
89 
93  enum
94  {
96  };
97 
102 
110  inline ValueType GetValue(vtkIdType valueIdx) const
111  {
112  return static_cast<const DerivedT*>(this)->GetValue(valueIdx);
113  }
114 
122  void SetValue(vtkIdType valueIdx, ValueType value)
123  VTK_EXPECTS(0 <= valueIdx && valueIdx < GetNumberOfValues())
124  {
125  static_cast<DerivedT*>(this)->SetValue(valueIdx, value);
126  }
127 
136  void GetTypedTuple(vtkIdType tupleIdx, ValueType* tuple) const
137  VTK_EXPECTS(0 <= tupleIdx && tupleIdx < GetNumberOfTuples())
138  {
139  static_cast<const DerivedT*>(this)->GetTypedTuple(tupleIdx, tuple);
140  }
141 
150  void SetTypedTuple(vtkIdType tupleIdx, const ValueType* tuple)
151  VTK_EXPECTS(0 <= tupleIdx && tupleIdx < GetNumberOfTuples())
152  {
153  static_cast<DerivedT*>(this)->SetTypedTuple(tupleIdx, tuple);
154  }
155 
161  ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const VTK_EXPECTS(0 <= tupleIdx &&
162  tupleIdx < GetNumberOfTuples()) VTK_EXPECTS(0 <= compIdx && compIdx < GetNumberOfComponents())
163  {
164  return static_cast<const DerivedT*>(this)->GetTypedComponent(tupleIdx, compIdx);
165  }
166 
172  void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
173  VTK_EXPECTS(0 <= tupleIdx && tupleIdx < GetNumberOfTuples())
174  VTK_EXPECTS(0 <= compIdx && compIdx < GetNumberOfComponents())
175  {
176  static_cast<DerivedT*>(this)->SetTypedComponent(tupleIdx, compIdx, value);
177  }
178 
180 
184  void* GetVoidPointer(vtkIdType valueIdx) override;
185  ValueType* GetPointer(vtkIdType valueIdx);
186  void SetVoidArray(void*, vtkIdType, int) override;
187  void SetVoidArray(void*, vtkIdType, int, int) override;
188  void SetArrayFreeFunction(void (*callback)(void*)) override;
189  void* WriteVoidPointer(vtkIdType valueIdx, vtkIdType numValues) override;
190  ValueType* WritePointer(vtkIdType valueIdx, vtkIdType numValues);
192 
199  void RemoveTuple(vtkIdType tupleIdx) override;
200 
204  vtkIdType InsertNextValue(ValueType value);
205 
209  void InsertValue(vtkIdType valueIdx, ValueType value);
210 
214  void InsertTypedTuple(vtkIdType tupleIdx, const ValueType* t);
215 
219  vtkIdType InsertNextTypedTuple(const ValueType* t);
220 
225  void InsertTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType val);
226 
228 
239  void GetValueRange(
240  ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
241  void GetValueRange(ValueType range[2], int comp);
242  ValueType* GetValueRange(int comp) VTK_SIZEHINT(2);
244 
249  ValueType* GetValueRange() VTK_SIZEHINT(2) { return this->GetValueRange(0); }
250  void GetValueRange(ValueType range[2]) { this->GetValueRange(range, 0); }
251 
257  void GetFiniteValueRange(
258  ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
259  void GetFiniteValueRange(ValueType range[2], int comp);
260  ValueType* GetFiniteValueRange(int comp) VTK_SIZEHINT(2);
261  ValueType* GetFiniteValueRange() VTK_SIZEHINT(2) { return this->GetFiniteValueRange(0); }
262  void GetFiniteValueRange(ValueType range[2]) { this->GetFiniteValueRange(range, 0); }
269  vtkIdType Capacity() { return this->Size; }
270 
274  virtual void FillTypedComponent(int compIdx, ValueType value);
275 
279  virtual void FillValue(ValueType value);
280 
281  int GetDataType() const override;
282  int GetDataTypeSize() const override;
283  bool HasStandardMemoryLayout() const override;
284  vtkTypeBool Allocate(vtkIdType size, vtkIdType ext = 1000) override;
285  vtkTypeBool Resize(vtkIdType numTuples) override;
286  void SetNumberOfComponents(int num) override;
287  void SetNumberOfTuples(vtkIdType number) override;
288  void Initialize() override;
289  void Squeeze() override;
290  void SetTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray* source) override;
291  // MSVC doesn't like 'using' here (error C2487). Just forward instead:
292  // using Superclass::SetTuple;
293  void SetTuple(vtkIdType tupleIdx, const float* tuple) override
294  {
295  this->Superclass::SetTuple(tupleIdx, tuple);
296  }
297  void SetTuple(vtkIdType tupleIdx, const double* tuple) override
298  {
299  this->Superclass::SetTuple(tupleIdx, tuple);
300  }
301 
303  vtkIdType dstStart, vtkIdList* srcIds, vtkAbstractArray* source) override;
304  void InsertTuples(vtkIdList* dstIds, vtkIdList* srcIds, vtkAbstractArray* source) override;
305  // MSVC doesn't like 'using' here (error C2487). Just forward instead:
306  // using Superclass::InsertTuples;
308  vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray* source) override
309  {
310  this->Superclass::InsertTuples(dstStart, n, srcStart, source);
311  }
312 
313  void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray* source) override;
314  void InsertTuple(vtkIdType tupleIdx, const float* source) override;
315  void InsertTuple(vtkIdType tupleIdx, const double* source) override;
316  void InsertComponent(vtkIdType tupleIdx, int compIdx, double value) override;
318  vtkIdType InsertNextTuple(const float* tuple) override;
319  vtkIdType InsertNextTuple(const double* tuple) override;
320  void GetTuples(vtkIdList* tupleIds, vtkAbstractArray* output) override;
321  void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray* output) override;
322  double* GetTuple(vtkIdType tupleIdx) override;
323  void GetTuple(vtkIdType tupleIdx, double* tuple) override;
324  void InterpolateTuple(vtkIdType dstTupleIdx, vtkIdList* ptIndices, vtkAbstractArray* source,
325  double* weights) override;
326  void InterpolateTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx1, vtkAbstractArray* source1,
327  vtkIdType srcTupleIdx2, vtkAbstractArray* source2, double t) override;
328  void SetComponent(vtkIdType tupleIdx, int compIdx, double value) override;
329  double GetComponent(vtkIdType tupleIdx, int compIdx) override;
330  void SetVariantValue(vtkIdType valueIdx, vtkVariant value) override;
331  vtkVariant GetVariantValue(vtkIdType valueIdx) override;
332  void InsertVariantValue(vtkIdType valueIdx, vtkVariant value) override;
334  virtual vtkIdType LookupTypedValue(ValueType value);
335  void LookupValue(vtkVariant value, vtkIdList* valueIds) override;
336  virtual void LookupTypedValue(ValueType value, vtkIdList* valueIds);
337  void ClearLookup() override;
338  void DataChanged() override;
339  void FillComponent(int compIdx, double value) override;
341 
342 protected:
344  ~vtkGenericDataArray() override;
345 
351  inline bool AllocateTuples(vtkIdType numTuples)
352  {
353  return static_cast<DerivedT*>(this)->AllocateTuples(numTuples);
354  }
355 
361  inline bool ReallocateTuples(vtkIdType numTuples)
362  {
363  return static_cast<DerivedT*>(this)->ReallocateTuples(numTuples);
364  }
365 
366  // This method resizes the array if needed so that the given tuple index is
367  // valid/accessible.
368  bool EnsureAccessToTuple(vtkIdType tupleIdx);
369 
377  void ComputeValueRange(
378  ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
379 
388  ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
389 
397  ValueType* ranges, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
398 
404  ValueType range[2], const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
405 
413  ValueType* ranges, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
414 
420  ValueType range[2], const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
421 
422  std::vector<double> LegacyTuple;
423  std::vector<ValueType> LegacyValueRange;
424  std::vector<ValueType> LegacyValueRangeFull;
425 
427 
428 private:
429  vtkGenericDataArray(const vtkGenericDataArray&) = delete;
430  void operator=(const vtkGenericDataArray&) = delete;
431 };
432 
433 // these predeclarations are needed before the .txx include for MinGW
434 namespace vtkDataArrayPrivate
435 {
436 template <typename A, typename R, typename T>
437 bool DoComputeScalarRange(A*, R*, T, const unsigned char* ghosts, unsigned char ghostsToSkip);
438 template <typename A, typename R>
440  A*, R[2], AllValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
441 template <typename A, typename R>
443  A*, R[2], FiniteValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
444 } // namespace vtkDataArrayPrivate
445 
446 #include "vtkGenericDataArray.txx"
447 
448 // Adds an implementation of NewInstanceInternal() that returns an AoS
449 // (unmapped) VTK array, if possible. This allows the pipeline to copy and
450 // propagate the array when the array data is not modifiable. Use this in
451 // combination with vtkAbstractTypeMacro or vtkAbstractTemplateTypeMacro
452 // (instead of vtkTypeMacro) to avoid adding the default NewInstance
453 // implementation.
454 #define vtkAOSArrayNewInstanceMacro(thisClass) \
455 protected: \
456  vtkObjectBase* NewInstanceInternal() const override \
457  { \
458  if (vtkDataArray* da = vtkDataArray::CreateDataArray(thisClass::VTK_DATA_TYPE)) \
459  { \
460  return da; \
461  } \
462  return thisClass::New(); \
463  } \
464  \
465 public:
466 
467 #endif
468 
469 // This portion must be OUTSIDE the include blockers. This is used to tell
470 // libraries other than vtkCommonCore that instantiations of
471 // the GetValueRange lookups can be found externally. This prevents each library
472 // from instantiating these on their own.
473 // Additionally it helps hide implementation details that pull in system
474 // headers.
475 // We only provide these specializations for the 64-bit integer types, since
476 // other types can reuse the double-precision mechanism in
477 // vtkDataArray::GetRange without losing precision.
478 #ifdef VTK_GDA_VALUERANGE_INSTANTIATING
479 
480 // Forward declare necessary stuffs:
481 template <typename ValueType>
483 template <typename ValueType>
485 
486 #ifdef VTK_USE_SCALED_SOA_ARRAYS
487 template <typename ValueType>
489 #endif
490 
491 #define VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
492  template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
493  ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
494  template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
495  vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
496  template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
497  vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
498  template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
499  vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
500 
501 #ifdef VTK_USE_SCALED_SOA_ARRAYS
502 
503 #define VTK_INSTANTIATE_VALUERANGE_VALUETYPE(ValueType) \
504  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
505  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) \
506  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<ValueType>, ValueType)
507 
508 #else // VTK_USE_SCALED_SOA_ARRAYS
509 
510 #define VTK_INSTANTIATE_VALUERANGE_VALUETYPE(ValueType) \
511  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
512  VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
513 
514 #endif
515 
516 #elif defined(VTK_USE_EXTERN_TEMPLATE) // VTK_GDA_VALUERANGE_INSTANTIATING
517 
518 #ifndef VTK_GDA_TEMPLATE_EXTERN
519 #define VTK_GDA_TEMPLATE_EXTERN
520 #ifdef _MSC_VER
521 #pragma warning(push)
522 // The following is needed when the following is declared
523 // dllexport and is used from another class in vtkCommonCore
524 #pragma warning(disable : 4910) // extern and dllexport incompatible
525 #endif
526 
527 // Forward declare necessary stuffs:
528 template <typename ValueType>
530 template <typename ValueType>
532 
533 #ifdef VTK_USE_SCALED_SOA_ARRAYS
534 template <typename ValueType>
536 #endif
537 
538 namespace vtkDataArrayPrivate
539 {
540 template <typename A, typename R, typename T>
541 bool DoComputeScalarRange(A*, R*, T, const unsigned char* ghosts, unsigned char ghostsToSkip);
542 template <typename A, typename R>
544  A*, R[2], AllValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
545 template <typename A, typename R>
547  A*, R[2], FiniteValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
548 } // namespace vtkDataArrayPrivate
549 
550 #define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
551  extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
552  ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
553  extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
554  vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
555  extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
556  vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
557  extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
558  vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
559 
560 #ifdef VTK_USE_SCALED_SOA_ARRAYS
561 
562 #define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType) \
563  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
564  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) \
565  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<ValueType>, ValueType)
566 
567 #else // VTK_USE_SCALED_SOA_ARRAYS
568 
569 #define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType) \
570  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
571  VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
572 
573 #endif
574 
575 namespace vtkDataArrayPrivate
576 {
577 // These are instantiated in vtkGenericDataArrayValueRange${i}.cxx
581 VTK_DECLARE_VALUERANGE_VALUETYPE(unsigned long long)
582 
583 // This is instantiated in vtkGenericDataArray.cxx
585 
586 // These are instantiated in vtkFloatArray.cxx, vtkDoubleArray.cxx, etc
600 
601 // These are instantiated in vtkSOADataArrayTemplateInstantiate${i}.cxx
615 
616 // These are instantiated in vtkScaledSOADataArrayTemplateInstantiate${i}.cxx
617 #ifdef VTK_USE_SCALED_SOA_ARRAYS
631 #endif // VTK_USE_SCALED_SOA_ARRAYS
632 
633 } // namespace vtkDataArrayPrivate
634 
635 #undef VTK_DECLARE_VALUERANGE_ARRAYTYPE
636 #undef VTK_DECLARE_VALUERANGE_VALUETYPE
637 
638 #ifdef _MSC_VER
639 #pragma warning(pop)
640 #endif
641 #endif // VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
642 
643 #endif // VTK_GDA_VALUERANGE_INSTANTIATING
644 
645 // 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.
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 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:332
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 atomic type representing the union of many types.
Definition: vtkVariant.h:69
void SetTuple(vtkIdType tupleIdx, const double *tuple) override
Set the data tuple at tupleIdx.
int vtkTypeBool
Definition: vtkABI.h:69
vtkIdType GetNumberOfValues() const
Get the total number of values in the array.
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
bool DoComputeVectorRange(A *, R[2], AllValues, const unsigned char *ghosts, unsigned char ghostsToSkip)
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:33
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:55
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)
bool DoComputeScalarRange(A *, R *, T, const unsigned char *ghosts, unsigned char ghostsToSkip)
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:33
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.