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
Özgür Ozan Sen
ogs
Commits
dfcd800e
Commit
dfcd800e
authored
8 months ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[ParL] Extract transformation's det(T)==1 check
parent
c5c66068
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
ParameterLib/CoordinateSystem.cpp
+20
-27
20 additions, 27 deletions
ParameterLib/CoordinateSystem.cpp
with
20 additions
and
27 deletions
ParameterLib/CoordinateSystem.cpp
+
20
−
27
View file @
dfcd800e
...
...
@@ -23,16 +23,26 @@ namespace ParameterLib
{
static
double
const
tolerance
=
std
::
numeric_limits
<
double
>::
epsilon
();
#ifndef NDEBUG
static
constexpr
char
error_info
[]
=
"The determinant of the coordinate system transformation matrix is '{:g}', "
"which is not sufficiently close to unity with the tolerance of '{:g}'. "
"Please adjust the accuracy of the local system bases"
;
static
constexpr
char
normalization_error_info
[]
=
"The direction vector given by parameter {:s} for local_coordinate_system "
"is not normalized to unit length"
;
#endif // NDEBUG
template
<
int
Dim
>
static
void
checkTransformationIsSON
(
Eigen
::
Matrix
<
double
,
Dim
,
Dim
>
const
&
t
)
{
if
(
std
::
abs
(
t
.
determinant
()
-
1
)
>
tolerance
)
{
OGS_FATAL
(
"The determinant of the coordinate system transformation matrix is "
"'{:g}', which is not sufficiently close to unity with the "
"tolerance of '{:g}'. Please adjust the accuracy of the local "
"system bases"
,
t
.
determinant
(),
tolerance
);
}
}
CoordinateSystem
::
CoordinateSystem
(
Parameter
<
double
>
const
&
unit_direction
)
:
_base
{
nullptr
,
nullptr
,
&
unit_direction
},
_has_implicit_base
(
true
)
{
...
...
@@ -117,10 +127,7 @@ Eigen::Matrix<double, 2, 2> getTransformationFromSingleBase2D(
t
<<
normal
[
1
],
normal
[
0
],
-
normal
[
0
],
normal
[
1
];
#ifndef NDEBUG
if
(
std
::
abs
(
t
.
determinant
()
-
1
)
>
tolerance
)
{
OGS_FATAL
(
error_info
,
t
.
determinant
(),
tolerance
);
}
checkTransformationIsSON
(
t
);
#endif // NDEBUG
return
t
;
}
...
...
@@ -148,10 +155,7 @@ Eigen::Matrix<double, 2, 2> CoordinateSystem::transformation<2>(
(
*
_base
[
1
])(
0
/* time independent */
,
pos
).
data
());
#ifndef NDEBUG
if
(
std
::
abs
(
t
.
determinant
()
-
1
)
>
tolerance
)
{
OGS_FATAL
(
error_info
,
t
.
determinant
(),
tolerance
);
}
checkTransformationIsSON
(
t
);
#endif // NDEBUG
return
t
;
}
...
...
@@ -210,12 +214,7 @@ Eigen::Matrix<double, 3, 3> getTransformationFromSingleBase3D(
t
.
col
(
2
)
=
eigen_mapped_e2
;
#ifndef NDEBUG
if
(
std
::
abs
(
t
.
determinant
()
-
1
)
>
tolerance
)
{
OGS_FATAL
(
error_info
,
t
.
determinant
(),
tolerance
);
}
checkTransformationIsSON
(
t
);
#endif // NDEBUG
return
t
;
...
...
@@ -246,10 +245,7 @@ Eigen::Matrix<double, 3, 3> CoordinateSystem::transformation<3>(
(
*
_base
[
2
])(
0
/* time independent */
,
pos
).
data
());
#ifndef NDEBUG
if
(
std
::
abs
(
t
.
determinant
()
-
1
)
>
tolerance
)
{
OGS_FATAL
(
error_info
,
t
.
determinant
(),
tolerance
);
}
checkTransformationIsSON
(
t
);
#endif // NDEBUG
return
t
;
}
...
...
@@ -289,10 +285,7 @@ Eigen::Matrix<double, 3, 3> CoordinateSystem::transformation_3d(
t
.
template
topLeftCorner
<
2
,
2
>()
<<
e0
[
0
],
e1
[
0
],
e0
[
1
],
e1
[
1
];
#ifndef NDEBUG
if
(
std
::
abs
(
t
.
determinant
()
-
1
)
>
tolerance
)
{
OGS_FATAL
(
error_info
,
t
.
determinant
(),
tolerance
);
}
checkTransformationIsSON
(
t
);
#endif // NDEBUG
return
t
;
}
...
...
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