VTK  9.1.0
vtkVoxel.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkVoxel.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 =========================================================================*/
77 #ifndef vtkVoxel_h
78 #define vtkVoxel_h
79 
80 #include "vtkCell3D.h"
81 #include "vtkCommonDataModelModule.h" // For export macro
82 
83 class vtkLine;
84 class vtkPixel;
86 
87 class VTKCOMMONDATAMODEL_EXPORT vtkVoxel : public vtkCell3D
88 {
89 public:
90  static vtkVoxel* New();
91  vtkTypeMacro(vtkVoxel, vtkCell3D);
92  void PrintSelf(ostream& os, vtkIndent indent) override;
93 
95 
100  void GetEdgePoints(vtkIdType edgeId, const vtkIdType*& pts) override;
101  // @deprecated Replaced by GetEdgePoints(vtkIdType, const vtkIdType*&) as of VTK 9.0
102  VTK_DEPRECATED_IN_9_0_0("Replaced by vtkVoxel::GetEdgePoints(vtkIdType, const vtkIdType*&)")
103  void GetEdgePoints(int edgeId, int*& pts) override;
104  vtkIdType GetFacePoints(vtkIdType faceId, const vtkIdType*& pts) override;
105  // @deprecated Replaced by GetFacePoints(vtkIdType, const vtkIdType*&) as of VTK 9.0
106  VTK_DEPRECATED_IN_9_0_0("Replaced by vtkVoxel::GetFacePoints(vtkIdType, const vtkIdType*&)")
107  void GetFacePoints(int faceId, int*& pts) override;
108  void GetEdgeToAdjacentFaces(vtkIdType edgeId, const vtkIdType*& pts) override;
109  vtkIdType GetFaceToAdjacentFaces(vtkIdType faceId, const vtkIdType*& faces) override;
110  vtkIdType GetPointToIncidentEdges(vtkIdType pointId, const vtkIdType*& edges) override;
111  vtkIdType GetPointToIncidentFaces(vtkIdType pointId, const vtkIdType*& faces) override;
112  vtkIdType GetPointToOneRingPoints(vtkIdType pointId, const vtkIdType*& pts) override;
113  double* GetParametricCoords() override;
114  bool GetCentroid(double centroid[3]) const override;
115  bool IsInsideOut() override;
117 
121  double ComputeBoundingSphere(double center[3]) const override;
122 
126  static constexpr vtkIdType NumberOfPoints = 8;
127 
131  static constexpr vtkIdType NumberOfEdges = 12;
132 
136  static constexpr vtkIdType NumberOfFaces = 6;
137 
142  static constexpr vtkIdType MaximumFaceSize = 4;
143 
149  static constexpr vtkIdType MaximumValence = 3;
150 
152 
155  int GetCellType() override { return VTK_VOXEL; }
156  int GetCellDimension() override { return 3; }
157  int GetNumberOfEdges() override { return 12; }
158  int GetNumberOfFaces() override { return 6; }
159  vtkCell* GetEdge(int edgeId) override;
160  vtkCell* GetFace(int faceId) override;
161  int CellBoundary(int subId, const double pcoords[3], vtkIdList* pts) override;
162  void Contour(double value, vtkDataArray* cellScalars, vtkIncrementalPointLocator* locator,
163  vtkCellArray* verts, vtkCellArray* lines, vtkCellArray* polys, vtkPointData* inPd,
164  vtkPointData* outPd, vtkCellData* inCd, vtkIdType cellId, vtkCellData* outCd) override;
165  int EvaluatePosition(const double x[3], double closestPoint[3], int& subId, double pcoords[3],
166  double& dist2, double weights[]) override;
167  void EvaluateLocation(int& subId, const double pcoords[3], double x[3], double* weights) override;
168  int IntersectWithLine(const double p1[3], const double p2[3], double tol, double& t, double x[3],
169  double pcoords[3], int& subId) override;
170  int Triangulate(int index, vtkIdList* ptIds, vtkPoints* pts) override;
172  int subId, const double pcoords[3], const double* values, int dim, double* derivs) override;
174 
183  int Inflate(double dist) override;
184 
185  static void InterpolationDerivs(const double pcoords[3], double derivs[24]);
187 
191  void InterpolateFunctions(const double pcoords[3], double weights[8]) override
192  {
193  vtkVoxel::InterpolationFunctions(pcoords, weights);
194  }
195  void InterpolateDerivs(const double pcoords[3], double derivs[24]) override
196  {
197  vtkVoxel::InterpolationDerivs(pcoords, derivs);
198  }
200 
206  static void InterpolationFunctions(const double pcoords[3], double weights[8]);
207 
215  static int* GetTriangleCases(int caseId);
216 
218 
226  static const vtkIdType* GetEdgeArray(vtkIdType edgeId) VTK_SIZEHINT(2);
227  static const vtkIdType* GetFaceArray(vtkIdType faceId) VTK_SIZEHINT(4);
229 
234 
239 
244 
249 
254 
258  static bool ComputeCentroid(vtkPoints* points, const vtkIdType* pointIds, double centroid[3]);
259 
260 protected:
262  ~vtkVoxel() override;
263 
264 private:
265  vtkVoxel(const vtkVoxel&) = delete;
266  void operator=(const vtkVoxel&) = delete;
267 
268  vtkLine* Line;
269  vtkPixel* Pixel;
270 };
271 
272 #endif
abstract class to specify 3D cell interface
Definition: vtkCell3D.h:40
object to represent cell connectivity
Definition: vtkCellArray.h:290
represent and manipulate cell attribute data
Definition: vtkCellData.h:142
abstract class to specify cell behavior
Definition: vtkCell.h:147
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
list of point or cell ids
Definition: vtkIdList.h:140
Abstract class in support of both point location and point insertion.
a simple class to control print indentation
Definition: vtkIndent.h:113
cell represents a 1D line
Definition: vtkLine.h:140
a cell that represents an orthogonal quadrilateral
Definition: vtkPixel.h:74
represent and manipulate point attribute data
Definition: vtkPointData.h:142
represent and manipulate 3D points
Definition: vtkPoints.h:143
a cell that represents a 3D orthogonal parallelepiped
Definition: vtkVoxel.h:88
int EvaluatePosition(const double x[3], double closestPoint[3], int &subId, double pcoords[3], double &dist2, double weights[]) override
See the vtkCell API for descriptions of these methods.
static const vtkIdType * GetFaceToAdjacentFacesArray(vtkIdType faceId)
Static method version of GetFaceToAdjacentFaces.
static const vtkIdType * GetPointToIncidentFacesArray(vtkIdType pointId)
Static method version of GetPointToIncidentFacesArray.
int Inflate(double dist) override
Inflates voxel by moving every faces by dist.
static void InterpolationFunctions(const double pcoords[3], double weights[8])
Compute the interpolation functions.
static const vtkIdType * GetEdgeArray(vtkIdType edgeId)
Return the ids of the vertices defining edge/face (edgeId/‘faceId’).
void GetEdgePoints(vtkIdType edgeId, const vtkIdType *&pts) override
See vtkCell3D API for description of these methods.
int GetNumberOfEdges() override
See the vtkCell API for descriptions of these methods.
Definition: vtkVoxel.h:157
static bool ComputeCentroid(vtkPoints *points, const vtkIdType *pointIds, double centroid[3])
Static method version of GetCentroid.
vtkCell * GetFace(int faceId) override
See the vtkCell API for descriptions of these methods.
static const vtkIdType * GetEdgeToAdjacentFacesArray(vtkIdType edgeId)
Static method version of GetEdgeToAdjacentFaces.
static vtkVoxel * New()
int GetNumberOfFaces() override
See the vtkCell API for descriptions of these methods.
Definition: vtkVoxel.h:158
void InterpolateFunctions(const double pcoords[3], double weights[8]) override
Compute the interpolation functions/derivatives (aka shape functions/derivatives)
Definition: vtkVoxel.h:191
static void InterpolationDerivs(const double pcoords[3], double derivs[24])
vtkCell * GetEdge(int edgeId) override
See the vtkCell API for descriptions of these methods.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static const vtkIdType * GetPointToIncidentEdgesArray(vtkIdType pointId)
Static method version of GetPointToIncidentEdgesArray.
static const vtkIdType * GetPointToOneRingPointsArray(vtkIdType pointId)
Static method version of GetPointToOneRingPoints.
void EvaluateLocation(int &subId, const double pcoords[3], double x[3], double *weights) override
See the vtkCell API for descriptions of these methods.
int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) override
See the vtkCell API for descriptions of these methods.
int CellBoundary(int subId, const double pcoords[3], vtkIdList *pts) override
See the vtkCell API for descriptions of these methods.
static int * GetTriangleCases(int caseId)
Return the case table for table-based isocontouring (aka marching cubes style implementations).
void InterpolateDerivs(const double pcoords[3], double derivs[24]) override
Compute the interpolation functions/derivatives (aka shape functions/derivatives)
Definition: vtkVoxel.h:195
~vtkVoxel() override
void Derivatives(int subId, const double pcoords[3], const double *values, int dim, double *derivs) override
See the vtkCell API for descriptions of these methods.
int GetCellDimension() override
See the vtkCell API for descriptions of these methods.
Definition: vtkVoxel.h:156
void Contour(double value, vtkDataArray *cellScalars, vtkIncrementalPointLocator *locator, vtkCellArray *verts, vtkCellArray *lines, vtkCellArray *polys, vtkPointData *inPd, vtkPointData *outPd, vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd) override
See the vtkCell API for descriptions of these methods.
static const vtkIdType * GetFaceArray(vtkIdType faceId)
Return the ids of the vertices defining edge/face (edgeId/‘faceId’).
int IntersectWithLine(const double p1[3], const double p2[3], double tol, double &t, double x[3], double pcoords[3], int &subId) override
See the vtkCell API for descriptions of these methods.
int GetCellType(const Ioss::ElementTopology *topology)
Returns VTK celltype for a Ioss topology element.
@ points
Definition: vtkX3D.h:452
@ value
Definition: vtkX3D.h:226
@ center
Definition: vtkX3D.h:236
@ index
Definition: vtkX3D.h:252
std::pair< boost::graph_traits< vtkGraph * >::edge_iterator, boost::graph_traits< vtkGraph * >::edge_iterator > edges(vtkGraph *g)
@ VTK_VOXEL
Definition: vtkCellType.h:96
#define VTK_DEPRECATED_IN_9_0_0(reason)
int vtkIdType
Definition: vtkType.h:332
#define VTK_SIZEHINT(...)