Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
d8537f4a
Commit
d8537f4a
authored
10 years ago
by
Thomas Toulorge
Browse files
Options
Downloads
Patches
Plain Diff
Modified JacobianBasis to improve portability
parent
394b3a73
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Numeric/JacobianBasis.cpp
+16
-76
16 additions, 76 deletions
Numeric/JacobianBasis.cpp
Numeric/JacobianBasis.h
+36
-73
36 additions, 73 deletions
Numeric/JacobianBasis.h
with
52 additions
and
149 deletions
Numeric/JacobianBasis.cpp
+
16
−
76
View file @
d8537f4a
...
...
@@ -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
,
...
...
This diff is collapsed.
Click to expand it.
Numeric/JacobianBasis.h
+
36
−
73
View file @
d8537f4a
...
...
@@ -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
{
get
Signed
JacobianGeneral
(
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
{
get
Signed
JacobianGeneral
(
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
{
get
Signed
JacobianGeneral
(
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
{
get
Signed
JacobianGeneral
(
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
{
get
Scaled
JacobianGeneral
(
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
{
get
Scaled
JacobianGeneral
(
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
{
get
Signed
JacobianGeneral
(
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
{
get
Scaled
JacobianGeneral
(
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
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment