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 =========================================================================*/
48 #ifndef vtkStructuredGrid_h
49 #define vtkStructuredGrid_h
50 
51 #include "vtkCommonDataModelModule.h" // For export macro
52 #include "vtkPointSet.h"
53 
54 #include "vtkStructuredData.h" // Needed for inline methods
55 
56 class vtkEmptyCell;
57 class vtkHexahedron;
58 class vtkLine;
59 class vtkQuad;
61 class vtkVertex;
62 
63 class VTKCOMMONDATAMODEL_EXPORT vtkStructuredGrid : public vtkPointSet
64 {
65 public:
67 
69  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
70 
74  int GetDataObjectType() VTK_OVERRIDE {return VTK_STRUCTURED_GRID;}
75 
79  void CopyStructure(vtkDataSet *ds) VTK_OVERRIDE;
80 
82 
87  double *GetPoint(vtkIdType ptId) VTK_OVERRIDE
88  {return this->vtkPointSet::GetPoint(ptId);}
89  void GetPoint(vtkIdType ptId, double p[3]) VTK_OVERRIDE
90  {this->vtkPointSet::GetPoint(ptId,p);}
91  vtkCell *GetCell(vtkIdType cellId) VTK_OVERRIDE;
92  void GetCell(vtkIdType cellId, vtkGenericCell *cell) VTK_OVERRIDE;
93  void GetCellBounds(vtkIdType cellId, double bounds[6]) VTK_OVERRIDE;
94  int GetCellType(vtkIdType cellId) VTK_OVERRIDE;
95  vtkIdType GetNumberOfCells() VTK_OVERRIDE;
96  void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) VTK_OVERRIDE;
97  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) VTK_OVERRIDE
98  {
99  vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());
100  }
101  void Initialize() VTK_OVERRIDE;
102  int GetMaxCellSize() VTK_OVERRIDE {return 8;}; //hexahedron is the largest
103  void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
104  vtkIdList *cellIds) VTK_OVERRIDE;
106 
108 
111  void SetDimensions(int i, int j, int k);
112  void SetDimensions(int dim[3]);
114 
116 
119  virtual int *GetDimensions ();
120  virtual void GetDimensions (int dim[3]);
122 
126  int GetDataDimension();
127 
129 
134  void SetExtent(int extent[6]);
135  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
136  vtkGetVector6Macro(Extent, int);
138 
147  unsigned long GetActualMemorySize() VTK_OVERRIDE;
148 
150 
153  void ShallowCopy(vtkDataObject *src) VTK_OVERRIDE;
154  void DeepCopy(vtkDataObject *src) VTK_OVERRIDE;
156 
160  int GetExtentType() VTK_OVERRIDE { return VTK_3D_EXTENT; }
161 
163 
169  void BlankPoint(vtkIdType ptId);
172 
174 
180  void BlankCell(vtkIdType ptId);
181  void UnBlankCell(vtkIdType ptId);
183 
189  unsigned char IsPointVisible(vtkIdType ptId);
190 
196  unsigned char IsCellVisible(vtkIdType cellId);
197 
202  bool HasAnyBlankPoints() VTK_OVERRIDE;
207  bool HasAnyBlankCells() VTK_OVERRIDE;
208 
215  void GetCellDims( int cellDims[3] );
216 
222  void Crop(const int* updateExtent) VTK_OVERRIDE;
223 
225 
229  static vtkStructuredGrid* GetData(vtkInformationVector* v, int i=0);
231 
241  void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true);
242 
243 protected:
245  ~vtkStructuredGrid() VTK_OVERRIDE;
246 
247  // for the GetCell method
248  vtkVertex *Vertex;
249  vtkLine *Line;
250  vtkQuad *Quad;
251  vtkHexahedron *Hexahedron;
252  vtkEmptyCell *EmptyCell;
253 
254  int Dimensions[3];
255  int DataDescription;
256 
257  int Extent[6];
258 
263  void ComputeScalarRange() VTK_OVERRIDE;
264 
265 private:
269  void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
270  {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
271 
272  // Internal method used by DeepCopy and ShallowCopy.
273  void InternalStructuredGridCopy(vtkStructuredGrid *src);
274 
275  static unsigned char MASKED_CELL_VALUE;
276 
277 private:
278  vtkStructuredGrid(const vtkStructuredGrid&) VTK_DELETE_FUNCTION;
279  void operator=(const vtkStructuredGrid&) VTK_DELETE_FUNCTION;
280 };
281 
282 
284 {
285  int nCells=1;
286  int dims[3];
287  int i;
288 
289  this->GetDimensions(dims);
290  for (i=0; i<3; i++)
291  {
292  if (dims[i] <= 0)
293  {
294  return 0;
295  }
296  if (dims[i] > 1)
297  {
298  nCells *= (dims[i]-1);
299  }
300  }
301 
302  return nCells;
303 }
304 
306 {
308 }
309 
310 #endif
311 
312 
313 
314 
315 
316 
void GetPoint(const int i, const int j, const int k, double pnt[3])
abstract class to specify cell behavior
Definition: vtkCell.h:60
general representation of visualization data
Definition: vtkDataObject.h:65
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
virtual vtkIdType GetNumberOfCells()=0
Determine the number of cells composing the dataset.
virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds)
Topological inquiry to get all cells using list of points exclusive of cell specified (e....
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:33
provides thread-safe access to cells
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:48
list of point or cell ids
Definition: vtkIdList.h:37
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
cell represents a 1D line
Definition: vtkLine.h:36
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:43
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:164
void GetPoint(vtkIdType ptId, double x[3]) override
Copy point coordinates into user provided array x[3] for specified point id.
Definition: vtkPointSet.h:63
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:42
static int GetDataDimension(int dataDescription)
Return the topological dimension of the data (e.g., 0, 1, 2, or 3D).
static void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, int dim[3])
Get the cells using a point.
topologically regular array of data
void SetDimensions(int i, int j, int k)
following methods are specific to structured grid
void BlankCell(vtkIdType ptId)
Methods for supporting blanking of cells.
void GetPoint(vtkIdType ptId, double p[3]) override
Copy point coordinates into user provided array x[3] for specified point id.
void BlankPoint(vtkIdType ptId)
Methods for supporting blanking of cells.
void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds) override
Topological inquiry to get all cells using list of points exclusive of cell specified (e....
void GetCellBounds(vtkIdType cellId, double bounds[6]) override
Get the bounds of the cell with cellId such that: 0 <= cellId < NumberOfCells.
virtual void GetDimensions(int dim[3])
int GetDataObjectType() override
Return what type of dataset this is.
void GetCell(vtkIdType cellId, vtkGenericCell *cell) override
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetDimensions(int dim[3])
int GetDataDimension()
Return the dimensionality of the data.
static vtkStructuredGrid * New()
void SetExtent(int extent[6])
Different ways to set the extent of the data array.
vtkIdType GetNumberOfPoints() override
Standard vtkDataSet API methods.
vtkIdType GetNumberOfCells() override
Determine the number of cells composing the dataset.
vtkCell * GetCell(vtkIdType cellId) override
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2)
void UnBlankPoint(vtkIdType ptId)
virtual int * GetDimensions()
Get dimensions of this structured points dataset.
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
unsigned char IsCellVisible(vtkIdType cellId)
Return non-zero value if specified point is visible.
double * GetPoint(vtkIdType ptId) override
See vtkDataSet for additional information.
int GetCellType(vtkIdType cellId) override
Get type of cell with cellId such that: 0 <= cellId < NumberOfCells.
void CopyStructure(vtkDataSet *ds) override
Copy the geometric and topological structure of an input poly data object.
unsigned char IsPointVisible(vtkIdType ptId)
Return non-zero value if specified point is visible.
bool HasAnyBlankPoints() override
Returns 1 if there is any visibility constraint on the points, 0 otherwise.
void UnBlankCell(vtkIdType ptId)
void Initialize() override
Reset to an empty state and free any memory.
dynamic, self-adjusting array of unsigned char
a cell that represents a 3D point
Definition: vtkVertex.h:37
@ info
Definition: vtkX3D.h:376
@ extent
Definition: vtkX3D.h:345
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
#define VTK_3D_EXTENT
Definition: vtkDataObject.h:61
int vtkIdType
Definition: vtkType.h:287
#define VTK_STRUCTURED_GRID
Definition: vtkType.h:89