Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wenqing
ogs
Commits
ce8417be
Commit
ce8417be
authored
7 years ago
by
Dmitri Naumov
Committed by
wenqing
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[NL] detJ: Improve messages and reduce nesting.
parent
03432a85
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
NumLib/Fem/CoordinatesMapping/NaturalCoordinatesMapping.cpp
+29
-19
29 additions, 19 deletions
NumLib/Fem/CoordinatesMapping/NaturalCoordinatesMapping.cpp
with
29 additions
and
19 deletions
NumLib/Fem/CoordinatesMapping/NaturalCoordinatesMapping.cpp
+
29
−
19
View file @
ce8417be
...
...
@@ -10,6 +10,9 @@
#include
"NaturalCoordinatesMapping.h"
#include
<cassert>
#ifndef NDEBUG
#include
<iostream>
#endif // NDEBUG
#include
"BaseLib/Error.h"
...
...
@@ -96,25 +99,32 @@ computeMappingMatrices(
{
}
static
void
checkJacobianDeterminant
(
const
double
detJ
)
static
void
checkJacobianDeterminant
(
const
double
detJ
,
MeshLib
::
Element
const
&
element
)
{
if
(
detJ
<=
.0
)
if
(
detJ
>
0
)
// The usual case
return
;
if
(
detJ
<
0
)
{
if
(
detJ
==
.0
)
{
OGS_FATAL
(
"det J is zero. Please check whether:
\n
"
"
\t
element nodes may have the same coordinates,
\n
"
"
\t
or the coordinates of all nodes are not given in x "
"component for 1D problem,
\n
"
"
\t
or the coordinates of all nodes are not given in x-y "
"components for 2D problem,
\n
"
);
}
ERR
(
"det J = %g is negative for element %d."
,
detJ
,
element
.
getID
());
#ifndef NDEBUG
std
::
cerr
<<
element
<<
"
\n
"
;
#endif // NDEBUG
OGS_FATAL
(
"Please check the node numbering of the element."
);
}
if
(
detJ
==
0
)
{
ERR
(
"det J is zero for element %d."
,
element
.
getID
());
#ifndef NDEBUG
std
::
cerr
<<
element
<<
"
\n
"
;
#endif // NDEBUG
OGS_FATAL
(
"det J = %g is negative. Please check the orientation of the "
"element node numbering
\n
"
,
detJ
);
"Please check whether:
\n
"
"
\t
the element nodes may have the same coordinates,
\n
"
"
\t
or the coordinates of all nodes are not given on the x-axis "
"for a 1D problem or in the xy-plane in the 2D case."
);
}
}
...
...
@@ -146,9 +156,9 @@ computeMappingMatrices(
}
shapemat
.
detJ
=
shapemat
.
J
.
determinant
();
checkJacobianDeterminant
(
shapemat
.
detJ
);
checkJacobianDeterminant
(
shapemat
.
detJ
,
ele
);
}
template
<
class
T_MESH_ELEMENT
,
class
T_SHAPE_FUNC
,
class
T_SHAPE_MATRICES
>
inline
typename
std
::
enable_if
<
T_SHAPE_FUNC
::
DIM
==
0
>::
type
...
...
@@ -189,8 +199,8 @@ computeMappingMatrices(
computeMappingMatrices
<
T_MESH_ELEMENT
,
T_SHAPE_FUNC
,
T_SHAPE_MATRICES
>
(
ele
,
natural_pt
,
ele_local_coord
,
shapemat
,
FieldType
<
ShapeMatrixType
::
DNDR_J
>
());
checkJacobianDeterminant
(
shapemat
.
detJ
);
checkJacobianDeterminant
(
shapemat
.
detJ
,
ele
);
//J^-1, dshape/dx
shapemat
.
invJ
.
noalias
()
=
shapemat
.
J
.
inverse
();
...
...
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