Skip to content

Commit

Permalink
- separated functions for BLT to BackendDAETransform
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Braun committed Oct 28, 2010
1 parent 91f758f commit ff06bd7
Show file tree
Hide file tree
Showing 9 changed files with 3,017 additions and 2,938 deletions.
2,926 changes: 8 additions & 2,918 deletions Compiler/BackendDAEOptimize.mo

Large diffs are not rendered by default.

2,982 changes: 2,982 additions & 0 deletions Compiler/BackendDAETransform.mo

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Compiler/BackendDump.mo
Expand Up @@ -43,6 +43,7 @@ public import DAE;
protected import Absyn;
protected import Algorithm;
protected import BackendDAEOptimize;
protected import BackendDAETransform;
protected import BackendDAEUtil;
protected import BackendVariable;
protected import BackendEquation;
Expand Down Expand Up @@ -1270,7 +1271,7 @@ algorithm
list<String> strLst,slst;
String str;
equation
eqns = BackendDAEOptimize.reachableNodes(i, m, mT, ass1, ass2);
eqns = BackendDAETransform.reachableNodes(i, m, mT, ass1, ass2);
llst = Util.listMap(eqns,Util.listCreate);
llst = Util.listMap1(llst,Util.listCons,i);
slst = Util.listMap(llst,intListStr);
Expand Down
7 changes: 4 additions & 3 deletions Compiler/CevalScript.mo
Expand Up @@ -65,6 +65,7 @@ protected import BackendDAEUtil;
protected import BackendDAECreate;
protected import BackendVariable;
protected import BackendDAEOptimize;
protected import BackendDAETransform;
protected import ConnectionGraph;
protected import ClassInf;
protected import ClassLoader;
Expand Down Expand Up @@ -3938,7 +3939,7 @@ algorithm
dlow = BackendDAECreate.lower(dae, Env.getFunctionTree(cache), true, true);
m = BackendDAEUtil.incidenceMatrix(dlow);
mT = BackendDAEUtil.transposeMatrix(m);
(_,_,dlow_1,m,mT) = BackendDAEOptimize.matchingAlgorithm(dlow, m, mT, (BackendDAE.INDEX_REDUCTION(),BackendDAE.EXACT(), BackendDAE.REMOVE_SIMPLE_EQN()), Env.getFunctionTree(cache));
(_,_,dlow_1,m,mT) = BackendDAETransform.matchingAlgorithm(dlow, m, mT, (BackendDAE.INDEX_REDUCTION(),BackendDAE.EXACT(), BackendDAE.REMOVE_SIMPLE_EQN()), Env.getFunctionTree(cache));
xml_filename = System.stringAppendList({filenameprefix,".xml"});
funcelems = DAEUtil.getFunctionList(Env.getFunctionTree(cache));
Print.clearBuf();
Expand Down Expand Up @@ -3980,8 +3981,8 @@ algorithm
dlow = BackendDAECreate.lower(dae, Env.getFunctionTree(cache), true, true);
m = BackendDAEUtil.incidenceMatrix(dlow);
mT = BackendDAEUtil.transposeMatrix(m);
(ass1,ass2,dlow_1,m,mT) = BackendDAEOptimize.matchingAlgorithm(dlow, m, mT, (BackendDAE.INDEX_REDUCTION(),BackendDAE.EXACT(), BackendDAE.REMOVE_SIMPLE_EQN()),Env.getFunctionTree(cache));
(comps) = BackendDAEOptimize.strongComponents(m, mT, ass1, ass2);
(ass1,ass2,dlow_1,m,mT) = BackendDAETransform.matchingAlgorithm(dlow, m, mT, (BackendDAE.INDEX_REDUCTION(),BackendDAE.EXACT(), BackendDAE.REMOVE_SIMPLE_EQN()),Env.getFunctionTree(cache));
(comps) = BackendDAETransform.strongComponents(m, mT, ass1, ass2);
indexed_dlow = BackendDAEUtil.translateDae(dlow_1,NONE());
indexed_dlow_1 = BackendDAEUtil.calculateValues(indexed_dlow);
xml_filename = System.stringAppendList({filenameprefix,".xml"});
Expand Down
5 changes: 3 additions & 2 deletions Compiler/Linearization.mo
Expand Up @@ -42,6 +42,7 @@ public import BackendDAE;

