VTK  9.4.20251007
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
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
69VTK_ABI_NAMESPACE_BEGIN
70template <class DerivedT, class ValueTypeT>
72{
74
75public:
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
151 VTK_EXPECTS(0 <= tupleIdx && GetNumberOfComponents() * tupleIdx + compIdx < GetNumberOfValues())
152 VTK_EXPECTS(0 <= compIdx && compIdx < GetNumberOfComponents())
153 {
154 return static_cast<const DerivedT*>(this)->GetTypedComponent(tupleIdx, compIdx);
155 }
156
162 void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
163 VTK_EXPECTS(0 <= tupleIdx && GetNumberOfComponents() * tupleIdx + compIdx < GetNumberOfValues())
164 VTK_EXPECTS(0 <= compIdx && compIdx < GetNumberOfComponents())
165 {
166 static_cast<DerivedT*>(this)->SetTypedComponent(tupleIdx, compIdx, value);
167 }
168
170
174 void* GetVoidPointer(vtkIdType valueIdx) override;
176 void SetVoidArray(void*, vtkIdType, int) override;
177 void SetVoidArray(void*, vtkIdType, int, int) override;
178 void SetArrayFreeFunction(void (*callback)(void*)) override;
179 void* WriteVoidPointer(vtkIdType valueIdx, vtkIdType numValues) override;
182
189 void RemoveTuple(vtkIdType tupleIdx) override;
190
195
199 void InsertValue(vtkIdType valueIdx, ValueType value);
200
204 void InsertTypedTuple(vtkIdType tupleIdx, const ValueType* t);
205
210
215 void InsertTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType val);
216
218
230 ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
231 void GetValueRange(ValueType range[2], int comp);
234
240 void GetValueRange(ValueType range[2]) { this->GetValueRange(range, 0); }
241
248 ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
249 void GetFiniteValueRange(ValueType range[2], int comp);
252 void GetFiniteValueRange(ValueType range[2]) { this->GetFiniteValueRange(range, 0); }
254
259 vtkIdType Capacity() { return this->Size; }
260
264 virtual void FillTypedComponent(int compIdx, ValueType value);
265
269 virtual void FillValue(ValueType value);
270
271 int GetDataType() const override;
272 int GetDataTypeSize() const override;
273 bool HasStandardMemoryLayout() const override;
274 vtkTypeBool Allocate(vtkIdType size, vtkIdType ext = 1000) override;
275 vtkTypeBool Resize(vtkIdType numTuples) override;
276 void SetNumberOfComponents(int num) override;
277 void SetNumberOfTuples(vtkIdType number) override;
278 void Initialize() override;
279 void Squeeze() override;
280 void SetTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray* source) override;
281 // MSVC doesn't like 'using' here (error C2487). Just forward instead:
282 // using Superclass::SetTuple;
283 void SetTuple(vtkIdType tupleIdx, const float* tuple) override
284 {
285 this->Superclass::SetTuple(tupleIdx, tuple);
286 }
287 void SetTuple(vtkIdType tupleIdx, const double* tuple) override
288 {
289 this->Superclass::SetTuple(tupleIdx, tuple);
290 }
291
293 vtkIdType dstStart, vtkIdList* srcIds, vtkAbstractArray* source) override;
294 void InsertTuples(vtkIdList* dstIds, vtkIdList* srcIds, vtkAbstractArray* source) override;
295 // MSVC doesn't like 'using' here (error C2487). Just forward instead:
296 // using Superclass::InsertTuples;
298 vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray* source) override
299 {
300 this->Superclass::InsertTuples(dstStart, n, srcStart, source);
301 }
302
303 void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray* source) override;
304 void InsertTuple(vtkIdType tupleIdx, const float* source) override;
305 void InsertTuple(vtkIdType tupleIdx, const double* source) override;
306 void InsertComponent(vtkIdType tupleIdx, int compIdx, double value) override;
308 vtkIdType InsertNextTuple(const float* tuple) override;
309 vtkIdType InsertNextTuple(const double* tuple) override;
310 void GetTuples(vtkIdList* tupleIds, vtkAbstractArray* output) override;
311 void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray* output) override;
312 double* GetTuple(vtkIdType tupleIdx) override;
313 void GetTuple(vtkIdType tupleIdx, double* tuple) override;
315 double* weights) override;
316 void InterpolateTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx1, vtkAbstractArray* source1,
317 vtkIdType srcTupleIdx2, vtkAbstractArray* source2, double t) override;
318 void SetComponent(vtkIdType tupleIdx, int compIdx, double value) override;
319 double GetComponent(vtkIdType tupleIdx, int compIdx) override;
320 void SetVariantValue(vtkIdType valueIdx, vtkVariant value) override;
322 void InsertVariantValue(vtkIdType valueIdx, vtkVariant value) override;
325 void LookupValue(vtkVariant value, vtkIdList* valueIds) override;
326 virtual void LookupTypedValue(ValueType value, vtkIdList* valueIds);
327 void ClearLookup() override;
328 void DataChanged() override;
329 void FillComponent(int compIdx, double value) override;
331
332protected:
335
341 inline bool AllocateTuples(vtkIdType numTuples)
342 {
343 return static_cast<DerivedT*>(this)->AllocateTuples(numTuples);
344 }
345
351 inline bool ReallocateTuples(vtkIdType numTuples)
352 {
353 return static_cast<DerivedT*>(this)->ReallocateTuples(numTuples);
354 }
355
356 // This method resizes the array if needed so that the given tuple index is
357 // valid/accessible.
359
368 ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
369
378 ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
379
387 ValueType* ranges, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
388
394 ValueType range[2], const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
395
403 ValueType* ranges, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
404
410 ValueType range[2], const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
411
412 std::vector<double> LegacyTuple;
413 std::vector<ValueType> LegacyValueRange;
414 std::vector<ValueType> LegacyValueRangeFull;
415
417
418private:
420 void operator=(const vtkGenericDataArray&) = delete;
421};
422VTK_ABI_NAMESPACE_END
423
424// these predeclarations are needed before the .txx include for MinGW
425namespace vtkDataArrayPrivate
426{
427VTK_ABI_NAMESPACE_BEGIN
428template <typename A, typename R, typename T>
429VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(
430 A*, R*, T, const unsigned char* ghosts, unsigned char ghostsToSkip);
431template <typename A, typename R>
432VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
433 A*, R[2], AllValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
434template <typename A, typename R>
435VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
436 A*, R[2], FiniteValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
437VTK_ABI_NAMESPACE_END
438} // namespace vtkDataArrayPrivate
439
440#include "vtkGenericDataArray.txx"
441
442// Adds an implementation of NewInstanceInternal() that returns an AoS
443// (unmapped) VTK array, if possible. This allows the pipeline to copy and
444// propagate the array when the array data is not modifiable. Use this in
445// combination with vtkAbstractTypeMacro or vtkAbstractTemplateTypeMacro
446// (instead of vtkTypeMacro) to avoid adding the default NewInstance
447// implementation.
448#define vtkAOSArrayNewInstanceMacro(thisClass) \
449protected: \
450 vtkObjectBase* NewInstanceInternal() const override \
451 { \
452 if (vtkDataArray* da = vtkDataArray::CreateDataArray(thisClass::VTK_DATA_TYPE)) \
453 { \
454 return da; \
455 } \
456 return thisClass::New(); \
457 } \
458 \
459public:
460
461#endif
462
463// This portion must be OUTSIDE the include blockers. This is used to tell
464// libraries other than vtkCommonCore that instantiations of
465// the GetValueRange lookups can be found externally. This prevents each library
466// from instantiating these on their own.
467// Additionally it helps hide implementation details that pull in system
468// headers.
469// We only provide these specializations for the 64-bit integer types, since
470// other types can reuse the double-precision mechanism in
471// vtkDataArray::GetRange without losing precision.
472#ifdef VTK_GDA_VALUERANGE_INSTANTIATING
473
474// Forward declare necessary stuffs:
475VTK_ABI_NAMESPACE_BEGIN
476template <typename ValueType>
478template <typename ValueType>
480
481#ifdef VTK_USE_SCALED_SOA_ARRAYS
482template <typename ValueType>
484#endif
485VTK_ABI_NAMESPACE_END
486
487#define VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
488 template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
489 ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
490 template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
491 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
492 template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
493 vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
494 template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
495 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
496
497#ifdef VTK_USE_SCALED_SOA_ARRAYS
498
499#define VTK_INSTANTIATE_VALUERANGE_VALUETYPE(ValueType) \
500 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
501 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) \
502 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<ValueType>, ValueType)
503
504#else // VTK_USE_SCALED_SOA_ARRAYS
505
506#define VTK_INSTANTIATE_VALUERANGE_VALUETYPE(ValueType) \
507 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
508 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
509
510#endif
511
512#elif defined(VTK_USE_EXTERN_TEMPLATE) // VTK_GDA_VALUERANGE_INSTANTIATING
513
514#ifndef VTK_GDA_TEMPLATE_EXTERN
515#define VTK_GDA_TEMPLATE_EXTERN
516#ifdef _MSC_VER
517#pragma warning(push)
518// The following is needed when the following is declared
519// dllexport and is used from another class in vtkCommonCore
520#pragma warning(disable : 4910) // extern and dllexport incompatible
521#endif
522
523VTK_ABI_NAMESPACE_BEGIN
524// Forward declare necessary stuffs:
525template <typename ValueType>
527template <typename ValueType>
529
530#ifdef VTK_USE_SCALED_SOA_ARRAYS
531template <typename ValueType>
533#endif
534
535VTK_ABI_NAMESPACE_END
536
537namespace vtkDataArrayPrivate
538{
539VTK_ABI_NAMESPACE_BEGIN
540template <typename A, typename R, typename T>
541VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(
542 A*, R*, T, const unsigned char* ghosts, unsigned char ghostsToSkip);
543template <typename A, typename R>
544VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
545 A*, R[2], AllValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
546template <typename A, typename R>
547VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
548 A*, R[2], FiniteValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
549VTK_ABI_NAMESPACE_END
550} // namespace vtkDataArrayPrivate
551
552#define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
553 extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
554 ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
555 extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
556 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
557 extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
558 vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
559 extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
560 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
561
562#ifdef VTK_USE_SCALED_SOA_ARRAYS
563
564#define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType) \
565 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
566 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) \
567 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<ValueType>, ValueType)
568
569#else // VTK_USE_SCALED_SOA_ARRAYS
570
571#define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType) \
572 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
573 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
574
575#endif
576
577namespace vtkDataArrayPrivate
578{
579VTK_ABI_NAMESPACE_BEGIN
580// These are instantiated in vtkGenericDataArrayValueRange${i}.cxx
584VTK_DECLARE_VALUERANGE_VALUETYPE(unsigned long long)
585
586// This is instantiated in vtkGenericDataArray.cxx
588
589// These are instantiated in vtkFloatArray.cxx, vtkDoubleArray.cxx, etc
603
604// These are instantiated in vtkSOADataArrayTemplateInstantiate${i}.cxx
618
619// These are instantiated in vtkScaledSOADataArrayTemplateInstantiate${i}.cxx
620#ifdef VTK_USE_SCALED_SOA_ARRAYS
634#endif // VTK_USE_SCALED_SOA_ARRAYS
635
636VTK_ABI_NAMESPACE_END
637} // namespace vtkDataArrayPrivate
638
639#undef VTK_DECLARE_VALUERANGE_ARRAYTYPE
640#undef VTK_DECLARE_VALUERANGE_VALUETYPE
641
642#ifdef _MSC_VER
643#pragma warning(pop)
644#endif
645#endif // VTK_GDA_TEMPLATE_EXTERN
646
647#endif // VTK_GDA_VALUERANGE_INSTANTIATING
648
649// 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.
virtual void SetTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source)=0
Set the tuple at dstTupleIdx in this array to the tuple at srcTupleIdx in the source array.
virtual void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source)=0
Copy the tuples indexed in srcIds from the source array to the tuple locations indexed by dstIds in t...
vtkIdType GetNumberOfValues() const
Get the total number of values in the array.
Abstract superclass to iterate over elements in an vtkAbstractArray.
internal class used by vtkGenericDataArray to support LookupValue.
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.
void SetNumberOfComponents(int num) override
Set/Get the dimension (n) of the components.
ValueType * GetFiniteValueRange()
These methods are analogous to the GetValueRange methods, except that the only consider finite values...
void DataChanged() override
Tell the array explicitly that the data has changed.
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.
void InsertTuple(vtkIdType tupleIdx, const float *source) override
Insert the data tuple at tupleIdx.
ValueType * GetPointer(vtkIdType valueIdx)
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 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.
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.
ValueType * WritePointer(vtkIdType valueIdx, vtkIdType numValues)
Default implementation raises a runtime error.
double * GetTuple(vtkIdType tupleIdx) override
Get the data tuple at tupleIdx.
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 * GetVoidPointer(vtkIdType valueIdx) override
Default implementation raises a runtime error.
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...
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.
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.
ValueType * GetFiniteValueRange(int comp)
These methods are analogous to the GetValueRange methods, except that the only consider finite values...
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
vtkArrayIterator * NewIterator() override
Subclasses must override this method and provide the right kind of templated vtkArrayIteratorTemplate...
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.
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 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...
void Squeeze() override
Free any unnecessary memory.
bool EnsureAccessToTuple(vtkIdType tupleIdx)
vtkGenericDataArrayLookupHelper< SelfType > Lookup
ValueType * GetValueRange(int comp)
Get the range of array values for the given component in the native data type.
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
void * WriteVoidPointer(vtkIdType valueIdx, vtkIdType numValues) override
Default implementation raises a runtime error.
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.
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.
ValueType * GetValueRange()
Get the range of array values for the 0th component in the native data type.
void Initialize() override
Release storage and reset array to initial state.
list of point or cell ids
Definition vtkIdList.h:24
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:53
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)
Template defining traits of native types used by VTK.
int vtkTypeBool
Definition vtkABI.h:64
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define vtkDataArray
#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