VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkDataArray.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDataArray.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 =========================================================================*/
42 #ifndef __vtkDataArray_h
43 #define __vtkDataArray_h
44 
45 #include "vtkCommonCoreModule.h" // For export macro
46 #include "vtkAbstractArray.h"
47 
48 class vtkDoubleArray;
49 class vtkIdList;
51 class vtkLookupTable;
52 
53 class VTKCOMMONCORE_EXPORT vtkDataArray : public vtkAbstractArray
54 {
55 public:
57  void PrintSelf(ostream& os, vtkIndent indent);
58 
60 
64  virtual int IsNumeric()
65  { return 1; }
67 
69 
72  { return this->GetDataTypeSize(); }
74 
80  virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) = 0;
81 
86  virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) = 0;
87 
93  virtual vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray* source) = 0;
94 
98  virtual void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output);
99 
103  virtual void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output);
104 
105 
107 
111  virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
112  vtkAbstractArray* source, double* weights);
114 
116 
121  virtual void InterpolateTuple(vtkIdType i,
122  vtkIdType id1, vtkAbstractArray* source1,
123  vtkIdType id2, vtkAbstractArray* source2, double t);
125 
130  virtual double *GetTuple(vtkIdType i) = 0;
131 
135  virtual void GetTuple(vtkIdType i, double * tuple) = 0;
136 
138 
141  double GetTuple1(vtkIdType i);
142  double* GetTuple2(vtkIdType i);
143  double* GetTuple3(vtkIdType i);
144  double* GetTuple4(vtkIdType i);
145  double* GetTuple9(vtkIdType i);
147 
149 
152  virtual void SetTuple(vtkIdType i, const float * tuple) = 0;
153  virtual void SetTuple(vtkIdType i, const double * tuple) = 0;
155 
157 
160  void SetTuple1(vtkIdType i, double value);
161  void SetTuple2(vtkIdType i, double val0, double val1);
162  void SetTuple3(vtkIdType i, double val0, double val1, double val2);
163  void SetTuple4(vtkIdType i, double val0, double val1, double val2,
164  double val3);
165  void SetTuple9(vtkIdType i, double val0, double val1, double val2,
166  double val3, double val4, double val5, double val6,
167  double val7, double val8);
169 
171 
173  virtual void InsertTuple(vtkIdType i, const float * tuple) = 0;
174  virtual void InsertTuple(vtkIdType i, const double * tuple) = 0;
176 
178 
181  void InsertTuple1(vtkIdType i, double value);
182  void InsertTuple2(vtkIdType i, double val0, double val1);
183  void InsertTuple3(vtkIdType i, double val0, double val1, double val2);
184  void InsertTuple4(vtkIdType i, double val0, double val1, double val2,
185  double val3);
186  void InsertTuple9(vtkIdType i, double val0, double val1, double val2,
187  double val3, double val4, double val5, double val6,
188  double val7, double val8);
190 
192 
195  virtual vtkIdType InsertNextTuple(const float * tuple) = 0;
196  virtual vtkIdType InsertNextTuple(const double * tuple) = 0;
198 
200 
203  void InsertNextTuple1(double value);
204  void InsertNextTuple2(double val0, double val1);
205  void InsertNextTuple3(double val0, double val1, double val2);
206  void InsertNextTuple4(double val0, double val1, double val2,
207  double val3);
208  void InsertNextTuple9(double val0, double val1, double val2,
209  double val3, double val4, double val5, double val6,
210  double val7, double val8);
212 
214 
217  virtual void RemoveTuple(vtkIdType id) = 0;
218  virtual void RemoveFirstTuple() = 0;
219  virtual void RemoveLastTuple() = 0;
221 
225  virtual double GetComponent(vtkIdType i, int j);
226 
231  virtual void SetComponent(vtkIdType i, int j, double c);
232 
236  virtual void InsertComponent(vtkIdType i, int j, double c);
237 
239 
245  virtual void GetData(vtkIdType tupleMin, vtkIdType tupleMax, int compMin,
246  int compMax, vtkDoubleArray* data);
248 
250 
252  virtual void DeepCopy(vtkAbstractArray *aa);
253  virtual void DeepCopy(vtkDataArray *da);
255 
260  virtual void FillComponent(int j, double c);
261 
263 
269  virtual void CopyComponent(int j, vtkDataArray *from,
270  int fromComponent);
272 
276  virtual void* WriteVoidPointer(vtkIdType id, vtkIdType number) = 0;
277 
284  virtual unsigned long GetActualMemorySize();
285 
288  void CreateDefaultLookupTable();
289 
291 
292  void SetLookupTable(vtkLookupTable *lut);
293  vtkGetObjectMacro(LookupTable,vtkLookupTable);
295 
297 
301  void GetRange(double range[2], int comp)
302  {
303  this->ComputeRange(range, comp);
304  }
306 
308 
313  double* GetRange(int comp)
314  {
315  this->GetRange(this->Range, comp);
316  return this->Range;
317  }
319 
321 
323  double* GetRange()
324  {
325  return this->GetRange(0);
326  }
328 
330 
332  void GetRange(double range[2])
333  {
334  this->GetRange(range,0);
335  }
337 
338 
341  void GetDataTypeRange(double range[2]);
342  double GetDataTypeMin();
343  double GetDataTypeMax();
344  static void GetDataTypeRange(int type, double range[2]);
345  static double GetDataTypeMin(int type);
346  static double GetDataTypeMax(int type);
348 
351  virtual double GetMaxNorm();
352 
358  static vtkDataArray* CreateDataArray(int dataType);
359 
365  static vtkInformationDoubleVectorKey* COMPONENT_RANGE();
370  static vtkInformationDoubleVectorKey* L2_NORM_RANGE();
371 
377  virtual int CopyInformation(vtkInformation *infoFrom, int deep=1);
378 
379 protected:
384  virtual void ComputeRange(double range[2], int comp);
386 
387  virtual void ComputeScalarRange(double range[2], int comp);
388  virtual void ComputeVectorRange(double range[2]);
390 
391  // Construct object with default tuple dimension (number of components) of 1.
392  vtkDataArray(vtkIdType numComp=1);
393  ~vtkDataArray();
394 
396  double Range[2];
397 
398 private:
399  double* GetTupleN(vtkIdType i, int n);
400 
401 private:
402  vtkDataArray(const vtkDataArray&); // Not implemented.
403  void operator=(const vtkDataArray&); // Not implemented.
404 };
405 
406 #endif
void PrintSelf(ostream &os, vtkIndent indent)
void GetRange(double range[2])
Definition: vtkDataArray.h:332
virtual void DeepCopy(vtkAbstractArray *da)
Store vtkAlgorithm input/output information.
Abstract superclass for all arrays.
virtual int GetDataTypeSize()=0
virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
map scalar values into colors via a lookup table
virtual int IsNumeric()
Definition: vtkDataArray.h:64
virtual int GetElementComponentSize()
Definition: vtkDataArray.h:71
int vtkIdType
Definition: vtkType.h:268
void GetRange(double range[2], int comp)
Definition: vtkDataArray.h:301
virtual int CopyInformation(vtkInformation *infoFrom, int deep=1)
dynamic, self-adjusting array of double
double * GetRange(int comp)
Definition: vtkDataArray.h:313
Key for double vector values.
a simple class to control print indentation
Definition: vtkIndent.h:38
double * GetRange()
Definition: vtkDataArray.h:323
list of point or cell ids
Definition: vtkIdList.h:35
virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:53
virtual void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output)
vtkLookupTable * LookupTable
Definition: vtkDataArray.h:395
virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices, vtkAbstractArray *source, double *weights)=0
virtual vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source)=0
virtual unsigned long GetActualMemorySize()=0
#define vtkDataArray