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 
28 #ifndef vtkPeriodicDataArray_h
29 #define vtkPeriodicDataArray_h
30 
31 #include "vtkMappedDataArray.h" // Parent
32 #include "vtkDataArrayTemplate.h" // Template
33 
34 template <class Scalar>
36 public vtkTypeTemplate <vtkPeriodicDataArray <Scalar>, vtkMappedDataArray <Scalar> >
37 {
38 public:
39  virtual void PrintSelf(ostream &os, vtkIndent indent);
40 
43 
45  void Initialize();
46 
48  void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output);
49 
51  void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output);
52 
54  void Squeeze();
55 
58 
61 
63  void LookupValue(vtkVariant value, vtkIdList *ids);
64 
67 
69  void ClearLookup();
70 
73  double* GetTuple(vtkIdType i);
74 
76  void GetTuple(vtkIdType i, double *tuple);
77 
79  vtkIdType LookupTypedValue(Scalar value);
80 
82  void LookupTypedValue(Scalar value, vtkIdList *ids);
83 
86  Scalar GetValue(vtkIdType idx);
87 
90  Scalar& GetValueReference(vtkIdType idx);
91 
93  void GetTupleValue(vtkIdType idx, Scalar *t);
94 
96  unsigned long GetActualMemorySize();
97 
99  int Allocate(vtkIdType sz, vtkIdType ext);
100 
102  int Resize(vtkIdType numTuples);
103 
105  void SetNumberOfTuples(vtkIdType number);
106 
109 
111  void SetTuple(vtkIdType i, const float *source);
112 
114  void SetTuple(vtkIdType i, const double *source);
115 
117  void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source);
118 
120  void InsertTuple(vtkIdType i, const float *source);
121 
123  void InsertTuple(vtkIdType i, const double *source);
124 
126 
127  void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds,
128  vtkAbstractArray *source);
130 
132 
133  void InsertTuples(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart,
134  vtkAbstractArray* source);
136 
139 
141  vtkIdType InsertNextTuple(const float *source);
142 
144  vtkIdType InsertNextTuple(const double *source);
145 
147  void DeepCopy(vtkAbstractArray *aa);
148 
150  void DeepCopy(vtkDataArray *da);
151 
153 
154  void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
155  vtkAbstractArray* source, double* weights);
157 
159 
161  vtkIdType id2, vtkAbstractArray *source2, double t);
163 
165  void SetVariantValue(vtkIdType idx, vtkVariant value);
166 
168  void InsertVariantValue(vtkIdType idx, vtkVariant value);
169 
171  void RemoveTuple(vtkIdType id);
172 
174  void RemoveFirstTuple();
175 
177  void RemoveLastTuple();
178 
180  void SetTupleValue(vtkIdType i, const Scalar *t);
181 
183  void InsertTupleValue(vtkIdType i, const Scalar *t);
184 
186  vtkIdType InsertNextTupleValue(const Scalar *t);
187 
189  void SetValue(vtkIdType idx, Scalar value);
190 
192  vtkIdType InsertNextValue(Scalar v);
193 
195  void InsertValue(vtkIdType idx, Scalar v);
196 
198 
199  vtkSetMacro(Normalize, bool);
200  vtkGetMacro(Normalize, bool);
202 
203 protected:
206 
208  virtual void Transform(Scalar* tuple) = 0;
209 
211  virtual bool ComputeScalarRange(double* range);
212 
214  virtual bool ComputeVectorRange(double range[2]);
215 
217  virtual void ComputePeriodicRange();
218 
220  void InvalidateRange();
221 
222  bool Normalize; // If transformed vector must be normalized
223 
224 private:
225  vtkPeriodicDataArray(const vtkPeriodicDataArray &); // Not implemented.
226  void operator=(const vtkPeriodicDataArray &); // Not implemented.
227 
228  Scalar* TempScalarArray; // Temporary array used by GetTupleValue methods
229  double* TempDoubleArray; // Temporary array used by GetTuple vethods
230  vtkIdType TempTupleIdx; // Location of currently stored Temp Tuple to use as cache
231  vtkDataArrayTemplate<Scalar>* Data; // Original data
232 
233  bool InvalidRange;
234  double PeriodicRange[6]; // Transformed periodic range
235 };
236 
237 #include "vtkPeriodicDataArray.txx"
238 
239 #endif //vtkPeriodicDataArray_h
240 // VTK-HeaderTest-Exclude: vtkPeriodicDataArray.h
vtkIdType InsertNextValue(Scalar v)
Provides the equivalent of vtkTypeMacro for use with template classes.
void RemoveTuple(vtkIdType id)
void GetTupleValue(vtkIdType idx, Scalar *t)
double * GetTuple(vtkIdType i)
Abstract superclass for all arrays.
void InsertValue(vtkIdType idx, Scalar v)
int Resize(vtkIdType numTuples)
virtual void ComputePeriodicRange()
unsigned long GetActualMemorySize()
int Allocate(vtkIdType sz, vtkIdType ext)
void SetNumberOfTuples(vtkIdType number)
int vtkIdType
Definition: vtkType.h:247
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source)
A atomic type representing the union of many types.
Definition: vtkVariant.h:78
virtual void PrintSelf(ostream &os, vtkIndent indent)
void InsertTupleValue(vtkIdType i, const Scalar *t)
void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)
Map native an Array into an angulat periodic array.
virtual bool ComputeScalarRange(double *range)
vtkIdType LookupValue(vtkVariant value)
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkIdType InsertNextTupleValue(const Scalar *t)
void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices, vtkAbstractArray *source, double *weights)
list of point or cell ids
Definition: vtkIdList.h:35
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkArrayIterator * NewIterator()
void SetTupleValue(vtkIdType i, const Scalar *t)
Abstract superclass to iterate over elements in an vtkAbstractArray.
vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source)
void DeepCopy(vtkAbstractArray *aa)
void InitializeArray(vtkDataArrayTemplate< Scalar > *inputData)
vtkIdType LookupTypedValue(Scalar value)
void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output)
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Scalar & GetValueReference(vtkIdType idx)
Scalar GetValue(vtkIdType idx)
virtual bool ComputeVectorRange(double range[2])
void InsertVariantValue(vtkIdType idx, vtkVariant value)
virtual void Transform(Scalar *tuple)=0
void SetVariantValue(vtkIdType idx, vtkVariant value)
vtkVariant GetVariantValue(vtkIdType idx)
void SetValue(vtkIdType idx, Scalar value)
void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)