VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkStructuredGrid.h,v $ 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 =========================================================================*/ 00044 #ifndef __vtkStructuredGrid_h 00045 #define __vtkStructuredGrid_h 00046 00047 #include "vtkPointSet.h" 00048 00049 #include "vtkStructuredData.h" // Needed for inline methods 00050 00051 class vtkEmptyCell; 00052 class vtkHexahedron; 00053 class vtkLine; 00054 class vtkQuad; 00055 class vtkStructuredVisibilityConstraint; 00056 class vtkUnsignedCharArray; 00057 class vtkVertex; 00058 00059 class VTK_FILTERING_EXPORT vtkStructuredGrid : public vtkPointSet 00060 { 00061 public: 00062 static vtkStructuredGrid *New(); 00063 00064 vtkTypeRevisionMacro(vtkStructuredGrid,vtkPointSet); 00065 void PrintSelf(ostream& os, vtkIndent indent); 00066 00068 int GetDataObjectType() {return VTK_STRUCTURED_GRID;} 00069 00072 void CopyStructure(vtkDataSet *ds); 00073 00075 00076 vtkIdType GetNumberOfPoints() {return vtkPointSet::GetNumberOfPoints();} 00077 double *GetPoint(vtkIdType ptId) {return this->vtkPointSet::GetPoint(ptId);} 00078 void GetPoint(vtkIdType ptId, double p[3]) 00079 {this->vtkPointSet::GetPoint(ptId,p);} 00080 vtkCell *GetCell(vtkIdType cellId); 00081 void GetCell(vtkIdType cellId, vtkGenericCell *cell); 00082 void GetCellBounds(vtkIdType cellId, double bounds[6]); 00083 int GetCellType(vtkIdType cellId); 00084 vtkIdType GetNumberOfCells(); 00085 void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds); 00086 void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) 00087 { 00088 vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions()); 00089 } 00090 void Initialize(); 00091 int GetMaxCellSize() {return 8;}; //hexahedron is the largest 00092 void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, 00093 vtkIdList *cellIds); 00094 virtual void GetScalarRange(double range[2]); 00095 double *GetScalarRange() {return this->Superclass::GetScalarRange();} 00097 00099 00100 void SetDimensions(int i, int j, int k); 00101 void SetDimensions(int dim[3]); 00103 00105 00106 virtual int *GetDimensions (); 00107 virtual void GetDimensions (int dim[3]); 00109 00111 int GetDataDimension(); 00112 00114 00117 void SetExtent(int extent[6]); 00118 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2); 00119 vtkGetVector6Macro(Extent, int); 00121 00127 unsigned long GetActualMemorySize(); 00128 00130 00131 void ShallowCopy(vtkDataObject *src); 00132 void DeepCopy(vtkDataObject *src); 00134 00136 int GetExtentType() { return VTK_3D_EXTENT; } 00137 00139 00143 void BlankPoint(vtkIdType ptId); 00144 void UnBlankPoint(vtkIdType ptId); 00146 00148 00152 void BlankCell(vtkIdType ptId); 00153 void UnBlankCell(vtkIdType ptId); 00155 00157 vtkUnsignedCharArray *GetPointVisibilityArray(); 00158 00162 void SetPointVisibilityArray(vtkUnsignedCharArray *pointVisibility); 00163 00165 vtkUnsignedCharArray *GetCellVisibilityArray(); 00166 00170 void SetCellVisibilityArray(vtkUnsignedCharArray *pointVisibility); 00171 00174 unsigned char IsPointVisible(vtkIdType ptId); 00175 00178 unsigned char IsCellVisible(vtkIdType cellId); 00179 00182 unsigned char GetPointBlanking(); 00183 00186 unsigned char GetCellBlanking(); 00187 00191 virtual void Crop(); 00192 00193 //BTX 00195 00196 static vtkStructuredGrid* GetData(vtkInformation* info); 00197 static vtkStructuredGrid* GetData(vtkInformationVector* v, int i=0); 00198 //ETX 00200 00201 protected: 00202 vtkStructuredGrid(); 00203 ~vtkStructuredGrid(); 00204 00205 // for the GetCell method 00206 vtkVertex *Vertex; 00207 vtkLine *Line; 00208 vtkQuad *Quad; 00209 vtkHexahedron *Hexahedron; 00210 vtkEmptyCell *EmptyCell; 00211 00212 int Dimensions[3]; 00213 int DataDescription; 00214 00215 int Extent[6]; 00216 00217 vtkStructuredVisibilityConstraint* PointVisibility; 00218 00219 void SetPointVisibility(vtkStructuredVisibilityConstraint *pointVisibility); 00220 vtkGetObjectMacro(PointVisibility, vtkStructuredVisibilityConstraint); 00221 00222 vtkStructuredVisibilityConstraint* CellVisibility; 00223 00224 void SetCellVisibility(vtkStructuredVisibilityConstraint *cellVisibility); 00225 vtkGetObjectMacro(CellVisibility, vtkStructuredVisibilityConstraint); 00226 00227 private: 00229 00230 void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds) 00231 {this->GetCellNeighbors(cellId, &ptIds, &cellIds);} 00233 00234 // Internal method used by DeepCopy and ShallowCopy. 00235 void InternalStructuredGridCopy(vtkStructuredGrid *src); 00236 00237 private: 00238 vtkStructuredGrid(const vtkStructuredGrid&); // Not implemented. 00239 void operator=(const vtkStructuredGrid&); // Not implemented. 00240 }; 00241 00242 00243 inline vtkIdType vtkStructuredGrid::GetNumberOfCells() 00244 { 00245 int nCells=1; 00246 int dims[3]; 00247 int i; 00248 00249 this->GetDimensions(dims); 00250 for (i=0; i<3; i++) 00251 { 00252 if (dims[i] <= 0) 00253 { 00254 return 0; 00255 } 00256 if (dims[i] > 1) 00257 { 00258 nCells *= (dims[i]-1); 00259 } 00260 } 00261 00262 return nCells; 00263 } 00264 00265 inline int vtkStructuredGrid::GetDataDimension() 00266 { 00267 return vtkStructuredData::GetDataDimension(this->DataDescription); 00268 } 00269 00270 #endif 00271 00272 00273 00274 00275 00276