Skip to content

Commit

Permalink
- improve bltdump, dump variable names in the order they are solved
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@8389 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Mar 28, 2011
1 parent 2e11e8a commit 7476b8e
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 8 deletions.
5 changes: 3 additions & 2 deletions Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -5463,7 +5463,7 @@ algorithm
// transformation phase (matching and sorting using a index reduction method
Debug.fcall("execstat",print, "*** BackendMain -> transformDAE at time: " +& realString(clock()) +& "\n" );
(sode,m,mT,v1,v2,comps) := transformDAE(optdae,functionTree,daeHandler,om,omT);
Debug.fcall("bltdump", BackendDump.bltdump, (sode,m,mT,v1,comps));
Debug.fcall("bltdump", BackendDump.bltdump, (sode,m,mT,v1,v2,comps));

// past optimisation phase
Debug.fcall("execstat",print, "*** BackendMain -> pastoptimiseDAE at time: " +& realString(clock()) +& "\n" );
Expand All @@ -5472,6 +5472,7 @@ algorithm
sode1 := BackendDAECreate.findZeroCrossings(sode);
Debug.fcall("execstat",print, "*** BackendMain -> translateDae: " +& realString(clock()) +& "\n" );
indexed_dlow := translateDae(sode1,NONE());
Debug.fcall("execstat",print, "*** BackendMain -> calculate Values: " +& realString(clock()) +& "\n" );
outSODE := calculateValues(inCache, inEnv, indexed_dlow);
Debug.fcall("dumpindxdae", print, "dumpindxdae:\n");
Debug.fcall("dumpindxdae", BackendDump.dump, outSODE);
Expand Down Expand Up @@ -5662,7 +5663,7 @@ algorithm
case (true,dae,funcs,m,mT,_,_,_,daeHandler)
equation
(sode,m,mT,v1,v2,comps) = transformDAE(dae,funcs,daeHandler,SOME(m),SOME(mT));
Debug.fcall("bltdump", BackendDump.bltdump, (sode,m,mT,v1,comps));
Debug.fcall("bltdump", BackendDump.bltdump, (sode,m,mT,v1,v2,comps));
then
(sode,m,mT,v1,v2,comps);
case (false,dae,funcs,m,mT,v1,v2,comps,_)
Expand Down
102 changes: 96 additions & 6 deletions Compiler/BackEnd/BackendDump.mo
Expand Up @@ -1422,15 +1422,14 @@ algorithm
_:=
match (inIntegerLstLst,inInteger)
local
BackendDAE.Value ni,i_1,i;
BackendDAE.Value i_1,i;
list<String> ls;
String s;
list<BackendDAE.Value> l;
list<list<BackendDAE.Value>> lst;
case ({},_) then ();
case ((l :: lst),i)
equation
ni = BackendDAEEXT.getLowLink(i);
print("{");
ls = Util.listMap(l, intString);
s = Util.stringDelimitList(ls, ", ");
Expand Down Expand Up @@ -1540,21 +1539,112 @@ end dumpStateVariable;

public function bltdump
"autor: Frenkel TUD 2011-03"
input tuple<BackendDAE.BackendDAE,BackendDAE.IncidenceMatrix,BackendDAE.IncidenceMatrix,array<Integer>,list<list<Integer>>> inTpl;
input tuple<BackendDAE.BackendDAE,BackendDAE.IncidenceMatrix,BackendDAE.IncidenceMatrix,array<Integer>,array<Integer>,list<list<Integer>>> inTpl;
protected
BackendDAE.BackendDAE ode;
BackendDAE.IncidenceMatrix m;
BackendDAE.IncidenceMatrix mT;
array<Integer> v1;
array<Integer> v1,v2;
list<list<Integer>> comps;
algorithm
(ode,m,mT,v1,comps) := inTpl;
(ode,m,mT,v1,v2,comps) := inTpl;
print("bltdump:\n");
dump(ode);
dumpIncidenceMatrix(m);
dumpIncidenceMatrixT(mT);
dumpMatching(v1);
dumpComponents(comps);
dumpComponentsAddvanced(comps,v2,ode);
end bltdump;

public function dumpComponentsAddvanced "function: dumpComponents
author: Frenkel TUD

Prints the blocks of the BLT sorting on stdout.
"
input list<list<Integer>> l;
input array<Integer> v2;
input BackendDAE.BackendDAE ode;
protected
BackendDAE.Variables vars;
algorithm
print("Blocks\n");
print("=======\n");
vars := BackendVariable.daeVars(ode);
dumpComponentsAddvanced2(l, 1,v2,vars);
end dumpComponentsAddvanced;

protected function dumpComponentsAddvanced2 "function: dumpComponents2
author: PA

Helper function to dump_components.
"
input list<list<Integer>> inIntegerLstLst;
input Integer inInteger;
input array<Integer> v2;
input BackendDAE.Variables vars;
algorithm
_:=
match (inIntegerLstLst,inInteger,v2,vars)
local
BackendDAE.Value ni,i_1,i;
list<String> ls;
String s;
list<BackendDAE.Value> l;
list<list<BackendDAE.Value>> lst;
case ({},_,_,_) then ();
case ((l :: lst),i,v2,vars)
equation
print("{");
ls = Util.listMap(l, intString);
s = Util.stringDelimitList(ls, ", ");
print(s);
print("} ");
dumpComponentsAddvanced3(l,v2,vars);
print("\n");
i_1 = i + 1;
dumpComponentsAddvanced2(lst, i_1,v2,vars);
then
();
end match;
end dumpComponentsAddvanced2;

protected function dumpComponentsAddvanced3 "function: dumpComponents2
author: PA

Helper function to dump_components.
"
input list<Integer> inIntegerLst;
input array<Integer> v2;
input BackendDAE.Variables vars;
algorithm
_:=
match (inIntegerLst,v2,vars)
local
BackendDAE.Value i,v;
list<String> ls;
String s;
list<BackendDAE.Value> l;
DAE.ComponentRef c;
case ({},_,_) then ();
case (i::{},v2,vars)
equation
v = v2[i];
BackendDAE.VAR(varName=c) = BackendVariable.getVarAt(vars,v);
s = ComponentReference.printComponentRefStr(c);
print(s);
then
();
case (i::l,v2,vars)
equation
v = v2[i];
BackendDAE.VAR(varName=c) = BackendVariable.getVarAt(vars,v);
s = ComponentReference.printComponentRefStr(c);
print(s);
print(", ");
dumpComponentsAddvanced3(l,v2,vars);
then
();
end match;
end dumpComponentsAddvanced3;

end BackendDump;

0 comments on commit 7476b8e

Please sign in to comment.