Skip to content

Commit 0b0a647

Browse files
hkielOpenModelica-Hudson
authored andcommitted
use AvlSetInt instead of too big List.uniqueIntN() array for large models
1 parent f30ae8a commit 0b0a647

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Compiler/BackEnd/RemoveSimpleEquations.mo

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public import DAE;
5151
public import FCore;
5252

5353
protected
54+
import AvlSetInt;
5455
import BackendDAEUtil;
5556
import BackendDump;
5657
import BackendEquation;
@@ -1605,13 +1606,16 @@ algorithm
16051606
BackendDAE.Variables vars, globalKnownVars;
16061607
list<Integer> ilst;
16071608
list<BackendDAE.Var> vlst;
1609+
AvlSetInt.Tree tree;
16081610

16091611
case (_, _, _, _, (vars, BackendDAE.SHARED(globalKnownVars=globalKnownVars), _, _, _, _, _))
16101612
equation
16111613
// collect vars and check if variable time not there
16121614
(_, (false, _, _, _, _, ilst)) = Expression.traverseExpTopDown(lhs, traversingTimeVarsFinder, (false, vars, globalKnownVars, false, false, {}));
16131615
(_, (false, _, _, _, _, ilst)) = Expression.traverseExpTopDown(rhs, traversingTimeVarsFinder, (false, vars, globalKnownVars, false, false, ilst));
1614-
ilst = List.uniqueIntN(ilst, BackendVariable.varsSize(vars));
1616+
tree = AvlSetInt.new();
1617+
tree = AvlSetInt.addList(tree, ilst);
1618+
ilst = AvlSetInt.listKeys(tree);
16151619
vlst = List.map1r(ilst, BackendVariable.getVarAt, vars);
16161620
then
16171621
solveTimeIndependentAcausal(vlst, ilst, lhs, rhs, eqnAttributes, inTpl);
@@ -1639,12 +1643,15 @@ algorithm
16391643
BackendDAE.Variables vars, globalKnownVars;
16401644
list<Integer> ilst;
16411645
list<BackendDAE.Var> vlst;
1646+
AvlSetInt.Tree tree;
16421647

16431648
case (_, _, _, (vars, BackendDAE.SHARED(globalKnownVars=globalKnownVars), _, _, _, _, _))
16441649
equation
16451650
// collect vars and check if variable time not there
16461651
(_, (false, _, _, _, _, ilst)) = Expression.traverseExpTopDown(exp, traversingTimeVarsFinder, (false, vars, globalKnownVars, false, false, {}));
1647-
ilst = List.uniqueIntN(ilst, BackendVariable.varsSize(vars));
1652+
tree = AvlSetInt.new();
1653+
tree = AvlSetInt.addList(tree, ilst);
1654+
ilst = AvlSetInt.listKeys(tree);
16481655
vlst = List.map1r(ilst, BackendVariable.getVarAt, vars);
16491656
ty = Expression.typeof(exp);
16501657
e2 = Expression.makeConstZero(ty);

0 commit comments

Comments
 (0)