Program listing for file kernel/src/simulationTools/OneStepNSProblem.hpp#
Return to documentation for this file
1#ifndef ONESTEPNSPROBLEM_H
2#define ONESTEPNSPROBLEM_H
3
4#include "SiconosFwd.hpp"
5#include "SiconosVisitor.hpp"
6#include "SimulationTypeDef.hpp"
7#include "SimulationGraphs.hpp"
8
9
10class OneStepNSProblem
11{
12
13protected:
14 ACCEPT_SERIALIZATION(OneStepNSProblem);
15
16
17 SP::SolverOptions _numerics_solver_options;
18
19
20 unsigned int _sizeOutput = 0;
21
22
23 SP::Simulation _simulation;
24
25
26 unsigned int _indexSetLevel = 0;
27
28
29 unsigned int _inputOutputLevel = 0;
30
31
32 unsigned int _maxSize = 0;
33
34
35 std::set<float> _nslawtype;
36
37
38 bool _hasBeenUpdated = false;
39
40
41
42 OneStepNSProblem() = default;
43
44private:
45
46
47 OneStepNSProblem(const OneStepNSProblem&) = delete;
48
49
50 OneStepNSProblem& operator=(const OneStepNSProblem&) = delete;
51
52public:
53
54 OneStepNSProblem(SP::SolverOptions options): _numerics_solver_options(options){};
55
56
57 virtual ~OneStepNSProblem(){};
58
59
60
61
62
63 inline SP::SolverOptions numericsSolverOptions() const
64 {
65 return _numerics_solver_options;
66 };
67
68
69 inline unsigned int getSizeOutput() const
70 {
71 return _sizeOutput;
72 }
73
74
75 inline SP::Simulation simulation() const
76 {
77 return _simulation;
78 }
79
80
81 inline void setSimulationPtr(SP::Simulation newS)
82 {
83 _simulation = newS;
84 }
85
86
87 inline unsigned int indexSetLevel() const
88 {
89 return _indexSetLevel;
90 }
91
92
93 inline void setIndexSetLevel(unsigned int newVal)
94 {
95 _indexSetLevel = newVal;
96 }
97
98
99 inline unsigned int inputOutputLevel() const
100 {
101 return _inputOutputLevel;
102 }
103
104
105 inline void setInputOutputLevel(unsigned int newVal)
106 {
107 _inputOutputLevel = newVal;
108 }
109
110
111 inline unsigned int maxSize() const
112 {
113 return _maxSize;
114 }
115
116
117 inline void setMaxSize(const unsigned int newVal)
118 {
119 _maxSize = newVal;
120 }
121
122
123 void setNumericsVerboseMode(bool vMode);
124
125
126
127 void setNumericsVerboseLevel(int level);
128
129
130 bool hasInteractions() const;
131
132 virtual void display() const {}
133
134
135 virtual void displayBlocks(SP::InteractionsGraph indexSet);
136
137
138 virtual void updateInteractionBlocks();
139
140
141 virtual void computeInteractionBlock(const InteractionsGraph::EDescriptor& ed ) = 0;
142
143
144 virtual void computeDiagonalInteractionBlock(const InteractionsGraph::VDescriptor& vd) = 0;
145
146
147 bool hasBeenUpdated()
148 {
149 return _hasBeenUpdated;
150 }
151
152
153 void setHasBeenUpdated(bool v)
154 {
155 _hasBeenUpdated = v;
156 }
157
158
159 virtual void initialize(SP::Simulation sim);
160
161
162 virtual bool preCompute(double time) = 0;
163
164
165 virtual int compute(double time) = 0;
166
167
168 virtual void postCompute() = 0;
169
170
171 void setSolverId(int solverId);
172
173
174 SP::SimpleMatrix getOSIMatrix(OneStepIntegrator& osi, SP::DynamicalSystem ds);
175
176 VIRTUAL_ACCEPT_VISITORS(OneStepNSProblem);
177
178};
179
180#endif