VTK  9.3.1
vtkHigherOrderInterpolation.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 // .NAME vtkHigherOrderInterpolation
4 // .SECTION Description
5 // .SECTION See Also
6 #ifndef vtkHigherOrderInterpolation_h
7 #define vtkHigherOrderInterpolation_h
8 
9 #include "vtkCommonDataModelModule.h" // For export macro.
10 #include "vtkObject.h"
11 #include "vtkSmartPointer.h" // For API.
12 
13 #include <vector> // For scratch storage.
14 
15 // Define this to include support for a "complete" (21- vs 18-point) wedge.
16 #define VTK_21_POINT_WEDGE true
17 
18 VTK_ABI_NAMESPACE_BEGIN
19 class vtkPoints;
20 class vtkVector2i;
21 class vtkVector3d;
23 
24 class VTKCOMMONDATAMODEL_EXPORT vtkHigherOrderInterpolation : public vtkObject
25 {
26 public:
27  // static vtkHigherOrderInterpolation* New();
28  void PrintSelf(ostream& os, vtkIndent indent) override;
30 
31  static int Tensor1ShapeFunctions(const int order[1], const double* pcoords, double* shape,
32  void (*function_evaluate_shape_functions)(int, double, double*));
33  static int Tensor1ShapeDerivatives(const int order[1], const double* pcoords, double* derivs,
34  void (*function_evaluate_shape_and_gradient)(int, double, double*, double*));
35 
36  static int Tensor2ShapeFunctions(const int order[2], const double* pcoords, double* shape,
37  void (*function_evaluate_shape_functions)(int, double, double*));
38  static int Tensor2ShapeDerivatives(const int order[2], const double* pcoords, double* derivs,
39  void (*function_evaluate_shape_and_gradient)(int, double, double*, double*));
40 
41  static int Tensor3ShapeFunctions(const int order[3], const double* pcoords, double* shape,
42  void (*function_evaluate_shape_functions)(int, double, double*));
43  static int Tensor3ShapeDerivatives(const int order[3], const double* pcoords, double* derivs,
44  void (*function_evaluate_shape_and_gradient)(int, double, double*, double*));
45 
46  virtual void Tensor3EvaluateDerivative(const int order[3], const double* pcoords,
47  vtkPoints* points, const double* fieldVals, int fieldDim, double* fieldDerivs) = 0;
48 
49  void Tensor3EvaluateDerivative(const int order[3], const double* pcoords, vtkPoints* points,
50  const double* fieldVals, int fieldDim, double* fieldDerivs,
51  void (*function_evaluate_shape_and_gradient)(int, double, double*, double*));
52 
53  static void WedgeShapeFunctions(const int order[3], vtkIdType numberOfPoints,
54  const double* pcoords, double* shape, vtkHigherOrderTriangle& tri,
55  void (*function_evaluate_shape_functions)(int, double, double*));
56  static void WedgeShapeDerivatives(const int order[3], vtkIdType numberOfPoints,
57  const double* pcoords, double* derivs, vtkHigherOrderTriangle& tri,
58  void (*function_evaluate_shape_and_gradient)(int, double, double*, double*));
59 
64  int JacobianInverse(vtkPoints* points, const double* derivs, double** inverse);
65  int JacobianInverseWedge(vtkPoints* points, const double* derivs, double** inverse);
66 
67  virtual void WedgeEvaluate(const int order[3], vtkIdType numberOfPoints, const double* pcoords,
68  double* fieldVals, int fieldDim, double* fieldAtPCoords) = 0;
69 
70  void WedgeEvaluate(const int order[3], vtkIdType numberOfPoints, const double* pcoords,
71  double* fieldVals, int fieldDim, double* fieldAtPCoords, vtkHigherOrderTriangle& tri,
72  void (*function_evaluate_shape_functions)(int, double, double*));
73 
74  virtual void WedgeEvaluateDerivative(const int order[3], const double* pcoords, vtkPoints* points,
75  const double* fieldVals, int fieldDim, double* fieldDerivs) = 0;
76 
77  void WedgeEvaluateDerivative(const int order[3], const double* pcoords, vtkPoints* points,
78  const double* fieldVals, int fieldDim, double* fieldDerivs, vtkHigherOrderTriangle& tri,
79  void (*function_evaluate_shape_and_gradient)(int, double, double*, double*));
80 
81  static vtkVector3d GetParametricHexCoordinates(int vertexId);
82  static vtkVector2i GetPointIndicesBoundingHexEdge(int edgeId);
83  static int GetVaryingParameterOfHexEdge(int edgeId);
84  static vtkVector2i GetFixedParametersOfHexEdge(int edgeId);
85 
86  static const int* GetPointIndicesBoundingHexFace(int faceId) VTK_SIZEHINT(4);
87  static const int* GetEdgeIndicesBoundingHexFace(int faceId) VTK_SIZEHINT(4);
88  static vtkVector2i GetVaryingParametersOfHexFace(int faceId);
89  static int GetFixedParameterOfHexFace(int faceId);
90 
91  static vtkVector3d GetParametricWedgeCoordinates(int vertexId);
92  static vtkVector2i GetPointIndicesBoundingWedgeEdge(int edgeId);
93  static int GetVaryingParameterOfWedgeEdge(int edgeId);
94  static vtkVector2i GetFixedParametersOfWedgeEdge(int edgeId);
95 
96  static const int* GetPointIndicesBoundingWedgeFace(int faceId) VTK_SIZEHINT(4);
97  static const int* GetEdgeIndicesBoundingWedgeFace(int faceId) VTK_SIZEHINT(4);
98  static vtkVector2i GetVaryingParametersOfWedgeFace(int faceId);
99  static int GetFixedParameterOfWedgeFace(int faceId);
100 
101  static void AppendCurveCollocationPoints(vtkSmartPointer<vtkPoints>& pts, const int order[1]);
102  static void AppendQuadrilateralCollocationPoints(
103  vtkSmartPointer<vtkPoints>& pts, const int order[2]);
104  static void AppendHexahedronCollocationPoints(
105  vtkSmartPointer<vtkPoints>& pts, const int order[3]);
106  static void AppendWedgeCollocationPoints(vtkSmartPointer<vtkPoints>& pts, const int order[3]);
107 
108  template <int N>
109  static int NumberOfIntervals(const int order[N]);
110 
111 protected:
113  ~vtkHigherOrderInterpolation() override;
114 
115  void PrepareForOrder(const int order[3], vtkIdType numberOfPoints);
116 
117  std::vector<double> ShapeSpace;
118  std::vector<double> DerivSpace;
119 
120 private:
122  void operator=(const vtkHigherOrderInterpolation&) = delete;
123 };
124 
125 template <int N>
127 {
128  int ni = 1;
129  for (int n = 0; n < N; ++n)
130  {
131  ni *= order[n];
132  }
133  return ni;
134 }
135 
136 VTK_ABI_NAMESPACE_END
137 #endif // vtkHigherOrderInterpolation_h
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int vtkIdType
Definition: vtkType.h:315
a simple class to control print indentation
Definition: vtkIndent.h:28
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:440
static int NumberOfIntervals(const int order[N])
#define VTK_SIZEHINT(...)
A 2D cell that represents an arbitrary order HigherOrder triangle.
represent and manipulate 3D points
Definition: vtkPoints.h:28