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 if (nb < 1 || nb > 3)
38 THROW_MESSAGE("third parameter should be 1,2 or 3");
40 .getDiffDiffMat(f, d_f, dd_f, t_S);
41};
42
45 return getMatImpl<double, double, 3>(t_val, t_vec, f);
46}
47
51 return getMatImpl<FTensor::PackPtr<double *, 3>,
52 FTensor::PackPtr<double *, 9>, 3>(t_val, t_vec, f);
53}
54
58 return getMatImpl<FTensor::PackPtr<double *, 3>,
59 FTensor::CursorPtr<double *, 9>, 3>(t_val, t_vec, f);
60}
61
65 return getMatImpl<FTensor::CursorPtr<double *, 3>,
66 FTensor::CursorPtr<double *, 9>, 3>(t_val, t_vec, f);
67}
68
70 Vec<double, 3> &t_vec,
72 const int nb) {
73 return getDiffMatImpl<double, double, 3>(t_val, t_vec, f, d_f, nb);
74}
75
79 Fun<double> d_f, const int nb) {
80 return getDiffMatImpl<FTensor::PackPtr<double *, 3>,
81 FTensor::PackPtr<double *, 9>, 3>(t_val, t_vec, f, d_f,
82 nb);
83}
84
88 Fun<double> d_f, const int nb) {
89 return getDiffMatImpl<FTensor::PackPtr<double *, 3>,
90 FTensor::CursorPtr<double *, 9>, 3>(t_val, t_vec, f,
91 d_f, nb);
92}
93
97 Fun<double> d_f, const int nb) {
98 return getDiffMatImpl<FTensor::CursorPtr<double *, 3>,
99 FTensor::CursorPtr<double *, 9>, 3>(t_val, t_vec, f,
100 d_f, nb);
101}
102
106 FTensor::Tensor2<double, 3, 3> &t_S, const int nb) {
107 return getDiffDiffMatImpl<double, double, FTensor::Tensor2<double, 3, 3>, 3>(
108 t_val, t_vec, f, d_f, dd_f, t_S, nb);
109}
110
115 FTensor::Tensor2<double, 3, 3> &t_S, const int nb) {
116 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 3>,
119 t_val, t_vec, f, d_f, dd_f, t_S, nb);
120}
121
126 FTensor::Tensor2<double, 3, 3> &t_S, const int nb) {
127 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 3>,
130 t_val, t_vec, f, d_f, dd_f, t_S, nb);
131}
132
137 FTensor::Tensor2<double, 3, 3> &t_S, const int nb) {
138 return getDiffDiffMatImpl<FTensor::CursorPtr<double *, 3>,
141 t_val, t_vec, f, d_f, dd_f, t_S, nb);
142}
143
148 const int nb) {
151 t_val, t_vec, f, d_f, dd_f, t_S, nb);
152}
153
159 const int nb) {
160 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 3>,
163 t_val, t_vec, f, d_f, dd_f, t_S, nb);
164}
165
171 const int nb) {
172 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 3>,
175 t_val, t_vec, f, d_f, dd_f, t_S, nb);
176}
177
183 const int nb) {
184 return getDiffDiffMatImpl<FTensor::CursorPtr<double *, 3>,
187 t_val, t_vec, f, d_f, dd_f, t_S, nb);
188}
189
192 return getMatImpl<double, double, 2>(t_val, t_vec, f);
193}
194
198 return getMatImpl<FTensor::PackPtr<double *, 2>,
199 FTensor::PackPtr<double *, 4>, 2>(t_val, t_vec, f);
200}
201
205 return getMatImpl<FTensor::PackPtr<double *, 2>,
206 FTensor::CursorPtr<double *, 4>, 2>(t_val, t_vec, f);
207}
208
212 return getMatImpl<FTensor::CursorPtr<double *, 2>,
213 FTensor::CursorPtr<double *, 4>, 2>(t_val, t_vec, f);
214}
215
218 return getMatImpl<double, double, 6>(t_val, t_vec, f);
219}
220
222 Vec<double, 2> &t_vec,
224 const int nb) {
225 return getDiffMatImpl<double, double, 2>(t_val, t_vec, f, d_f, nb);
226}
227
231 Fun<double> d_f, const int nb) {
232 return getDiffMatImpl<FTensor::PackPtr<double *, 2>,
233 FTensor::PackPtr<double *, 4>, 2>(t_val, t_vec, f, d_f,
234 nb);
235}
236
240 Fun<double> d_f, const int nb) {
241 return getDiffMatImpl<FTensor::PackPtr<double *, 2>,
242 FTensor::CursorPtr<double *, 4>, 2>(t_val, t_vec, f,
243 d_f, nb);
244}
245
249 Fun<double> d_f, const int nb) {
250 return getDiffMatImpl<FTensor::CursorPtr<double *, 2>,
251 FTensor::CursorPtr<double *, 4>, 2>(t_val, t_vec, f,
252 d_f, nb);
253}
254
258 FTensor::Tensor2<double, 2, 2> &t_S, const int nb) {
259 return getDiffDiffMatImpl<double, double, FTensor::Tensor2<double, 2, 2>, 2>(
260 t_val, t_vec, f, d_f, dd_f, t_S, nb);
261}
262
267 const int nb) {
270 t_val, t_vec, f, d_f, dd_f, t_S, nb);
271}
272
277 FTensor::Tensor2<double, 2, 2> &t_S, const int nb) {
278 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 2>,
281 t_val, t_vec, f, d_f, dd_f, t_S, nb);
282}
283
288 FTensor::Tensor2<double, 2, 2> &t_S, const int nb) {
289 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 2>,
292 t_val, t_vec, f, d_f, dd_f, t_S, nb);
293}
294
299 FTensor::Tensor2<double, 2, 2> &t_S, const int nb) {
300 return getDiffDiffMatImpl<FTensor::CursorPtr<double *, 2>,
303 t_val, t_vec, f, d_f, dd_f, t_S, nb);
304}
305
311 const int nb) {
312 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 2>,
315 t_val, t_vec, f, d_f, dd_f, t_S, nb);
316}
317
323 const int nb) {
324 return getDiffDiffMatImpl<FTensor::PackPtr<double *, 2>,
327 t_val, t_vec, f, d_f, dd_f, t_S, nb);
328}
329
335 const int nb) {
336 return getDiffDiffMatImpl<FTensor::CursorPtr<double *, 2>,
339 t_val, t_vec, f, d_f, dd_f, t_S, nb);
340}
341
353
365
377
389
401
413
425
437
449
461
473
485
486} // 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 getDiffDiffMat(Fun f, Fun d_f, Fun dd_f, T &t_S)
auto getDiffMat(Fun f, Fun d_f)
Get derivative of matrix.