/usr/include/gmsh/JacobianBasis.h is in libgmsh-dev 2.15.0+dfsg1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | // Gmsh - Copyright (C) 1997-2016 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to the public mailing list <gmsh@onelab.info>.
#ifndef _JACOBIAN_BASIS_H_
#define _JACOBIAN_BASIS_H_
#include "fullMatrix.h"
#include "FuncSpaceData.h"
class bezierBasis;
class GradientBasis {
public:
fullMatrix<double> gradShapeMatX, gradShapeMatY, gradShapeMatZ;
fullMatrix<double> gradShapeIdealMatX, gradShapeIdealMatY, gradShapeIdealMatZ;
private:
const FuncSpaceData _data;
public:
GradientBasis(FuncSpaceData);
int getNumSamplingPoints() const {return gradShapeMatX.size1();}
int getNumMapNodes() const {return gradShapeMatX.size2();}
const bezierBasis* getBezier() const;
void getGradientsFromNodes(const fullMatrix<double> &nodes,
fullMatrix<double> *dxyzdX,
fullMatrix<double> *dxyzdY,
fullMatrix<double> *dxyzdZ) const;
void getAllGradientsFromNodes(const fullMatrix<double> &nodes,
fullMatrix<double> &dxyzdXYZ) const;
void getIdealGradientsFromNodes(const fullMatrix<double> &nodes,
fullMatrix<double> *dxyzdX,
fullMatrix<double> *dxyzdY,
fullMatrix<double> *dxyzdZ) const;
void getAllIdealGradientsFromNodes(const fullMatrix<double> &nodes,
fullMatrix<double> &dxyzdXYZ) const;
void mapFromIdealElement(fullMatrix<double> &dxyzdX,
fullMatrix<double> &dxyzdY,
fullMatrix<double> &dxyzdZ) const {
GradientBasis::mapFromIdealElement(_data.elementType(), dxyzdX, dxyzdY, dxyzdZ);
}
void mapFromIdealElement(fullVector<double> &dxyzdX,
fullVector<double> &dxyzdY,
fullVector<double> &dxyzdZ) const {
GradientBasis::mapFromIdealElement(_data.elementType(), dxyzdX, dxyzdY, dxyzdZ);
}
static void mapFromIdealElement(int type,
fullMatrix<double> &gSMatX,
fullMatrix<double> &gSMatY,
fullMatrix<double> &gSMatZ);
static void mapFromIdealElement(int type,
fullVector<double> &gSVecX,
fullVector<double> &gSVecY,
fullVector<double> &gSVecZ);
static void mapFromIdealElement(int type, double jac[3][3]);
void lag2Bez(const fullMatrix<double> &lag, fullMatrix<double> &bez) const;
};
class JacobianBasis {
private:
const GradientBasis *_gradBasis;
const FuncSpaceData _data;
const int _dim;
fullMatrix<double> gradShapeMatXFast, gradShapeMatYFast, gradShapeMatZFast;
fullVector<double> primGradShapeBaryX, primGradShapeBaryY, primGradShapeBaryZ;
fullVector<double> primIdealGradShapeBaryX, primIdealGradShapeBaryY,
primIdealGradShapeBaryZ;
fullMatrix<double> matrixPrimJac2Jac; // Lifts Lagrange basis of primary Jac. to Lagrange basis of Jac.
int numJacNodes, numPrimJacNodes;
int numMapNodes, numPrimMapNodes;
int numJacNodesFast;
public:
JacobianBasis(FuncSpaceData);
// Get methods
inline int getJacOrder() const {return _data.spaceOrder();}
inline int getNumJacNodes() const {return numJacNodes;}
inline int getNumJacNodesFast() const {return numJacNodesFast;}
inline int getNumMapNodes() const {return numMapNodes;}
inline int getNumPrimJacNodes() const {return numPrimJacNodes;}
inline int getNumPrimMapNodes() const {return numPrimMapNodes;}
const bezierBasis* getBezier() const;
// Jacobian evaluation methods
double getPrimNormals1D(const fullMatrix<double> &nodesXYZ,
fullMatrix<double> &result) const;
double getPrimNormal2D(const fullMatrix<double> &nodesXYZ,
fullMatrix<double> &result, bool ideal=false) const;
double getPrimJac3D(const fullMatrix<double> &nodesXYZ, bool ideal=false) const;
inline void getSignedJacAndGradients(const fullMatrix<double> &nodesXYZ,
const fullMatrix<double> &normals,
fullMatrix<double> &JDJ) const {
getSignedJacAndGradientsGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ,
nodesXYZ, normals, JDJ);
}
inline void getSignedJacAndGradientsFast(const fullMatrix<double> &nodesXYZ,
const fullMatrix<double> &normals,
fullMatrix<double> &JDJ) const {
getSignedJacAndGradientsGeneral(numJacNodesFast, gradShapeMatXFast,
gradShapeMatYFast, gradShapeMatZFast,
nodesXYZ, normals, JDJ);
}
inline void getSignedIdealJacAndGradients(const fullMatrix<double> &nodesXYZ,
const fullMatrix<double> &normals,
fullMatrix<double> &JDJ) const {
getSignedJacAndGradientsGeneral(numJacNodes, _gradBasis->gradShapeIdealMatX,
_gradBasis->gradShapeIdealMatY,
_gradBasis->gradShapeIdealMatZ,
nodesXYZ, normals, JDJ);
}
void getMetricMinAndGradients(const fullMatrix<double> &nodesXYZ,
const fullMatrix<double> &nodesXYZStraight,
fullVector<double> &lambdaJ,
fullMatrix<double> &gradLambdaJ) const;
inline void getSignedJacobian(const fullMatrix<double> &nodesXYZ,
fullVector<double> &jacobian,
const fullMatrix<double> *normals = NULL) const {
getJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ,
nodesXYZ, false, false, jacobian, normals);
}
inline void getSignedJacobian(const fullMatrix<double> &nodesX,
const fullMatrix<double> &nodesY,
const fullMatrix<double> &nodesZ,
fullMatrix<double> &jacobian,
const fullMatrix<double> *normals = NULL) const {
getJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ,
nodesX, nodesY, nodesZ, false, false, jacobian, normals);
}
inline void getSignedIdealJacobian(const fullMatrix<double> &nodesXYZ,
fullVector<double> &jacobian,
const fullMatrix<double> *normals = NULL) const {
getJacobianGeneral(numJacNodes, _gradBasis->gradShapeIdealMatX,
_gradBasis->gradShapeIdealMatY,
_gradBasis->gradShapeIdealMatZ,
nodesXYZ, true, false, jacobian, normals);
}
inline void getSignedIdealJacobian(const fullMatrix<double> &nodesX,
const fullMatrix<double> &nodesY,
const fullMatrix<double> &nodesZ,
fullMatrix<double> &jacobian,
const fullMatrix<double> *normals = NULL) const {
getJacobianGeneral(numJacNodes, _gradBasis->gradShapeIdealMatX,
_gradBasis->gradShapeIdealMatY,
_gradBasis->gradShapeIdealMatZ,
nodesX, nodesY, nodesZ, true, false, jacobian, normals);
}
inline void getScaledJacobian(const fullMatrix<double> &nodesXYZ,
fullVector<double> &jacobian) const {
getJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ,
nodesXYZ, false, true, jacobian, NULL);
}
inline void getScaledJacobian(const fullMatrix<double> &nodesX,
const fullMatrix<double> &nodesY,
const fullMatrix<double> &nodesZ,
fullMatrix<double> &jacobian) const {
getJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ,
nodesX, nodesY, nodesZ, false, true, jacobian, NULL);
}
inline void getSignedJacobianFast(const fullMatrix<double> &nodesXYZ,
fullVector<double> &jacobian,
const fullMatrix<double> *normals = NULL) const {
getJacobianGeneral(numJacNodesFast, gradShapeMatXFast,
gradShapeMatYFast, gradShapeMatZFast,
nodesXYZ, false, false, jacobian, normals);
}
inline void getScaledJacobianFast(const fullMatrix<double> &nodesXYZ,
fullVector<double> &jacobian,
const fullMatrix<double> *normals = NULL) const {
getJacobianGeneral(numJacNodesFast, gradShapeMatXFast,
gradShapeMatYFast, gradShapeMatZFast,
nodesXYZ, false, true, jacobian, normals);
}
void lag2Bez(const fullVector<double> &lag, fullVector<double> &bez) const;
void lag2Bez(const fullMatrix<double> &lag, fullMatrix<double> &bez) const;
inline void primJac2Jac(const fullVector<double> &primJac, fullVector<double> &jac) const {
matrixPrimJac2Jac.mult(primJac,jac);
}
// Research purpose (to be removed ?)
void interpolate(const fullVector<double> &jacobian,
const fullMatrix<double> &uvw,
fullMatrix<double> &result, bool areBezier = false) const;
static int jacobianOrder(int tag);
static int jacobianOrder(int parentType, int order);
static FuncSpaceData jacobianMatrixSpace(int type, int order);
private :
void getJacobianGeneral(int nJacNodes,
const fullMatrix<double> &gSMatX,
const fullMatrix<double> &gSMatY,
const fullMatrix<double> &gSMatZ,
const fullMatrix<double> &nodesXYZ,
bool idealNorm, bool scaling,
fullVector<double> &jacobian,
const fullMatrix<double> *normals) const;
void getJacobianGeneral(int nJacNodes,
const fullMatrix<double> &gSMatX,
const fullMatrix<double> &gSMatY,
const fullMatrix<double> &gSMatZ,
const fullMatrix<double> &nodesX,
const fullMatrix<double> &nodesY,
const fullMatrix<double> &nodesZ,
bool idealNorm, bool scaling,
fullMatrix<double> &jacobian,
const fullMatrix<double> *normals) const;
void getSignedJacAndGradientsGeneral(int nJacNodes,
const fullMatrix<double> &gSMatX,
const fullMatrix<double> &gSMatY,
const fullMatrix<double> &gSMatZ,
const fullMatrix<double> &nodesXYZ,
const fullMatrix<double> &normals,
fullMatrix<double> &JDJ) const;
void getSignedIdealJacAndGradientsGeneral(int nJacNodes,
const fullMatrix<double> &gSMatX,
const fullMatrix<double> &gSMatY,
const fullMatrix<double> &gSMatZ,
const fullMatrix<double> &nodesXYZ,
const fullMatrix<double> &normals,
fullMatrix<double> &JDJ) const;
};
#endif
|