integrator.hpp
1 /*
2  * This file is part of CasADi.
3  *
4  * CasADi -- A symbolic framework for dynamic optimization.
5  * Copyright (C) 2010-2023 Joel Andersson, Joris Gillis, Moritz Diehl,
6  * KU Leuven. All rights reserved.
7  * Copyright (C) 2011-2014 Greg Horn
8  *
9  * CasADi is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 3 of the License, or (at your option) any later version.
13  *
14  * CasADi is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with CasADi; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  */
24 
25 
26 #ifndef CASADI_INTEGRATOR_HPP
27 #define CASADI_INTEGRATOR_HPP
28 
29 #include "function.hpp"
30 #include "linsol.hpp"
31 #include "rootfinder.hpp"
32 #include "casadi_enum.hpp"
33 
34 namespace casadi {
35 
86  CASADI_EXPORT Function integrator(const std::string& name, const std::string& solver,
87  const SXDict& dae, const Dict& opts=Dict());
88  CASADI_EXPORT Function integrator(const std::string& name, const std::string& solver,
89  const MXDict& dae, const Dict& opts=Dict());
90  CASADI_EXPORT Function integrator(const std::string& name, const std::string& solver,
91  const Function& dae, const Dict& opts=Dict());
92  CASADI_EXPORT Function integrator(const std::string& name, const std::string& solver,
93  const SXDict& dae, double t0, const std::vector<double>& tout, const Dict& opts=Dict());
94  CASADI_EXPORT Function integrator(const std::string& name, const std::string& solver,
95  const MXDict& dae, double t0, const std::vector<double>& tout, const Dict& opts=Dict());
96  CASADI_EXPORT Function integrator(const std::string& name, const std::string& solver,
97  const Function& dae, double t0, const std::vector<double>& tout, const Dict& opts=Dict());
98 #ifndef SWIGMATLAB
99  CASADI_EXPORT Function integrator(const std::string& name, const std::string& solver,
100  const SXDict& dae, double t0, double tf, const Dict& opts=Dict());
101  CASADI_EXPORT Function integrator(const std::string& name, const std::string& solver,
102  const MXDict& dae, double t0, double tf, const Dict& opts=Dict());
103  CASADI_EXPORT Function integrator(const std::string& name, const std::string& solver,
104  const Function& dae, double t0, double tf, const Dict& opts=Dict());
105 #endif // SWIGMATLAB
107 
109  CASADI_EXPORT bool has_integrator(const std::string& name);
110 
112  CASADI_EXPORT void load_integrator(const std::string& name);
113 
115  CASADI_EXPORT std::string doc_integrator(const std::string& name);
116 
120  CASADI_EXPORT std::vector<std::string> integrator_in();
121 
125  CASADI_EXPORT std::vector<std::string> integrator_out();
126 
130  CASADI_EXPORT std::string integrator_in(casadi_int ind);
131 
135  CASADI_EXPORT std::string integrator_out(casadi_int ind);
136 
140  CASADI_EXPORT casadi_int integrator_n_in();
141 
145  CASADI_EXPORT casadi_int integrator_n_out();
146 
150  CASADI_EXPORT std::vector<std::string> dyn_in();
151 
155  CASADI_EXPORT std::vector<std::string> dyn_out();
156 
160  CASADI_EXPORT std::string dyn_in(casadi_int ind);
161 
165  CASADI_EXPORT std::string dyn_out(casadi_int ind);
166 
170  CASADI_EXPORT casadi_int dyn_n_in();
171 
175  CASADI_EXPORT casadi_int dyn_n_out();
176 
179 #ifndef SWIG
181 enum DynIn {
182  DYN_T,
183  DYN_X,
184  DYN_Z,
185  DYN_P,
186  DYN_U,
187  DYN_NUM_IN};
188 
190 enum DynOut {
191  DYN_ODE,
192  DYN_ALG,
193  DYN_QUAD,
194  DYN_NUM_OUT};
195 
197 enum IntegratorInput {
199  INTEGRATOR_X0,
201  INTEGRATOR_Z0,
203  INTEGRATOR_P,
205  INTEGRATOR_U,
207  INTEGRATOR_ADJ_XF,
209  INTEGRATOR_ADJ_ZF,
211  INTEGRATOR_ADJ_QF,
213  INTEGRATOR_NUM_IN
214 };
215 
217 enum IntegratorOutput {
219  INTEGRATOR_XF,
221  INTEGRATOR_ZF,
223  INTEGRATOR_QF,
225  INTEGRATOR_ADJ_X0,
227  INTEGRATOR_ADJ_Z0,
229  INTEGRATOR_ADJ_P,
231  INTEGRATOR_ADJ_U,
233  INTEGRATOR_NUM_OUT
234 };
235 
238 template<> struct enum_traits<DynIn> {
239  static const size_t n_enum = DYN_NUM_IN;
240 };
241 template<> struct enum_traits<DynOut> {
242  static const size_t n_enum = DYN_NUM_OUT;
243 };
245 
248 CASADI_EXPORT std::string to_string(DynIn v);
249 CASADI_EXPORT std::string to_string(DynOut v);
251 
252 #endif // SWIG
253 
254 } // namespace casadi
255 
256 #endif // CASADI_INTEGRATOR_HPP
Function object.
Definition: function.hpp:60
CASADI_EXPORT bool has_integrator(const std::string &name)
Check if a particular plugin is available.
CASADI_EXPORT casadi_int integrator_n_out()
Get the number of integrator outputs.
CASADI_EXPORT casadi_int dyn_n_in()
Get the number of simulator inputs.
CASADI_EXPORT std::vector< std::string > dyn_out()
Get simulator output scheme of simulators.
CASADI_EXPORT std::vector< std::string > integrator_in()
Get input scheme of integrators.
CASADI_EXPORT void load_integrator(const std::string &name)
Explicitly load a plugin dynamically.
CASADI_EXPORT casadi_int integrator_n_in()
Get the number of integrator inputs.
CASADI_EXPORT std::vector< std::string > integrator_out()
Get integrator output scheme of integrators.
CASADI_EXPORT std::vector< std::string > dyn_in()
Get input scheme of simulators.
CASADI_EXPORT std::string doc_integrator(const std::string &name)
Get the documentation string for a plugin.
CASADI_EXPORT casadi_int dyn_n_out()
Get the number of simulator outputs.
CASADI_EXPORT Function integrator(const std::string &name, const std::string &solver, const SXDict &dae, const Dict &opts=Dict())
The casadi namespace.
std::map< std::string, MX > MXDict
Definition: mx.hpp:943
std::map< std::string, SX > SXDict
Definition: sx_fwd.hpp:40
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.