VTK  9.3.1
vtkUniformGrid.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
17 #ifndef vtkUniformGrid_h
18 #define vtkUniformGrid_h
19 
20 #include "vtkCommonDataModelModule.h" // For export macro
21 #include "vtkImageData.h"
22 
23 VTK_ABI_NAMESPACE_BEGIN
24 class vtkEmptyCell;
25 class vtkStructuredVisibilityConstraint;
27 class vtkAMRBox;
28 
29 class VTKCOMMONDATAMODEL_EXPORT vtkUniformGrid : public vtkImageData
30 {
31 public:
33 
36  static vtkUniformGrid* New();
37  vtkTypeMacro(vtkUniformGrid, vtkImageData);
38  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
45  void CopyStructure(vtkDataSet* ds) override;
46 
50  int GetDataObjectType() override { return VTK_UNIFORM_GRID; }
51 
53 
56  vtkCell* GetCell(int i, int j, int k) override;
57  vtkCell* GetCell(vtkIdType cellId) override;
58  void GetCell(vtkIdType cellId, vtkGenericCell* cell) override;
59  vtkIdType FindCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
60  double pcoords[3], double* weights) override;
61  vtkIdType FindCell(double x[3], vtkCell* cell, vtkGenericCell* gencell, vtkIdType cellId,
62  double tol2, int& subId, double pcoords[3], double* weights) override;
63  vtkCell* FindAndGetCell(double x[3], vtkCell* cell, vtkIdType cellId, double tol2, int& subId,
64  double pcoords[3], double* weights) override;
65  int GetCellType(vtkIdType cellId) override;
67  void GetCellPoints(vtkIdType cellId, vtkIdList* ptIds) override
68  {
70  cellId, ptIds, this->GetDataDescription(), this->GetDimensions());
71  }
72  void GetPointCells(vtkIdType ptId, vtkIdList* cellIds) override
73  {
74  vtkStructuredData::GetPointCells(ptId, cellIds, this->GetDimensions());
75  }
76  void Initialize() override;
77  int GetMaxCellSize() override { return 8; } // voxel is the largest
79 
83  int GetGridDescription();
84 
91  int Initialize(const vtkAMRBox* def, double* origin, double* spacing);
99  int Initialize(const vtkAMRBox* def, double* origin, double* spacing, int nGhosts);
100 
108  int Initialize(const vtkAMRBox* def, double* origin, double* spacing, const int nGhosts[3]);
117  int Initialize(const vtkAMRBox* def, double* origin, double* spacing, int nGhostsI, int nGhostsJ,
118  int nGhostsK);
119 
121 
127  virtual void BlankPoint(vtkIdType ptId);
128  virtual void UnBlankPoint(vtkIdType ptId);
129  virtual void BlankPoint(int i, int j, int k);
130  virtual void UnBlankPoint(int i, int j, int k);
132 
134 
140  virtual void BlankCell(vtkIdType ptId);
141  virtual void UnBlankCell(vtkIdType ptId);
142  virtual void BlankCell(int i, int j, int k);
143  virtual void UnBlankCell(int i, int j, int k);
145 
150  bool HasAnyBlankCells() override;
155  bool HasAnyBlankPoints() override;
156 
162  virtual unsigned char IsPointVisible(vtkIdType pointId);
163 
169  virtual unsigned char IsCellVisible(vtkIdType cellId);
170 
171  virtual VTK_NEWINSTANCE vtkImageData* NewImageDataCopy();
172 
174 
178  static vtkUniformGrid* GetData(vtkInformationVector* v, int i = 0);
180 
181 protected:
182  vtkUniformGrid();
183  ~vtkUniformGrid() override;
184 
188  void GetCellDims(int cellDims[3]);
189 
193  void ComputeScalarRange() override;
194 
195  vtkEmptyCell* GetEmptyCell();
196 
197 private:
198  vtkUniformGrid(const vtkUniformGrid&) = delete;
199  void operator=(const vtkUniformGrid&) = delete;
200 
201  vtkEmptyCell* EmptyCell;
202 
203  static unsigned char MASKED_CELL_VALUE;
204 };
205 
206 VTK_ABI_NAMESPACE_END
207 #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:52
Encloses a rectangular region of voxel like cells.
Definition: vtkAMRBox.h:28
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:21
int vtkIdType
Definition: vtkType.h:315
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:49
friend class vtkUniformGrid
Definition: vtkImageData.h:638
int GetCellType(vtkIdType cellId) override
Standard vtkDataSet API methods.
#define VTK_UNIFORM_GRID
Definition: vtkType.h:75
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:28
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:42
list of point or cell ids
Definition: vtkIdList.h:22
virtual void GetCellPoints(vtkIdType cellId, vtkIdList *ptIds)=0
Topological inquiry to get points defining cell.
int GetDataDescription()
Definition: vtkImageData.h:633
#define VTK_NEWINSTANCE
unsigned char IsCellVisible(vtkIdType cellId)
Return non-zero value if specified point is visible.
dynamic, self-adjusting array of unsigned char
image data with blanking
static void GetPointCells(vtkIdType ptId, vtkIdList *cellIds, VTK_FUTURE_CONST int dim[3])
Get the cells using a point.
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.