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;
61 class vtkVertex;
62 
64 {
65 public:
66  static vtkStructuredGrid *New();
67 
69  void PrintSelf(ostream& os, vtkIndent indent);
70 
73 
76  void CopyStructure(vtkDataSet *ds);
77 
79 
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);
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);
99 
101 
102  void SetDimensions(int i, int j, int k);
103  void SetDimensions(int dim[3]);
105 
107 
108  virtual int *GetDimensions ();
109  virtual void GetDimensions (int dim[3]);
111 
113  int GetDataDimension();
114 
116 
119  void SetExtent(int extent[6]);
120  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
121  vtkGetVector6Macro(Extent, int);
123 
129  unsigned long GetActualMemorySize();
130 
132 
134  void DeepCopy(vtkDataObject *src);
136 
138  int GetExtentType() { return VTK_3D_EXTENT; }
139 
141 
145  void BlankPoint(vtkIdType ptId);
146  void UnBlankPoint(vtkIdType ptId);
148 
150 
154  void BlankCell(vtkIdType ptId);
155  void UnBlankCell(vtkIdType ptId);
157 
159  vtkUnsignedCharArray *GetPointVisibilityArray();
160 
164  void SetPointVisibilityArray(vtkUnsignedCharArray *pointVisibility);
165 
167  vtkUnsignedCharArray *GetCellVisibilityArray();
168 
172  void SetCellVisibilityArray(vtkUnsignedCharArray *pointVisibility);
173 
176  unsigned char IsPointVisible(vtkIdType ptId);
177 
180  unsigned char IsCellVisible(vtkIdType cellId);
181 
184  unsigned char GetPointBlanking();
185 
188  unsigned char GetCellBlanking();
189 
194  void GetCellDims( int cellDims[3] );
195 
199  virtual void Crop(const int* updateExtent);
200 
201  //BTX
203 
205  static vtkStructuredGrid* GetData(vtkInformationVector* v, int i=0);
206  //ETX
208 
215  void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true);
216 
217 protected:
220 
221  // for the GetCell method
227 
228  int Dimensions[3];
230 
231  int Extent[6];
232 
234 
235  void SetPointVisibility(vtkStructuredVisibilityConstraint *pointVisibility);
236  vtkGetObjectMacro(PointVisibility, vtkStructuredVisibilityConstraint);
237 
239 
240  void SetCellVisibility(vtkStructuredVisibilityConstraint *cellVisibility);
241  vtkGetObjectMacro(CellVisibility, vtkStructuredVisibilityConstraint);
242 
245  virtual void ComputeScalarRange();
246 
247 private:
249 
250  void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
251  {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
253 
254  // Internal method used by DeepCopy and ShallowCopy.
255  void InternalStructuredGridCopy(vtkStructuredGrid *src);
256 
257 private:
258  vtkStructuredGrid(const vtkStructuredGrid&); // Not implemented.
259  void operator=(const vtkStructuredGrid&); // Not implemented.
260 };
261 
262 
264 {
265  int nCells=1;
266  int dims[3];
267  int i;
268 
269  this->GetDimensions(dims);
270  for (i=0; i<3; i++)
271  {
272  if (dims[i] <= 0)
273  {
274  return 0;
275  }
276  if (dims[i] > 1)
277  {
278  nCells *= (dims[i]-1);
279  }
280  }
281 
282  return nCells;
283 }
284 
286 {
288 }
289 
290 #endif
291 
292 
293 
294 
295 
296 
virtual vtkIdType GetNumberOfCells()=0
vtkEmptyCell * EmptyCell
const GLdouble * v
Definition: vtkgl.h:11595
static vtkDataObject * New()
virtual void ComputeScalarRange()
Store vtkAlgorithm input/output information.
vtkIdType GetNumberOfPoints()
Definition: vtkPointSet.h:131
abstract class to specify dataset behavior
Definition: vtkDataSet.h:60
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])
static vtkPointSet * GetData(vtkInformation *info)
double * GetPoint(vtkIdType ptId)
void CopyStructure(vtkDataSet *pd)
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:40
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:41
void Initialize()
unsigned long GetActualMemorySize()
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:31
int vtkIdType
Definition: vtkType.h:268
provides thread-safe access to cells
virtual int * GetDimensions()
virtual void Crop(const int *updateExtent)
cell represents a 1D line
Definition: vtkLine.h:34
abstract class to specify cell behavior
Definition: vtkCell.h:58
GLenum src
Definition: vtkgl.h:12525
vtkStructuredVisibilityConstraint * CellVisibility
a simple class to control print indentation
Definition: vtkIndent.h:38
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
list of point or cell ids
Definition: vtkIdList.h:35
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
vtkStructuredVisibilityConstraint * PointVisibility
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:46
virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds)
dynamic, self-adjusting array of unsigned char
void PrintSelf(ostream &os, vtkIndent indent)
static void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, int dim[3])
void DeepCopy(vtkDataObject *src)
topologically regular array of data
vtkIdType GetNumberOfPoints()
Store zero or more vtkInformation instances.
helper object to manage the visibility of points and cells
void ShallowCopy(vtkDataObject *src)
general representation of visualization data
Definition: vtkDataObject.h:64
#define VTK_STRUCTURED_GRID
Definition: vtkType.h:68
#define VTKCOMMONDATAMODEL_EXPORT
virtual vtkCell * GetCell(vtkIdType cellId)=0
vtkHexahedron * Hexahedron
virtual void GetCellBounds(vtkIdType cellId, double bounds[6])
virtual int GetCellType(vtkIdType cellId)=0
double * GetPoint(vtkIdType ptId)
Definition: vtkPointSet.h:56
GLfloat GLfloat p
Definition: vtkgl.h:15717