Skip to content

Commit

Permalink
Use AvlSetInt instead of lists for inc. matrix
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Nov 30, 2016
1 parent dc675db commit 8dcb443
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 116 deletions.
7 changes: 4 additions & 3 deletions Compiler/BackEnd/BackendDAEOptimize.mo
Expand Up @@ -968,7 +968,8 @@ algorithm
BackendDAE.Variables vars;
BackendDAE.EquationArray eqns,eqns1;
DAE.Exp exp,e1,e2,ecr;
list<Integer> expvars,controleqns,expvars1;
AvlSetInt.Tree expvars;
list<Integer> controleqns,expvars1;
list<list<Integer>> expvarseqns;

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

0 comments on commit 8dcb443

Please sign in to comment.