OGS
anonymous_namespace{MFront.cpp} Namespace Reference

Functions

constexpr std::ptrdiff_t OGSToMFront (std::ptrdiff_t i)
 Converts between OGSes and MFront's Kelvin vector indices. More...
 
constexpr std::ptrdiff_t MFrontToOGS (std::ptrdiff_t i)
 Converts between OGSes and MFront's Kelvin vector indices. More...
 
template<typename Derived >
Derived::PlainObject OGSToMFront (Eigen::DenseBase< Derived > const &m)
 Converts between OGSes and MFront's Kelvin vectors and matrices. More...
 
template<typename Derived >
Derived::PlainObject MFrontToOGS (Eigen::DenseBase< Derived > const &m)
 Converts between OGSes and MFront's Kelvin vectors and matrices. More...
 

Function Documentation

◆ MFrontToOGS() [1/2]

template<typename Derived >
Derived::PlainObject anonymous_namespace{MFront.cpp}::MFrontToOGS ( Eigen::DenseBase< Derived > const &  m)

Converts between OGSes and MFront's Kelvin vectors and matrices.

Definition at line 71 of file MFront.cpp.

72 {
73  static_assert(Derived::RowsAtCompileTime != Eigen::Dynamic, "Error");
74  static_assert(Derived::ColsAtCompileTime != Eigen::Dynamic, "Error");
75 
76  typename Derived::PlainObject n;
77 
78  // optimal for row-major storage order
79  for (std::ptrdiff_t r = 0; r < Eigen::DenseBase<Derived>::RowsAtCompileTime;
80  ++r)
81  {
82  auto const R = MFrontToOGS(r);
83  for (std::ptrdiff_t c = 0;
84  c < Eigen::DenseBase<Derived>::ColsAtCompileTime;
85  ++c)
86  {
87  auto const C = MFrontToOGS(c);
88  n(R, C) = m(r, c);
89  }
90  }
91 
92  return n;
93 }
static const double r
Derived::PlainObject MFrontToOGS(Eigen::DenseBase< Derived > const &m)
Converts between OGSes and MFront's Kelvin vectors and matrices.
Definition: MFront.cpp:71

References MaterialPropertyLib::c, and MathLib::r.

Referenced by MaterialLib::Solids::MFront::MFront< DisplacementDim >::integrateStress().

◆ MFrontToOGS() [2/2]

constexpr std::ptrdiff_t anonymous_namespace{MFront.cpp}::MFrontToOGS ( std::ptrdiff_t  i)
constexpr

Converts between OGSes and MFront's Kelvin vector indices.

Definition at line 36 of file MFront.cpp.

37 {
38  // MFront: 11 22 33 12 13 23
39  // OGS: 11 22 33 12 23 13
40  return OGSToMFront(i); // Same algorithm: indices 4 and 5 swapped.
41 }
Derived::PlainObject OGSToMFront(Eigen::DenseBase< Derived > const &m)
Converts between OGSes and MFront's Kelvin vectors and matrices.
Definition: MFront.cpp:45

References OGSToMFront().

◆ OGSToMFront() [1/2]

template<typename Derived >
Derived::PlainObject anonymous_namespace{MFront.cpp}::OGSToMFront ( Eigen::DenseBase< Derived > const &  m)

Converts between OGSes and MFront's Kelvin vectors and matrices.

Definition at line 45 of file MFront.cpp.

46 {
47  static_assert(Derived::RowsAtCompileTime != Eigen::Dynamic, "Error");
48  static_assert(Derived::ColsAtCompileTime != Eigen::Dynamic, "Error");
49 
50  typename Derived::PlainObject n;
51 
52  // optimal for row-major storage order
53  for (std::ptrdiff_t r = 0; r < Eigen::DenseBase<Derived>::RowsAtCompileTime;
54  ++r)
55  {
56  auto const R = OGSToMFront(r);
57  for (std::ptrdiff_t c = 0;
58  c < Eigen::DenseBase<Derived>::ColsAtCompileTime;
59  ++c)
60  {
61  auto const C = OGSToMFront(c);
62  n(R, C) = m(r, c);
63  }
64  }
65 
66  return n;
67 }

References MaterialPropertyLib::c, and MathLib::r.

Referenced by MaterialLib::Solids::MFront::MFront< DisplacementDim >::integrateStress(), and MFrontToOGS().

◆ OGSToMFront() [2/2]

constexpr std::ptrdiff_t anonymous_namespace{MFront.cpp}::OGSToMFront ( std::ptrdiff_t  i)
constexpr

Converts between OGSes and MFront's Kelvin vector indices.

Definition at line 25 of file MFront.cpp.

26 {
27  // MFront: 11 22 33 12 13 23
28  // OGS: 11 22 33 12 23 13
29  if (i < 4)
30  return i;
31  if (i == 4)
32  return 5;
33  return 4;
34 }