gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
JacobianBasis.h
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 
6 #ifndef JACOBIAN_BASIS_H
7 #define JACOBIAN_BASIS_H
8 
9 #include "fullMatrix.h"
10 #include "FuncSpaceData.h"
11 
13 public:
16 
17 private:
18  const int _elementTag;
20 
21 public:
22  GradientBasis(int elementTag, FuncSpaceData);
23 
24  inline int getPolynomialOrder() const { return _data.getSpaceOrder(); }
25  int getNumSamplingPoints() const { return dShapeMat_dX.size1(); }
26  int getNumMapNodes() const { return dShapeMat_dX.size2(); }
27  void getGradientsFromNodes(const fullMatrix<double> &nodesCoord,
28  fullMatrix<double> *dxyzdX,
29  fullMatrix<double> *dxyzdY,
30  fullMatrix<double> *dxyzdZ) const;
31  void getAllGradientsFromNodes(const fullMatrix<double> &nodesCoord,
32  fullMatrix<double> &dxyzdXYZ) const;
33  void getIdealGradientsFromNodes(const fullMatrix<double> &nodesCoord,
34  fullMatrix<double> *dxyzdX,
35  fullMatrix<double> *dxyzdY,
36  fullMatrix<double> *dxyzdZ) const;
38  fullMatrix<double> &dxyzdXYZ) const;
40  fullMatrix<double> &dxyzdY,
41  fullMatrix<double> &dxyzdZ) const
42  {
43  GradientBasis::mapFromIdealElement(_data.getType(), dxyzdX, dxyzdY, dxyzdZ);
44  }
46  fullVector<double> &dxyzdY,
47  fullVector<double> &dxyzdZ) const
48  {
49  GradientBasis::mapFromIdealElement(_data.getType(), dxyzdX, dxyzdY, dxyzdZ);
50  }
51  static void mapFromIdealElement(int type, fullMatrix<double> &dSMat_dX,
52  fullMatrix<double> &dSMat_dY,
53  fullMatrix<double> &dSMat_dZ);
54  static void mapFromIdealElement(int type, fullVector<double> &dSVec_dX,
55  fullVector<double> &dSVec_dY,
56  fullVector<double> &dSVec_dZ);
57  static void mapFromIdealElement(int type, double jac[3][3]);
58 };
59 
61 private:
63  const int _elementTag;
65  const int _dim;
70  // Lifts Lagrange basis of primary Jac. to Lagrange basis of Jac.
75 
76 public:
77  JacobianBasis(int elementTag, FuncSpaceData);
78 
79  // Get methods
80  inline int getJacOrder() const { return _data.getSpaceOrder(); }
81  inline int getNumSamplingPnts() const { return numSamplingPnts; }
82  inline int getNumSamplingPntsFast() const { return numSamplingPntsFast; }
83  inline int getNumMapNodes() const { return numMapNodes; }
84  inline int getNumPrimSamplingPnts() const { return numPrimSamplingPnts; }
85  inline int getNumPrimMapNodes() const { return numPrimMapNodes; }
86  inline FuncSpaceData getFuncSpaceData() const { return _data; }
87 
88  // Jacobian evaluation methods
89  double getPrimNormals1D(const fullMatrix<double> &nodesXYZ,
90  fullMatrix<double> &result) const;
91  double getPrimNormal2D(const fullMatrix<double> &nodesXYZ,
92  fullMatrix<double> &result, bool ideal = false) const;
93  double getPrimJac3D(const fullMatrix<double> &nodesXYZ,
94  bool ideal = false) const;
95  inline void getSignedJacAndGradients(const fullMatrix<double> &nodesXYZ,
96  const fullMatrix<double> &normals,
97  fullMatrix<double> &JDJ) const
98  {
101  _gradBasis->dShapeMat_dZ, nodesXYZ, normals, JDJ);
102  }
104  const fullMatrix<double> &normals,
105  fullMatrix<double> &JDJ) const
106  {
109  nodesXYZ, normals, JDJ);
110  }
112  const fullMatrix<double> &normals,
113  fullMatrix<double> &JDJ) const
114  {
118  normals, JDJ);
119  }
120  void getMetricMinAndGradients(const fullMatrix<double> &nodesXYZ,
121  const fullMatrix<double> &nodesXYZStraight,
122  fullVector<double> &lambdaJ,
123  fullMatrix<double> &gradLambdaJ) const;
124  inline void getSignedJacobian(const fullMatrix<double> &nodesXYZ,
125  fullVector<double> &jacobian,
126  const fullMatrix<double> *normals = nullptr) const
127  {
130  nodesXYZ, false, false, jacobian, normals);
131  }
132  inline void getSignedJacobian(const fullMatrix<double> &nodesX,
133  const fullMatrix<double> &nodesY,
134  const fullMatrix<double> &nodesZ,
135  fullMatrix<double> &jacobian,
136  const fullMatrix<double> *normals = nullptr) const
137  {
140  nodesX, nodesY, nodesZ, false, false, jacobian, normals);
141  }
142  inline void
144  fullVector<double> &jacobian,
145  const fullMatrix<double> *normals = nullptr) const
146  {
149  _gradBasis->dShapeIdealMat_dZ, nodesXYZ, true, false,
150  jacobian, normals);
151  }
153  const fullMatrix<double> &nodesX, const fullMatrix<double> &nodesY,
154  const fullMatrix<double> &nodesZ, fullMatrix<double> &jacobian,
155  const fullMatrix<double> *normals = nullptr) const
156  {
159  _gradBasis->dShapeIdealMat_dZ, nodesX, nodesY, nodesZ,
160  true, false, jacobian, normals);
161  }
162  inline void getScaledJacobian(const fullMatrix<double> &nodesXYZ,
163  fullVector<double> &jacobian) const
164  {
167  nodesXYZ, false, true, jacobian, nullptr);
168  }
169  inline void getScaledJacobian(const fullMatrix<double> &nodesX,
170  const fullMatrix<double> &nodesY,
171  const fullMatrix<double> &nodesZ,
172  fullMatrix<double> &jacobian) const
173  {
176  nodesX, nodesY, nodesZ, false, true, jacobian, nullptr);
177  }
178  inline void
180  fullVector<double> &jacobian,
181  const fullMatrix<double> *normals = nullptr) const
182  {
184  dFastShapeMat_dZ, nodesXYZ, false, false, jacobian,
185  normals);
186  }
187  inline void
189  fullVector<double> &jacobian,
190  const fullMatrix<double> *normals = nullptr) const
191  {
193  dFastShapeMat_dZ, nodesXYZ, false, true, jacobian,
194  normals);
195  }
196 
197  inline void primJac2Jac(const fullVector<double> &primJac,
198  fullVector<double> &jac) const
199  {
200  matrixPrimJac2Jac.mult(primJac, jac);
201  }
202 
203  static int jacobianOrder(int tag);
204  static int jacobianOrder(int parentType, int order);
205  static FuncSpaceData jacobianMatrixSpace(int type, int order);
206 
207 private:
208  void getJacobianGeneral(int nSamplingPnts, const fullMatrix<double> &dSMat_dX,
209  const fullMatrix<double> &dSMat_dY,
210  const fullMatrix<double> &dSMat_dZ,
211  const fullMatrix<double> &nodesXYZ, bool idealNorm,
212  bool scaling, fullVector<double> &jacobian,
213  const fullMatrix<double> *normals) const;
214  void getJacobianGeneral(int nSamplingPnts, const fullMatrix<double> &dSMat_dX,
215  const fullMatrix<double> &dSMat_dY,
216  const fullMatrix<double> &dSMat_dZ,
217  const fullMatrix<double> &nodesX,
218  const fullMatrix<double> &nodesY,
219  const fullMatrix<double> &nodesZ, bool idealNorm,
220  bool scaling, fullMatrix<double> &jacobian,
221  const fullMatrix<double> *normals) const;
222  void getSignedJacAndGradientsGeneral(int nSamplingPnts,
223  const fullMatrix<double> &dSMat_dX,
224  const fullMatrix<double> &dSMat_dY,
225  const fullMatrix<double> &dSMat_dZ,
226  const fullMatrix<double> &nodesXYZ,
227  const fullMatrix<double> &normals,
228  fullMatrix<double> &JDJ) const;
229  void getSignedIdealJacAndGradientsGeneral(int nSamplingPnts,
230  const fullMatrix<double> &dSMat_dX,
231  const fullMatrix<double> &dSMat_dY,
232  const fullMatrix<double> &dSMat_dZ,
233  const fullMatrix<double> &nodesXYZ,
234  const fullMatrix<double> &normals,
235  fullMatrix<double> &JDJ) const;
236 };
237 
238 #endif
JacobianBasis::getSignedIdealJacAndGradients
void getSignedIdealJacAndGradients(const fullMatrix< double > &nodesXYZ, const fullMatrix< double > &normals, fullMatrix< double > &JDJ) const
Definition: JacobianBasis.h:111
GradientBasis::getIdealGradientsFromNodes
void getIdealGradientsFromNodes(const fullMatrix< double > &nodesCoord, fullMatrix< double > *dxyzdX, fullMatrix< double > *dxyzdY, fullMatrix< double > *dxyzdZ) const
Definition: JacobianBasis.cpp:184
JacobianBasis::matrixPrimJac2Jac
fullMatrix< double > matrixPrimJac2Jac
Definition: JacobianBasis.h:71
GradientBasis::_data
const FuncSpaceData _data
Definition: JacobianBasis.h:19
JacobianBasis::getNumPrimMapNodes
int getNumPrimMapNodes() const
Definition: JacobianBasis.h:85
JacobianBasis::getMetricMinAndGradients
void getMetricMinAndGradients(const fullMatrix< double > &nodesXYZ, const fullMatrix< double > &nodesXYZStraight, fullVector< double > &lambdaJ, fullMatrix< double > &gradLambdaJ) const
Definition: JacobianBasis.cpp:758
JacobianBasis::dFastShapeMat_dY
fullMatrix< double > dFastShapeMat_dY
Definition: JacobianBasis.h:66
JacobianBasis::numMapNodes
int numMapNodes
Definition: JacobianBasis.h:73
JacobianBasis::JacobianBasis
JacobianBasis(int elementTag, FuncSpaceData)
Definition: JacobianBasis.cpp:252
fullVector< double >
JacobianBasis::_dim
const int _dim
Definition: JacobianBasis.h:65
JacobianBasis::getSignedJacAndGradientsFast
void getSignedJacAndGradientsFast(const fullMatrix< double > &nodesXYZ, const fullMatrix< double > &normals, fullMatrix< double > &JDJ) const
Definition: JacobianBasis.h:103
JacobianBasis::getSignedIdealJacobian
void getSignedIdealJacobian(const fullMatrix< double > &nodesXYZ, fullVector< double > &jacobian, const fullMatrix< double > *normals=nullptr) const
Definition: JacobianBasis.h:143
GradientBasis::dShapeMat_dY
fullMatrix< double > dShapeMat_dY
Definition: JacobianBasis.h:14
GradientBasis::getAllGradientsFromNodes
void getAllGradientsFromNodes(const fullMatrix< double > &nodesCoord, fullMatrix< double > &dxyzdXYZ) const
Definition: JacobianBasis.cpp:203
JacobianBasis::dPrimBaryIdealShape_dY
fullVector< double > dPrimBaryIdealShape_dY
Definition: JacobianBasis.h:68
JacobianBasis::_gradBasis
const GradientBasis * _gradBasis
Definition: JacobianBasis.h:62
GradientBasis::mapFromIdealElement
void mapFromIdealElement(fullMatrix< double > &dxyzdX, fullMatrix< double > &dxyzdY, fullMatrix< double > &dxyzdZ) const
Definition: JacobianBasis.h:39
JacobianBasis::getPrimNormals1D
double getPrimNormals1D(const fullMatrix< double > &nodesXYZ, fullMatrix< double > &result) const
Definition: JacobianBasis.cpp:339
JacobianBasis::_elementTag
const int _elementTag
Definition: JacobianBasis.h:63
JacobianBasis::getNumPrimSamplingPnts
int getNumPrimSamplingPnts() const
Definition: JacobianBasis.h:84
JacobianBasis::getNumMapNodes
int getNumMapNodes() const
Definition: JacobianBasis.h:83
GradientBasis::dShapeMat_dX
fullMatrix< double > dShapeMat_dX
Definition: JacobianBasis.h:14
fullMatrix< double >
GradientBasis::dShapeMat_dZ
fullMatrix< double > dShapeMat_dZ
Definition: JacobianBasis.h:14
JacobianBasis::getSignedIdealJacobian
void getSignedIdealJacobian(const fullMatrix< double > &nodesX, const fullMatrix< double > &nodesY, const fullMatrix< double > &nodesZ, fullMatrix< double > &jacobian, const fullMatrix< double > *normals=nullptr) const
Definition: JacobianBasis.h:152
JacobianBasis::numSamplingPntsFast
int numSamplingPntsFast
Definition: JacobianBasis.h:74
JacobianBasis::getSignedJacobianFast
void getSignedJacobianFast(const fullMatrix< double > &nodesXYZ, fullVector< double > &jacobian, const fullMatrix< double > *normals=nullptr) const
Definition: JacobianBasis.h:179
JacobianBasis::primJac2Jac
void primJac2Jac(const fullVector< double > &primJac, fullVector< double > &jac) const
Definition: JacobianBasis.h:197
JacobianBasis::jacobianOrder
static int jacobianOrder(int tag)
Definition: JacobianBasis.cpp:813
JacobianBasis::dPrimBaryShape_dY
fullVector< double > dPrimBaryShape_dY
Definition: JacobianBasis.h:67
JacobianBasis::getSignedIdealJacAndGradientsGeneral
void getSignedIdealJacAndGradientsGeneral(int nSamplingPnts, const fullMatrix< double > &dSMat_dX, const fullMatrix< double > &dSMat_dY, const fullMatrix< double > &dSMat_dZ, const fullMatrix< double > &nodesXYZ, const fullMatrix< double > &normals, fullMatrix< double > &JDJ) const
Definition: JacobianBasis.cpp:748
JacobianBasis::dPrimBaryIdealShape_dX
fullVector< double > dPrimBaryIdealShape_dX
Definition: JacobianBasis.h:68
JacobianBasis::dFastShapeMat_dX
fullMatrix< double > dFastShapeMat_dX
Definition: JacobianBasis.h:66
GradientBasis::getAllIdealGradientsFromNodes
void getAllIdealGradientsFromNodes(const fullMatrix< double > &nodesCoord, fullMatrix< double > &dxyzdXYZ) const
Definition: JacobianBasis.cpp:217
JacobianBasis::numPrimMapNodes
int numPrimMapNodes
Definition: JacobianBasis.h:73
GradientBasis::mapFromIdealElement
void mapFromIdealElement(fullVector< double > &dxyzdX, fullVector< double > &dxyzdY, fullVector< double > &dxyzdZ) const
Definition: JacobianBasis.h:45
GradientBasis::getPolynomialOrder
int getPolynomialOrder() const
Definition: JacobianBasis.h:24
GradientBasis::getGradientsFromNodes
void getGradientsFromNodes(const fullMatrix< double > &nodesCoord, fullMatrix< double > *dxyzdX, fullMatrix< double > *dxyzdY, fullMatrix< double > *dxyzdZ) const
Definition: JacobianBasis.cpp:193
JacobianBasis::getSignedJacAndGradients
void getSignedJacAndGradients(const fullMatrix< double > &nodesXYZ, const fullMatrix< double > &normals, fullMatrix< double > &JDJ) const
Definition: JacobianBasis.h:95
GradientBasis::getNumMapNodes
int getNumMapNodes() const
Definition: JacobianBasis.h:26
JacobianBasis::getScaledJacobian
void getScaledJacobian(const fullMatrix< double > &nodesX, const fullMatrix< double > &nodesY, const fullMatrix< double > &nodesZ, fullMatrix< double > &jacobian) const
Definition: JacobianBasis.h:169
JacobianBasis::getNumSamplingPntsFast
int getNumSamplingPntsFast() const
Definition: JacobianBasis.h:82
JacobianBasis::numSamplingPnts
int numSamplingPnts
Definition: JacobianBasis.h:72
GradientBasis::GradientBasis
GradientBasis(int elementTag, FuncSpaceData)
Definition: JacobianBasis.cpp:146
FuncSpaceData::getType
int getType() const
Definition: FuncSpaceData.h:65
JacobianBasis::_data
const FuncSpaceData _data
Definition: JacobianBasis.h:64
GradientBasis::dShapeIdealMat_dZ
fullMatrix< double > dShapeIdealMat_dZ
Definition: JacobianBasis.h:15
fullMatrix::size2
int size2() const
Definition: fullMatrix.h:275
JacobianBasis::dFastShapeMat_dZ
fullMatrix< double > dFastShapeMat_dZ
Definition: JacobianBasis.h:66
JacobianBasis::getPrimNormal2D
double getPrimNormal2D(const fullMatrix< double > &nodesXYZ, fullMatrix< double > &result, bool ideal=false) const
Definition: JacobianBasis.cpp:385
FuncSpaceData
Definition: FuncSpaceData.h:16
JacobianBasis::dPrimBaryShape_dZ
fullVector< double > dPrimBaryShape_dZ
Definition: JacobianBasis.h:67
GradientBasis::_elementTag
const int _elementTag
Definition: JacobianBasis.h:18
JacobianBasis::getJacOrder
int getJacOrder() const
Definition: JacobianBasis.h:80
JacobianBasis::jacobianMatrixSpace
static FuncSpaceData jacobianMatrixSpace(int type, int order)
Definition: JacobianBasis.cpp:840
fullMatrix::size1
int size1() const
Definition: fullMatrix.h:274
JacobianBasis::getScaledJacobian
void getScaledJacobian(const fullMatrix< double > &nodesXYZ, fullVector< double > &jacobian) const
Definition: JacobianBasis.h:162
JacobianBasis::getSignedJacobian
void getSignedJacobian(const fullMatrix< double > &nodesX, const fullMatrix< double > &nodesY, const fullMatrix< double > &nodesZ, fullMatrix< double > &jacobian, const fullMatrix< double > *normals=nullptr) const
Definition: JacobianBasis.h:132
FuncSpaceData.h
JacobianBasis
Definition: JacobianBasis.h:60
GradientBasis::getNumSamplingPoints
int getNumSamplingPoints() const
Definition: JacobianBasis.h:25
JacobianBasis::getNumSamplingPnts
int getNumSamplingPnts() const
Definition: JacobianBasis.h:81
GradientBasis::dShapeIdealMat_dY
fullMatrix< double > dShapeIdealMat_dY
Definition: JacobianBasis.h:15
JacobianBasis::getSignedJacAndGradientsGeneral
void getSignedJacAndGradientsGeneral(int nSamplingPnts, const fullMatrix< double > &dSMat_dX, const fullMatrix< double > &dSMat_dY, const fullMatrix< double > &dSMat_dZ, const fullMatrix< double > &nodesXYZ, const fullMatrix< double > &normals, fullMatrix< double > &JDJ) const
Definition: JacobianBasis.cpp:694
JacobianBasis::getFuncSpaceData
FuncSpaceData getFuncSpaceData() const
Definition: JacobianBasis.h:86
GradientBasis::dShapeIdealMat_dX
fullMatrix< double > dShapeIdealMat_dX
Definition: JacobianBasis.h:15
FuncSpaceData::getSpaceOrder
int getSpaceOrder() const
Definition: FuncSpaceData.h:80
JacobianBasis::dPrimBaryShape_dX
fullVector< double > dPrimBaryShape_dX
Definition: JacobianBasis.h:67
JacobianBasis::getPrimJac3D
double getPrimJac3D(const fullMatrix< double > &nodesXYZ, bool ideal=false) const
Definition: JacobianBasis.cpp:418
fullMatrix::mult
void mult(const fullVector< scalar > &x, fullVector< scalar > &y) const
Definition: fullMatrix.h:487
JacobianBasis::dPrimBaryIdealShape_dZ
fullVector< double > dPrimBaryIdealShape_dZ
Definition: JacobianBasis.h:69
JacobianBasis::getScaledJacobianFast
void getScaledJacobianFast(const fullMatrix< double > &nodesXYZ, fullVector< double > &jacobian, const fullMatrix< double > *normals=nullptr) const
Definition: JacobianBasis.h:188
JacobianBasis::getJacobianGeneral
void getJacobianGeneral(int nSamplingPnts, const fullMatrix< double > &dSMat_dX, const fullMatrix< double > &dSMat_dY, const fullMatrix< double > &dSMat_dZ, const fullMatrix< double > &nodesXYZ, bool idealNorm, bool scaling, fullVector< double > &jacobian, const fullMatrix< double > *normals) const
Definition: JacobianBasis.cpp:448
JacobianBasis::numPrimSamplingPnts
int numPrimSamplingPnts
Definition: JacobianBasis.h:72
GradientBasis
Definition: JacobianBasis.h:12
JacobianBasis::getSignedJacobian
void getSignedJacobian(const fullMatrix< double > &nodesXYZ, fullVector< double > &jacobian, const fullMatrix< double > *normals=nullptr) const
Definition: JacobianBasis.h:124
fullMatrix.h