00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00046 #ifndef __vtkAbstractArray_h
00047 #define __vtkAbstractArray_h
00048
00049 #include "vtkObject.h"
00050 #include "vtkVariant.h"
00051
00052 class vtkArrayIterator;
00053 class vtkDataArray;
00054 class vtkIdList;
00055 class vtkIdTypeArray;
00056 class vtkInformation;
00057
00058 class VTK_COMMON_EXPORT vtkAbstractArray : public vtkObject
00059 {
00060 public:
00061 vtkTypeRevisionMacro(vtkAbstractArray,vtkObject);
00062 void PrintSelf(ostream& os, vtkIndent indent);
00063
00066 virtual int Allocate(vtkIdType sz, vtkIdType ext=1000) = 0;
00067
00069 virtual void Initialize() = 0;
00070
00073 virtual int GetDataType() =0;
00074
00076
00079 virtual int GetDataTypeSize() = 0;
00080 static int GetDataTypeSize(int type);
00082
00087 virtual int GetElementComponentSize() = 0;
00088
00090
00092 vtkSetClampMacro(NumberOfComponents, int, 1, VTK_LARGE_INTEGER);
00093 int GetNumberOfComponents() { return this->NumberOfComponents; }
00095
00101 virtual void SetNumberOfTuples(vtkIdType number) = 0;
00102
00104
00105 vtkIdType GetNumberOfTuples()
00106 {return (this->MaxId + 1)/this->NumberOfComponents;}
00108
00114 virtual void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) = 0;
00115
00119 virtual void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) = 0;
00120
00124 virtual vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray* source) = 0;
00125
00129 virtual void GetTuples(vtkIdList *ptIds, vtkAbstractArray* output);
00130
00134 virtual void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output);
00135
00138 virtual void *GetVoidPointer(vtkIdType id) = 0;
00139
00144 virtual void DeepCopy(vtkAbstractArray* da);
00145
00147
00151 virtual void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
00152 vtkAbstractArray* source, double* weights) = 0;
00154
00156
00161 virtual void InterpolateTuple(vtkIdType i,
00162 vtkIdType id1, vtkAbstractArray* source1,
00163 vtkIdType id2, vtkAbstractArray* source2, double t) =0;
00165
00168 virtual void Squeeze() = 0;
00169
00172 virtual int Resize(vtkIdType numTuples) = 0;
00173
00175
00176 void Reset()
00177 {this->MaxId = -1;}
00179
00181
00182 vtkIdType GetSize()
00183 {return this->Size;}
00185
00187
00188 vtkIdType GetMaxId()
00189 {return this->MaxId;}
00191
00193
00199 virtual void SetVoidArray(void *vtkNotUsed(array),
00200 vtkIdType vtkNotUsed(size),
00201 int vtkNotUsed(save)) =0;
00203
00207 virtual void ExportToVoidPointer(void *vtkNotUsed(out_ptr)) {}
00208
00215 virtual unsigned long GetActualMemorySize() = 0;
00216
00218
00219 vtkSetStringMacro(Name);
00220 vtkGetStringMacro(Name);
00222
00224
00225 virtual const char *GetDataTypeAsString( void )
00226 { return vtkImageScalarTypeNameMacro( this->GetDataType() ); }
00228
00234 static vtkAbstractArray* CreateArray(int dataType);
00235
00238 virtual int IsNumeric() = 0;
00239
00242 virtual vtkArrayIterator* NewIterator() = 0;
00243
00245
00249 virtual vtkIdType GetDataSize()
00250 {
00251 return this->GetNumberOfComponents() * this->GetNumberOfTuples();
00252 }
00254
00255
00257
00258 virtual vtkIdType LookupValue(vtkVariant value) = 0;
00259 virtual void LookupValue(vtkVariant value, vtkIdList* ids) = 0;
00261
00263 virtual vtkVariant GetVariantValue(vtkIdType idx);
00264
00266
00267 virtual void InsertVariantValue(vtkIdType idx, vtkVariant value) = 0;
00268
00270
00277 virtual void DataChanged() = 0;
00278
00282 virtual void ClearLookup() = 0;
00283
00284
00285
00286
00287
00288
00289
00291
00294 vtkInformation* GetInformation();
00295
00296
00297
00298 bool HasInformation(){ return this->Information!=0; }
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310 virtual int CopyInformation(vtkInformation *infoFrom, int deep=1);
00311
00313
00314 protected:
00318 virtual void SetInformation( vtkInformation* );
00319
00320
00321 vtkAbstractArray(vtkIdType numComp=1);
00322 ~vtkAbstractArray();
00323
00324 vtkIdType Size;
00325 vtkIdType MaxId;
00326 int NumberOfComponents;
00327
00328 char* Name;
00329
00330 bool RebuildArray;
00331
00332 vtkInformation* Information;
00333
00334 private:
00335 vtkAbstractArray(const vtkAbstractArray&);
00336 void operator=(const vtkAbstractArray&);
00337 };
00338
00339 #endif