Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 8dcb443

Browse files
sjoelundOpenModelica-Hudson
authored andcommitted
Use AvlSetInt instead of lists for inc. matrix
The incidence matrix takes a long time to calculate for certain systems, especially when you have one equation that ties into all of the other equations.
1 parent dc675db commit 8dcb443

File tree

6 files changed

+190
-116
lines changed

6 files changed

+190
-116
lines changed

Compiler/BackEnd/BackendDAEOptimize.mo

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,8 @@ algorithm
968968
BackendDAE.Variables vars;
969969
BackendDAE.EquationArray eqns,eqns1;
970970
DAE.Exp exp,e1,e2,ecr;
971-
list<Integer> expvars,controleqns,expvars1;
971+
AvlSetInt.Tree expvars;
972+
list<Integer> controleqns,expvars1;
972973
list<list<Integer>> expvarseqns;
973974

974975
case ((elem,pos,m,(mT,vars,eqns,changed)))
@@ -982,9 +983,9 @@ algorithm
982983
// failure(DAE.CREF(componentRef=_) = exp);
983984
// failure(DAE.UNARY(operator=DAE.UMINUS(ty=_),exp=DAE.CREF(componentRef=_)) = exp);
984985
// BackendDump.debugStrExpStrExpStr(("Found ",ecr," = ",exp,"\n"));
985-
expvars = BackendDAEUtil.incidenceRowExp(exp,vars,{},NONE(),BackendDAE.NORMAL());
986+
expvars = BackendDAEUtil.incidenceRowExp(exp,vars,AvlSetInt.EMPTY(),NONE(),BackendDAE.NORMAL());
986987
// print("expvars "); BackendDump.debuglst((expvars,intString," ","\n"));
987-
(expvars1::expvarseqns) = List.map2(expvars,varEqns,pos,mT);
988+
(expvars1::expvarseqns) = List.map2(AvlSetInt.listKeys(expvars),varEqns,pos,mT);
988989
// print("expvars1 "); BackendDump.debuglst((expvars1,intString," ","\n"));;
989990
controleqns = getControlEqns(expvars1,expvarseqns);
990991
// print("controleqns "); BackendDump.debuglst((controleqns,intString," ","\n"));

0 commit comments

Comments
 (0)