Program listing for file kernel/src/modelingTools/FirstOrderNonLinearDS.hpp

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
#ifndef FIRSTORDERNONLINEARDS_H
#define FIRSTORDERNONLINEARDS_H

#include "DynamicalSystem.hpp"



class FirstOrderNonLinearDS : public DynamicalSystem
{

private:


  typedef void (*FNLDSPtrfct)(double, unsigned int, const double*, double*, unsigned int, double*);

protected:

  ACCEPT_SERIALIZATION(FirstOrderNonLinearDS);


  void _init(SP::SiconosVector initial_state);


  SP::SiconosMatrix _M;


  SP::SiconosVector _f;



  SP::SiconosVector _fold;


  SP::SiconosMatrix _jacobianfx;


  SP::PluggedObject _pluginf;


  SP::PluggedObject _pluginJacxf;

  SP::PluggedObject _pluginM;


  SiconosMemory _rMemory;


  SP::SiconosMatrix _invM;


  FirstOrderNonLinearDS(): DynamicalSystem() {};


  virtual void _zeroPlugin();


public:




  FirstOrderNonLinearDS(SP::SiconosVector newX0);


  FirstOrderNonLinearDS(SP::SiconosVector newX0, const std::string& fPlugin, const std::string& jacobianfxPlugin);


  FirstOrderNonLinearDS(const FirstOrderNonLinearDS & FONLDS);


  virtual ~FirstOrderNonLinearDS() {};





  virtual void initRhs(double time);


  void initializeNonSmoothInput(unsigned int level) ;


  virtual void computeRhs(double time);


  void computeJacobianRhsx(double time);


  virtual void resetAllNonSmoothParts();


  virtual void resetNonSmoothPart(unsigned int level);






  inline SP::SiconosMatrix M() const
  {
    return _M;
  }


  inline void setMPtr(SP::SiconosMatrix newM)
  {
    _M = newM;
  }



  inline const SimpleMatrix getInvM() const
  {
    return *_invM;
  }


  inline SP::SiconosMatrix invM() const
  {
    return _invM;
  }


  inline SP::SiconosVector f() const
  {
    return _f;
  }


  inline void setFPtr(SP::SiconosVector newPtr)
  {
    _f = newPtr;
  }


  virtual SP::SiconosMatrix jacobianfx() const
  {
    return _jacobianfx;
  }


  inline void setJacobianfxPtr(SP::SiconosMatrix newPtr)
  {
    _jacobianfx = newPtr;
  }








  inline const SiconosMemory& rMemory() const
  {
    return _rMemory;
  }


  inline SP::SiconosVector fold() const
  {
    return _fold;
  }


  void initMemory(unsigned int steps);


  void swapInMemory();








  virtual void updatePlugins(double time);




  void setComputeMFunction(const std::string& pluginPath, const std::string& functionName);


  void setComputeMFunction(FPtr1 fct);


  void setComputeFFunction(const std::string& pluginPath, const std::string& functionName);


  void setComputeFFunction(FPtr1 fct);


  void setComputeJacobianfxFunction(const std::string&  pluginPath, const std::string&  functionName);


  void setComputeJacobianfxFunction(FPtr1 fct);




  void computeM(double time);





  virtual void computef(double time, SP::SiconosVector state);


  virtual void computeJacobianfx(double time, SP::SiconosVector state);


  inline SP::PluggedObject getPluginF() const
  {
    return _pluginf;
  };


  inline SP::PluggedObject getPluginJacxf() const
  {
    return _pluginJacxf;
  };


  inline SP::PluggedObject getPluginM() const
  {
    return _pluginM;
  };







  void display(bool brief = true) const;



  ACCEPT_STD_VISITORS();

};

#endif