dox/Common/vtkDoubleArray.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00033 #ifndef __vtkDoubleArray_h
00034 #define __vtkDoubleArray_h
00035
00036 #include "vtkDataArray.h"
00037
00038 class VTK_COMMON_EXPORT vtkDoubleArray : public vtkDataArray
00039 {
00040 public:
00041 static vtkDoubleArray *New();
00042
00043 vtkTypeRevisionMacro(vtkDoubleArray,vtkDataArray);
00044 void PrintSelf(ostream& os, vtkIndent indent);
00045
00048 int Allocate(const vtkIdType sz, const vtkIdType ext=1000);
00049
00051 void Initialize();
00052
00054 int GetDataType() {return VTK_DOUBLE;};
00055
00057 int GetDataTypeSize() { return sizeof(double); }
00058
00060 void SetNumberOfTuples(const vtkIdType number);
00061
00064 float *GetTuple(const vtkIdType i);
00065
00067
00068 void GetTuple(const vtkIdType i, float * tuple);
00069 void GetTuple(const vtkIdType i, double * tuple);
00071
00073
00074 void SetTuple(const vtkIdType i, const float * tuple);
00075 void SetTuple(const vtkIdType i, const double * tuple);
00077
00079
00081 void InsertTuple(const vtkIdType i, const float * tuple);
00082 void InsertTuple(const vtkIdType i, const double * tuple);
00084
00086
00088 vtkIdType InsertNextTuple(const float * tuple);
00089 vtkIdType InsertNextTuple(const double * tuple);
00091
00093 void Squeeze() {this->ResizeAndExtend (this->MaxId+1);};
00094
00096 virtual void Resize(vtkIdType numTuples);
00097
00099 double GetValue(const vtkIdType id) {return this->Array[id];}
00100
00102
00104 void SetValue(const vtkIdType id, const double value)
00105 { this->Array[id] = value;};
00107
00111 void SetNumberOfValues(const vtkIdType number);
00112
00114 void InsertValue(const vtkIdType id, const double f);
00115
00118 vtkIdType InsertNextValue(const double f);
00119
00123 float GetComponent(const vtkIdType i, const int j);
00124
00129 void SetComponent(const vtkIdType i, const int j, float c);
00130
00134 virtual void InsertComponent(const vtkIdType i, const int j, float c);
00135
00139 double *WritePointer(const vtkIdType id, const vtkIdType number);
00140
00142
00144 double *GetPointer(const vtkIdType id) {return this->Array + id;}
00145 void *GetVoidPointer(const vtkIdType id)
00146 {return (void *)this->GetPointer(id);};
00148
00150 void DeepCopy(vtkDataArray *da);
00151
00153
00159 void SetArray(double* array, vtkIdType size, int save);
00160 void SetVoidArray(void *array, vtkIdType size, int save)
00161 {this->SetArray((double*)array, size, save);};
00163
00164 protected:
00165 vtkDoubleArray(vtkIdType numComp=1);
00166 ~vtkDoubleArray();
00167
00168 double *Array;
00169 double *ResizeAndExtend(const vtkIdType sz);
00170
00171 int TupleSize;
00172 float *Tuple;
00173
00174 int SaveUserArray;
00175 private:
00176 vtkDoubleArray(const vtkDoubleArray&);
00177 void operator=(const vtkDoubleArray&);
00178 };
00179
00180 inline void vtkDoubleArray::SetNumberOfValues(const vtkIdType number)
00181 {
00182 this->Allocate(number);
00183 this->MaxId = number - 1;
00184 }
00185
00186 inline double *vtkDoubleArray::WritePointer(const vtkIdType id,
00187 const vtkIdType number)
00188 {
00189 vtkIdType newSize=id+number;
00190 if ( newSize > this->Size )
00191 {
00192 this->ResizeAndExtend(newSize);
00193 }
00194 if ( (--newSize) > this->MaxId )
00195 {
00196 this->MaxId = newSize;
00197 }
00198 return this->Array + id;
00199 }
00200
00201 inline void vtkDoubleArray::InsertValue(const vtkIdType id, const double f)
00202 {
00203 if ( id >= this->Size )
00204 {
00205 this->ResizeAndExtend(id+1);
00206 }
00207 this->Array[id] = f;
00208 if ( id > this->MaxId )
00209 {
00210 this->MaxId = id;
00211 }
00212 }
00213
00214 inline vtkIdType vtkDoubleArray::InsertNextValue(const double f)
00215 {
00216 this->InsertValue (++this->MaxId,f);
00217 return this->MaxId;
00218 }
00219
00220
00221 #endif