Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
MostafaMollaali
dynamic
Commits
50cc3a47
Commit
50cc3a47
authored
7 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[ML] KelvinVec; Fix symmetricTensorToKelvinVector.
parent
aefd525c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MathLib/KelvinVector.cpp
+0
-1
0 additions, 1 deletion
MathLib/KelvinVector.cpp
MathLib/KelvinVector.h
+34
-0
34 additions, 0 deletions
MathLib/KelvinVector.h
with
34 additions
and
1 deletion
MathLib/KelvinVector.cpp
+
0
−
1
View file @
50cc3a47
...
@@ -124,6 +124,5 @@ kelvinVectorToSymmetricTensor(Eigen::Matrix<double,
...
@@ -124,6 +124,5 @@ kelvinVectorToSymmetricTensor(Eigen::Matrix<double,
v
.
size
());
v
.
size
());
}
}
}
}
}
// namespace KelvinVector
}
// namespace KelvinVector
}
// namespace MathLib
}
// namespace MathLib
This diff is collapsed.
Click to expand it.
MathLib/KelvinVector.h
+
34
−
0
View file @
50cc3a47
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#pragma once
#pragma once
#include
<Eigen/Dense>
#include
<Eigen/Dense>
#include
"BaseLib/Error.h"
namespace
MathLib
namespace
MathLib
{
{
...
@@ -132,6 +133,8 @@ Eigen::Matrix<double, 3, 3> kelvinVectorToTensor(Eigen::Matrix<double,
...
@@ -132,6 +133,8 @@ Eigen::Matrix<double, 3, 3> kelvinVectorToTensor(Eigen::Matrix<double,
/// In the 3D case the entries for the xx, yy, zz, xy, yz, and xz components in
/// In the 3D case the entries for the xx, yy, zz, xy, yz, and xz components in
/// that particular order are stored.
/// that particular order are stored.
///
///
/// This is opposite of the symmetricTensorToKelvinVector()
///
/// Only implementations for KelvinVectorSize 4 and 6, and dynamic size vectors
/// Only implementations for KelvinVectorSize 4 and 6, and dynamic size vectors
/// are provided.
/// are provided.
template
<
int
KelvinVectorSize
>
template
<
int
KelvinVectorSize
>
...
@@ -143,6 +146,37 @@ kelvinVectorToSymmetricTensor(Eigen::Matrix<double,
...
@@ -143,6 +146,37 @@ kelvinVectorToSymmetricTensor(Eigen::Matrix<double,
KelvinVectorSize
,
KelvinVectorSize
,
1
>
const
&
v
);
1
>
const
&
v
);
/// Conversion of a short vector representation of a
/// symmetric 3x3 matrix to a Kelvin vector.
///
/// This is opposite of the kelvinVectorToSymmetricTensor()
///
/// Only implementations for KelvinVectorSize 4 and 6, and dynamic size vectors
/// are provided.
template
<
typename
Derived
>
Eigen
::
Matrix
<
double
,
Eigen
::
MatrixBase
<
Derived
>::
RowsAtCompileTime
,
1
>
symmetricTensorToKelvinVector
(
Eigen
::
MatrixBase
<
Derived
>
const
&
v
)
{
Eigen
::
Matrix
<
double
,
Eigen
::
MatrixBase
<
Derived
>::
RowsAtCompileTime
,
1
>
result
;
if
(
v
.
size
()
==
4
)
{
result
<<
v
[
0
],
v
[
1
],
v
[
2
],
v
[
3
]
*
std
::
sqrt
(
2.
);
}
else
if
(
v
.
size
()
==
6
)
{
result
<<
v
[
0
],
v
[
1
],
v
[
2
],
v
[
3
]
*
std
::
sqrt
(
2.
),
v
[
4
]
*
std
::
sqrt
(
2.
),
v
[
5
]
*
std
::
sqrt
(
2.
);
}
else
{
OGS_FATAL
(
"Symmetric tensor to Kelvin vector conversion expected an input "
"vector of size 4 or 6, but a vector of size %d was given."
,
v
.
size
());
}
return
result
;
}
}
// namespace KelvinVector
}
// namespace KelvinVector
}
// namespace MathLib
}
// namespace MathLib
...
...
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