19 using IntegratorAbstract = IntegratorAbstractTpl<Scalar>;
20 using DAEType = ContinuousDynamicsAbstractTpl<Scalar>;
21 using ODEType = ODEAbstractTpl<Scalar>;
25 using PyIntegratorAbstract = internal::PyStageFunction<IntegratorAbstract>;
26 bp::class_<PyIntegratorAbstract, bp::bases<context::DynamicsModel>,
27 boost::noncopyable>(
"IntegratorAbstract",
28 "Base class for numerical integrators.",
29 bp::init<const shared_ptr<DAEType> &>(
30 "Construct the integrator from a DAE.",
31 bp::args(
"self",
"cont_dynamics")))
32 .def_readwrite(
"continuous_dynamics",
33 &IntegratorAbstract::continuous_dynamics_,
34 "The underlying ODE or DAE.")
35 .add_property(
"space",
36 bp::make_function(&IntegratorAbstract::space,
37 bp::return_internal_reference<>()),
38 "Return the state manifold.");
40 bp::register_ptr_to_python<shared_ptr<IntegratorDataTpl<Scalar>>>();
41 bp::class_<IntegratorDataTpl<Scalar>, bp::bases<DynamicsDataTpl<Scalar>>>(
42 "IntegratorData",
"Base class for integrators' data.", bp::no_init)
43 .def_readwrite(
"continuous_data",
48 using ExplicitIntegratorAbstract = ExplicitIntegratorAbstractTpl<Scalar>;
49 using PyExplicitIntegrator =
50 internal::PyExplicitDynamics<ExplicitIntegratorAbstract>;
52 bp::class_<PyExplicitIntegrator, bp::bases<ExplicitDynamicsModelTpl<Scalar>>,
53 boost::noncopyable>(
"ExplicitIntegratorAbstract",
54 bp::init<const shared_ptr<ODEType> &>(
55 "Construct the integrator from an ODE.",
56 bp::args(
"self",
"cont_dynamics")))
57 .def_readonly(
"nx2", &ExplicitIntegratorAbstract::nx2,
58 "Next state dimension.")
59 .def_readwrite(
"differential_dynamics", &ExplicitIntegratorAbstract::ode_,
60 "The underlying differential equation.");
62 bp::register_ptr_to_python<shared_ptr<ExplicitIntegratorDataTpl<Scalar>>>();
63 bp::class_<ExplicitIntegratorDataTpl<Scalar>,
64 bp::bases<ExplicitDynamicsDataTpl<Scalar>>>(
65 "ExplicitIntegratorData",
"Data struct for explicit time integrators.",
67 .def_readwrite(
"continuous_data",
70 bp::class_<IntegratorEulerTpl<Scalar>, bp::bases<ExplicitIntegratorAbstract>>(
72 "The explicit Euler integrator :math:`x' = x \\oplus \\Delta t f(x, u)`; "
73 "this integrator has error :math:`O(\\Delta t)` "
74 "in the time step :math:`\\Delta t`.",
75 bp::init<shared_ptr<ODEType>, Scalar>(
76 bp::args(
"self",
"ode",
"timestep")))
80 bp::class_<IntegratorSemiImplEulerTpl<Scalar>,
81 bp::bases<ExplicitIntegratorAbstract>>(
82 "IntegratorSemiImplEuler",
"The semi implicit Euler integrator.",
83 bp::init<shared_ptr<ODEType>, Scalar>(
84 bp::args(
"self",
"ode",
"timestep")))
87 bp::class_<IntegratorSemiImplDataTpl<Scalar>,
88 bp::bases<ExplicitIntegratorDataTpl<Scalar>>>(
89 "IntegratorSemiImplData", bp::no_init);
91 bp::class_<IntegratorRK2Tpl<Scalar>, bp::bases<ExplicitIntegratorAbstract>>(
92 "IntegratorRK2", bp::init<shared_ptr<ODEType>, Scalar>(
93 bp::args(
"self",
"ode",
"timestep")))
97 bp::class_<IntegratorRK2DataTpl<Scalar>,
98 bp::bases<ExplicitIntegratorDataTpl<Scalar>>>(
"IntegratorRK2Data",
101 using MidpointType = IntegratorMidpointTpl<Scalar>;
102 bp::class_<MidpointType, bp::bases<IntegratorAbstract>>(
103 "IntegratorMidpoint", bp::init<shared_ptr<DAEType>, Scalar>(
104 bp::args(
"self",
"dae",
"timestep")))
105 .def_readwrite(
"timestep", &MidpointType::timestep_,
"Time step.");
107 bp::register_ptr_to_python<shared_ptr<IntegratorMidpointDataTpl<Scalar>>>();
108 bp::class_<IntegratorMidpointDataTpl<Scalar>,
109 bp::bases<IntegratorDataTpl<Scalar>>>(
"IntegratorMidpointData",