00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00065 #ifndef __vtkStructuredGrid_h
00066 #define __vtkStructuredGrid_h
00067
00068 #include "vtkPointSet.h"
00069 #include "vtkStructuredData.h"
00070 #include "vtkUnsignedCharArray.h"
00071
00072 class vtkVertex;
00073 class vtkLine;
00074 class vtkQuad;
00075 class vtkHexahedron;
00076 class vtkEmptyCell;
00077
00078 class VTK_COMMON_EXPORT vtkStructuredGrid : public vtkPointSet
00079 {
00080 public:
00081 static vtkStructuredGrid *New();
00082
00083 vtkTypeMacro(vtkStructuredGrid,vtkPointSet);
00084 void PrintSelf(ostream& os, vtkIndent indent);
00085
00087 int GetDataObjectType() {return VTK_STRUCTURED_GRID;}
00088
00090 vtkDataObject *MakeObject() {return vtkStructuredGrid::New();}
00091
00094 void CopyStructure(vtkDataSet *ds);
00095
00097
00098 vtkIdType GetNumberOfPoints() {return vtkPointSet::GetNumberOfPoints();}
00099 float *GetPoint(vtkIdType ptId) {return this->vtkPointSet::GetPoint(ptId);}
00100 void GetPoint(vtkIdType ptId, float p[3])
00101 {this->vtkPointSet::GetPoint(ptId,p);}
00102 vtkCell *GetCell(vtkIdType cellId);
00103 void GetCell(vtkIdType cellId, vtkGenericCell *cell);
00104 void GetCellBounds(vtkIdType cellId, float bounds[6]);
00105 int GetCellType(vtkIdType cellId);
00106 vtkIdType GetNumberOfCells();
00107 void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
00108 void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
00109 {
00110 vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());
00111 }
00112 void Initialize();
00113 int GetMaxCellSize() {return 8;};
00114 void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
00115 vtkIdList *cellIds);
00116 virtual void GetScalarRange(float range[2]);
00117 float *GetScalarRange() {return this->vtkPointSet::GetScalarRange();}
00119
00121
00122 void SetDimensions(int i, int j, int k);
00123 void SetDimensions(int dim[3]);
00125
00127
00128 virtual int *GetDimensions ();
00129 virtual void GetDimensions (int dim[3]);
00131
00133 int GetDataDimension();
00134
00136
00138 void SetBlanking(int blanking);
00139 int GetBlanking() {return this->Blanking;}
00140 void BlankingOn();
00141 void BlankingOff();
00142 void BlankPoint(vtkIdType ptId);
00143 void UnBlankPoint(vtkIdType ptId);
00145
00147
00148 vtkUnsignedCharArray *GetPointVisibility()
00149 {return this->PointVisibility;}
00151
00155 void SetPointVisibility(vtkUnsignedCharArray *pointVisibility);
00156
00158
00160 unsigned char IsPointVisible(vtkIdType ptId)
00161 {return (this->Blanking ? this->PointVisibility->GetValue(ptId) : 1);}
00163
00166 unsigned char IsCellVisible(vtkIdType cellId);
00167
00169
00172 void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
00173 void SetUpdateExtent(int piece, int numPieces)
00174 {this->SetUpdateExtent(piece, numPieces, 0);}
00176
00178
00179 void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
00180 { this->vtkPointSet::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
00181 void SetUpdateExtent( int ext[6] )
00182 { this->vtkPointSet::SetUpdateExtent( ext ); };
00184
00186
00189 void SetExtent(int extent[6]);
00190 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
00191 vtkGetVector6Macro(Extent,int);
00193
00199 unsigned long GetActualMemorySize();
00200
00202
00203 void ShallowCopy(vtkDataObject *src);
00204 void DeepCopy(vtkDataObject *src);
00206
00207 protected:
00208 vtkStructuredGrid();
00209 ~vtkStructuredGrid();
00210
00211
00212 vtkVertex *Vertex;
00213 vtkLine *Line;
00214 vtkQuad *Quad;
00215 vtkHexahedron *Hexahedron;
00216 vtkEmptyCell *EmptyCell;
00217
00218
00219 int GetExtentType() { return VTK_3D_EXTENT; }
00220
00224 virtual void Crop();
00225
00226 int Dimensions[3];
00227 int DataDescription;
00228 int Blanking;
00229 vtkUnsignedCharArray *PointVisibility;
00230 void AllocatePointVisibility();
00231
00232 private:
00234
00235 void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
00236 {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
00238
00239
00240 void InternalStructuredGridCopy(vtkStructuredGrid *src);
00241
00242 private:
00243 vtkStructuredGrid(const vtkStructuredGrid&);
00244 void operator=(const vtkStructuredGrid&);
00245 };
00246
00247
00248 inline vtkIdType vtkStructuredGrid::GetNumberOfCells()
00249 {
00250 int nCells=1;
00251 int dims[3];
00252 int i;
00253
00254 this->GetDimensions(dims);
00255 for (i=0; i<3; i++)
00256 {
00257 if (dims[i] <= 0)
00258 {
00259 return 0;
00260 }
00261 if (dims[i] > 1)
00262 {
00263 nCells *= (dims[i]-1);
00264 }
00265 }
00266
00267 return nCells;
00268 }
00269
00270 inline int vtkStructuredGrid::GetDataDimension()
00271 {
00272 return vtkStructuredData::GetDataDimension(this->DataDescription);
00273 }
00274
00275 #endif
00276
00277
00278
00279
00280
00281