Program listing for file kernel/src/modelingTools/FirstOrderNonLinearDS.hpp#
Return to documentation for this file
1#ifndef FIRSTORDERNONLINEARDS_H
2#define FIRSTORDERNONLINEARDS_H
3
4#include "DynamicalSystem.hpp"
5
6
7class FirstOrderNonLinearDS : public DynamicalSystem {
8
9private:
10
11 typedef void (*FNLDSPtrfct)(double, unsigned int, const double *, double *, unsigned int,
12 double *);
13
14protected:
15
16 ACCEPT_SERIALIZATION(FirstOrderNonLinearDS);
17
18
19 void _init(SP::SiconosVector initial_state);
20
21
22 SP::SiconosMatrix _M;
23
24
25 SP::SiconosVector _f;
26
27
28 SP::SiconosVector _fold;
29
30
31 SP::SiconosMatrix _jacobianfx;
32
33
34 SP::PluggedObject _pluginf;
35
36
37 SP::PluggedObject _pluginJacxf;
38
39 SP::PluggedObject _pluginM;
40
41
42 SiconosMemory _rMemory;
43
44
45 SP::SiconosMatrix _invM;
46
47
48 FirstOrderNonLinearDS() : DynamicalSystem(){};
49
50
51 void _zeroPlugin() override;
52
53public:
54
55
56
57 FirstOrderNonLinearDS(SP::SiconosVector newX0);
58
59
60 FirstOrderNonLinearDS(SP::SiconosVector newX0, const std::string &fPlugin,
61 const std::string &jacobianfxPlugin);
62
63
64 FirstOrderNonLinearDS(const FirstOrderNonLinearDS &FONLDS);
65
66
67 virtual ~FirstOrderNonLinearDS(){};
68
69
70 virtual void initRhs(double time) override;
71
72
73 void initializeNonSmoothInput(unsigned int level) override;
74
75
76 void resetToInitialState() override;
77
78
79 virtual void computeRhs(double time) override;
80
81
82 void computeJacobianRhsx(double time) override;
83
84
85 virtual void resetAllNonSmoothParts() override;
86
87
88 virtual void resetNonSmoothPart(unsigned int level) override;
89
90
91 inline SP::SiconosMatrix M() const { return _M; }
92
93
94 inline void setMPtr(SP::SiconosMatrix newM) { _M = newM; }
95
96
97
98 inline const SimpleMatrix getInvM() const { return *_invM; }
99
100
101 inline SP::SiconosMatrix invM() const { return _invM; }
102
103
104 inline SP::SiconosVector f() const { return _f; }
105
106
107 inline void setFPtr(SP::SiconosVector newPtr) { _f = newPtr; }
108
109
110 virtual SP::SiconosMatrix jacobianfx() const { return _jacobianfx; }
111
112
113 inline void setJacobianfxPtr(SP::SiconosMatrix newPtr) { _jacobianfx = newPtr; }
114
115
116 inline const SiconosMemory &rMemory() const { return _rMemory; }
117
118
119 inline SP::SiconosVector fold() const { return _fold; }
120
121
122 void initMemory(unsigned int steps) override;
123
124
125 void swapInMemory() override;
126
127
128 virtual void updatePlugins(double time) override;
129
130
131
132
133 void setComputeMFunction(const std::string &pluginPath, const std::string &functionName);
134
135
136 void setComputeMFunction(FPtr1 fct);
137
138
139 void setComputeFFunction(const std::string &pluginPath, const std::string &functionName);
140
141
142 void setComputeFFunction(FPtr1 fct);
143
144
145 void setComputeJacobianfxFunction(const std::string &pluginPath,
146 const std::string &functionName);
147
148
149 void setComputeJacobianfxFunction(FPtr1 fct);
150
151
152
153
154 void computeM(double time);
155
156
157
158
159
160 virtual void computef(double time, SP::SiconosVector state);
161
162
163 virtual void computeJacobianfx(double time, SP::SiconosVector state);
164
165
166 inline SP::PluggedObject getPluginF() const { return _pluginf; };
167
168
169 inline SP::PluggedObject getPluginJacxf() const { return _pluginJacxf; };
170
171
172 inline SP::PluggedObject getPluginM() const { return _pluginM; };
173
174
175 void display(bool brief = true) const override;
176
177 ACCEPT_STD_VISITORS();
178};
179
180#endif