Skip to content

Commit 8f62672

Browse files
committed
d1 refactor
1 parent 574a003 commit 8f62672

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+12305
-7387
lines changed

NPField/script_d1/NPField_model.py

100755100644
Lines changed: 170 additions & 391 deletions
Large diffs are not rendered by default.
873 KB
Binary file not shown.
959 KB
Binary file not shown.
883 KB
Binary file not shown.
875 KB
Binary file not shown.
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
#include <l4casadi.hpp>
2+
3+
L4CasADi l4casadi("/app/NPField/script_d1/_l4c_generated", "y_expr", 3, 1, 1, 10, "cuda", true, true, true, false, true, false);
4+
5+
#ifdef __cplusplus
6+
extern "C" {
7+
#endif
8+
9+
#include <math.h>
10+
11+
#ifndef casadi_real
12+
#define casadi_real double
13+
#endif
14+
15+
#ifndef casadi_int
16+
#define casadi_int long long int
17+
#endif
18+
19+
/* Symbol visibility in DLLs */
20+
#ifndef CASADI_SYMBOL_EXPORT
21+
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
22+
#if defined(STATIC_LINKED)
23+
#define CASADI_SYMBOL_EXPORT
24+
#else
25+
#define CASADI_SYMBOL_EXPORT __declspec(dllexport)
26+
#endif
27+
#elif defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
28+
#define CASADI_SYMBOL_EXPORT __attribute__ ((visibility ("default")))
29+
#else
30+
#define CASADI_SYMBOL_EXPORT
31+
#endif
32+
#endif
33+
34+
// Function y_expr
35+
36+
static const casadi_int y_expr_s_in0[3] = { 3, 1, 1};
37+
static const casadi_int y_expr_s_out0[3] = { 1, 10, 1};
38+
39+
// Only single input, single output is supported at the moment
40+
CASADI_SYMBOL_EXPORT casadi_int y_expr_n_in(void) { return 1;}
41+
CASADI_SYMBOL_EXPORT casadi_int y_expr_n_out(void) { return 1;}
42+
43+
CASADI_SYMBOL_EXPORT const casadi_int* y_expr_sparsity_in(casadi_int i) {
44+
switch (i) {
45+
case 0: return y_expr_s_in0;
46+
default: return 0;
47+
}
48+
}
49+
50+
CASADI_SYMBOL_EXPORT const casadi_int* y_expr_sparsity_out(casadi_int i) {
51+
switch (i) {
52+
case 0: return y_expr_s_out0;
53+
default: return 0;
54+
}
55+
}
56+
57+
CASADI_SYMBOL_EXPORT int y_expr(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
58+
l4casadi.forward(arg[0], res[0]);
59+
return 0;
60+
}
61+
62+
// Jacobian y_expr
63+
64+
CASADI_SYMBOL_EXPORT casadi_int jac_y_expr_n_in(void) { return 2;}
65+
CASADI_SYMBOL_EXPORT casadi_int jac_y_expr_n_out(void) { return 1;}
66+
67+
CASADI_SYMBOL_EXPORT int jac_y_expr(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
68+
l4casadi.jac(arg[0], res[0]);
69+
return 0;
70+
}
71+
72+
73+
74+
// adj1 y_expr
75+
76+
CASADI_SYMBOL_EXPORT casadi_int adj1_y_expr_n_in(void) { return 3;}
77+
CASADI_SYMBOL_EXPORT casadi_int adj1_y_expr_n_out(void) { return 1;}
78+
79+
CASADI_SYMBOL_EXPORT int adj1_y_expr(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
80+
// adj1 [i0, out_o0, adj_o0] -> [out_adj_i0]
81+
l4casadi.adj1(arg[0], arg[2], res[0]);
82+
return 0;
83+
}
84+
85+
86+
// jac_adj1 y_expr
87+
88+
CASADI_SYMBOL_EXPORT casadi_int jac_adj1_y_expr_n_in(void) { return 4;}
89+
CASADI_SYMBOL_EXPORT casadi_int jac_adj1_y_expr_n_out(void) { return 3;}
90+
91+
CASADI_SYMBOL_EXPORT int jac_adj1_y_expr(const casadi_real** arg, casadi_real** res, casadi_int* iw, casadi_real* w, int mem){
92+
// jac_adj1 [i0, out_o0, adj_o0, out_adj_i0] -> [jac_adj_i0_i0, jac_adj_i0_out_o0, jac_adj_i0_adj_o0]
93+
if (res[1] != NULL) {
94+
l4casadi.invalid_argument("jac_adj_i0_out_o0 is not provided by L4CasADi. If you need this feature, please contact the L4CasADi developer.");
95+
}
96+
if (res[0] != NULL) {
97+
l4casadi.jac_adj1_p(arg[0], arg[2], res[0]);
98+
}
99+
if (res[2] != NULL) {
100+
l4casadi.jac_adj1_t(arg[0], arg[2], res[2]);
101+
}
102+
103+
return 0;
104+
}
105+
106+
107+
108+
109+
#ifdef __cplusplus
110+
} /* extern "C" */
111+
#endif
871 KB
Binary file not shown.

0 commit comments

Comments
 (0)