VTK
vtkPeriodicDataArray.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPeriodicDataArray.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 =========================================================================*/
15 
29 #ifndef vtkPeriodicDataArray_h
30 #define vtkPeriodicDataArray_h
31 
32 #include "vtkGenericDataArray.h" // Parent
33 #include "vtkAOSDataArrayTemplate.h" // Template
34 
35 template <class Scalar>
37  public vtkGenericDataArray<vtkPeriodicDataArray<Scalar>, Scalar>
38 {
40 public:
42  typedef typename Superclass::ValueType ValueType;
43 
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
50 
54  void Initialize() override;
55 
59  void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output) override;
60 
64  void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output) override;
65 
69  void Squeeze() override;
70 
75 
80 
84  void LookupValue(vtkVariant value, vtkIdList *ids) override;
85 
89  vtkVariant GetVariantValue(vtkIdType idx) override;
90 
94  void ClearLookup() override;
95 
100  double* GetTuple(vtkIdType i) override;
101 
105  void GetTuple(vtkIdType i, double *tuple) override;
106 
110  vtkIdType LookupTypedValue(Scalar value) override;
111 
115  void LookupTypedValue(Scalar value, vtkIdList *ids) override;
116 
122  ValueType GetValue(vtkIdType idx) const ;
123 
130 
134  void GetTypedTuple(vtkIdType idx, Scalar *t) const;
135 
141  ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const;
142 
146  unsigned long GetActualMemorySize() override;
147 
151  vtkTypeBool Allocate(vtkIdType sz, vtkIdType ext) override;
152 
156  vtkTypeBool Resize(vtkIdType numTuples) override;
157 
161  void SetNumberOfTuples(vtkIdType number) override;
162 
166  void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source) override;
167 
171  void SetTuple(vtkIdType i, const float *source) override;
172 
176  void SetTuple(vtkIdType i, const double *source) override;
177 
181  void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source) override;
182 
186  void InsertTuple(vtkIdType i, const float *source) override;
187 
191  void InsertTuple(vtkIdType i, const double *source) override;
192 
196  void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds,
197  vtkAbstractArray *source) override;
198 
202  void InsertTuples(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart,
203  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 
233  void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
234  vtkAbstractArray* source, double* weights) override;
235 
240  vtkIdType id2, 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 
285  vtkIdType InsertNextTypedTuple(const Scalar *t);
286 
290  void SetValue(vtkIdType idx, Scalar value);
291 
295  vtkIdType InsertNextValue(Scalar v);
296 
300  void InsertValue(vtkIdType idx, Scalar v);
301 
303 
306  vtkSetMacro(Normalize, bool);
307  vtkGetMacro(Normalize, bool);
309 
310 protected:
312  ~vtkPeriodicDataArray() override;
313 
315 
318  bool AllocateTuples(vtkIdType numTuples);
319  bool ReallocateTuples(vtkIdType numTuples);
321 
325  virtual void Transform(Scalar* tuple) const = 0;
326 
330  bool ComputeScalarRange(double* range) override;
331 
335  bool ComputeVectorRange(double range[2]) override;
336 
340  virtual void ComputePeriodicRange();
341 
345  void InvalidateRange();
346 
347  bool Normalize; // If transformed vector must be normalized
348 
349 private:
350  vtkPeriodicDataArray(const vtkPeriodicDataArray &) = delete;
351  void operator=(const vtkPeriodicDataArray &) = delete;
352 
353  friend class vtkGenericDataArray<vtkPeriodicDataArray<Scalar>, Scalar>;
354 
355  Scalar* TempScalarArray; // Temporary array used by GetTypedTuple methods
356  double* TempDoubleArray; // Temporary array used by GetTuple vethods
357  vtkIdType TempTupleIdx; // Location of currently stored Temp Tuple to use as cache
358  vtkAOSDataArrayTemplate<Scalar>* Data; // Original data
359 
360  bool InvalidRange;
361  double PeriodicRange[6]; // Transformed periodic range
362 };
363 
364 #include "vtkPeriodicDataArray.txx"
365 
366 #endif //vtkPeriodicDataArray_h
367 // VTK-HeaderTest-Exclude: vtkPeriodicDataArray.h
vtkPeriodicDataArray::vtkPeriodicDataArray
vtkPeriodicDataArray()
vtkPeriodicDataArray
Map native an Array into an angulat periodic array.
Definition: vtkPeriodicDataArray.h:36
vtkGenericDataArray< vtkPeriodicDataArray< Scalar >, Scalar >::ValueType
Scalar ValueType
Definition: vtkGenericDataArray.h:83
vtkPeriodicDataArray::SetTypedComponent
void SetTypedComponent(vtkIdType t, int c, Scalar v)
Read only container, not supported.
vtkPeriodicDataArray::ComputeVectorRange
bool ComputeVectorRange(double range[2]) override
Get the transformed range on all components.
vtkPeriodicDataArray::Normalize
bool Normalize
Definition: vtkPeriodicDataArray.h:347
vtkPeriodicDataArray::InsertNextTuple
vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source) override
Read only container, error.
vtkPeriodicDataArray::InsertTuples
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
Read only container, not supported.
vtkPeriodicDataArray::SetNumberOfTuples
void SetNumberOfTuples(vtkIdType number) override
Read only container, not supported.
vtkX3D::value
Definition: vtkX3D.h:220
vtkPeriodicDataArray::AllocateTuples
bool AllocateTuples(vtkIdType numTuples)
Read only container, not supported.
vtkIdType
int vtkIdType
Definition: vtkType.h:349
vtkPeriodicDataArray::PrintSelf
vtkTemplateTypeMacro(vtkPeriodicDataArray< Scalar >, GenericBase) typedef typename Superclass void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAOSDataArrayTemplate.h
vtkGenericDataArray
Base interface for all typed vtkDataArray subclasses.
Definition: vtkGenericDataArray.h:79
vtkPeriodicDataArray::InsertNextValue
vtkIdType InsertNextValue(Scalar v)
Read only container, not supported.
vtkX3D::range
Definition: vtkX3D.h:238
vtkPeriodicDataArray::LookupTypedValue
vtkIdType LookupTypedValue(Scalar value) override
Not implemented.
vtkPeriodicDataArray::ComputeScalarRange
bool ComputeScalarRange(double *range) override
Get the transformed range by components.
vtkPeriodicDataArray::InitializeArray
void InitializeArray(vtkAOSDataArrayTemplate< Scalar > *inputData)
Initialize the mapped array with the original input data array.
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkPeriodicDataArray::Resize
vtkTypeBool Resize(vtkIdType numTuples) override
Read only container, not supported.
vtkPeriodicDataArray::SetValue
void SetValue(vtkIdType idx, Scalar value)
Read only container, not supported.
vtkPeriodicDataArray::InsertValue
void InsertValue(vtkIdType idx, Scalar v)
Read only container, not supported.
vtkPeriodicDataArray::InsertVariantValue
void InsertVariantValue(vtkIdType idx, vtkVariant value) override
Read only container, not supported.
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:824
vtkPeriodicDataArray::~vtkPeriodicDataArray
~vtkPeriodicDataArray() override
vtkPeriodicDataArray::GetValueReference
ValueType & GetValueReference(vtkIdType idx)
Get value at index idx as reference.
vtkPeriodicDataArray::InvalidateRange
void InvalidateRange()
Set the invalid range flag to false.
vtkPeriodicDataArray::RemoveTuple
void RemoveTuple(vtkIdType id) override
Read only container, not supported.
vtkPeriodicDataArray::ReallocateTuples
bool ReallocateTuples(vtkIdType numTuples)
vtkPeriodicDataArray::GetVariantValue
vtkVariant GetVariantValue(vtkIdType idx) override
Not implemented.
vtkPeriodicDataArray::InsertTuple
void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source) override
Read only container, not supported.
vtkPeriodicDataArray::RemoveLastTuple
void RemoveLastTuple() override
Read only container, not supported.
vtkPeriodicDataArray::GetTuples
void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output) override
Copy tuples values, selected by ptIds into provided array.
vtkPeriodicDataArray::ComputePeriodicRange
virtual void ComputePeriodicRange()
Update the transformed periodic range.
vtkGenericDataArray< vtkPeriodicDataArray< Scalar >, Scalar >::vtkTemplateTypeMacro
vtkTemplateTypeMacro(SelfType, vtkDataArray) enum
Compile time access to the VTK type identifier.
Definition: vtkGenericDataArray.h:84
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkPeriodicDataArray::GetTuple
double * GetTuple(vtkIdType i) override
Return tuple at location i.
vtkPeriodicDataArray::SetVariantValue
void SetVariantValue(vtkIdType idx, vtkVariant value) override
Read only container, not supported.
vtkGenericDataArray.h
vtkVariant
A atomic type representing the union of many types.
Definition: vtkVariant.h:71
vtkPeriodicDataArray::NewIterator
vtkArrayIterator * NewIterator() override
Not implemented.
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
vtkPeriodicDataArray::GetActualMemorySize
unsigned long GetActualMemorySize() override
Return the memory in kilobytes consumed by this data array.
vtkPeriodicDataArray::SetTuple
void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source) override
Read only container, not supported.
vtkPeriodicDataArray::LookupValue
vtkIdType LookupValue(vtkVariant value) override
Not implemented.
vtkPeriodicDataArray::RemoveFirstTuple
void RemoveFirstTuple() override
Read only container, not supported.
vtkPeriodicDataArray::ClearLookup
void ClearLookup() override
Not implemented.
vtkPeriodicDataArray::Transform
virtual void Transform(Scalar *tuple) const =0
Transform the provided tuple.
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:78
vtkPeriodicDataArray::Squeeze
void Squeeze() override
No effect.
vtkPeriodicDataArray::Initialize
void Initialize() override
Initialize array with zero values.
vtkPeriodicDataArray::DeepCopy
void DeepCopy(vtkAbstractArray *aa) override
Read only container, not supported.
vtkPeriodicDataArray::InterpolateTuple
void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices, vtkAbstractArray *source, double *weights) override
Read only container, not supported.
vtkArrayIterator
Abstract superclass to iterate over elements in an vtkAbstractArray.
Definition: vtkArrayIterator.h:49
vtkPeriodicDataArray::SetTypedTuple
void SetTypedTuple(vtkIdType i, const Scalar *t)
Read only container, not supported.
vtkPeriodicDataArray::Allocate
vtkTypeBool Allocate(vtkIdType sz, vtkIdType ext) override
Read only container, not supported.
vtkPeriodicDataArray::InsertNextTypedTuple
vtkIdType InsertNextTypedTuple(const Scalar *t)
Read only container, not supported.
vtkAOSDataArrayTemplate< Scalar >
vtkPeriodicDataArray::GetValue
ValueType GetValue(vtkIdType idx) const
Get value at index idx.
VTK_NEWINSTANCE
#define VTK_NEWINSTANCE
Definition: vtkWrappingHints.h:42
vtkPeriodicDataArray::InsertTypedTuple
void InsertTypedTuple(vtkIdType i, const Scalar *t)
Read only container, not supported.
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkPeriodicDataArray::GetTypedTuple
void GetTypedTuple(vtkIdType idx, Scalar *t) const
Copy tuple value at location idx into provided array.
vtkPeriodicDataArray::GetTypedComponent
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Return the requested component of the specified tuple.