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 "vtkNonLinearCell.h"
45 
46 class vtkQuadraticEdge;
47 class vtkQuadraticQuad;
49 class vtkTetra;
50 class vtkPyramid;
51 class vtkDoubleArray;
52 
54 {
55 public:
56  static vtkQuadraticPyramid *New();
58  void PrintSelf(ostream& os, vtkIndent indent);
59 
61 
64  int GetCellDimension() {return 3;}
65  int GetNumberOfEdges() {return 8;}
66  int GetNumberOfFaces() {return 5;}
67  vtkCell *GetEdge(int edgeId);
68  vtkCell *GetFace(int faceId);
70 
71  int CellBoundary(int subId, double pcoords[3], vtkIdList *pts);
72  void Contour(double value, vtkDataArray *cellScalars,
74  vtkCellArray *lines, vtkCellArray *polys,
75  vtkPointData *inPd, vtkPointData *outPd,
76  vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd);
77  int EvaluatePosition(double x[3], double* closestPoint,
78  int& subId, double pcoords[3],
79  double& dist2, double *weights);
80  void EvaluateLocation(int& subId, double pcoords[3], double x[3],
81  double *weights);
82  int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts);
83  void Derivatives(int subId, double pcoords[3], double *values,
84  int dim, double *derivs);
85  virtual double *GetParametricCoords();
86 
88 
91  void Clip(double value, vtkDataArray *cellScalars,
93  vtkPointData *inPd, vtkPointData *outPd,
94  vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
95  int insideOut);
97 
99 
101  int IntersectWithLine(double p1[3], double p2[3], double tol, double& t,
102  double x[3], double pcoords[3], int& subId);
104 
105 
107  int GetParametricCenter(double pcoords[3]);
108 
110 
112  static void InterpolationFunctions(double pcoords[3], double weights[13]);
113  // Description:
114  // @deprecated Replaced by vtkQuadraticPyramid::InterpolateDerivs as of VTK 5.2
115  static void InterpolationDerivs(double pcoords[3], double derivs[39]);
116  // Description:
117  // Compute the interpolation functions/derivatives
118  // (aka shape functions/derivatives)
119  virtual void InterpolateFunctions(double pcoords[3], double weights[13])
120  {
122  }
123  virtual void InterpolateDerivs(double pcoords[3], double derivs[39])
124  {
126  }
127  // Description:
128  // Return the ids of the vertices defining edge/face (`edgeId`/`faceId').
129  // Ids are related to the cell, not to the dataset.
130  static int *GetEdgeArray(int edgeId);
131  static int *GetFaceArray(int faceId);
133 
137  void JacobianInverse(double pcoords[3], double **inverse, double derivs[39]);
138 
139 protected:
142 
151  vtkDoubleArray *Scalars; //used to avoid New/Delete in contouring/clipping
152 
153  void Subdivide(vtkPointData *inPd, vtkCellData *inCd, vtkIdType cellId,
154  vtkDataArray *cellScalars);
155 
156 private:
157  vtkQuadraticPyramid(const vtkQuadraticPyramid&); // Not implemented.
158  void operator=(const vtkQuadraticPyramid&); // Not implemented.
159 };
160 //----------------------------------------------------------------------------
161 // Return the center of the quadratic pyramid in parametric coordinates.
162 //
163 inline int vtkQuadraticPyramid::GetParametricCenter(double pcoords[3])
164 {
165  pcoords[0] = pcoords[1] = 6./13;
166  pcoords[2] = 3./13;
167  return 0;
168 }
169 
170 
171 #endif