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 
54  Vec<double, 3> &t_vec, Fun<double> f) {
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 
66  Fun<double> d_f, const int nb) {
67  return getDiffMatImpl<double, 3>(t_val, t_vec, f, d_f, nb);
68 }
69 
73  Fun<double> d_f, const int nb) {
74  return getDiffMatImpl<FTensor::PackPtr<double *, 1>, 3>(t_val, t_vec, f, d_f,
75  nb);
76 }
77 
82  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 
100  FTensor::Tensor2_symmetric<double, 3> &t_S, const int nb) {
101  return getDiffDiffMatImpl<double, FTensor::Tensor2_symmetric<double, 3>, 3>(
102  t_val, t_vec, f, d_f, dd_f, t_S, nb);
103 }
104 
109  FTensor::Tensor2_symmetric<double, 3> &t_S, const int nb) {
110  return getDiffDiffMatImpl<FTensor::PackPtr<double *, 1>,
112  t_val, t_vec, f, d_f, dd_f, t_S, nb);
113 }
114 
116  Vec<double, 2> &t_vec,
117  Fun<double> f) {
118  return getMatImpl<double, 2>(t_val, t_vec, f);
119 }
120 
122  Vec<double, 2> &t_vec, Fun<double> f,
123  Fun<double> d_f, const int nb) {
124  return getDiffMatImpl<double, 2>(t_val, t_vec, f, d_f, nb);
125 }
126 
128  Vec<double, 2> &t_vec, Fun<double> f,
131  const int nb) {
132  return getDiffDiffMatImpl<double, FTensor::Tensor2<double, 2, 2>, 2>(
133  t_val, t_vec, f, d_f, dd_f, t_S, nb);
134 }
135 
139  FTensor::Tensor2_symmetric<double, 2> &t_S, const int nb) {
140  return getDiffDiffMatImpl<double, FTensor::Tensor2_symmetric<double, 2>, 2>(
141  t_val, t_vec, f, d_f, dd_f, t_S, nb);
142 }
143 
144 } // namespace EigenMatrix
EigenMatrix::getMat
FTensor::Tensor2_symmetric< double, 3 > getMat(Val< double, 3 > &t_val, Vec< double, 3 > &t_vec, Fun< double > f)
Get the Mat object.
Definition: MatrixFunction.cpp:53
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
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::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::getDiffDiffMat
FTensor::Ddg< double, 3, 3 > getDiffDiffMat(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)
Definition: MatrixFunction.cpp:78
EigenMatrix::Fun
boost::function< T(const T)> Fun
Definition: MatrixFunction.hpp:67
FTensor.hpp
Tensors class implemented by Walter Landry.
EigenMatrix::getDiffMat
FTensor::Ddg< double, 3, 3 > getDiffMat(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