/
casadi_c.h
136 lines (110 loc) · 4.37 KB
/
casadi_c.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
* This file is part of CasADi.
*
* CasADi -- A symbolic framework for dynamic optimization.
* Copyright (C) 2010-2023 Joel Andersson, Joris Gillis, Moritz Diehl,
* KU Leuven. All rights reserved.
* Copyright (C) 2011-2014 Greg Horn
*
* CasADi is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* CasADi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with CasADi; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef CASADI_C_H
#define CASADI_C_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef CASADI_CASADI_HPP
/* Used to manage symbol visibility */
#ifndef CASADI_EXPORT
#define CASADI_EXPORT
#endif /* CASADI_EXPORT */
/* Integer type */
#ifndef casadi_int
#define casadi_int long long int
#endif /* casadi_int */
#endif /* CASADI_CASADI_HPP */
/* ==================================
* Managing CasADi Functions
* ================================== */
/** \brief Read from a serialized CasADi file
*
* Pushes to an internal buffer any Functions found
*
* Not thread-safe
* Return 0 when successful
*/
CASADI_EXPORT int casadi_c_push_file(const char *filename);
/** \brief Unloads the last batch of added Functions
* Not thread-safe
*/
CASADI_EXPORT void casadi_c_pop(void);
/** \brief Unloads all Functions
*
* Not thread-safe
*/
CASADI_EXPORT void casadi_c_clear(void);
/** \brief Show the amount of Functions loaded */
CASADI_EXPORT int casadi_c_n_loaded(void);
/** \brief Get a Function id by name
*
* id is really just a linear index into the loaded Functions vector
*/
CASADI_EXPORT int casadi_c_id(const char* funname);
CASADI_EXPORT int casadi_c_activate(int id);
/** \brief Get name of Function */
CASADI_EXPORT const char* casadi_c_name();
CASADI_EXPORT const char* casadi_c_name_id(int id);
/** \brief Get width of integer type casadi_int */
CASADI_EXPORT int casadi_c_int_width();
/** \brief Get width of real type double */
CASADI_EXPORT int casadi_c_real_width();
/* ===================================================
* Codegen-like API for evaluating CasADi Functions
* =================================================== */
CASADI_EXPORT void casadi_c_incref(void);
CASADI_EXPORT void casadi_c_decref(void);
CASADI_EXPORT int casadi_c_checkout(void);
CASADI_EXPORT void casadi_c_release(int mem);
CASADI_EXPORT double casadi_c_default_in(casadi_int i);
CASADI_EXPORT casadi_int casadi_c_n_in(void);
CASADI_EXPORT casadi_int casadi_c_n_out(void);
CASADI_EXPORT const char* casadi_c_name_in(casadi_int i);
CASADI_EXPORT const char* casadi_c_name_out(casadi_int i);
CASADI_EXPORT const casadi_int* casadi_c_sparsity_in(casadi_int i);
CASADI_EXPORT const casadi_int* casadi_c_sparsity_out(casadi_int i);
CASADI_EXPORT int casadi_c_work(casadi_int *sz_arg, casadi_int* sz_res,
casadi_int *sz_iw, casadi_int *sz_w);
CASADI_EXPORT int casadi_c_eval(const double** arg, double** res,
casadi_int* iw, double* w, int mem);
CASADI_EXPORT void casadi_c_incref_id(int id);
CASADI_EXPORT void casadi_c_decref_id(int id);
CASADI_EXPORT int casadi_c_checkout_id(int id);
CASADI_EXPORT void casadi_c_release_id(int id, int mem);
CASADI_EXPORT double casadi_c_default_in_id(int id, casadi_int i);
CASADI_EXPORT casadi_int casadi_c_n_in_id(int id);
CASADI_EXPORT casadi_int casadi_c_n_out_id(int id);
CASADI_EXPORT const char* casadi_c_name_in_id(int id, casadi_int i);
CASADI_EXPORT const char* casadi_c_name_out_id(int id, casadi_int i);
CASADI_EXPORT const casadi_int* casadi_c_sparsity_in_id(int id, casadi_int i);
CASADI_EXPORT const casadi_int* casadi_c_sparsity_out_id(int id, casadi_int i);
CASADI_EXPORT int casadi_c_work_id(int id, casadi_int *sz_arg, casadi_int* sz_res,
casadi_int *sz_iw, casadi_int *sz_w);
CASADI_EXPORT int casadi_c_eval_id(int id, const double** arg, double** res,
casadi_int* iw, double* w, int mem);
#ifdef __cplusplus
}
#endif
#endif /* CASADI_C_H */