v0.14.0
MatrixFunction.cpp
Go to the documentation of this file.
1 #include <type_traits>
2 #include <FTensor.hpp>
3 #include <MoFEM.hpp>
4 #include <Includes.hpp>
5 #include <MatrixFunction.hpp>
7 
8 namespace EigenMatrix {
9 
10 template <typename T, int Dim>
13  return EigenMatrixImp<T, T, 3, Dim>(t_val, t_vec).getMat(f);
14 }
15 
16 template <typename T, int Dim>
18  Vec<T, Dim> &t_vec, Fun<double> f,
19  Fun<double> d_f, const int nb) {
20  switch (nb) {
21  case 1:
22  return EigenMatrixImp<T, T, 1, Dim>(t_val, t_vec).getDiffMat(f, d_f);
23  case 2:
24  return EigenMatrixImp<T, T, 2, Dim>(t_val, t_vec).getDiffMat(f, d_f);
25  case 3:
26  break;
27  default:
28  THROW_MESSAGE("third parameter should be 1,2 or 3");
29  }
30  return EigenMatrixImp<T, T, 3, Dim>(t_val, t_vec).getDiffMat(f, d_f);
31 };
32 
33 template <typename T, typename S, int Dim>
36  Fun<double> d_f, Fun<double> dd_f, S &t_S, const int nb) {
37  switch (nb) {
38  case 1:
39  return EigenMatrixImp<T, T, 1, Dim>(t_val, t_vec)
40  .getDiffDiffMat(f, d_f, dd_f, t_S);
41  case 2:
42  return EigenMatrixImp<T, T, 2, Dim>(t_val, t_vec)
43  .getDiffDiffMat(f, d_f, dd_f, t_S);
44  case 3:
45  break;
46  default:
47  THROW_MESSAGE("third parameter should be 1,2 or 3");
48  }
49  return EigenMatrixImp<T, T, 3, Dim>(t_val, t_vec)
50  .getDiffDiffMat(f, d_f, dd_f, t_S);
51 };
52 
55  return getMatImpl<double, 3>(t_val, t_vec, f);
56 }
57 
61  return getMatImpl<FTensor::PackPtr<double *, 1>, 3>(t_val, t_vec, f);
62 }
63 
65  Vec<double, 3> &t_vec,
67  const int nb) {
68  return getDiffMatImpl<double, 3>(t_val, t_vec, f, d_f, nb);
69 }
70 
74  Fun<double> d_f, const int nb) {
75  return getDiffMatImpl<FTensor::PackPtr<double *, 1>, 3>(t_val, t_vec, f, d_f,
76  nb);
77 }
78 
82  FTensor::Tensor2<double, 3, 3> &t_S, const int nb) {
83  return getDiffDiffMatImpl<double, FTensor::Tensor2<double, 3, 3>, 3>(
84  t_val, t_vec, f, d_f, dd_f, t_S, nb);
85 }
86 
91  FTensor::Tensor2<double, 3, 3> &t_S, const int nb) {
92  return getDiffDiffMatImpl<FTensor::PackPtr<double *, 1>,
94  t_val, t_vec, f, d_f, dd_f, t_S, nb);
95 }
96 
101  const int nb) {
102  return getDiffDiffMatImpl<double, FTensor::Tensor2_symmetric<double, 3>, 3>(
103  t_val, t_vec, f, d_f, dd_f, t_S, nb);
104 }
105 
111  const int nb) {
112  return getDiffDiffMatImpl<FTensor::PackPtr<double *, 1>,
114  t_val, t_vec, f, d_f, dd_f, t_S, nb);
115 }
116 
119  return getMatImpl<double, 2>(t_val, t_vec, f);
120 }
121 
125  return getMatImpl<FTensor::PackPtr<double *, 1>, 2>(t_val, t_vec, f);
126 }
127 
129  Vec<double, 2> &t_vec,
131  const int nb) {
132  return getDiffMatImpl<double, 2>(t_val, t_vec, f, d_f, nb);
133 }
134 
138  Fun<double> d_f, const int nb) {
139  return getDiffMatImpl<FTensor::PackPtr<double *, 1>, 2>(t_val, t_vec, f, d_f,
140  nb);
141 }
142 
146  FTensor::Tensor2<double, 2, 2> &t_S, const int nb) {
147  return getDiffDiffMatImpl<double, FTensor::Tensor2<double, 2, 2>, 2>(
148  t_val, t_vec, f, d_f, dd_f, t_S, nb);
149 }
150 
155  const int nb) {
156  return getDiffDiffMatImpl<double, FTensor::Tensor2_symmetric<double, 2>, 2>(
157  t_val, t_vec, f, d_f, dd_f, t_S, nb);
158 }
159 
164  FTensor::Tensor2<double, 2, 2> &t_S, const int nb) {
165  return getDiffDiffMatImpl<FTensor::PackPtr<double *, 1>,
167  t_val, t_vec, f, d_f, dd_f, t_S, nb);
168 }
169 
175  const int nb) {
176  return getDiffDiffMatImpl<FTensor::PackPtr<double *, 1>,
178  t_val, t_vec, f, d_f, dd_f, t_S, nb);
179 }
180 
186  const int nb) {
187  return getDiffDiffMatImpl<
190  t_val, t_vec, f, d_f, dd_f, t_S, nb);
191 }
192 
198  const int nb) {
199  return getDiffDiffMatImpl<
202  t_val, t_vec, f, d_f, dd_f, t_S, nb);
203 }
204 
205 } // namespace EigenMatrix
EigenMatrix::EigenMatrixImp::getMat
auto getMat(Fun f)
Get matrix.
Definition: MatrixFunctionTemplate.hpp:874
FTensor::Tensor1
Definition: Tensor1_value.hpp:8
EigenMatrix::getDiffMatImpl
FTensor::Ddg< double, Dim, Dim > getDiffMatImpl(Val< T, Dim > &t_val, Vec< T, Dim > &t_vec, Fun< double > f, Fun< double > d_f, const int nb)
Definition: MatrixFunction.cpp:17
EigenMatrix::getMatSpecial
FTensor::Tensor2_symmetric< double, 3 > getMatSpecial(Val< double, 3 > &t_val, Vec< double, 3 > &t_vec, Fun< double > f)
Get the Mat object.
Definition: MatrixFunction.cpp:54
HenckyOps::d_f
auto d_f
Definition: HenckyOps.hpp:16
MoFEM.hpp
FTensor::Tensor2_symmetric< double, Dim >
THROW_MESSAGE
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
Definition: definitions.h:574
FTensor::Tensor2
Definition: Tensor2_value.hpp:16
Includes.hpp
EigenMatrix::getDiffDiffMatImpl
FTensor::Ddg< double, Dim, Dim > getDiffDiffMatImpl(Val< T, Dim > &t_val, Vec< T, Dim > &t_vec, Fun< double > f, Fun< double > d_f, Fun< double > dd_f, S &t_S, const int nb)
Definition: MatrixFunction.cpp:35
EigenMatrix::EigenMatrixImp::getDiffMat
auto getDiffMat(Fun f, Fun d_f)
Get derivative of matrix.
Definition: MatrixFunctionTemplate.hpp:900
EigenMatrix
Definition: MatrixFunction.cpp:8
EigenMatrix::getDiffMatSpecial
FTensor::Ddg< double, 3, 3 > getDiffMatSpecial(Val< double, 3 > &t_val, Vec< double, 3 > &t_vec, Fun< double > f, Fun< double > d_f, const int nb)
Get the Diff Mat object.
Definition: MatrixFunction.cpp:64
EigenMatrix::getMatImpl
FTensor::Tensor2_symmetric< double, Dim > getMatImpl(Val< T, Dim > &t_val, Vec< T, Dim > &t_vec, Fun< double > f)
Definition: MatrixFunction.cpp:12
MatrixFunction.hpp
FTensor::PackPtr
Definition: FTensor.hpp:54
HenckyOps::dd_f
auto dd_f
Definition: HenckyOps.hpp:17
EigenMatrix::EigenMatrixImp::getDiffDiffMat
auto getDiffDiffMat(Fun f, Fun d_f, Fun dd_f, T &t_S)
Get second directive of matrix.
Definition: MatrixFunctionTemplate.hpp:940
HenckyOps::f
auto f
Definition: HenckyOps.hpp:15
MatrixFunctionTemplate.hpp
FTensor::Ddg< double, Dim, Dim >
EigenMatrix::EigenMatrixImp
Definition: MatrixFunctionTemplate.hpp:799
EigenMatrix::Fun
boost::function< T(const T)> Fun
Definition: MatrixFunction.hpp:68
FTensor.hpp
Tensors class implemented by Walter Landry.
EigenMatrix::getDiffDiffMatSpecial
FTensor::Ddg< double, 3, 3 > getDiffDiffMatSpecial(Val< double, 3 > &t_val, Vec< double, 3 > &t_vec, Fun< double > f, Fun< double > d_f, Fun< double > dd_f, FTensor::Tensor2< double, 3, 3 > &t_S, const int nb)
Get the Diff Diff Mat object.
Definition: MatrixFunction.cpp:80