protected import BackendDAEUtil;
protected import BackendDAEOptimize;
protected import BackendDAETransform;
protected import BackendDump;
protected import BackendEquation;
protected import BackendVariable;
Expand Down Expand Up @@ -140,12 +141,12 @@ algorithm
// figure out new matching and the strong components
m = BackendDAEUtil.incidenceMatrix(dlow);
mT = BackendDAEUtil.transposeMatrix(m);
(v1,v2,dlow,m,mT) = BackendDAEOptimize.matchingAlgorithm(dlow, m, mT, (BackendDAE.NO_INDEX_REDUCTION(), BackendDAE.EXACT(), BackendDAE.KEEP_SIMPLE_EQN()),functionTree);
(v1,v2,dlow,m,mT) = BackendDAETransform.matchingAlgorithm(dlow, m, mT, (BackendDAE.NO_INDEX_REDUCTION(), BackendDAE.EXACT(), BackendDAE.KEEP_SIMPLE_EQN()),functionTree);
Debug.fcall("jacdump2", BackendDump.dumpIncidenceMatrix, m);
Debug.fcall("jacdump2", BackendDump.dumpIncidenceMatrixT, mT);
Debug.fcall("jacdump2", BackendDump.dump, dlow);
Debug.fcall("jacdump2", BackendDump.dumpMatching, v1);
(comps1) = BackendDAEOptimize.strongComponents(m, mT, v1, v2);
(comps1) = BackendDAETransform.strongComponents(m, mT, v1, v2);
Debug.fcall("jacdump2", BackendDump.dumpComponents, comps1);

