Program listing for file kernel/src/simulationTools/ZeroOrderHoldOSI.hpp#
Return to documentation for this file
1#ifndef ZEROORDERHOLD_H
2#define ZEROORDERHOLD_H
3
4#include "OneStepIntegrator.hpp"
5#include "SimpleMatrix.hpp"
6
7const unsigned int ZOHSTEPSINMEMORY = 1;
8
9
10class ZeroOrderHoldOSI : public OneStepIntegrator {
11protected:
12 ACCEPT_SERIALIZATION(ZeroOrderHoldOSI);
13
14
15 struct _NSLEffectOnFreeOutput;
16 friend struct _NSLEffectOnFreeOutput;
17
18
19 bool _useGammaForRelation;
20
21public:
22 enum ZeroOrderHoldOSI_ds_workVector_id {
23 RESIDU_FREE,
24 FREE,
25 DELTA_X_FOR_RELATION,
26 WORK_LENGTH
27 };
28
29 enum ZeroOrderHoldOSI_interaction_workVector_id {
30 OSNSP_RHS,
31 H_ALPHA,
32 WORK_INTERACTION_LENGTH
33 };
34
35 enum ZeroOrderHoldOSI_interaction_workBlockVector_id {
36 xfree,
37 DELTA_X,
38 BLOCK_WORK_LENGTH
39 };
40
41
42 ZeroOrderHoldOSI();
43
44
45 virtual ~ZeroOrderHoldOSI(){};
46
47
48
49
50 const SiconosMatrix &Ad(SP::DynamicalSystem ds);
51
52
53 const SiconosMatrix &Bd(SP::DynamicalSystem ds);
54
55
56
57
58
59
60
61 void initializeWorkVectorsForDS(double t, SP::DynamicalSystem ds) override;
62
63
64 void initializeWorkVectorsForInteraction(Interaction &inter,
65 InteractionProperties &interProp,
66 DynamicalSystemsGraph &DSG) override;
67
68
69 unsigned int numberOfIndexSets() const override { return 1; };
70
71 double computeResidu() override;
72
73
74 void computeFreeState() override;
75
76
77 void computeFreeOutput(InteractionsGraph::VDescriptor &vertex_inter,
78 OneStepNSProblem *osnsp) override;
79
80
81 SiconosVector& osnsp_rhs(InteractionsGraph::VDescriptor& vertex_inter, InteractionsGraph& indexSet) override
82 {
83 return *(*indexSet.properties(vertex_inter).workVectors)[ZeroOrderHoldOSI::OSNSP_RHS];
84 };
85
86
87 bool addInteractionInIndexSet(SP::Interaction inter, unsigned int i) override;
88
89
90 bool removeInteractionFromIndexSet(SP::Interaction inter,
91 unsigned int i) override;
92
93
94 void prepareNewtonIteration(double time) override;
95
96
97 void integrate(double &tinit, double &tend, double &tout,
98 int ¬Used) override;
99
100
101 void updateState(const unsigned int level) override;
102
103
104 void display() override;
105
106 void updateMatrices(SP::DynamicalSystem ds);
107
108 ACCEPT_STD_VISITORS();
109};
110
111#endif