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 class vtkPoints;
53 
55 {
56 public:
58  void PrintSelf(ostream& os, vtkIndent indent);
59 
65  static vtkDataArray* FastDownCast(vtkAbstractArray *source);
66 
68 
72  virtual int IsNumeric()
73  { return 1; }
75 
77 
80  { return this->GetDataTypeSize(); }
82 
88  virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) = 0;
89 
94  virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) = 0;
95 
102 
106  virtual void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output);
107 
111  virtual void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output);
112 
113 
115 
119  virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
120  vtkAbstractArray* source, double* weights);
122 
124 
129  virtual void InterpolateTuple(vtkIdType i,
130  vtkIdType id1, vtkAbstractArray* source1,
131  vtkIdType id2, vtkAbstractArray* source2, double t);
133 
138  virtual double *GetTuple(vtkIdType i) = 0;
139 
143  virtual void GetTuple(vtkIdType i, double * tuple) = 0;
144 
146 
149  double GetTuple1(vtkIdType i);
150  double* GetTuple2(vtkIdType i);
151  double* GetTuple3(vtkIdType i);
152  double* GetTuple4(vtkIdType i);
153  double* GetTuple6(vtkIdType i);
154  double* GetTuple9(vtkIdType i);
156 
158 
161  virtual void SetTuple(vtkIdType i, const float * tuple) = 0;
162  virtual void SetTuple(vtkIdType i, const double * tuple) = 0;
164 
166 
169  void SetTuple1(vtkIdType i, double value);
170  void SetTuple2(vtkIdType i, double val0, double val1);
171  void SetTuple3(vtkIdType i, double val0, double val1, double val2);
172  void SetTuple4(vtkIdType i, double val0, double val1, double val2,
173  double val3);
174  void SetTuple6(vtkIdType i, double val0, double val1, double val2,
175  double val3, double val4, double val5);
176  void SetTuple9(vtkIdType i, double val0, double val1, double val2,
177  double val3, double val4, double val5, double val6,
178  double val7, double val8);
180 
182 
184  virtual void InsertTuple(vtkIdType i, const float * tuple) = 0;
185  virtual void InsertTuple(vtkIdType i, const double * tuple) = 0;
187 
189 
192  void InsertTuple1(vtkIdType i, double value);
193  void InsertTuple2(vtkIdType i, double val0, double val1);
194  void InsertTuple3(vtkIdType i, double val0, double val1, double val2);
195  void InsertTuple4(vtkIdType i, double val0, double val1, double val2,
196  double val3);
197  void InsertTuple6(vtkIdType i, double val0, double val1, double val2,
198  double val3, double val4, double val5);
199  void InsertTuple9(vtkIdType i, double val0, double val1, double val2,
200  double val3, double val4, double val5, double val6,
201  double val7, double val8);
203 
205 
208  virtual vtkIdType InsertNextTuple(const float * tuple) = 0;
209  virtual vtkIdType InsertNextTuple(const double * tuple) = 0;
211 
213 
216  void InsertNextTuple1(double value);
217  void InsertNextTuple2(double val0, double val1);
218  void InsertNextTuple3(double val0, double val1, double val2);
219  void InsertNextTuple4(double val0, double val1, double val2,
220  double val3);
221  void InsertNextTuple6(double val0, double val1, double val2,
222  double val3, double val4, double val5);
223  void InsertNextTuple9(double val0, double val1, double val2,
224  double val3, double val4, double val5, double val6,
225  double val7, double val8);
227 
229 
232  virtual void RemoveTuple(vtkIdType id) = 0;
233  virtual void RemoveFirstTuple() = 0;
234  virtual void RemoveLastTuple() = 0;
236 
240  virtual double GetComponent(vtkIdType i, int j);
241 
246  virtual void SetComponent(vtkIdType i, int j, double c);
247 
251  virtual void InsertComponent(vtkIdType i, int j, double c);
252 
254 
260  virtual void GetData(vtkIdType tupleMin, vtkIdType tupleMax, int compMin,
261  int compMax, vtkDoubleArray* data);
263 
265 
267  virtual void DeepCopy(vtkAbstractArray *aa);
268  virtual void DeepCopy(vtkDataArray *da);
270 
275  virtual void FillComponent(int j, double c);
276 
278 
284  virtual void CopyComponent(int j, vtkDataArray *from,
285  int fromComponent);
287 
291  virtual void* WriteVoidPointer(vtkIdType id, vtkIdType number) = 0;
292 
299  virtual unsigned long GetActualMemorySize();
300 
303  void CreateDefaultLookupTable();
304 
306 
307  void SetLookupTable(vtkLookupTable *lut);
308  vtkGetObjectMacro(LookupTable,vtkLookupTable);
310 
312 
319  void GetRange(double range[2], int comp)
320  {
321  this->ComputeRange(range, comp);
322  }
324 
326 
332  double* GetRange(int comp)
333  {
334  this->GetRange(this->Range, comp);
335  return this->Range;
336  }
338 
340 
345  double* GetRange()
346  {
347  return this->GetRange(0);
348  }
350 
352 
358  void GetRange(double range[2])
359  {
360  this->GetRange(range,0);
361  }
363 
365 
368  void GetDataTypeRange(double range[2]);
369  double GetDataTypeMin();
370  double GetDataTypeMax();
371  static void GetDataTypeRange(int type, double range[2]);
372  static double GetDataTypeMin(int type);
373  static double GetDataTypeMax(int type);
375 
378  virtual double GetMaxNorm();
379 
385  static vtkDataArray* CreateDataArray(int dataType);
386 
392  static vtkInformationDoubleVectorKey* COMPONENT_RANGE();
397  static vtkInformationDoubleVectorKey* L2_NORM_RANGE();
398 
404  virtual int CopyInformation(vtkInformation *infoFrom, int deep=1);
405 
407  virtual int GetArrayType() { return DataArray; }
408 
409 protected:
410 
411  friend class vtkPoints;
412 
417  virtual void ComputeRange(double range[2], int comp);
418 
423  virtual bool ComputeScalarRange(double* ranges);
424 
425  // Returns true if the range was computed. Will return false
426  // if you try to compute the range of an array of length zero.
427  virtual bool ComputeVectorRange(double range[2]);
428 
429  // Construct object with default tuple dimension (number of components) of 1.
430  vtkDataArray();
431  ~vtkDataArray();
432 
434  double Range[2];
435 
436 private:
437  double* GetTupleN(vtkIdType i, int n);
438 
439 private:
440  vtkDataArray(const vtkDataArray&); // Not implemented.
441  void operator=(const vtkDataArray&); // Not implemented.
442 };
443 
444 //------------------------------------------------------------------------------
446 {
447  switch (source->GetArrayType())
448  {
449  case DataArrayTemplate:
450  case TypedDataArray:
451  case DataArray:
452  case MappedDataArray:
453  return static_cast<vtkDataArray*>(source);
454  default:
455  return NULL;
456  }
457 }
458 
459 #endif
void PrintSelf(ostream &os, vtkIndent indent)
void GetRange(double range[2])
Definition: vtkDataArray.h:358
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:407
virtual int IsNumeric()
Definition: vtkDataArray.h:72
virtual int GetArrayType()
virtual int GetElementComponentSize()
Definition: vtkDataArray.h:79
int vtkIdType
Definition: vtkType.h:247
void GetRange(double range[2], int comp)
Definition: vtkDataArray.h:319
virtual int CopyInformation(vtkInformation *infoFrom, int deep=1)
dynamic, self-adjusting array of double
double * GetRange(int comp)
Definition: vtkDataArray.h:332
#define vtkDataArray
Definition: vtkCharArray.h:40
Key for double vector values.
a simple class to control print indentation
Definition: vtkIndent.h:38
double * GetRange()
Definition: vtkDataArray.h:345
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:54
virtual void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output)
vtkLookupTable * LookupTable
Definition: vtkDataArray.h:433
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:445
virtual vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source)=0
virtual unsigned long GetActualMemorySize()=0
represent and manipulate 3D points
Definition: vtkPoints.h:38