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 =========================================================================*/
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;
60 class vtkVertex;
61 
63 {
64 public:
65  static vtkStructuredGrid *New();
66 
68  void PrintSelf(ostream& os, vtkIndent indent);
69 
72 
75  void CopyStructure(vtkDataSet *ds);
76 
78 
80  double *GetPoint(vtkIdType ptId) {return this->vtkPointSet::GetPoint(ptId);}
81  void GetPoint(vtkIdType ptId, double p[3])
82  {this->vtkPointSet::GetPoint(ptId,p);}
83  vtkCell *GetCell(vtkIdType cellId);
84  void GetCell(vtkIdType cellId, vtkGenericCell *cell);
85  void GetCellBounds(vtkIdType cellId, double bounds[6]);
86  int GetCellType(vtkIdType cellId);
88  void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds);
89  void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
90  {
91  vtkStructuredData::GetPointCells(ptId,cellIds,this->GetDimensions());
92  }
93  void Initialize();
94  int GetMaxCellSize() {return 8;}; //hexahedron is the largest
95  void GetCellNeighbors(vtkIdType cellId, vtkIdList *ptIds,
96  vtkIdList *cellIds);
98 
100 
101  void SetDimensions(int i, int j, int k);
102  void SetDimensions(int dim[3]);
104 
106 
107  virtual int *GetDimensions ();
108  virtual void GetDimensions (int dim[3]);
110 
112  int GetDataDimension();
113 
115 
118  void SetExtent(int extent[6]);
119  void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
120  vtkGetVector6Macro(Extent, int);
122 
128  unsigned long GetActualMemorySize();
129 
131 
132  void ShallowCopy(vtkDataObject *src);
133  void DeepCopy(vtkDataObject *src);
135 
137  int GetExtentType() { return VTK_3D_EXTENT; }
138 
140 
144  void BlankPoint(vtkIdType ptId);
145  void UnBlankPoint(vtkIdType ptId);
147 
149 
153  void BlankCell(vtkIdType ptId);
154  void UnBlankCell(vtkIdType ptId);
156 
159  unsigned char IsPointVisible(vtkIdType ptId);
160 
163  unsigned char IsCellVisible(vtkIdType cellId);
164 
167  virtual bool HasAnyBlankPoints();
170  virtual bool HasAnyBlankCells();
171 
176  void GetCellDims( int cellDims[3] );
177 
181  virtual void Crop(const int* updateExtent);
182 
183  //BTX
185 
187  static vtkStructuredGrid* GetData(vtkInformationVector* v, int i=0);
188  //ETX
190 
197  void GetPoint(int i, int j, int k, double p[3], bool adjustForExtent = true);
198 
199 protected:
202 
203  // for the GetCell method
209 
210  int Dimensions[3];
212 
213  int Extent[6];
214 
217  virtual void ComputeScalarRange();
218 
219 private:
221 
222  void GetCellNeighbors(vtkIdType cellId, vtkIdList& ptIds, vtkIdList& cellIds)
223  {this->GetCellNeighbors(cellId, &ptIds, &cellIds);}
225 
226  // Internal method used by DeepCopy and ShallowCopy.
227  void InternalStructuredGridCopy(vtkStructuredGrid *src);
228 
229  static unsigned char MASKED_CELL_VALUE;
230 
231 private:
232  vtkStructuredGrid(const vtkStructuredGrid&); // Not implemented.
233  void operator=(const vtkStructuredGrid&); // Not implemented.
234 };
235 
236 
238 {
239  int nCells=1;
240  int dims[3];
241  int i;
242 
243  this->GetDimensions(dims);
244  for (i=0; i<3; i++)
245  {
246  if (dims[i] <= 0)
247  {
248  return 0;
249  }
250  if (dims[i] > 1)
251  {
252  nCells *= (dims[i]-1);
253  }
254  }
255 
256  return nCells;
257 }
258 
260 {
262 }
263 
264 #endif
265 
266 
267 
268 
269 
270 
virtual vtkIdType GetNumberOfCells()=0
vtkEmptyCell * EmptyCell
static vtkDataObject * New()
virtual void ComputeScalarRange()
Store vtkAlgorithm input/output information.
vtkIdType GetNumberOfPoints()
Definition: vtkPointSet.h:134
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
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:44
void Initialize()
unsigned long GetActualMemorySize()
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:31
int vtkIdType
Definition: vtkType.h:275
virtual bool HasAnyBlankCells()
Definition: vtkDataSet.h:341
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:61
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual bool HasAnyBlankPoints()
Definition: vtkDataSet.h:349
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds)
list of point or cell ids
Definition: vtkIdList.h:35
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
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.
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:59