Program listing for file kernel/src/simulationTools/SchatzmanPaoliOSI.hpp#
Return to documentation for this file
1#ifndef SCHATZMANPAOLIOSI_H
2#define SCHATZMANPAOLIOSI_H
3
4#include "OneStepIntegrator.hpp"
5#include "SimpleMatrix.hpp"
6
7const unsigned int SCHATZMANPAOLISTEPSINMEMORY = 2;
8
9
10class SchatzmanPaoliOSI : public OneStepIntegrator {
11public:
12 enum SchatzmanPaoliOSI_ds_workVector_id {
13 RESIDU_FREE,
14 FREE,
15 LOCAL_BUFFER,
16 WORK_LENGTH
17 };
18
19 enum SchatzmanPaoliOSI_interaction_workVector_id {
20 OSNSP_RHS,
21 WORK_INTERACTION_LENGTH
22 };
23
24 enum SchatzmanPaoliOSI_workBlockVector_id { xfree, BLOCK_WORK_LENGTH };
25
26protected:
27
28 ACCEPT_SERIALIZATION(SchatzmanPaoliOSI);
29
30
31 double _theta;
32
33
34 double _gamma;
35
36
37 bool _useGamma;
38
39
40 bool _useGammaForRelation;
41
42
43 struct _NSLEffectOnFreeOutput;
44 friend struct _NSLEffectOnFreeOutput;
45
46
47 SchatzmanPaoliOSI(){};
48
49public:
50
51 SchatzmanPaoliOSI(double theta);
52
53
54 SchatzmanPaoliOSI(double theta, double gamma);
55
56
57 virtual ~SchatzmanPaoliOSI(){};
58
59
60
61
62 const SimpleMatrix getW(SP::DynamicalSystem ds = SP::DynamicalSystem());
63
64
65 SP::SimpleMatrix W(SP::DynamicalSystem ds);
66
67
68 void setW(const SiconosMatrix &newValue, SP::DynamicalSystem ds);
69
70
71 void setWPtr(SP::SimpleMatrix newPtr, SP::DynamicalSystem ds);
72
73
74
75
76 const SimpleMatrix
77 getWBoundaryConditions(SP::DynamicalSystem ds = SP::DynamicalSystem());
78
79
80 SP::SiconosMatrix WBoundaryConditions(SP::DynamicalSystem ds);
81
82
83
84
85 inline double theta() { return _theta; };
86
87
88 inline void setTheta(double newTheta) { _theta = newTheta; };
89
90
91
92
93 inline double gamma() { return _gamma; };
94
95
96 inline void setGamma(double newGamma)
97 {
98 _gamma = newGamma;
99 _useGamma = true;
100 };
101
102
103
104
105 inline bool useGamma() { return _useGamma; };
106
107
108 inline void setUseGamma(bool newUseGamma) { _useGamma = newUseGamma; };
109
110
111 inline bool useGammaForRelation() { return _useGammaForRelation; };
112
113
114 inline void setUseGammaForRelation(bool newUseGammaForRelation)
115 {
116 _useGammaForRelation = newUseGammaForRelation;
117 if (_useGammaForRelation)
118 _useGamma = false;
119 };
120
121
122
123
124 void initializeWorkVectorsForDS(double t, SP::DynamicalSystem ds) override;
125
126
127 void initializeWorkVectorsForInteraction(Interaction &inter,
128 InteractionProperties &interProp,
129 DynamicalSystemsGraph &DSG) override;
130
131
132 unsigned int numberOfIndexSets() const override { return 1; };
133
134 void initializeIterationMatrixW(double time, SP::DynamicalSystem ds);
135
136
137 void computeW(double time, SP::DynamicalSystem ds, SiconosMatrix &W);
138
139
140 void computeWBoundaryConditions(SP::DynamicalSystem ds,
141 SiconosMatrix &WBoundaryConditions);
142
143
144 void initializeIterationMatrixWBoundaryConditions(
145 SP::DynamicalSystem ds, const DynamicalSystemsGraph::VDescriptor &dsv);
146
147
148 double computeResidu() override;
149
150
151 void computeFreeState() override;
152
153
154 void computeFreeOutput(InteractionsGraph::VDescriptor &vertex_inter,
155 OneStepNSProblem *osnsp) override;
156
157
158 SiconosVector& osnsp_rhs(InteractionsGraph::VDescriptor& vertex_inter, InteractionsGraph& indexSet) override
159 {
160 return *(*indexSet.properties(vertex_inter).workVectors)[SchatzmanPaoliOSI::OSNSP_RHS];
161 };
162
163 void prepareNewtonIteration(double time) override;
164
165
166 void integrate(double &tinit, double &tend, double &tout, int &idid) override;
167
168
169 void updateState(const unsigned int level) override;
170
171
172 void display() override;
173
174 ACCEPT_STD_VISITORS();
175};
176
177#endif