• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Common/vtkAbstractArray.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkAbstractArray.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 =========================================================================*/
00015 //
00046 #ifndef __vtkAbstractArray_h
00047 #define __vtkAbstractArray_h
00048 
00049 #include "vtkObject.h"
00050 #include "vtkVariant.h" // for variant arguments
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   //BTX
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   //ETX
00270 
00277   virtual void DataChanged() = 0;
00278 
00282   virtual void ClearLookup() = 0;
00283 
00284   // TODO: Implement these lookup functions also.
00285   //virtual void LookupRange(vtkVariant min, vtkVariant max, vtkIdList* ids,
00286   //  bool includeMin = true, bool includeMax = true) = 0;
00287   //virtual void LookupGreaterThan(vtkVariant min, vtkIdList* ids, bool includeMin = false) = 0;
00288   //virtual void LookupLessThan(vtkVariant max, vtkIdList* ids, bool includeMax = false) = 0;
00289 
00291 
00294   vtkInformation* GetInformation();
00295   // Description:
00296   // Inquire if this array has an instance of vtkInformation 
00297   // already associated with it.
00298   bool HasInformation(){ return this->Information!=0; }
00299   //BTX
00300   // Description:
00301   // Copy information instance. Arrays use information objects
00302   // in a variety of ways. It is important to have flexibility in
00303   // this regard because certain keys should not be coppied, while
00304   // others must be.
00305   // 
00306   // NOTE: Subclasses must always call their superclass's CopyInformation
00307   // method, so that all classes in the hierarchy get a chance to remove
00308   // keys they do not wish to be coppied. The subclass will not need to
00309   // explicilty copy the keys as it's handled here.
00310   virtual int CopyInformation(vtkInformation *infoFrom, int deep=1);
00311   //ETX
00313 
00314 protected:
00318   virtual void SetInformation( vtkInformation* );
00319 
00320   // Construct object with default tuple dimension (number of components) of 1.
00321   vtkAbstractArray(vtkIdType numComp=1);
00322   ~vtkAbstractArray();
00323 
00324   vtkIdType Size;         // allocated size of data
00325   vtkIdType MaxId;        // maximum index inserted thus far
00326   int NumberOfComponents; // the number of components per tuple
00327 
00328   char* Name;
00329 
00330   bool RebuildArray;      // whether to rebuild the fast lookup data structure.
00331 
00332   vtkInformation* Information;
00333 
00334 private:
00335   vtkAbstractArray(const vtkAbstractArray&);  // Not implemented.
00336   void operator=(const vtkAbstractArray&);  // Not implemented.
00337 };
00338 
00339 #endif

Generated by  doxygen 1.7.1