VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkDataArray.h 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 "vtkCommonCoreModule.h" // For export macro 00046 #include "vtkAbstractArray.h" 00047 00048 class vtkDoubleArray; 00049 class vtkIdList; 00050 class vtkInformationDoubleVectorKey; 00051 class vtkLookupTable; 00052 00053 class VTKCOMMONCORE_EXPORT vtkDataArray : public vtkAbstractArray 00054 { 00055 public: 00056 vtkTypeMacro(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 00130 virtual double *GetTuple(vtkIdType i) = 0; 00131 00135 virtual void GetTuple(vtkIdType i, double * tuple) = 0; 00136 00138 00141 double GetTuple1(vtkIdType i); 00142 double* GetTuple2(vtkIdType i); 00143 double* GetTuple3(vtkIdType i); 00144 double* GetTuple4(vtkIdType i); 00145 double* GetTuple9(vtkIdType i); 00147 00149 00152 virtual void SetTuple(vtkIdType i, const float * tuple) = 0; 00153 virtual void SetTuple(vtkIdType i, const double * tuple) = 0; 00155 00157 00160 void SetTuple1(vtkIdType i, double value); 00161 void SetTuple2(vtkIdType i, double val0, double val1); 00162 void SetTuple3(vtkIdType i, double val0, double val1, double val2); 00163 void SetTuple4(vtkIdType i, double val0, double val1, double val2, 00164 double val3); 00165 void SetTuple9(vtkIdType i, double val0, double val1, double val2, 00166 double val3, double val4, double val5, double val6, 00167 double val7, double val8); 00169 00171 00173 virtual void InsertTuple(vtkIdType i, const float * tuple) = 0; 00174 virtual void InsertTuple(vtkIdType i, const double * tuple) = 0; 00176 00178 00181 void InsertTuple1(vtkIdType i, double value); 00182 void InsertTuple2(vtkIdType i, double val0, double val1); 00183 void InsertTuple3(vtkIdType i, double val0, double val1, double val2); 00184 void InsertTuple4(vtkIdType i, double val0, double val1, double val2, 00185 double val3); 00186 void InsertTuple9(vtkIdType i, double val0, double val1, double val2, 00187 double val3, double val4, double val5, double val6, 00188 double val7, double val8); 00190 00192 00195 virtual vtkIdType InsertNextTuple(const float * tuple) = 0; 00196 virtual vtkIdType InsertNextTuple(const double * tuple) = 0; 00198 00200 00203 void InsertNextTuple1(double value); 00204 void InsertNextTuple2(double val0, double val1); 00205 void InsertNextTuple3(double val0, double val1, double val2); 00206 void InsertNextTuple4(double val0, double val1, double val2, 00207 double val3); 00208 void InsertNextTuple9(double val0, double val1, double val2, 00209 double val3, double val4, double val5, double val6, 00210 double val7, double val8); 00212 00214 00217 virtual void RemoveTuple(vtkIdType id) = 0; 00218 virtual void RemoveFirstTuple() = 0; 00219 virtual void RemoveLastTuple() = 0; 00221 00225 virtual double GetComponent(vtkIdType i, int j); 00226 00231 virtual void SetComponent(vtkIdType i, int j, double c); 00232 00236 virtual void InsertComponent(vtkIdType i, int j, double c); 00237 00239 00245 virtual void GetData(vtkIdType tupleMin, vtkIdType tupleMax, int compMin, 00246 int compMax, vtkDoubleArray* data); 00248 00250 00252 virtual void DeepCopy(vtkAbstractArray *aa); 00253 virtual void DeepCopy(vtkDataArray *da); 00255 00260 virtual void FillComponent(int j, double c); 00261 00263 00269 virtual void CopyComponent(int j, vtkDataArray *from, 00270 int fromComponent); 00272 00276 virtual void* WriteVoidPointer(vtkIdType id, vtkIdType number) = 0; 00277 00284 virtual unsigned long GetActualMemorySize(); 00285 00288 void CreateDefaultLookupTable(); 00289 00291 00292 void SetLookupTable(vtkLookupTable *lut); 00293 vtkGetObjectMacro(LookupTable,vtkLookupTable); 00295 00297 00301 void GetRange(double range[2], int comp) 00302 { 00303 this->ComputeRange(range, comp); 00304 } 00306 00308 00313 double* GetRange(int comp) 00314 { 00315 this->GetRange(this->Range, comp); 00316 return this->Range; 00317 } 00319 00321 00323 double* GetRange() 00324 { 00325 return this->GetRange(0); 00326 } 00328 00330 00332 void GetRange(double range[2]) 00333 { 00334 this->GetRange(range,0); 00335 } 00337 00338 00341 void GetDataTypeRange(double range[2]); 00342 double GetDataTypeMin(); 00343 double GetDataTypeMax(); 00344 static void GetDataTypeRange(int type, double range[2]); 00345 static double GetDataTypeMin(int type); 00346 static double GetDataTypeMax(int type); 00348 00351 virtual double GetMaxNorm(); 00352 00358 static vtkDataArray* CreateDataArray(int dataType); 00359 00365 static vtkInformationDoubleVectorKey* COMPONENT_RANGE(); 00370 static vtkInformationDoubleVectorKey* L2_NORM_RANGE(); 00371 00377 virtual int CopyInformation(vtkInformation *infoFrom, int deep=1); 00378 00379 protected: 00384 virtual void ComputeRange(double range[2], int comp); 00386 00387 virtual void ComputeScalarRange(double range[2], int comp); 00388 virtual void ComputeVectorRange(double range[2]); 00390 00391 // Construct object with default tuple dimension (number of components) of 1. 00392 vtkDataArray(vtkIdType numComp=1); 00393 ~vtkDataArray(); 00394 00395 vtkLookupTable *LookupTable; 00396 double Range[2]; 00397 00398 private: 00399 double* GetTupleN(vtkIdType i, int n); 00400 00401 private: 00402 vtkDataArray(const vtkDataArray&); // Not implemented. 00403 void operator=(const vtkDataArray&); // Not implemented. 00404 }; 00405 00406 #endif