VTK
vtkLagrangeInterpolation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLagrangeInterpolation.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 vtkLagrangeInterpolation
16 // .SECTION Description
17 // .SECTION See Also
18 #ifndef vtkLagrangeInterpolation_h
19 #define vtkLagrangeInterpolation_h
20 
21 #include "vtkObject.h"
22 #include "vtkSmartPointer.h" // For API.
23 #include "vtkCommonDataModelModule.h" // For export macro.
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;
33 
34 class VTKCOMMONDATAMODEL_EXPORT vtkLagrangeInterpolation : public vtkObject
35 {
36 public:
38  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
41  enum Constants {
42  MaxDegree = 10 // The maximum degree that VTK will support.
43  };
44 
45  static void EvaluateShapeFunctions(int order, double pcoord, double* shape);
46  static void EvaluateShapeAndGradient(int order, double pcoord, double* shape, double* grad);
47 
48  static int Tensor1ShapeFunctions(const int order[1], const double* pcoords, double* shape);
49  static int Tensor1ShapeDerivatives(const int order[1], const double* pcoords, double* derivs);
50 
51  static int Tensor2ShapeFunctions(const int order[2], const double* pcoords, double* shape);
52  static int Tensor2ShapeDerivatives(const int order[2], const double* pcoords, double* derivs);
53 
54  static int Tensor3ShapeFunctions(const int order[3], const double* pcoords, double* shape);
55  static int Tensor3ShapeDerivatives(const int order[3], const double* pcoords, double* derivs);
56 
58  const int order[3],
59  const double* pcoords,
61  const double* fieldVals,
62  int fieldDim,
63  double* fieldDerivs);
64 
65  static void WedgeShapeFunctions(const int order[3], const vtkIdType numberOfPoints, const double* pcoords, double* shape);
66  static void WedgeShapeDerivatives(const int order[3], const vtkIdType numberOfPoints, const double* pcoords, double* derivs);
67 
72  int JacobianInverse(vtkPoints* points, const double* derivs, double** inverse);
73  int JacobianInverseWedge(vtkPoints* points, const double* derivs, double** inverse);
74 
76  const int order[3],
77  const vtkIdType numberOfPoints,
78  const double* pcoords,
79  double* fieldVals,
80  int fieldDim,
81  double* fieldAtPCoords);
82 
84  const int order[3],
85  const double* pcoords,
87  const double* fieldVals,
88  int fieldDim,
89  double* fieldDerivs);
90 
93  static int GetVaryingParameterOfHexEdge(int edgeId);
95 
96  static const int* GetPointIndicesBoundingHexFace(int faceId) VTK_SIZEHINT(4);
97  static const int* GetEdgeIndicesBoundingHexFace(int faceId) VTK_SIZEHINT(4);
99  static int GetFixedParameterOfHexFace(int faceId);
100 
103  static int GetVaryingParameterOfWedgeEdge(int edgeId);
105 
106  static const int* GetPointIndicesBoundingWedgeFace(int faceId) VTK_SIZEHINT(4);
107  static const int* GetEdgeIndicesBoundingWedgeFace(int faceId) VTK_SIZEHINT(4);
109  static int GetFixedParameterOfWedgeFace(int faceId);
110 
115 
116  template<int N>
117  static int NumberOfIntervals(const int order[N]);
118 protected:
121 
122  void PrepareForOrder(const int order[3], const vtkIdType numberOfPoints);
123 
124  std::vector<double> ShapeSpace;
125  std::vector<double> DerivSpace;
126 
127 private:
129  void operator=(const vtkLagrangeInterpolation&) = delete;
130 };
131 
132 template<int N>
134 {
135  int ni = 1;
136  for (int n = 0; n < N; ++n)
137  {
138  ni *= order[n];
139  }
140  return ni;
141 }
142 
143 #endif // vtkLagrangeInterpolation_h
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:40
vtkLagrangeInterpolation::AppendHexahedronCollocationPoints
static void AppendHexahedronCollocationPoints(vtkSmartPointer< vtkPoints > &pts, const int order[3])
vtkLagrangeInterpolation::Tensor2ShapeFunctions
static int Tensor2ShapeFunctions(const int order[2], const double *pcoords, double *shape)
vtkLagrangeInterpolation::vtkLagrangeInterpolation
vtkLagrangeInterpolation()
vtkLagrangeInterpolation::EvaluateShapeAndGradient
static void EvaluateShapeAndGradient(int order, double pcoord, double *shape, double *grad)
vtkLagrangeInterpolation::AppendQuadrilateralCollocationPoints
static void AppendQuadrilateralCollocationPoints(vtkSmartPointer< vtkPoints > &pts, const int order[2])
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkLagrangeInterpolation::AppendWedgeCollocationPoints
static void AppendWedgeCollocationPoints(vtkSmartPointer< vtkPoints > &pts, const int order[3])
vtkLagrangeInterpolation::GetVaryingParametersOfWedgeFace
static vtkVector2i GetVaryingParametersOfWedgeFace(int faceId)
vtkLagrangeInterpolation::GetPointIndicesBoundingWedgeEdge
static vtkVector2i GetPointIndicesBoundingWedgeEdge(int edgeId)
vtkLagrangeInterpolation::New
static vtkLagrangeInterpolation * New()
vtkLagrangeInterpolation::GetPointIndicesBoundingHexEdge
static vtkVector2i GetPointIndicesBoundingHexEdge(int edgeId)
vtkLagrangeInterpolation::WedgeShapeDerivatives
static void WedgeShapeDerivatives(const int order[3], const vtkIdType numberOfPoints, const double *pcoords, double *derivs)
vtkLagrangeInterpolation::GetParametricWedgeCoordinates
static vtkVector3d GetParametricWedgeCoordinates(int vertexId)
vtkSmartPointer< vtkPoints >
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkLagrangeInterpolation::GetVaryingParameterOfWedgeEdge
static int GetVaryingParameterOfWedgeEdge(int edgeId)
vtkLagrangeInterpolation::NumberOfIntervals
static int NumberOfIntervals(const int order[N])
Definition: vtkLagrangeInterpolation.h:133
vtkLagrangeInterpolation::GetVaryingParametersOfHexFace
static vtkVector2i GetVaryingParametersOfHexFace(int faceId)
vtkLagrangeInterpolation::Tensor3ShapeFunctions
static int Tensor3ShapeFunctions(const int order[3], const double *pcoords, double *shape)
vtkLagrangeInterpolation::WedgeEvaluateDerivative
void WedgeEvaluateDerivative(const int order[3], const double *pcoords, vtkPoints *points, const double *fieldVals, int fieldDim, double *fieldDerivs)
vtkLagrangeInterpolation::Tensor1ShapeFunctions
static int Tensor1ShapeFunctions(const int order[1], const double *pcoords, double *shape)
vtkLagrangeInterpolation::JacobianInverseWedge
int JacobianInverseWedge(vtkPoints *points, const double *derivs, double **inverse)
vtkX3D::points
@ points
Definition: vtkX3D.h:446
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:42
vtkLagrangeInterpolation::DerivSpace
std::vector< double > DerivSpace
Definition: vtkLagrangeInterpolation.h:125
vtkLagrangeInterpolation::Constants
Constants
Definition: vtkLagrangeInterpolation.h:41
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkLagrangeInterpolation::GetFixedParameterOfWedgeFace
static int GetFixedParameterOfWedgeFace(int faceId)
vtkSmartPointer.h
vtkLagrangeInterpolation::EvaluateShapeFunctions
static void EvaluateShapeFunctions(int order, double pcoord, double *shape)
vtkLagrangeInterpolation::Tensor2ShapeDerivatives
static int Tensor2ShapeDerivatives(const int order[2], const double *pcoords, double *derivs)
vtkLagrangeInterpolation
Definition: vtkLagrangeInterpolation.h:35
vtkLagrangeInterpolation::ShapeSpace
std::vector< double > ShapeSpace
Definition: vtkLagrangeInterpolation.h:124
vtkLagrangeInterpolation::PrepareForOrder
void PrepareForOrder(const int order[3], const vtkIdType numberOfPoints)
vtkLagrangeInterpolation::GetFixedParameterOfHexFace
static int GetFixedParameterOfHexFace(int faceId)
vtkLagrangeInterpolation::GetEdgeIndicesBoundingHexFace
static const int * GetEdgeIndicesBoundingHexFace(int faceId)
vtkObject.h
vtkX3D::order
@ order
Definition: vtkX3D.h:440
vtkLagrangeInterpolation::Tensor1ShapeDerivatives
static int Tensor1ShapeDerivatives(const int order[1], const double *pcoords, double *derivs)
vtkLagrangeInterpolation::GetPointIndicesBoundingWedgeFace
static const int * GetPointIndicesBoundingWedgeFace(int faceId)
vtkLagrangeInterpolation::JacobianInverse
int JacobianInverse(vtkPoints *points, const double *derivs, double **inverse)
Compute the inverse of the Jacobian and put the values in inverse.
vtkLagrangeInterpolation::GetFixedParametersOfWedgeEdge
static vtkVector2i GetFixedParametersOfWedgeEdge(int edgeId)
vtkLagrangeInterpolation::GetParametricHexCoordinates
static vtkVector3d GetParametricHexCoordinates(int vertexId)
vtkLagrangeInterpolation::WedgeEvaluate
void WedgeEvaluate(const int order[3], const vtkIdType numberOfPoints, const double *pcoords, double *fieldVals, int fieldDim, double *fieldAtPCoords)
vtkLagrangeInterpolation::AppendCurveCollocationPoints
static void AppendCurveCollocationPoints(vtkSmartPointer< vtkPoints > &pts, const int order[1])
vtkLagrangeInterpolation::Tensor3EvaluateDerivative
void Tensor3EvaluateDerivative(const int order[3], const double *pcoords, vtkPoints *points, const double *fieldVals, int fieldDim, double *fieldDerivs)
vtkLagrangeInterpolation::WedgeShapeFunctions
static void WedgeShapeFunctions(const int order[3], const vtkIdType numberOfPoints, const double *pcoords, double *shape)
vtkLagrangeInterpolation::~vtkLagrangeInterpolation
~vtkLagrangeInterpolation() override
vtkLagrangeInterpolation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkLagrangeInterpolation::GetFixedParametersOfHexEdge
static vtkVector2i GetFixedParametersOfHexEdge(int edgeId)
vtkLagrangeInterpolation::GetPointIndicesBoundingHexFace
static const int * GetPointIndicesBoundingHexFace(int faceId)
vtkVector2i
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:409
vtkVector3d
Definition: vtkVector.h:463
vtkLagrangeInterpolation::GetVaryingParameterOfHexEdge
static int GetVaryingParameterOfHexEdge(int edgeId)
vtkLagrangeInterpolation::Tensor3ShapeDerivatives
static int Tensor3ShapeDerivatives(const int order[3], const double *pcoords, double *derivs)
vtkLagrangeInterpolation::GetEdgeIndicesBoundingWedgeFace
static const int * GetEdgeIndicesBoundingWedgeFace(int faceId)