// figure out wich comps are needed to evaluate all derivedVariables
Expand Down
5 changes: 3 additions & 2 deletions Compiler/Main.mo
Expand Up @@ -46,6 +46,7 @@ protected import AbsynDep;
protected import BackendDAE;
protected import BackendDAECreate;
protected import BackendDAEOptimize;
protected import BackendDAETransform;
protected import BackendDAEUtil;
protected import BackendVariable;
protected import BackendDump;
Expand Down Expand Up @@ -790,14 +791,14 @@ algorithm
Debug.fcall("bltdump", BackendDump.dumpIncidenceMatrix, m);
Debug.fcall("bltdump", BackendDump.dumpIncidenceMatrixT, mT);
Debug.fcall("execstat",print, "*** Main -> To run matching at time: " +& realString(clock()) +& "\n" );
(v1,v2,dlow_1,m,mT) = BackendDAEOptimize.matchingAlgorithm(dlow, m, mT, (BackendDAE.INDEX_REDUCTION(), BackendDAE.EXACT(), BackendDAE.REMOVE_SIMPLE_EQN()),funcs);
(v1,v2,dlow_1,m,mT) = BackendDAETransform.matchingAlgorithm(dlow, m, mT, (BackendDAE.INDEX_REDUCTION(), BackendDAE.EXACT(), BackendDAE.REMOVE_SIMPLE_EQN()),funcs);
// late Inline
dlow_1 = Inline.inlineCalls(SOME(funcs),{DAE.NORM_INLINE(),DAE.AFTER_INDEX_RED_INLINE()},dlow_1);
Debug.fcall("bltdump", BackendDump.dumpIncidenceMatrix, m);
Debug.fcall("bltdump", BackendDump.dumpIncidenceMatrixT, mT);
Debug.fcall("bltdump", BackendDump.dump, dlow_1);
Debug.fcall("bltdump", BackendDump.dumpMatching, v1);
(comps) = BackendDAEOptimize.strongComponents(m, mT, v1, v2);
(comps) = BackendDAETransform.strongComponents(m, mT, v1, v2);
/**
* TODO: Activate this when we call it from a command like +d=...
*
Expand Down
1 change: 1 addition & 0 deletions Compiler/Makefile.common
Expand Up @@ -35,6 +35,7 @@ BackendDAE.mo \
BackendDump.mo \
BackendDAECreate.mo \
BackendDAEOptimize.mo \
BackendDAETransform.mo \
BackendDAEUtil.mo \
BackendEquation.mo \
BackendVariable.mo \
Expand Down
17 changes: 9 additions & 8 deletions Compiler/SimCode.mo
Expand Up @@ -70,6 +70,7 @@ public import Inline;
protected import BackendDump;
protected import BackendDAECreate;
protected import BackendDAEOptimize;
protected import BackendDAETransform;
protected import BackendEquation;
protected import BackendVariable;
protected import BackendVarTransform;
Expand Down Expand Up @@ -834,10 +835,10 @@ algorithm
Debug.fcall("bltdump", BackendDump.dump, dlow);
m = BackendDAEUtil.incidenceMatrix(dlow);
mT = BackendDAEUtil.transposeMatrix(m);
(ass1,ass2,dlow_1,m,mT) = BackendDAEOptimize.matchingAlgorithm(dlow, m, mT, (BackendDAE.INDEX_REDUCTION(),BackendDAE.EXACT(),BackendDAE.REMOVE_SIMPLE_EQN()),funcs);
(ass1,ass2,dlow_1,m,mT) = BackendDAETransform.matchingAlgorithm(dlow, m, mT, (BackendDAE.INDEX_REDUCTION(),BackendDAE.EXACT(),BackendDAE.REMOVE_SIMPLE_EQN()),funcs);
// late Inline
dlow_1 = Inline.inlineCalls(SOME(funcs),{DAE.NORM_INLINE(),DAE.AFTER_INDEX_RED_INLINE()},dlow_1);
(comps) = BackendDAEOptimize.strongComponents(m, mT, ass1, ass2);
(comps) = BackendDAETransform.strongComponents(m, mT, ass1, ass2);
indexed_dlow = BackendDAEUtil.translateDae(dlow_1,NONE());
indexed_dlow_1 = BackendDAEUtil.calculateValues(indexed_dlow);
Debug.fprint("bltdump", "indexed DAE:\n");
Expand Down Expand Up @@ -961,10 +962,10 @@ algorithm
Debug.fcall("bltdump", BackendDump.dump, dlow);
m = BackendDAEUtil.incidenceMatrix(dlow);
mT = BackendDAEUtil.transposeMatrix(m);
(ass1,ass2,dlow_1,m,mT) = BackendDAEOptimize.matchingAlgorithm(dlow, m, mT, (BackendDAE.INDEX_REDUCTION(),BackendDAE.EXACT(),BackendDAE.REMOVE_SIMPLE_EQN()),funcs);
(ass1,ass2,dlow_1,m,mT) = BackendDAETransform.matchingAlgorithm(dlow, m, mT, (BackendDAE.INDEX_REDUCTION(),BackendDAE.EXACT(),BackendDAE.REMOVE_SIMPLE_EQN()),funcs);
// late Inline
dlow_1 = Inline.inlineCalls(SOME(funcs),{DAE.NORM_INLINE(),DAE.AFTER_INDEX_RED_INLINE()},dlow_1);
(comps) = BackendDAEOptimize.strongComponents(m, mT, ass1, ass2);
(comps) = BackendDAETransform.strongComponents(m, mT, ass1, ass2);
indexed_dlow = BackendDAEUtil.translateDae(dlow_1,NONE());
indexed_dlow_1 = BackendDAEUtil.calculateValues(indexed_dlow);
Debug.fprint("bltdump", "indexed DAE:\n");
Expand Down Expand Up @@ -3321,8 +3322,8 @@ algorithm
m = BackendDAEUtil.incidenceMatrix(subsystem_dae);
m_1 = BackendDAEUtil.absIncidenceMatrix(m);
mt_1 = BackendDAEUtil.transposeMatrix(m_1);
(v1,v2,subsystem_dae_1,m_2,mT_2) = BackendDAEOptimize.matchingAlgorithm(subsystem_dae, m_1, mt_1, (BackendDAE.NO_INDEX_REDUCTION(), BackendDAE.EXACT(), BackendDAE.KEEP_SIMPLE_EQN()),DAEUtil.avlTreeNew());
(comps) = BackendDAEOptimize.strongComponents(m_2, mT_2, v1,v2);
(v1,v2,subsystem_dae_1,m_2,mT_2) = BackendDAETransform.matchingAlgorithm(subsystem_dae, m_1, mt_1, (BackendDAE.NO_INDEX_REDUCTION(), BackendDAE.EXACT(), BackendDAE.KEEP_SIMPLE_EQN()),DAEUtil.avlTreeNew());
(comps) = BackendDAETransform.strongComponents(m_2, mT_2, v1,v2);
(subsystem_dae_2,m_3,mT_3,v1_1,v2_1,comps_1,r,t) = BackendDAEOptimize.tearingSystem(subsystem_dae_1,m_2,mT_2,v1,v2,comps);
true = listLength(r) > 0;
true = listLength(t) > 0;
Expand Down Expand Up @@ -3692,8 +3693,8 @@ algorithm
m = BackendDAEUtil.incidenceMatrix(d);
m_1 = BackendDAEUtil.absIncidenceMatrix(m);
mt_1 = BackendDAEUtil.transposeMatrix(m_1);
(v1,v2,subsystem_dae_1,m_2,mT_2) = BackendDAEOptimize.matchingAlgorithm(d, m_1, mt_1, (BackendDAE.NO_INDEX_REDUCTION(), BackendDAE.EXACT(), BackendDAE.KEEP_SIMPLE_EQN()),DAEUtil.avlTreeNew());
(comps) = BackendDAEOptimize.strongComponents(m_2, mT_2, v1,v2);
(v1,v2,subsystem_dae_1,m_2,mT_2) = BackendDAETransform.matchingAlgorithm(d, m_1, mt_1, (BackendDAE.NO_INDEX_REDUCTION(), BackendDAE.EXACT(), BackendDAE.KEEP_SIMPLE_EQN()),DAEUtil.avlTreeNew());
(comps) = BackendDAETransform.strongComponents(m_2, mT_2, v1,v2);
(subsystem_dae_2,m_3,mT_3,v1_1,v2_1,comps_1,r,t) = BackendDAEOptimize.tearingSystem(subsystem_dae_1,m_2,mT_2,v1,v2,comps);
true = listLength(r) > 0;
true = listLength(t) > 0;
Expand Down
9 changes: 5 additions & 4 deletions Compiler/XMLDump.mo
Expand Up @@ -89,6 +89,7 @@ public import RTOpts;
protected import Algorithm;
protected import BackendDAEUtil;
protected import BackendDAEOptimize;
protected import BackendDAETransform;
protected import BackendVariable;
protected import ComponentReference;
protected import DAEUtil;
Expand Down Expand Up @@ -2693,8 +2694,8 @@ algorithm
equation
m = BackendDAEUtil.incidenceMatrix(dlow);
mT = BackendDAEUtil.transposeMatrix(m);
(v1,v2,_,m,mT) = BackendDAEOptimize.matchingAlgorithm(dlow, m, mT,(BackendDAE.INDEX_REDUCTION(),BackendDAE.EXACT(),BackendDAE.REMOVE_SIMPLE_EQN()),DAEUtil.avlTreeNew());
(comps) = BackendDAEOptimize.strongComponents(m, mT, v1, v2);
(v1,v2,_,m,mT) = BackendDAETransform.matchingAlgorithm(dlow, m, mT,(BackendDAE.INDEX_REDUCTION(),BackendDAE.EXACT(),BackendDAE.REMOVE_SIMPLE_EQN()),DAEUtil.avlTreeNew());
(comps) = BackendDAETransform.strongComponents(m, mT, v1, v2);
//(blt_states,blt_no_states) = BackendDAE.generateStatePartition(comps, dlow, v1, v2, m, mt);
dumpStrOpenTag(ADDITIONAL_INFO);
dumpStrOpenTag(ORIGINAL_INCIDENCE_MATRIX);
Expand Down Expand Up @@ -2728,8 +2729,8 @@ algorithm
equation
m = BackendDAEUtil.incidenceMatrix(dlow);
mT = BackendDAEUtil.transposeMatrix(m);
(v1,v2,_,m,mT) = BackendDAEOptimize.matchingAlgorithm(dlow, m, mT,(BackendDAE.INDEX_REDUCTION(),BackendDAE.EXACT(),BackendDAE.REMOVE_SIMPLE_EQN()),DAEUtil.avlTreeNew());
(comps) = BackendDAEOptimize.strongComponents(m, mT, v1, v2);
(v1,v2,_,m,mT) = BackendDAETransform.matchingAlgorithm(dlow, m, mT,(BackendDAE.INDEX_REDUCTION(),BackendDAE.EXACT(),BackendDAE.REMOVE_SIMPLE_EQN()),DAEUtil.avlTreeNew());
(comps) = BackendDAETransform.strongComponents(m, mT, v1, v2);
//(blt_states,blt_no_states) = BackendDAE.generateStatePartition(comps, dlow, v1, v2, m, mt);
dumpStrOpenTag(ADDITIONAL_INFO);
dumpStrOpenTag(SOLVING_INFO);
Expand Down

0 comments on commit ff06bd7

Please sign in to comment.