16template<
typename IntegratorType>
27 template<
typename T,
typename BaseSignalSpec,
typename TangentSignalSpec>
31 const bool& insertIntoHistory =
false)
39 return IntegratorType::integrate(xInt, x, t0, tf, insertIntoHistory);
52 template<
typename T,
typename BaseSignalSpec,
typename TangentSignalSpec>
55 const double& >>>>>>> master tf,
57 const bool& insertIntoHistory =
false)
59 double t_k = xInt.
t();
61 while (t_k < tf && success)
66 double t_kp1 = t_k + dt_k;
67 success &= IntegratorType::integrate(xInt, x, t_k, t_kp1, insertIntoHistory);
97 template<
typename T,
typename BaseSignalSpec,
typename TangentSignalSpec>
102 const bool& insertIntoHistory)
105 return xInt.
update(tf, xInt() + x(tf) * dt, x(tf), insertIntoHistory);
127 template<
typename T,
typename BaseSignalSpec,
typename TangentSignalSpec>
132 const bool& insertIntoHistory)
135 return xInt.
update(tf, xInt() + (x(t0) + x(tf)) * dt / 2.0, x(tf), insertIntoHistory);
157 template<
typename BaseSignalSpec,
typename TangentSignalSpec>
162 const bool& insertIntoHistory)
166 xInt() + (x(t0) + 4.0 * x((t0 + tf) / 2.0) + x(tf)) * dt / 6.0,
172#define MAKE_INTEGRATOR(IntegratorName) typedef Integrator<IntegratorName##IntegratorSpec> IntegratorName##Integrator;
#define MAKE_INTEGRATOR(IntegratorName)
Definition Integration.h:172
Template class for time-series signals with interpolation, extrapolation, and derivative capabilities...
Definition Signal.h:63
double t() const
Get the current time of the signal.
Definition Signal.h:151
bool update(const double &_t, const BaseType &_x, bool insertHistory=false)
Update the signal with a new value at a given time, computing derivative automatically.
Definition Signal.h:270
bool getTimeDelta(double &dt, const double &t0, const double &tf, const double &dt_max=std::numeric_limits< double >::max())
Definition Utils.h:11
Specification for numerically integrating a black box function using Euler's method.
Definition Integration.h:83
static bool integrate(Signal< T, BaseSignalSpec, TangentSignalSpec > &xInt, const Signal< T, TangentSignalSpec, TangentSignalSpec > &x, const double &t0, const double &tf, const bool &insertIntoHistory)
Euler integration implementation.
Definition Integration.h:98
Base type for all integrators.
Definition Integration.h:18
static bool integrate(Signal< T, BaseSignalSpec, TangentSignalSpec > &xInt, const Signal< T, TangentSignalSpec, TangentSignalSpec > &x, const double &tf, const bool &insertIntoHistory=false)
Integrate a signal from the current time to the specified end time.
Definition Integration.h:28
static bool integrate(Signal< T, BaseSignalSpec, TangentSignalSpec > &xInt, const Signal< T, TangentSignalSpec, TangentSignalSpec > &x, const double & > > > > > > > master tf, const double &dt, const bool &insertIntoHistory=false)
Integrate a signal from the current time to the specified end time, chunked up into smaller integrati...
Definition Integration.h:53
Specification for numerically integrating a black box function using Simpson's method.
Definition Integration.h:143
static bool integrate(Signal< BaseSignalSpec, TangentSignalSpec > &xInt, const Signal< TangentSignalSpec, TangentSignalSpec > &x, const double &t0, const double &tf, const bool &insertIntoHistory)
Simpson integration implementation.
Definition Integration.h:158
Specification for numerically integrating a black box function using the Trapezoidal method.
Definition Integration.h:113
static bool integrate(Signal< T, BaseSignalSpec, TangentSignalSpec > &xInt, const Signal< T, TangentSignalSpec, TangentSignalSpec > &x, const double &t0, const double &tf, const bool &insertIntoHistory)
Trapezoidal integration implementation.
Definition Integration.h:128