Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages
Common/vtkIdTypeArray.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00040 #ifndef __vtkIdTypeArray_h
00041 #define __vtkIdTypeArray_h
00042
00043 #include "vtkDataArray.h"
00044
00045 class VTK_COMMON_EXPORT vtkIdTypeArray : public vtkDataArray
00046 {
00047 public:
00048 static vtkIdTypeArray *New();
00049
00050 vtkTypeRevisionMacro(vtkIdTypeArray, vtkDataArray);
00051 void PrintSelf(ostream& os, vtkIndent indent);
00052
00055 int Allocate(const vtkIdType sz, const vtkIdType ext=1000);
00056
00058 void Initialize();
00059
00061
00062 int GetDataType()
00063 {return VTK_ID_TYPE;}
00065
00067 int GetDataTypeSize() { return sizeof(vtkIdType); }
00068
00070
00071 void Squeeze()
00072 {this->ResizeAndExtend (this->MaxId+1);}
00074
00076 virtual void Resize(vtkIdType numTuples);
00077
00079 void SetNumberOfTuples(const vtkIdType number);
00080
00083 float *GetTuple(const vtkIdType i);
00084
00086
00087 void GetTuple(const vtkIdType i, float * tuple);
00088 void GetTuple(const vtkIdType i, double * tuple);
00090
00092
00093 void SetTuple(const vtkIdType i, const float * tuple);
00094 void SetTuple(const vtkIdType i, const double * tuple);
00096
00098
00100 void InsertTuple(const vtkIdType i, const float * tuple);
00101 void InsertTuple(const vtkIdType i, const double * tuple);
00103
00105
00107 vtkIdType InsertNextTuple(const float * tuple);
00108 vtkIdType InsertNextTuple(const double * tuple);
00110
00112
00113 vtkIdType GetValue(const vtkIdType id)
00114 {return this->Array[id];}
00116
00118
00120 void SetValue(const vtkIdType id, const vtkIdType value)
00121 {this->Array[id] = value;}
00123
00127 void SetNumberOfValues(const vtkIdType number);
00128
00130 void InsertValue(const vtkIdType id, const vtkIdType i);
00131
00134 vtkIdType InsertNextValue(const vtkIdType i);
00135
00137
00139 vtkIdType *GetPointer(const vtkIdType id)
00140 {return this->Array + id;}
00141 void *GetVoidPointer(const vtkIdType id)
00142 {return (void *)this->GetPointer(id);}
00144
00148 vtkIdType *WritePointer(const vtkIdType id, const vtkIdType number);
00149
00151 void DeepCopy(vtkDataArray *ia);
00152
00154
00160 void SetArray(vtkIdType* array, vtkIdType size, int save);
00161 void SetVoidArray(void *array, vtkIdType size, int save)
00162 {this->SetArray((vtkIdType*)array, size, save);};
00164
00165 protected:
00166 vtkIdTypeArray(vtkIdType numComp=1);
00167 ~vtkIdTypeArray();
00168
00169 vtkIdType *Array;
00170 vtkIdType *ResizeAndExtend(const vtkIdType sz);
00171
00172 int TupleSize;
00173 float *Tuple;
00174
00175 int SaveUserArray;
00176 private:
00177 vtkIdTypeArray(const vtkIdTypeArray&);
00178 void operator=(const vtkIdTypeArray&);
00179 };
00180
00181
00182 inline void vtkIdTypeArray::SetNumberOfValues(const vtkIdType number)
00183 {
00184 this->Allocate(number);
00185 this->MaxId = number - 1;
00186 }
00187
00188 inline vtkIdType *vtkIdTypeArray::WritePointer(const vtkIdType id,
00189 const vtkIdType number)
00190 {
00191 vtkIdType newSize=id+number;
00192 if ( newSize > this->Size )
00193 {
00194 this->ResizeAndExtend(newSize);
00195 }
00196 if ( (--newSize) > this->MaxId )
00197 {
00198 this->MaxId = newSize;
00199 }
00200 return this->Array + id;
00201 }
00202
00203 inline void vtkIdTypeArray::InsertValue(const vtkIdType id, const vtkIdType i)
00204 {
00205 if ( id >= this->Size )
00206 {
00207 this->ResizeAndExtend(id+1);
00208 }
00209 this->Array[id] = i;
00210 if ( id > this->MaxId )
00211 {
00212 this->MaxId = id;
00213 }
00214 }
00215
00216 inline vtkIdType vtkIdTypeArray::InsertNextValue(const vtkIdType i)
00217 {
00218 this->InsertValue (++this->MaxId,i);
00219 return this->MaxId;
00220 }
00221
00222
00223 #endif