VTK
vtkQuadraticPyramid.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQuadraticPyramid.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 =========================================================================*/
41 #ifndef __vtkQuadraticPyramid_h
42 #define __vtkQuadraticPyramid_h
43 
44 #include "vtkCommonDataModelModule.h" // For export macro
45 #include "vtkNonLinearCell.h"
46 
47 class vtkQuadraticEdge;
48 class vtkQuadraticQuad;
50 class vtkTetra;
51 class vtkPyramid;
52 class vtkDoubleArray;
53 
54 class VTKCOMMONDATAMODEL_EXPORT vtkQuadraticPyramid : public vtkNonLinearCell
55 {
56 public:
57  static vtkQuadraticPyramid *New();
59  void PrintSelf(ostream& os, vtkIndent indent);
60 
62 
65  int GetCellDimension() {return 3;}
66  int GetNumberOfEdges() {return 8;}
67  int GetNumberOfFaces() {return 5;}
68  vtkCell *GetEdge(int edgeId);
69  vtkCell *GetFace(int faceId);
71 
72  int CellBoundary(int subId, double pcoords[3], vtkIdList *pts);
73  void Contour(double value, vtkDataArray *cellScalars,
75  vtkCellArray *lines, vtkCellArray *polys,
76  vtkPointData *inPd, vtkPointData *outPd,
77  vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd);
78  int EvaluatePosition(double x[3], double* closestPoint,
79  int& subId, double pcoords[3],
80  double& dist2, double *weights);
81  void EvaluateLocation(int& subId, double pcoords[3], double x[3],
82  double *weights);
83  int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts);
84  void Derivatives(int subId, double pcoords[3], double *values,
85  int dim, double *derivs);
86  virtual double *GetParametricCoords();
87 
89 
92  void Clip(double value, vtkDataArray *cellScalars,
94  vtkPointData *inPd, vtkPointData *outPd,
95  vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
96  int insideOut);
98 
100 
102  int IntersectWithLine(double p1[3], double p2[3], double tol, double& t,
103  double x[3], double pcoords[3], int& subId);
105 
106 
108  int GetParametricCenter(double pcoords[3]);
109 
112  static void InterpolationFunctions(double pcoords[3], double weights[13]);
115  static void InterpolationDerivs(double pcoords[3], double derivs[39]);
117 
119  virtual void InterpolateFunctions(double pcoords[3], double weights[13])
120  {
122  }
123  virtual void InterpolateDerivs(double pcoords[3], double derivs[39])
124  {
126  }
128 
129 
131  static int *GetEdgeArray(int edgeId);
132  static int *GetFaceArray(int faceId);
134 
138  void JacobianInverse(double pcoords[3], double **inverse, double derivs[39]);
139 
140 protected:
143 
152  vtkDoubleArray *Scalars; //used to avoid New/Delete in contouring/clipping
153 
154  void Subdivide(vtkPointData *inPd, vtkCellData *inCd, vtkIdType cellId,
155  vtkDataArray *cellScalars);
156 
157 private:
158  vtkQuadraticPyramid(const vtkQuadraticPyramid&); // Not implemented.
159  void operator=(const vtkQuadraticPyramid&); // Not implemented.
160 };
161 //----------------------------------------------------------------------------
162 // Return the center of the quadratic pyramid in parametric coordinates.
163 //
164 inline int vtkQuadraticPyramid::GetParametricCenter(double pcoords[3])
165 {
166  pcoords[0] = pcoords[1] = 6./13;
167  pcoords[2] = 3./13;
168  return 0;
169 }
170 
171 
172 #endif