14 #include "eigenIntegration.h" 61 template <
size_t STATE_DIM,
typename SCALAR =
double>
65 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
84 const EventHandlerPtr& eventHandler);
243 template <
typename S = SCALAR>
244 typename std::enable_if<std::is_same<S, double>::value,
void>::type initializeAdaptiveSteppers(
252 std::shared_ptr<internal::StepperODEIntControlled<internal::runge_kutta_dopri5_t<STATE_DIM, SCALAR>,
253 Eigen::Matrix<SCALAR, STATE_DIM, 1>,
SCALAR>>(
255 Eigen::Matrix<SCALAR, STATE_DIM, 1>,
SCALAR>());
264 Eigen::Matrix<SCALAR, STATE_DIM, 1>,
SCALAR>());
271 std::shared_ptr<internal::StepperODEInt<internal::bulirsch_stoer_t<STATE_DIM, SCALAR>,
272 Eigen::Matrix<SCALAR, STATE_DIM, 1>,
SCALAR>>(
274 Eigen::Matrix<SCALAR, STATE_DIM, 1>,
SCALAR>());
282 template <
typename S = SCALAR>
283 typename std::enable_if<!std::is_same<S, double>::value,
void>::type initializeAdaptiveSteppers(
289 template <
typename S = SCALAR>
290 typename std::enable_if<std::is_same<S, ADCGScalar>::value,
void>::type initializeODEIntSteppers(
303 template <
typename S = SCALAR>
304 typename std::enable_if<std::is_same<S, double>::value,
void>::type initializeODEIntSteppers(
311 integratorStepper_ = std::shared_ptr<internal::StepperODEInt<internal::euler_t<STATE_DIM, SCALAR>,
312 Eigen::Matrix<SCALAR, STATE_DIM, 1>,
SCALAR>>(
314 Eigen::Matrix<SCALAR, STATE_DIM, 1>,
SCALAR>());
321 std::shared_ptr<internal::StepperODEInt<internal::runge_kutta_4_t<STATE_DIM, SCALAR>,
322 Eigen::Matrix<SCALAR, STATE_DIM, 1>,
SCALAR>>(
324 Eigen::Matrix<SCALAR, STATE_DIM, 1>,
SCALAR>());
331 std::shared_ptr<internal::StepperODEInt<internal::modified_midpoint_t<STATE_DIM, SCALAR>,
332 Eigen::Matrix<SCALAR, STATE_DIM, 1>,
SCALAR>>(
334 Eigen::Matrix<SCALAR, STATE_DIM, 1>,
SCALAR>());
341 std::shared_ptr<internal::StepperODEInt<internal::runge_kutta_fehlberg78_t<STATE_DIM, SCALAR>,
342 Eigen::Matrix<SCALAR, STATE_DIM, 1>,
SCALAR>>(
344 Eigen::Matrix<SCALAR, STATE_DIM, 1>,
SCALAR>());
375 std::shared_ptr<System<STATE_DIM, SCALAR>> system_;
376 std::function<void(const Eigen::Matrix<SCALAR, STATE_DIM, 1>&, Eigen::Matrix<SCALAR, STATE_DIM, 1>&,
SCALAR)>
378 std::shared_ptr<internal::StepperBase<Eigen::Matrix<SCALAR, STATE_DIM, 1>,
SCALAR>> integratorStepper_;
An discrete array (vector) of a particular data type.
Definition: DiscreteArray.h:22
void integrate_n_steps(StateVector< STATE_DIM, SCALAR > &state, const SCALAR &startTime, size_t numSteps, SCALAR dt, StateVectorArray< STATE_DIM, SCALAR > &stateTrajectory, tpl::TimeArray< SCALAR > &timeTrajectory)
Equidistant integration based on number of time steps and step length.
Definition: Integrator-impl.h:50
std::vector< EventHandlerPtr, Eigen::aligned_allocator< EventHandlerPtr > > EventHandlerPtrVector
Definition: Integrator.h:67
void integrate_adaptive(StateVector< STATE_DIM, SCALAR > &state, const SCALAR &startTime, const SCALAR &finalTime, StateVectorArray< STATE_DIM, SCALAR > &stateTrajectory, tpl::TimeArray< SCALAR > &timeTrajectory, const SCALAR dtInitial=SCALAR(0.01))
integrate forward from an initial to a final time using an adaptive scheme
Definition: Integrator-impl.h:98
Definition: Integrator.h:32
Observer for Integrator.
Definition: Observer.h:27
The interface to call ODEInt Dense Output Integration routines.
Definition: SteppersODEInt.h:110
Definition: Integrator.h:35
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef std::shared_ptr< EventHandler< STATE_DIM, SCALAR > > EventHandlerPtr
Definition: Integrator.h:66
void changeIntegrationType(const IntegrationType &intType)
Changes the integration type.
Definition: Integrator-impl.h:33
CppAD::AD< CppAD::cg::CG< double > > SCALAR
void integrate_times(StateVector< STATE_DIM, SCALAR > &state, const tpl::TimeArray< SCALAR > &timeTrajectory, StateVectorArray< STATE_DIM, SCALAR > &stateTrajectory, SCALAR dtInitial=SCALAR(0.01))
Integrate system using a given time trajectory.
Definition: Integrator-impl.h:124
Definition: StateVector.h:12
Standard Integrator.
Definition: Integrator.h:62
Definition: Integrator.h:33
Definition: Integrator.h:39
An array in time.
Definition: TimeArray.h:22
The interface to call ODEInt Controlled integration routines.
Definition: SteppersODEInt.h:167
Definition: Integrator.h:42
Definition: Integrator.h:37
void integrate_const(StateVector< STATE_DIM, SCALAR > &state, const SCALAR &startTime, const SCALAR &finalTime, SCALAR dt, StateVectorArray< STATE_DIM, SCALAR > &stateTrajectory, tpl::TimeArray< SCALAR > &timeTrajectory)
Equidistant integration based on initial and final time as well as step length.
Definition: Integrator-impl.h:74
Definition: Integrator.h:36
Definition: Integrator.h:41
Definition: Integrator.h:38
Interface class for a general system described by an ordinary differential equation (ODE) ...
Definition: System.h:38
boost::numeric::odeint::runge_kutta_dopri5< Eigen::Matrix< SCALAR, STATE_DIM, 1 >, SCALAR, Eigen::Matrix< SCALAR, STATE_DIM, 1 >, SCALAR, boost::numeric::odeint::vector_space_algebra > runge_kutta_dopri5_t
Runge-Kutta Dormand Price 5 stepper.
Definition: SteppersODEIntDefinitions.h:46
Definition: Integrator.h:40
void setApadativeErrorTolerances(const SCALAR absErrTol, const SCALAR &relErrTol)
Sets the adaptive error tolerances.
Definition: Integrator-impl.h:44
Definition: Integrator.h:34
IntegrationType
The available integration types.
Definition: Integrator.h:30
Integrator(const std::shared_ptr< System< STATE_DIM, SCALAR >> &system, const IntegrationType &intType=IntegrationType::EULERCT, const EventHandlerPtrVector &eventHandlers=EventHandlerPtrVector(0))
constructor
Definition: Integrator-impl.h:13
The interface to call the integration routines from ODEInt.
Definition: SteppersODEInt.h:23