vtkUnsignedLongArray.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00030 #ifndef __vtkUnsignedLongArray_h
00031 #define __vtkUnsignedLongArray_h
00032
00033 #include "vtkDataArray.h"
00034
00035 class VTK_COMMON_EXPORT vtkUnsignedLongArray : public vtkDataArray
00036 {
00037 public:
00038 static vtkUnsignedLongArray *New();
00039
00040 vtkTypeRevisionMacro(vtkUnsignedLongArray,vtkDataArray);
00041 void PrintSelf(ostream& os, vtkIndent indent);
00042
00045 int Allocate(const vtkIdType sz, const vtkIdType ext=1000);
00046
00048 void Initialize();
00049
00051 int GetDataType() {return VTK_UNSIGNED_LONG;};
00052
00054 int GetDataTypeSize() { return sizeof(unsigned long); }
00055
00057 void SetNumberOfTuples(const vtkIdType number);
00058
00061 float *GetTuple(const vtkIdType i);
00062
00064
00065 void GetTuple(const vtkIdType i, float * tuple);
00066 void GetTuple(const vtkIdType i, double * tuple);
00068
00070
00071 void SetTuple(const vtkIdType i, const float * tuple);
00072 void SetTuple(const vtkIdType i, const double * tuple);
00074
00076
00078 void InsertTuple(const vtkIdType i, const float * tuple);
00079 void InsertTuple(const vtkIdType i, const double * tuple);
00081
00083
00085 vtkIdType InsertNextTuple(const float * tuple);
00086 vtkIdType InsertNextTuple(const double * tuple);
00088
00090 unsigned long GetValue(const vtkIdType id) {return this->Array[id];};
00091
00093
00095 void SetValue(const vtkIdType id, const unsigned long value) {
00096 this->Array[id] = value;};
00098
00102 void SetNumberOfValues(const vtkIdType number);
00103
00105 void InsertValue(const vtkIdType id, const unsigned long i);
00106
00109 vtkIdType InsertNextValue(const unsigned long);
00110
00114 float GetComponent(const vtkIdType i, const int j);
00115
00120 void SetComponent(const vtkIdType i, const int j, float c);
00121
00125 virtual void InsertComponent(const vtkIdType i, const int j, float c);
00126
00128
00130 unsigned long *GetPointer(const vtkIdType id) {return this->Array + id;}
00131 void *GetVoidPointer(const vtkIdType id)
00132 {return (void *)this->GetPointer(id);};
00134
00138 unsigned long *WritePointer(const vtkIdType id, const vtkIdType number);
00139
00141 void DeepCopy(vtkDataArray *da);
00142
00144
00150 void SetArray(unsigned long* array, vtkIdType size, int save);
00151 void SetVoidArray(void *array, vtkIdType size, int save)
00152 {this->SetArray((unsigned long*)array, size, save);};
00154
00156 void Squeeze() {this->ResizeAndExtend (this->MaxId+1);};
00157
00159 virtual void Resize(vtkIdType numTuples);
00160
00161 protected:
00162 vtkUnsignedLongArray(vtkIdType numComp=1);
00163 ~vtkUnsignedLongArray();
00164
00165 unsigned long *Array;
00166 unsigned long *ResizeAndExtend(const vtkIdType sz);
00167
00168
00169 int TupleSize;
00170 float *Tuple;
00171
00172 int SaveUserArray;
00173 private:
00174 vtkUnsignedLongArray(const vtkUnsignedLongArray&);
00175 void operator=(const vtkUnsignedLongArray&);
00176 };
00177
00178 inline void vtkUnsignedLongArray::SetNumberOfValues(const vtkIdType number)
00179 {
00180 this->Allocate(number);
00181 this->MaxId = number - 1;
00182 }
00183
00184 inline unsigned long *vtkUnsignedLongArray::WritePointer(const vtkIdType id,
00185 const vtkIdType number)
00186 {
00187 vtkIdType newSize=id+number;
00188 if ( newSize > this->Size )
00189 {
00190 this->ResizeAndExtend(newSize);
00191 }
00192 if ( (--newSize) > this->MaxId )
00193 {
00194 this->MaxId = newSize;
00195 }
00196 return this->Array + id;
00197 }
00198
00199 inline void vtkUnsignedLongArray::InsertValue(const vtkIdType id,
00200 const unsigned long i)
00201 {
00202 if ( id >= this->Size )
00203 {
00204 this->ResizeAndExtend(id+1);
00205 }
00206 this->Array[id] = i;
00207 if ( id > this->MaxId )
00208 {
00209 this->MaxId = id;
00210 }
00211 }
00212
00213 inline vtkIdType vtkUnsignedLongArray::InsertNextValue(const unsigned long i)
00214 {
00215 this->InsertValue (++this->MaxId,i);
00216 return this->MaxId;
00217 }
00218
00219
00220 #endif
00221
00222
00223
00224