v0.15.0
Loading...
Searching...
No Matches
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
8namespace EigenMatrix {
9
10template <typename T, int Dim>
13 return EigenMatrixImp<T, T, 3, Dim>(t_val, t_vec).getMat(f);
14}
15
16template <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
33template <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
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) {
84 t_val, t_vec, f, d_f, dd_f, t_S, nb);
85}
86
96
101 const int nb) {
103 t_val, t_vec, f, d_f, dd_f, t_S, nb);
104}
105
116
119 return getMatImpl<double, 2>(t_val, t_vec, f);
120}
121
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) {
148 t_val, t_vec, f, d_f, dd_f, t_S, nb);
149}
150
155 const int nb) {
157 t_val, t_vec, f, d_f, dd_f, t_S, nb);
158}
159
169
180
192
204
205} // namespace EigenMatrix
Tensors class implemented by Walter Landry.
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
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)
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)
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.
FTensor::Tensor2_symmetric< double, Dim > getMatImpl(Val< T, Dim > &t_val, Vec< T, Dim > &t_vec, Fun< double > f)
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.
boost::function< T(const T)> Fun
FTensor::Tensor2_symmetric< double, 3 > getMatSpecial(Val< double, 3 > &t_val, Vec< double, 3 > &t_vec, Fun< double > f)
Get the Mat object.
auto getDiffMat(Fun f, Fun d_f)
Get derivative of matrix.
auto getDiffDiffMat(Fun f, Fun d_f, Fun dd_f, T &t_S)
Get second directive of matrix.