Program listing for file kernel/src/simulationTools/SchatzmanPaoliOSI.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
#ifndef SCHATZMANPAOLIOSI_H
#define SCHATZMANPAOLIOSI_H

#include "OneStepIntegrator.hpp"
#include "SimpleMatrix.hpp"


const unsigned int SCHATZMANPAOLISTEPSINMEMORY = 2;


class SchatzmanPaoliOSI : public OneStepIntegrator
{
public:

  enum SchatzmanPaoliOSI_ds_workVector_id {RESIDU_FREE, FREE, LOCAL_BUFFER, WORK_LENGTH};

  enum SchatzmanPaoliOSI_interaction_workVector_id{OSNSP_RHS, WORK_INTERACTION_LENGTH};

  enum SchatzmanPaoliOSI_workBlockVector_id{xfree, BLOCK_WORK_LENGTH};

protected:

  ACCEPT_SERIALIZATION(SchatzmanPaoliOSI);




  double _theta;


  double _gamma;


  bool _useGamma;


  bool _useGammaForRelation;


  struct _NSLEffectOnFreeOutput;
  friend struct _NSLEffectOnFreeOutput;




  SchatzmanPaoliOSI() {};

public:


  SchatzmanPaoliOSI(double theta);


  SchatzmanPaoliOSI(double theta, double gamma);


  virtual ~SchatzmanPaoliOSI() {};




  const SimpleMatrix getW(SP::DynamicalSystem ds = SP::DynamicalSystem());


  SP::SimpleMatrix W(SP::DynamicalSystem ds);


  void setW(const SiconosMatrix& newValue, SP::DynamicalSystem ds);


  void setWPtr(SP::SimpleMatrix newPtr, SP::DynamicalSystem ds);




  const SimpleMatrix getWBoundaryConditions(SP::DynamicalSystem ds = SP::DynamicalSystem());


  SP::SiconosMatrix WBoundaryConditions(SP::DynamicalSystem ds);




  inline double theta()
  {
    return _theta;
  };


  inline void setTheta(double newTheta)
  {
    _theta = newTheta;
  };




  inline double gamma()
  {
    return _gamma;
  };


  inline void setGamma(double newGamma)
  {
    _gamma = newGamma;
    _useGamma = true;
  };




  inline bool useGamma()
  {
    return _useGamma;
  };


  inline void setUseGamma(bool newUseGamma)
  {
    _useGamma = newUseGamma;
  };


  inline bool useGammaForRelation()
  {
    return _useGammaForRelation;
  };



  inline void setUseGammaForRelation(bool newUseGammaForRelation)
  {
    _useGammaForRelation = newUseGammaForRelation;
    if(_useGammaForRelation) _useGamma = false;
  };








  void initializeWorkVectorsForDS( double t, SP::DynamicalSystem ds);


  void initializeWorkVectorsForInteraction(Interaction &inter,
                 InteractionProperties& interProp,
                 DynamicalSystemsGraph & DSG);


  unsigned int numberOfIndexSets() const {return 1;};

  void initializeIterationMatrixW(double time, SP::DynamicalSystem ds);


  void computeW(double time, SP::DynamicalSystem ds, SiconosMatrix& W);


  void computeWBoundaryConditions(SP::DynamicalSystem ds, SiconosMatrix& WBoundaryConditions);


  void initializeIterationMatrixWBoundaryConditions(SP::DynamicalSystem ds, const DynamicalSystemsGraph::VDescriptor& dsv);


  double computeResidu();


  virtual void computeFreeState();


  virtual void computeFreeOutput(InteractionsGraph::VDescriptor& vertex_inter, OneStepNSProblem* osnsp);

  void prepareNewtonIteration(double time);


  void integrate(double& tinit, double& tend, double& tout, int& idid);


  virtual void updateState(const unsigned int level);


  void display();


  ACCEPT_STD_VISITORS();

};

#endif