Program listing for file kernel/src/simulationTools/NewMarkAlphaOSI.hpp

Program listing for file kernel/src/simulationTools/NewMarkAlphaOSI.hpp#

  1#ifndef NEWMARKALPHAOSI_H
  2#define NEWMARKALPHAOSI_H
  3
  4#include "OneStepIntegrator.hpp"
  5
  6
  7class NewMarkAlphaOSI : public OneStepIntegrator {
  8protected:
  9
 10  ACCEPT_SERIALIZATION(NewMarkAlphaOSI);
 11
 12  double _beta, _gamma, _alpha_m, _alpha_f;
 13
 14
 15  unsigned int _orderDenseOutput;
 16
 17
 18  bool _IsVelocityLevel;
 19
 20
 21  NewMarkAlphaOSI(){};
 22
 23public:
 24  enum NewMarkAlphaOSI_ds_workVector_id {
 25    RESIDU_FREE,
 26    FREE,
 27    ACCE_LIKE,
 28    ACCE_MEMORY,
 29    WORK_LENGTH
 30  };
 31
 32  enum NewMarkAlphaOSI_interaction_workVector_id {
 33    OSNSP_RHS,
 34    WORK_INTERACTION_LENGTH
 35  };
 36
 37  enum NewMarkAlphaOSI_workBlockVector_id { xfree, BLOCK_WORK_LENGTH };
 38
 39  enum NewMarkAlphaOSI_interaction_workMat_id {
 40    DENSE_OUTPUT_COEFFICIENTS,
 41    MAT_WORK_LENGTH
 42  };
 43
 44
 45  NewMarkAlphaOSI(double beta, double gamma, double alpha_m, double alpha_f,
 46                  bool flag);
 47
 48
 49  NewMarkAlphaOSI(double rho_infty, bool flag);
 50
 51
 52  virtual ~NewMarkAlphaOSI(){};
 53
 54
 55
 56
 57  inline void setBeta(double beta) { _beta = beta; };
 58
 59
 60  inline void setGamma(double value_gamma) { _gamma = value_gamma; };
 61
 62
 63
 64  inline void setAlpha_m(double value_alpha_m) { _alpha_m = value_alpha_m; };
 65
 66
 67
 68  inline void setAlpha_f(double value_alpha_f) { _alpha_f = value_alpha_f; };
 69
 70
 71
 72  inline void setParametersFromRho_infty(double rho_infty)
 73  {
 74    _alpha_m = (2 * rho_infty - 1) / (rho_infty + 1);
 75    _alpha_f = rho_infty / (rho_infty + 1);
 76    _gamma = 0.5 + _alpha_f - _alpha_m;
 77    _beta = 0.25 * std::pow((_gamma + 0.5), 2);
 78  };
 79
 80
 81  inline double getBeta() { return _beta; };
 82
 83
 84  inline double getGamma() { return _gamma; };
 85
 86
 87  inline double getAlpha_m() { return _alpha_m; };
 88
 89
 90
 91  inline double getAlpha_f() { return _alpha_f; };
 92
 93  inline unsigned int getOrderDenseOutput() { return _orderDenseOutput; }
 94
 95
 96  inline void setFlagVelocityLevel(bool flag) { _IsVelocityLevel = flag; }
 97
 98
 99  inline bool getFlagVelocityLevel() { return _IsVelocityLevel; }
100
101
102  const SimpleMatrix getW(SP::DynamicalSystem ds);
103
104
105  SP::SimpleMatrix W(SP::DynamicalSystem ds);
106
107
108  void initializeIterationMatrixW(SP::DynamicalSystem ds);
109
110
111  void computeW(SP::DynamicalSystem ds, SiconosMatrix &W);
112
113
114  double computeResidu() override;
115
116
117  void computeFreeState() override;
118
119
120  void computeFreeOutput(InteractionsGraph::VDescriptor &vertex_inter,
121                         OneStepNSProblem *osnsp) override;
122
123
124  SiconosVector& osnsp_rhs(InteractionsGraph::VDescriptor& vertex_inter,   InteractionsGraph& indexSet) override
125  {
126    return *(*indexSet.properties(vertex_inter).workVectors)[NewMarkAlphaOSI::OSNSP_RHS];
127  };
128
129
130
131
132
133  void initializeWorkVectorsForDS(double t, SP::DynamicalSystem ds) override;
134
135
136  void initializeWorkVectorsForInteraction(Interaction &inter,
137                                           InteractionProperties &interProp,
138                                           DynamicalSystemsGraph &DSG) override;
139
140
141  unsigned int numberOfIndexSets() const override { return 3; };
142
143
144  void prepareNewtonIteration(double time) override;
145
146
147  void prediction();
148
149
150  void correction();
151
152
153  void integrate(double &tinit, double &tend, double &tout, int &flag) override;
154
155
156  void updateState(const unsigned int level) override;
157
158
159  void computeCoefsDenseOutput(SP::DynamicalSystem ds);
160
161
162  void prepareEventLocalization();
163
164
165  void DenseOutputallDSs(double time);
166
167
168  void display() override;
169
170  ACCEPT_STD_VISITORS();
171};
172
173#endif