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,14 +402,13 @@ double JacobianBasis::getPrimJac3D(const fullMatrix<double> &nodesXYZ, bool idea
// 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.
template<bool scaling>
inline void JacobianBasis::getJacobianGeneral(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 JacobianBasis::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
{
switch (_dim) {
......@@ -493,45 +492,18 @@ 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
// elements for regularization. Evaluation points depend on the given matrices for shape function gradients.
// TODO: Optimize and test 1D & 2D
template<bool scaling>
inline void JacobianBasis::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,
fullMatrix<double> &jacobian) const
void JacobianBasis::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
{
switch (_dim) {
......@@ -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
// for regularization. Evaluation points depend on the given matrices for shape function gradients.
inline void JacobianBasis::getSignedJacAndGradientsGeneral(int nJacNodes,
......
......@@ -112,79 +112,71 @@ public:
_gradBasis->gradShapeIdealMatZ,
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,
const fullMatrix<double> &nodesXYZStraight,
fullVector<double> &lambdaJ,
fullMatrix<double> &gradLambdaJ) const;
inline void getSignedJacobian(const fullMatrix<double> &nodesXYZ,
fullVector<double> &jacobian) const {
getSignedJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ,
nodesXYZ, false, jacobian);
getJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ,
nodesXYZ, false, false, jacobian);
}
inline void getSignedJacobian(const fullMatrix<double> &nodesX,
const fullMatrix<double> &nodesY,
const fullMatrix<double> &nodesZ,
fullMatrix<double> &jacobian) const {
getSignedJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ,
nodesX, nodesY, nodesZ, false, jacobian);
getJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ,
nodesX, nodesY, nodesZ, false, false, jacobian);
}
inline void getSignedIdealJacobian(const fullMatrix<double> &nodesXYZ,
fullVector<double> &jacobian) const {
getSignedJacobianGeneral(numJacNodes, _gradBasis->gradShapeIdealMatX,
_gradBasis->gradShapeIdealMatY,
_gradBasis->gradShapeIdealMatZ,
nodesXYZ, true, jacobian);
getJacobianGeneral(numJacNodes, _gradBasis->gradShapeIdealMatX,
_gradBasis->gradShapeIdealMatY,
_gradBasis->gradShapeIdealMatZ,
nodesXYZ, true, false, jacobian);
}
inline void getSignedIdealJacobian(const fullMatrix<double> &nodesX,
const fullMatrix<double> &nodesY,
const fullMatrix<double> &nodesZ,
fullMatrix<double> &jacobian) const {
getSignedJacobianGeneral(numJacNodes, _gradBasis->gradShapeIdealMatX,
_gradBasis->gradShapeIdealMatY,
_gradBasis->gradShapeIdealMatZ,
nodesX, nodesY, nodesZ, true, jacobian);
getJacobianGeneral(numJacNodes, _gradBasis->gradShapeIdealMatX,
_gradBasis->gradShapeIdealMatY,
_gradBasis->gradShapeIdealMatZ,
nodesX, nodesY, nodesZ, true, false, jacobian);
}
inline void getScaledJacobian(const fullMatrix<double> &nodesXYZ,
fullVector<double> &jacobian) const {
getScaledJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ,
nodesXYZ, false, jacobian);
getJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ,
nodesXYZ, false, true, jacobian);
}
inline void getScaledJacobian(const fullMatrix<double> &nodesX,
const fullMatrix<double> &nodesY,
const fullMatrix<double> &nodesZ,
fullMatrix<double> &jacobian) const {
getScaledJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ,
nodesX, nodesY, nodesZ, false, jacobian);
getJacobianGeneral(numJacNodes, _gradBasis->gradShapeMatX,
_gradBasis->gradShapeMatY,
_gradBasis->gradShapeMatZ,
nodesX, nodesY, nodesZ, false, true, jacobian);
}
inline void getSignedJacobianFast(const fullMatrix<double> &nodesXYZ,
fullVector<double> &jacobian) const {
getSignedJacobianGeneral(numJacNodesFast, gradShapeMatXFast,
gradShapeMatYFast, gradShapeMatZFast,
nodesXYZ, false, jacobian);
getJacobianGeneral(numJacNodesFast, gradShapeMatXFast,
gradShapeMatYFast, gradShapeMatZFast,
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,
fullVector<double> &jacobian) const {
getScaledJacobianGeneral(numJacNodesFast, gradShapeMatXFast,
gradShapeMatYFast, gradShapeMatZFast,
nodesXYZ, false, jacobian);
getJacobianGeneral(numJacNodesFast, gradShapeMatXFast,
gradShapeMatYFast, gradShapeMatZFast,
nodesXYZ, false, true, jacobian);
}
//
inline void lag2Bez(const fullVector<double> &jac, fullVector<double> &bez) const {
getBezier()->matrixLag2Bez.mult(jac,bez);
}
......@@ -194,26 +186,24 @@ public:
inline void primJac2Jac(const fullVector<double> &primJac, fullVector<double> &jac) const {
matrixPrimJac2Jac.mult(primJac,jac);
}
//
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 :
template<bool scaling>
void getJacobianGeneral(int nJacNodes,
const fullMatrix<double> &gSMatX,
const fullMatrix<double> &gSMatY,
const fullMatrix<double> &gSMatZ,
const fullMatrix<double> &nodesXYZ,
bool idealNorm, fullVector<double> &jacobian) const;
template<bool scaling>
bool idealNorm, bool scaling,
fullVector<double> &jacobian) const;
void getJacobianGeneral(int nJacNodes,
const fullMatrix<double> &gSMatX,
const fullMatrix<double> &gSMatY,
......@@ -221,35 +211,8 @@ public:
const fullMatrix<double> &nodesX,
const fullMatrix<double> &nodesY,
const fullMatrix<double> &nodesZ,
bool idealNorm, fullMatrix<double> &jacobian) const;
void 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;
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;
bool idealNorm, bool scaling,
fullMatrix<double> &jacobian) const;
void getSignedJacAndGradientsGeneral(int nJacNodes,
const fullMatrix<double> &gSMatX,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment