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 25 of file CoordinateSystem.cpp.

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

References _base, MaterialPropertyLib::name, and OGS_FATAL.

◆ CoordinateSystem() [2/2]

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

Definition at line 48 of file CoordinateSystem.cpp.

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

References _base, MaterialPropertyLib::name, 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 166 of file CoordinateSystem.cpp.

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

◆ 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 152 of file CoordinateSystem.cpp.

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

◆ transformation() [1/3]

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

Definition at line 48 of file CoordinateSystem.cpp.

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

◆ transformation() [2/3]

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

Definition at line 48 of file CoordinateSystem.cpp.

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

◆ 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 129 of file CoordinateSystem.cpp.

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

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: