OGS
ParameterLib::CoordinateSystem Struct Referencefinal

Detailed Description

Definition at line 26 of file CoordinateSystem.h.

#include <CoordinateSystem.h>

Public Member Functions

 CoordinateSystem (Parameter< double > const &e0, Parameter< double > const &e1)
 
 CoordinateSystem (Parameter< double > const &e0, Parameter< double > const &e1, Parameter< double > const &e2)
 
template<int Dimension>
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
 
template<int Dimension>
Eigen::Matrix< double, Dimension, Dimension > rotateDiagonalTensor (std::vector< double > const &values, SpatialPosition const &pos) const
 
template<>
Eigen::Matrix< double, 2, 2 > transformation (SpatialPosition const &pos) const
 
template<>
Eigen::Matrix< double, 3, 3 > transformation (SpatialPosition const &pos) const
 

Private Attributes

std::array< Parameter< double > const *, 3 > _base
 

Constructor & Destructor Documentation

◆ CoordinateSystem() [1/2]

ParameterLib::CoordinateSystem::CoordinateSystem ( Parameter< double > const &  e0,
Parameter< double > const &  e1 
)

Definition at line 28 of file CoordinateSystem.cpp.

30 : _base{&e0, &e1, nullptr}
31{
32 if (typeid(_base[0]) != typeid(_base[1]))
33 {
35 "The parameter types for the basis must be equal but they are "
36 "'{:s}' and '{:s}'.",
37 typeid(_base[0]).name(),
38 typeid(_base[1]).name());
39 }
40 if (_base[0]->isTimeDependent() || _base[1]->isTimeDependent())
41 {
42 OGS_FATAL("The parameters for the basis must not be time dependent.");
43 }
44 if (_base[0]->getNumberOfGlobalComponents() != 2 ||
45 _base[1]->getNumberOfGlobalComponents() != 2)
46 {
47 OGS_FATAL("The parameters for the 2D basis must have two components.");
48 }
49}
#define OGS_FATAL(...)
Definition: Error.h:26
std::array< Parameter< double > const *, 3 > _base

References _base, and OGS_FATAL.

◆ CoordinateSystem() [2/2]

ParameterLib::CoordinateSystem::CoordinateSystem ( Parameter< double > const &  e0,
Parameter< double > const &  e1,
Parameter< double > const &  e2 
)

Definition at line 51 of file CoordinateSystem.cpp.

54 : _base{&e0, &e1, &e2}
55{
56 if ((typeid(_base[0]) != typeid(_base[1])) ||
57 (typeid(_base[1]) != typeid(_base[2])) ||
58 (typeid(_base[2]) != typeid(_base[0])))
59 {
61 "The parameter types for the basis must be equal but they are "
62 "'{:s}', '{:s}', and '{:s}'.",
63 typeid(_base[0]).name(),
64 typeid(_base[1]).name(),
65 typeid(_base[2]).name());
66 }
67 if (_base[0]->isTimeDependent() || _base[1]->isTimeDependent(),
68 _base[2]->isTimeDependent())
69 {
70 OGS_FATAL("The parameters for the basis must not be time dependent.");
71 }
72 if (_base[0]->getNumberOfGlobalComponents() != 3 ||
73 _base[1]->getNumberOfGlobalComponents() != 3 ||
74 _base[2]->getNumberOfGlobalComponents() != 3)
75 {
77 "The parameters for the 3D basis must have three components.");
78 }
79}

References _base, and OGS_FATAL.

Member Function Documentation

◆ rotateDiagonalTensor()

template<int Dimension>
template Eigen::Matrix< double, 3, 3 > ParameterLib::CoordinateSystem::rotateDiagonalTensor< 3 > ( std::vector< double > const &  values,
SpatialPosition const &  pos 
) const

Definition at line 169 of file CoordinateSystem.cpp.

171{
172 assert(values.size() == Dimension ||
173 "Input vector has wrong dimension; expected 2 or 3 entries.");
174 auto const tensor = Eigen::Map<Eigen::Matrix<double, Dimension, 1> const>(
175 values.data(), Dimension, 1);
176 auto const R = transformation<Dimension>(pos);
177 return R * tensor.asDiagonal() * R.transpose();
178}

◆ rotateTensor()

