Skip to content
Snippets Groups Projects
Commit d8537f4a authored by Thomas Toulorge's avatar Thomas Toulorge
Browse files

Modified JacobianBasis to improve portability

parent 394b3a73
No related branches found
No related tags found
No related merge requests found
...@@ -402,13 +402,12 @@ double JacobianBasis::getPrimJac3D(const fullMatrix<double> &nodesXYZ, bool idea ...@@ -402,13 +402,12 @@ double JacobianBasis::getPrimJac3D(const fullMatrix<double> &nodesXYZ, bool idea
// Calculate (signed, possibly scaled) Jacobian for one element, with normal vectors to straight element // Calculate (signed, possibly scaled) Jacobian for one element, with normal vectors to straight element
// for regularization. Evaluation points depend on the given matrices for shape function gradients. // for regularization. Evaluation points depend on the given matrices for shape function gradients.
template<bool scaling> void JacobianBasis::getJacobianGeneral(int nJacNodes,
inline void JacobianBasis::getJacobianGeneral(int nJacNodes,
const fullMatrix<double> &gSMatX, const fullMatrix<double> &gSMatX,
const fullMatrix<double> &gSMatY, const fullMatrix<double> &gSMatY,
const fullMatrix<double> &gSMatZ, const fullMatrix<double> &gSMatZ,
const fullMatrix<double> &nodesXYZ, const fullMatrix<double> &nodesXYZ,
bool idealNorm, bool idealNorm, bool scaling,
fullVector<double> &jacobian) const fullVector<double> &jacobian) const
{ {
switch (_dim) { switch (_dim) {
...@@ -493,44 +492,17 @@ inline void JacobianBasis::getJacobianGeneral(int nJacNodes, ...@@ -493,44 +492,17 @@ inline void JacobianBasis::getJacobianGeneral(int nJacNodes,
} }
// Calculate signed Jacobian for one element, with normal vectors to straight element for
// regularization. Evaluation points depend on the given matrices for shape function gradients.
void JacobianBasis::getSignedJacobianGeneral(int nJacNodes,
const fullMatrix<double> &gSMatX,
const fullMatrix<double> &gSMatY,
const fullMatrix<double> &gSMatZ,
const fullMatrix<double> &nodesXYZ,
bool idealNorm,
fullVector<double> &jacobian) const
{
getJacobianGeneral<false>(nJacNodes, gSMatX, gSMatY, gSMatZ, nodesXYZ, idealNorm, jacobian);
}
// Calculate (signed) scaled Jacobian for one element, with normal vectors to straight element
// for regularization. Evaluation points depend on the given matrices for shape function gradients.
void JacobianBasis::getScaledJacobianGeneral(int nJacNodes,
const fullMatrix<double> &gSMatX,
const fullMatrix<double> &gSMatY,
const fullMatrix<double> &gSMatZ,
const fullMatrix<double> &nodesXYZ,
bool idealNorm,
fullVector<double> &jacobian) const
{
getJacobianGeneral<true>(nJacNodes, gSMatX, gSMatY, gSMatZ, nodesXYZ, idealNorm, jacobian);
}
// Calculate (signed, possibly scaled) Jacobian for several elements, with normal vectors to straight // Calculate (signed, possibly scaled) Jacobian for several elements, with normal vectors to straight
// elements for regularization. Evaluation points depend on the given matrices for shape function gradients. // elements for regularization. Evaluation points depend on the given matrices for shape function gradients.
// TODO: Optimize and test 1D & 2D // TODO: Optimize and test 1D & 2D
template<bool scaling> void JacobianBasis::getJacobianGeneral(int nJacNodes,
inline void JacobianBasis::getJacobianGeneral(int nJacNodes,
const fullMatrix<double> &gSMatX, const fullMatrix<double> &gSMatX,
const fullMatrix<double> &gSMatY, const fullMatrix<double> &gSMatY,
const fullMatrix<double> &gSMatZ, const fullMatrix<double> &gSMatZ,
const fullMatrix<double> &nodesX, const fullMatrix<double> &nodesX,
const fullMatrix<double> &nodesY, const fullMatrix<double> &nodesY,
const fullMatrix<double> &nodesZ, const fullMatrix<double> &nodesZ,
bool idealNorm, bool idealNorm, bool scaling,
fullMatrix<double> &jacobian) const fullMatrix<double> &jacobian) const
{ {
switch (_dim) { switch (_dim) {
...@@ -636,38 +608,6 @@ inline void JacobianBasis::getJacobianGeneral(int nJacNodes, ...@@ -636,38 +608,6 @@ inline void JacobianBasis::getJacobianGeneral(int nJacNodes,
} }
// Calculate signed Jacobian for several elements, with normal vectors to straight elements for
// regularization. Evaluation points depend on the given matrices for shape function gradients.
void JacobianBasis::getSignedJacobianGeneral(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,
fullMatrix<double> &jacobian) const
{
getJacobianGeneral<false>(nJacNodes, gSMatX, gSMatY, gSMatZ,
nodesX, nodesY, nodesZ, idealNorm, jacobian);
}
// Calculate (signed) scaled Jacobian for several elements, with normal vectors to straight elements
// for regularization. Evaluation points depend on the given matrices for shape function gradients.
void JacobianBasis::getScaledJacobianGeneral(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,
fullMatrix<double> &jacobian) const
{
getJacobianGeneral<true>(nJacNodes, gSMatX, gSMatY, gSMatZ,
nodesX, nodesY, nodesZ, idealNorm, jacobian);
}
// Calculate (signed) Jacobian and its gradients for one element, with normal vectors to straight element // Calculate (signed) Jacobian and its gradients for one element, with normal vectors to straight element
// for regularization. Evaluation points depend on the given matrices for shape function gradients. // for regularization. Evaluation points depend on the given matrices for shape function gradients.
inline void JacobianBasis::getSignedJacAndGradientsGeneral(int nJacNodes, inline void JacobianBasis::getSignedJacAndGradientsGeneral(int nJacNodes,
......
...@@ -112,79 +112,71 @@ public: ...@@ -112,79 +112,71 @@ public:
_gradBasis->gradShapeIdealMatZ, _gradBasis->gradShapeIdealMatZ,
nodesXYZ, normals, JDJ); nodesXYZ, normals, JDJ);
} }
// inline void getSignedIdealJacAndGradientsFast(const fullMatrix<double> &nodesXYZ,
// const fullMatrix<double> &normals, fullMatrix<double> &JDJ) const {
// getSignedIdealJacAndGradientsGeneral(numJacNodesFast,gradShapeMatXFast,gradShapeMatYFast,
// gradShapeMatZFast,nodesXYZ,normals,JDJ);
// }
void getMetricMinAndGradients(const fullMatrix<double> &nodesXYZ, void getMetricMinAndGradients(const fullMatrix<double> &nodesXYZ,
const fullMatrix<double> &nodesXYZStraight, const fullMatrix<double> &nodesXYZStraight,
fullVector<double> &lambdaJ, fullVector<double> &lambdaJ,
fullMatrix<double> &gradLambdaJ) const; fullMatrix<double> &gradLambdaJ) const;
inline void getSignedJacobian(const fullMatrix<double> &nodesXYZ, inline void getSignedJacobian(const fullMatrix<double> &nodesXYZ,
fullVector<double> &jacobian) const { fullVector<double> &jacobian) const {
getSignedJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX, getJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY, _gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ, _gradBasis->gradShapeMatZ,
nodesXYZ, false, jacobian); nodesXYZ, false, false, jacobian);
} }
inline void getSignedJacobian(const fullMatrix<double> &nodesX, inline void getSignedJacobian(const fullMatrix<double> &nodesX,
const fullMatrix<double> &nodesY, const fullMatrix<double> &nodesY,
const fullMatrix<double> &nodesZ, const fullMatrix<double> &nodesZ,
fullMatrix<double> &jacobian) const { fullMatrix<double> &jacobian) const {
getSignedJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX, getJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY, _gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ, _gradBasis->gradShapeMatZ,
nodesX, nodesY, nodesZ, false, jacobian); nodesX, nodesY, nodesZ, false, false, jacobian);
} }
inline void getSignedIdealJacobian(const fullMatrix<double> &nodesXYZ, inline void getSignedIdealJacobian(const fullMatrix<double> &nodesXYZ,
fullVector<double> &jacobian) const { fullVector<double> &jacobian) const {
getSignedJacobianGeneral(numJacNodes, _gradBasis->gradShapeIdealMatX, getJacobianGeneral(numJacNodes, _gradBasis->gradShapeIdealMatX,
_gradBasis->gradShapeIdealMatY, _gradBasis->gradShapeIdealMatY,
_gradBasis->gradShapeIdealMatZ, _gradBasis->gradShapeIdealMatZ,
nodesXYZ, true, jacobian); nodesXYZ, true, false, jacobian);
} }
inline void getSignedIdealJacobian(const fullMatrix<double> &nodesX, inline void getSignedIdealJacobian(const fullMatrix<double> &nodesX,
const fullMatrix<double> &nodesY, const fullMatrix<double> &nodesY,
const fullMatrix<double> &nodesZ, const fullMatrix<double> &nodesZ,
fullMatrix<double> &jacobian) const { fullMatrix<double> &jacobian) const {
getSignedJacobianGeneral(numJacNodes, _gradBasis->gradShapeIdealMatX, getJacobianGeneral(numJacNodes, _gradBasis->gradShapeIdealMatX,
_gradBasis->gradShapeIdealMatY, _gradBasis->gradShapeIdealMatY,
_gradBasis->gradShapeIdealMatZ, _gradBasis->gradShapeIdealMatZ,
nodesX, nodesY, nodesZ, true, jacobian); nodesX, nodesY, nodesZ, true, false, jacobian);
} }
inline void getScaledJacobian(const fullMatrix<double> &nodesXYZ, inline void getScaledJacobian(const fullMatrix<double> &nodesXYZ,
fullVector<double> &jacobian) const { fullVector<double> &jacobian) const {
getScaledJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX, getJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY, _gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ, _gradBasis->gradShapeMatZ,
nodesXYZ, false, jacobian); nodesXYZ, false, true, jacobian);
} }
inline void getScaledJacobian(const fullMatrix<double> &nodesX, inline void getScaledJacobian(const fullMatrix<double> &nodesX,
const fullMatrix<double> &nodesY, const fullMatrix<double> &nodesY,
const fullMatrix<double> &nodesZ, const fullMatrix<double> &nodesZ,
fullMatrix<double> &jacobian) const { fullMatrix<double> &jacobian) const {
getScaledJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX, getJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY, _gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ, _gradBasis->gradShapeMatZ,
nodesX, nodesY, nodesZ, false, jacobian); nodesX, nodesY, nodesZ, false, true, jacobian);
} }
inline void getSignedJacobianFast(const fullMatrix<double> &nodesXYZ, inline void getSignedJacobianFast(const fullMatrix<double> &nodesXYZ,
fullVector<double> &jacobian) const { fullVector<double> &jacobian) const {
getSignedJacobianGeneral(numJacNodesFast, gradShapeMatXFast, getJacobianGeneral(numJacNodesFast, gradShapeMatXFast,
gradShapeMatYFast, gradShapeMatZFast, gradShapeMatYFast, gradShapeMatZFast,
nodesXYZ, false, jacobian); nodesXYZ, false, false, jacobian);
} }
// inline void getSignedIdealJacobianFast(const fullMatrix<double> &nodesXYZ, fullVector<double> &jacobian) const {
// getSignedIdealJacobianGeneral(numJacNodesFast,gradShapeMatXFast,gradShapeMatYFast,gradShapeMatZFast,nodesXYZ,jacobian);
// }
inline void getScaledJacobianFast(const fullMatrix<double> &nodesXYZ, inline void getScaledJacobianFast(const fullMatrix<double> &nodesXYZ,
fullVector<double> &jacobian) const { fullVector<double> &jacobian) const {
getScaledJacobianGeneral(numJacNodesFast, gradShapeMatXFast, getJacobianGeneral(numJacNodesFast, gradShapeMatXFast,
gradShapeMatYFast, gradShapeMatZFast, gradShapeMatYFast, gradShapeMatZFast,
nodesXYZ, false, jacobian); nodesXYZ, false, true, jacobian);
} }
//
inline void lag2Bez(const fullVector<double> &jac, fullVector<double> &bez) const { inline void lag2Bez(const fullVector<double> &jac, fullVector<double> &bez) const {
getBezier()->matrixLag2Bez.mult(jac,bez); getBezier()->matrixLag2Bez.mult(jac,bez);
} }
...@@ -194,26 +186,24 @@ public: ...@@ -194,26 +186,24 @@ public:
inline void primJac2Jac(const fullVector<double> &primJac, fullVector<double> &jac) const { inline void primJac2Jac(const fullVector<double> &primJac, fullVector<double> &jac) const {
matrixPrimJac2Jac.mult(primJac,jac); matrixPrimJac2Jac.mult(primJac,jac);
} }
//
void interpolate(const fullVector<double> &jacobian, void interpolate(const fullVector<double> &jacobian,
const fullMatrix<double> &uvw, const fullMatrix<double> &uvw,
fullMatrix<double> &result, bool areBezier = false) const; fullMatrix<double> &result, bool areBezier = false) const;
//
static int jacobianOrder(int tag); static int jacobianOrder(int tag);
static int jacobianOrder(int parentType, int order); static int jacobianOrder(int parentType, int order);
static FuncSpaceData jacobianMatrixSpace(int type, int order); static FuncSpaceData jacobianMatrixSpace(int type, int order);
private : private :
template<bool scaling>
void getJacobianGeneral(int nJacNodes, void getJacobianGeneral(int nJacNodes,
const fullMatrix<double> &gSMatX, const fullMatrix<double> &gSMatX,
const fullMatrix<double> &gSMatY, const fullMatrix<double> &gSMatY,
const fullMatrix<double> &gSMatZ, const fullMatrix<double> &gSMatZ,
const fullMatrix<double> &nodesXYZ, const fullMatrix<double> &nodesXYZ,
bool idealNorm, fullVector<double> &jacobian) const; bool idealNorm, bool scaling,
template<bool scaling> fullVector<double> &jacobian) const;
void getJacobianGeneral(int nJacNodes, void getJacobianGeneral(int nJacNodes,
const fullMatrix<double> &gSMatX, const fullMatrix<double> &gSMatX,
const fullMatrix<double> &gSMatY, const fullMatrix<double> &gSMatY,
...@@ -221,35 +211,8 @@ public: ...@@ -221,35 +211,8 @@ public:
const fullMatrix<double> &nodesX, const fullMatrix<double> &nodesX,
const fullMatrix<double> &nodesY, const fullMatrix<double> &nodesY,
const fullMatrix<double> &nodesZ, const fullMatrix<double> &nodesZ,
bool idealNorm, fullMatrix<double> &jacobian) const; bool idealNorm, bool scaling,
void getSignedJacobianGeneral(int nJacNodes, fullMatrix<double> &jacobian) const;
const fullMatrix<double> &gSMatX,
const fullMatrix<double> &gSMatY,
const fullMatrix<double> &gSMatZ,
const fullMatrix<double> &nodesXYZ,
bool idealNorm, fullVector<double> &jacobian) const;
void getSignedJacobianGeneral(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, fullMatrix<double> &jacobian) const;
void getScaledJacobianGeneral(int nJacNodes,
const fullMatrix<double> &gSMatX,
const fullMatrix<double> &gSMatY,
const fullMatrix<double> &gSMatZ,
const fullMatrix<double> &nodesXYZ,
bool idealNorm, fullVector<double> &jacobian) const;
void getScaledJacobianGeneral(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, fullMatrix<double> &jacobian) const;
void getSignedJacAndGradientsGeneral(int nJacNodes, void getSignedJacAndGradientsGeneral(int nJacNodes,
const fullMatrix<double> &gSMatX, const fullMatrix<double> &gSMatX,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment