v0.16.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 T1, typename T2, int Dim>
13 return EigenMatrixImp<T1, T2, 3, Dim>(t_val, t_vec).getMat(f);
14}
15
16template <typename T1, typename T2, int Dim>
19 Fun<double> d_f, const int nb) {
20 switch (nb) {
21 case 1:
22 return EigenMatrixImp<T1, T2, 1, Dim>(t_val, t_vec).getDiffMat(f, d_f);
23 case 2:
24 return EigenMatrixImp<T1, T2, 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<T1, T2, 3, Dim>(t_val, t_vec).getDiffMat(f, d_f);
31};
32
33template <typename T1, typename T2, 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<T1, T2, 1, Dim>(t_val, t_vec)
40 .getDiffDiffMat(f, d_f, dd_f, t_S);
41 case 2:
42 return EigenMatrixImp<T1, T2, 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<T1, T2, 3, Dim>(t_val, t_vec)
50 .getDiffDiffMat(f, d_f, dd_f, t_S);
51};
52
55 return getMatImpl<double, double, 3>(t_val, t_vec, f);
56}
57
61 return getMatImpl<FTensor::PackPtr<double *, 3>,
62 FTensor::PackPtr<double *, 9>, 3>(t_val, t_vec, f);
63}
64
68 return getMatImpl<FTensor::PackPtr<double *, 3>,
69 FTensor::CursorPtr<double *, 9>, 3>(t_val, t_vec, f);
70}
71
75 return getMatImpl<FTensor::CursorPtr<double *, 3>,
76 FTensor::CursorPtr<double *, 9>, 3>(t_val, t_vec, f);
77}
78
80 Vec<double, 3> &t_vec,
82 const int nb) {
83 return getDiffMatImpl<double, double, 3>(t_val, t_vec, f, d_f, nb);
84}
85
89 Fun<double> d_f, const int nb) {
90 return getDiffMatImpl<FTensor::PackPtr<double *, 3>,
91 FTensor::PackPtr<double *, 9>, 3>(t_val, t_vec, f, d_f,
92 nb);
93}
94
98 Fun<double> d_f, const int nb) {
99 return getDiffMatImpl<FTensor::PackPtr<double *, 3>,
100 FTensor::CursorPtr<double *, 9>, 3>(t_val, t_vec, f,
101 d_f, nb);
102}
103
107 Fun<double> d_f, const int nb) {
108 return getDiffMatImpl<FTensor::CursorPtr<double *, 3>,
109 FTensor::CursorPtr<double *, 9>, 3>(t_val, t_vec, f,
110 d_f, nb);
111}
112
116 FTensor::Tensor2<double, 3, 3> &t_S, const int nb) {
117 return getDiffDiffMatImpl<double, double, FTensor::Tensor2<double, 3, 3>, 3>(
118 t_val, t_vec, f, d_f, dd_f, t_S, nb);
119}
120
125 FTensor::Tensor2<double, 3, 3> &t_S, const int nb) {
126 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 3>,
129 t_val, t_vec, f, d_f, dd_f, t_S, nb);
130}
131
136 FTensor::Tensor2<double, 3, 3> &t_S, const int nb) {
137 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 3>,
140 t_val, t_vec, f, d_f, dd_f, t_S, nb);
141}
142
147 FTensor::Tensor2<double, 3, 3> &t_S, const int nb) {
148 return getDiffDiffMatImpl<FTensor::CursorPtr<double *, 3>,
151 t_val, t_vec, f, d_f, dd_f, t_S, nb);
152}
153
158 const int nb) {
161 t_val, t_vec, f, d_f, dd_f, t_S, nb);
162}
163
169 const int nb) {
170 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 3>,
173 t_val, t_vec, f, d_f, dd_f, t_S, nb);
174}
175
181 const int nb) {
182 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 3>,
185 t_val, t_vec, f, d_f, dd_f, t_S, nb);
186}
187
193 const int nb) {
194 return getDiffDiffMatImpl<FTensor::CursorPtr<double *, 3>,
197 t_val, t_vec, f, d_f, dd_f, t_S, nb);
198}
199
202 return getMatImpl<double, double, 2>(t_val, t_vec, f);
203}
204
208 return getMatImpl<FTensor::PackPtr<double *, 2>,
209 FTensor::PackPtr<double *, 4>, 2>(t_val, t_vec, f);
210}
211
215 return getMatImpl<FTensor::PackPtr<double *, 2>,
216 FTensor::CursorPtr<double *, 4>, 2>(t_val, t_vec, f);
217}
218
222 return getMatImpl<FTensor::CursorPtr<double *, 2>,
223 FTensor::CursorPtr<double *, 4>, 2>(t_val, t_vec, f);
224}
225
228 return getMatImpl<double, double, 6>(t_val, t_vec, f);
229}
230
232 Vec<double, 2> &t_vec,
234 const int nb) {
235 return getDiffMatImpl<double, double, 2>(t_val, t_vec, f, d_f, nb);
236}
237
241 Fun<double> d_f, const int nb) {
242 return getDiffMatImpl<FTensor::PackPtr<double *, 2>,
243 FTensor::PackPtr<double *, 4>, 2>(t_val, t_vec, f, d_f,
244 nb);
245}
246
250 Fun<double> d_f, const int nb) {
251 return getDiffMatImpl<FTensor::PackPtr<double *, 2>,
252 FTensor::CursorPtr<double *, 4>, 2>(t_val, t_vec, f,
253 d_f, nb);
254}
255
259 Fun<double> d_f, const int nb) {
260 return getDiffMatImpl<FTensor::CursorPtr<double *, 2>,
261 FTensor::CursorPtr<double *, 4>, 2>(t_val, t_vec, f,
262 d_f, nb);
263}
264
268 FTensor::Tensor2<double, 2, 2> &t_S, const int nb) {
269 return getDiffDiffMatImpl<double, double, FTensor::Tensor2<double, 2, 2>, 2>(
270 t_val, t_vec, f, d_f, dd_f, t_S, nb);
271}
272
277 const int nb) {
280 t_val, t_vec, f, d_f, dd_f, t_S, nb);
281}
282
287 FTensor::Tensor2<double, 2, 2> &t_S, const int nb) {
288 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 2>,
291 t_val, t_vec, f, d_f, dd_f, t_S, nb);
292}
293
298 FTensor::Tensor2<double, 2, 2> &t_S, const int nb) {
299 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 2>,
302 t_val, t_vec, f, d_f, dd_f, t_S, nb);
303}
304
309 FTensor::Tensor2<double, 2, 2> &t_S, const int nb) {
310 return getDiffDiffMatImpl<FTensor::CursorPtr<double *, 2>,
313 t_val, t_vec, f, d_f, dd_f, t_S, nb);
314}
315
321 const int nb) {
322 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 2>,
325 t_val, t_vec, f, d_f, dd_f, t_S, nb);
326}
327
333 const int nb) {
334 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 2>,
337 t_val, t_vec, f, d_f, dd_f, t_S, nb);
338}
339
345 const int nb) {
346 return getDiffDiffMatImpl<FTensor::CursorPtr<double *, 2>,
349 t_val, t_vec, f, d_f, dd_f, t_S, nb);
350}
351
363
375
387
399
411
423
435
447
459
471
483
495
496} // namespace EigenMatrix
Tensors class implemented by Walter Landry.
#define THROW_MESSAGE(msg)
Throw MoFEM exception.
FTensor::Tensor2_symmetric< double, Dim > getMatImpl(Val< T1, Dim > &t_val, Vec< T2, Dim > &t_vec, Fun< double > f)
FTensor::Ddg< double, Dim, Dim > getDiffDiffMatImpl(Val< T1, Dim > &t_val, Vec< T2, Dim > &t_vec, Fun< double > f, Fun< double > d_f, Fun< double > dd_f, S &t_S, const int nb)
boost::function< T(const T)> Fun
FTensor::Ddg< double, Dim, Dim > getDiffMatImpl(Val< T1, Dim > &t_val, Vec< T2, 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::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.
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.