-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel_Variables_Code_ODE.c
More file actions
executable file
·489 lines (419 loc) · 17.2 KB
/
Copy pathmodel_Variables_Code_ODE.c
File metadata and controls
executable file
·489 lines (419 loc) · 17.2 KB
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
#include "./Include/MODEL.h"
/* Note on an example of how to call this function:
int S_; int E_; int I_; int R_; int C_;
int L_; int X_; int U_; int W_; int A_;
int K_;
M_O_D_E_L___V_A_R_I_A_B_L_E_S___C_O_D_E ( P,
&S_, &E_, &I_, &R_, &C_,
&L_, &X_, &U_, &W_, &A_,
&K_);
*/
void M_O_D_E_L___V_A_R_I_A_B_L_E_S___C_O_D_E (Parameter_Table * P,
int * S, int * E, int * I, int * R, int * C,
int * S1, int * I1, int * S2, int * I2, int * S3, int * I3,
int * L, int * X, int * U, int * W, int * A,
int * K)
{
int TYPE_of_MODEL = P->TYPE_of_MODEL;
switch( TYPE_of_MODEL )
{
/* CASES_1 models * * * * * * * * * * * * * * * * * * * * * * */
case 11: /* CASES_1-LXVnW */
S_E_I_R_C___L_X_U_W___C_O_D_E_S( P,
S, E, I, R, C, L, X, U, W );
(* A) = (* W);
(* K) = (* W);
break;
case 12: /* CASES_1-XkVnW */
S_E_I_R_C___L_X_U_W___C_O_D_E_S( P,
S, E, I, R, C, L, X, U, W );
/* Mosquito codes */
(* X) = (*C ) + 1; /************************/ /* X */
(* U) = (*C ) + 2; /************************/ /* U, first latent mosquito class */
(* W) = (*C ) + 2 + P->n_V; /* W, infectious mosquitos */
/* Per convention... */
(* L) = (* X);
(* A) = (* W);
(* K) = (* W);
break;
case 13: /* CASES_1-XVnW */
S_E_I_R_C___L_X_U_W___C_O_D_E_S( P,
S, E, I, R, C, L, X, U, W );
/* Mosquito codes */
(* X) = (* C) + 1; /************************/ /* X */
(* U) = (* C) + 2; /************************/ /* U, first latent mosquito class */
(* W) = (* C) + 2 + P->n_V; /* W, infectious mosquitos */
/* Per convention... */
(* L) = (* X);
(* A) = (* W);
(* K) = (* W);
break;
case 14: /* CASES_1-XW */
S_E_I_R_C___L_X_U_W___C_O_D_E_S( P,
S, E, I, R, C, L, X, U, W );
assert(P->n_V == 0);
/* Mosquito codes */
(* X) = (* C) + 1; /************************/ /* X */
(* U) = (* C) + 2; /************************/ /* U, first latent mosquito class */
(* W) = (* C) + 2 + P->n_V; /* W, infectious mosquitos */
/* Per convention... */
(* L) = (* X);
(* A) = (* W);
(* K) = (* W);
break;
/* NO_CASES models * * * * * * * * * * * * * * * * * * * * * * */
case 21: /* NO_CASES-LXVnW */
S_E_I_R___L_X_U_W___C_O_D_E_S( P,
S, E, I, R, L, X, U, W );
(* C) = (* R); /* Last human class */
(* A) = (* W);
(* K) = (* W);
break;
case 22: /* NO_CASES-XkVnW */
S_E_I_R___L_X_U_W___C_O_D_E_S( P,
S, E, I, R, L, X, U, W );
(* C) = (* R); /* Last human class */
/* Mosquito codes */
(* X) = (* R) + 1; /************************/ /* X */
(* U) = (* R) + 2; /************************/ /* U, first latent mosquito class */
(* W) = (* R) + 2 + P->n_V; /* W, infectious mosquitos */
/* Per convention... */
(* L) = (* X);
(* A) = (* W);
(* K) = (* W);
break;
case 23: /* NO_CASES-XVnW */
S_E_I_R___L_X_U_W___C_O_D_E_S( P,
S, E, I, R, L, X, U, W );
(* C) = (* R); /* Last human class */
/* Mosquito codes */
(* X) = (* R) + 1; /************************/ /* X */
(* U) = (* R) + 2; /************************/ /* U, first latent mosquito class */
(* W) = (* R) + 2 + P->n_V; /* W, infectious mosquitos */
/* Per convention... */
(* L) = (* X);
(* A) = (* W);
(* K) = (* W);
break;
case 24: /* NO_CASES-XW */
S_E_I_R___L_X_U_W___C_O_D_E_S( P,
S, E, I, R, L, X, U, W );
(* C) = (* R); /* Last human class */
assert(P->n_V == 0);
/* Mosquito codes */
(* X) = (* R) + 1; /************************/ /* X */
(* U) = (* R) + 2; /************************/ /* U, first latent mosquito class */
(* W) = (* R) + 2 + P->n_V; /* W, infectious mosquitos */
/* Per convention... */
(* L) = (* X);
(* A) = (* W);
(* K) = (* W);
break;
/* SEnI models * * * * * * * * * * * * * * * * * * * * * * */
case 31: /* SEnI-LXVnW */
S_E_I___L_X_U_W___C_O_D_E_S( P,
S, E, I, L, X, U, W );
(* C) = (* I); /* Last human class */
(* A) = (* W);
(* K) = (* W);
break;
case 32: /* SEnI-XkVnW */
S_E_I___L_X_U_W___C_O_D_E_S( P,
S, E, I, L, X, U, W );
(* C) = (* I); /* Last human class */
/* Mosquito codes */
(* X) = (* I) + 1; /************************/ /* X */
(* U) = (* I) + 2; /************************/ /* U, first latent mosquito class */
(* W) = (* I) + 2 + P->n_V; /* W, infectious mosquitos */
/* Per convention... */
(* L) = (* X);
(* A) = (* W);
(* K) = (* W);
break;
case 33: /* SEnI-XVnW */
S_E_I___L_X_U_W___C_O_D_E_S( P,
S, E, I, L, X, U, W );
(* C) = (* I); /* Last human class */
/* Mosquito codes */
(* X) = (* I) + 1; /************************/ /* X */
(* U) = (* I) + 2; /************************/ /* U, first latent mosquito class */
(* W) = (* I) + 2 + P->n_V; /* W, infectious mosquitos */
/* Per convention... */
(* L) = (* X);
(* A) = (* W);
(* K) = (* W);
break;
case 34: /* SEnI-XW */
S_E_I___L_X_U_W___C_O_D_E_S( P,
S, E, I, L, X, U, W );
(* C) = (* I); /* Last human class */
assert(P->n_V == 0);
/* Mosquito codes */
(* X) = (* I) + 1; /************************/ /* X */
(* U) = (* I) + 2; /************************/ /* U, first latent mosquito class */
(* W) = (* I) + 2 + P->n_V; /* W, infectious mosquitos */
/* Per convention... */
(* L) = (* X);
(* A) = (* W);
(* K) = (* W);
break;
/* SI models * * * * * * * * * * * * * * * * * * * * * * */
case 41: /* SI-LXVnW */
S_I___L_X_U_W___C_O_D_E_S( P,
S, E, I, L, X, U, W );
(* C) = (* I); /* Last human class */
(* A) = (* W);
(* K) = (* W);
break;
case 42: /* SI-XkVnW */
S_I___L_X_U_W___C_O_D_E_S( P,
S, E, I, L, X, U, W );
(* C) = (* I); /* Last human class */
/* Mosquito codes */
(* X) = (* I) + 1; /************************/ /* X */
(* U) = (* I) + 2; /************************/ /* U, first latent mosquito class */
(* W) = (* I) + 2 + P->n_V; /* W, infectious mosquitos */
/* Per convention... */
(* L) = (* X);
(* A) = (* W);
(* K) = (* W);
break;
case 43: /* SI-XVnW */
S_I___L_X_U_W___C_O_D_E_S( P,
S, E, I, L, X, U, W );
(* C) = (* I); /* Last human class */
/* Mosquito codes */
(* X) = (* I) + 1; /************************/ /* X */
(* U) = (* I) + 2; /************************/ /* U, first latent mosquito class */
(* W) = (* I) + 2 + P->n_V; /* W, infectious mosquitos */
/* Per convention... */
(* L) = (* X);
(* A) = (* W);
(* K) = (* W);
break;
case 44: /* SI-XW */
S_I___L_X_U_W___C_O_D_E_S( P,
S, E, I, L, X, U, W );
(* C) = (* I); /* Last human class */
assert(P->n_V == 0);
/* Mosquito codes */
(* X) = (* I) + 1; /************************/ /* X */
(* U) = (* I) + 2; /************************/ /* U, first latent mosquito class */
(* W) = (* I) + 2 + P->n_V; /* W, infectious mosquitos */
/* Per convention... */
(* L) = (* X);
(* A) = (* W);
(* K) = (* W);
break;
case 0: /* CASES_33 */
S_E_I_R_C___L_X_U_W_A___K___C_O_D_E_S( P,
S, E, I, R, C, L, X, U, W, A, K );
break;
case 2: /* MacDonald and Ross */
(* W) = 1; /* Number of infectious mosquitoes per human */
(* I) = 0; /* Fraction of infectious humans */
(* K) = (* W);
(* C) = (* I); /* Last human class */
break;
/* CLASSES (SnInR) models * * * * * * * * * * * * * * * * * * * * * * */
case 51: /* SnInR-LXVnW */
S_n_I_n_R___L_X_U_W___C_O_D_E_S( P,
S, E, I, R, C, S1, I1, S2, I2, S3, I3, L, X, U, W );
(* C) = (* R); /* Last human class */
(* A) = (* W);
(* K) = (* W);
break;
case 52: /* SnInR-XkVnW */
S_n_I_n_R___X_U_W___C_O_D_E_S( P,
S, E, I, R, C, S1, I1, S2, I2, S3, I3, L, X, U, W );
(* C) = (* R); /* Last human class */
(* A) = (* W);
(* K) = (* W);
break;
case 53: /* SnInR-XVnW */
S_n_I_n_R___X_U_W___C_O_D_E_S( P,
S, E, I, R, C, S1, I1, S2, I2, S3, I3, L, X, U, W );
(* C) = (* R); /* Last human class */
(* A) = (* W);
(* K) = (* W);
break;
case 54: /* SnInR-XW */
S_n_I_n_R___X_W___C_O_D_E_S( P,
S, E, I, R, C, S1, I1, S2, I2, S3, I3, L, X, U, W );
(* C) = (* R); /* Last human class */
(* A) = (* W);
(* K) = (* W);
break;
default:
printf(" This TYPE_of_MODEL (%d) code is not defined. Check input argument list", TYPE_of_MODEL);
exit(0);
}
/* Conventionally, the last label in the argument list of M_O_D_E_L___V_A_R_I_A_B_L_E_S___C_O_D_E (...),
(*K), should be the label of the last model state variable. Then ( * K) + 1 becomes de total
number of dynamic variables.
*/
}
void S_E_I___X_U_W___C_O_D_E_S( Parameter_Table * P,
int * S, int * E, int * I,
int * X, int * U, int * W )
{
/* Human codes */
* S = 0;
* E = 1; //P->n_H;
* I = 1 + P->n_H; /************************/ /* I */
/* Mosquito codes */
* X = *I + 1; /************************/ /* X */
* U = *I + 2; /************************/ /* U, first latent mosquito class */
* W = *I + 2 + P->n_V; /* W, infectious mosquitos */
}
void S_I___L_X_U_W___C_O_D_E_S( Parameter_Table * P,
int * S, int * E, int * I,
int * L, int * X, int * U, int * W )
{
/* Human codes */
* S = 0;
* E = 0;
* I = 1 ; /************************/ /* I */
/* Mosquito codes */
* L = *I + 1; /************************/ /* L */
* X = *I + 2; /************************/ /* X */
* U = *I + 3; /************************/ /* U, first latent mosquito class */
* W = *I + 3 + P->n_V; /* W, infectious mosquitos */
}
void S_E_I___L_X_U_W___C_O_D_E_S( Parameter_Table * P,
int * S, int * E, int * I,
int * L, int * X, int * U, int * W )
{
/* Human codes */
* S = 0;
* E = 1; //P->n_H;
* I = 1 + P->n_H; /************************/ /* I */
/* Mosquito codes */
* L = *I + 1; /************************/ /* L */
* X = *I + 2; /************************/ /* X */
* U = *I + 3; /************************/ /* U, first latent mosquito class */
* W = *I + 3 + P->n_V; /* W, infectious mosquitos */
}
void S_E_I_R___L_X_U_W___C_O_D_E_S( Parameter_Table * P,
int * S, int * E, int * I, int * R,
int * L, int * X, int * U, int * W )
{
/* Human codes */
* S = 0;
* E = 1; //P->n_H;
* I = 1 + P->n_H; /************************/ /* I */
* R = 2 + P->n_H; /************************/ /* R */
/* Mosquito codes */
* L = *R + 1; /************************/ /* L */
* X = *R + 2; /************************/ /* X */
* U = *R + 3; /************************/ /* U, first latent mosquito class */
* W = *R + 3 + P->n_V; /* W, infectious mosquitos */
}
void S_E_I_R_C___L_X_U_W___C_O_D_E_S( Parameter_Table * P,
int * S, int * E, int * I, int * R, int * C,
int * L, int * X, int * U, int * W )
{
/* Human codes */
* S = 0;
* E = 1; //P->n_H;
* I = 1 + P->n_H; /************************/ /* I */
* R = 2 + P->n_H; /************************/ /* R */
* C = 3 + P->n_H; /************************/ /* C */
/* Mosquito codes */
* L = *C + 1; /************************/ /* L */
* X = *C + 2; /************************/ /* X */
* U = *C + 3; /************************/ /* U, first latent mosquito class */
* W = *C + 3 + P->n_V; /* W, infectious mosquitos */
}
void S_E_I_R_C___L_X_U_W_A___K___C_O_D_E_S(Parameter_Table * P,
int * S, int * E, int * I, int * R, int * C,
int * L, int * X, int * U, int * W,
int * A,
int * K)
{
/* Human codes */
* S = 0;
* E = 1; //P->n_H;
* I = 1 + P->n_H; /************************/ /* I */
* R = 2 + P->n_H; /************************/ /* R */
* C = 3 + P->n_H; /************************/ /* C */
/* Mosquito codes */
* L = *C + 1; /************************/ /* L */
* X = *C + 2; /************************/ /* X */
* U = *C + 3; /************************/ /* U, first latent mosquito class */
* W = *C + 3 + P->n_V; /* W, infectious mosquitos */
/* Acummulated cases and Carrying capicity */
* A = *W + 1; /************************/ /* A, Accummulated no of cases */
* K = *A + 1; /************************/ /* K, Karrying capacity */
}
void S_n_I_n_R___L_X_U_W___C_O_D_E_S( Parameter_Table * P,
int * S, int * E, int * I, int * R, int *C,
int * S1, int * I1, int * S2, int * I2, int * S3, int * I3,
int * L, int * X, int * U, int * W)
{
/* Human codes */
* S = 0;
* E = 0; //P->n_H;
* I = 0; //+ P->n_H; /************************/ /* I */
* R = 6; //+ P->n_H; /************************/ /* R */
/* Human HumanSnInR codes */
* S1 = 0;
* I1 = 1;
* S2 = 2;
* I2 = 3;
* S3 = 4;
* I3 = 5;
/* Mosquito codes */
* L = *R + 1; /************************/ /* L */
* X = *R + 2; /************************/ /* X */
* U = *R + 3; /************************/ /* U, first latent mosquito class */
* W = *R + 3 + P->n_V; /* W, infectious mosquitos */
/* K = *W; /* Must have K as last state variable in Fixed Point calculations this is set in */
/* C = * R; /* For LXVnW jacobian calculation */
}
void S_n_I_n_R___X_U_W___C_O_D_E_S( Parameter_Table * P,
int * S, int * E, int * I, int * R, int *C,
int * S1, int * I1, int * S2, int * I2, int * S3, int * I3,
int * L, int * X, int * U, int * W)
{
/* Human codes */
* S = 0;
* E = 0; //P->n_H;
* I = 0; //+ P->n_H; /************************/ /* I */
* R = 6; //+ P->n_H; /************************/ /* R */
/* Human HumanSnInR codes */
* S1 = 0;
* I1 = 1;
* S2 = 2;
* I2 = 3;
* S3 = 4;
* I3 = 5;
/* Mosquito codes */
* X = *R + 1; /************************/ /* X */
* U = *R + 2; /************************/ /* U, first latent mosquito class */
* W = *R + 2 + P->n_V; /* W, infectious mosquitos */
}
void S_n_I_n_R___X_W___C_O_D_E_S( Parameter_Table * P,
int * S, int * E, int * I, int * R, int *C,
int * S1, int * I1, int * S2, int * I2, int * S3, int * I3,
int * L, int * X, int * U, int * W)
{
/* Human codes */
* S = 0;
* E = 0; //P->n_H;
* I = 0; //+ P->n_H; /************************/ /* I */
* R = 6; //+ P->n_H; /************************/ /* R */
/* Human HumanSnInR codes */
* S1 = 0;
* I1 = 1;
* S2 = 2;
* I2 = 3;
* S3 = 4;
* I3 = 5;
/* Mosquito codes */
assert(P->n_V == 0);
/* Mosquito codes */
(* X) = (* R) + 1; /************************/ /* X */
(* U) = (* R) + 2; /************************/ /* U, first latent mosquito class */
(* W) = (* R) + 2 + P->n_V; /* W, infectious mosquitos */
}