VTK  9.2.6
vtkUniformGrid.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkUniformGrid.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 =========================================================================*/
29 #ifndef vtkUniformGrid_h
30 #define vtkUniformGrid_h
31 
32 #include "vtkCommonDataModelModule.h" // For export macro
33 #include "vtkImageData.h"
34 
35 class vtkEmptyCell;
36 class vtkStructuredVisibilityConstraint;
38 class vtkAMRBox;
39 
40 class VTKCOMMONDATAMODEL_EXPORT vtkUniformGrid : public vtkImageData
41 {
42 public:
44 
47  static vtkUniformGrid* New();
48  vtkTypeMacro(vtkUniformGrid, vtkImageData);
49  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
56  void CopyStructure(vtkDataSet* ds) override;
57 
61  int GetDataObjectType() override { return VTK_UNIFORM_GRID; }
62 
64 
67  vtkCell* GetCell(int i, int j, int k) override;
68  vtkCell* GetCell(vtkIdType cellId) override;
69  void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
70  vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
71  double pcoords[3], double* weights) override;
72  vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
73  double tol2, int& subId, double pcoords[3], double* weights) override;
74  vtkCell* FindAndGetCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
75  double pcoords[3], double* weights) override;
76  int GetCellType(vtkIdType cellId) override;
78  void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) override
79  {
81  cellId, ptIds, this->GetDataDescription(), this->GetDimensions());
82  }
83  void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override
84  {
85  vtkStructuredData::GetPointCells(ptId, cellIds, this->GetDimensions());
86  }
87  void Initialize() override;
88  int GetMaxCellSize() override { return 8; } // voxel is the largest
90 
94  int GetGridDescription();
95 
102  int Initialize(const vtkAMRBox* def, double* origin, double* spacing);
110  int Initialize(const vtkAMRBox* def, double* origin, double* spacing, int nGhosts);
111 
119  int Initialize(const vtkAMRBox* def, double* origin, double* spacing, const int nGhosts[3]);
128  int Initialize(const vtkAMRBox* def, double* origin, double* spacing, int nGhostsI, int nGhostsJ,
129  int nGhostsK);
130 
132 
138  virtual void BlankPoint(vtkIdType ptId);
139  virtual void UnBlankPoint(vtkIdType ptId);
140  virtual void BlankPoint(const int i, const int j, const int k);
141  virtual void UnBlankPoint(const int i, const int j, const int k);
143 
145 
151  virtual void BlankCell(vtkIdType ptId);
152  virtual void UnBlankCell(vtkIdType ptId);
153  virtual void BlankCell(const int i, const int j, const int k);
154  virtual void UnBlankCell(const int i, const int j, const int k);
156 
161  bool HasAnyBlankCells() override;
166  bool HasAnyBlankPoints() override;
167 
173  virtual unsigned char IsPointVisible(vtkIdType pointId);
174 
180  virtual unsigned char IsCellVisible(vtkIdType cellId);
181 
182  virtual vtkImageData* NewImageDataCopy();
183 
185 
189  static vtkUniformGrid* GetData(vtkInformationVector* v, int i = 0);
191 
192 protected:
193  vtkUniformGrid();
194  ~vtkUniformGrid() override;
195 
199  void GetCellDims(int cellDims[3]);
200 
204  void ComputeScalarRange() override;
205 
206  vtkEmptyCell* GetEmptyCell();
207 
208 private:
209  vtkUniformGrid(const vtkUniformGrid&) = delete;
210  void operator=(const vtkUniformGrid&) = delete;
211 
212  vtkEmptyCell* EmptyCell;
213 
214  static unsigned char MASKED_CELL_VALUE;
215 };
216 
217 #endif
static vtkImageData * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCell * GetCell(vtkIdType cellId) override
Standard vtkDataSet API methods.
static vtkImageData * New()
virtual void ComputeScalarRange()
Compute the range of the scalars and cache it into ScalarRange only if the cache became invalid (Scal...
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
Encloses a rectangular region of voxel like cells.
Definition: vtkAMRBox.h:39
bool HasAnyBlankCells() override
Returns 1 if there is any visibility constraint on the cells, 0 otherwise.
vtkCell * FindAndGetCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights) override
Standard vtkDataSet API methods.
void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds) override
Standard vtkDataSet API methods.
an empty cell used as a place-holder during processing
Definition: vtkEmptyCell.h:32
int vtkIdType
Definition: vtkType.h:332
provides thread-safe access to cells
unsigned char IsPointVisible(vtkIdType ptId)
Return non-zero value if specified point is visible.
int GetMaxCellSize() override
Standard vtkDataSet API methods.
abstract class to specify cell behavior
Definition: vtkCell.h:60
friend class vtkUniformGrid
Definition: vtkImageData.h:650
int GetCellType(vtkIdType cellId) override
Standard vtkDataSet API methods.
#define VTK_UNIFORM_GRID
Definition: vtkType.h:87
vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights) override
Standard vtkDataSet API methods.
virtual int * GetDimensions()
Get dimensions of this structured points dataset.
a simple class to control print indentation
Definition: vtkIndent.h:39
static void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds, int dataDescription, int dim[3])
Get the points defining a cell.
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
list of point or cell ids
Definition: vtkIdList.h:33
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
Topological inquiry to get points defining cell.
int GetDataDescription()
Definition: vtkImageData.h:644
unsigned char IsCellVisible(vtkIdType cellId)
Return non-zero value if specified point is visible.
dynamic, self-adjusting array of unsigned char
static void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, int dim[3])
Get the cells using a point.
image data with blanking
Store zero or more vtkInformation instances.
void GetPointCells(vtkIdType ptId, vtkIdList *cellIds) override
Standard vtkDataSet API methods.
void CopyStructure(vtkDataSet *ds) override
Copy the geometric and topological structure of an input image data object.
void Initialize() override
Restore data object to initial state.
bool HasAnyBlankPoints() override
Returns 1 if there is any visibility constraint on the points, 0 otherwise.
int GetDataObjectType() override
Return what type of dataset this is.
void GetCellDims(int cellDims[3])
Given the node dimensions of this grid instance, this method computes the node dimensions.