VTK
vtkStructuredGrid.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkStructuredGrid.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
47 #ifndef __vtkStructuredGrid_h
48 #define __vtkStructuredGrid_h
49 
50 #include "vtkPointSet.h"
51 
52 #include "vtkStructuredData.h" // Needed for inline methods
53 
54 class vtkEmptyCell;
55 class vtkHexahedron;
56 class vtkLine;
57 class vtkQuad;
60 class vtkVertex;
61 
63 {
64 public:
65  static vtkStructuredGrid *New();
66 
68  void PrintSelf(ostream& os, vtkIndent indent);
69 
72 
75  void CopyStructure(vtkDataSet *ds);
76 
78 
80  double *GetPoint(vtkIdType ptId) {return this->vtkPointSet::GetPoint(ptId);}
81  void GetPoint(vtkIdType ptId, double p[3])
82  {this->vtkPointSet::GetPoint(ptId,p);}
83  vtkCell *GetCell(vtkIdType cellId);
84  void GetCell(vtkIdType cellId, vtkGenericCell *cell);
85  void GetCellBounds(vtkIdType cellId, double bounds[6]);
86  int GetCellType(vtkIdType cellId);
88  void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
89  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
90  {
91  vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());
92  }
93  void Initialize();
94  int GetMaxCellSize() {return 8;}; //hexahedron is the largest
95  void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
96  vtkIdList *cellIds);
97  virtual void GetScalarRange(double range[2]);
98  double *GetScalarRange() {return this->Superclass::GetScalarRange();}
100 
102 
103  void SetDimensions(int i, int j, int k);
104  void SetDimensions(int dim[3]);
106 
108 
109  virtual int *GetDimensions ();
110  virtual void GetDimensions (int dim[3]);
112 
114  int GetDataDimension();
115 
117 
120  void SetExtent(int extent[6]);
121  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
122  vtkGetVector6Macro(Extent, int);
124 
130  unsigned long GetActualMemorySize();
131 
133 
134  void ShallowCopy(vtkDataObject *src);
135  void DeepCopy(vtkDataObject *src);
137 
139  int GetExtentType() { return VTK_3D_EXTENT; }
140 
142 
146  void BlankPoint(vtkIdType ptId);
147  void UnBlankPoint(vtkIdType ptId);
149 
151 
155  void BlankCell(vtkIdType ptId);
156  void UnBlankCell(vtkIdType ptId);
158 
160  vtkUnsignedCharArray *GetPointVisibilityArray();
161 
165  void SetPointVisibilityArray(vtkUnsignedCharArray *pointVisibility);
166 
168  vtkUnsignedCharArray *GetCellVisibilityArray();
169 
173  void SetCellVisibilityArray(vtkUnsignedCharArray *pointVisibility);
174 
177  unsigned char IsPointVisible(vtkIdType ptId);
178 
181  unsigned char IsCellVisible(vtkIdType cellId);
182 
185  unsigned char GetPointBlanking();
186 
189  unsigned char GetCellBlanking();
190 
194  virtual void Crop();
195 
196  //BTX
198 
200  static vtkStructuredGrid* GetData(vtkInformationVector* v, int i=0);
201  //ETX
203 
210  void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true);
211 
212 protected:
215 
216  // for the GetCell method
222 
223  int Dimensions[3];
225 
226  int Extent[6];
227 
229 
230  void SetPointVisibility(vtkStructuredVisibilityConstraint *pointVisibility);
231  vtkGetObjectMacro(PointVisibility, vtkStructuredVisibilityConstraint);
232 
234 
235  void SetCellVisibility(vtkStructuredVisibilityConstraint *cellVisibility);
236  vtkGetObjectMacro(CellVisibility, vtkStructuredVisibilityConstraint);
237 
238 private:
240 
241  void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
242  {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
244 
245  // Internal method used by DeepCopy and ShallowCopy.
246  void InternalStructuredGridCopy(vtkStructuredGrid *src);
247 
248 private:
249  vtkStructuredGrid(const vtkStructuredGrid&); // Not implemented.
250  void operator=(const vtkStructuredGrid&); // Not implemented.
251 };
252 
253 
255 {
256  int nCells=1;
257  int dims[3];
258  int i;
259 
260  this->GetDimensions(dims);
261  for (i=0; i<3; i++)
262  {
263  if (dims[i] <= 0)
264  {
265  return 0;
266  }
267  if (dims[i] > 1)
268  {
269  nCells *= (dims[i]-1);
270  }
271  }
272 
273  return nCells;
274 }
275 
277 {
279 }
280 
281 #endif
282 
283 
284 
285 
286 
287