dox/Common/vtkDataArray.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkDataArray.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00042 #ifndef __vtkDataArray_h
00043 #define __vtkDataArray_h
00044 
00045 #include "vtkAbstractArray.h"
00046 
00047 class vtkDoubleArray;
00048 class vtkIdList;
00049 class vtkInformationDoubleVectorKey;
00050 class vtkInformationInformationVectorKey;
00051 class vtkLookupTable;
00052 
00053 class VTK_COMMON_EXPORT vtkDataArray : public vtkAbstractArray
00054 {
00055 public:
00056   vtkTypeRevisionMacro(vtkDataArray,vtkAbstractArray);
00057   void PrintSelf(ostream& os, vtkIndent indent);
00058 
00060 
00064   virtual int IsNumeric() 
00065     { return 1; }
00067 
00069 
00071   virtual int GetElementComponentSize() 
00072     { return this->GetDataTypeSize(); }
00074 
00080   virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) = 0;
00081 
00086   virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) = 0;
00087 
00093   virtual vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray* source) = 0;
00094 
00098   virtual void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output);
00099 
00103   virtual void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output);
00104 
00105 
00107 
00111   virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
00112     vtkAbstractArray* source,  double* weights);
00114 
00116 
00121   virtual void InterpolateTuple(vtkIdType i, 
00122     vtkIdType id1, vtkAbstractArray* source1, 
00123     vtkIdType id2, vtkAbstractArray* source2, double t);
00125   
00126   
00131   virtual double *GetTuple(vtkIdType i) = 0;
00132 
00136   virtual void GetTuple(vtkIdType i, double * tuple) = 0;
00137 
00139 
00142   double GetTuple1(vtkIdType i);
00143   double* GetTuple2(vtkIdType i);
00144   double* GetTuple3(vtkIdType i);
00145   double* GetTuple4(vtkIdType i);
00146   double* GetTuple9(vtkIdType i);
00148 
00150 
00153   virtual void SetTuple(vtkIdType i, const float * tuple) = 0;
00154   virtual void SetTuple(vtkIdType i, const double * tuple) = 0;
00156 
00158 
00161   void SetTuple1(vtkIdType i, double value);
00162   void SetTuple2(vtkIdType i, double val0, double val1);
00163   void SetTuple3(vtkIdType i, double val0, double val1, double val2);
00164   void SetTuple4(vtkIdType i, double val0, double val1, double val2,
00165                  double val3);
00166   void SetTuple9(vtkIdType i, double val0, double val1, double val2,
00167                  double val3, double val4, double val5, double val6,
00168                  double val7, double val8);
00170 
00172 
00174   virtual void InsertTuple(vtkIdType i, const float * tuple) = 0;
00175   virtual void InsertTuple(vtkIdType i, const double * tuple) = 0;
00177 
00179 
00182   void InsertTuple1(vtkIdType i, double value);
00183   void InsertTuple2(vtkIdType i, double val0, double val1);
00184   void InsertTuple3(vtkIdType i, double val0, double val1, double val2);
00185   void InsertTuple4(vtkIdType i, double val0, double val1, double val2,
00186                     double val3);
00187   void InsertTuple9(vtkIdType i, double val0, double val1, double val2,
00188                     double val3, double val4, double val5, double val6,
00189                     double val7, double val8);
00191 
00193 
00196   virtual vtkIdType InsertNextTuple(const float * tuple) = 0;
00197   virtual vtkIdType InsertNextTuple(const double * tuple) = 0;
00199 
00201 
00204   void InsertNextTuple1(double value);
00205   void InsertNextTuple2(double val0, double val1);
00206   void InsertNextTuple3(double val0, double val1, double val2);
00207   void InsertNextTuple4(double val0, double val1, double val2,
00208                         double val3);
00209   void InsertNextTuple9(double val0, double val1, double val2,
00210                         double val3, double val4, double val5, double val6,
00211                         double val7, double val8);
00213 
00215 
00218   virtual void RemoveTuple(vtkIdType id) = 0;
00219   virtual void RemoveFirstTuple() = 0;
00220   virtual void RemoveLastTuple() = 0;
00222 
00226   virtual double GetComponent(vtkIdType i, int j);
00227 
00232   virtual void SetComponent(vtkIdType i, int j, double c);
00233 
00237   virtual void InsertComponent(vtkIdType i, int j, double c);
00238 
00240 
00246   virtual void GetData(vtkIdType tupleMin, vtkIdType tupleMax, int compMin,
00247                        int compMax, vtkDoubleArray* data);
00249 
00251 
00253   virtual void DeepCopy(vtkAbstractArray *aa);
00254   virtual void DeepCopy(vtkDataArray *da);
00256 
00261   virtual void FillComponent(int j, double c);
00262 
00264 
00270   virtual void CopyComponent(int j, vtkDataArray *from,
00271                              int fromComponent);
00273  
00277   virtual void* WriteVoidPointer(vtkIdType id, vtkIdType number) = 0;
00278 
00285   virtual unsigned long GetActualMemorySize();
00286   
00289   void CreateDefaultLookupTable();
00290 
00292 
00293   void SetLookupTable(vtkLookupTable *lut);
00294   vtkGetObjectMacro(LookupTable,vtkLookupTable);
00296 
00298 
00302   void GetRange(double range[2], int comp)
00303     {
00304     this->ComputeRange(comp);
00305     memcpy(range, this->Range, 2*sizeof(double));
00306     }
00307   double* GetRange(int comp)
00308     {
00309     this->ComputeRange(comp);
00310     return this->Range;
00311     }
00313 
00314   virtual void ComputeRange(int comp);
00316 
00318   double* GetRange()
00319     {
00320     this->ComputeRange(0);
00321     return this->Range;
00322     }
00323   void GetRange(double range[2])
00324     {
00325     this->GetRange(range,0);
00326     }
00328 
00330 
00333   void GetDataTypeRange(double range[2]);
00334   double GetDataTypeMin();
00335   double GetDataTypeMax();
00336   static void GetDataTypeRange(int type, double range[2]);
00337   static double GetDataTypeMin(int type);
00338   static double GetDataTypeMax(int type);
00340 
00343   virtual double GetMaxNorm();
00344 
00350   static vtkDataArray* CreateDataArray(int dataType);
00351 
00353 
00363   static vtkInformationInformationVectorKey* PER_COMPONENT();
00364   // Description:
00365   // This key is used to hold tight bounds on the range of
00366   // one component over all tuples of the array.
00367   // Two values (a minimum and maximum) are stored for each component.
00368   // When GetRange() is called when no tuples are present in the array
00369   // this value is set to { VTK_DOUBLE_MAX, VTK_DOUBLE_MIN }.
00370   static vtkInformationDoubleVectorKey* COMPONENT_RANGE();
00371   // Description:
00372   // This key is used to hold tight bounds on the $L_2$ norm
00373   // of tuples in the array.
00374   // Two values (a minimum and maximum) are stored for each component.
00375   // When GetRange() is called when no tuples are present in the array
00376   // this value is set to { VTK_DOUBLE_MAX, VTK_DOUBLE_MIN }.
00377   static vtkInformationDoubleVectorKey* L2_NORM_RANGE();
00379   
00380 protected:
00381   // Construct object with default tuple dimension (number of components) of 1.
00382   vtkDataArray(vtkIdType numComp=1);
00383   ~vtkDataArray();
00384 
00385   vtkLookupTable *LookupTable;
00386   double Range[2];
00387 
00388 private:
00389   double* GetTupleN(vtkIdType i, int n);
00390   
00391 private:
00392   vtkDataArray(const vtkDataArray&);  // Not implemented.
00393   void operator=(const vtkDataArray&);  // Not implemented.
00394 };
00395 
00396 #endif

Generated on Sun Oct 5 14:37:43 2008 for VTK by  doxygen 1.4.7