Skip to content
Snippets Groups Projects
Commit d47161e7 authored by Dmitri Naumov's avatar Dmitri Naumov Committed by Dmitri Naumov
Browse files

[ParL] Add transformation_3d to coordinate system.

This is explicitly allowing the 2d coordinate system
being given (contrary to the transformation<3> specialization).
parent 639b13a5
No related branches found
No related tags found
No related merge requests found
......@@ -126,6 +126,31 @@ Eigen::Matrix<double, 3, 3> CoordinateSystem::transformation<3>(
return t;
}
Eigen::Matrix<double, 3, 3> CoordinateSystem::transformation_3d(
SpatialPosition const& pos) const
{
if (_base[2] != nullptr)
{
return transformation<3>(pos);
}
auto e0 = (*_base[0])(0 /* time independent */, pos);
auto e1 = (*_base[1])(0 /* time independent */, pos);
Eigen::Matrix<double, 3, 3> t = Eigen::Matrix<double, 3, 3>::Identity();
t.template topLeftCorner<2, 2>() << e0[0], e1[0], e0[1], e1[1];
#ifndef NDEBUG
if (std::abs(t.determinant() - 1) > std::numeric_limits<double>::epsilon())
{
OGS_FATAL(
"The determinant of the coordinate system transformation matrix is "
"'%g', which is not sufficiently close to unity.",
t.determinant());
}
#endif // NDEBUG
return t;
}
template <int Dimension>
Eigen::Matrix<double, Dimension, Dimension> CoordinateSystem::rotateTensor(
std::vector<double> const& values, SpatialPosition const& pos) const
......
......@@ -35,6 +35,9 @@ struct CoordinateSystem final
Eigen::Matrix<double, Dimension, Dimension> transformation(
SpatialPosition const& pos) const;
Eigen::Matrix<double, 3, 3> transformation_3d(
SpatialPosition const& pos) const;
template <int Dimension>
Eigen::Matrix<double, Dimension, Dimension> rotateTensor(
std::vector<double> const& values, SpatialPosition const& pos) const;
......
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