| 1 |
REQUIRE "test/blackbox/bbox3.a4c"; |
| 2 |
|
| 3 |
(* array of models containing bboxes. *) |
| 4 |
MODEL pass20; |
| 5 |
ma[1..3] IS_A bbox3; |
| 6 |
METHODS |
| 7 |
METHOD specify; |
| 8 |
RUN ma[1..3].specify; |
| 9 |
END specify; |
| 10 |
END pass20; |
| 11 |
|
| 12 |
(* dense array of black boxes right syntax*) |
| 13 |
MODEL pass22; |
| 14 |
coef IS_A real_constant; |
| 15 |
coef :== 2.0; |
| 16 |
npts IS_A integer_constant; |
| 17 |
npts :== 4; |
| 18 |
x[1..npts][1..3] IS_A generic_real; |
| 19 |
y[1..npts][1..3] IS_A generic_real; |
| 20 |
|
| 21 |
(* the simple repeated npts times for different data. *) |
| 22 |
FOR i IN [1..npts] CREATE |
| 23 |
bbox[i]: bboxtest( x[i][1..3] : INPUT ; |
| 24 |
y[i][1..3] : OUTPUT ; |
| 25 |
coef : DATA); |
| 26 |
END FOR; |
| 27 |
|
| 28 |
END pass22; |
| 29 |
|
| 30 |
(* triangular array of black boxes *) |
| 31 |
MODEL pass23; |
| 32 |
npts IS_A integer_constant; |
| 33 |
npts :== 4; |
| 34 |
coef IS_A real_constant; |
| 35 |
coef :== 3; |
| 36 |
|
| 37 |
(* the odd repeated npts triangle of times. |
| 38 |
Verifies that each instance gets its own argument |
| 39 |
evaluation in FOR processing. |
| 40 |
*) |
| 41 |
FOR i IN [1..npts] CREATE |
| 42 |
FOR j IN [1..i] CREATE |
| 43 |
xT[i][j] IS_A generic_real; |
| 44 |
yT[i][j] IS_A generic_real; |
| 45 |
END FOR; |
| 46 |
END FOR; |
| 47 |
FOR i IN [1..npts] CREATE |
| 48 |
bboxT[i]: bboxtest( xT[i][1..i] : INPUT ; |
| 49 |
yT[i][1..i] : OUTPUT ; |
| 50 |
coef : DATA); |
| 51 |
END FOR; |
| 52 |
METHODS |
| 53 |
|
| 54 |
METHOD default_self; |
| 55 |
FOR i IN [1..npts] DO |
| 56 |
FOR j IN [1..i] DO |
| 57 |
xT[i][j] := 1.0; |
| 58 |
yT[i][j] := -1.0; |
| 59 |
END FOR; |
| 60 |
END FOR; |
| 61 |
END default_self; |
| 62 |
METHOD reset; |
| 63 |
EXTERNAL asc_free_all_variables(SELF); |
| 64 |
RUN specify; |
| 65 |
END reset; |
| 66 |
|
| 67 |
METHOD specify; |
| 68 |
FOR i IN [1..npts] DO |
| 69 |
FOR j IN [1..i] DO |
| 70 |
FIX xT[i][j]; |
| 71 |
FREE yT[i][j]; |
| 72 |
END FOR; |
| 73 |
END FOR; |
| 74 |
END specify; |
| 75 |
|
| 76 |
METHOD default_all; |
| 77 |
RUN default_self; |
| 78 |
END default_all; |
| 79 |
|
| 80 |
END pass23; |