forked from Sidharth-Prasad/aae497hw4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcasadi_gen.c
146 lines (126 loc) · 3.93 KB
/
casadi_gen.c
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
137
138
139
140
141
142
143
144
145
146
/* This file was automatically generated by CasADi.
The CasADi copyright holders make no ownership claim of its contents. */
#ifdef __cplusplus
extern "C" {
#endif
/* How to prefix internal symbols */
#ifdef CODEGEN_PREFIX
#define NAMESPACE_CONCAT(NS, ID) _NAMESPACE_CONCAT(NS, ID)
#define _NAMESPACE_CONCAT(NS, ID) NS ## ID
#define CASADI_PREFIX(ID) NAMESPACE_CONCAT(CODEGEN_PREFIX, ID)
#else
#define CASADI_PREFIX(ID) casadi_gen_ ## ID
#endif
#include <math.h>
#include <casadi/mem.h>
#ifndef casadi_real
#define casadi_real double
#endif
#ifndef casadi_int
#define casadi_int long long int
#endif
/* Add prefix to internal symbols */
#define casadi_f0 CASADI_PREFIX(f0)
#define casadi_s0 CASADI_PREFIX(s0)
#define casadi_s1 CASADI_PREFIX(s1)
#define casadi_s2 CASADI_PREFIX(s2)
#define casadi_s3 CASADI_PREFIX(s3)
/* Symbol visibility in DLLs */
#ifndef CASADI_SYMBOL_EXPORT
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#if defined(STATIC_LINKED)
#define CASADI_SYMBOL_EXPORT
#else
#define CASADI_SYMBOL_EXPORT __declspec(dllexport)
#endif
#elif defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
#define CASADI_SYMBOL_EXPORT __attribute__ ((visibility ("default")))
#else
#define CASADI_SYMBOL_EXPORT
#endif
#endif
static const casadi_int casadi_s0[18] = {14, 1, 0, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
static const casadi_int casadi_s1[8] = {4, 1, 0, 4, 0, 1, 2, 3};
static const casadi_int casadi_s2[19] = {15, 1, 0, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
static const casadi_int casadi_s3[7] = {3, 1, 0, 3, 0, 1, 2};
/* double_this:(x[14],u[4],p[15])->(F_aero[3],F_prop[3]) */
static int casadi_f0(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, void* mem) {
casadi_real a0;
a0=arg[2] ? arg[2][0] : 0;
if (res[0]!=0) res[0][0]=a0;
a0=arg[2] ? arg[2][1] : 0;
if (res[0]!=0) res[0][1]=a0;
a0=arg[2] ? arg[2][2] : 0;
if (res[0]!=0) res[0][2]=a0;
a0=arg[0] ? arg[0][3] : 0;
if (res[1]!=0) res[1][0]=a0;
a0=arg[0] ? arg[0][4] : 0;
if (res[1]!=0) res[1][1]=a0;
a0=arg[0] ? arg[0][5] : 0;
if (res[1]!=0) res[1][2]=a0;
return 0;
}
CASADI_SYMBOL_EXPORT int double_this(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, void* mem){
return casadi_f0(arg, res, iw, w, mem);
}
CASADI_SYMBOL_EXPORT void double_this_incref(void) {
}
CASADI_SYMBOL_EXPORT void double_this_decref(void) {
}
CASADI_SYMBOL_EXPORT casadi_int double_this_n_in(void) { return 3;}
CASADI_SYMBOL_EXPORT casadi_int double_this_n_out(void) { return 2;}
CASADI_SYMBOL_EXPORT const char* double_this_name_in(casadi_int i){
switch (i) {
case 0: return "x";
case 1: return "u";
case 2: return "p";
default: return 0;
}
}
CASADI_SYMBOL_EXPORT const char* double_this_name_out(casadi_int i){
switch (i) {
case 0: return "F_aero";
case 1: return "F_prop";
default: return 0;
}
}
CASADI_SYMBOL_EXPORT const casadi_int* double_this_sparsity_in(casadi_int i) {
switch (i) {
case 0: return casadi_s0;
case 1: return casadi_s1;
case 2: return casadi_s2;
default: return 0;
}
}
CASADI_SYMBOL_EXPORT const casadi_int* double_this_sparsity_out(casadi_int i) {
switch (i) {
case 0: return casadi_s3;
case 1: return casadi_s3;
default: return 0;
}
}
CASADI_SYMBOL_EXPORT int double_this_work(casadi_int *sz_arg, casadi_int* sz_res, casadi_int *sz_iw, casadi_int *sz_w) {
if (sz_arg) *sz_arg = 3;
if (sz_res) *sz_res = 2;
if (sz_iw) *sz_iw = 0;
if (sz_w) *sz_w = 0;
return 0;
}
CASADI_SYMBOL_EXPORT casadi_functions* double_this_functions(void) {
static casadi_functions fun = {
double_this_incref,
double_this_decref,
double_this_n_in,
double_this_n_out,
double_this_name_in,
double_this_name_out,
double_this_sparsity_in,
double_this_sparsity_out,
double_this_work,
double_this
};
return &fun;
}
#ifdef __cplusplus
} /* extern "C" */
#endif