VTK
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 
54 {
55 public:
57  void PrintSelf(ostream& os, vtkIndent indent);
58 
64  static vtkDataArray* FastDownCast(vtkAbstractArray *source);
65 
67 
71  virtual int IsNumeric()
72  { return 1; }
74 
76 
79  { return this->GetDataTypeSize(); }
81 
87  virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) = 0;
88 
93  virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) = 0;
94 
101 
105  virtual void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output);
106 
110  virtual void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output);
111 
112 
114 
118  virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
119  vtkAbstractArray* source, double* weights);
121 
123 
128  virtual void InterpolateTuple(vtkIdType i,
129  vtkIdType id1, vtkAbstractArray* source1,
130  vtkIdType id2, vtkAbstractArray* source2, double t);
132 
137  virtual double *GetTuple(vtkIdType i) = 0;
138 
142  virtual void GetTuple(vtkIdType i, double * tuple) = 0;
143 
145 
148  double GetTuple1(vtkIdType i);
149  double* GetTuple2(vtkIdType i);
150  double* GetTuple3(vtkIdType i);
151  double* GetTuple4(vtkIdType i);
152  double* GetTuple9(vtkIdType i);
154 
156 
159  virtual void SetTuple(vtkIdType i, const float * tuple) = 0;
160  virtual void SetTuple(vtkIdType i, const double * tuple) = 0;
162 
164 
167  void SetTuple1(vtkIdType i, double value);
168  void SetTuple2(vtkIdType i, double val0, double val1);
169  void SetTuple3(vtkIdType i, double val0, double val1, double val2);
170  void SetTuple4(vtkIdType i, double val0, double val1, double val2,
171  double val3);
172  void SetTuple9(vtkIdType i, double val0, double val1, double val2,
173  double val3, double val4, double val5, double val6,
174  double val7, double val8);
176 
178 
180  virtual void InsertTuple(vtkIdType i, const float * tuple) = 0;
181  virtual void InsertTuple(vtkIdType i, const double * tuple) = 0;
183 
185 
188  void InsertTuple1(vtkIdType i, double value);
189  void InsertTuple2(vtkIdType i, double val0, double val1);
190  void InsertTuple3(vtkIdType i, double val0, double val1, double val2);
191  void InsertTuple4(vtkIdType i, double val0, double val1, double val2,
192  double val3);
193  void InsertTuple9(vtkIdType i, double val0, double val1, double val2,
194  double val3, double val4, double val5, double val6,
195  double val7, double val8);
197 
199 
202  virtual vtkIdType InsertNextTuple(const float * tuple) = 0;
203  virtual vtkIdType InsertNextTuple(const double * tuple) = 0;
205 
207 
210  void InsertNextTuple1(double value);
211  void InsertNextTuple2(double val0, double val1);
212  void InsertNextTuple3(double val0, double val1, double val2);
213  void InsertNextTuple4(double val0, double val1, double val2,
214  double val3);
215  void InsertNextTuple9(double val0, double val1, double val2,
216  double val3, double val4, double val5, double val6,
217  double val7, double val8);
219 
221 
224  virtual void RemoveTuple(vtkIdType id) = 0;
225  virtual void RemoveFirstTuple() = 0;
226  virtual void RemoveLastTuple() = 0;
228 
232  virtual double GetComponent(vtkIdType i, int j);
233 
238  virtual void SetComponent(vtkIdType i, int j, double c);
239 
243  virtual void InsertComponent(vtkIdType i, int j, double c);
244 
246 
252  virtual void GetData(vtkIdType tupleMin, vtkIdType tupleMax, int compMin,
253  int compMax, vtkDoubleArray* data);
255 
257 
259  virtual void DeepCopy(vtkAbstractArray *aa);
260  virtual void DeepCopy(vtkDataArray *da);
262 
267  virtual void FillComponent(int j, double c);
268 
270 
276  virtual void CopyComponent(int j, vtkDataArray *from,
277  int fromComponent);
279 
283  virtual void* WriteVoidPointer(vtkIdType id, vtkIdType number) = 0;
284 
291  virtual unsigned long GetActualMemorySize();
292 
295  void CreateDefaultLookupTable();
296 
298 
299  void SetLookupTable(vtkLookupTable *lut);
300  vtkGetObjectMacro(LookupTable,vtkLookupTable);
302 
304 
308  void GetRange(double range[2], int comp)
309  {
310  this->ComputeRange(range, comp);
311  }
313 
315 
320  double* GetRange(int comp)
321  {
322  this->GetRange(this->Range, comp);
323  return this->Range;
324  }
326 
328 
330  double* GetRange()
331  {
332  return this->GetRange(0);
333  }
335 
337 
339  void GetRange(double range[2])
340  {
341  this->GetRange(range,0);
342  }
344 
345 
348  void GetDataTypeRange(double range[2]);
349  double GetDataTypeMin();
350  double GetDataTypeMax();
351  static void GetDataTypeRange(int type, double range[2]);
352  static double GetDataTypeMin(int type);
353  static double GetDataTypeMax(int type);
355 
358  virtual double GetMaxNorm();
359 
365  static vtkDataArray* CreateDataArray(int dataType);
366 
372  static vtkInformationDoubleVectorKey* COMPONENT_RANGE();
377  static vtkInformationDoubleVectorKey* L2_NORM_RANGE();
378 
384  virtual int CopyInformation(vtkInformation *infoFrom, int deep=1);
385 
387  virtual int GetArrayType() { return DataArray; }
388 
389 protected:
394  virtual void ComputeRange(double range[2], int comp);
396 
397  virtual void ComputeScalarRange(double range[2], int comp);
398  virtual void ComputeVectorRange(double range[2]);
400 
401  // Construct object with default tuple dimension (number of components) of 1.
402  vtkDataArray();
403  ~vtkDataArray();
404 
406  double Range[2];
407 
408 private:
409  double* GetTupleN(vtkIdType i, int n);
410 
411 private:
412  vtkDataArray(const vtkDataArray&); // Not implemented.
413  void operator=(const vtkDataArray&); // Not implemented.
414 };
415 
416 //------------------------------------------------------------------------------
418 {
419  switch (source->GetArrayType())
420  {
421  case DataArrayTemplate:
422  case TypedDataArray:
423  case DataArray:
424  case MappedDataArray:
425  return static_cast<vtkDataArray*>(source);
426  default:
427  return NULL;
428  }
429 }
430 
431 #endif
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: vtkgl.h:11339
void PrintSelf(ostream &os, vtkIndent indent)
void GetRange(double range[2])
Definition: vtkDataArray.h:339
GLuint GLuint GLsizei GLenum type
Definition: vtkgl.h:11315
virtual void DeepCopy(vtkAbstractArray *da)
Store vtkAlgorithm input/output information.
Abstract superclass for all arrays.
virtual int GetDataTypeSize()=0
#define VTKCOMMONCORE_EXPORT
virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source)=0
map scalar values into colors via a lookup table
virtual int GetArrayType()
Definition: vtkDataArray.h:387
virtual int IsNumeric()
Definition: vtkDataArray.h:71
virtual int GetArrayType()
GLsizei const GLfloat * value
Definition: vtkgl.h:12021
virtual int GetElementComponentSize()
Definition: vtkDataArray.h:78
int vtkIdType
Definition: vtkType.h:268
GLdouble GLdouble t
Definition: vtkgl.h:11602
void GetRange(double range[2], int comp)
Definition: vtkDataArray.h:308
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
virtual int CopyInformation(vtkInformation *infoFrom, int deep=1)
dynamic, self-adjusting array of double
double * GetRange(int comp)
Definition: vtkDataArray.h:320
Key for double vector values.
const GLbyte * weights
Definition: vtkgl.h:12766
a simple class to control print indentation
Definition: vtkIndent.h:38
const GLubyte * c
Definition: vtkgl.h:15720
double * GetRange()
Definition: vtkDataArray.h:330
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:405
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices, vtkAbstractArray *source, double *weights)=0
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
static vtkDataArray * FastDownCast(vtkAbstractArray *source)
Definition: vtkDataArray.h:417
virtual vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source)=0
GLclampd n
Definition: vtkgl.h:14370
virtual unsigned long GetActualMemorySize()=0
#define vtkDataArray
GLenum GLint * range
Definition: vtkgl.h:14180