VTK  9.4.20241123
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
166#ifndef vtkGenericDataArray_h
167#define vtkGenericDataArray_h
168
169#include "vtkDataArray.h"
170
171#include "vtkCompiler.h" // for VTK_USE_EXTERN_TEMPLATE
173#include "vtkSmartPointer.h"
174#include "vtkTypeTraits.h"
175
176#include <cassert>
177
178VTK_ABI_NAMESPACE_BEGIN
179template <class DerivedT, class ValueTypeT>
181{
183
184public:
185 typedef ValueTypeT ValueType;
187
191 enum
192 {
194 };
195
200
208 inline ValueType GetValue(vtkIdType valueIdx) const
209 {
210 return static_cast<const DerivedT*>(this)->GetValue(valueIdx);
211 }
212
220 void SetValue(vtkIdType valueIdx, ValueType value)
221 VTK_EXPECTS(0 <= valueIdx && valueIdx < GetNumberOfValues())
222 {
223 static_cast<DerivedT*>(this)->SetValue(valueIdx, value);
224 }
225
234 void GetTypedTuple(vtkIdType tupleIdx, ValueType* tuple) const
235 VTK_EXPECTS(0 <= tupleIdx && tupleIdx < GetNumberOfTuples())
236 {
237 static_cast<const DerivedT*>(this)->GetTypedTuple(tupleIdx, tuple);
238 }
239
248 void SetTypedTuple(vtkIdType tupleIdx, const ValueType* tuple)
249 VTK_EXPECTS(0 <= tupleIdx && tupleIdx < GetNumberOfTuples())
250 {
251 static_cast<DerivedT*>(this)->SetTypedTuple(tupleIdx, tuple);
252 }
253
259 ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
260 VTK_EXPECTS(0 <= tupleIdx && GetNumberOfComponents() * tupleIdx + compIdx < GetNumberOfValues())
261 VTK_EXPECTS(0 <= compIdx && compIdx < GetNumberOfComponents())
262 {
263 return static_cast<const DerivedT*>(this)->GetTypedComponent(tupleIdx, compIdx);
264 }
265
271 void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
272 VTK_EXPECTS(0 <= tupleIdx && GetNumberOfComponents() * tupleIdx + compIdx < GetNumberOfValues())
273 VTK_EXPECTS(0 <= compIdx && compIdx < GetNumberOfComponents())
274 {
275 static_cast<DerivedT*>(this)->SetTypedComponent(tupleIdx, compIdx, value);
276 }
277
279
283 void* GetVoidPointer(vtkIdType valueIdx) override;
285 void SetVoidArray(void*, vtkIdType, int) override;
286 void SetVoidArray(void*, vtkIdType, int, int) override;
287 void SetArrayFreeFunction(void (*callback)(void*)) override;
288 void* WriteVoidPointer(vtkIdType valueIdx, vtkIdType numValues) override;
291
298 void RemoveTuple(vtkIdType tupleIdx) override;
299
304
308 void InsertValue(vtkIdType valueIdx, ValueType value);
309
313 void InsertTypedTuple(vtkIdType tupleIdx, const ValueType* t);
314
319
324 void InsertTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType val);
325
327
339 ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
340 void GetValueRange(ValueType range[2], int comp);
343
349 void GetValueRange(ValueType range[2]) { this->GetValueRange(range, 0); }
350
357 ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
358 void GetFiniteValueRange(ValueType range[2], int comp);
361 void GetFiniteValueRange(ValueType range[2]) { this->GetFiniteValueRange(range, 0); }
368 vtkIdType Capacity() { return this->Size; }
369
373 virtual void FillTypedComponent(int compIdx, ValueType value);
374
378 virtual void FillValue(ValueType value);
379
380 int GetDataType() const override;
381 int GetDataTypeSize() const override;
382 bool HasStandardMemoryLayout() const override;
383 vtkTypeBool Allocate(vtkIdType size, vtkIdType ext = 1000) override;
384 vtkTypeBool Resize(vtkIdType numTuples) override;
385 void SetNumberOfComponents(int num) override;
386 void SetNumberOfTuples(vtkIdType number) override;
387 void Initialize() override;
388 void Squeeze() override;
389 void SetTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray* source) override;
390 // MSVC doesn't like 'using' here (error C2487). Just forward instead:
391 // using Superclass::SetTuple;
392 void SetTuple(vtkIdType tupleIdx, const float* tuple) override
393 {
394 this->Superclass::SetTuple(tupleIdx, tuple);
395 }
396 void SetTuple(vtkIdType tupleIdx, const double* tuple) override
397 {
398 this->Superclass::SetTuple(tupleIdx, tuple);
399 }
400
402 vtkIdType dstStart, vtkIdList* srcIds, vtkAbstractArray* source) override;
403 void InsertTuples(vtkIdList* dstIds, vtkIdList* srcIds, vtkAbstractArray* source) override;
404 // MSVC doesn't like 'using' here (error C2487). Just forward instead:
405 // using Superclass::InsertTuples;
407 vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray* source) override
408 {
409 this->Superclass::InsertTuples(dstStart, n, srcStart, source);
410 }
411
412 void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray* source) override;
413 void InsertTuple(vtkIdType tupleIdx, const float* source) override;
414 void InsertTuple(vtkIdType tupleIdx, const double* source) override;
415 void InsertComponent(vtkIdType tupleIdx, int compIdx, double value) override;
417 vtkIdType InsertNextTuple(const float* tuple) override;
418 vtkIdType InsertNextTuple(const double* tuple) override;
419 void GetTuples(vtkIdList* tupleIds, vtkAbstractArray* output) override;
420 void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray* output) override;
421 double* GetTuple(vtkIdType tupleIdx) override;
422 void GetTuple(vtkIdType tupleIdx, double* tuple) override;
424 double* weights) override;
425 void InterpolateTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx1, vtkAbstractArray* source1,
426 vtkIdType srcTupleIdx2, vtkAbstractArray* source2, double t) override;
427 void SetComponent(vtkIdType tupleIdx, int compIdx, double value) override;
428 double GetComponent(vtkIdType tupleIdx, int compIdx) override;
429 void SetVariantValue(vtkIdType valueIdx, vtkVariant value) override;
431 void InsertVariantValue(vtkIdType valueIdx, vtkVariant value) override;
434 void LookupValue(vtkVariant value, vtkIdList* valueIds) override;
435 virtual void LookupTypedValue(ValueType value, vtkIdList* valueIds);
436 void ClearLookup() override;
437 void DataChanged() override;
438 void FillComponent(int compIdx, double value) override;
440
441protected:
444
450 inline bool AllocateTuples(vtkIdType numTuples)
451 {
452 return static_cast<DerivedT*>(this)->AllocateTuples(numTuples);
453 }
454
460 inline bool ReallocateTuples(vtkIdType numTuples)
461 {
462 return static_cast<DerivedT*>(this)->ReallocateTuples(numTuples);
463 }
464
465 // This method resizes the array if needed so that the given tuple index is
466 // valid/accessible.
468
477 ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
478
487 ValueType range[2], int comp, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
488
496 ValueType* ranges, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
497
503 ValueType range[2], const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
504
512 ValueType* ranges, const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
513
519 ValueType range[2], const unsigned char* ghosts, unsigned char ghostsToSkip = 0xff);
520
521 std::vector<double> LegacyTuple;
522 std::vector<ValueType> LegacyValueRange;
523 std::vector<ValueType> LegacyValueRangeFull;
524
526
527private:
529 void operator=(const vtkGenericDataArray&) = delete;
530};
531VTK_ABI_NAMESPACE_END
532
533// these predeclarations are needed before the .txx include for MinGW
534namespace vtkDataArrayPrivate
535{
536VTK_ABI_NAMESPACE_BEGIN
537template <typename A, typename R, typename T>
538VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(
539 A*, R*, T, const unsigned char* ghosts, unsigned char ghostsToSkip);
540template <typename A, typename R>
541VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
542 A*, R[2], AllValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
543template <typename A, typename R>
544VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
545 A*, R[2], FiniteValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
546VTK_ABI_NAMESPACE_END
547} // namespace vtkDataArrayPrivate
548
549#include "vtkGenericDataArray.txx"
550
551// Adds an implementation of NewInstanceInternal() that returns an AoS
552// (unmapped) VTK array, if possible. This allows the pipeline to copy and
553// propagate the array when the array data is not modifiable. Use this in
554// combination with vtkAbstractTypeMacro or vtkAbstractTemplateTypeMacro
555// (instead of vtkTypeMacro) to avoid adding the default NewInstance
556// implementation.
557#define vtkAOSArrayNewInstanceMacro(thisClass) \
558protected: \
559 vtkObjectBase* NewInstanceInternal() const override \
560 { \
561 if (vtkDataArray* da = vtkDataArray::CreateDataArray(thisClass::VTK_DATA_TYPE)) \
562 { \
563 return da; \
564 } \
565 return thisClass::New(); \
566 } \
567 \
568public:
569
570#endif
571
572// This portion must be OUTSIDE the include blockers. This is used to tell
573// libraries other than vtkCommonCore that instantiations of
574// the GetValueRange lookups can be found externally. This prevents each library
575// from instantiating these on their own.
576// Additionally it helps hide implementation details that pull in system
577// headers.
578// We only provide these specializations for the 64-bit integer types, since
579// other types can reuse the double-precision mechanism in
580// vtkDataArray::GetRange without losing precision.
581#ifdef VTK_GDA_VALUERANGE_INSTANTIATING
582
583// Forward declare necessary stuffs:
584VTK_ABI_NAMESPACE_BEGIN
585template <typename ValueType>
587template <typename ValueType>
589
590#ifdef VTK_USE_SCALED_SOA_ARRAYS
591template <typename ValueType>
593#endif
594VTK_ABI_NAMESPACE_END
595
596#define VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
597 template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
598 ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
599 template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
600 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
601 template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
602 vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
603 template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
604 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
605
606#ifdef VTK_USE_SCALED_SOA_ARRAYS
607
608#define VTK_INSTANTIATE_VALUERANGE_VALUETYPE(ValueType) \
609 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
610 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) \
611 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<ValueType>, ValueType)
612
613#else // VTK_USE_SCALED_SOA_ARRAYS
614
615#define VTK_INSTANTIATE_VALUERANGE_VALUETYPE(ValueType) \
616 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
617 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
618
619#endif
620
621#elif defined(VTK_USE_EXTERN_TEMPLATE) // VTK_GDA_VALUERANGE_INSTANTIATING
622
623#ifndef VTK_GDA_TEMPLATE_EXTERN
624#define VTK_GDA_TEMPLATE_EXTERN
625#ifdef _MSC_VER
626#pragma warning(push)
627// The following is needed when the following is declared
628// dllexport and is used from another class in vtkCommonCore
629#pragma warning(disable : 4910) // extern and dllexport incompatible
630#endif
631
632VTK_ABI_NAMESPACE_BEGIN
633// Forward declare necessary stuffs:
634template <typename ValueType>
636template <typename ValueType>
638
639#ifdef VTK_USE_SCALED_SOA_ARRAYS
640template <typename ValueType>
642#endif
643
644VTK_ABI_NAMESPACE_END
645
646namespace vtkDataArrayPrivate
647{
648VTK_ABI_NAMESPACE_BEGIN
649template <typename A, typename R, typename T>
650VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(
651 A*, R*, T, const unsigned char* ghosts, unsigned char ghostsToSkip);
652template <typename A, typename R>
653VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
654 A*, R[2], AllValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
655template <typename A, typename R>
656VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(
657 A*, R[2], FiniteValues, const unsigned char* ghosts, unsigned char ghostsToSkip);
658VTK_ABI_NAMESPACE_END
659} // namespace vtkDataArrayPrivate
660
661#define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType) \
662 extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange( \
663 ArrayType*, ValueType*, vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
664 extern template VTKCOMMONCORE_EXPORT bool DoComputeScalarRange(ArrayType*, ValueType*, \
665 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char); \
666 extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
667 vtkDataArrayPrivate::AllValues, const unsigned char*, unsigned char); \
668 extern template VTKCOMMONCORE_EXPORT bool DoComputeVectorRange(ArrayType*, ValueType[2], \
669 vtkDataArrayPrivate::FiniteValues, const unsigned char*, unsigned char);
670
671#ifdef VTK_USE_SCALED_SOA_ARRAYS
672
673#define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType) \
674 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
675 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType) \
676 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<ValueType>, ValueType)
677
678#else // VTK_USE_SCALED_SOA_ARRAYS
679
680#define VTK_DECLARE_VALUERANGE_VALUETYPE(ValueType) \
681 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<ValueType>, ValueType) \
682 VTK_DECLARE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<ValueType>, ValueType)
683
684#endif
685
686namespace vtkDataArrayPrivate
687{
688VTK_ABI_NAMESPACE_BEGIN
689// These are instantiated in vtkGenericDataArrayValueRange${i}.cxx
693VTK_DECLARE_VALUERANGE_VALUETYPE(unsigned long long)
694
695// This is instantiated in vtkGenericDataArray.cxx
697
698// These are instantiated in vtkFloatArray.cxx, vtkDoubleArray.cxx, etc
712
713// These are instantiated in vtkSOADataArrayTemplateInstantiate${i}.cxx
727
728// These are instantiated in vtkScaledSOADataArrayTemplateInstantiate${i}.cxx
729#ifdef VTK_USE_SCALED_SOA_ARRAYS
743#endif // VTK_USE_SCALED_SOA_ARRAYS
744
745VTK_ABI_NAMESPACE_END
746} // namespace vtkDataArrayPrivate
747
748#undef VTK_DECLARE_VALUERANGE_ARRAYTYPE
749#undef VTK_DECLARE_VALUERANGE_VALUETYPE
750
751#ifdef _MSC_VER
752#pragma warning(pop)
753#endif
754#endif // VTK_GDA_TEMPLATE_EXTERN
755
756#endif // VTK_GDA_VALUERANGE_INSTANTIATING
757
758// 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.
abstract superclass for arrays of numeric data
internal class used by vtkGenericDataArray to support LookupValue.
Base interface for all typed vtkDataArray subclasses.
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.
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.
std::vector< ValueType > LegacyValueRangeFull
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
std::vector< double > LegacyTuple
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:133
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:162
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 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