VTK
vtkLagrangeInterpolation.h
Go to the documentation of this file.
1 #ifndef vtkLagrangeInterpolation_h
2 #define vtkLagrangeInterpolation_h
3 
4 #include "vtkObject.h"
5 #include "vtkSmartPointer.h" // For API.
6 #include "vtkCommonDataModelModule.h" // For export macro.
7 
8 #include <vector> // For scratch storage.
9 
10 // Define this to include support for a "complete" (21- vs 18-point) wedge.
11 #define VTK_21_POINT_WEDGE true
12 
13 class vtkPoints;
14 class vtkVector2i;
15 class vtkVector3d;
16 
17 class VTKCOMMONDATAMODEL_EXPORT vtkLagrangeInterpolation : public vtkObject
18 {
19 public:
20  static vtkLagrangeInterpolation* New();
21  void PrintSelf(ostream& os, vtkIndent indent) override;
23 
24  enum Constants {
25  MaxDegree = 10 // The maximum degree that VTK will support.
26  };
27 
28  static void EvaluateShapeFunctions(int order, double pcoord, double* shape);
29  static void EvaluateShapeAndGradient(int order, double pcoord, double* shape, double* grad);
30 
31  static int Tensor1ShapeFunctions(const int order[1], const double* pcoords, double* shape);
32  static int Tensor1ShapeDerivatives(const int order[1], const double* pcoords, double* derivs);
33 
34  static int Tensor2ShapeFunctions(const int order[2], const double* pcoords, double* shape);
35  static int Tensor2ShapeDerivatives(const int order[2], const double* pcoords, double* derivs);
36 
37  static int Tensor3ShapeFunctions(const int order[3], const double* pcoords, double* shape);
38  static int Tensor3ShapeDerivatives(const int order[3], const double* pcoords, double* derivs);
39 
40  void Tensor3EvaluateDerivative(
41  const int order[4],
42  const double* pcoords,
43  double* fieldVals,
44  int fieldDim,
45  double* fieldDerivs);
46 
47  static void WedgeShapeFunctions(const int order[4], const double* pcoords, double* shape);
48  static void WedgeShapeDerivatives(const int order[4], const double* pcoords, double* derivs);
49 
50  void WedgeEvaluate(
51  const int order[4],
52  const double* pcoords,
53  double* fieldVals,
54  int fieldDim,
55  double* fieldAtPCoords);
56 
57  void WedgeEvaluateDerivative(
58  const int order[4],
59  const double* pcoords,
60  double* fieldVals,
61  int fieldDim,
62  double* fieldDerivs);
63 
64  static vtkVector3d GetParametricHexCoordinates(int vertexId);
65  static vtkVector2i GetPointIndicesBoundingHexEdge(int edgeId);
66  static int GetVaryingParameterOfHexEdge(int edgeId);
67  static vtkVector2i GetFixedParametersOfHexEdge(int edgeId);
68 
69  static const int* GetPointIndicesBoundingHexFace(int faceId) VTK_SIZEHINT(4);
70  static const int* GetEdgeIndicesBoundingHexFace(int faceId) VTK_SIZEHINT(4);
71  static vtkVector2i GetVaryingParametersOfHexFace(int faceId);
72  static int GetFixedParameterOfHexFace(int faceId);
73 
74  static vtkVector3d GetParametricWedgeCoordinates(int vertexId);
75  static vtkVector2i GetPointIndicesBoundingWedgeEdge(int edgeId);
76  static int GetVaryingParameterOfWedgeEdge(int edgeId);
77  static vtkVector2i GetFixedParametersOfWedgeEdge(int edgeId);
78 
79  static const int* GetPointIndicesBoundingWedgeFace(int faceId) VTK_SIZEHINT(4);
80  static const int* GetEdgeIndicesBoundingWedgeFace(int faceId) VTK_SIZEHINT(4);
81  static vtkVector2i GetVaryingParametersOfWedgeFace(int faceId);
82  static int GetFixedParameterOfWedgeFace(int faceId);
83 
84  static void AppendCurveCollocationPoints(vtkSmartPointer<vtkPoints>& pts, const int order[1]);
85  static void AppendQuadrilateralCollocationPoints(vtkSmartPointer<vtkPoints>& pts, const int order[2]);
86  static void AppendHexahedronCollocationPoints(vtkSmartPointer<vtkPoints>& pts, const int order[3]);
87  static void AppendWedgeCollocationPoints(vtkSmartPointer<vtkPoints>& pts, const int order[3]);
88 
89  template<int N>
90  static int NumberOfIntervals(const int order[N]);
91 protected:
93  ~vtkLagrangeInterpolation() override;
94 
95  void PrepareForOrder(const int o[4]);
96 
97  std::vector<double> ShapeSpace;
98  std::vector<double> DerivSpace;
99 
100 private:
102  void operator=(const vtkLagrangeInterpolation&) = delete;
103 };
104 
105 template<int N>
107 {
108  int ni = 1;
109  for (int n = 0; n < N; ++n)
110  {
111  ni *= order[n];
112  }
113  return ni;
114 }
115 
116 #endif // vtkLagrangeInterpolation_h
abstract base class for most VTK objects
Definition: vtkObject.h:53
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static int NumberOfIntervals(const int order[N])
a simple class to control print indentation
Definition: vtkIndent.h:33
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:405
std::vector< double > DerivSpace
#define VTK_SIZEHINT(...)
std::vector< double > ShapeSpace
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
represent and manipulate 3D points
Definition: vtkPoints.h:33