integration_tools.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_INTEGRATION_TOOLS_HPP
27 #define CASADI_INTEGRATION_TOOLS_HPP
28 
29 #include "casadi/core/function.hpp"
30 
31 namespace casadi {
32 
34 
40  CASADI_EXPORT
41  std::vector<double> collocation_points(casadi_int order, const std::string& scheme="radau");
42 #ifndef SWIG
43  CASADI_EXPORT
44  std::vector<long double> collocation_pointsL(casadi_int order,
45  const std::string& scheme="radau");
46 #endif // SWIG
48 
74  CASADI_EXPORT void
75  collocation_interpolators(const std::vector<double> & tau,
76  std::vector< std::vector<double> > &SWIG_OUTPUT(C),
77  std::vector< double > &SWIG_OUTPUT(D));
78 
116  CASADI_EXPORT void
117  collocation_coeff(const std::vector<double> & tau,
118  DM &SWIG_OUTPUT(C),
119  DM &SWIG_OUTPUT(D),
120  DM &SWIG_OUTPUT(B));
121 
122  // Type of collocation points
124 
136  CASADI_EXPORT Function simpleRK(Function f, casadi_int N=10, casadi_int order=4);
137 
152  CASADI_EXPORT
153  Function simpleIRK(Function f, casadi_int N=10, casadi_int order=4,
154  const std::string& scheme="radau",
155  const std::string& solver="newton",
156  const Dict& solver_options = Dict());
157 
161  CASADI_EXPORT
162  Function simpleIntegrator(Function f, const std::string& integrator="cvodes",
163  const Dict& integrator_options = Dict());
164 
165 
222  CASADI_EXPORT
223  MXDict dae_reduce_index(const MXDict& dae, Dict& SWIG_OUTPUT(stats), const Dict& opts={});
224  CASADI_EXPORT
225  SXDict dae_reduce_index(const SXDict& dae, Dict& SWIG_OUTPUT(stats), const Dict& opts={});
227 
228 
245  CASADI_EXPORT
246  MXDict dae_map_semi_expl(const MXDict& dae, const MXDict& dae_red,
247  Function& SWIG_OUTPUT(state_to_orig), Function& SWIG_OUTPUT(phi));
248  CASADI_EXPORT
249  SXDict dae_map_semi_expl(const SXDict& dae, const SXDict& dae_red,
250  Function& SWIG_OUTPUT(state_to_orig), Function& SWIG_OUTPUT(phi));
252 
280  CASADI_EXPORT
281  Function dae_init_gen(const MXDict& dae, const MXDict& dae_red,
282  const std::string& init_solver, const DMDict& init_strength=DMDict(),
283  const Dict& init_solver_options=Dict());
284  CASADI_EXPORT
285  Function dae_init_gen(const SXDict& dae, const SXDict& dae_red,
286  const std::string& init_solver, const DMDict& init_strength=DMDict(),
287  const Dict& init_solver_options=Dict());
289 
290 } // namespace casadi
291 
292 #endif // CASADI_INTEGRATION_TOOLS_HPP
Function object.
Definition: function.hpp:60
Sparse matrix class. SX and DM are specializations.
Definition: matrix_decl.hpp:92
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:948
CASADI_EXPORT void collocation_coeff(const std::vector< double > &tau, DM &C, DM &D, DM &B)
Obtain collocation interpolating matrices.
CASADI_EXPORT Function dae_init_gen(const MXDict &dae, const MXDict &dae_red, const std::string &init_solver, const DMDict &init_strength=DMDict(), const Dict &init_solver_options=Dict())
Obtain a generator Function for producing consistent initial guesses of a reduced DAE.
CASADI_EXPORT Function simpleRK(Function f, casadi_int N=10, casadi_int order=4)
Construct an explicit Runge-Kutta integrator.
CASADI_EXPORT std::vector< double > collocation_points(casadi_int order, const std::string &scheme="radau")
Obtain collocation points of specific order and scheme.
std::map< std::string, SX > SXDict
Definition: sx_fwd.hpp:40
CASADI_EXPORT MXDict dae_map_semi_expl(const MXDict &dae, const MXDict &dae_red, Function &state_to_orig, Function &phi)
Turn a reduced DAE into a semi explicit form suitable for CasADi integrator.
CASADI_EXPORT void collocation_interpolators(const std::vector< double > &tau, std::vector< std::vector< double > > &C, std::vector< double > &D)
Obtain collocation interpolating matrices.
GenericType::Dict Dict
C++ equivalent of Python's dict or MATLAB's struct.
CASADI_EXPORT MXDict dae_reduce_index(const MXDict &dae, Dict &stats, const Dict &opts={})
Reduce index.
CASADI_EXPORT Function simpleIRK(Function f, casadi_int N=10, casadi_int order=4, const std::string &scheme="radau", const std::string &solver="newton", const Dict &solver_options=Dict())
Construct an implicit Runge-Kutta integrator using a collocation scheme.
CASADI_EXPORT Function simpleIntegrator(Function f, const std::string &integrator="cvodes", const Dict &integrator_options=Dict())
Simplified wrapper for the Integrator class.
std::map< std::string, DM > DMDict
Definition: dm_fwd.hpp:36