Changeset 14165


Ignore:
Timestamp:
Nov 25, 2019 12:32:09 PM (2 weeks ago)
Author:
Jonathan Kämpe
Message:

#5883 Now keeping mutable primitive array assignments as composite assignments rather than expanding to for loops.

Location:
branches/dev-jk-2720/Compiler
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-jk-2720/Compiler/ModelicaCBackEnd/src/jastadd/CCodeGen/CCodeGenAlgorithms.jrag

    r12904 r14165  
    3333    public void FType.printAssign(CodePrinter.ExecuteCodePrinter p, CodeStream str, String indent,
    3434            ASTNode dst, ASTNode src) {
    35         str.print(indent);
    36         boolean deref = dst.deref_C();
    37         if (deref) {
    38             str.print("*");
    39         }
    40         p.print(dst, str, indent);
    41         str.print(" = ");
    42         if (deref) {
    43             str.print("*");
    44         }
    45         p.print(src, str, indent);
    46         str.print(";\n");
    47     }
    48 
    49     syn boolean ASTNode.deref_C() = false;
    50     eq FAccessExp.deref_C() = type().isRecord() && hasFArraySubscripts();
     35        if (isArray() && (dst.memCpy_C() || src.memCpy_C())) {
     36            printAssignMacro(p, str, indent, dst, src);
     37        } else {
     38            printAssignValue(p, str, indent, dst, src);
     39        }
     40    }
     41
     42    syn boolean ASTNode.memCpy_C() = false;
     43    eq FAccessExp.memCpy_C() = !getFAccess().myTopFV().isImmutable();
    5144
    5245    @Override
    5346    public void FStringType.printAssign(CodePrinter.ExecuteCodePrinter p, CodeStream str, String indent,
     47            ASTNode dst, ASTNode src) {
     48        printAssignMacro(p, str, indent, dst, src);
     49    }
     50
     51    public void FType.printAssignMacro(CodePrinter.ExecuteCodePrinter p, CodeStream str, String indent,
    5452            ASTNode dst, ASTNode src) {
    5553        str.print(indent);
     
    6260        str.print(")\n");
    6361    }
     62   
     63    public void FType.printAssignValue(CodePrinter.ExecuteCodePrinter p, CodeStream str, String indent,
     64            ASTNode dst, ASTNode src) {
     65        str.print(indent);
     66        boolean deref = dst.deref_C();
     67        if (deref) {
     68            str.print("*");
     69        }
     70        p.print(dst, str, indent);
     71        str.print(" = ");
     72        if (deref) {
     73            str.print("*");
     74        }
     75        p.print(src, str, indent);
     76        str.print(";", "\n");
     77    }
     78
     79    syn boolean ASTNode.deref_C() = false;
     80    eq FAccessExp.deref_C() = type().isRecord() && hasFArraySubscripts();
    6481
    6582    syn String ASTNode.assignMacroType(FType type) = type.macroType();
  • branches/dev-jk-2720/Compiler/ModelicaCBackEnd/test/modelica/CCodeGenAlgorithmTests.mo

    r14004 r14165  
    965965    JMI_ARR(STACK, jmi_real_t, jmi_array_t, o_an, 2, 1)
    966966    JMI_ARR(STACK, jmi_real_t, jmi_array_t, temp_1_a, 2, 1)
    967     jmi_real_t i1_0i;
    968     jmi_int_t i1_0ie;
    969     jmi_int_t i1_0in;
    970967    if (o_a == NULL) {
    971968        JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, o_an, 2, 1, 2)
     
    975972    jmi_array_ref_1(temp_1_a, 1) = 1;
    976973    jmi_array_ref_1(temp_1_a, 2) = 1;
    977     i1_0in = 0;
    978     i1_0ie = floor((2) - (1));
    979     for (i1_0i = 1; i1_0in <= i1_0ie; i1_0i = 1 + (++i1_0in)) {
    980         jmi_array_ref_1(o_a, i1_0i) = jmi_array_val_1(temp_1_a, i1_0i);
    981     }
     974    JMI_ASG(GEN_ARR, o_a, temp_1_a)
    982975    JMI_DYNAMIC_FREE()
    983976    return;
     
    992985    JMI_ARR(STACK, jmi_real_t, jmi_array_t, temp_1_a, 2, 1)
    993986    JMI_ARR(STACK, jmi_real_t, jmi_array_t, temp_2_a, 2, 1)
     987    jmi_real_t i1_0i;
     988    jmi_int_t i1_0ie;
     989    jmi_int_t i1_0in;
    994990    jmi_real_t i1_1i;
    995991    jmi_int_t i1_1ie;
     
    998994    jmi_int_t i1_2ie;
    999995    jmi_int_t i1_2in;
    1000     jmi_real_t i1_3i;
    1001     jmi_int_t i1_3ie;
    1002     jmi_int_t i1_3in;
    1003996    JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, tmp_1, 3, 1, 3)
    1004997    r__v->a = tmp_1;
     
    10101003    JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, temp_1_a, 2, 1, 2)
    10111004    func_CCodeGenAlgorithmTests_Algorithm9_f_def0(temp_1_a);
     1005    i1_0in = 0;
     1006    i1_0ie = floor((2) - (1));
     1007    for (i1_0i = 1; i1_0in <= i1_0ie; i1_0i = 1 + (++i1_0in)) {
     1008        jmi_array_ref_1(r_v->a, i1_0i) = 2 * jmi_array_val_1(temp_1_a, i1_0i);
     1009    }
     1010    JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, temp_2_a, 2, 1, 2)
     1011    func_CCodeGenAlgorithmTests_Algorithm9_f_def0(temp_2_a);
    10121012    i1_1in = 0;
    10131013    i1_1ie = floor((2) - (1));
    10141014    for (i1_1i = 1; i1_1in <= i1_1ie; i1_1i = 1 + (++i1_1in)) {
    1015         jmi_array_ref_1(r_v->a, i1_1i) = 2 * jmi_array_val_1(temp_1_a, i1_1i);
    1016     }
    1017     JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, temp_2_a, 2, 1, 2)
    1018     func_CCodeGenAlgorithmTests_Algorithm9_f_def0(temp_2_a);
     1015        jmi_array_ref_1(r_v->a, 2 + (i1_1i - 1)) = jmi_array_val_1(temp_2_a, i1_1i);
     1016    }
    10191017    i1_2in = 0;
    1020     i1_2ie = floor((2) - (1));
     1018    i1_2ie = floor((3) - (1));
    10211019    for (i1_2i = 1; i1_2in <= i1_2ie; i1_2i = 1 + (++i1_2in)) {
    1022         jmi_array_ref_1(r_v->a, 2 + (i1_2i - 1)) = jmi_array_val_1(temp_2_a, i1_2i);
    1023     }
    1024     i1_3in = 0;
    1025     i1_3ie = floor((3) - (1));
    1026     for (i1_3i = 1; i1_3in <= i1_3ie; i1_3i = 1 + (++i1_3in)) {
    1027         jmi_array_ref_1(r__v->a, i1_3i) = jmi_array_val_1(r_v->a, i1_3i);
     1020        jmi_array_ref_1(r__v->a, i1_2i) = jmi_array_val_1(r_v->a, i1_2i);
    10281021    }
    10291022    JMI_DYNAMIC_FREE()
     
    11701163    JMI_ARR(STACK, jmi_real_t, jmi_array_t, o_an, 2, 1)
    11711164    JMI_DEF(REA, dummy_v)
    1172     jmi_real_t i1_3i;
    1173     jmi_int_t i1_3ie;
    1174     jmi_int_t i1_3in;
    11751165    if (o_a == NULL) {
    11761166        JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, o_an, 2, 1, 2)
     
    11781168    }
    11791169    dummy_v = 1;
    1180     i1_3in = 0;
    1181     i1_3ie = floor((2) - (1));
    1182     for (i1_3i = 1; i1_3in <= i1_3ie; i1_3i = 1 + (++i1_3in)) {
    1183         jmi_array_ref_1(o_a, i1_3i) = jmi_array_val_1(i_a, i1_3i);
    1184     }
     1170    JMI_ASG(GEN_ARR, o_a, i_a)
    11851171    JMI_RET(GEN, dummy_o, dummy_v)
    11861172    JMI_DYNAMIC_FREE()
  • branches/dev-jk-2720/Compiler/ModelicaCBackEnd/test/modelica/CCodeGenExternalTests.mo

    r13491 r14165  
    22292229    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, Awork_a, -1, 2)
    22302230    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, work_a, -1, 1)
    2231     jmi_real_t i1_0i;
    2232     jmi_int_t i1_0ie;
    2233     jmi_int_t i1_0in;
    2234     jmi_real_t i2_1i;
    2235     jmi_int_t i2_1ie;
    2236     jmi_int_t i2_1in;
    22372231    JMI_DEF(STR_EXT, tmp_1)
    22382232    JMI_DEF(STR_EXT, tmp_2)
     
    22622256    lwork_v = 12 * n_v;
    22632257    JMI_ARRAY_INIT_2(HEAP, jmi_real_t, jmi_array_t, Awork_a, jmi_array_size(A_a, 0) * jmi_array_size(A_a, 0), 2, jmi_array_size(A_a, 0), jmi_array_size(A_a, 0))
    2264     i1_0in = 0;
    2265     i1_0ie = floor((jmi_array_size(A_a, 0)) - (1));
    2266     for (i1_0i = 1; i1_0in <= i1_0ie; i1_0i = 1 + (++i1_0in)) {
    2267         i2_1in = 0;
    2268         i2_1ie = floor((jmi_array_size(A_a, 0)) - (1));
    2269         for (i2_1i = 1; i2_1in <= i2_1ie; i2_1i = 1 + (++i2_1in)) {
    2270             jmi_array_ref_2(Awork_a, i1_0i, i2_1i) = jmi_array_val_2(A_a, i1_0i, i2_1i);
    2271         }
    2272     }
     2258    JMI_ASG(GEN_ARR, Awork_a, A_a)
    22732259    JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, work_a, 12 * jmi_array_size(A_a, 0), 1, 12 * jmi_array_size(A_a, 0))
    22742260    JMI_ASG(STR, tmp_1, \"N\")
  • branches/dev-jk-2720/Compiler/ModelicaCBackEnd/test/modelica/CCodeGenTests.mo

    r14004 r14165  
    941941    jmi_int_t i1_2ie;
    942942    jmi_int_t i1_2in;
    943     jmi_real_t i1_3i;
    944     jmi_int_t i1_3ie;
    945     jmi_int_t i1_3in;
    946     jmi_real_t i2_4i;
    947     jmi_int_t i2_4ie;
    948     jmi_int_t i2_4in;
    949943    if (y_a == NULL) {
    950944        JMI_ARRAY_INIT_2(STACK, jmi_real_t, jmi_array_t, y_an, 1, 2, 1, 1)
     
    959953        jmi_array_ref_2(temp_1_a, 1, i1_2i) = jmi_array_val_1(temp_2_a, i1_2i);
    960954    }
     955    JMI_ASG(GEN_ARR, y_a, temp_1_a)
     956    JMI_DYNAMIC_FREE()
     957    return;
     958}
     959
     960void func_CCodeGenTests_CCodeGenTest20_mysum_def2(jmi_array_t* x_a, jmi_real_t* y_o) {
     961    JMI_DYNAMIC_INIT()
     962    JMI_DEF(REA, y_v)
     963    JMI_DEF(REA, temp_1_v)
     964    jmi_real_t i1_3i;
     965    jmi_int_t i1_3ie;
     966    jmi_int_t i1_3in;
     967    jmi_real_t i2_4i;
     968    jmi_int_t i2_4ie;
     969    jmi_int_t i2_4in;
     970    temp_1_v = 0.0;
    961971    i1_3in = 0;
    962     i1_3ie = floor((1) - (1));
     972    i1_3ie = floor((jmi_array_size(x_a, 0)) - (1));
    963973    for (i1_3i = 1; i1_3in <= i1_3ie; i1_3i = 1 + (++i1_3in)) {
    964974        i2_4in = 0;
    965         i2_4ie = floor((1) - (1));
     975        i2_4ie = floor((jmi_array_size(x_a, 1)) - (1));
    966976        for (i2_4i = 1; i2_4in <= i2_4ie; i2_4i = 1 + (++i2_4in)) {
    967             jmi_array_ref_2(y_a, i1_3i, i2_4i) = jmi_array_val_2(temp_1_a, i1_3i, i2_4i);
    968         }
    969     }
    970     JMI_DYNAMIC_FREE()
    971     return;
    972 }
    973 
    974 void func_CCodeGenTests_CCodeGenTest20_mysum_def2(jmi_array_t* x_a, jmi_real_t* y_o) {
    975     JMI_DYNAMIC_INIT()
    976     JMI_DEF(REA, y_v)
    977     JMI_DEF(REA, temp_1_v)
    978     jmi_real_t i1_5i;
    979     jmi_int_t i1_5ie;
    980     jmi_int_t i1_5in;
    981     jmi_real_t i2_6i;
    982     jmi_int_t i2_6ie;
    983     jmi_int_t i2_6in;
    984     temp_1_v = 0.0;
    985     i1_5in = 0;
    986     i1_5ie = floor((jmi_array_size(x_a, 0)) - (1));
    987     for (i1_5i = 1; i1_5in <= i1_5ie; i1_5i = 1 + (++i1_5in)) {
    988         i2_6in = 0;
    989         i2_6ie = floor((jmi_array_size(x_a, 1)) - (1));
    990         for (i2_6i = 1; i2_6in <= i2_6ie; i2_6i = 1 + (++i2_6in)) {
    991             temp_1_v = temp_1_v + jmi_array_val_2(x_a, i1_5i, i2_6i);
     977            temp_1_v = temp_1_v + jmi_array_val_2(x_a, i1_3i, i2_4i);
    992978        }
    993979    }
     
    29492935    JMI_DYNAMIC_INIT()
    29502936    JMI_ARR(STACK, jmi_real_t, jmi_array_t, y_an, 2, 1)
    2951     jmi_real_t i1_0i;
    2952     jmi_int_t i1_0ie;
    2953     jmi_int_t i1_0in;
    29542937    if (y_a == NULL) {
    29552938        JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, y_an, 2, 1, 2)
    29562939        y_a = y_an;
    29572940    }
    2958     i1_0in = 0;
    2959     i1_0ie = floor((2) - (1));
    2960     for (i1_0i = 1; i1_0in <= i1_0ie; i1_0i = 1 + (++i1_0in)) {
    2961         jmi_array_ref_1(y_a, i1_0i) = jmi_array_val_1(x_a, i1_0i);
    2962     }
     2941    JMI_ASG(GEN_ARR, y_a, x_a)
    29632942    JMI_DYNAMIC_FREE()
    29642943    return;
     
    29762955    (*res)[2] = 1 - ((_z_1_0*sf(0)));
    29772956    (*res)[3] = 1 - ((_z_2_1*sf(1)));
    2978 
    29792957")})));
    29802958end CFunctionTest12;
     
    36923670    JMI_ARR(STACK, jmi_real_t, jmi_array_t, tmp_1, 2, 1)
    36933671    JMI_ARR(STACK, jmi_real_t, jmi_array_t, tmp_2, 2, 1)
    3694     JMI_ARR(STACK, jmi_real_t, jmi_array_t, tmp_3, 2, 1)
    3695     jmi_real_t i1_0i;
    3696     jmi_int_t i1_0ie;
    3697     jmi_int_t i1_0in;
    36983672    if (y_a == NULL) {
    36993673        JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, tmp_1, 2, 1, 2)
     
    37113685    JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, temp_1_a, 1, 1, 1)
    37123686    jmi_array_ref_1(temp_1_a, 1) = x_v;
    3713     JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, tmp_3, 2, 1, 2)
    3714     jmi_array_ref_1(tmp_3, 1) = x_v;
    3715     jmi_array_ref_1(tmp_3, 2) = x_v;
    3716     i1_0in = 0;
    3717     i1_0ie = floor((func_CCodeGenTests_FuncWithArray_g_exp1(tmp_3)) - (1));
    3718     for (i1_0i = 1; i1_0in <= i1_0ie; i1_0i = 1 + (++i1_0in)) {
    3719         jmi_array_ref_1(y_a, i1_0i) = jmi_array_val_1(temp_1_a, i1_0i);
    3720     }
     3687    JMI_ASG(GEN_ARR, y_a, temp_1_a)
    37213688    JMI_DYNAMIC_FREE()
    37223689    return;
     
    37283695    JMI_DEF(REA, temp_1_v)
    37293696    JMI_DEF(REA, temp_2_v)
     3697    jmi_real_t i1_0i;
     3698    jmi_int_t i1_0ie;
     3699    jmi_int_t i1_0in;
    37303700    jmi_real_t i1_1i;
    37313701    jmi_int_t i1_1ie;
    37323702    jmi_int_t i1_1in;
    3733     jmi_real_t i1_2i;
    3734     jmi_int_t i1_2ie;
    3735     jmi_int_t i1_2in;
    37363703    temp_1_v = 0.0;
     3704    i1_0in = 0;
     3705    i1_0ie = floor((jmi_array_size(x_a, 0)) - (1));
     3706    for (i1_0i = 1; i1_0in <= i1_0ie; i1_0i = 1 + (++i1_0in)) {
     3707        temp_1_v = temp_1_v + jmi_array_val_1(x_a, i1_0i);
     3708    }
     3709    temp_2_v = 0.0;
    37373710    i1_1in = 0;
    37383711    i1_1ie = floor((jmi_array_size(x_a, 0)) - (1));
    37393712    for (i1_1i = 1; i1_1in <= i1_1ie; i1_1i = 1 + (++i1_1in)) {
    3740         temp_1_v = temp_1_v + jmi_array_val_1(x_a, i1_1i);
    3741     }
    3742     temp_2_v = 0.0;
    3743     i1_2in = 0;
    3744     i1_2ie = floor((jmi_array_size(x_a, 0)) - (1));
    3745     for (i1_2i = 1; i1_2in <= i1_2ie; i1_2i = 1 + (++i1_2in)) {
    3746         temp_2_v = temp_2_v + jmi_array_val_1(x_a, i1_2i);
     3713        temp_2_v = temp_2_v + jmi_array_val_1(x_a, i1_1i);
    37473714    }
    37483715    n_v = floor(JMI_DIVIDE_FUNCTION(\"CCodeGenTests.FuncWithArray.g\", temp_1_v, temp_2_v, \"temp_1 / temp_2\"));
     
    49164883 Real x[2] = f();
    49174884
    4918     annotation(__JModelica(UnitTesting(tests={
    4919         CCodeGenTestCase(
    4920             name="CArrayOutputs1",
    4921             description="C code generation: array outputs from functions: in equation",
    4922             variability_propagation=false,
    4923             inline_functions="none",
    4924             generate_ode=false,
    4925             generate_dae=true,
    4926             template="
     4885annotation(__JModelica(UnitTesting(tests={
     4886    CCodeGenTestCase(
     4887        name="CArrayOutputs1",
     4888        description="C code generation: array outputs from functions: in equation",
     4889        variability_propagation=false,
     4890        inline_functions="none",
     4891        generate_ode=false,
     4892        generate_dae=true,
     4893        template="
    49274894$C_function_headers$
    49284895$C_functions$
    49294896$C_DAE_equation_residuals$
    49304897",
    4931             generatedCode="
     4898        generatedCode="
    49324899void func_CCodeGenTests_CArrayOutputs1_f_def0(jmi_array_t* o_a);
    49334900
     
    49364903    JMI_ARR(STACK, jmi_real_t, jmi_array_t, o_an, 2, 1)
    49374904    JMI_ARR(STACK, jmi_real_t, jmi_array_t, temp_1_a, 2, 1)
    4938     jmi_real_t i1_0i;
    4939     jmi_int_t i1_0ie;
    4940     jmi_int_t i1_0in;
    49414905    if (o_a == NULL) {
    49424906        JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, o_an, 2, 1, 2)
     
    49464910    jmi_array_ref_1(temp_1_a, 1) = 1;
    49474911    jmi_array_ref_1(temp_1_a, 2) = 2;
    4948     i1_0in = 0;
    4949     i1_0ie = floor((2) - (1));
    4950     for (i1_0i = 1; i1_0in <= i1_0ie; i1_0i = 1 + (++i1_0in)) {
    4951         jmi_array_ref_1(o_a, i1_0i) = jmi_array_val_1(temp_1_a, i1_0i);
    4952     }
     4912    JMI_ASG(GEN_ARR, o_a, temp_1_a)
    49534913    JMI_DYNAMIC_FREE()
    49544914    return;
     
    49954955    JMI_ARR(STACK, jmi_real_t, jmi_array_t, o_an, 2, 1)
    49964956    JMI_ARR(STACK, jmi_real_t, jmi_array_t, temp_1_a, 2, 1)
    4997     jmi_real_t i1_0i;
    4998     jmi_int_t i1_0ie;
    4999     jmi_int_t i1_0in;
    50004957    if (o_a == NULL) {
    50014958        JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, o_an, 2, 1, 2)
     
    50054962    jmi_array_ref_1(temp_1_a, 1) = 1;
    50064963    jmi_array_ref_1(temp_1_a, 2) = 2;
    5007     i1_0in = 0;
    5008     i1_0ie = floor((2) - (1));
    5009     for (i1_0i = 1; i1_0in <= i1_0ie; i1_0i = 1 + (++i1_0in)) {
    5010         jmi_array_ref_1(o_a, i1_0i) = jmi_array_val_1(temp_1_a, i1_0i);
    5011     }
     4964    JMI_ASG(GEN_ARR, o_a, temp_1_a)
    50124965    JMI_DYNAMIC_FREE()
    50134966    return;
     
    50985051    JMI_ARR(STACK, jmi_real_t, jmi_array_t, o_an, 2, 1)
    50995052    JMI_ARR(STACK, jmi_real_t, jmi_array_t, temp_1_a, 2, 1)
    5100     jmi_real_t i1_1i;
    5101     jmi_int_t i1_1ie;
    5102     jmi_int_t i1_1in;
    51035053    if (o_a == NULL) {
    51045054        JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, o_an, 2, 1, 2)
     
    51085058    jmi_array_ref_1(temp_1_a, 1) = 1;
    51095059    jmi_array_ref_1(temp_1_a, 2) = 2;
    5110     i1_1in = 0;
    5111     i1_1ie = floor((2) - (1));
    5112     for (i1_1i = 1; i1_1in <= i1_1ie; i1_1i = 1 + (++i1_1in)) {
    5113         jmi_array_ref_1(o_a, i1_1i) = jmi_array_val_1(temp_1_a, i1_1i);
    5114     }
     5060    JMI_ASG(GEN_ARR, o_a, temp_1_a)
    51155061    JMI_DYNAMIC_FREE()
    51165062    return;
     
    51405086 Real x = f1();
    51415087
    5142     annotation(__JModelica(UnitTesting(tests={
    5143         CCodeGenTestCase(
    5144             name="CArrayOutputs4",
    5145             description="C code generation: array outputs from functions: function call statement",
    5146             variability_propagation=false,
    5147             inline_functions="none",
    5148             generate_ode=false,
    5149             generate_dae=true,
    5150             template="
     5088annotation(__JModelica(UnitTesting(tests={
     5089    CCodeGenTestCase(
     5090        name="CArrayOutputs4",
     5091        description="C code generation: array outputs from functions: function call statement",
     5092        variability_propagation=false,
     5093        inline_functions="none",
     5094        generate_ode=false,
     5095        generate_dae=true,
     5096        template="
    51515097$C_function_headers$
    51525098$C_functions$
    51535099$C_DAE_equation_residuals$
    51545100",
    5155             generatedCode="
     5101        generatedCode="
    51565102void func_CCodeGenTests_CArrayOutputs4_f1_def0(jmi_real_t* o_o);
    51575103jmi_real_t func_CCodeGenTests_CArrayOutputs4_f1_exp0();
     
    51825128    JMI_DEF(REA, o2_v)
    51835129    JMI_ARR(STACK, jmi_real_t, jmi_array_t, temp_1_a, 2, 1)
    5184     jmi_real_t i1_0i;
    5185     jmi_int_t i1_0ie;
    5186     jmi_int_t i1_0in;
    51875130    if (o1_a == NULL) {
    51885131        JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, o1_an, 2, 1, 2)
     
    51925135    jmi_array_ref_1(temp_1_a, 1) = 1;
    51935136    jmi_array_ref_1(temp_1_a, 2) = 2;
    5194     i1_0in = 0;
    5195     i1_0ie = floor((2) - (1));
    5196     for (i1_0i = 1; i1_0in <= i1_0ie; i1_0i = 1 + (++i1_0in)) {
    5197         jmi_array_ref_1(o1_a, i1_0i) = jmi_array_val_1(temp_1_a, i1_0i);
    5198     }
     5137    JMI_ASG(GEN_ARR, o1_a, temp_1_a)
    51995138    o2_v = 3;
    52005139    JMI_RET(GEN, o2_o, o2_v)
     
    52695208    JMI_ARR(STACK, jmi_real_t, jmi_array_t, o1_an, 2, 1)
    52705209    JMI_DEF(REA, o2_v)
    5271     jmi_real_t i1_0i;
    5272     jmi_int_t i1_0ie;
    5273     jmi_int_t i1_0in;
    52745210    if (o1_a == NULL) {
    52755211        JMI_ARRAY_INIT_1(STACK, jmi_real_t, jmi_array_t, o1_an, 2, 1, 2)
    52765212        o1_a = o1_an;
    52775213    }
    5278     i1_0in = 0;
    5279     i1_0ie = floor((2) - (1));
    5280     for (i1_0i = 1; i1_0in <= i1_0ie; i1_0i = 1 + (++i1_0in)) {
    5281         jmi_array_ref_1(o1_a, i1_0i) = jmi_array_val_1(i_a, i1_0i);
    5282     }
     5214    JMI_ASG(GEN_ARR, o1_a, i_a)
    52835215    o2_v = 3;
    52845216    JMI_RET(GEN, o2_o, o2_v)
     
    54005332    jmi_int_t i3_4ie;
    54015333    jmi_int_t i3_4in;
    5402     jmi_real_t i1_5i;
    5403     jmi_int_t i1_5ie;
    5404     jmi_int_t i1_5in;
    5405     jmi_real_t i2_6i;
    5406     jmi_int_t i2_6ie;
    5407     jmi_int_t i2_6in;
    54085334    if (y_a == NULL) {
    54095335        JMI_ARRAY_INIT_2(HEAP, jmi_real_t, jmi_array_t, y_an, jmi_array_size(x_a, 0) * 2, 2, jmi_array_size(x_a, 0), 2)
     
    54435369        }
    54445370    }
    5445     i1_5in = 0;
    5446     i1_5ie = floor((jmi_array_size(x_a, 0)) - (1));
    5447     for (i1_5i = 1; i1_5in <= i1_5ie; i1_5i = 1 + (++i1_5in)) {
    5448         i2_6in = 0;
    5449         i2_6ie = floor((2) - (1));
    5450         for (i2_6i = 1; i2_6in <= i2_6ie; i2_6i = 1 + (++i2_6in)) {
    5451             jmi_array_ref_2(y_a, i1_5i, i2_6i) = jmi_array_val_2(temp_1_a, i1_5i, i2_6i);
    5452         }
    5453     }
     5371    JMI_ASG(GEN_ARR, y_a, temp_1_a)
    54545372    JMI_DYNAMIC_FREE()
    54555373    return;
     
    55395457    JMI_DYNAMIC_INIT()
    55405458    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, y2_an, -1, 1)
    5541     jmi_real_t i1_1i;
    5542     jmi_int_t i1_1ie;
    5543     jmi_int_t i1_1in;
    55445459    if (y2_a == NULL) {
    55455460        JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, y2_an, jmi_array_size(x2_a, 0), 1, jmi_array_size(x2_a, 0))
    55465461        y2_a = y2_an;
    55475462    }
    5548     i1_1in = 0;
    5549     i1_1ie = floor((jmi_array_size(x2_a, 0)) - (1));
    5550     for (i1_1i = 1; i1_1in <= i1_1ie; i1_1i = 1 + (++i1_1in)) {
    5551         jmi_array_ref_1(y2_a, i1_1i) = jmi_array_val_1(x2_a, i1_1i);
    5552     }
     5463    JMI_ASG(GEN_ARR, y2_a, x2_a)
    55535464    JMI_DYNAMIC_FREE()
    55545465    return;
     
    56455556    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, o_an, -1, 1)
    56465557    JMI_DEF(REA, dummy_v)
    5647     jmi_real_t i1_3i;
    5648     jmi_int_t i1_3ie;
    5649     jmi_int_t i1_3in;
    56505558    if (o_a == NULL) {
    56515559        JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, o_an, jmi_array_size(i_a, 0), 1, jmi_array_size(i_a, 0))
     
    56535561    }
    56545562    dummy_v = 1;
    5655     i1_3in = 0;
    5656     i1_3ie = floor((jmi_array_size(i_a, 0)) - (1));
    5657     for (i1_3i = 1; i1_3in <= i1_3ie; i1_3i = 1 + (++i1_3in)) {
    5658         jmi_array_ref_1(o_a, i1_3i) = jmi_array_val_1(i_a, i1_3i);
    5659     }
     5563    JMI_ASG(GEN_ARR, o_a, i_a)
    56605564    JMI_RET(GEN, dummy_o, dummy_v)
    56615565    JMI_DYNAMIC_FREE()
     
    60575961    jmi_int_t i1_0ie;
    60585962    jmi_int_t i1_0in;
    6059     jmi_real_t i1_1i;
    6060     jmi_int_t i1_1ie;
    6061     jmi_int_t i1_1in;
    60625963    if (ba_a == NULL) {
    60635964        JMI_ARRAY_INIT_1(HEAP, jmi_real_t, jmi_array_t, ba_an, n_v, 1, n_v)
     
    60735974        jmi_array_ref_1(ba_a, i1_0i) = 1;
    60745975    }
    6075     i1_1in = 0;
    6076     i1_1ie = floor((jmi_array_size(ba_a, 0)) - (1));
    6077     for (i1_1i = 1; i1_1in <= i1_1ie; i1_1i = 1 + (++i1_1in)) {
    6078         jmi_array_ref_1(ab_a, i1_1i) = jmi_array_val_1(ba_a, i1_1i);
    6079     }
     5976    JMI_ASG(GEN_ARR, ab_a, ba_a)
    60805977    JMI_DYNAMIC_FREE()
    60815978    return;
     
    1382413721    JMI_DEF(INT, ldb_v)
    1382513722    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, ipiv_a, -1, 1)
    13826     jmi_real_t i1_0i;
    13827     jmi_int_t i1_0ie;
    13828     jmi_int_t i1_0in;
    13829     jmi_real_t i1_1i;
    13830     jmi_int_t i1_1ie;
    13831     jmi_int_t i1_1in;
    13832     jmi_real_t i2_2i;
    13833     jmi_int_t i2_2ie;
    13834     jmi_int_t i2_2in;
    1383513723    JMI_DEF(INT_EXT, tmp_1)
    1383613724    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, tmp_2, -1, 2)
     
    1384413732        x_a = x_an;
    1384513733    }
    13846     i1_0in = 0;
    13847     i1_0ie = floor((jmi_array_size(A_a, 0)) - (1));
    13848     for (i1_0i = 1; i1_0in <= i1_0ie; i1_0i = 1 + (++i1_0in)) {
    13849         jmi_array_ref_1(x_a, i1_0i) = jmi_array_val_1(b_a, i1_0i);
    13850     }
     13734    JMI_ASG(GEN_ARR, x_a, b_a)
    1385113735    JMI_ARRAY_INIT_2(HEAP, jmi_real_t, jmi_array_t, Awork_a, jmi_array_size(A_a, 0) * jmi_array_size(A_a, 0), 2, jmi_array_size(A_a, 0), jmi_array_size(A_a, 0))
    13852     i1_1in = 0;
    13853     i1_1ie = floor((jmi_array_size(A_a, 0)) - (1));
    13854     for (i1_1i = 1; i1_1in <= i1_1ie; i1_1i = 1 + (++i1_1in)) {
    13855         i2_2in = 0;
    13856         i2_2ie = floor((jmi_array_size(A_a, 0)) - (1));
    13857         for (i2_2i = 1; i2_2in <= i2_2ie; i2_2i = 1 + (++i2_2in)) {
    13858             jmi_array_ref_2(Awork_a, i1_1i, i2_2i) = jmi_array_val_2(A_a, i1_1i, i2_2i);
    13859         }
    13860     }
     13736    JMI_ASG(GEN_ARR, Awork_a, A_a)
    1386113737    lda_v = JMI_MAX_EQUATION(1.0, jmi_array_size(A_a, 0));
    1386213738    ldb_v = JMI_MAX_EQUATION(1.0, jmi_array_size(b_a, 0));
     
    1392613802    JMI_DEF(INT, ldb_v)
    1392713803    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, ipiv_a, -1, 1)
    13928     jmi_real_t i1_0i;
    13929     jmi_int_t i1_0ie;
    13930     jmi_int_t i1_0in;
    13931     jmi_real_t i2_1i;
    13932     jmi_int_t i2_1ie;
    13933     jmi_int_t i2_1in;
    13934     jmi_real_t i1_2i;
    13935     jmi_int_t i1_2ie;
    13936     jmi_int_t i1_2in;
    13937     jmi_real_t i2_3i;
    13938     jmi_int_t i2_3ie;
    13939     jmi_int_t i2_3in;
    1394013804    JMI_ARR(HEAP, jmi_real_t, jmi_array_t, tmp_1, -1, 2)
    1394113805    JMI_DEF(INT_EXT, tmp_2)
     
    1394913813        X_a = X_an;
    1395013814    }
    13951     i1_0in = 0;
    13952     i1_0ie = floor((jmi_array_size(A_a, 0)) - (1));
    13953     for (i1_0i = 1; i1_0in <= i1_0ie; i1_0i = 1 + (++i1_0in)) {
    13954         i2_1in = 0;
    13955         i2_1ie = floor((jmi_array_size(B_a, 1)) - (1));
    13956         for (i2_1i = 1; i2_1in <= i2_1ie; i2_1i = 1 + (++i2_1in)) {
    13957             jmi_array_ref_2(X_a, i1_0i, i2_1i) = jmi_array_val_2(B_a, i1_0i, i2_1i);
    13958         }
    13959     }
     13815    JMI_ASG(GEN_ARR, X_a, B_a)
    1396013816    JMI_ARRAY_INIT_2(HEAP, jmi_real_t, jmi_array_t, Awork_a, jmi_array_size(A_a, 0) * jmi_array_size(A_a, 0), 2, jmi_array_size(A_a, 0), jmi_array_size(A_a, 0))
    13961     i1_2in = 0;
    13962     i1_2ie = floor((jmi_array_size(A_a, 0)) - (1));
    13963     for (i1_2i = 1; i1_2in <= i1_2ie; i1_2i = 1 + (++i1_2in)) {
    13964         i2_3in = 0;
    13965         i2_3ie = floor((jmi_array_size(A_a, 0)) - (1));
    13966         for (i2_3i = 1; i2_3in <= i2_3ie; i2_3i = 1 + (++i2_3in)) {
    13967             jmi_array_ref_2(Awork_a, i1_2i, i2_3i) = jmi_array_val_2(A_a, i1_2i, i2_3i);
    13968         }
    13969     }
     13817    JMI_ASG(GEN_ARR, Awork_a, A_a)
    1397013818    lda_v = JMI_MAX_EQUATION(1.0, jmi_array_size(A_a, 0));
    1397113819    ldb_v = JMI_MAX_EQUATION(1.0, jmi_array_size(B_a, 0));
     
    1627116119    JMI_ARR(STACK, jmi_string_t, jmi_string_array_t, s_a, 2, 1)
    1627216120    JMI_ARR(STACK, jmi_string_t, jmi_string_array_t, temp_1_a, 2, 1)
    16273     jmi_real_t i1_0i;
    16274     jmi_int_t i1_0ie;
    16275     jmi_int_t i1_0in;
    1627616121    JMI_ARR(STACK, jmi_string_t, jmi_string_array_t, tmp_1, 2, 1)
    1627716122    JMI_ARRAY_INIT_1(STACK, jmi_string_t, jmi_string_array_t, s_a, 2, 1, 2)
     
    1628016125    JMI_ASG(STR, jmi_array_ref_1(temp_1_a, 1), \"str\")
    1628116126    JMI_ASG(STR, jmi_array_ref_1(temp_1_a, 2), \"str\")
    16282     i1_0in = 0;
    16283     i1_0ie = floor((2) - (1));
    16284     for (i1_0i = 1; i1_0in <= i1_0ie; i1_0i = 1 + (++i1_0in)) {
    16285         JMI_ASG(STR, jmi_array_ref_1(s_a, i1_0i), jmi_array_val_1(temp_1_a, i1_0i))
    16286     }
     16127    JMI_ASG(STR_ARR, s_a, temp_1_a)
    1628716128    JMI_ARRAY_INIT_1(STACK, jmi_string_t, jmi_string_array_t, tmp_1, 2, 1, 2)
    1628816129    func_CCodeGenTests_StringOperations10_f1_def1(s_a, tmp_1);
     
    1630116142    JMI_DYNAMIC_INIT()
    1630216143    JMI_ARR(HEAP, jmi_string_t, jmi_string_array_t, o_a, -1, 1)
    16303     jmi_real_t i1_1i;
    16304     jmi_int_t i1_1ie;
    16305     jmi_int_t i1_1in;
    1630616144    JMI_ARRAY_INIT_1(HEAP, jmi_string_t, jmi_string_array_t, o_a, jmi_array_size(s_a, 0), 1, jmi_array_size(s_a, 0))
    16307     i1_1in = 0;
    16308     i1_1ie = floor((jmi_array_size(s_a, 0)) - (1));
    16309     for (i1_1i = 1; i1_1in <= i1_1ie; i1_1i = 1 + (++i1_1in)) {
    16310         JMI_ASG(STR, jmi_array_ref_1(o_a, i1_1i), jmi_array_val_1(s_a, i1_1i))
    16311     }
     16145    JMI_ASG(STR_ARR, o_a, s_a)
    1631216146    JMI_RET(STR_ARR, o_o, o_a)
    1631316147    JMI_DYNAMIC_FREE()
     
    1635516189    jmi_int_t i1_0ie;
    1635616190    jmi_int_t i1_0in;
    16357     jmi_real_t i1_1i;
    16358     jmi_int_t i1_1ie;
    16359     jmi_int_t i1_1in;
    1636016191    JMI_ARR(HEAP, jmi_string_t, jmi_string_array_t, tmp_1, -1, 1)
    1636116192    JMI_ARRAY_INIT_1(HEAP, jmi_string_t, jmi_string_array_t, s_a, n_v, 1, n_v)
     
    1636716198        JMI_ASG(STR, jmi_array_ref_1(temp_1_a, i1_0i), \"str\")
    1636816199    }
    16369     i1_1in = 0;
    16370     i1_1ie = floor((n_v) - (1));
    16371     for (i1_1i = 1; i1_1in <= i1_1ie; i1_1i = 1 + (++i1_1in)) {
    16372         JMI_ASG(STR, jmi_array_ref_1(s_a, i1_1i), jmi_array_val_1(temp_1_a, i1_1i))
    16373     }
     16200    JMI_ASG(STR_ARR, s_a, temp_1_a)
    1637416201    JMI_ARRAY_INIT_1(HEAP, jmi_string_t, jmi_string_array_t, tmp_1, n_v, 1, n_v)
    1637516202    func_CCodeGenTests_StringOperations11_f1_def1(s_a, tmp_1);
     
    1638816215    JMI_DYNAMIC_INIT()
    1638916216    JMI_ARR(HEAP, jmi_string_t, jmi_string_array_t, o_a, -1, 1)
    16390     jmi_real_t i1_2i;
    16391     jmi_int_t i1_2ie;
    16392     jmi_int_t i1_2in;
    1639316217    JMI_ARRAY_INIT_1(HEAP, jmi_string_t, jmi_string_array_t, o_a, jmi_array_size(s_a, 0), 1, jmi_array_size(s_a, 0))
    16394     i1_2in = 0;
    16395     i1_2ie = floor((jmi_array_size(s_a, 0)) - (1));
    16396     for (i1_2i = 1; i1_2in <= i1_2ie; i1_2i = 1 + (++i1_2in)) {
    16397         JMI_ASG(STR, jmi_array_ref_1(o_a, i1_2i), jmi_array_val_1(s_a, i1_2i))
    16398     }
     16218    JMI_ASG(STR_ARR, o_a, s_a)
    1639916219    JMI_RET(STR_ARR, o_o, o_a)
    1640016220    JMI_DYNAMIC_FREE()
  • branches/dev-jk-2720/Compiler/ModelicaFlatTree/src/jastadd/ConstantEvaluation/ConstantEvaluation.jrag

    r13897 r14165  
    26962696        if (var != null && !var.isUnknown()) {
    26972697            Index i = Index.NULL;
    2698             if (var.ndims() > 0 && hasFArraySubscripts()) {
     2698            /* Slices have been delegated to cevalArray. */
     2699            /* Non-slice arrays do not have subscripts. */
     2700            if (hasFArraySubscripts()) {
    26992701                i = getFArraySubscripts().createIndex(evaluator);
    27002702            }
  • branches/dev-jk-2720/Compiler/ModelicaFlatTree/test/modelica/EvaluationTests.mo

    r14150 r14165  
    29812981    annotation(__JModelica(UnitTesting(tests={
    29822982        TransformCanonicalTestCase(
    2983             name="IfStmt1",
     2983            name="Partial_IfStmt1",
    29842984            description="Partial evaluation of if stmt. All branches known.",
    29852985            inline_functions="none",
     
    29982998 algorithm
    29992999  init y as Real[size(x, 1)];
    3000   for i1 in 1:size(x, 1) loop
    3001    y[i1] := x[i1];
    3002   end for;
     3000  y := x;
    30033001  if x[1] < x[2] then
    30043002   for i1 in 1:size(x, 1) loop
     
    30893087    annotation(__JModelica(UnitTesting(tests={
    30903088        TransformCanonicalTestCase(
    3091             name="IfStmt4",
     3089            name="Partial_IfStmt4",
    30923090            description="Partial evaluation of if stmt. Unknown branch.",
    30933091            inline_functions="none",
     
    31113109   end for;
    31123110  else
    3113    for i1 in 1:size(x, 1) loop
    3114     y[i1] := x[i1];
    3115    end for;
     3111   y := x;
    31163112  end if;
    31173113  return;
     
    31393135    annotation(__JModelica(UnitTesting(tests={
    31403136        TransformCanonicalTestCase(
    3141             name="IfStmt5",
     3137            name="Partial_IfStmt5",
    31423138            description="Partial evaluation of if stmt. Unknown branch.",
    31433139            inline_functions="none",
     
    31563152 algorithm
    31573153  init y as Real[size(x, 1)];
    3158   for i1 in 1:size(x, 1) loop
    3159    y[i1] := x[i1];
    3160   end for;
     3154  y := x;
    31613155  if x[1] < x[2] then
    3162    for i1 in 1:size(x, 1) loop
    3163     y[i1] := x[i1];
    3164    end for;
     3156   y := x;
    31653157  else
    31663158   for i1 in 1:size(x, 1) loop
     
    32293221    annotation(__JModelica(UnitTesting(tests={
    32303222        TransformCanonicalTestCase(
    3231             name="IfStmt7",
     3223            name="Partial_IfStmt7",
    32323224            description="Partial evaluation of if stmt. Partially known array.",
    32333225            inline_functions="none",
     
    32463238 algorithm
    32473239  init y as Real[size(x, 1)];
    3248   for i1 in 1:size(x, 1) loop
    3249    y[i1] := x[i1];
    3250   end for;
     3240  y := x;
    32513241  if x[1] < x[2] then
    32523242   for i1 in 1:size(x, 1) loop
     
    32553245   y[1] := x[1];
    32563246  else
    3257    for i1 in 1:size(x, 1) loop
    3258     y[i1] := x[i1];
    3259    end for;
     3247   y := x;
    32603248   y[2] := 0;
    32613249  end if;
     
    33913379    annotation(__JModelica(UnitTesting(tests={
    33923380        TransformCanonicalTestCase(
    3393             name="IfStmt10",
     3381            name="Partial_IfStmt10",
    33943382            description="Partial evaluation of if stmt. Break.",
    33953383            inline_functions="none",
     
    34103398 algorithm
    34113399  init y as Real[size(x, 1)];
    3412   for i1 in 1:size(x, 1) loop
    3413    y[i1] := x[i1];
    3414   end for;
     3400  y := x;
    34153401  for i in 1:size(x, 1) loop
    34163402   if x[i] > 1 then
     
    34873473    annotation(__JModelica(UnitTesting(tests={
    34883474        TransformCanonicalTestCase(
    3489             name="IfStmt12",
     3475            name="Partial_IfStmt12",
    34903476            description="Partial evaluation of if stmt. Assigned in only one branch.",
    34913477            inline_functions="none",
     
    35103496 algorithm
    35113497  init y1 as Real[size(x, 1)];
    3512   for i1 in 1:size(x, 1) loop
    3513    y1[i1] := x[i1];
    3514   end for;
     3498  y1 := x;
    35153499  if x[1] < x[2] then
    35163500   for i1 in 1:size(x, 1) loop
     
    35193503   y2 := 3;
    35203504  else
    3521    for i1 in 1:size(x, 1) loop
    3522     y1[i1] := x[i1];
    3523    end for;
     3505   y1 := x;
    35243506   y1[2] := 0;
    35253507   y3 := 3;
  • branches/dev-jk-2720/Compiler/ModelicaFrontEnd/src/java/org/jmodelica/util/streams/NotNullCodeStream.java

    r12940 r14165  
    3535    @Override
    3636    public void print(String s) {
    37         if (s == null)
     37        if (s == null) {
    3838            throw new NullPointerException();
     39        }
    3940        super.print(s);
    4041    }
     
    4243    @Override
    4344    public void print(Object o) {
    44         if (o == null)
     45        if (o == null) {
    4546            throw new NullPointerException();
     47        }
    4648        super.print(o);
    4749    }
     
    4951    @Override
    5052    public void format(String format, Object... args) {
    51         for (Object obj : args)
    52             if (obj == null)
     53        for (Object obj : args) {
     54            if (obj == null) {
    5355                throw new NullPointerException();
     56            }
     57        }
    5458        super.format(format, args);
    5559    }
  • branches/dev-jk-2720/Compiler/ModelicaFrontEnd/test/modelica/ArrayBuiltins.mo

    r14150 r14165  
    14671467    Real[2,3] x = f({{1,3},{5,7},{9,11}});
    14681468
    1469     annotation(__JModelica(UnitTesting(tests={
    1470         TransformCanonicalTestCase(
    1471             name="Transpose_Transpose11",
    1472             description="Scalarization of transpose operator: unknown size",
    1473             inline_functions="none",
    1474             variability_propagation=false,
    1475             flatModel="
     1469annotation(__JModelica(UnitTesting(tests={
     1470    TransformCanonicalTestCase(
     1471        name="Transpose_Transpose11",
     1472        description="Scalarization of transpose operator: unknown size",
     1473        inline_functions="none",
     1474        variability_propagation=false,
     1475        flatModel="
    14761476fclass ArrayBuiltins.Transpose.Transpose11
    14771477 Real x[1,1];
     
    15021502   end for;
    15031503  end for;
    1504   for i1 in 1:size(a, 2) loop
    1505    for i2 in 1:size(a, 1) loop
    1506     b[i1,i2] := temp_1[i1,i2];
    1507    end for;
    1508   end for;
     1504  b := temp_1;
    15091505  return;
    15101506 end ArrayBuiltins.Transpose.Transpose11.f;
     
    22592255    Real[:] d = f({time,time});
    22602256
    2261     annotation(__JModelica(UnitTesting(tests={
    2262         TransformCanonicalTestCase(
    2263             name="Cat_ArrayCat12",
    2264             description="Single argument cat",
    2265             eliminate_linear_equations=false,
    2266             flatModel="
     2257annotation(__JModelica(UnitTesting(tests={
     2258    TransformCanonicalTestCase(
     2259        name="Cat_ArrayCat12",
     2260        description="Single argument cat",
     2261        eliminate_linear_equations=false,
     2262        flatModel="
    22672263fclass ArrayBuiltins.Cat.ArrayCat12
    22682264 constant Real k[1] = 1;
     
    22882284   temp_1[i1] := x[i1];
    22892285  end for;
    2290   for i1 in 1:size(x, 1) loop
    2291    y[i1] := temp_1[i1];
    2292   end for;
     2286  y := temp_1;
    22932287  return;
    22942288 annotation(Inline = false);
  • branches/dev-jk-2720/Compiler/ModelicaFrontEnd/test/modelica/ArrayTests.mo

    r14150 r14165  
    66906690   temp_1[i1] := i1 ^ 2;
    66916691  end for;
    6692   for i1 in 1:max(integer(a / 2), 0) loop
    6693    x[i1] := temp_1[i1];
    6694   end for;
     6692  x := temp_1;
    66956693  return;
    66966694 annotation(Inline = false);
     
    67406738   temp_1[i1] := (2 + (i1 - 1) * 0.5) ^ 2;
    67416739  end for;
    6742   for i1 in 1:max(integer((a / 2 - 2) / 0.5) + 1, 0) loop
    6743    x1[i1] := temp_1[i1];
    6744   end for;
     6740  x1 := temp_1;
    67456741  init x2 as Real[max(integer((a / 2 - 2) / 0.5) + 1, 0)];
    67466742  init temp_2 as Integer[max(integer((a / 2 - 2) / 0.5) + 1, 0)];
     
    67486744   temp_2[i1] := 2 + (i1 - 1) * 0.5;
    67496745  end for;
    6750   for i1 in 1:max(integer((a / 2 - 2) / 0.5) + 1, 0) loop
    6751    x2[i1] := temp_2[i1];
    6752   end for;
     6746  x2 := temp_2;
    67536747  init x3 as Real[max(integer((a / 2 - 2) / 0.5) + 1, 0)];
    67546748  for i1 in 1:max(integer((a / 2 - 2) / 0.5) + 1, 0) loop
     
    77497743    (ae[{5,4,3,2,1}],) = fw();
    77507744
    7751     annotation(__JModelica(UnitTesting(tests={
    7752         TransformCanonicalTestCase(
    7753             name="Slices_SliceTest4",
    7754             description="Slice operations: test with vector indices",
    7755             eliminate_alias_variables=false,
    7756             variability_propagation=false,
    7757             flatModel="
     7745annotation(__JModelica(UnitTesting(tests={
     7746    TransformCanonicalTestCase(
     7747        name="Slices_SliceTest4",
     7748        description="Slice operations: test with vector indices",
     7749        eliminate_alias_variables=false,
     7750        variability_propagation=false,
     7751        flatModel="
    77587752fclass ArrayTests.Slices.SliceTest4
    77597753 Real a[1];
     
    78227816  init o as Real[2];
    78237817  dummy := 1;
    7824   for i1 in 1:2 loop
    7825    o[i1] := i[i1];
    7826   end for;
     7818  o := i;
    78277819  return;
    78287820 end ArrayTests.Slices.SliceTest4.f;
     
    89198911    a[2] = time;
    89208912
    8921     annotation(__JModelica(UnitTesting(tests={
    8922         TransformCanonicalTestCase(
    8923             name="VariableIndex_Slice6",
    8924             description="Using variable index in slice over models, complex example",
    8925             variability_propagation=false,
    8926             flatModel="
     8913annotation(__JModelica(UnitTesting(tests={
     8914    TransformCanonicalTestCase(
     8915        name="VariableIndex_Slice6",
     8916        description="Using variable index in slice over models, complex example",
     8917        variability_propagation=false,
     8918        flatModel="
    89278919fclass ArrayTests.VariableIndex.Slice6
    89288920 Real a[1];
     
    89338925 Real temp_1[1];
    89348926 Real temp_1[2];
    8935 initial equation 
     8927initial equation
    89368928 pre(b[1]) = 0;
    89378929 pre(b[2]) = 0;
     
    89548946  temp_1[1] := x;
    89558947  temp_1[2] := x;
    8956   for i1 in 1:2 loop
    8957    y[i1] := temp_1[i1];
    8958   end for;
     8948  y := temp_1;
    89598949  return;
    89608950 annotation(Inline = false);
     
    96799669    Real y = if sum(f(time))>0 then sum(f(time)) else sum(f(time+1));
    96809670   
    9681     annotation(__JModelica(UnitTesting(tests={
    9682         TransformCanonicalTestCase(
    9683             name="IfExprTemp1",
    9684             description="",
    9685             inline_functions="none",
    9686             flatModel="
     9671annotation(__JModelica(UnitTesting(tests={
     9672    TransformCanonicalTestCase(
     9673        name="IfExprTemp1",
     9674        description="",
     9675        inline_functions="none",
     9676        flatModel="
    96879677fclass ArrayTests.IfExprTemp1
    96889678 Real y;
     
    97199709  temp_1[1] := x;
    97209710  temp_1[2] := x + 1;
    9721   for i1 in 1:2 loop
    9722    y[i1] := temp_1[i1];
    9723   end for;
     9711  y := temp_1;
    97249712  return;
    97259713 end ArrayTests.IfExprTemp1.f;
     
    97409728    y := if sum(f(time)) > 0 then sum(f(time)) else sum(f(time + 1));
    97419729
    9742     annotation(__JModelica(UnitTesting(tests={
    9743         TransformCanonicalTestCase(
    9744             name="IfExprTemp2",
    9745             description="",
    9746             inline_functions="none",
    9747             flatModel="
     9730annotation(__JModelica(UnitTesting(tests={
     9731    TransformCanonicalTestCase(
     9732        name="IfExprTemp2",
     9733        description="",
     9734        inline_functions="none",
     9735        flatModel="
    97489736fclass ArrayTests.IfExprTemp2
    97499737 Real y;
     
    97779765  temp_1[1] := x;
    97789766  temp_1[2] := x + 1;
    9779   for i1 in 1:2 loop
    9780    y[i1] := temp_1[i1];
    9781   end for;
     9767  y := temp_1;
    97829768  return;
    97839769 end ArrayTests.IfExprTemp2.f;
     
    98009786      y = if der(x) > x then 1 else if der(x) > x then 1 else sum(f(x));
    98019787   
    9802     annotation(__JModelica(UnitTesting(tests={
    9803         TransformCanonicalTestCase(
    9804             name="IfExprTemp3",
    9805             description="",
    9806             inline_functions="none",
    9807             flatModel="
     9788annotation(__JModelica(UnitTesting(tests={
     9789    TransformCanonicalTestCase(
     9790        name="IfExprTemp3",
     9791        description="",
     9792        inline_functions="none",
     9793        flatModel="
    98089794fclass ArrayTests.IfExprTemp3
    98099795 Real x;
     
    98119797 Real temp_1[1];
    98129798 Real temp_1[2];
    9813 initial equation 
     9799initial equation
    98149800 x = 0.0;
    98159801equation
     
    98339819  temp_1[1] := x;
    98349820  temp_1[2] := x + 1;
    9835   for i1 in 1:2 loop
    9836    y[i1] := temp_1[i1];
    9837   end for;
     9821  y := temp_1;
    98389822  return;
    98399823 end ArrayTests.IfExprTemp3.f;
  • branches/dev-jk-2720/Compiler/ModelicaFrontEnd/test/modelica/FunctionTests.mo

    r14150 r14165  
    44784478 Real x = f();
    44794479
    4480     annotation(__JModelica(UnitTesting(tests={
    4481         TransformCanonicalTestCase(
    4482             name="ArrayExpInFunc1",
    4483             description="Scalarization of functions: assign from array",
    4484             variability_propagation=false,
    4485             flatModel="
     4480annotation(__JModelica(UnitTesting(tests={
     4481    TransformCanonicalTestCase(
     4482        name="ArrayExpInFunc1",
     4483        description="Scalarization of functions: assign from array",
     4484        variability_propagation=false,
     4485        flatModel="
    44864486fclass FunctionTests.ArrayExpInFunc1
    44874487 Real x;
     
    45014501  temp_1[2] := 2;
    45024502  temp_1[3] := 3;
    4503   for i1 in 1:3 loop
    4504    x[i1] := temp_1[i1];
    4505   end for;
     4503  x := temp_1;
    45064504  return;
    45074505 end FunctionTests.ArrayExpInFunc1.f;
     
    45224520 Real x = f();
    45234521
    4524     annotation(__JModelica(UnitTesting(tests={
    4525         TransformCanonicalTestCase(
    4526             name="ArrayExpInFunc2",
    4527             description="Scalarization of functions: assign from array exp",
    4528             variability_propagation=false,
    4529             flatModel="
     4522annotation(__JModelica(UnitTesting(tests={
     4523    TransformCanonicalTestCase(
     4524        name="ArrayExpInFunc2",
     4525        description="Scalarization of functions: assign from array exp",
     4526        variability_propagation=false,
     4527        flatModel="
    45304528fclass FunctionTests.ArrayExpInFunc2
    45314529 Real x;
     
    45844582   end for;
    45854583  end for;
    4586   for i1 in 1:2 loop
    4587    for i2 in 1:2 loop
    4588     x[i1,i2] := temp_1[i1,i2];
    4589    end for;
    4590   end for;
     4584  x := temp_1;
    45914585  return;
    45924586 end FunctionTests.ArrayExpInFunc2.f;
     
    46574651 Real x = f();
    46584652
    4659     annotation(__JModelica(UnitTesting(tests={
    4660         TransformCanonicalTestCase(
    4661             name="ArrayExpInFunc4",
    4662             description="Scalarization of functions: binding exp to array var",
    4663             variability_propagation=false,
    4664             flatModel="
     4653annotation(__JModelica(UnitTesting(tests={
     4654    TransformCanonicalTestCase(
     4655        name="ArrayExpInFunc4",
     4656        description="Scalarization of functions: binding exp to array var",
     4657        variability_propagation=false,
     4658        flatModel="
    46654659fclass FunctionTests.ArrayExpInFunc4
    46664660 Real x;
     
    47194713   end for;
    47204714  end for;
    4721   for i1 in 1:2 loop
    4722    for i2 in 1:2 loop
    4723     x[i1,i2] := temp_1[i1,i2];
    4724    end for;
    4725   end for;
     4715  x := temp_1;
    47264716  return;
    47274717 end FunctionTests.ArrayExpInFunc4.f;
     
    48234813 Real x = f();
    48244814
    4825     annotation(__JModelica(UnitTesting(tests={
    4826         TransformCanonicalTestCase(
    4827             name="ArrayExpInFunc6",
    4828             description="Scalarization of functions: if statements",
    4829             variability_propagation=false,
    4830             flatModel="
     4815annotation(__JModelica(UnitTesting(tests={
     4816    TransformCanonicalTestCase(
     4817        name="ArrayExpInFunc6",
     4818        description="Scalarization of functions: if statements",
     4819        variability_propagation=false,
     4820        flatModel="
    48314821fclass FunctionTests.ArrayExpInFunc6
    48324822 Real x;
     
    48494839   temp_1[2] := 2;
    48504840   temp_1[3] := 3;
    4851    for i1 in 1:3 loop
    4852     x[i1] := temp_1[i1];
    4853    end for;
     4841   x := temp_1;
    48544842  elseif o < 1.5 then
    48554843   init temp_2 as Integer[3];
     
    48574845   temp_2[2] := 5;
    48584846   temp_2[3] := 6;
    4859    for i1 in 1:3 loop
    4860     x[i1] := temp_2[i1];
    4861    end for;
     4847   x := temp_2;
    48624848  else
    48634849   init temp_3 as Integer[3];
     
    48654851   temp_3[2] := 8;
    48664852   temp_3[3] := 9;
    4867    for i1 in 1:3 loop
    4868     x[i1] := temp_3[i1];
    4869    end for;
     4853   x := temp_3;
    48704854  end if;
    48714855  return;
     
    51395123    r = f2();
    51405124
    5141     annotation(__JModelica(UnitTesting(tests={
    5142         TransformCanonicalTestCase(
    5143             name="ArrayExpInFunc12",
    5144             description="Scalarization of functions: temp in record constructor",
    5145             variability_propagation=false,
    5146             inline_functions="none",
    5147             flatModel="
     5125annotation(__JModelica(UnitTesting(tests={
     5126    TransformCanonicalTestCase(
     5127        name="ArrayExpInFunc12",
     5128        description="Scalarization of functions: temp in record constructor",
     5129        variability_propagation=false,
     5130        inline_functions="none",
     5131        flatModel="
    51485132fclass FunctionTests.ArrayExpInFunc12
    51495133 Real r.x[1];
     
    51735157  temp_1[1] := 1;
    51745158  temp_1[2] := 2;
    5175   for i1 in 1:2 loop
    5176    o[i1] := temp_1[i1];
    5177   end for;
     5159  o := temp_1;
    51785160  return;
    51795161 end FunctionTests.ArrayExpInFunc12.f1;
     
    54745456    (ae[{3,2,1}],) = fw({1,2,3});
    54755457
    5476     annotation(__JModelica(UnitTesting(tests={
    5477         TransformCanonicalTestCase(
    5478             name="ArrayExpInFunc18",
    5479             description="Scalarization of functions: unknown size slice in function call stmt",
    5480             variability_propagation=false,
    5481             inline_functions="none",
    5482             flatModel="
     5458annotation(__JModelica(UnitTesting(tests={
     5459    TransformCanonicalTestCase(
     5460        name="ArrayExpInFunc18",
     5461        description="Scalarization of functions: unknown size slice in function call stmt",
     5462        variability_propagation=false,
     5463        inline_functions="none",
     5464        flatModel="
    54835465fclass FunctionTests.ArrayExpInFunc18
    54845466 Real ae[1];
     
    55305512  init o as Real[size(i, 1)];
    55315513  dummy := 1;
    5532   for i1 in 1:size(i, 1) loop
    5533    o[i1] := i[i1];
    5534   end for;
     5514  o := i;
    55355515  return;
    55365516 end FunctionTests.ArrayExpInFunc18.f;
     
    55525532Real[2,2,2] ae = f({{1,2},{3,4}},{{1,2},{3,4}});
    55535533
    5554     annotation(__JModelica(UnitTesting(tests={
    5555         TransformCanonicalTestCase(
    5556             name="ArrayExpInFunc19",
    5557             description="Scalarization of functions: unknown size array expression",
    5558             variability_propagation=false,
    5559             inline_functions="none",
    5560             flatModel="
     5534annotation(__JModelica(UnitTesting(tests={
     5535    TransformCanonicalTestCase(
     5536        name="ArrayExpInFunc19",
     5537        description="Scalarization of functions: unknown size array expression",
     5538        variability_propagation=false,
     5539        inline_functions="none",
     5540        flatModel="
    55615541fclass FunctionTests.ArrayExpInFunc19
    55625542 Real ae[1,1,1];
     
    55905570   end for;
    55915571  end for;
    5592   for i1 in 1:2 loop
    5593    for i2 in 1:size(x1, 1) loop
    5594     for i3 in 1:size(x1, 2) loop
    5595      y[i1,i2,i3] := temp_1[i1,i2,i3];
    5596     end for;
    5597    end for;
    5598   end for;
     5572  y := temp_1;
    55995573  return;
    56005574 end FunctionTests.ArrayExpInFunc19.f;
     
    56815655   end for;
    56825656  end for;
    5683   for i1 in 1:2 loop
    5684    for i2 in 1:size(x1, 1) + 2 loop
    5685     o[i1,i2] := temp_1[i1,i2];
    5686    end for;
    5687   end for;
     5657  o := temp_1;
    56885658  return;
    56895659 end FunctionTests.ArrayExpInFunc20.f;
     
    58205790   end for;
    58215791  end for;
    5822   for i1 in 1:size(x1, 1) * 2 + size(x3, 1) loop
    5823    for i2 in 1:size(x2, 2) + 1 loop
    5824     y[i1,i2] := temp_1[i1,i2];
    5825    end for;
    5826   end for;
     5792  y := temp_1;
    58275793  return;
    58285794 end FunctionTests.ArrayExpInFunc21.f;
     
    61456111equation
    61466112
    6147     annotation(__JModelica(UnitTesting(tests={
    6148         TransformCanonicalTestCase(
    6149             name="ArrayExpInFunc27",
    6150             description="Scalarization of functions: unknown size matrix expression",
    6151             variability_propagation=false,
    6152             inline_functions="none",
    6153             flatModel="
     6113annotation(__JModelica(UnitTesting(tests={
     6114    TransformCanonicalTestCase(
     6115        name="ArrayExpInFunc27",
     6116        description="Scalarization of functions: unknown size matrix expression",
     6117        variability_propagation=false,
     6118        inline_functions="none",
     6119        flatModel="
    61546120fclass FunctionTests.ArrayExpInFunc27
    61556121 Real x[1,1];
     
    61866152   end for;
    61876153  end for;
    6188   for i1 in 1:size(a, 1) loop
    6189    for i2 in 1:size(b, 2) loop
    6190     o[i1,i2] := temp_1[i1,i2];
    6191    end for;
    6192   end for;
     6154  o := temp_1;
    61936155  return;
    61946156 end FunctionTests.ArrayExpInFunc27.f;
     
    62096171equation
    62106172
    6211     annotation(__JModelica(UnitTesting(tests={
    6212         TransformCanonicalTestCase(
    6213             name="ArrayExpInFunc28",
    6214             description="Scalarization of functions: unknown size matrix expression",
    6215             variability_propagation=false,
    6216             inline_functions="none",
    6217             flatModel="
     6173annotation(__JModelica(UnitTesting(tests={
     6174    TransformCanonicalTestCase(
     6175        name="ArrayExpInFunc28",
     6176        description="Scalarization of functions: unknown size matrix expression",
     6177        variability_propagation=false,
     6178        inline_functions="none",
     6179        flatModel="
    62186180fclass FunctionTests.ArrayExpInFunc28
    62196181 Real x[1,1];
     
    62506212   end for;
    62516213  end for;
    6252   for i1 in 1:size(a, 1) loop
    6253    for i2 in 1:size(b, 2) loop
    6254     o[i1,i2] := temp_1[i1,i2];
    6255    end for;
    6256   end for;
     6214  o := temp_1;
    62576215  return;
    62586216 end FunctionTests.ArrayExpInFunc28.f;
     
    63056263   end for;
    63066264  end for;
    6307   for i1 in 1:size(a, 1) + size(b, 1) loop
    6308    for i2 in 1:size(b, 2) loop
    6309     o[i1,i2] := temp_1[i1,i2];
    6310    end for;
    6311   end for;
     6265  o := temp_1;
    63126266  return;
    63136267 end FunctionTests.ArrayExpInFunc29.f;
     
    63926346   end for;
    63936347  end for;
    6394   for i1 in 1:size(a, 1) loop
    6395    for i2 in 1:size(a, 2) + size(b, 2) loop
    6396     for i3 in 1:size(a, 3) loop
    6397      o[i1,i2,i3] := temp_1[i1,i2,i3];
    6398     end for;
    6399    end for;
    6400   end for;
     6348  o := temp_1;
    64016349  return;
    64026350 end FunctionTests.ArrayExpInFunc30.f;
     
    66566604    Real[1,1] y = f(1);
    66576605
    6658     annotation(__JModelica(UnitTesting(tests={
    6659         TransformCanonicalTestCase(
    6660             name="ArrayExpInFunc34",
    6661             description="Scalarization of functions: unknown size identity expression",
    6662             variability_propagation=false,
    6663             inline_functions="none",
    6664             flatModel="
     6606annotation(__JModelica(UnitTesting(tests={
     6607    TransformCanonicalTestCase(
     6608        name="ArrayExpInFunc34",
     6609        description="Scalarization of functions: unknown size identity expression",
     6610        variability_propagation=false,
     6611        inline_functions="none",
     6612        flatModel="
    66656613fclass FunctionTests.ArrayExpInFunc34
    66666614 Real y[1,1];
     
    66816629   end for;
    66826630  end for;
    6683   for i1 in 1:n loop
    6684    for i2 in 1:n loop
    6685     o[i1,i2] := temp_1[i1,i2];
    6686    end for;
    6687   end for;
     6631  o := temp_1;
    66886632  return;
    66896633 end FunctionTests.ArrayExpInFunc34.f;
     
    67516695    Real[1] y = f({1});
    67526696   
    6753     annotation(__JModelica(UnitTesting(tests={
    6754         TransformCanonicalTestCase(
    6755             name="ArrayExpInFunc36",
    6756             description="Scalarization of functions: unknown size vector operator",
    6757             variability_propagation=false,
    6758             inline_functions="none",
    6759             flatModel="
     6697annotation(__JModelica(UnitTesting(tests={
     6698    TransformCanonicalTestCase(
     6699        name="ArrayExpInFunc36",
     6700        description="Scalarization of functions: unknown size vector operator",
     6701        variability_propagation=false,
     6702        inline_functions="none",
     6703        flatModel="
    67606704fclass FunctionTests.ArrayExpInFunc36
    67616705 Real y[1];
     
    67746718   temp_1[i1 - 1 + 1] := a[i1];
    67756719  end for;
    6776   for i1 in 1:size(a, 1) loop
    6777    b[i1] := temp_1[i1];
    6778   end for;
     6720  b := temp_1;
    67796721  return;
    67806722 end FunctionTests.ArrayExpInFunc36.f;
     
    67946736    Real[1,1] y = f({{3}});
    67956737
    6796     annotation(__JModelica(UnitTesting(tests={
    6797         TransformCanonicalTestCase(
    6798             name="ArrayExpInFunc39",
    6799             description="Scalarization of functions: unknown size vector operator, matrix input",
    6800             variability_propagation=false,
    6801             inline_functions="none",
    6802             flatModel="
     6738annotation(__JModelica(UnitTesting(tests={
     6739    TransformCanonicalTestCase(
     6740        name="ArrayExpInFunc39",
     6741        description="Scalarization of functions: unknown size vector operator, matrix input",
     6742        variability_propagation=false,
     6743        inline_functions="none",
     6744        flatModel="
    68036745fclass FunctionTests.ArrayExpInFunc39
    68046746 Real y[1,1];
     
    68196761   end for;
    68206762  end for;
    6821   for i1 in 1:size(a, 1) loop
    6822    for i2 in 1:size(a, 2) loop
    6823     b[i1,i2] := temp_1[i1,i2];
    6824    end for;
    6825   end for;
     6763  b := temp_1;
    68266764  return;
    68276765 end FunctionTests.ArrayExpInFunc39.f;
     
    68696807   end for;
    68706808  end for;
    6871   for i1 in 1:size(a, 1) loop
    6872    for i2 in 1:size(a, 2) loop
    6873     b[i1,i2] := temp_1[i1,i2];
    6874    end for;
    6875   end for;
     6809  b := temp_1;
    68766810  return;
    68776811 end FunctionTests.ArrayExpInFunc40.f;
     
    70416975        Real x[2,2] = F({1,2});
    70426976
    7043     annotation(__JModelica(UnitTesting(tests={
    7044         TransformCanonicalTestCase(
    7045             name="ArrayExpInFunc44",
    7046             description="Scalarization of functions: unknown size in scalar operator",
    7047             variability_propagation=false,
    7048             flatModel="
     6977annotation(__JModelica(UnitTesting(tests={
     6978    TransformCanonicalTestCase(
     6979        name="ArrayExpInFunc44",
     6980        description="Scalarization of functions: unknown size in scalar operator",
     6981        variability_propagation=false,
     6982        flatModel="
    70496983fclass FunctionTests.ArrayExpInFunc44
    70506984 Real x[1,1];
     
    70687002   end for;
    70697003  end for;
    7070   for i1 in 1:size(a, 1) loop
    7071    for i2 in 1:size(a, 1) loop
    7072     b[i1,i2] := temp_1[i1,i2];
    7073    end for;
    7074   end for;
     7004  b := temp_1;
    70757005  return;
    70767006 annotation(Inline = false);
     
    70957025    Real y = f2(3);
    70967026
    7097     annotation(__JModelica(UnitTesting(tests={
    7098         TransformCanonicalTestCase(
    7099             name="ArrayExpInFunc45",
    7100             description="Scalarization of functions: unknown size in scalar operator",
    7101             variability_propagation=false,
    7102             flatModel="
     7027annotation(__JModelica(UnitTesting(tests={
     7028    TransformCanonicalTestCase(
     7029        name="ArrayExpInFunc45",
     7030        description="Scalarization of functions: unknown size in scalar operator",
     7031        variability_propagation=false,
     7032        flatModel="
    71037033fclass FunctionTests.ArrayExpInFunc45
    71047034 Real y;
     
    71347064 algorithm
    71357065  init y as Real[size(x, 1)];
    7136   for i1 in 1:size(x, 1) loop
    7137    y[i1] := x[i1];
    7138   end for;
     7066  y := x;
    71397067  return;
    71407068 end FunctionTests.ArrayExpInFunc45.f1;
     
    75217449    Real[:] y = f({R({1})});
    75227450
    7523     annotation(__JModelica(UnitTesting(tests={
    7524         TransformCanonicalTestCase(
    7525             name="ArrayExpInFunc52",
    7526             description="Scalarizing temporary in size expression",
    7527             variability_propagation=false,
    7528             flatModel="
     7451annotation(__JModelica(UnitTesting(tests={
     7452    TransformCanonicalTestCase(
     7453        name="ArrayExpInFunc52",
     7454        description="Scalarizing temporary in size expression",
     7455        variability_propagation=false,
     7456        flatModel="
    75297457fclass FunctionTests.ArrayExpInFunc52
    75307458 Real y[1];
     
    75467474  (temp_2) := FunctionTests.ArrayExpInFunc52.g(r[1].x);
    75477475  temp_1[2] := size(r[temp_2[1]].x, 1);
    7548   for i1 in 1:2 loop
    7549    y[i1] := temp_1[i1];
    7550   end for;
     7476  y := temp_1;
    75517477  return;
    75527478 annotation(Inline = false);
     
    75587484 algorithm
    75597485  init y as Integer[size(x, 1)];
    7560   for i1 in 1:size(x, 1) loop
    7561    y[i1] := x[i1];
    7562   end for;
     7486  y := x;
    75637487  return;
    75647488 end FunctionTests.ArrayExpInFunc52.g;
     
    75857509 (x,y) = f();
    75867510
    7587     annotation(__JModelica(UnitTesting(tests={
    7588         TransformCanonicalTestCase(
    7589             name="ArrayOutputScalarization1",
    7590             description="Scalarization of array function outputs: function call equation",
    7591             variability_propagation=false,
    7592             inline_functions="none",
    7593             flatModel="
     7511annotation(__JModelica(UnitTesting(tests={
     7512    TransformCanonicalTestCase(
     7513        name="ArrayOutputScalarization1",
     7514        description="Scalarization of array function outputs: function call equation",
     7515        variability_propagation=false,
     7516        inline_functions="none",
     7517        flatModel="
    75947518fclass FunctionTests.ArrayOutputScalarization1
    75957519 Real x[1];
     
    76117535  temp_1[1] := 1;
    76127536  temp_1[2] := 2;
    7613   for i1 in 1:2 loop
    7614    x[i1] := temp_1[i1];
    7615   end for;
     7537  x := temp_1;
    76167538  init y as Real[2];
    76177539  init temp_2 as Integer[2];
    76187540  temp_2[1] := 1;
    76197541  temp_2[2] := 2;
    7620   for i1 in 1:2 loop
    7621    y[i1] := temp_2[i1];
    7622   end for;
     7542  y := temp_2;
    76237543  return;
    76247544 end FunctionTests.ArrayOutputScalarization1.f;
     
    76397559 x = {3,4} + f();
    76407560
    7641     annotation(__JModelica(UnitTesting(tests={
    7642         TransformCanonicalTestCase(
    7643             name="ArrayOutputScalarization2",
    7644             description="Scalarization of array function outputs: expression with func call",
    7645             variability_propagation=false,
    7646             inline_functions="none",
    7647             flatModel="
     7561annotation(__JModelica(UnitTesting(tests={
     7562    TransformCanonicalTestCase(
     7563        name="ArrayOutputScalarization2",
     7564        description="Scalarization of array function outputs: expression with func call",
     7565        variability_propagation=false,
     7566        inline_functions="none",
     7567        flatModel="
    76487568fclass FunctionTests.ArrayOutputScalarization2
    76497569 Real x[1];
     
    76657585  temp_1[1] := 1;
    76667586  temp_1[2] := 2;
    7667   for i1 in 1:2 loop
    7668    x[i1] := temp_1[i1];
    7669   end for;
     7587  x := temp_1;
    76707588  return;
    76717589 end FunctionTests.ArrayOutputScalarization2.f;
     
    76897607 x = {1,2} + f();
    76907608
    7691     annotation(__JModelica(UnitTesting(tests={
    7692         TransformCanonicalTestCase(
    7693             name="ArrayOutputScalarization3",
    7694             description="Scalarization of array function outputs: finding free temp name",
    7695             variability_propagation=false,
    7696             inline_functions="none",
    7697             flatModel="
     7609annotation(__JModelica(UnitTesting(tests={
     7610    TransformCanonicalTestCase(
     7611        name="ArrayOutputScalarization3",
     7612        description="Scalarization of array function outputs: finding free temp name",
     7613        variability_propagation=false,
     7614        inline_functions="none",
     7615        flatModel="
    76987616fclass FunctionTests.ArrayOutputScalarization3
    76997617 Real x[1];
     
    77217639  temp_1[1] := 1;
    77227640  temp_1[2] := 2;
    7723   for i1 in 1:2 loop
    7724    x[i1] := temp_1[i1];
    7725   end for;
     7641  x := temp_1;
    77267642  return;
    77277643 end FunctionTests.ArrayOutputScalarization3.f;
     
    77507666 Real x = f2();
    77517667
    7752     annotation(__JModelica(UnitTesting(tests={
    7753         TransformCanonicalTestCase(
    7754             name="ArrayOutputScalarization4",
    7755             description="Scalarization of array function outputs: function call statement",
    7756             variability_propagation=false,
    7757             flatModel="
     7668annotation(__JModelica(UnitTesting(tests={
     7669    TransformCanonicalTestCase(
     7670        name="ArrayOutputScalarization4",
     7671        description="Scalarization of array function outputs: function call statement",
     7672        variability_propagation=false,
     7673        flatModel="
    77587674fclass FunctionTests.ArrayOutputScalarization4
    77597675 Real x;
     
    77847700  temp_1[1] := 1;
    77857701  temp_1[2] := 2;
    7786   for i1 in 1:2 loop
    7787    x[i1] := temp_1[i1];
    7788   end for;
     7702  x := temp_1;
    77897703  init y as Real[2];
    77907704  init temp_2 as Integer[2];
    77917705  temp_2[1] := 1;
    77927706  temp_2[2] := 2;
    7793   for i1 in 1:2 loop
    7794    y[i1] := temp_2[i1];
    7795   end for;
     7707  y := temp_2;
    77967708  return;
    77977709 end FunctionTests.ArrayOutputScalarization4.f1;
     
    78187730 Real x = f2();
    78197731
    7820     annotation(__JModelica(UnitTesting(tests={
    7821         TransformCanonicalTestCase(
    7822             name="ArrayOutputScalarization5",
    7823             description="Scalarization of array function outputs: assign statement with expression",
    7824             variability_propagation=false,
    7825             flatModel="
     7732annotation(__JModelica(UnitTesting(tests={
     7733    TransformCanonicalTestCase(
     7734        name="ArrayOutputScalarization5",
     7735        description="Scalarization of array function outputs: assign statement with expression",
     7736        variability_propagation=false,
     7737        flatModel="
    78267738fclass FunctionTests.ArrayOutputScalarization5
    78277739 Real x;
     
    78577769  temp_1[1] := 1;
    78587770  temp_1[2] := 2;
    7859   for i1 in 1:2 loop
    7860    x[i1] := temp_1[i1];
    7861   end for;
     7771  x := temp_1;
    78627772  return;
    78637773 end FunctionTests.ArrayOutputScalarization5.f1;
     
    78867796 Real x = f2();
    78877797
    7888     annotation(__JModelica(UnitTesting(tests={
    7889         TransformCanonicalTestCase(
    7890             name="ArrayOutputScalarization6",
    7891             description="Scalarization of array function outputs: finding free temp name",
    7892             variability_propagation=false,
    7893             flatModel="
     7798annotation(__JModelica(UnitTesting(tests={
     7799    TransformCanonicalTestCase(
     7800        name="ArrayOutputScalarization6",
     7801        description="Scalarization of array function outputs: finding free temp name",
     7802        variability_propagation=false,
     7803        flatModel="
    78947804fclass FunctionTests.ArrayOutputScalarization6
    78957805 Real x;
     
    79177827  temp_1[1] := 1;
    79187828  temp_1[2] := 2;
    7919   for i1 in 1:2 loop
    7920    x[i1] := temp_1[i1];
    7921   end for;
     7829  x := temp_1;
    79227830  return;
    79237831 end FunctionTests.ArrayOutputScalarization6.f1;
     
    79547862 Real x = f2(1);
    79557863
    7956     annotation(__JModelica(UnitTesting(tests={
    7957         TransformCanonicalTestCase(
    7958             name="ArrayOutputScalarization7",
    7959             description="Scalarization of array function outputs: if statement",
    7960             variability_propagation=false,
    7961             flatModel="
     7864annotation(__JModelica(UnitTesting(tests={
     7865    TransformCanonicalTestCase(
     7866        name="ArrayOutputScalarization7",
     7867        description="Scalarization of array function outputs: if statement",
     7868        variability_propagation=false,
     7869        flatModel="
    79627870fclass FunctionTests.ArrayOutputScalarization7
    79637871 Real x;
     
    80057913   temp_7[1] := 3;
    80067914   temp_7[2] := 4;
    8007    for i1 in 1:2 loop
    8008     y[i1] := temp_7[i1];
    8009    end for;
     7915   y := temp_7;
    80107916  else
    80117917   x := 1;
     
    80257931  temp_1[1] := 1;
    80267932  temp_1[2] := 2;
    8027   for i1 in 1:2 loop
    8028    x[i1] := temp_1[i1];
    8029   end for;
     7933  x := temp_1;
    80307934  return;
    80317935 end FunctionTests.ArrayOutputScalarization7.f1;
     
    80557959 Real x = f2();
    80567960
    8057     annotation(__JModelica(UnitTesting(tests={
    8058         TransformCanonicalTestCase(
    8059             name="ArrayOutputScalarization8",
    8060             description="Scalarization of array function outputs: for statement",
    8061             variability_propagation=false,
    8062             flatModel="
     7961annotation(__JModelica(UnitTesting(tests={
     7962    TransformCanonicalTestCase(
     7963        name="ArrayOutputScalarization8",
     7964        description="Scalarization of array function outputs: for statement",
     7965        variability_propagation=false,
     7966        flatModel="
    80637967fclass FunctionTests.ArrayOutputScalarization8
    80647968 Real x;
     
    80917995  temp_1[1] := 1;
    80927996  temp_1[2] := 2;
    8093   for i1 in 1:2 loop
    8094    x[i1] := temp_1[i1];
    8095   end for;
     7997  x := temp_1;
    80967998  return;
    80977999 end FunctionTests.ArrayOutputScalarization8.f1;
     
    81128014 x = f();
    81138015
    8114     annotation(__JModelica(UnitTesting(tests={
    8115         TransformCanonicalTestCase(
    8116             name="ArrayOutputScalarization9",
    8117             description="Scalarization of array function outputs: equation without expression",
    8118             variability_propagation=false,
    8119             inline_functions="none",
    8120             eliminate_alias_variables=false,
    8121             flatModel="
     8016annotation(__JModelica(UnitTesting(tests={
     8017    TransformCanonicalTestCase(
     8018        name="ArrayOutputScalarization9",
     8019        description="Scalarization of array function outputs: equation without expression",
     8020        variability_propagation=false,
     8021        inline_functions="none",
     8022        eliminate_alias_variables=false,
     8023        flatModel="
    81228024fclass FunctionTests.ArrayOutputScalarization9
    81238025 Real x[1];
     
    81358037  temp_1[1] := 1;
    81368038  temp_1[2] := 2;
    8137   for i1 in 1:2 loop
    8138    x[i1] := temp_1[i1];
    8139   end for;
     8039  x := temp_1;
    81408040  return;
    81418041 end FunctionTests.ArrayOutputScalarization9.f;
     
    81628062 Real x = f2();
    81638063
    8164     annotation(__JModelica(UnitTesting(tests={
    8165         TransformCanonicalTestCase(
    8166             name="ArrayOutputScalarization10",
    8167             description="Scalarization of array function outputs: while statement",
    8168             variability_propagation=false,
    8169             flatModel="
     8064annotation(__JModelica(UnitTesting(tests={
     8065    TransformCanonicalTestCase(
     8066        name="ArrayOutputScalarization10",
     8067        description="Scalarization of array function outputs: while statement",
     8068        variability_propagation=false,
     8069        flatModel="
    81708070fclass FunctionTests.ArrayOutputScalarization10
    81718071 Real x;
     
    82068106  temp_1[1] := 1;
    82078107  temp_1[2] := 2;
    8208   for i1 in 1:2 loop
    8209    x[i1] := temp_1[i1];
    8210   end for;
     8108  x := temp_1;
    82118109  return;
    82128110 end FunctionTests.ArrayOutputScalarization10.f1;
     
    82328130 Real x = f2();
    82338131
    8234     annotation(__JModelica(UnitTesting(tests={
    8235         TransformCanonicalTestCase(
    8236             name="ArrayOutputScalarization11",
    8237             description="Scalarization of array function outputs: binding expression",
    8238             variability_propagation=false,
    8239             flatModel="
     8132annotation(__JModelica(UnitTesting(tests={
     8133    TransformCanonicalTestCase(
     8134        name="ArrayOutputScalarization11",
     8135        description="Scalarization of array function outputs: binding expression",
     8136        variability_propagation=false,
     8137        flatModel="
    82408138fclass FunctionTests.ArrayOutputScalarization11
    82418139 Real x;
     
    82628160  temp_1[1] := 1;
    82638161  temp_1[2] := 2;
    8264   for i1 in 1:2 loop
    8265    x[i1] := temp_1[i1];
    8266   end for;
     8162  x := temp_1;
    82678163  return;
    82688164 end FunctionTests.ArrayOutputScalarization11.f1;
     
    82888184 Real x = f2();
    82898185
    8290     annotation(__JModelica(UnitTesting(tests={
    8291         TransformCanonicalTestCase(
    8292             name="ArrayOutputScalarization12",
    8293             description="Scalarization of array function outputs: part of binding expression",
    8294             variability_propagation=false,
    8295             flatModel="
     8186annotation(__JModelica(UnitTesting(tests={
     8187    TransformCanonicalTestCase(
     8188        name="ArrayOutputScalarization12",
     8189        description="Scalarization of array function outputs: part of binding expression",
     8190        variability_propagation=false,
     8191        flatModel="
    82968192fclass FunctionTests.ArrayOutputScalarization12
    82978193 Real x;
     
    83278223  temp_1[1] := 1;
    83288224  temp_1[2] := 2;
    8329   for i1 in 1:2 loop
    8330    x[i1] := temp_1[i1];
    8331   end for;
     8225  x := temp_1;
    83328226  return;
    83338227 end FunctionTests.ArrayOutputScalarization12.f1;
     
    83538247 Real x = f2();
    83548248
    8355     annotation(__JModelica(UnitTesting(tests={
    8356         TransformCanonicalTestCase(
    8357             name="ArrayOutputScalarization13",
    8358             description="Scalarization of array function outputs: part of scalar binding exp",
    8359             variability_propagation=false,
    8360             flatModel="
     8249annotation(__JModelica(UnitTesting(tests={
     8250    TransformCanonicalTestCase(
     8251        name="ArrayOutputScalarization13",
     8252        description="Scalarization of array function outputs: part of scalar binding exp",
     8253        variability_propagation=false,
     8254        flatModel="
    83618255fclass FunctionTests.ArrayOutputScalarization13
    83628256 Real x;
     
    83908284  temp_1[1] := 1;
    83918285  temp_1[2] := 2;
    8392   for i1 in 1:2 loop
    8393    x[i1] := temp_1[i1];
    8394   end for;
     8286  x := temp_1;
    83958287  return;
    83968288 end FunctionTests.ArrayOutputScalarization13.f1;
     
    84098301 Real x = f() * {3, 4};
    84108302
    8411     annotation(__JModelica(UnitTesting(tests={
    8412         TransformCanonicalTestCase(
    8413             name="ArrayOutputScalarization14",
    8414             description="Scalarization of array function outputs: part of scalar expression",
    8415             variability_propagation=false,
    8416             inline_functions="none",
    8417             flatModel="
     8303annotation(__JModelica(UnitTesting(tests={
     8304    TransformCanonicalTestCase(
     8305        name="ArrayOutputScalarization14",
     8306        description="Scalarization of array function outputs: part of scalar expression",
     8307        variability_propagation=false,
     8308        inline_functions="none",
     8309        flatModel="
    84188310fclass FunctionTests.ArrayOutputScalarization14
    84198311 Real x;
     
    84338325  temp_1[1] := 1;
    84348326  temp_1[2] := 2;
    8435   for i1 in 1:2 loop
    8436    x[i1] := temp_1[i1];
    8437   end for;
     8327  x := temp_1;
    84388328  return;
    84398329 end FunctionTests.ArrayOutputScalarization14.f;
     
    84848374 Real x = f1();
    84858375
    8486     annotation(__JModelica(UnitTesting(tests={
    8487         TransformCanonicalTestCase(
    8488             name="ArrayOutputScalarization16",
    8489             description="Scalarization of array function outputs: using original arrays",
    8490             variability_propagation=false,
    8491             flatModel="
     8376annotation(__JModelica(UnitTesting(tests={
     8377    TransformCanonicalTestCase(
     8378        name="ArrayOutputScalarization16",
     8379        description="Scalarization of array function outputs: using original arrays",
     8380        variability_propagation=false,
     8381        flatModel="
    84928382fclass FunctionTests.ArrayOutputScalarization16
    84938383 Real x;
     
    85078397  temp_1[1] := 1;
    85088398  temp_1[2] := 2;
    8509   for i1 in 1:2 loop
    8510    x[i1] := temp_1[i1];
    8511   end for;
     8399  x := temp_1;
    85128400  init y as Real[2];
    85138401  (y) := FunctionTests.ArrayOutputScalarization16.f2(x);
     
    85208408 algorithm
    85218409  init y as Real[2];
    8522   for i1 in 1:2 loop
    8523    y[i1] := x[i1];
    8524   end for;
     8410  y := x;
    85258411  return;
    85268412 end FunctionTests.ArrayOutputScalarization16.f2;
     
    85478433 Real x = f1();
    85488434
    8549     annotation(__JModelica(UnitTesting(tests={
    8550         TransformCanonicalTestCase(
    8551             name="ArrayOutputScalarization17",
    8552             description="Scalarization of array function outputs: using original arrays",
    8553             variability_propagation=false,
    8554             flatModel="
     8435annotation(__JModelica(UnitTesting(tests={
     8436    TransformCanonicalTestCase(
     8437        name="ArrayOutputScalarization17",
     8438        description="Scalarization of array function outputs: using original arrays",
     8439        variability_propagation=false,
     8440        flatModel="
    85558441fclass FunctionTests.ArrayOutputScalarization17
    85568442 Real x;
     
    85748460 algorithm
    85758461  init y as Real[2];
    8576   for i1 in 1:2 loop
    8577    y[i1] := x[i1];
    8578   end for;
     8462  y := x;
    85798463  return;
    85808464 end FunctionTests.ArrayOutputScalarization17.f2;
     
    88598743    Real[n,2] c = { f(i) for i in 1:n };
    88608744
    8861     annotation(__JModelica(UnitTesting(tests={
    8862         TransformCanonicalTestCase(
    8863             name="ArrayOutputScalarization22",
    8864             description="Iteration expression with function call",
    8865             inline_functions="none",
    8866             variability_propagation=false,
    8867             flatModel="
     8745annotation(__JModelica(UnitTesting(tests={
     8746    TransformCanonicalTestCase(
     8747        name="ArrayOutputScalarization22",
     8748        description="Iteration expression with function call",
     8749        inline_functions="none",
     8750        variability_propagation=false,
     8751        flatModel="
    88688752fclass FunctionTests.ArrayOutputScalarization22
    88698753 structural parameter Integer n = 3 /* 3 */;
     
    88898773  temp_1[1] := a;
    88908774  temp_1[2] := a * a;
    8891   for i1 in 1:2 loop
    8892    b[i1] := temp_1[i1];
    8893   end for;
     8775  b := temp_1;
    88948776  return;
    88958777 end FunctionTests.ArrayOutputScalarization22.f;
     
    89158797    end for;
    89168798
    8917     annotation(__JModelica(UnitTesting(tests={
    8918         TransformCanonicalTestCase(
    8919             name="ArrayOutputScalarization23",
    8920             description="Function returning array in for loop",
    8921             inline_functions="none",
    8922             variability_propagation=false,
    8923             flatModel="
     8799annotation(__JModelica(UnitTesting(tests={
     8800    TransformCanonicalTestCase(
     8801        name="ArrayOutputScalarization23",
     8802        description="Function returning array in for loop",
     8803        inline_functions="none",
     8804        variability_propagation=false,
     8805        flatModel="
    89248806fclass FunctionTests.ArrayOutputScalarization23
    89258807 structural parameter Integer n = 3 /* 3 */;
     
    89458827  temp_1[1] := a;
    89468828  temp_1[2] := a * a;
    8947   for i1 in 1:2 loop
    8948    b[i1] := temp_1[i1];
    8949   end for;
     8829  b := temp_1;
    89508830  return;
    89518831 end FunctionTests.ArrayOutputScalarization23.f;
     
    89758855    der(z) = { -x, -y };
    89768856
    8977     annotation(__JModelica(UnitTesting(tests={
    8978         TransformCanonicalTestCase(
    8979             name="ArrayOutputScalarization24",
    8980             description="Scalarize use of function returning array in initial equations",
    8981             inline_functions="none",
    8982             flatModel="
     8857annotation(__JModelica(UnitTesting(tests={
     8858    TransformCanonicalTestCase(
     8859        name="ArrayOutputScalarization24",
     8860        description="Scalarize use of function returning array in initial equations",
     8861        inline_functions="none",
     8862        flatModel="
    89838863fclass FunctionTests.ArrayOutputScalarization24
    89848864 Real x(start = 1);
     
    90108890  temp_1[1] := a;
    90118891  temp_1[2] := a * a;
    9012   for i1 in 1:2 loop
    9013    b[i1] := temp_1[i1];
    9014   end for;
     8892  b := temp_1;
    90158893  return;
    90168894 end FunctionTests.ArrayOutputScalarization24.f;
     
    97169594 Real x[2] = f({1,2});
    97179595
    9718     annotation(__JModelica(UnitTesting(tests={
    9719         TransformCanonicalTestCase(
    9720             name="UnknownArray10",
    9721             description="Scalarization of operations on arrays of unknown size: assignment",
    9722             variability_propagation=false,
    9723             inline_functions="none",
    9724             flatModel="
     9596annotation(__JModelica(UnitTesting(tests={
     9597    TransformCanonicalTestCase(
     9598        name="UnknownArray10",
     9599        description="Scalarization of operations on arrays of unknown size: assignment",
     9600        variability_propagation=false,
     9601        inline_functions="none",
     9602        flatModel="
    97259603fclass FunctionTests.UnknownArray10
    97269604 Real x[1];
     
    97359613 algorithm
    97369614  init b as Real[size(a, 1)];
    9737   for i1 in 1:size(a, 1) loop
    9738    b[i1] := a[i1];
    9739   end for;
     9615  b := a;
    97409616  return;
    97419617 end FunctionTests.UnknownArray10.f;
     
    97559631 Real x[2] = f({1,2});
    97569632
    9757     annotation(__JModelica(UnitTesting(tests={
    9758         TransformCanonicalTestCase(
    9759             name="UnknownArray11",
    9760             description="Scalarization of operations on arrays of unknown size: binding expression",
    9761             variability_propagation=false,
    9762             inline_functions="none",
    9763             flatModel="
     9633annotation(__JModelica(UnitTesting(tests={
     9634    TransformCanonicalTestCase(
     9635        name="UnknownArray11",
     9636        description="Scalarization of operations on arrays of unknown size: binding expression",
     9637        variability_propagation=false,
     9638        inline_functions="none",
     9639        flatModel="
    97649640fclass FunctionTests.UnknownArray11
    97659641 Real x[1];
     
    97749650 algorithm
    97759651  init b as Real[size(a, 1)];
    9776   for i1 in 1:size(a, 1) loop
    9777    b[i1] := a[i1];
    9778   end for;
     9652  b := a;
    97799653  return;
    97809654 end FunctionTests.UnknownArray11.f;
     
    98829756 Real x[2,2] = f({{1,2},{3,4}}, {{5,6},{7,8}});
    98839757
    9884     annotation(__JModelica(UnitTesting(tests={
    9885         TransformCanonicalTestCase(
    9886             name="UnknownArray14",
    9887             description="Scalarization of operations on arrays of unknown size: matrix multiplication",
    9888             variability_propagation=false,
    9889             flatModel="
     9758annotation(__JModelica(UnitTesting(tests={
     9759    TransformCanonicalTestCase(
     9760        name="UnknownArray14",
     9761        description="Scalarization of operations on arrays of unknown size: matrix multiplication",
     9762        variability_propagation=false,
     9763        flatModel="
    98909764fclass FunctionTests.UnknownArray14
    98919765 Real x[1,1];
     
    99159789   end for;
    99169790  end for;
    9917   for i1 in 1:size(a, 1) loop
    9918    for i2 in 1:size(b, 2) loop
    9919     o[i1,i2] := temp_1[i1,i2];
    9920    end for;
    9921   end for;
     9791  o := temp_1;
    99229792  return;
    99239793 end FunctionTests.UnknownArray14.f;
     
    100329902 Real x[2,2] = f(y, y, y);
    100339903
    10034     annotation(__JModelica(UnitTesting(tests={
    10035         TransformCanonicalTestCase(
    10036             name="UnknownArray17",
    10037             description="Scalarization of operations on arrays of unknown size: nestled multiplications",
    10038             variability_propagation=false,
    10039             flatModel="
     9904annotation(__JModelica(UnitTesting(tests={
     9905    TransformCanonicalTestCase(
     9906        name="UnknownArray17",
     9907        description="Scalarization of operations on arrays of unknown size: nestled multiplications",
     9908        variability_propagation=false,
     9909        flatModel="
    100409910fclass FunctionTests.UnknownArray17
    100419911 Real y[1,1];
     
    100869956   end for;
    100879957  end for;
    10088   for i1 in 1:size(a, 1) loop
    10089    for i2 in 1:size(c, 2) loop
    10090     o[i1,i2] := temp_1[i1,i2];
    10091    end for;
    10092   end for;
     9958  o := temp_1;
    100939959  return;
    100949960 end FunctionTests.UnknownArray17.f;
     
    1035210218    Real x[3,2] = f({{5,6},{7,8},{9,0}});
    1035310219
    10354     annotation(__JModelica(UnitTesting(tests={
    10355         TransformCanonicalTestCase(
    10356             name="UnknownArray24",
    10357             description="Using array constructors with inputs of unknown size",
    10358             variability_propagation=false,
    10359             flatModel="
     10220annotation(__JModelica(UnitTesting(tests={
     10221    TransformCanonicalTestCase(
     10222        name="UnknownArray24",
     10223        description="Using array constructors with inputs of unknown size",
     10224        variability_propagation=false,
     10225        flatModel="
    1036010226fclass FunctionTests.UnknownArray24
    1036110227 Real x[1,1];
     
    1040210268   end for;
    1040310269  end for;
    10404   for i1 in 1:size(x, 1) loop
    10405    for i2 in 1:2 loop
    10406     y[i1,i2] := temp_1[i1,i2];
    10407    end for;
    10408   end for;
     10270  y := temp_1;
    1040910271  return;
    1041010272 end FunctionTests.UnknownArray24.f;
     
    1068510547    Real[2] x = f2({1,2});
    1068610548
    10687     annotation(__JModelica(UnitTesting(tests={
    10688         TransformCanonicalTestCase(
    10689             name="UnknownArray31",
    10690             description="Assignstatement with right hand side function call.",
    10691             variability_propagation=false,
    10692             flatModel="
     10549annotation(__JModelica(UnitTesting(tests={
     10550    TransformCanonicalTestCase(
     10551        name="UnknownArray31",
     10552        description="Assignstatement with right hand side function call.",
     10553        variability_propagation=false,
     10554        flatModel="
    1069310555fclass FunctionTests.UnknownArray31
    1069410556 Real x[1];
    1069510557 Real x[2];
    1069610558equation
    10697  ({x[1], x[2]}) = FunctionTests.UnknownArray31.f2({1, 2});
    10698 
    10699 public
    10700  function FunctionTests.UnknownArray31.f2
    10701   input Real[:] c;
    10702   output Real[:] d;
    10703  algorithm
    10704   init d as Real[size(c, 1)];
    10705   (d) := FunctionTests.UnknownArray31.f1(c);
    10706   return;
    10707  end FunctionTests.UnknownArray31.f2;
    10708 
    10709  function FunctionTests.UnknownArray31.f1
    10710   input Real[:] a;
    10711   output Real[:] b;
    10712  algorithm
    10713   init b as Real[size(a, 1)];
    10714   for i1 in 1:size(a, 1) loop
    10715    b[i1] := 2 * a[i1];
    10716   end for;
    10717   return;
    10718  end FunctionTests.UnknownArray31.f1;
    10719 
     10559 x[1] = 2.0;
     10560 x[2] = 4.0;
    1072010561end FunctionTests.UnknownArray31;
    1072110562")})));
     
    1079610637    (x,y) = f(f2(f2({time,time*2})));
    1079710638
    10798     annotation(__JModelica(UnitTesting(tests={
    10799         TransformCanonicalTestCase(
    10800             name="UnknownArray33",
    10801             description="Check extraction of function calls in function call equations",
    10802             variability_propagation=false,
    10803             inline_functions="none",
    10804             flatModel="
     10639annotation(__JModelica(UnitTesting(tests={
     10640    TransformCanonicalTestCase(
     10641        name="UnknownArray33",
     10642        description="Check extraction of function calls in function call equations",
     10643        variability_propagation=false,
     10644        inline_functions="none",
     10645        flatModel="
    1080510646fclass FunctionTests.UnknownArray33
    1080610647 Real x;
     
    1083110672 algorithm
    1083210673  init b as Real[size(a, 1)];
    10833   for i1 in 1:size(a, 1) loop
    10834    b[i1] := a[i1];
    10835   end for;
     10674  b := a;
    1083610675  return;
    1083710676 end FunctionTests.UnknownArray33.f2;
     
    1086010699    Real x = f(3);
    1086110700   
    10862     annotation(__JModelica(UnitTesting(tests={
    10863         TransformCanonicalTestCase(
    10864             name="UnknownArray34",
    10865             description="Known to unknown size assignment",
    10866             variability_propagation=false,
    10867             inline_functions="none",
    10868             flatModel="
     10701annotation(__JModelica(UnitTesting(tests={
     10702    TransformCanonicalTestCase(
     10703        name="UnknownArray34",
     10704        description="Known to unknown size assignment",
     10705        variability_propagation=false,
     10706        inline_functions="none",
     10707        flatModel="
    1086910708fclass FunctionTests.UnknownArray34
    1087010709 Real x;
     
    1088710726  temp_1[2] := 2;
    1088810727  temp_1[3] := 3;
    10889   for i1 in 1:n loop
    10890    d[i1] := temp_1[i1];
    10891   end for;
     10728  d := temp_1;
    1089210729  assert(n == 3, \"Mismatching sizes in FunctionTests.UnknownArray34.f\");
    10893   for i1 in 1:3 loop
    10894    c[i1] := d[i1];
    10895   end for;
     10730  c := d;
    1089610731  b := 1;
    1089710732  return;
     
    1091610751    Real x = f(3, {1,2,3});
    1091710752   
    10918     annotation(__JModelica(UnitTesting(tests={
    10919         TransformCanonicalTestCase(
    10920             name="UnknownArray35",
    10921             description="Known to unknown size assignment",
    10922             variability_propagation=false,
    10923             inline_functions="none",
    10924             flatModel="
     10753annotation(__JModelica(UnitTesting(tests={
     10754    TransformCanonicalTestCase(
     10755        name="UnknownArray35",
     10756        description="Known to unknown size assignment",
     10757        variability_propagation=false,
     10758        inline_functions="none",
     10759        flatModel="
    1092510760fclass FunctionTests.UnknownArray35
    1092610761 Real x;
     
    1094910784   temp_1[3,i1] := d[i1];
    1095010785  end for;
    10951   for i1 in 1:n loop
    10952    for i2 in 1:3 loop
    10953     e[i1,i2] := temp_1[i1,i2];
    10954    end for;
    10955   end for;
     10786  e := temp_1;
    1095610787  b := 1;
    1095710788  return;
     
    1098610817    Real x = f1(2);
    1098710818   
    10988     annotation(__JModelica(UnitTesting(tests={
    10989         TransformCanonicalTestCase(
    10990             name="UnknownArray36",
    10991             description="Known to unknown size assignment",
    10992             variability_propagation=false,
    10993             inline_functions="none",
    10994             flatModel="
     10819annotation(__JModelica(UnitTesting(tests={
     10820    TransformCanonicalTestCase(
     10821        name="UnknownArray36",
     10822        description="Known to unknown size assignment",
     10823        variability_propagation=false,
     10824        inline_functions="none",
     10825        flatModel="
    1099510826fclass FunctionTests.UnknownArray36
    1099610827 Real x;
     
    1101510846  end for;
    1101610847  assert(n == 2, \"Mismatching sizes in FunctionTests.UnknownArray36.f1\");
    11017   for i1 in 1:2 loop
    11018    c[i1] := d[i1];
    11019   end for;
     10848  c := d;
    1102010849  assert(n == 2, \"Mismatching sizes in FunctionTests.UnknownArray36.f1\");
    1102110850  (c, d) := FunctionTests.UnknownArray36.f2(c, d);
     
    1103210861  init xout as Real[size(xin, 1)];
    1103310862  assert(size(xin, 1) == 2, \"Mismatching sizes in FunctionTests.UnknownArray36.f2\");
    11034   for i1 in 1:size(xin, 1) loop
    11035    xout[i1] := yin[i1];
    11036   end for;
     10863  xout := yin;
    1103710864  init yout as Real[2];
    1103810865  assert(size(xin, 1) == 2, \"Mismatching sizes in FunctionTests.UnknownArray36.f2\");
    11039   for i1 in 1:2 loop
    11040    yout[i1] := xin[i1];
    11041   end for;
     10866  yout := xin;
    1104210867  return;
    1104310868 end FunctionTests.UnknownArray36.f2;
     
    1107010895    Real x = f1(2, {{1,2},{3,4}});
    1107110896   
    11072     annotation(__JModelica(UnitTesting(tests={
    11073         TransformCanonicalTestCase(
    11074             name="UnknownArray37",
    11075             description="Known to unknown size assignment",
    11076             variability_propagation=false,
    11077             inline_functions="none",
    11078             flatModel="
     10897annotation(__JModelica(UnitTesting(tests={
     10898    TransformCanonicalTestCase(
     10899        name="UnknownArray37",
     10900        description="Known to unknown size assignment",
     10901        variability_propagation=false,
     10902        inline_functions="none",
     10903        flatModel="
    1107910904fclass FunctionTests.UnknownArray37
    1108010905 Real x;
     
    1109110916  init c as Real[2, n];
    1109210917  assert(size(d, 1) == 2, \"Mismatching sizes in FunctionTests.UnknownArray37.f1\");
    11093   for i1 in 1:2 loop
    11094    for i2 in 1:n loop
    11095     c[i1,i2] := d[i1,i2];
    11096    end for;
    11097   end for;
     10918  c := d;
    1109810919  assert(size(d, 1) == 2, \"Mismatching sizes in FunctionTests.UnknownArray37.f1\");
    1109910920  assert(size(d, 2) == 2, \"Mismatching sizes in FunctionTests.UnknownArray37.f1\");
     
    1111110932  init xout as Real[size(xin, 1), size(xin, 2)];
    1111210933  assert(size(xin, 1) == 2, \"Mismatching sizes in FunctionTests.UnknownArray37.f2\");
    11113   for i1 in 1:size(xin, 1) loop
    11114    for i2 in 1:size(xin, 2) loop
    11115     xout[i1,i2] := yin[i1,i2];
    11116    end for;
    11117   end for;
     10934  xout := yin;
    1111810935  init yout as Real[2, 2];
    1111910936  assert(size(xin, 1) == 2, \"Mismatching sizes in FunctionTests.UnknownArray37.f2\");
    1112010937  assert(size(xin, 2) == 2, \"Mismatching sizes in FunctionTests.UnknownArray37.f2\");
    11121   for i1 in 1:2 loop
    11122    for i2 in 1:2 loop
    11123     yout[i1,i2] := xin[i1,i2];
    11124    end for;
    11125   end for;
     10938  yout := xin;
    1112610939  return;
    1112710940 end FunctionTests.UnknownArray37.f2;
     
    1114610959    Real x = f(3, {1,2,3});
    1114710960   
    11148     annotation(__JModelica(UnitTesting(tests={
    11149         TransformCanonicalTestCase(
    11150             name="UnknownArray38",
    11151             description="Checks a more complex combination of known/unknown sizes",
    11152             variability_propagation=false,
    11153             inline_functions="none",
    11154             flatModel="
     10961annotation(__JModelica(UnitTesting(tests={
     10962    TransformCanonicalTestCase(
     10963        name="UnknownArray38",
     10964        description="Checks a more complex combination of known/unknown sizes",
     10965        variability_propagation=false,
     10966        inline_functions="none",
     10967        flatModel="
    1115510968fclass FunctionTests.UnknownArray38
    1115610969 Real x;
     
    1119111004   temp_1[3,i1] := d[i1];
    1119211005  end for;
    11193   for i1 in 1:n loop
    11194    for i2 in 1:3 loop
    11195     e[i1,i2] := temp_1[i1,i2];
    11196    end for;
    11197   end for;
     11006  e := temp_1;
    1119811007  assert(n == 1, \"Mismatching sizes in FunctionTests.UnknownArray38.f\");
    1119911008  init temp_2 as Real[n, 1];
     
    1124411053   end for;
    1124511054  end for;
    11246   for i1 in 1:1 loop
    11247    for i2 in 1:1 loop
    11248     c[i1,i2] := temp_2[i1,i2];
    11249    end for;
    11250   end for;
     11055  c := temp_2;
    1125111056  b := 1;
    1125211057  return;
     
    1171911524    Real[1] y = f1({1});
    1172011525   
    11721     annotation(__JModelica(UnitTesting(tests={
    11722         TransformCanonicalTestCase(
    11723             name="UnknownArray46",
    11724             description="Unknown size if exp as function call arg",
    11725             variability_propagation=false,
    11726             inline_functions="none",
    11727             flatModel="
     11526annotation(__JModelica(UnitTesting(tests={
     11527    TransformCanonicalTestCase(
     11528        name="UnknownArray46",
     11529        description="Unknown size if exp as function call arg",
     11530        variability_propagation=false,
     11531        inline_functions="none",
     11532        flatModel="
    1172811533fclass FunctionTests.UnknownArray46
    1172911534 Real y[1];
     
    1175411559 algorithm
    1175511560  init y as Real[size(x, 1)];
    11756   for i1 in 1:size(x, 1) loop
    11757    y[i1] := x[i1];
    11758   end for;
     11561  y := x;
    1175911562  return;
    1176011563 end FunctionTests.UnknownArray46.f2;
     
    1178011583    Real[1] y = f1({time});
    1178111584   
    11782     annotation(__JModelica(UnitTesting(tests={
    11783         TransformCanonicalTestCase(
    11784             name="UnknownArray47",
    11785             description="Test flattening of function call sizes with unknown size args #3806",
    11786             flatModel="
     11585annotation(__JModelica(UnitTesting(tests={
     11586    TransformCanonicalTestCase(
     11587        name="UnknownArray47",
     11588        description="Test flattening of function call sizes with unknown size args #3806",
     11589        flatModel="
    1178711590fclass FunctionTests.UnknownArray47
    1178811591 Real y[1];
     
    1181611619 algorithm
    1181711620  init b as Real[size(a, 1)];
    11818   for i1 in 1:size(a, 1) loop
    11819    b[i1] := a[i1];
    11820   end for;
     11621  b := a;
    1182111622  return;
    1182211623 end FunctionTests.UnknownArray47.f2;
     
    1183711638    Real[1,1] y = f({{time}});
    1183811639   
    11839     annotation(__JModelica(UnitTesting(tests={
    11840         TransformCanonicalTestCase(
    11841             name="UnknownArray48",
    11842             description="Scalarizing known size mul exp with unknown size parts as rhs of assigment. #3788",
    11843             flatModel="
     11640annotation(__JModelica(UnitTesting(tests={
     11641    TransformCanonicalTestCase(
     11642        name="UnknownArray48",
     11643        description="Scalarizing known size mul exp with unknown size parts as rhs of assigment. #3788",
     11644        flatModel="
    1184411645fclass FunctionTests.UnknownArray48
    1184511646 Real y[1,1];
     
    1186511666   end for;
    1186611667  end for;
    11867   for i1 in 1:1 loop
    11868    for i2 in 1:1 loop
    11869     y[i1,i2] := temp_1[i1,i2];
    11870    end for;
    11871   end for;
     11668  y := temp_1;
    1187211669  return;
    1187311670 annotation(Inline = false);
     
    1285512652    Real x[2](start = f()) = {3, 4};
    1285612653
    12857     annotation(__JModelica(UnitTesting(tests={
    12858         TransformCanonicalTestCase(
    12859             name="AttributeTemp1",
    12860             description="Temporary variable for attribute",
    12861             variability_propagation=false,
    12862             inline_functions="none",
    12863             flatModel="
     12654annotation(__JModelica(UnitTesting(tests={
     12655    TransformCanonicalTestCase(
     12656        name="AttributeTemp1",
     12657        description="Temporary variable for attribute",
     12658        variability_propagation=false,
     12659        inline_functions="none",
     12660        flatModel="
    1286412661fclass FunctionTests.AttributeTemp1
    1286512662 Real x[1](start = temp_1[1]);
     
    1288212679  temp_1[1] := 1;
    1288312680  temp_1[2] := 2;
    12884   for i1 in 1:2 loop
    12885    o[i1] := temp_1[i1];
    12886   end for;
     12681  o := temp_1;
    1288712682  return;
    1288812683 end FunctionTests.AttributeTemp1.f;
     
    1359513390  (QR,tau,) = Modelica.Math.Matrices.LAPACK.dgeqpf(A);
    1359613391
    13597     annotation(__JModelica(UnitTesting(tests={
    13598         TransformCanonicalTestCase(
    13599             name="Lapack_dgeqpf",
    13600             description="Test scalarization of LAPACK function that has had some issues",
    13601             variability_propagation=false,
    13602             flatModel="
     13392annotation(__JModelica(UnitTesting(tests={
     13393    TransformCanonicalTestCase(
     13394        name="Lapack_dgeqpf",
     13395        description="Test scalarization of LAPACK function that has had some issues",
     13396        variability_propagation=false,
     13397        flatModel="
    1360313398fclass FunctionTests.Lapack_dgeqpf
    1360413399 Real A[1,1];
     
    1363113426 algorithm
    1363213427  init QR as Real[size(A, 1), size(A, 2)];
    13633   for i1 in 1:size(A, 1) loop
    13634    for i2 in 1:size(A, 2) loop
    13635     QR[i1,i2] := A[i1,i2];
    13636    end for;
    13637   end for;
     13428  QR := A;
    1363813429  init tau as Real[min(size(A, 1), size(A, 2))];
    1363913430  init p as Integer[size(A, 2)];
     
    1366013451 (Q,R,) = Modelica.Math.Matrices.QR(A);
    1366113452
    13662     annotation(__JModelica(UnitTesting(tests={
    13663         TransformCanonicalTestCase(
    13664             name="Lapack_QR",
    13665             description="",
    13666             variability_propagation=false,
    13667             flatModel="
     13453annotation(__JModelica(UnitTesting(tests={
     13454    TransformCanonicalTestCase(
     13455        name="Lapack_QR",
     13456        description="",
     13457        variability_propagation=false,
     13458        flatModel="
    1366813459fclass FunctionTests.Lapack_QR
    1366913460 Real A[1,1];
     
    1373813529 algorithm
    1373913530  init QR as Real[size(A, 1), size(A, 2)];
    13740   for i1 in 1:size(A, 1) loop
    13741    for i2 in 1:size(A, 2) loop
    13742     QR[i1,i2] := A[i1,i2];
    13743    end for;
    13744   end for;
     13531  QR := A;
    1374513532  init tau as Real[min(size(A, 1), size(A, 2))];
    1374613533  init p as Integer[size(A, 2)];
     
    1376713554 algorithm
    1376813555  init Aout as Real[size(A, 1), size(A, 2)];
    13769   for i1 in 1:size(A, 1) loop
    13770    for i2 in 1:size(A, 2) loop
    13771     Aout[i1,i2] := A[i1,i2];
    13772    end for;
    13773   end for;
     13556  Aout := A;
    1377413557  init tau as Real[min(size(A, 1), size(A, 2))];
    1377513558  init work as Real[3 * max(1, size(A, 2))];
     
    1379213575 algorithm
    1379313576  init Q as Real[size(QR, 1), size(QR, 2)];
    13794   for i1 in 1:size(QR, 1) loop
    13795    for i2 in 1:size(QR, 2) loop
    13796     Q[i1,i2] := QR[i1,i2];
    13797    end for;
    13798   end for;
     13577  Q := QR;
    1379913578  lda := max(1, size(Q, 1));
    1380013579  lwork := max(1, min(10, size(QR, 2)) * size(QR, 2));
     
    1446814247  temp_1 := temp_2;
    1446914248  init y as Real[temp_1];
    14470   for i1 in 1:temp_1 loop
    14471    y[i1] := x[i1];
    14472   end for;
     14249  y := x;
    1447314250  return;
    1447414251 end FunctionTests.UnknownSize.FuncCallInSize.WithTemporary.g;
     
    1448314260  temp_1[1] := size(x, 1);
    1448414261  temp_1[2] := size(x, 1);
    14485   for i1 in 1:2 loop
    14486    n[i1] := temp_1[i1];
    14487   end for;
     14262  n := temp_1;
    1448814263  return;
    1448914264 end FunctionTests.UnknownSize.FuncCallInSize.WithTemporary.s;
  • branches/dev-jk-2720/Compiler/ModelicaFrontEnd/test/modelica/RecordTests.mo

    r14150 r14165  
    78157815    A a1(y=2);
    78167816
    7817     annotation(__JModelica(UnitTesting(tests={
    7818         TransformCanonicalTestCase(
    7819             name="RecordParam3",
    7820             description="Parameter with default value in record",
    7821             variability_propagation=false,
    7822             inline_functions="none",
    7823             flatModel="
     7817annotation(__JModelica(UnitTesting(tests={
     7818    TransformCanonicalTestCase(
     7819        name="RecordParam3",
     7820        description="Parameter with default value in record",
     7821        variability_propagation=false,
     7822        inline_functions="none",
     7823        flatModel="
    78247824fclass RecordTests.RecordParam3
    78257825 parameter Real a1.x[1];
     
    78417841  temp_1[1] := i;
    78427842  temp_1[2] := - i;
    7843   for i1 in 1:2 loop
    7844    o[i1] := temp_1[i1];
    7845   end for;
     7843  o := temp_1;
    78467844  return;
    78477845 end RecordTests.RecordParam3.f;
     
    79227920    A a2;
    79237921
    7924     annotation(__JModelica(UnitTesting(tests={
    7925         TransformCanonicalTestCase(
    7926             name="RecordParam6",
    7927             description="",
    7928             variability_propagation=false,
    7929             inline_functions="none",
    7930             flatModel="
     7922annotation(__JModelica(UnitTesting(tests={
     7923    TransformCanonicalTestCase(
     7924        name="RecordParam6",
     7925        description="",
     7926        variability_propagation=false,
     7927        inline_functions="none",
     7928        flatModel="
    79317929fclass RecordTests.RecordParam6
    79327930 parameter Real a1.x[1];
     
    79557953  temp_1[1] := 1;
    79567954  temp_1[2] := 2;
    7957   for i1 in 1:2 loop
    7958    o[i1] := temp_1[i1];
    7959   end for;
     7955  o := temp_1;
    79607956  return;
    79617957 end RecordTests.RecordParam6.f;
  • branches/dev-jk-2720/Compiler/ModelicaFrontEnd/test/modelica/VectorizedFunctionTests.mo

    r12811 r14165  
    578578Real[:] y = f({time});
    579579
    580     annotation(__JModelica(UnitTesting(tests={
    581         TransformCanonicalTestCase(
    582             name="VectorizedCall8",
    583             description="",
    584             flatModel="
     580annotation(__JModelica(UnitTesting(tests={
     581    TransformCanonicalTestCase(
     582        name="Basic_VectorizedCall8",
     583        description="",
     584        flatModel="
    585585fclass VectorizedFunctionTests.Basic.VectorizedCall8
    586586 Real y[1];
     
    599599   temp_1[i1] := VectorizedFunctionTests.Basic.VectorizedCall8.fv(x[i1]);
    600600  end for;
    601   for i1 in 1:1 loop
    602    y[i1] := temp_1[i1];
    603   end for;
     601  y := temp_1;
    604602  return;
    605603 annotation(Inline = false);
     
    631629   
    632630   Real[:] y = g({1,2});
    633        annotation(__JModelica(UnitTesting(tests={
    634         TransformCanonicalTestCase(
    635             name="VectorizedCall9",
    636             description="Unknown size vectorization of function call with regular call as intermediate.",
    637             inline_functions="none",
    638             variability_propagation=false,
    639             flatModel="
     631annotation(__JModelica(UnitTesting(tests={
     632    TransformCanonicalTestCase(
     633        name="Basic_VectorizedCall9",
     634        description="Unknown size vectorization of function call with regular call as intermediate.",
     635        inline_functions="none",
     636        variability_propagation=false,
     637        flatModel="
    640638fclass VectorizedFunctionTests.Basic.VectorizedCall9
    641639 Real y[1];
     
    655653   temp_1[i1] := VectorizedFunctionTests.Basic.VectorizedCall9.f(x1, x1[i1]);
    656654  end for;
    657   for i1 in 1:size(x1, 1) loop
    658    y[i1] := temp_1[i1];
    659   end for;
     655  y := temp_1;
    660656  return;
    661657 end VectorizedFunctionTests.Basic.VectorizedCall9.g;
     
    705701    Real x = f(2);
    706702   
    707     annotation(__JModelica(UnitTesting(tests={
    708         TransformCanonicalTestCase(
    709             name="DifferingUnknownParameters1",
    710             description="Unknown size vectorization of function calls for scalar & matrix inputs.",
    711             inline_functions="none",
    712             variability_propagation=false,
    713             flatModel="
     703annotation(__JModelica(UnitTesting(tests={
     704    TransformCanonicalTestCase(
     705        name="DifferentDimensionedParamerers_DifferingUnknownParameters1",
     706        description="Unknown size vectorization of function calls for scalar & matrix inputs.",
     707        inline_functions="none",
     708        variability_propagation=false,
     709        flatModel="
    714710fclass VectorizedFunctionTests.DifferentDimensionedParamerers.DifferingUnknownParameters1
    715711 Real x;
     
    741737   temp_1[i1] := VectorizedFunctionTests.DifferentDimensionedParamerers.v(d, temp_3);
    742738  end for;
    743   for i1 in 1:d loop
    744    a[i1] := temp_1[i1];
    745   end for;
     739  a := temp_1;
    746740  y := 1;
    747741  return;
     
    773767    Real x = f(2);
    774768   
    775     annotation(__JModelica(UnitTesting(tests={
    776         TransformCanonicalTestCase(
    777             name="DifferingUnknownParameters2",
    778             description="Unknown size vectorization of function calls for array & matrix inputs.",
    779             inline_functions="none",
    780             variability_propagation=false,
    781             flatModel="
     769annotation(__JModelica(UnitTesting(tests={
     770    TransformCanonicalTestCase(
     771        name="DifferentDimensionedParamerers_DifferingUnknownParameters2",
     772        description="Unknown size vectorization of function calls for array & matrix inputs.",
     773        inline_functions="none",
     774        variability_propagation=false,
     775        flatModel="
    782776fclass VectorizedFunctionTests.DifferentDimensionedParamerers.DifferingUnknownParameters2
    783777 Real x;
     
    814808   temp_1[i1] := VectorizedFunctionTests.DifferentDimensionedParamerers.v(temp_2[i1], temp_4);
    815809  end for;
    816   for i1 in 1:d loop
    817    a[i1] := temp_1[i1];
    818   end for;
     810  a := temp_1;
    819811  y := 1;
    820812  return;
     
    941933   
    942934    Real x = z(2);
    943     annotation(__JModelica(UnitTesting(tests={
    944         TransformCanonicalTestCase(
    945             name="NestedVectorizedCalls2",
    946             description="Unknown size vectorization of function call with regular call as input.",
    947             inline_functions="none",
    948             variability_propagation=false,
    949             flatModel="
     935annotation(__JModelica(UnitTesting(tests={
     936    TransformCanonicalTestCase(
     937        name="Nested_NestedVectorizedCalls2",
     938        description="Unknown size vectorization of function call with regular call as input.",
     939        inline_functions="none",
     940        variability_propagation=false,
     941        flatModel="
    950942fclass VectorizedFunctionTests.Nested.NestedVectorizedCalls2
    951943 Real x;
     
    973965   temp_1[i1] := VectorizedFunctionTests.Nested.g(temp_3[i1]);
    974966  end for;
    975   for i1 in 1:d loop
    976    a[i1] := temp_1[i1];
    977   end for;
     967  a := temp_1;
    978968  y := 1;
    979969  return;
     
    10951085   
    10961086    Real x = z(2);
    1097     annotation(__JModelica(UnitTesting(tests={
    1098         TransformCanonicalTestCase(
    1099             name="NestedVectorizedCalls4",
    1100             description="Unknown size vectorization of function call with regular call as intermediate.",
    1101             inline_functions="none",
    1102             variability_propagation=false,
    1103             flatModel="
     1087annotation(__JModelica(UnitTesting(tests={
     1088    TransformCanonicalTestCase(
     1089        name="Nested_NestedVectorizedCalls4",
     1090        description="Unknown size vectorization of function call with regular call as intermediate.",
     1091        inline_functions="none",
     1092        variability_propagation=false,
     1093        flatModel="
    11041094fclass VectorizedFunctionTests.Nested.NestedVectorizedCalls4
    11051095 Real x;
     
    11321122   temp_1[i1] := VectorizedFunctionTests.Nested.g(temp_4[i1]);
    11331123  end for;
    1134   for i1 in 1:d loop
    1135    a[i1] := temp_1[i1];
    1136   end for;
     1124  a := temp_1;
    11371125  y := 1;
    11381126  return;
  • branches/dev-jk-2720/Compiler/ModelicaMiddleEnd/src/jastadd/optimizations/InlineFunctions.jrag

    r12772 r14165  
    12071207        public static class UnknownArray extends Scalar {
    12081208            // TODO: check sizes, and how loop indices are used?
    1209             protected void check(FAccess use, int i) { n += use.inForLoop() ? 1 : 2; }
     1209            protected void check(FAccess use, int i) { n += use.inForLoop() || !use.isSlice() ? 1 : 2; }
    12101210            protected void checkAll(FAccess use)     { n++; }
    12111211        }
  • branches/dev-jk-2720/Compiler/ModelicaMiddleEnd/src/jastadd/scalarization/ScalarizeAlgorithms.jrag

    r12766 r14165  
    173173        isComposite() && left.keepCompositeAssign() && right.keepCompositeAssign() && !left.inLoop();
    174174   
    175     syn boolean FExp.keepCompositeAssign() = useTempVar;
    176     eq FAccessExp.keepCompositeAssign() = !isSlice() && (getFAccess().myTopFV().isInput() || getFAccess().myTopFV().isConstant());
    177     eq FTempAccessExp.keepCompositeAssign() = true;
     175    syn boolean FExp.keepCompositeAssign() = useTempVar && indexNames == null;
     176    eq FAccessExp.keepCompositeAssign() = !isSlice() && getFAccess().myTopFV().keepCompositeAssign();
     177    eq FTempAccessExp.keepCompositeAssign() = indexNames == null;
     178   
     179    syn boolean FAbstractVariable.keepCompositeAssign() = !isRecord() || isImmutable();
     180   
     181    syn boolean FAbstractVariable.isImmutable() = isConstant();
     182    eq FFunctionVariable.isImmutable() = isInput() || getVisibilityType().isTemporary();
     183   
    178184   
    179185    inh boolean FExp.inLoop();
  • branches/dev-jk-2720/Compiler/ModelicaMiddleEnd/test/modelica/AlgorithmTests.mo

    r12716 r14165  
    667667        y[i,:] := f(time);
    668668    end for;
    669     annotation(__JModelica(UnitTesting(tests={
    670         TransformCanonicalTestCase(
    671             name="TempAssign4",
    672             description="Scalarizing assignment temp generation",
    673             flatModel="
     669annotation(__JModelica(UnitTesting(tests={
     670    TransformCanonicalTestCase(
     671        name="TempAssign4",
     672        description="Scalarizing assignment temp generation",
     673        flatModel="
    674674fclass AlgorithmTests.TempAssign4
    675675 Real y[1,1];
     
    706706  temp_1[2] := x;
    707707  temp_1[3] := x;
    708   for i1 in 1:3 loop
    709    y[i1] := temp_1[i1];
    710   end for;
     708  y := temp_1;
    711709  return;
    712710 end AlgorithmTests.TempAssign4.f;
  • branches/dev-jk-2720/Compiler/ModelicaMiddleEnd/test/modelica/Differentiation.mo

    r14150 r14165  
    15391539 algorithm
    15401540  init y as Real[2];
    1541   for i1 in 1:2 loop
    1542    y[i1] := x[i1];
    1543   end for;
     1541  y := x;
    15441542  return;
    15451543 annotation(Inline = false);
  • branches/dev-jk-2720/Compiler/ModelicaMiddleEnd/test/modelica/FunctionInlining.mo

    r12493 r14165  
    41864186    p1 = f1(p2);
    41874187
    4188     annotation(__JModelica(UnitTesting(tests={
    4189         TransformCanonicalTestCase(
    4190             name="InitialSystemInlining3",
    4191             description="Test inlining in the initial system. Test that ensures that equations and variables which define p1 end up in correct equations list (and with correct variability)",
    4192             flatModel="
     4188annotation(__JModelica(UnitTesting(tests={
     4189    TransformCanonicalTestCase(
     4190        name="InitialSystemInlining3",
     4191        description="Test inlining in the initial system. Test that ensures that equations and variables which define p1 end up in correct equations list (and with correct variability)",
     4192        flatModel="
    41934193fclass FunctionInlining.InitialSystemInlining3
    41944194 parameter Real p2 = 2 /* 2 */;
     
    42084208  temp_1[1] := sin(x);
    42094209  temp_1[2] := cos(x);
    4210   for i1 in 1:2 loop
    4211    y[i1] := temp_1[i1];
    4212   end for;
     4210  y := temp_1;
    42134211  return;
    42144212 annotation(Inline = false);
     
    46574655    Real[:,:] y = f2(f1(time));
    46584656   
    4659     annotation(__JModelica(UnitTesting(tests={
    4660         TransformCanonicalTestCase(
    4661             name="ChainedCallInlining11",
    4662             description="Test inlining chained function calls",
    4663             flatModel="
     4657annotation(__JModelica(UnitTesting(tests={
     4658    TransformCanonicalTestCase(
     4659        name="ChainedCallInlining11",
     4660        description="Test inlining chained function calls",
     4661        flatModel="
    46644662fclass FunctionInlining.ChainedCallInlining11
    46654663 Real y[1,1];
     
    46734671 algorithm
    46744672  init y as Real[size(x, 1), size(x, 2)];
    4675   for i1 in 1:size(x, 1) loop
    4676    for i2 in 1:size(x, 2) loop
    4677     y[i1,i2] := x[i1,i2];
    4678    end for;
    4679   end for;
     4673  y := x;
    46804674  return;
    46814675 annotation(Inline = false);
  • branches/dev-jk-2720/Compiler/ModelicaMiddleEnd/test/modelica/IndexReduction.mo

    r12754 r14165  
    452452  x1 + f(x2,A) = {0,0};
    453453
    454     annotation(__JModelica(UnitTesting(tests={
    455         TransformCanonicalTestCase(
    456             name="IndexReduction27_DerFunc",
    457             description="Test of index reduction",
    458             inline_functions="none",
    459             dynamic_states=false,
    460             flatModel="
     454        annotation(__JModelica(UnitTesting(tests={
     455            TransformCanonicalTestCase(
     456                name="IndexReduction27_DerFunc",
     457                description="Test of index reduction",
     458                inline_functions="none",
     459                dynamic_states=false,
     460                flatModel="
    461461fclass IndexReduction.IndexReduction27_DerFunc
    462462 parameter Real A[1,1] = 1 /* 1 */;
     
    504504   temp_1[i1] := temp_2;
    505505  end for;
    506   for i1 in 1:2 loop
    507    y[i1] := temp_1[i1];
    508   end for;
     506  y := temp_1;
    509507  return;
    510508 annotation(derivative = IndexReduction.IndexReduction27_DerFunc.f_der);
     
    529527   temp_1[i1] := temp_2;
    530528  end for;
    531   for i1 in 1:2 loop
    532    der_y[i1] := temp_1[i1];
    533   end for;
     529  der_y := temp_1;
    534530  return;
    535531 end IndexReduction.IndexReduction27_DerFunc.f_der;
  • branches/dev-jk-2720/Compiler/ModelicaMiddleEnd/test/modelica/ScalarizeFunctionVectorTests.mo

    r14150 r14165  
    2828    Real[1] y = f(time);
    2929
    30     annotation(__JModelica(UnitTesting(tests={
    31         TransformCanonicalTestCase(
    32             name="Vector1",
    33             description="",
    34             flatModel="
     30annotation(__JModelica(UnitTesting(tests={
     31    TransformCanonicalTestCase(
     32        name="Vector1",
     33        description="",
     34        flatModel="
    3535fclass ScalarizeFunctionVectorTests.Vector1
    3636 Real y[1];
     
    4747  init temp_1 as Real[1];
    4848  temp_1[1] := x;
    49   for i1 in 1:1 loop
    50    y[i1] := temp_1[i1];
    51   end for;
     49  y := temp_1;
    5250  return;
    5351 annotation(Inline = false);
     
    9694   end for;
    9795  end for;
    98   for i1 in 1:size(a, 1) * size(a, 2) * size(a, 3) loop
    99    b[i1] := temp_1[i1];
    100   end for;
     96  b := temp_1;
    10197  return;
    10298 end ScalarizeFunctionVectorTests.Vector2.f;
     
    116112    Real[1,1] y = f({3});
    117113
    118     annotation(__JModelica(UnitTesting(tests={
    119         TransformCanonicalTestCase(
    120             name="Vector3",
    121             description="Scalarization of functions: unknown size matrix operator, vector input",
    122             variability_propagation=false,
    123             inline_functions="none",
    124             flatModel="
     114annotation(__JModelica(UnitTesting(tests={
     115    TransformCanonicalTestCase(
     116        name="Vector3",
     117        description="Scalarization of functions: unknown size matrix operator, vector input",
     118        variability_propagation=false,
     119        inline_functions="none",
     120        flatModel="
    125121fclass ScalarizeFunctionVectorTests.Vector3
    126122 Real y[1,1];
     
    139135   temp_1[i1,1] := a[i1];
    140136  end for;
    141   for i1 in 1:size(a, 1) loop
    142    for i2 in 1:1 loop
    143     b[i1,i2] := temp_1[i1,i2];
    144    end for;
    145   end for;
     137  b := temp_1;
    146138  return;
    147139 end ScalarizeFunctionVectorTests.Vector3.f;
  • branches/dev-jk-2720/Compiler/ModelicaMiddleEnd/test/modelica/TransformCanonicalTests.mo

    r14150 r14165  
    24922492    (x,y) = f2(ones(3),ones(4));
    24932493
    2494     annotation(__JModelica(UnitTesting(tests={
    2495         TransformCanonicalTestCase(
    2496             name="InitialEqTest9",
    2497             description="Test algorithm for adding additional initial equations.",
    2498             variability_propagation=false,
    2499             inline_functions="none",
    2500             flatModel="
     2494  annotation(__JModelica(UnitTesting(tests={
     2495      TransformCanonicalTestCase(
     2496          name="InitialEqTest9",
     2497          description="Test algorithm for adding additional initial equations.",
     2498          variability_propagation=false,
     2499          inline_functions="none",
     2500          flatModel="
    25012501fclass TransformCanonicalTests.InitialEqTest9
    25022502 Real x[1];
     
    25192519  init w as Real[3];
    25202520  init z as Real[4];
    2521   for i1 in 1:3 loop
    2522    w[i1] := x[i1];
    2523   end for;
    2524   for i1 in 1:4 loop
    2525    z[i1] := y[i1];
    2526   end for;
     2521  w := x;
     2522  z := y;
    25272523  return;
    25282524 end TransformCanonicalTests.f2;
     
    25402536    der(y) = -y;
    25412537
    2542     annotation(__JModelica(UnitTesting(tests={
    2543         TransformCanonicalTestCase(
    2544             name="InitialEqTest10",
    2545             inline_functions="none",
    2546             description="Test algorithm for adding additional initial equations.",
    2547             flatModel="
     2538  annotation(__JModelica(UnitTesting(tests={
     2539      TransformCanonicalTestCase(
     2540          name="InitialEqTest10",
     2541          description="Test algorithm for adding additional initial equations.",
     2542          inline_functions="none",
     2543          flatModel="
    25482544fclass TransformCanonicalTests.InitialEqTest10
    25492545 Real x[1];
     
    25742570  init w as Real[3];
    25752571  init z as Real[4];
    2576   for i1 in 1:3 loop
    2577    w[i1] := x[i1];
    2578   end for;
    2579   for i1 in 1:4 loop
    2580    z[i1] := y[i1];
    2581   end for;
     2572  w := x;
     2573  z := y;
    25822574  return;
    25832575 end TransformCanonicalTests.f2;
     
    25952587    (,y) = f2(ones(3),ones(4));
    25962588
    2597     annotation(__JModelica(UnitTesting(tests={
    2598         TransformCanonicalTestCase(
    2599             name="InitialEqTest11",
    2600             inline_functions="none",
    2601             description="Test algorithm for adding additional initial equations.",
    2602             variability_propagation=false,
    2603             flatModel="
     2589  annotation(__JModelica(UnitTesting(tests={
     2590      TransformCanonicalTestCase(
     2591          name="InitialEqTest11",
     2592          description="Test algorithm for adding additional initial equations.",
     2593          inline_functions="none",
     2594          variability_propagation=false,
     2595          flatModel="
    26042596fclass TransformCanonicalTests.InitialEqTest11
    26052597 Real x[1];
     
    26272619  init w as Real[3];
    26282620  init z as Real[4];
    2629   for i1 in 1:3 loop
    2630    w[i1] := x[i1];
    2631   end for;
    2632   for i1 in 1:4 loop
    2633    z[i1] := y[i1];
    2634   end for;
     2621  w := x;
     2622  z := y;
    26352623  return;
    26362624 end TransformCanonicalTests.f2;
     
    26462634    (,y) = f2(ones(3),ones(4));
    26472635
    2648     annotation(__JModelica(UnitTesting(tests={
    2649         TransformCanonicalTestCase(
    2650             name="InitialEqTest12",
    2651             description="Test algorithm for adding additional initial equations.",
    2652             variability_propagation=false,
    2653             inline_functions="none",
    2654             flatModel="
     2636  annotation(__JModelica(UnitTesting(tests={
     2637      TransformCanonicalTestCase(
     2638          name="InitialEqTest12",
     2639          description="Test algorithm for adding additional initial equations.",
     2640          variability_propagation=false,
     2641          inline_functions="none",
     2642          flatModel="
    26552643fclass TransformCanonicalTests.InitialEqTest12
    26562644 Real x[1](start = 3);
     
    26802668  init w as Real[3];
    26812669  init z as Real[4];
    2682   for i1 in 1:3 loop
    2683    w[i1] := x[i1];
    2684   end for;
    2685   for i1 in 1:4 loop
    2686    z[i1] := y[i1];
    2687   end for;
     2670  w := x;
     2671  z := y;
    26882672  return;
    26892673 end TransformCanonicalTests.f2;
     
    78997883    Real[3] c = f(a, b);
    79007884
    7901     annotation(__JModelica(UnitTesting(tests={
    7902         TransformCanonicalTestCase(
    7903             name="ScalarizeCrossInFunction",
    7904             description="Test scalarization of cross in a function",
    7905             variability_propagation=false,
    7906             eliminate_alias_constants=false,
    7907             inline_functions="none",
    7908             flatModel="
     7885annotation(__JModelica(UnitTesting(tests={
     7886    TransformCanonicalTestCase(
     7887        name="ScalarizeCrossInFunction",
     7888        description="Test scalarization of cross in a function",
     7889        variability_propagation=false,
     7890        eliminate_alias_constants=false,
     7891        inline_functions="none",
     7892        flatModel="
    79097893fclass TransformCanonicalTests.ScalarizeCrossInFunction
    79107894 Real a[1];
     
    79417925  temp_1[2] := a[3] * temp_2[1] - a[1] * temp_2[3];
    79427926  temp_1[3] := a[1] * temp_2[2] - a[2] * temp_2[1];
    7943   for i1 in 1:3 loop
    7944    c[i1] := temp_1[i1];
    7945   end for;
     7927  c := temp_1;
    79467928  return;
    79477929 end TransformCanonicalTests.ScalarizeCrossInFunction.f;
     
    79807962    Real[3, 3] b = f(a);
    79817963
    7982     annotation(__JModelica(UnitTesting(tests={
    7983         TransformCanonicalTestCase(
    7984             name="ScalarizeSkewInFunction",
    7985             description="Test scalarization of skew in a function",
    7986             variability_propagation=false,
    7987             eliminate_alias_constants=false,
    7988             eliminate_alias_variables=false,
    7989             inline_functions="none",
    7990             flatModel="
     7964annotation(__JModelica(UnitTesting(tests={
     7965    TransformCanonicalTestCase(
     7966        name="ScalarizeSkewInFunction",
     7967        description="Test scalarization of skew in a function",
     7968        variability_propagation=false,
     7969        eliminate_alias_constants=false,
     7970        eliminate_alias_variables=false,
     7971        inline_functions="none",
     7972        flatModel="
    79917973fclass TransformCanonicalTests.ScalarizeSkewInFunction
    79927974 Real a[1];
     
    80288010  temp_1[3,2] := temp_2[1];
    80298011  temp_1[3,3] := 0;
    8030   for i1 in 1:3 loop
    8031    for i2 in 1:3 loop
    8032     b[i1,i2] := temp_1[i1,i2];
    8033    end for;
    8034   end for;
     8012  b := temp_1;
    80358013  return;
    80368014 end TransformCanonicalTests.ScalarizeSkewInFunction.f;
  • branches/dev-jk-2720/Compiler/ModelicaMiddleEnd/test/modelica/VariabilityPropagationPartialTests.mo

    r13856 r14165  
    305305    Real[:] y = f({time,time},true);
    306306   
    307     annotation(__JModelica(UnitTesting(tests={
    308         TransformCanonicalTestCase(
    309             name="FunctionCallEquationPartial8",
    310             description="",
    311             flatModel="
     307annotation(__JModelica(UnitTesting(tests={
     308    TransformCanonicalTestCase(
     309        name="FunctionCallEquationPartial8",
     310        description="",
     311        flatModel="
    312312fclass VariabilityPropagationPartialTests.FunctionCallEquationPartial8
    313313 Real y[1];
     
    323323 algorithm
    324324  init y as Real[size(x, 1)];
    325   for i1 in 1:size(x, 1) loop
    326    y[i1] := x[i1];
    327   end for;
     325  y := x;
    328326  (y) := VariabilityPropagationPartialTests.FunctionCallEquationPartial8.g(y);
    329327  (y) := VariabilityPropagationPartialTests.FunctionCallEquationPartial8.u(y);
     
    346344 algorithm
    347345  init y as Real[size(x, 1)];
    348   for i1 in 1:size(x, 1) loop
    349    y[i1] := x[i1];
    350   end for;
     346  y := x;
    351347  return;
    352348 end VariabilityPropagationPartialTests.FunctionCallEquationPartial8.u;
     
    381377        Real[:] y = g(2,time,2);
    382378   
    383     annotation(__JModelica(UnitTesting(tests={
    384         TransformCanonicalTestCase(
    385             name="FunctionCallEquationPartial9",
    386             description="Bug when returning cloned CValueUnknown",
    387             flatModel="
     379annotation(__JModelica(UnitTesting(tests={
     380    TransformCanonicalTestCase(
     381        name="FunctionCallEquationPartial9",
     382        description="Bug when returning cloned CValueUnknown",
     383        flatModel="
    388384fclass VariabilityPropagationPartialTests.FunctionCallEquationPartial9
    389385 Real y[1];
     
    408404   temp_1[1] := 1;
    409405   temp_1[2] := 2;
    410    for i1 in 1:n loop
    411     y[i1] := temp_1[i1];
    412    end for;
     406   y := temp_1;
    413407  end if;
    414408  return;
     
    426420  temp_1[1] := x1;
    427421  temp_1[2] := x1;
    428   for i1 in 1:n loop
    429    y[i1] := temp_1[i1];
    430   end for;
     422  y := temp_1;
    431423  assert(x1 == 1, \"nope\");
    432424  return;
     
    677669 algorithm
    678670  init y as Real[size(x, 1)];
    679   for i1 in 1:size(x, 1) loop
    680    y[i1] := x[i1];
    681   end for;
     671  y := x;
    682672  return;
    683673 end VariabilityPropagationPartialTests.PartiallyKnownComposite6.f;
  • branches/dev-jk-2720/Compiler/ModelicaMiddleEnd/test/modelica/VariabilityPropagationTests.mo

    r12754 r14165  
    728728    a = {{1,2},{3,4}};
    729729   
    730     annotation(__JModelica(UnitTesting(tests={
    731         TransformCanonicalTestCase(
    732             name="FunctionCallEquation4",
    733             description="Tests that parameters in function call equations are folded.
    734 Also tests that when it is constant and can't evaluate, variability is propagated as parameter.",
    735             eliminate_alias_variables=false,
    736             inline_functions="none",
    737             flatModel="
     730annotation(__JModelica(UnitTesting(tests={
     731    TransformCanonicalTestCase(
     732        name="FunctionCallEquation4",
     733        description="
     734Tests that parameters in function call equations are folded.
     735Also tests that when it is constant and can't evaluate, variability is propagated as parameter.
     736",
     737        eliminate_alias_variables=false,
     738        inline_functions="none",
     739        flatModel="
    738740fclass VariabilityPropagationTests.FunctionCallEquation4
    739741 constant Real a[1,1] = 1;
     
    774776 algorithm
    775777  init x as Real[size(A, 1)];
    776   for i1 in 1:size(A, 1) loop
    777    x[i1] := b[i1];
    778   end for;
     778  x := b;
    779779  init Awork as Real[size(A, 1), size(A, 1)];
    780   for i1 in 1:size(A, 1) loop
    781    for i2 in 1:size(A, 1) loop
    782     Awork[i1,i2] := A[i1,i2];
    783    end for;
    784   end for;
     780  Awork := A;
    785781  lda := max(1, size(A, 1));
    786782  ldb := max(1, size(b, 1));
     
    10061002    Real x[2](start = f()) = {3,4};
    10071003
    1008     annotation(__JModelica(UnitTesting(tests={
    1009         TransformCanonicalTestCase(
    1010             name="ConstantStartFunc1",
    1011             description="Tests that a constant right hand in a function call equation is not folded. It should only be propagated.",
    1012             inline_functions="none",
    1013             flatModel="
     1004annotation(__JModelica(UnitTesting(tests={
     1005    TransformCanonicalTestCase(
     1006        name="ConstantStartFunc1",
     1007        description="Tests that a constant right hand in a function call equation is not folded. It should only be propagated.",
     1008        inline_functions="none",
     1009        flatModel="
    10141010fclass VariabilityPropagationTests.ConstantStartFunc1
    10151011 constant Real x[1](start = temp_1[1]) = 3;
     
    10291025  temp_1[1] := 1;
    10301026  temp_1[2] := 2;
    1031   for i1 in 1:2 loop
    1032    o[i1] := temp_1[i1];
    1033   end for;
     1027  o := temp_1;
    10341028  return;
    10351029 end VariabilityPropagationTests.ConstantStartFunc1.f;
     
    13431337   
    13441338    Real[:] y = f();
    1345     annotation(__JModelica(UnitTesting(tests={
    1346         TransformCanonicalTestCase(
    1347             name="EvalFail2",
    1348             description="Test parameter from constant on fail to evaluate",
    1349             flatModel="
     1339annotation(__JModelica(UnitTesting(tests={
     1340    TransformCanonicalTestCase(
     1341        name="EvalFail2",
     1342        description="Test parameter from constant on fail to evaluate",
     1343        flatModel="
    13501344fclass VariabilityPropagationTests.EvalFail2
    13511345 parameter Real y[1];
     
    13611355  init temp_1 as Integer[1];
    13621356  temp_1[1] := 1;
    1363   for i1 in 1:1 loop
    1364    y[i1] := temp_1[i1];
    1365   end for;
     1357  y := temp_1;
    13661358  assert(false, \"nope\");
    13671359  return;
     
    14841476    Real[:] y = if sum(f(time))>0 then f(1) else f(2);
    14851477
    1486     annotation(__JModelica(UnitTesting(tests={
    1487         TransformCanonicalTestCase(
    1488             name="IfEquationTemp1",
    1489             description="",
    1490             inline_functions="none",
    1491             flatModel="
     1478annotation(__JModelica(UnitTesting(tests={
     1479    TransformCanonicalTestCase(
     1480        name="IfEquationTemp1",
     1481        description="",
     1482        inline_functions="none",
     1483        flatModel="
    14921484fclass VariabilityPropagationTests.IfEquationTemp1
    14931485 Real y[1];
     
    15101502  temp_1[1] := x;
    15111503  temp_1[2] := x + 1;
    1512   for i1 in 1:2 loop
    1513    y[i1] := temp_1[i1];
    1514   end for;
     1504  y := temp_1;
    15151505  return;
    15161506 end VariabilityPropagationTests.IfEquationTemp1.f;
     
    15301520    Real c = 1;
    15311521
    1532     annotation(__JModelica(UnitTesting(tests={
    1533         TransformCanonicalTestCase(
    1534             name="IfEquationTemp2",
    1535             description="",
    1536             inline_functions="none",
    1537             flatModel="
     1522annotation(__JModelica(UnitTesting(tests={
     1523    TransformCanonicalTestCase(
     1524        name="IfEquationTemp2",
     1525        description="",
     1526        inline_functions="none",
     1527        flatModel="
    15381528fclass VariabilityPropagationTests.IfEquationTemp2
    15391529 Real y[1];
     
    15571547  temp_1[1] := x;
    15581548  temp_1[2] := x + 1;
    1559   for i1 in 1:2 loop
    1560    y[i1] := temp_1[i1];
    1561   end for;
     1549  y := temp_1;
    15621550  return;
    15631551 end VariabilityPropagationTests.IfEquationTemp2.f;
Note: See TracChangeset for help on using the changeset viewer.