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:
66  static vtkStructuredGrid *New();
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);
170  void UnBlankPoint(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 
228  static vtkStructuredGrid* GetData(vtkInformation* info);
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 
283 inline vtkIdType vtkStructuredGrid::GetNumberOfCells()
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 {
307  return vtkStructuredData::GetDataDimension(this->DataDescription);
308 }
309 
310 #endif
311 
312 
313 
314 
315 
316 
int GetDataObjectType() override
Return what type of dataset this is.
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:164
virtual vtkIdType GetNumberOfCells()=0
Determine the number of cells composing the dataset.
static vtkDataObject * New()
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
a cell that represents a 3D point
Definition: vtkVertex.h:36
#define VTK_3D_EXTENT
Definition: vtkDataObject.h:61
static int GetDataDimension(int dataDescription)
Return the topological dimension of the data (e.g., 0, 1, 2, or 3D).
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:41
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:42
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:32
int vtkIdType
Definition: vtkType.h:287
provides thread-safe access to cells
void GetPoint(const int i, const int j, const int k, double pnt[3])
int GetDataDimension()
Return the dimensionality of the data.
cell represents a 1D line
Definition: vtkLine.h:35
abstract class to specify cell behavior
Definition: vtkCell.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual bool HasAnyBlankPoints()
Returns 1 if there are any blanking points 0 otherwise.
Definition: vtkDataSet.h:439
list of point or cell ids
Definition: vtkIdList.h:36
void Initialize() override
Reset to an empty state and free any memory.
void GetPoint(vtkIdType ptId, double p[3]) override
Standard vtkDataSet API methods.
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:47
virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds)
Topological inquiry to get all cells using list of points exclusive of cell specified (e...
dynamic, self-adjusting array of unsigned char
void GetPoint(vtkIdType ptId, double x[3]) override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:63
static void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, int dim[3])
Get the cells using a point.
topologically regular array of data
Store zero or more vtkInformation instances.
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
void CopyStructure(vtkDataSet *pd) override
Copy the geometric structure of an input point set object.
general representation of visualization data
Definition: vtkDataObject.h:64
#define VTK_STRUCTURED_GRID
Definition: vtkType.h:89
virtual vtkCell * GetCell(vtkIdType cellId)=0
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
virtual void GetCellBounds(vtkIdType cellId, double bounds[6])
Get the bounds of the cell with cellId such that: 0 <= cellId < NumberOfCells.
virtual int GetCellType(vtkIdType cellId)=0
Get type of cell with cellId such that: 0 <= cellId < NumberOfCells.
double * GetPoint(vtkIdType ptId) override
Standard vtkDataSet API methods.
vtkIdType GetNumberOfPoints() override
Standard vtkDataSet API methods.