VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 "vtkCommonDataModelModule.h" // For export macro
51 #include "vtkPointSet.h"
52 
53 #include "vtkStructuredData.h" // Needed for inline methods
54 
55 class vtkEmptyCell;
56 class vtkHexahedron;
57 class vtkLine;
58 class vtkQuad;
60 class vtkUnsignedCharArray;
61 class vtkVertex;
62 
63 class VTKCOMMONDATAMODEL_EXPORT vtkStructuredGrid : public vtkPointSet
64 {
65 public:
66  static vtkStructuredGrid *New();
67 
68  vtkTypeMacro(vtkStructuredGrid,vtkPointSet);
69  void PrintSelf(ostream& os, vtkIndent indent);
70 
72  int GetDataObjectType() {return VTK_STRUCTURED_GRID;}
73 
76  void CopyStructure(vtkDataSet *ds);
77 
79 
80  vtkIdType GetNumberOfPoints() {return vtkPointSet::GetNumberOfPoints();}
81  double *GetPoint(vtkIdType ptId) {return this->vtkPointSet::GetPoint(ptId);}
82  void GetPoint(vtkIdType ptId, double p[3])
83  {this->vtkPointSet::GetPoint(ptId,p);}
84  vtkCell *GetCell(vtkIdType cellId);
85  void GetCell(vtkIdType cellId, vtkGenericCell *cell);
86  void GetCellBounds(vtkIdType cellId, double bounds[6]);
87  int GetCellType(vtkIdType cellId);
88  vtkIdType GetNumberOfCells();
89  void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
90  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
91  {
92  vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());
93  }
94  void Initialize();
95  int GetMaxCellSize() {return 8;}; //hexahedron is the largest
96  void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
97  vtkIdList *cellIds);
98  virtual void GetScalarRange(double range[2]);
99  double *GetScalarRange() {return this->Superclass::GetScalarRange();}
101 
103 
104  void SetDimensions(int i, int j, int k);
105  void SetDimensions(int dim[3]);
107 
109 
110  virtual int *GetDimensions ();
111  virtual void GetDimensions (int dim[3]);
113 
115  int GetDataDimension();
116 
118 
121  void SetExtent(int extent[6]);
122  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
123  vtkGetVector6Macro(Extent, int);
125 
131  unsigned long GetActualMemorySize();
132 
134 
135  void ShallowCopy(vtkDataObject *src);
136  void DeepCopy(vtkDataObject *src);
138 
140  int GetExtentType() { return VTK_3D_EXTENT; }
141 
143 
147  void BlankPoint(vtkIdType ptId);
148  void UnBlankPoint(vtkIdType ptId);
150 
152 
156  void BlankCell(vtkIdType ptId);
157  void UnBlankCell(vtkIdType ptId);
159 
161  vtkUnsignedCharArray *GetPointVisibilityArray();
162 
166  void SetPointVisibilityArray(vtkUnsignedCharArray *pointVisibility);
167 
169  vtkUnsignedCharArray *GetCellVisibilityArray();
170 
174  void SetCellVisibilityArray(vtkUnsignedCharArray *pointVisibility);
175 
178  unsigned char IsPointVisible(vtkIdType ptId);
179 
182  unsigned char IsCellVisible(vtkIdType cellId);
183 
186  unsigned char GetPointBlanking();
187 
190  unsigned char GetCellBlanking();
191 
196  void GetCellDims( int cellDims[3] );
197 
201  virtual void Crop(const int* updateExtent);
202 
203  //BTX
205 
206  static vtkStructuredGrid* GetData(vtkInformation* info);
207  static vtkStructuredGrid* GetData(vtkInformationVector* v, int i=0);
208  //ETX
210 
217  void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true);
218 
219 protected:
222 
223  // for the GetCell method
225  vtkLine *Line;
226  vtkQuad *Quad;
229 
230  int Dimensions[3];
232 
233  int Extent[6];
234 
236 
237  void SetPointVisibility(vtkStructuredVisibilityConstraint *pointVisibility);
238  vtkGetObjectMacro(PointVisibility, vtkStructuredVisibilityConstraint);
239 
241 
242  void SetCellVisibility(vtkStructuredVisibilityConstraint *cellVisibility);
243  vtkGetObjectMacro(CellVisibility, vtkStructuredVisibilityConstraint);
244 
245 private:
247 
248  void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
249  {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
251 
252  // Internal method used by DeepCopy and ShallowCopy.
253  void InternalStructuredGridCopy(vtkStructuredGrid *src);
254 
255 private:
256  vtkStructuredGrid(const vtkStructuredGrid&); // Not implemented.
257  void operator=(const vtkStructuredGrid&); // Not implemented.
258 };
259 
260 
262 {
263  int nCells=1;
264  int dims[3];
265  int i;
266 
267  this->GetDimensions(dims);
268  for (i=0; i<3; i++)
269  {
270  if (dims[i] <= 0)
271  {
272  return 0;
273  }
274  if (dims[i] > 1)
275  {
276  nCells *= (dims[i]-1);
277  }
278  }
279 
280  return nCells;
281 }
282 
284 {
286 }
287 
288 #endif
289 
290 
291 
292 
293 
294 
vtkEmptyCell * EmptyCell
a cell that represents a 3D point
Definition: vtkVertex.h:35
vtkIdType GetNumberOfCells()
#define VTK_3D_EXTENT
Definition: vtkDataObject.h:61
static int GetDataDimension(int dataDescription)
void GetPoint(vtkIdType ptId, double p[3])
double * GetPoint(vtkIdType ptId)
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:31
provides thread-safe access to cells
virtual int * GetDimensions()
vtkStructuredVisibilityConstraint * CellVisibility
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
vtkStructuredVisibilityConstraint * PointVisibility
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:46
double * GetScalarRange()
static void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, int dim[3])
topologically regular array of data
vtkIdType GetNumberOfPoints()
helper object to manage the visibility of points and cells
general representation of visualization data
Definition: vtkDataObject.h:64
vtkHexahedron * Hexahedron