VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkStructuredGrid.h 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 =========================================================================*/ 00047 #ifndef __vtkStructuredGrid_h 00048 #define __vtkStructuredGrid_h 00049 00050 #include "vtkPointSet.h" 00051 00052 #include "vtkStructuredData.h" // Needed for inline methods 00053 00054 class vtkEmptyCell; 00055 class vtkHexahedron; 00056 class vtkLine; 00057 class vtkQuad; 00058 class vtkStructuredVisibilityConstraint; 00059 class vtkUnsignedCharArray; 00060 class vtkVertex; 00061 00062 class VTK_FILTERING_EXPORT vtkStructuredGrid : public vtkPointSet 00063 { 00064 public: 00065 static vtkStructuredGrid *New(); 00066 00067 vtkTypeMacro(vtkStructuredGrid,vtkPointSet); 00068 void PrintSelf(ostream& os, vtkIndent indent); 00069 00071 int GetDataObjectType() {return VTK_STRUCTURED_GRID;} 00072 00075 void CopyStructure(vtkDataSet *ds); 00076 00078 00079 vtkIdType GetNumberOfPoints() {return vtkPointSet::GetNumberOfPoints();} 00080 double *GetPoint(vtkIdType ptId) {return this->vtkPointSet::GetPoint(ptId);} 00081 void GetPoint(vtkIdType ptId, double p[3]) 00082 {this->vtkPointSet::GetPoint(ptId,p);} 00083 vtkCell *GetCell(vtkIdType cellId); 00084 void GetCell(vtkIdType cellId, vtkGenericCell *cell); 00085 void GetCellBounds(vtkIdType cellId, double bounds[6]); 00086 int GetCellType(vtkIdType cellId); 00087 vtkIdType GetNumberOfCells(); 00088 void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds); 00089 void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) 00090 { 00091 vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions()); 00092 } 00093 void Initialize(); 00094 int GetMaxCellSize() {return 8;}; //hexahedron is the largest 00095 void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, 00096 vtkIdList *cellIds); 00097 virtual void GetScalarRange(double range[2]); 00098 double *GetScalarRange() {return this->Superclass::GetScalarRange();} 00100 00102 00103 void SetDimensions(int i, int j, int k); 00104 void SetDimensions(int dim[3]); 00106 00108 00109 virtual int *GetDimensions (); 00110 virtual void GetDimensions (int dim[3]); 00112 00114 int GetDataDimension(); 00115 00117 00120 void SetExtent(int extent[6]); 00121 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2); 00122 vtkGetVector6Macro(Extent, int); 00124 00130 unsigned long GetActualMemorySize(); 00131 00133 00134 void ShallowCopy(vtkDataObject *src); 00135 void DeepCopy(vtkDataObject *src); 00137 00139 int GetExtentType() { return VTK_3D_EXTENT; } 00140 00142 00146 void BlankPoint(vtkIdType ptId); 00147 void UnBlankPoint(vtkIdType ptId); 00149 00151 00155 void BlankCell(vtkIdType ptId); 00156 void UnBlankCell(vtkIdType ptId); 00158 00160 vtkUnsignedCharArray *GetPointVisibilityArray(); 00161 00165 void SetPointVisibilityArray(vtkUnsignedCharArray *pointVisibility); 00166 00168 vtkUnsignedCharArray *GetCellVisibilityArray(); 00169 00173 void SetCellVisibilityArray(vtkUnsignedCharArray *pointVisibility); 00174 00177 unsigned char IsPointVisible(vtkIdType ptId); 00178 00181 unsigned char IsCellVisible(vtkIdType cellId); 00182 00185 unsigned char GetPointBlanking(); 00186 00189 unsigned char GetCellBlanking(); 00190 00194 virtual void Crop(); 00195 00196 //BTX 00198 00199 static vtkStructuredGrid* GetData(vtkInformation* info); 00200 static vtkStructuredGrid* GetData(vtkInformationVector* v, int i=0); 00201 //ETX 00203 00210 void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true); 00211 00212 protected: 00213 vtkStructuredGrid(); 00214 ~vtkStructuredGrid(); 00215 00216 // for the GetCell method 00217 vtkVertex *Vertex; 00218 vtkLine *Line; 00219 vtkQuad *Quad; 00220 vtkHexahedron *Hexahedron; 00221 vtkEmptyCell *EmptyCell; 00222 00223 int Dimensions[3]; 00224 int DataDescription; 00225 00226 int Extent[6]; 00227 00228 vtkStructuredVisibilityConstraint* PointVisibility; 00229 00230 void SetPointVisibility(vtkStructuredVisibilityConstraint *pointVisibility); 00231 vtkGetObjectMacro(PointVisibility, vtkStructuredVisibilityConstraint); 00232 00233 vtkStructuredVisibilityConstraint* CellVisibility; 00234 00235 void SetCellVisibility(vtkStructuredVisibilityConstraint *cellVisibility); 00236 vtkGetObjectMacro(CellVisibility, vtkStructuredVisibilityConstraint); 00237 00238 private: 00240 00241 void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds) 00242 {this->GetCellNeighbors(cellId, &ptIds, &cellIds);} 00244 00245 // Internal method used by DeepCopy and ShallowCopy. 00246 void InternalStructuredGridCopy(vtkStructuredGrid *src); 00247 00248 private: 00249 vtkStructuredGrid(const vtkStructuredGrid&); // Not implemented. 00250 void operator=(const vtkStructuredGrid&); // Not implemented. 00251 }; 00252 00253 00254 inline vtkIdType vtkStructuredGrid::GetNumberOfCells() 00255 { 00256 int nCells=1; 00257 int dims[3]; 00258 int i; 00259 00260 this->GetDimensions(dims); 00261 for (i=0; i<3; i++) 00262 { 00263 if (dims[i] <= 0) 00264 { 00265 return 0; 00266 } 00267 if (dims[i] > 1) 00268 { 00269 nCells *= (dims[i]-1); 00270 } 00271 } 00272 00273 return nCells; 00274 } 00275 00276 inline int vtkStructuredGrid::GetDataDimension() 00277 { 00278 return vtkStructuredData::GetDataDimension(this->DataDescription); 00279 } 00280 00281 #endif 00282 00283 00284 00285 00286 00287