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 "vtkCommonDataModelModule.h" // For export macro 00051 #include "vtkPointSet.h" 00052 00053 #include "vtkStructuredData.h" // Needed for inline methods 00054 00055 class vtkEmptyCell; 00056 class vtkHexahedron; 00057 class vtkLine; 00058 class vtkQuad; 00059 class vtkStructuredVisibilityConstraint; 00060 class vtkUnsignedCharArray; 00061 class vtkVertex; 00062 00063 class VTKCOMMONDATAMODEL_EXPORT vtkStructuredGrid : public vtkPointSet 00064 { 00065 public: 00066 static vtkStructuredGrid *New(); 00067 00068 vtkTypeMacro(vtkStructuredGrid,vtkPointSet); 00069 void PrintSelf(ostream& os, vtkIndent indent); 00070 00072 int GetDataObjectType() {return VTK_STRUCTURED_GRID;} 00073 00076 void CopyStructure(vtkDataSet *ds); 00077 00079 00080 vtkIdType GetNumberOfPoints() {return vtkPointSet::GetNumberOfPoints();} 00081 double *GetPoint(vtkIdType ptId) {return this->vtkPointSet::GetPoint(ptId);} 00082 void GetPoint(vtkIdType ptId, double p[3]) 00083 {this->vtkPointSet::GetPoint(ptId,p);} 00084 vtkCell *GetCell(vtkIdType cellId); 00085 void GetCell(vtkIdType cellId, vtkGenericCell *cell); 00086 void GetCellBounds(vtkIdType cellId, double bounds[6]); 00087 int GetCellType(vtkIdType cellId); 00088 vtkIdType GetNumberOfCells(); 00089 void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds); 00090 void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) 00091 { 00092 vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions()); 00093 } 00094 void Initialize(); 00095 int GetMaxCellSize() {return 8;}; //hexahedron is the largest 00096 void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, 00097 vtkIdList *cellIds); 00099 00101 00102 void SetDimensions(int i, int j, int k); 00103 void SetDimensions(int dim[3]); 00105 00107 00108 virtual int *GetDimensions (); 00109 virtual void GetDimensions (int dim[3]); 00111 00113 int GetDataDimension(); 00114 00116 00119 void SetExtent(int extent[6]); 00120 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2); 00121 vtkGetVector6Macro(Extent, int); 00123 00129 unsigned long GetActualMemorySize(); 00130 00132 00133 void ShallowCopy(vtkDataObject *src); 00134 void DeepCopy(vtkDataObject *src); 00136 00138 int GetExtentType() { return VTK_3D_EXTENT; } 00139 00141 00145 void BlankPoint(vtkIdType ptId); 00146 void UnBlankPoint(vtkIdType ptId); 00148 00150 00154 void BlankCell(vtkIdType ptId); 00155 void UnBlankCell(vtkIdType ptId); 00157 00159 vtkUnsignedCharArray *GetPointVisibilityArray(); 00160 00164 void SetPointVisibilityArray(vtkUnsignedCharArray *pointVisibility); 00165 00167 vtkUnsignedCharArray *GetCellVisibilityArray(); 00168 00172 void SetCellVisibilityArray(vtkUnsignedCharArray *pointVisibility); 00173 00176 unsigned char IsPointVisible(vtkIdType ptId); 00177 00180 unsigned char IsCellVisible(vtkIdType cellId); 00181 00184 unsigned char GetPointBlanking(); 00185 00188 unsigned char GetCellBlanking(); 00189 00194 void GetCellDims( int cellDims[3] ); 00195 00199 virtual void Crop(const int* updateExtent); 00200 00201 //BTX 00203 00204 static vtkStructuredGrid* GetData(vtkInformation* info); 00205 static vtkStructuredGrid* GetData(vtkInformationVector* v, int i=0); 00206 //ETX 00208 00215 void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true); 00216 00217 protected: 00218 vtkStructuredGrid(); 00219 ~vtkStructuredGrid(); 00220 00221 // for the GetCell method 00222 vtkVertex *Vertex; 00223 vtkLine *Line; 00224 vtkQuad *Quad; 00225 vtkHexahedron *Hexahedron; 00226 vtkEmptyCell *EmptyCell; 00227 00228 int Dimensions[3]; 00229 int DataDescription; 00230 00231 int Extent[6]; 00232 00233 vtkStructuredVisibilityConstraint* PointVisibility; 00234 00235 void SetPointVisibility(vtkStructuredVisibilityConstraint *pointVisibility); 00236 vtkGetObjectMacro(PointVisibility, vtkStructuredVisibilityConstraint); 00237 00238 vtkStructuredVisibilityConstraint* CellVisibility; 00239 00240 void SetCellVisibility(vtkStructuredVisibilityConstraint *cellVisibility); 00241 vtkGetObjectMacro(CellVisibility, vtkStructuredVisibilityConstraint); 00242 00245 virtual void ComputeScalarRange(); 00246 00247 private: 00249 00250 void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds) 00251 {this->GetCellNeighbors(cellId, &ptIds, &cellIds);} 00253 00254 // Internal method used by DeepCopy and ShallowCopy. 00255 void InternalStructuredGridCopy(vtkStructuredGrid *src); 00256 00257 private: 00258 vtkStructuredGrid(const vtkStructuredGrid&); // Not implemented. 00259 void operator=(const vtkStructuredGrid&); // Not implemented. 00260 }; 00261 00262 00263 inline vtkIdType vtkStructuredGrid::GetNumberOfCells() 00264 { 00265 int nCells=1; 00266 int dims[3]; 00267 int i; 00268 00269 this->GetDimensions(dims); 00270 for (i=0; i<3; i++) 00271 { 00272 if (dims[i] <= 0) 00273 { 00274 return 0; 00275 } 00276 if (dims[i] > 1) 00277 { 00278 nCells *= (dims[i]-1); 00279 } 00280 } 00281 00282 return nCells; 00283 } 00284 00285 inline int vtkStructuredGrid::GetDataDimension() 00286 { 00287 return vtkStructuredData::GetDataDimension(this->DataDescription); 00288 } 00289 00290 #endif 00291 00292 00293 00294 00295 00296