VTK  9.0.1
vtkHigherOrderInterpolation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkHigherOrderInterpolation.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 =========================================================================*/
15 // .NAME vtkHigherOrderInterpolation
16 // .SECTION Description
17 // .SECTION See Also
18 #ifndef vtkHigherOrderInterpolation_h
19 #define vtkHigherOrderInterpolation_h
20 
21 #include "vtkCommonDataModelModule.h" // For export macro.
22 #include "vtkObject.h"
23 #include "vtkSmartPointer.h" // For API.
24 
25 #include <vector> // For scratch storage.
26 
27 // Define this to include support for a "complete" (21- vs 18-point) wedge.
28 #define VTK_21_POINT_WEDGE true
29 
30 class vtkPoints;
31 class vtkVector2i;
32 class vtkVector3d;
34 
35 class VTKCOMMONDATAMODEL_EXPORT vtkHigherOrderInterpolation : public vtkObject
36 {
37 public:
38  // static vtkHigherOrderInterpolation* New();
39  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
42  static int Tensor1ShapeFunctions(const int order[1], const double* pcoords, double* shape,
43  void (*function_evaluate_shape_functions)(int, double, double*));
44  static int Tensor1ShapeDerivatives(const int order[1], const double* pcoords, double* derivs,
45  void (*function_evaluate_shape_and_gradient)(int, double, double*, double*));
46 
47  static int Tensor2ShapeFunctions(const int order[2], const double* pcoords, double* shape,
48  void (*function_evaluate_shape_functions)(int, double, double*));
49  static int Tensor2ShapeDerivatives(const int order[2], const double* pcoords, double* derivs,
50  void (*function_evaluate_shape_and_gradient)(int, double, double*, double*));
51 
52  static int Tensor3ShapeFunctions(const int order[3], const double* pcoords, double* shape,
53  void (*function_evaluate_shape_functions)(int, double, double*));
54  static int Tensor3ShapeDerivatives(const int order[3], const double* pcoords, double* derivs,
55  void (*function_evaluate_shape_and_gradient)(int, double, double*, double*));
56 
57  virtual void Tensor3EvaluateDerivative(const int order[3], const double* pcoords,
58  vtkPoints* points, const double* fieldVals, int fieldDim, double* fieldDerivs) = 0;
59 
60  void Tensor3EvaluateDerivative(const int order[3], const double* pcoords, vtkPoints* points,
61  const double* fieldVals, int fieldDim, double* fieldDerivs,
62  void (*function_evaluate_shape_and_gradient)(int, double, double*, double*));
63 
64  static void WedgeShapeFunctions(const int order[3], const vtkIdType numberOfPoints,
65  const double* pcoords, double* shape, vtkHigherOrderTriangle& tri,
66  void (*function_evaluate_shape_functions)(int, double, double*));
67  static void WedgeShapeDerivatives(const int order[3], const vtkIdType numberOfPoints,
68  const double* pcoords, double* derivs, vtkHigherOrderTriangle& tri,
69  void (*function_evaluate_shape_and_gradient)(int, double, double*, double*));
70 
75  int JacobianInverse(vtkPoints* points, const double* derivs, double** inverse);
76  int JacobianInverseWedge(vtkPoints* points, const double* derivs, double** inverse);
77 
78  virtual void WedgeEvaluate(const int order[3], const vtkIdType numberOfPoints,
79  const double* pcoords, double* fieldVals, int fieldDim, double* fieldAtPCoords) = 0;
80 
81  void WedgeEvaluate(const int order[3], const vtkIdType numberOfPoints, const double* pcoords,
82  double* fieldVals, int fieldDim, double* fieldAtPCoords, vtkHigherOrderTriangle& tri,
83  void (*function_evaluate_shape_functions)(int, double, double*));
84 
85  virtual void WedgeEvaluateDerivative(const int order[3], const double* pcoords, vtkPoints* points,
86  const double* fieldVals, int fieldDim, double* fieldDerivs) = 0;
87 
88  void WedgeEvaluateDerivative(const int order[3], const double* pcoords, vtkPoints* points,
89  const double* fieldVals, int fieldDim, double* fieldDerivs, vtkHigherOrderTriangle& tri,
90  void (*function_evaluate_shape_and_gradient)(int, double, double*, double*));
91 
92  static vtkVector3d GetParametricHexCoordinates(int vertexId);
93  static vtkVector2i GetPointIndicesBoundingHexEdge(int edgeId);
94  static int GetVaryingParameterOfHexEdge(int edgeId);
95  static vtkVector2i GetFixedParametersOfHexEdge(int edgeId);
96 
97  static const int* GetPointIndicesBoundingHexFace(int faceId) VTK_SIZEHINT(4);
98  static const int* GetEdgeIndicesBoundingHexFace(int faceId) VTK_SIZEHINT(4);
99  static vtkVector2i GetVaryingParametersOfHexFace(int faceId);
100  static int GetFixedParameterOfHexFace(int faceId);
101 
102  static vtkVector3d GetParametricWedgeCoordinates(int vertexId);
103  static vtkVector2i GetPointIndicesBoundingWedgeEdge(int edgeId);
104  static int GetVaryingParameterOfWedgeEdge(int edgeId);
105  static vtkVector2i GetFixedParametersOfWedgeEdge(int edgeId);
106 
107  static const int* GetPointIndicesBoundingWedgeFace(int faceId) VTK_SIZEHINT(4);
108  static const int* GetEdgeIndicesBoundingWedgeFace(int faceId) VTK_SIZEHINT(4);
109  static vtkVector2i GetVaryingParametersOfWedgeFace(int faceId);
110  static int GetFixedParameterOfWedgeFace(int faceId);
111 
112  static void AppendCurveCollocationPoints(vtkSmartPointer<vtkPoints>& pts, const int order[1]);
113  static void AppendQuadrilateralCollocationPoints(
114  vtkSmartPointer<vtkPoints>& pts, const int order[2]);
115  static void AppendHexahedronCollocationPoints(
116  vtkSmartPointer<vtkPoints>& pts, const int order[3]);
117  static void AppendWedgeCollocationPoints(vtkSmartPointer<vtkPoints>& pts, const int order[3]);
118 
119  template <int N>
120  static int NumberOfIntervals(const int order[N]);
121 
122 protected:
124  ~vtkHigherOrderInterpolation() override;
125 
126  void PrepareForOrder(const int order[3], const vtkIdType numberOfPoints);
127 
128  std::vector<double> ShapeSpace;
129  std::vector<double> DerivSpace;
130 
131 private:
133  void operator=(const vtkHigherOrderInterpolation&) = delete;
134 };
135 
136 template <int N>
138 {
139  int ni = 1;
140  for (int n = 0; n < N; ++n)
141  {
142  ni *= order[n];
143  }
144  return ni;
145 }
146 
147 #endif // vtkHigherOrderInterpolation_h
abstract base class for most VTK objects
Definition: vtkObject.h:62
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int vtkIdType
Definition: vtkType.h:338
a simple class to control print indentation
Definition: vtkIndent.h:33
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:419
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:33