v0.16.3
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
227 Vec<double, 2> &t_vec,
229 const int nb) {
230 return getDiffMatImpl<double, double, 2>(t_val, t_vec, f, d_f, nb);
231}
232
236 Fun<double> d_f, const int nb) {
237 return getDiffMatImpl<FTensor::PackPtr<double *, 2>,
238 FTensor::PackPtr<double *, 4>, 2>(t_val, t_vec, f, d_f,
239 nb);
240}
241
245 Fun<double> d_f, const int nb) {
246 return getDiffMatImpl<FTensor::PackPtr<double *, 2>,
247 FTensor::CursorPtr<double *, 4>, 2>(t_val, t_vec, f,
248 d_f, nb);
249}
250
254 Fun<double> d_f, const int nb) {
255 return getDiffMatImpl<FTensor::CursorPtr<double *, 2>,
256 FTensor::CursorPtr<double *, 4>, 2>(t_val, t_vec, f,
257 d_f, nb);
258}
259
263 FTensor::Tensor2<double, 2, 2> &t_S, const int nb) {
264 return getDiffDiffMatImpl<double, double, FTensor::Tensor2<double, 2, 2>, 2>(
265 t_val, t_vec, f, d_f, dd_f, t_S, nb);
266}
267
272 const int nb) {
275 t_val, t_vec, f, d_f, dd_f, t_S, nb);
276}
277
282 FTensor::Tensor2<double, 2, 2> &t_S, const int nb) {
283 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 2>,
286 t_val, t_vec, f, d_f, dd_f, t_S, nb);
287}
288
293 FTensor::Tensor2<double, 2, 2> &t_S, const int nb) {
294 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 2>,
297 t_val, t_vec, f, d_f, dd_f, t_S, nb);
298}
299
304 FTensor::Tensor2<double, 2, 2> &t_S, const int nb) {
305 return getDiffDiffMatImpl<FTensor::CursorPtr<double *, 2>,
308 t_val, t_vec, f, d_f, dd_f, t_S, nb);
309}
310
316 const int nb) {
317 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 2>,
320 t_val, t_vec, f, d_f, dd_f, t_S, nb);
321}
322
328 const int nb) {
329 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 2>,
332 t_val, t_vec, f, d_f, dd_f, t_S, nb);
333}
334
340 const int nb) {
341 return getDiffDiffMatImpl<FTensor::CursorPtr<double *, 2>,
344 t_val, t_vec, f, d_f, dd_f, t_S, nb);
345}
346
358
370
382
394
406
418
430
442
454
466
478
490
491} // 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.