VTK  9.5.20251114
vtkPeriodicDataArray.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
3
17#ifndef vtkPeriodicDataArray_h
18#define vtkPeriodicDataArray_h
19
20#include "vtkAOSDataArrayTemplate.h" // Template
21#include "vtkGenericDataArray.h" // Parent
22
23VTK_ABI_NAMESPACE_BEGIN
24template <class Scalar>
26 : public vtkGenericDataArray<vtkPeriodicDataArray<Scalar>, Scalar,
27 vtkArrayTypes::VTK_PERIODIC_DATA_ARRAY>
28{
31
32public:
35 using typename Superclass::ArrayTypeTag;
36 using typename Superclass::DataTypeTag;
37 using typename Superclass::ValueType;
38
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
45
49 void Initialize() override;
50
54 void GetTuples(vtkIdList* ptIds, vtkAbstractArray* output) override;
55
59 void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray* output) override;
60
64 void Squeeze() override;
65
70
75
79 void LookupValue(vtkVariant value, vtkIdList* ids) override;
80
85
89 void ClearLookup() override;
90
95 double* GetTuple(vtkIdType i) override;
96
100 void GetTuple(vtkIdType i, double* tuple) override;
101
105 vtkIdType LookupTypedValue(Scalar value) override;
106
110 void LookupTypedValue(Scalar value, vtkIdList* ids) override;
111
118
125
129 void GetTypedTuple(vtkIdType idx, Scalar* t) const;
130
136 ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const;
137
141 unsigned long GetActualMemorySize() const override;
142
147
151 vtkTypeBool Resize(vtkIdType numTuples) override;
152
156 void SetNumberOfTuples(vtkIdType number) override;
157
162
166 void SetTuple(vtkIdType i, const float* source) override;
167
171 void SetTuple(vtkIdType i, const double* source) override;
172
177
181 void InsertTuple(vtkIdType i, const float* source) override;
182
186 void InsertTuple(vtkIdType i, const double* source) override;
187
191 void InsertTuples(vtkIdList* dstIds, vtkIdList* srcIds, vtkAbstractArray* source) override;
192
197 vtkIdType dstStart, vtkIdList* srcIds, vtkAbstractArray* source) override;
198
203 vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray* source) override;
204
209
213 vtkIdType InsertNextTuple(const float* source) override;
214
218 vtkIdType InsertNextTuple(const double* source) override;
219
223 void DeepCopy(vtkAbstractArray* aa) override;
224
228 void DeepCopy(vtkDataArray* da) override;
229
234 vtkIdType i, vtkIdList* ptIndices, vtkAbstractArray* source, double* weights) override;
235
240 vtkAbstractArray* source2, double t) override;
241
245 void SetVariantValue(vtkIdType idx, vtkVariant value) override;
246
250 void InsertVariantValue(vtkIdType idx, vtkVariant value) override;
251
255 void RemoveTuple(vtkIdType id) override;
256
260 void RemoveFirstTuple() override;
261
265 void RemoveLastTuple() override;
266
270 void SetTypedTuple(vtkIdType i, const Scalar* t);
271
275 void SetTypedComponent(vtkIdType t, int c, Scalar v);
276
280 void InsertTypedTuple(vtkIdType i, const Scalar* t);
281
286
290 void SetValue(vtkIdType idx, Scalar value);
291
296
300 void InsertValue(vtkIdType idx, Scalar v);
301
303
306 vtkSetMacro(Normalize, bool);
307 vtkGetMacro(Normalize, bool);
309
314 void* GetVoidPointer(vtkIdType valueIdx) override;
315
316protected:
319
321
324 bool AllocateTuples(vtkIdType numTuples);
327
331 virtual void Transform(Scalar* tuple) const = 0;
332
333 using Superclass::ComputeFiniteScalarRange;
334 using Superclass::ComputeFiniteVectorRange;
335 using Superclass::ComputeScalarRange;
336 using Superclass::ComputeVectorRange;
337
341 bool ComputeScalarRange(double* range) override;
342
346 bool ComputeVectorRange(double range[2]) override;
347
351 bool ComputeFiniteScalarRange(double* range) override;
352
356 bool ComputeFiniteVectorRange(double range[2]) override;
357
361 virtual void ComputePeriodicRange(bool finite = false);
362
367
368 bool Normalize; // If transformed vector must be normalized
369
370private:
372 void operator=(const vtkPeriodicDataArray&) = delete;
373
374 friend class vtkGenericDataArray<SelfType, ValueType, ArrayTypeTag::value>;
375
376 Scalar* TempScalarArray; // Temporary array used by GetTypedTuple methods
377 double* TempDoubleArray; // Temporary array used by GetTuple vethods
378 vtkIdType TempTupleIdx; // Location of currently stored Temp Tuple to use as cache
379 vtkAOSDataArrayTemplate<Scalar>* Data; // Original data
380 vtkAOSDataArrayTemplate<Scalar>* Cache; // Only used by void pointer
381
382 bool InvalidRange = true;
383 double PeriodicRange[6]; // Transformed periodic range
384 bool InvalidFiniteRange = true;
385 double PeriodicFiniteRange[6]; // Transformed periodic finite range
386};
387
388// Declare vtkArrayDownCast implementations for scaled SoA containers:
390
391VTK_ABI_NAMESPACE_END
392#include "vtkPeriodicDataArray.txx"
393
394#endif // vtkPeriodicDataArray_h
395// VTK-HeaderTest-Exclude: vtkPeriodicDataArray.h
Array-Of-Structs implementation of vtkGenericDataArray.
Abstract superclass for all arrays.
std::integral_constant< int, VTK_OPAQUE > DataTypeTag
std::integral_constant< int, vtkArrayTypes::VTK_ABSTRACT_ARRAY > ArrayTypeTag
Abstract superclass to iterate over elements in an vtkAbstractArray.
abstract superclass for arrays of numeric data
Base interface for all typed vtkDataArray subclasses.
list of point or cell ids
Definition vtkIdList.h:133
a simple class to control print indentation
Definition vtkIndent.h:108
Map native an Array into an angulat periodic array.
void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output) override
Copy tuples from id p1 to id p2 included into provided array.
void InsertTypedTuple(vtkIdType i, const Scalar *t)
Read only container, not supported.
void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output) override
Copy tuples values, selected by ptIds into provided array.
void SetTuple(vtkIdType i, const double *source) override
Read only container, not supported.
bool AllocateTuples(vtkIdType numTuples)
Read only container, not supported.
vtkTypeBool Allocate(vtkIdType sz, vtkIdType ext) override
Read only container, not supported.
void ClearLookup() override
Not implemented.
vtkIdType InsertNextTuple(const double *source) override
Read only container, not supported.
unsigned long GetActualMemorySize() const override
Return the memory in kilobytes consumed by this data array.
vtkTemplateTypeMacro(vtkPeriodicDataArray< Scalar >, GenericDataArrayType)
vtkIdType LookupTypedValue(Scalar value) override
Not implemented.
virtual void ComputePeriodicRange(bool finite=false)
Update the transformed periodic range.
void SetNumberOfTuples(vtkIdType number) override
Read only container, not supported.
bool ComputeScalarRange(double *range) override
Get the transformed range by components.
void LookupValue(vtkVariant value, vtkIdList *ids) override
Not implemented.
vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source) override
Read only container, error.
void RemoveTuple(vtkIdType id) override
Read only container, not supported.
vtkArrayIterator * NewIterator() override
Not implemented.
void SetValue(vtkIdType idx, Scalar value)
Read only container, not supported.
bool ComputeFiniteScalarRange(double *range) override
Get the finite transformed range by components.
void DeepCopy(vtkAbstractArray *aa) override
Read only container, not supported.
void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source) override
Read only container, not supported.
void InsertVariantValue(vtkIdType idx, vtkVariant value) override
Read only container, not supported.
ValueType & GetValueReference(vtkIdType idx)
Get value at index idx as reference.
bool ComputeFiniteVectorRange(double range[2]) override
Get the transformed finite range on all components.
vtkIdType InsertNextTypedTuple(const Scalar *t)
Read only container, not supported.
void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source) override
Read only container, not supported.
void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source) override
Read only container, not supported.
void LookupTypedValue(Scalar value, vtkIdList *ids) override
Not implemented.
void GetTypedTuple(vtkIdType idx, Scalar *t) const
Copy tuple value at location idx into provided array.
void SetTuple(vtkIdType i, const float *source) override
Read only container, not supported.
void SetTypedComponent(vtkIdType t, int c, Scalar v)
Read only container, not supported.
bool ReallocateTuples(vtkIdType numTuples)
Read only container, not supported.
void InsertTuples(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray *source) override
Read only container, not supported.
vtkTypeBool Resize(vtkIdType numTuples) override
Read only container, not supported.
vtkVariant GetVariantValue(vtkIdType idx) override
Not implemented.
virtual void Transform(Scalar *tuple) const =0
Transform the provided tuple.
void InitializeArray(vtkAOSDataArrayTemplate< Scalar > *inputData)
Initialize the mapped array with the original input data array.
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Return the requested component of the specified tuple.
void RemoveLastTuple() override
Read only container, not supported.
void SetVariantValue(vtkIdType idx, vtkVariant value) override
Read only container, not supported.
void * GetVoidPointer(vtkIdType valueIdx) override
Use of this method is discouraged, it creates a memory copy of the data into a contiguous AoS-ordered...
void Squeeze() override
No effect.
bool ComputeVectorRange(double range[2]) override
Get the transformed range on all components.
vtkIdType InsertNextValue(Scalar v)
Read only container, not supported.
void InvalidateRange()
Set the invalid range flag to false.
void InsertTuple(vtkIdType i, const float *source) override
Read only container, not supported.
std::integral_constant< int, vtkArrayTypes::VTK_ABSTRACT_ARRAY > ArrayTypeTag
void RemoveFirstTuple() override
Read only container, not supported.
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
Read only container, not supported.
void InsertTuple(vtkIdType i, const double *source) override
Read only container, not supported.
void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices, vtkAbstractArray *source, double *weights) override
Read only container, not supported.
void DeepCopy(vtkDataArray *da) override
Read only container, not supported.
ValueType GetValue(vtkIdType idx) const
Get value at index idx.
void Initialize() override
Initialize array with zero values.
void GetTuple(vtkIdType i, double *tuple) override
Copy tuple at location i into user provided array.
void SetTypedTuple(vtkIdType i, const Scalar *t)
Read only container, not supported.
void InterpolateTuple(vtkIdType i, vtkIdType id1, vtkAbstractArray *source1, vtkIdType id2, vtkAbstractArray *source2, double t) override
Read only container, not supported.
void InsertValue(vtkIdType idx, Scalar v)
Read only container, not supported.
vtkIdType LookupValue(vtkVariant value) override
Not implemented.
~vtkPeriodicDataArray() override
vtkIdType InsertNextTuple(const float *source) override
Read only container, not supported.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
double * GetTuple(vtkIdType i) override
Return tuple at location i.
A type representing the union of many types.
Definition vtkVariant.h:162
int vtkTypeBool
Definition vtkABI.h:64
#define vtkArrayDownCast_TemplateFastCastMacro(ArrayT)
Same as vtkArrayDownCast_FastCastMacro, but treats ArrayT as a single-parameter template (the paramet...
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
int vtkIdType
Definition vtkType.h:367
@ VTK_PERIODIC_DATA_ARRAY
Definition vtkType.h:87
#define VTK_NEWINSTANCE