00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00075 #ifndef __vtkDataArray_h
00076 #define __vtkDataArray_h
00077
00078 #include "vtkObject.h"
00079 #include "vtkLargeInteger.h"
00080
00081 class vtkFloatArray;
00082 class vtkLookupTable;
00083 class vtkIdList;
00084
00085 class VTK_COMMON_EXPORT vtkDataArray : public vtkObject
00086 {
00087 public:
00088 vtkTypeMacro(vtkDataArray,vtkObject);
00089 void PrintSelf(ostream& os, vtkIndent indent);
00090
00092
00094 virtual int Allocate(const vtkIdType sz, const vtkIdType ext=1000) = 0;
00095 virtual void Initialize() = 0;
00097
00101 virtual vtkDataArray *MakeObject() = 0;
00102
00105 virtual int GetDataType() = 0;
00106
00108
00110 vtkSetClampMacro(NumberOfComponents,int,1,VTK_LARGE_INTEGER);
00111 int GetNumberOfComponents() {return this->NumberOfComponents;};
00113
00116 virtual void SetNumberOfTuples(const vtkIdType number) = 0;
00117
00119
00120 vtkIdType GetNumberOfTuples()
00121 {return (this->MaxId + 1)/this->NumberOfComponents;}
00123
00128 virtual float *GetTuple(const vtkIdType i) = 0;
00129
00131
00134 virtual void GetTuple(const vtkIdType i, float * tuple) = 0;
00135 virtual void GetTuple(const vtkIdType i, double * tuple);
00137
00139
00142 float GetTuple1(const vtkIdType i);
00143 float* GetTuple2(const vtkIdType i);
00144 float* GetTuple3(const vtkIdType i);
00145 float* GetTuple4(const vtkIdType i);
00146 float* GetTuple9(const vtkIdType i);
00148
00152 void GetTuples(vtkIdList *ptIds, vtkDataArray *output);
00153
00157 void GetTuples(vtkIdType p1, vtkIdType p2, vtkDataArray *output);
00158
00160
00163 virtual void SetTuple(const vtkIdType i, const float * tuple) = 0;
00164 virtual void SetTuple(const vtkIdType i, const double * tuple);
00166
00168
00171 void SetTuple1(const vtkIdType i, float value);
00172 void SetTuple2(const vtkIdType i, float val0, float val1);
00173 void SetTuple3(const vtkIdType i, float val0, float val1, float val2);
00174 void SetTuple4(const vtkIdType i, float val0, float val1, float val2,
00175 float val3);
00176 void SetTuple9(const vtkIdType i, float val0, float val1, float val2,
00177 float val3, float val4, float val5, float val6,
00178 float val7, float val8);
00180
00182
00184 virtual void InsertTuple(const vtkIdType i, const float * tuple) = 0;
00185 virtual void InsertTuple(const vtkIdType i, const double * tuple);
00187
00189
00192 void InsertTuple1(const vtkIdType i, float value);
00193 void InsertTuple2(const vtkIdType i, float val0, float val1);
00194 void InsertTuple3(const vtkIdType i, float val0, float val1, float val2);
00195 void InsertTuple4(const vtkIdType i, float val0, float val1, float val2,
00196 float val3);
00197 void InsertTuple9(const vtkIdType i, float val0, float val1, float val2,
00198 float val3, float val4, float val5, float val6,
00199 float val7, float val8);
00201
00203
00206 virtual vtkIdType InsertNextTuple(const float * tuple) = 0;
00207 virtual vtkIdType InsertNextTuple(const double * tuple);
00209
00211
00214 void InsertNextTuple1(float value);
00215 void InsertNextTuple2(float val0, float val1);
00216 void InsertNextTuple3(float val0, float val1, float val2);
00217 void InsertNextTuple4(float val0, float val1, float val2,
00218 float val3);
00219 void InsertNextTuple9(float val0, float val1, float val2,
00220 float val3, float val4, float val5, float val6,
00221 float val7, float val8);
00223
00227 virtual float GetComponent(const vtkIdType i, const int j);
00228
00233 virtual void SetComponent(const vtkIdType i, const int j, const float c);
00234
00238 virtual void InsertComponent(const vtkIdType i, const int j, const float c);
00239
00241
00247 virtual void GetData(vtkIdType tupleMin, vtkIdType tupleMax, int compMin,
00248 int compMax, vtkFloatArray* data);
00250
00253 virtual void DeepCopy(vtkDataArray *da);
00254
00259 virtual void FillComponent(const int j, const float c);
00260
00262
00268 virtual void CopyComponent(const int j, vtkDataArray *from,
00269 const int fromComponent);
00271
00274 virtual void *GetVoidPointer(const vtkIdType id) = 0;
00275
00277 virtual void Squeeze() = 0;
00278
00280 virtual void Resize(vtkIdType numTuples) = 0;
00281
00283
00284 void Reset()
00285 {this->MaxId = -1;}
00287
00289
00290 vtkIdType GetSize()
00291 {return this->Size;}
00293
00295
00296 vtkIdType GetMaxId()
00297 {return this->MaxId;}
00299
00301
00307 virtual void SetVoidArray(void *vtkNotUsed(array),
00308 vtkIdType vtkNotUsed(size),
00309 int vtkNotUsed(save)) {};
00311
00318 unsigned long GetActualMemorySize();
00319
00322 void CreateDefaultLookupTable();
00323
00325
00326 void SetLookupTable(vtkLookupTable *lut);
00327 vtkGetObjectMacro(LookupTable,vtkLookupTable);
00329
00331
00332 void SetName(const char* name);
00333 const char* GetName();
00335
00337
00339 void GetRange(float range[2], int comp)
00340 {
00341 this->ComputeRange(comp);
00342 memcpy(range, this->Range, 2*sizeof(float));
00343 }
00344 float* GetRange(int comp)
00345 {
00346 this->ComputeRange(comp);
00347 return this->Range;
00348 }
00350
00351 virtual void ComputeRange(int comp);
00353
00355 float* GetRange()
00356 {
00357 this->ComputeRange(0);
00358 return this->Range;
00359 }
00360 void GetRange(float range[2])
00361 {
00362 this->GetRange(range,0);
00363 }
00365
00367
00370 void GetDataTypeRange(double range[2]);
00371 double GetDataTypeMin();
00372 double GetDataTypeMax();
00374
00377 virtual float GetMaxNorm();
00378
00384 static vtkDataArray* CreateDataArray(int dataType);
00385
00386 protected:
00387
00388 vtkDataArray(vtkIdType numComp=1);
00389 ~vtkDataArray();
00390
00391 vtkLookupTable *LookupTable;
00392
00393 vtkIdType Size;
00394 vtkIdType MaxId;
00395 int NumberOfComponents;
00396
00397 char* Name;
00398
00399 private:
00400 float Range[2];
00401 int ComponentForLastRange;
00402 vtkTimeStamp ComputeTimeForLastRange;
00403
00404 float* GetTupleN(const vtkIdType i, int n);
00405
00406 private:
00407 vtkDataArray(const vtkDataArray&);
00408 void operator=(const vtkDataArray&);
00409 };
00410
00411 #endif