VTK  9.3.1
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 
23 VTK_ABI_NAMESPACE_BEGIN
24 template <class Scalar>
25 class vtkPeriodicDataArray : public vtkGenericDataArray<vtkPeriodicDataArray<Scalar>, Scalar>
26 {
28 
29 public:
31  typedef typename Superclass::ValueType ValueType;
32 
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
39 
43  void Initialize() override;
44 
48  void GetTuples(vtkIdList* ptIds, vtkAbstractArray* output) override;
49 
53  void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray* output) override;
54 
58  void Squeeze() override;
59 
64 
69 
73  void LookupValue(vtkVariant value, vtkIdList* ids) override;
74 
78  vtkVariant GetVariantValue(vtkIdType idx) override;
79 
83  void ClearLookup() override;
84 
89  double* GetTuple(vtkIdType i) override;
90 
94  void GetTuple(vtkIdType i, double* tuple) override;
95 
99  vtkIdType LookupTypedValue(Scalar value) override;
100 
104  void LookupTypedValue(Scalar value, vtkIdList* ids) override;
105 
111  ValueType GetValue(vtkIdType idx) const;
112 
118  ValueType& GetValueReference(vtkIdType idx);
119 
123  void GetTypedTuple(vtkIdType idx, Scalar* t) const;
124 
130  ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const;
131 
135  unsigned long GetActualMemorySize() const override;
136 
140  vtkTypeBool Allocate(vtkIdType sz, vtkIdType ext) override;
141 
145  vtkTypeBool Resize(vtkIdType numTuples) override;
146 
150  void SetNumberOfTuples(vtkIdType number) override;
151 
155  void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) override;
156 
160  void SetTuple(vtkIdType i, const float* source) override;
161 
165  void SetTuple(vtkIdType i, const double* source) override;
166 
170  void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) override;
171 
175  void InsertTuple(vtkIdType i, const float* source) override;
176 
180  void InsertTuple(vtkIdType i, const double* source) override;
181 
185  void InsertTuples(vtkIdList* dstIds, vtkIdList* srcIds, vtkAbstractArray* source) override;
186 
191  vtkIdType dstStart, vtkIdList* srcIds, vtkAbstractArray* source) override;
192 
196  void InsertTuples(
197  vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray* source) override;
198 
203 
207  vtkIdType InsertNextTuple(const float* source) override;
208 
212  vtkIdType InsertNextTuple(const double* source) override;
213 
217  void DeepCopy(vtkAbstractArray* aa) override;
218 
222  void DeepCopy(vtkDataArray* da) override;
223 
227  void InterpolateTuple(
228  vtkIdType i, vtkIdList* ptIndices, vtkAbstractArray* source, double* weights) override;
229 
234  vtkAbstractArray* source2, double t) override;
235 
239  void SetVariantValue(vtkIdType idx, vtkVariant value) override;
240 
244  void InsertVariantValue(vtkIdType idx, vtkVariant value) override;
245 
249  void RemoveTuple(vtkIdType id) override;
250 
254  void RemoveFirstTuple() override;
255 
259  void RemoveLastTuple() override;
260 
264  void SetTypedTuple(vtkIdType i, const Scalar* t);
265 
269  void SetTypedComponent(vtkIdType t, int c, Scalar v);
270 
274  void InsertTypedTuple(vtkIdType i, const Scalar* t);
275 
279  vtkIdType InsertNextTypedTuple(const Scalar* t);
280 
284  void SetValue(vtkIdType idx, Scalar value);
285 
289  vtkIdType InsertNextValue(Scalar v);
290 
294  void InsertValue(vtkIdType idx, Scalar v);
295 
297 
300  vtkSetMacro(Normalize, bool);
301  vtkGetMacro(Normalize, bool);
303 
304 protected:
306  ~vtkPeriodicDataArray() override;
307 
309 
312  bool AllocateTuples(vtkIdType numTuples);
313  bool ReallocateTuples(vtkIdType numTuples);
315 
319  virtual void Transform(Scalar* tuple) const = 0;
320 
321  using Superclass::ComputeFiniteScalarRange;
322  using Superclass::ComputeFiniteVectorRange;
323  using Superclass::ComputeScalarRange;
324  using Superclass::ComputeVectorRange;
325 
329  bool ComputeScalarRange(double* range) override;
330 
334  bool ComputeVectorRange(double range[2]) override;
335 
339  bool ComputeFiniteScalarRange(double* range) override;
340 
344  bool ComputeFiniteVectorRange(double range[2]) override;
345 
349  virtual void ComputePeriodicRange(bool finite = false);
350 
354  void InvalidateRange();
355 
356  bool Normalize; // If transformed vector must be normalized
357 
358 private:
360  void operator=(const vtkPeriodicDataArray&) = delete;
361 
362  friend class vtkGenericDataArray<vtkPeriodicDataArray<Scalar>, Scalar>;
363 
364  Scalar* TempScalarArray; // Temporary array used by GetTypedTuple methods
365  double* TempDoubleArray; // Temporary array used by GetTuple vethods
366  vtkIdType TempTupleIdx; // Location of currently stored Temp Tuple to use as cache
367  vtkAOSDataArrayTemplate<Scalar>* Data; // Original data
368 
369  bool InvalidRange = true;
370  double PeriodicRange[6]; // Transformed periodic range
371  bool InvalidFiniteRange = true;
372  double PeriodicFiniteRange[6]; // Transformed periodic finite range
373 };
374 
375 VTK_ABI_NAMESPACE_END
376 #include "vtkPeriodicDataArray.txx"
377 
378 #endif // vtkPeriodicDataArray_h
379 // VTK-HeaderTest-Exclude: vtkPeriodicDataArray.h
vtkIdType InsertNextValue(Scalar v)
Read only container, not supported.
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
Read only container, not supported.
void RemoveFirstTuple() override
Read only container, not supported.
ValueType GetValue(vtkIdType idx) const
Get value at index idx.
bool ComputeFiniteVectorRange(double range[2]) override
Get the transformed finite range on all components.
Abstract superclass for all arrays.
vtkIdType LookupTypedValue(Scalar value) override
Not implemented.
void DeepCopy(vtkAbstractArray *aa) override
Read only container, not supported.
void InsertValue(vtkIdType idx, Scalar v)
Read only container, not supported.
bool AllocateTuples(vtkIdType numTuples)
Read only container, not supported.
vtkTemplateTypeMacro(vtkPeriodicDataArray< Scalar >, GenericBase)
vtkIdType LookupValue(vtkVariant value) override
Not implemented.
virtual void ComputePeriodicRange(bool finite=false)
Update the transformed periodic range.
void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source) override
Read only container, not supported.
void InvalidateRange()
Set the invalid range flag to false.
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Return the requested component of the specified tuple.
Superclass::ValueType ValueType
int vtkIdType
Definition: vtkType.h:315
Base interface for all typed vtkDataArray subclasses.
A type representing the union of many types.
Definition: vtkVariant.h:52
void SetTypedTuple(vtkIdType i, const Scalar *t)
Read only container, not supported.
vtkVariant GetVariantValue(vtkIdType idx) override
Not implemented.
vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source) override
Read only container, error.
void Squeeze() override
No effect.
int vtkTypeBool
Definition: vtkABI.h:64
void Initialize() override
Initialize array with zero values.
void SetNumberOfTuples(vtkIdType number) override
Read only container, not supported.
void InsertTypedTuple(vtkIdType i, const Scalar *t)
Read only container, not supported.
Map native an Array into an angulat periodic array.
void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices, vtkAbstractArray *source, double *weights) override
Read only container, not supported.
void ClearLookup() override
Not implemented.
bool ComputeFiniteScalarRange(double *range) override
Get the finite transformed range by components.
a simple class to control print indentation
Definition: vtkIndent.h:28
unsigned long GetActualMemorySize() const override
Return the memory in kilobytes consumed by this data array.
list of point or cell ids
Definition: vtkIdList.h:22
void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source) override
Read only container, not supported.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
void InsertVariantValue(vtkIdType idx, vtkVariant value) override
Read only container, not supported.
void SetTypedComponent(vtkIdType t, int c, Scalar v)
Read only container, not supported.
virtual void Transform(Scalar *tuple) const =0
Transform the provided tuple.
Abstract superclass to iterate over elements in an vtkAbstractArray.
double * GetTuple(vtkIdType i) override
Return tuple at location i.
vtkTypeBool Allocate(vtkIdType sz, vtkIdType ext) override
Read only container, not supported.
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define VTK_NEWINSTANCE
void InitializeArray(vtkAOSDataArrayTemplate< Scalar > *inputData)
Initialize the mapped array with the original input data array.
void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source) override
Read only container, not supported.
bool ComputeScalarRange(double *range) override
Get the transformed range by components.
void GetTypedTuple(vtkIdType idx, Scalar *t) const
Copy tuple value at location idx into provided array.
void RemoveTuple(vtkIdType id) override
Read only container, not supported.
bool ReallocateTuples(vtkIdType numTuples)
Read only container, not supported.
~vtkPeriodicDataArray() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void RemoveLastTuple() override
Read only container, not supported.
vtkArrayIterator * NewIterator() override
Not implemented.
vtkTypeBool Resize(vtkIdType numTuples) override
Read only container, not supported.
ValueType & GetValueReference(vtkIdType idx)
Get value at index idx as reference.
void SetVariantValue(vtkIdType idx, vtkVariant value) override
Read only container, not supported.
void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output) override
Copy tuples values, selected by ptIds into provided array.
void SetValue(vtkIdType idx, Scalar value)
Read only container, not supported.
bool ComputeVectorRange(double range[2]) override
Get the transformed range on all components.
vtkIdType InsertNextTypedTuple(const Scalar *t)
Read only container, not supported.