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) override;
70 
74  int GetDataObjectType() override {return VTK_STRUCTURED_GRID;}
75 
79  void CopyStructure(vtkDataSet *ds) override;
80 
82 
87  double *GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override
88  {return this->vtkPointSet::GetPoint(ptId);}
89  void GetPoint(vtkIdType ptId, double p[3]) override
90  {this->vtkPointSet::GetPoint(ptId,p);}
91  vtkCell *GetCell(vtkIdType cellId) override;
92  vtkCell *GetCell(int i, int j, int k) override;
93  void GetCell(vtkIdType cellId, vtkGenericCell *cell) override;
94  void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
95  int GetCellType(vtkIdType cellId) override;
96  vtkIdType GetNumberOfCells() override;
97  void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) override;
98  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override
99  {
100  vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());
101  }
102  void Initialize() override;
103  int GetMaxCellSize() override {return 8;}; //hexahedron is the largest
104  void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
105  vtkIdList *cellIds) override;
106  void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
107  vtkIdList *cellIds, int *seedLoc);
109 
111 
114  void SetDimensions(int i, int j, int k);
115  void SetDimensions(const int dim[3]);
117 
119 
122  virtual int *GetDimensions () VTK_SIZEHINT(3);
123  virtual void GetDimensions (int dim[3]);
125 
129  int GetDataDimension();
130 
132 
137  void SetExtent(int extent[6]);
138  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
139  vtkGetVector6Macro(Extent, int);
141 
150  unsigned long GetActualMemorySize() override;
151 
153 
156  void ShallowCopy(vtkDataObject *src) override;
157  void DeepCopy(vtkDataObject *src) override;
159 
163  int GetExtentType() override { return VTK_3D_EXTENT; }
164 
166 
172  void BlankPoint(vtkIdType ptId);
173  void UnBlankPoint(vtkIdType ptId);
175 
177 
183  void BlankCell(vtkIdType ptId);
184  void UnBlankCell(vtkIdType ptId);
186 
192  unsigned char IsPointVisible(vtkIdType ptId);
193 
199  unsigned char IsCellVisible(vtkIdType cellId);
200 
205  bool HasAnyBlankPoints() override;
210  bool HasAnyBlankCells() override;
211 
218  void GetCellDims( int cellDims[3] );
219 
225  void Crop(const int* updateExtent) override;
226 
228 
232  static vtkStructuredGrid* GetData(vtkInformationVector* v, int i=0);
234 
244  void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true);
245 
246 protected:
248  ~vtkStructuredGrid() override;
249 
250  // for the GetCell method
256 
257  int Dimensions[3];
259 
260  int Extent[6];
261 
266  void ComputeScalarRange() override;
267 
268 private:
272  void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
273  {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
274 
275  // Internal method used by DeepCopy and ShallowCopy.
276  void InternalStructuredGridCopy(vtkStructuredGrid *src);
277 
278  static unsigned char MASKED_CELL_VALUE;
279 
280 private:
281  vtkStructuredGrid(const vtkStructuredGrid&) = delete;
282  void operator=(const vtkStructuredGrid&) = delete;
283 };
284 
285 
287 {
288  vtkIdType nCells=1;
289  int dims[3];
290  int i;
291 
292  this->GetDimensions(dims);
293  for (i=0; i<3; i++)
294  {
295  if (dims[i] <= 0)
296  {
297  return 0;
298  }
299  if (dims[i] > 1)
300  {
301  nCells *= (dims[i]-1);
302  }
303  }
304 
305  return nCells;
306 }
307 
309 {
311 }
312 
313 #endif
314 
315 
316 
317 
318 
319 
vtkStructuredGrid::GetPointCells
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override
Topological inquiry to get cells using point.
Definition: vtkStructuredGrid.h:98
vtkDataSet::ComputeScalarRange
virtual void ComputeScalarRange()
Compute the range of the scalars and cache it into ScalarRange only if the cache became invalid (Scal...
vtkStructuredData::GetDataDimension
static int GetDataDimension(int dataDescription)
Return the topological dimension of the data (e.g., 0, 1, 2, or 3D).
vtkHexahedron
a cell that represents a linear 3D hexahedron
Definition: vtkHexahedron.h:47
vtkStructuredGrid::GetNumberOfPoints
vtkIdType GetNumberOfPoints() override
Standard vtkDataSet API methods.
Definition: vtkStructuredGrid.h:85
vtkPointSet.h
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkStructuredGrid::EmptyCell
vtkEmptyCell * EmptyCell
Definition: vtkStructuredGrid.h:255
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkEmptyCell
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:32
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:41
vtkStructuredGrid
topologically regular array of data
Definition: vtkStructuredGrid.h:63
vtkPointSet::GetData
static vtkPointSet * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
vtkVertex
a cell that represents a 3D point
Definition: vtkVertex.h:36
vtkLine
cell represents a 1D line
Definition: vtkLine.h:35
VTK_3D_EXTENT
#define VTK_3D_EXTENT
Definition: vtkDataObject.h:61
vtkStructuredData.h
vtkStructuredGrid::GetDimensions
virtual int * GetDimensions()
Get dimensions of this structured points dataset.
vtkPointSet::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkStructuredGrid::GetDataDimension
int GetDataDimension()
Return the dimensionality of the data.
Definition: vtkStructuredGrid.h:308
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:42
vtkDataSet::GetCellNeighbors
virtual void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds, vtkIdList *cellIds)
Topological inquiry to get all cells using list of points exclusive of cell specified (e....
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:59
vtkStructuredData::GetPointCells
static void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, int dim[3])
Get the cells using a point.
vtkStructuredGrid::GetNumberOfCells
vtkIdType GetNumberOfCells() override
Determine the number of cells composing the dataset.
Definition: vtkStructuredGrid.h:286
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkStructuredGrid::GetMaxCellSize
int GetMaxCellSize() override
Convenience method returns largest cell size in dataset.
Definition: vtkStructuredGrid.h:103
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
vtkDataSet::HasAnyBlankCells
virtual bool HasAnyBlankCells()
Returns 1 if there are any blanking cells 0 otherwise.
Definition: vtkDataSet.h:435
vtkPointSet::Initialize
void Initialize() override
Reset to an empty state and free any memory.
vtkStructuredGrid::DataDescription
int DataDescription
Definition: vtkStructuredGrid.h:258
vtkDataObject::Crop
virtual void Crop(const int *updateExtent)
This method crops the data object (if necessary) so that the extent matches the update extent.
vtkPointSet::GetPoint
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
vtkDataSet::HasAnyBlankPoints
virtual bool HasAnyBlankPoints()
Returns 1 if there are any blanking points 0 otherwise.
Definition: vtkDataSet.h:444
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkDataSet::GetCellPoints
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
Topological inquiry to get points defining cell.
vtkX3D::info
Definition: vtkX3D.h:376
vtkStructuredGrid::Quad
vtkQuad * Quad
Definition: vtkStructuredGrid.h:253
vtkStructuredGrid::GetPoint
void GetPoint(vtkIdType ptId, double p[3]) override
Copy point coordinates into user provided array x[3] for specified point id.
Definition: vtkStructuredGrid.h:89
vtkPointSet
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:42
vtkStructuredGrid::Hexahedron
vtkHexahedron * Hexahedron
Definition: vtkStructuredGrid.h:254
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:39
vtkStructuredGrid::Vertex
vtkVertex * Vertex
Definition: vtkStructuredGrid.h:251
vtkX3D::extent
Definition: vtkX3D.h:345
vtkDataSet::GetNumberOfCells
virtual vtkIdType GetNumberOfCells()=0
Determine the number of cells composing the dataset.
vtkStructuredGrid::GetDataObjectType
int GetDataObjectType() override
Return what type of dataset this is.
Definition: vtkStructuredGrid.h:74
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkDataSet::GetCellType
virtual int GetCellType(vtkIdType cellId)=0
Get type of cell with cellId such that: 0 <= cellId < NumberOfCells.
vtkStructuredGrid::GetPoint
double * GetPoint(vtkIdType ptId) override
See vtkDataSet for additional information.
Definition: vtkStructuredGrid.h:87
vtkDataSet::GetCellBounds
virtual void GetCellBounds(vtkIdType cellId, double bounds[6])
Get the bounds of the cell with cellId such that: 0 <= cellId < NumberOfCells.
vtkPointSet::CopyStructure
void CopyStructure(vtkDataSet *pd) override
Copy the geometric structure of an input point set object.
vtkQuad
a cell that represents a 2D quadrilateral
Definition: vtkQuad.h:41
vtkStructuredGrid::Line
vtkLine * Line
Definition: vtkStructuredGrid.h:252
vtkDataObject::New
static vtkDataObject * New()
vtkDataSet::GetCell
virtual vtkCell * GetCell(vtkIdType cellId)=0
Get cell with cellId such that: 0 <= cellId < NumberOfCells.
VTK_STRUCTURED_GRID
#define VTK_STRUCTURED_GRID
Definition: vtkType.h:93
vtkPointSet::GetNumberOfPoints
vtkIdType GetNumberOfPoints() override
See vtkDataSet for additional information.
Definition: vtkPointSet.h:164