Changeset 83c2747 in OpenModelica
- Timestamp:
- 2020-10-21T18:53:49+02:00 (3 years ago)
- Branches:
- maintenance/v1.16
- Children:
- 4a9e195b
- Parents:
- 9b268ea7
- git-author:
- Per Östlund <perost86@…> (10/21/20 12:36:55)
- git-committer:
- Adrian Pop <adrian.pop@…> (10/21/20 18:53:49)
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
OMCompiler/Compiler/NFFrontEnd/NFArrayConnections.mo
rbfae500 r83c2747 372 372 Vector.update(vCount, 1, vc + 1); 373 373 374 mi := SBMultiInterval.from List({SBInterval.new(vc, 1, vc)});374 mi := SBMultiInterval.fromArray(arrayCreate(Vector.size(vCount), SBInterval.new(vc, 1, vc))); 375 375 else 376 376 ints := arrayCreate(listLength(dims), SBInterval.newEmpty()); … … 547 547 protected 548 548 array<SBInterval> ints1, ints2, mi; 549 Integer mi1_sz, mi2_sz, ints1_i, ints2_i,sz, sz1, sz2;549 Integer mi1_sz, mi2_sz, sz, sz1, sz2; 550 550 Integer count, aux_ec; 551 551 array<Real> g1, g2, o1, o2; … … 560 560 algorithm 561 561 ints1 := SBMultiInterval.intervals(mi1); 562 ints1_i := 1;563 562 mi1_sz := SBMultiInterval.size(mi1); 564 563 565 564 ints2 := SBMultiInterval.intervals(mi2); 566 ints2_i := 1;567 565 mi2_sz := SBMultiInterval.size(mi2); 568 566 … … 581 579 582 580 for i in 1:sz loop 583 sz1 := SBInterval.size(ints1[i nts1_i]);584 sz2 := SBInterval.size(ints2[i nts2_i]);581 sz1 := SBInterval.size(ints1[i]); 582 sz2 := SBInterval.size(ints2[i]); 585 583 586 584 if sz1 <> sz2 and sz1 <> 1 and sz2 <> 1 then … … 592 590 mi[i] := SBInterval.new(aux_ec, 1, aux_ec + count - 1); 593 591 594 i1 := ints1[i nts1_i];595 i2 := ints2[i nts2_i];592 i1 := ints1[i]; 593 i2 := ints2[i]; 596 594 597 595 if sz1 == 1 then … … 616 614 617 615 Vector.push(new_ec, aux_ec + count); 618 619 if mi1_sz > 1 or mi2_sz == 1 then620 ints1_i := ints1_i + 1;621 end if;622 623 if mi2_sz > 1 or mi1_sz == 1 then624 ints2_i := ints2_i + 1;625 end if;626 616 end for; 627 617 … … 717 707 protected 718 708 Integer lo = SBInterval.lowerBound(interval); 719 Integer step = SBInterval.stepValue(interval);720 709 Integer hi = SBInterval.upperBound(interval); 721 710 algorithm … … 723 712 range := Expression.INTEGER(lo); 724 713 else 725 range := Expression.makeRange( 726 Expression.INTEGER(lo), 727 if step == 1 then NONE() else SOME(Expression.INTEGER(step)), 728 Expression.INTEGER(hi) 729 ); 714 range := Expression.makeIntegerRange(lo, SBInterval.stepValue(interval), hi); 730 715 end if; 731 716 end intervalToRange; … … 1035 1020 outExpl := Expression.INTEGER(SBInterval.lowerBound(i2)) :: outExpl; 1036 1021 elseif i1_sz == 1 and forFlow then 1037 e := Expression.makeRange( 1038 Expression.INTEGER(SBInterval.lowerBound(i2)), 1039 SOME(Expression.INTEGER(SBInterval.stepValue(i2))), 1040 Expression.INTEGER(SBInterval.upperBound(i2)) 1041 ); 1022 e := Expression.makeIntegerRange( 1023 SBInterval.lowerBound(i2), SBInterval.stepValue(i2), SBInterval.upperBound(i2)); 1042 1024 outExpl := e :: outExpl; 1043 1025 flowRange := true; -
OMCompiler/Compiler/NFFrontEnd/NFExpression.mo
rb6e418f6 r83c2747 1005 1005 end makeRange; 1006 1006 1007 function makeIntegerRange 1008 input Integer start; 1009 input Integer step; 1010 input Integer stop; 1011 output Expression rangeExp; 1012 protected 1013 Expression start_exp, stop_exp; 1014 Option<Expression> step_exp; 1015 algorithm 1016 start_exp := Expression.INTEGER(start); 1017 stop_exp := Expression.INTEGER(stop); 1018 1019 if start == stop or 1020 step == 1 and start <= stop or 1021 step == -1 and start >= stop then 1022 step_exp := NONE(); 1023 else 1024 step_exp := SOME(Expression.INTEGER(step)); 1025 end if; 1026 1027 rangeExp := makeRange(start_exp, step_exp, stop_exp); 1028 end makeIntegerRange; 1029 1007 1030 function applySubscripts 1008 1031 "Subscripts an expression with the given list of subscripts." -
OMCompiler/Compiler/NFFrontEnd/NFSimplifyExp.mo
r32725bb r83c2747 177 177 callExp := Expression.stripBindingInfo(callExp); 178 178 else 179 callExp := Expression.CALL(call); 179 180 end try; 180 181 else … … 183 184 callExp := simplifyBuiltinCall(Function.nameConsiderBuiltin(call.fn), args, call); 184 185 else 185 // nothing186 callExp := Expression.CALL(call); 186 187 end if; 187 188 end if; -
testsuite/flattening/modelica/scodeinst/ArrayConnect1.mo
r5ad7c91 r83c2747 56 56 // end for; 57 57 // G.p.e = S.n.e; 58 // S.n.f + G.p.f + sum(C[ 1:1:1000].n.f) = 0.0;58 // S.n.f + G.p.f + sum(C[:].n.f) = 0.0; 59 59 // for $i1 in 1:999 loop 60 60 // R[$i1].n.e = R[$i1 + 1].p.e; -
testsuite/flattening/modelica/scodeinst/ArrayConnect2.mo
r5ad7c91 r83c2747 61 61 // C[1].n.e = S.n.e; 62 62 // G.p.e = S.n.e; 63 // S.n.f + G.p.f + C[1].n.f + sum(C[2: 1:999].n.f) + C[1000].n.f = 0.0;63 // S.n.f + G.p.f + C[1].n.f + sum(C[2:999].n.f) + C[1000].n.f = 0.0; 64 64 // for $i1 in 1:999 loop 65 65 // R[$i1].n.e = R[$i1 + 1].p.e; -
testsuite/flattening/modelica/scodeinst/ArrayConnect3.mo
rbfae500 r83c2747 83 83 // cells[$i1,100].r.f + cells[$i1,1].l.f = 0.0; 84 84 // end for; 85 // S.p.e = cells[1,1].u.e; 86 // for $i2 in 2:100 loop 87 // cells[1,$i2].u.e = cells[1,1].u.e; 88 // end for; 89 // cells[1,1].u.f + sum(cells[1,2:100].u.f) + S.p.f = 0.0; 90 // S.n.e = cells[1000,1].d.e; 91 // for $i2 in 2:100 loop 92 // cells[1000,$i2].d.e = cells[1000,1].d.e; 93 // end for; 94 // cells[1000,1].d.f + sum(cells[1000,2:100].d.f) + S.n.f = 0.0; 85 95 // for $i2 in 1:99 loop 86 96 // cells[1000,$i2].r.f = 0.0; … … 89 99 // cells[1000,$i2].l.f = 0.0; 90 100 // end for; 91 // for $i2 in 1:100 loop92 // cells[1000,$i2].d.f = 0.0;93 // end for;94 101 // for $i1 in 1:999 loop 95 102 // cells[$i1,100].d.f = 0.0; 96 // end for;97 // for $i2 in 1:100 loop98 // cells[1,$i2].u.f = 0.0;99 103 // end for; 100 104 // for $i1 in 2:1000 loop
Note: See TracChangeset
for help on using the changeset viewer.