@@ -65,12 +65,16 @@ class IntegratorEuler
65
65
public:
66
66
IntegratorEuler ( const std::string& name )
67
67
: IntegratorAbstract<sigT,coefT>( name )
68
+ , derivativeSOUT(boost::bind(&IntegratorEuler<sigT,coefT>::derivative,this ,_1,_2),
69
+ SOUT,
70
+ " sotIntegratorAbstract(" +name+" )::output(vector)::derivativesout" )
68
71
{
72
+ this ->signalRegistration ( derivativeSOUT );
73
+
69
74
using namespace dg ::command;
70
75
71
76
setSamplingPeriod (0.005 );
72
77
73
- SOUT.addDependency (SIN);
74
78
this ->addCommand (" setSamplingPeriod" ,
75
79
new Setter<IntegratorEuler,double > (*this ,
76
80
&IntegratorEuler::setSamplingPeriod,
@@ -92,6 +96,8 @@ protected:
92
96
std::vector<sigT> inputMemory;
93
97
std::vector<sigT> outputMemory;
94
98
99
+ dg::SignalTimeDependent<sigT, int > derivativeSOUT;
100
+
95
101
double dt;
96
102
double invdt;
97
103
@@ -147,6 +153,16 @@ public:
147
153
return res;
148
154
}
149
155
156
+ sigT& derivative ( sigT& res, int time )
157
+ {
158
+ if (outputMemory.size () < 2 )
159
+ throw dg::ExceptionSignal (dg::ExceptionSignal::GENERIC,
160
+ " Integrator does not compute the derivative." );
161
+
162
+ SOUT.recompute (time);
163
+ res = outputMemory[1 ];
164
+ }
165
+
150
166
void setSamplingPeriod (const double & period)
151
167
{
152
168
dt = period;
0 commit comments