VTK  9.0.20210126
vtkTetra.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTetra.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 =========================================================================*/
30 #ifndef vtkTetra_h
31 #define vtkTetra_h
32 
33 #include "vtkCell3D.h"
34 #include "vtkCommonDataModelModule.h" // For export macro
35 
36 class vtkLine;
37 class vtkTriangle;
40 
41 class VTKCOMMONDATAMODEL_EXPORT vtkTetra : public vtkCell3D
42 {
43 public:
44  static vtkTetra* New();
45  vtkTypeMacro(vtkTetra, vtkCell3D);
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
49 
52  void GetEdgePoints(vtkIdType edgeId, const vtkIdType*& pts) override;
53  // @deprecated Replaced by GetEdgePoints(vtkIdType, const vtkIdType*&) as of VTK 9.0
54  VTK_DEPRECATED_IN_9_0_0("Replaced by vtkTetra::GetEdgePoints(vtkIdType, const vtkIdType*&)")
55  void GetEdgePoints(int edgeId, int*& pts) override;
56  vtkIdType GetFacePoints(vtkIdType faceId, const vtkIdType*& pts) override;
57  // @deprecated Replaced by GetFacePoints(vtkIdType, const vtkIdType*&) as of VTK 9.0
58  VTK_DEPRECATED_IN_9_0_0("Replaced by vtkTetra::GetFacePoints(vtkIdType, const vtkIdType*&)")
59  void GetFacePoints(int faceId, int*& pts) override;
60  void GetEdgeToAdjacentFaces(vtkIdType edgeId, const vtkIdType*& pts) override;
61  vtkIdType GetFaceToAdjacentFaces(vtkIdType faceId, const vtkIdType*& faceIds) override;
62  vtkIdType GetPointToIncidentEdges(vtkIdType pointId, const vtkIdType*& edgeIds) override;
63  vtkIdType GetPointToIncidentFaces(vtkIdType pointId, const vtkIdType*& faceIds) override;
64  vtkIdType GetPointToOneRingPoints(vtkIdType pointId, const vtkIdType*& pts) override;
65  bool GetCentroid(double centroid[3]) const override;
66  bool IsInsideOut() override;
68 
72  static constexpr vtkIdType NumberOfPoints = 4;
73 
77  static constexpr vtkIdType NumberOfEdges = 6;
78 
82  static constexpr vtkIdType NumberOfFaces = 4;
83 
88  static constexpr vtkIdType MaximumFaceSize = 3;
89 
95  static constexpr vtkIdType MaximumValence = 3;
96 
98 
101  int GetCellType() override { return VTK_TETRA; }
102  int GetNumberOfEdges() override { return 6; }
103  int GetNumberOfFaces() override { return 4; }
104  vtkCell* GetEdge(int edgeId) override;
105  vtkCell* GetFace(int faceId) override;
106  void Contour(double value, vtkDataArray* cellScalars, vtkIncrementalPointLocator* locator,
107  vtkCellArray* verts, vtkCellArray* lines, vtkCellArray* polys, vtkPointData* inPd,
108  vtkPointData* outPd, vtkCellData* inCd, vtkIdType cellId, vtkCellData* outCd) override;
109  void Clip(double value, vtkDataArray* cellScalars, vtkIncrementalPointLocator* locator,
110  vtkCellArray* connectivity, vtkPointData* inPd, vtkPointData* outPd, vtkCellData* inCd,
111  vtkIdType cellId, vtkCellData* outCd, int insideOut) override;
112  int EvaluatePosition(const double x[3], double closestPoint[3], int& subId, double pcoords[3],
113  double& dist2, double weights[]) override;
114  void EvaluateLocation(int& subId, const double pcoords[3], double x[3], double* weights) override;
115  int IntersectWithLine(const double p1[3], const double p2[3], double tol, double& t, double x[3],
116  double pcoords[3], int& subId) override;
117  int Triangulate(int index, vtkIdList* ptIds, vtkPoints* pts) override;
118  void Derivatives(
119  int subId, const double pcoords[3], const double* values, int dim, double* derivs) override;
120  double* GetParametricCoords() override;
122 
130  static int* GetTriangleCases(int caseId);
131 
137  int CellBoundary(int subId, const double pcoords[3], vtkIdList* pts) override;
138 
142  int GetParametricCenter(double pcoords[3]) override;
143 
148  double GetParametricDistance(const double pcoords[3]) override;
149 
153  static void TetraCenter(double p1[3], double p2[3], double p3[3], double p4[3], double center[3]);
154 
160  static double Circumsphere(
161  double x1[3], double x2[3], double x3[3], double x4[3], double center[3]);
162 
168  static double Insphere(double p1[3], double p2[3], double p3[3], double p4[3], double center[3]);
169 
182  static int BarycentricCoords(
183  double x[3], double x1[3], double x2[3], double x3[3], double x4[3], double bcoords[4]);
184 
189  static double ComputeVolume(double p1[3], double p2[3], double p3[3], double p4[3]);
190 
196  int JacobianInverse(double** inverse, double derivs[12]);
197 
198  static void InterpolationFunctions(const double pcoords[3], double weights[4]);
199  static void InterpolationDerivs(const double pcoords[3], double derivs[12]);
201 
205  void InterpolateFunctions(const double pcoords[3], double weights[4]) override
206  {
207  vtkTetra::InterpolationFunctions(pcoords, weights);
208  }
209  void InterpolateDerivs(const double pcoords[3], double derivs[12]) override
210  {
211  vtkTetra::InterpolationDerivs(pcoords, derivs);
212  }
214 
216 
224  static const vtkIdType* GetEdgeArray(vtkIdType edgeId) VTK_SIZEHINT(2);
225  static const vtkIdType* GetFaceArray(vtkIdType faceId) VTK_SIZEHINT(3);
227 
231  static const vtkIdType* GetEdgeToAdjacentFacesArray(vtkIdType edgeId) VTK_SIZEHINT(2);
232 
236  static const vtkIdType* GetFaceToAdjacentFacesArray(vtkIdType faceId) VTK_SIZEHINT(3);
237 
241  static const vtkIdType* GetPointToIncidentEdgesArray(vtkIdType pointId) VTK_SIZEHINT(3);
242 
246  static const vtkIdType* GetPointToIncidentFacesArray(vtkIdType pointId) VTK_SIZEHINT(3);
247 
251  static const vtkIdType* GetPointToOneRingPointsArray(vtkIdType pointId) VTK_SIZEHINT(3);
252 
256  static bool ComputeCentroid(vtkPoints* points, const vtkIdType* pointIds, double centroid[3]);
257 
258 protected:
259  vtkTetra();
260  ~vtkTetra() override;
261 
264 
265 private:
266  vtkTetra(const vtkTetra&) = delete;
267  void operator=(const vtkTetra&) = delete;
268 };
269 
270 inline int vtkTetra::GetParametricCenter(double pcoords[3])
271 {
272  pcoords[0] = pcoords[1] = pcoords[2] = 0.25;
273  return 0;
274 }
275 
276 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkCell::IntersectWithLine
virtual int IntersectWithLine(const double p1[3], const double p2[3], double tol, double &t, double x[3], double pcoords[3], int &subId)=0
Intersect with a ray.
vtkTetra::InterpolationDerivs
static void InterpolationDerivs(const double pcoords[3], double derivs[12])
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:32
vtkX3D::value
Definition: vtkX3D.h:226
vtkIdType
int vtkIdType
Definition: vtkType.h:330
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkIossUtilities::GetCellType
int GetCellType(const Ioss::ElementTopology *topology)
Returns VTK celltype for a Ioss topology element.
vtkTetra::InterpolateDerivs
void InterpolateDerivs(const double pcoords[3], double derivs[12]) override
Definition: vtkTetra.h:209
vtkX3D::center
Definition: vtkX3D.h:236
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
vtkCell3D.h
vtkCell::EvaluateLocation
virtual void EvaluateLocation(int &subId, const double pcoords[3], double x[3], double *weights)=0
Determine global coordinate (x[3]) from subId and parametric coordinates.
vtkLine
cell represents a 1D line
Definition: vtkLine.h:30
vtkCell3D::GetEdgePoints
virtual void GetEdgePoints(vtkIdType edgeId, const vtkIdType *&pts)=0
Get the pair of vertices that define an edge.
vtkCell3D
abstract class to specify 3D cell interface
Definition: vtkCell3D.h:39
vtkX3D::points
Definition: vtkX3D.h:452
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:45
vtkCell::Triangulate
virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts)=0
Generate simplices of proper dimension.
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:57
vtkTetra::InterpolateFunctions
void InterpolateFunctions(const double pcoords[3], double weights[4]) override
Compute the interpolation functions/derivatives (aka shape functions/derivatives)
Definition: vtkTetra.h:205
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:32
vtkCell::GetFace
virtual vtkCell * GetFace(int faceId)=0
Return the face cell from the faceId of the cell.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:180
VTK_DEPRECATED_IN_9_0_0
#define VTK_DEPRECATED_IN_9_0_0(reason)
Definition: vtkDeprecation.h:83
vtkIncrementalPointLocator
Abstract class in support of both point location and point insertion.
Definition: vtkIncrementalPointLocator.h:51
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:30
vtkTetra::GetNumberOfFaces
int GetNumberOfFaces() override
Return the number of faces in the cell.
Definition: vtkTetra.h:103
VTK_TETRA
Definition: vtkCellType.h:56
vtkCell3D::Contour
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
Generate contouring primitives.
vtkCell3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTriangle
a cell that represents a triangle
Definition: vtkTriangle.h:35
vtkTetra::GetNumberOfEdges
int GetNumberOfEdges() override
Return the number of edges in the cell.
Definition: vtkTetra.h:102
vtkTetra::InterpolationFunctions
static void InterpolationFunctions(const double pcoords[3], double weights[4])
vtkCell::CellBoundary
virtual int CellBoundary(int subId, const double pcoords[3], vtkIdList *pts)=0
Given parametric coordinates of a point, return the closest cell boundary, and whether the point is i...
vtkCell::GetParametricDistance
virtual double GetParametricDistance(const double pcoords[3])
Return the distance of the parametric coordinate provided to the cell.
vtkCell::EvaluatePosition
virtual int EvaluatePosition(const double x[3], double closestPoint[3], int &subId, double pcoords[3], double &dist2, double weights[])=0
Given a point x[3] return inside(=1), outside(=0) cell, or (-1) computational problem encountered; ev...
vtkCell::GetParametricCoords
virtual double * GetParametricCoords())
Return a contiguous array of parametric coordinates of the points defining this cell.
vtkCell::GetEdge
virtual vtkCell * GetEdge(int edgeId)=0
Return the edge cell from the edgeId of the cell.
vtkTetra::GetParametricCenter
int GetParametricCenter(double pcoords[3]) override
Return the center of the tetrahedron in parametric coordinates.
Definition: vtkTetra.h:270
vtkTetra::Line
vtkLine * Line
Definition: vtkTetra.h:262
vtkTetra::Triangle
vtkTriangle * Triangle
Definition: vtkTetra.h:263
vtkCell::Derivatives
virtual void Derivatives(int subId, const double pcoords[3], const double *values, int dim, double *derivs)=0
Compute derivatives given cell subId and parametric coordinates.
vtkCell::GetParametricCenter
virtual int GetParametricCenter(double pcoords[3])
Return center of the cell in parametric coordinates.
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:93
vtkTetra
a 3D cell that represents a tetrahedron
Definition: vtkTetra.h:41
vtkCell3D::Clip
void Clip(double value, vtkDataArray *cellScalars, vtkIncrementalPointLocator *locator, vtkCellArray *connectivity, vtkPointData *inPd, vtkPointData *outPd, vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd, int insideOut) override
Cut (or clip) the cell based on the input cellScalars and the specified value.
vtkX3D::index
Definition: vtkX3D.h:252