template<int Dimension>
template Eigen::Matrix< double, 3, 3 > ParameterLib::CoordinateSystem::rotateTensor< 3 > ( std::vector< double > const &  values,
SpatialPosition const &  pos 
) const

Definition at line 155 of file CoordinateSystem.cpp.

157{
158 assert(values.size() == Dimension * Dimension ||
159 "Input vector has wrong dimension; expected 4 or 9 entries.");
160 auto const tensor =
161 Eigen::Map<Eigen::Matrix<double, Dimension, Dimension> const>(
162 values.data(), Dimension, Dimension);
163 auto const R = transformation<Dimension>(pos);
164 return R * tensor * R.transpose();
165}

◆ transformation() [1/3]

template<>
Eigen::Matrix< double, 2, 2 > ParameterLib::CoordinateSystem::transformation ( SpatialPosition const &  pos) const

Definition at line 51 of file CoordinateSystem.cpp.

84{
85 if (_base[2] != nullptr)
86 {
88 "The coordinate system is 3D but a transformation for 2D case is "
89 "requested.");
90 }
91
92 auto e0 = (*_base[0])(0 /* time independent */, pos);
93 auto e1 = (*_base[1])(0 /* time independent */, pos);
94 Eigen::Matrix<double, 2, 2> t;
95 t << e0[0], e1[0], e0[1], e1[1];
96
97#ifndef NDEBUG
98 if (std::abs(t.determinant() - 1) > tolerance)
99 {
100 OGS_FATAL(error_info, t.determinant(), tolerance);
101 }
102#endif // NDEBUG
103 return t;
104}
static double const tolerance
static constexpr char error_info[]

◆ transformation() [2/3]

template<>
Eigen::Matrix< double, 3, 3 > ParameterLib::CoordinateSystem::transformation ( SpatialPosition const &  pos) const

Definition at line 51 of file CoordinateSystem.cpp.

109{
110 if (_base[2] == nullptr)
111 {
112 OGS_FATAL(
113 "The coordinate system is 2D but a transformation for 3D case is "
114 "requested.");
115 }
116
117 auto e0 = (*_base[0])(0 /* time independent */, pos);
118 auto e1 = (*_base[1])(0 /* time independent */, pos);
119 auto e2 = (*_base[2])(0 /* time independent */, pos);
120 Eigen::Matrix<double, 3, 3> t;
121 t << e0[0], e1[0], e2[0], e0[1], e1[1], e2[1], e0[2], e1[2], e2[2];
122
123#ifndef NDEBUG
124 if (std::abs(t.determinant() - 1) > tolerance)
125 {
126 OGS_FATAL(error_info, t.determinant(), tolerance);
127 }
128#endif // NDEBUG
129 return t;
130}

◆ transformation() [3/3]

template<int Dimension>
Eigen::Matrix< double, Dimension, Dimension > ParameterLib::CoordinateSystem::transformation ( SpatialPosition const &  pos) const

◆ transformation_3d()

Eigen::Matrix< double, 3, 3 > ParameterLib::CoordinateSystem::transformation_3d ( SpatialPosition const &  pos) const

Definition at line 132 of file CoordinateSystem.cpp.

134{
135 if (_base[2] != nullptr)
136 {
137 return transformation<3>(pos);
138 }
139
140 auto e0 = (*_base[0])(0 /* time independent */, pos);
141 auto e1 = (*_base[1])(0 /* time independent */, pos);
142 Eigen::Matrix<double, 3, 3> t = Eigen::Matrix<double, 3, 3>::Identity();
143 t.template topLeftCorner<2, 2>() << e0[0], e1[0], e0[1], e1[1];
144
145#ifndef NDEBUG
146 if (std::abs(t.determinant() - 1) > tolerance)
147 {
148 OGS_FATAL(error_info, t.determinant(), tolerance);
149 }
150#endif // NDEBUG
151 return t;
152}

References _base, ParameterLib::error_info, OGS_FATAL, and ParameterLib::tolerance.

Referenced by MaterialPropertyLib::SaturationDependentSwelling::dValue(), and MaterialPropertyLib::SaturationDependentSwelling::value().

Member Data Documentation

◆ _base

std::array<Parameter<double> const*, 3> ParameterLib::CoordinateSystem::_base
private

Definition at line 50 of file CoordinateSystem.h.

Referenced by CoordinateSystem(), and transformation_3d().


The documentation for this struct was generated from the following files: