Geomi
Geomi
trash
LieMidpointStep.hpp
1
#ifndef DEF_LIE_MIDPOINT_STEP
2
#define DEF_LIE_MIDPOINT_STEP
3
4
/*
5
#include "include/Problem/ProblemInterface.hpp"
6
#include "include/Common/NOXVector.hpp"
7
#include "include/Step/AbstractStep.hpp"
8
9
bool isZero (double);
10
11
template <typename T_M, typename T_Q, typename T_LIE_ALGEBRA>
12
class LieMidpointStep : public Abstract::Step<T_Q>
13
{
14
private:
15
// Number of calls to computeF
16
int fevals;
17
// Initial guess
18
T_LIE_ALGEBRA initialGuess;
19
// Correct answer
20
T_LIE_ALGEBRA solution;
21
// Y0
22
T_Q y0;
23
// time step
24
T_M h;
25
// The interface
26
Abstract::Problem<T_M,T_Q,T_LIE_ALGEBRA>& m_interface;
27
28
public:
29
30
LieMidpointStep<T_M,T_Q,T_LIE_ALGEBRA>
31
( Abstract::Problem<T_M,T_Q,T_LIE_ALGEBRA>& interface,
32
T_M h_var,
33
T_Q y0_var) :
34
m_interface(interface),
35
h(h_var),
36
y0(y0_var)
37
{
38
fevals = 0;
39
40
initialGuess = T_LIE_ALGEBRA::Zero();
41
solution = T_LIE_ALGEBRA::Zero();
42
}
43
44
~LieMidpointStep<T_M,T_Q,T_LIE_ALGEBRA> ()
45
{ }
46
47
void
48
setData (T_M h_var, T_Q y0_var)
49
{
50
h = h_var;
51
y0 = y0_var;
52
}
53
54
T_Q
55
reconstruct (const NOXVector<T_Q::DOF>& w)
56
{
57
return T_Q(T_LIE_ALGEBRA(w).exp()*y0);
58
}
59
60
const NOXVector<T_Q::DOF>
61
getInitialGuess (void)
62
{
63
return initialGuess.toNOXVector();
64
}
65
66
const T_LIE_ALGEBRA&
67
getSolution (void)
68
{
69
return solution;
70
}
71
72
bool
73
computeA (T_LIE_ALGEBRA& A, const T_Q& y)
74
{
75
return m_interface.computeA(A,y);
76
}
77
78
bool
79
computeJacobianA (std::vector<T_LIE_ALGEBRA>& JA, const T_Q& y)
80
{
81
return m_interface.computeJacobianA(JA,y);
82
}
83
84
bool
85
computeF (NOXVector<T_Q::DOF>& f, const NOXVector<T_Q::DOF>& x)
86
{
87
int i;
88
T_LIE_ALGEBRA w0(x);
89
T_LIE_ALGEBRA w1(w0*0.5);
90
T_LIE_ALGEBRA A;
91
m_interface.computeA(A,w1.exp()*y0);
92
T_LIE_ALGEBRA res(h*A-w1);
93
94
f = res.toVector();
95
96
fevals++;
97
return true;
98
}
99
100
// Voir calculs cahier III p.80 et surtout p.95
101
bool
102
computeJacobian (Eigen::Matrix<double,T_Q::DOF,T_Q::DOF>& J, const NOXVector<T_Q::DOF>& x)
103
{
104
int i,j;
105
T_LIE_ALGEBRA w(x);
106
T_LIE_ALGEBRA w1(w*0.5);
107
108
T_Q Y = w1.exp()*y0;
109
110
std::vector<T_LIE_ALGEBRA> JA;
111
this->computeJacobianA(JA,Y);
112
113
Eigen::Matrix<double,3,3> partialExp;
114
Eigen::Matrix<double,3,1> partialF;
115
116
for (i=0; i<T_Q::DOF; i++) {
117
partialF = -T_LIE_ALGEBRA::Generator(i).toVector();
118
partialExp = w1.partialExp(i);
119
for (j=0; j<T_Q::DOF; j++) {
120
partialF += 2.0*h*((JA[j]).toVector()*(partialExp.row(j)*y0));
121
}
122
J.col(i) = partialF;
123
}
124
125
return true;
126
}
127
128
};
129
130
*/
131
#endif
Generated by
1.8.13