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 =========================================================================*/
42 #ifndef vtkStructuredGrid_h
43 #define vtkStructuredGrid_h
44 
45 #include "vtkCommonDataModelModule.h" // For export macro
46 #include "vtkPointSet.h"
47 
48 #include "vtkStructuredData.h" // Needed for inline methods
49 
50 class vtkEmptyCell;
51 class vtkHexahedron;
52 class vtkLine;
53 class vtkQuad;
55 class vtkVertex;
56 
57 class VTKCOMMONDATAMODEL_EXPORT vtkStructuredGrid : public vtkPointSet
58 {
59 public:
60  static vtkStructuredGrid *New();
61 
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
68  int GetDataObjectType() override {return VTK_STRUCTURED_GRID;}
69 
73  void CopyStructure(vtkDataSet *ds) override;
74 
76 
81  double *GetPoint(vtkIdType ptId) VTK_SIZEHINT(3) override
82  {return this->vtkPointSet::GetPoint(ptId);}
83  void GetPoint(vtkIdType ptId, double p[3]) override
84  {this->vtkPointSet::GetPoint(ptId,p);}
85  vtkCell *GetCell(vtkIdType cellId) override;
86  vtkCell *GetCell(int i, int j, int k) override;
87  void GetCell(vtkIdType cellId, vtkGenericCell *cell) override;
88  void GetCellBounds(vtkIdType cellId, double bounds[6]) override;
89  int GetCellType(vtkIdType cellId) override;
90  vtkIdType GetNumberOfCells() override;
91  void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) override;
92  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override
93  {
94  vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());
95  }
96  void Initialize() override;
97  int GetMaxCellSize() override {return 8;}; //hexahedron is the largest
98  void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
99  vtkIdList *cellIds) override;
100  void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
101  vtkIdList *cellIds, int *seedLoc);
103 
105 
108  void SetDimensions(int i, int j, int k);
109  void SetDimensions(int dim[3]);
111 
113 
116  virtual int *GetDimensions () VTK_SIZEHINT(3);
117  virtual void GetDimensions (int dim[3]);
119 
123  int GetDataDimension();
124 
126 
131  void SetExtent(int extent[6]);
132  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
133  vtkGetVector6Macro(Extent, int);
135 
144  unsigned long GetActualMemorySize() override;
145 
147 
150  void ShallowCopy(vtkDataObject *src) override;
151  void DeepCopy(vtkDataObject *src) override;
153 
157  int GetExtentType() override { return VTK_3D_EXTENT; }
158 
160 
166  void BlankPoint(vtkIdType ptId);
167  void UnBlankPoint(vtkIdType ptId);
169 
171 
177  void BlankCell(vtkIdType ptId);
178  void UnBlankCell(vtkIdType ptId);
180 
186  unsigned char IsPointVisible(vtkIdType ptId);
187 
193  unsigned char IsCellVisible(vtkIdType cellId);
194 
199  bool HasAnyBlankPoints() override;
204  bool HasAnyBlankCells() override;
205 
212  void GetCellDims( int cellDims[3] );
213 
219  void Crop(const int* updateExtent) override;
220 
222 
226  static vtkStructuredGrid* GetData(vtkInformationVector* v, int i=0);
228 
238  void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true);
239 
240 protected:
242  ~vtkStructuredGrid() override;
243 
244  // for the GetCell method
250 
251  int Dimensions[3];
253 
254  int Extent[6];
255 
260  void ComputeScalarRange() override;
261 
262 private:
266  void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
267  {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
268 
269  // Internal method used by DeepCopy and ShallowCopy.
270  void InternalStructuredGridCopy(vtkStructuredGrid *src);
271 
272  static unsigned char MASKED_CELL_VALUE;
273 
274 private:
275  vtkStructuredGrid(const vtkStructuredGrid&) = delete;
276  void operator=(const vtkStructuredGrid&) = delete;
277 };
278 
279 
281 {
282  vtkIdType nCells=1;
283  int dims[3];
284  int i;
285 
286  this->GetDimensions(dims);
287  for (i=0; i<3; i++)
288  {
289  if (dims[i] <= 0)
290  {
291  return 0;
292  }
293  if (dims[i] > 1)
294  {
295  nCells *= (dims[i]-1);
296  }
297  }
298 
299  return nCells;
300 }
301 
303 {
305 }
306 
307 #endif
308 
309 
310 
311 
312 
313 
vtkStructuredGrid::GetPointCells
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override
Topological inquiry to get cells using point.
Definition: vtkStructuredGrid.h:92
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:41
vtkStructuredGrid::GetNumberOfPoints
vtkIdType GetNumberOfPoints() override
Standard vtkDataSet API methods.
Definition: vtkStructuredGrid.h:79
vtkPointSet.h
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkStructuredGrid::EmptyCell
vtkEmptyCell * EmptyCell
Definition: vtkStructuredGrid.h:249
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkEmptyCell
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:29
vtkUnsignedCharArray
dynamic, self-adjusting array of unsigned char
Definition: vtkUnsignedCharArray.h:35
vtkStructuredGrid
topologically regular array of data
Definition: vtkStructuredGrid.h:57
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:30
vtkLine
cell represents a 1D line
Definition: vtkLine.h:29
VTK_3D_EXTENT
#define VTK_3D_EXTENT
Definition: vtkDataObject.h:55
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:302
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:56
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:280
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkStructuredGrid::GetMaxCellSize
int GetMaxCellSize() override
Convenience method returns largest cell size in dataset.
Definition: vtkStructuredGrid.h:97
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:30
vtkDataSet::HasAnyBlankCells
virtual bool HasAnyBlankCells()
Returns 1 if there are any blanking cells 0 otherwise.
Definition: vtkDataSet.h:429
vtkPointSet::Initialize
void Initialize() override
Reset to an empty state and free any memory.
vtkStructuredGrid::DataDescription
int DataDescription
Definition: vtkStructuredGrid.h:252
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:60
vtkDataSet::HasAnyBlankPoints
virtual bool HasAnyBlankPoints()
Returns 1 if there are any blanking points 0 otherwise.
Definition: vtkDataSet.h:438
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
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:247
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:83
vtkPointSet
abstract class for specifying dataset behavior
Definition: vtkPointSet.h:39
vtkStructuredGrid::Hexahedron
vtkHexahedron * Hexahedron
Definition: vtkStructuredGrid.h:248
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:36
vtkStructuredGrid::Vertex
vtkVertex * Vertex
Definition: vtkStructuredGrid.h:245
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:68
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:58
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:81
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:35
vtkStructuredGrid::Line
vtkLine * Line
Definition: vtkStructuredGrid.h:246
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:161