Skip to content

Commit

Permalink
- remove unused functionality
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@8061 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Mar 2, 2011
1 parent f49830e commit 4c043e5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 135 deletions.
135 changes: 8 additions & 127 deletions Compiler/BackEnd/BackendDAEOptimize.mo
Expand Up @@ -77,7 +77,7 @@ protected import ValuesUtil;
* inline functions stuff
*/

public function lateInlineDAE
public function lateInline
"function lateInlineDAE"
input BackendDAE.BackendDAE inDAE;
input DAE.FunctionTree inFunctionTree;
Expand All @@ -101,7 +101,7 @@ algorithm
outAss2 := inAss2;
outComps := inComps;
outRunMatching := false;
end lateInlineDAE;
end lateInline;

/*
* remove simply equations stuff
Expand Down Expand Up @@ -903,7 +903,7 @@ public function removeParameterEqns
output Option<BackendDAE.IncidenceMatrixT> outMT;
algorithm
(outDlow,outM,outMT):=
matchcontinue (inDlow,inFunctionTree,inM,inMT)
match (inDlow,inFunctionTree,inM,inMT)
local
BackendDAE.BackendDAE dlow,dlow1;
DAE.FunctionTree funcs;
Expand All @@ -915,19 +915,13 @@ algorithm
BackendDAE.EquationArray eqns,remeqns,inieqns,eqns1,eqns2;
array<BackendDAE.MultiDimEquation> arreqns;
array<DAE.Algorithm> algorithms;
BackendDAE.EventInfo einfo,einfo1;
BackendDAE.EventInfo einfo;
BackendDAE.ExternalObjectClasses eoc;
BackendDAE.BinTree movedVars;
list<Integer> meqns;
case (dlow,funcs,NONE(),_)
equation
m = BackendDAEUtil.incidenceMatrix(dlow, BackendDAE.NORMAL());
mT = BackendDAEUtil.transposeMatrix(m);
(dlow,om,omT) = removeParameterEqns(dlow,funcs,SOME(m),SOME(mT));
then
(dlow,om,omT);
case (dlow as BackendDAE.DAE(ordvars,knvars,exobj,av,eqns,remeqns,inieqns,arreqns,algorithms,einfo,eoc),funcs,SOME(m),SOME(mT))
case (dlow as BackendDAE.DAE(ordvars,knvars,exobj,av,eqns,remeqns,inieqns,arreqns,algorithms,einfo,eoc),funcs,inM,inMT)
equation
(m,mT) = BackendDAEUtil.getIncidenceMatrixfromOption(dlow,inM,inMT);
// for now check interactive flag to avoid errors there
// false = RTOpts.debugFlag("");
// check equations
Expand All @@ -936,16 +930,13 @@ algorithm
(ordvars2,knvars2) = BackendVariable.moveVariables(ordvars1,knvars1,movedVars);
// remove changed eqns
eqns2 = BackendEquation.equationDelete(eqns1,meqns);
// update EventInfo
einfo1 = removeEqnsfromEventInfo(meqns,einfo);
// update IncidenceMatrix
dlow1 = BackendDAE.DAE(ordvars2,knvars2,exobj,av,eqns2,remeqns,inieqns,arreqns,algorithms,einfo1,eoc);
dlow1 = BackendDAE.DAE(ordvars2,knvars2,exobj,av,eqns2,remeqns,inieqns,arreqns,algorithms,einfo,eoc);
m_2 = BackendDAEUtil.incidenceMatrix(dlow1, BackendDAE.NORMAL());
// update transposed IncidenceMatrix
mT_1 = BackendDAEUtil.transposeMatrix(m_2);
then (dlow1,SOME(m_2),SOME(mT_1));
case (dlow,_,om,omT) then (dlow,om,omT);
end matchcontinue;
end match;
end removeParameterEqns;

protected function traverseIncidenceMatrix
Expand Down Expand Up @@ -1173,116 +1164,6 @@ algorithm
end match;
end removeVarfromIncidenceMatrix;

protected function removeEqnsfromEventInfo
" function: removeEqnsfromEventInfo
autor: Frenkel TUD 2010-12"
input list<Integer> inEqns;
input BackendDAE.EventInfo inEI;
output BackendDAE.EventInfo outEI;
algorithm
outEI := matchcontinue(inEqns,inEI)
local
Integer pos;
list<Integer> rest;
BackendDAE.EventInfo ei,ei1;

case({},inEI) then inEI;

case(pos::rest,inEI)
equation
ei = removeEqnfromEventInfo(pos,inEI);
ei1 = removeEqnsfromEventInfo(rest,ei);
then ei1;

// do not fail in case of an error
case(pos::rest,inEI)
equation
Debug.fcall("failtrace",print,"BackendDAEOptimize.removeEqnsfromEventInfo failed\n");
ei1 = removeEqnsfromEventInfo(rest,inEI);
then ei1;
end matchcontinue;
end removeEqnsfromEventInfo;

protected function removeEqnfromEventInfo
" function: removeEqnfromEventInfo
autor: Frenkel TUD 2010-12"
input Integer inEqn;
input BackendDAE.EventInfo inEI;
output BackendDAE.EventInfo outEI;
algorithm
outEI := match(inEqn,inEI)
local
Integer eqn;
list<BackendDAE.WhenClause> whenClauseLst;
list<BackendDAE.ZeroCrossing> zeroCrossingLst,zeroCrossingLst1;

case(eqn,BackendDAE.EVENT_INFO(whenClauseLst,zeroCrossingLst))
equation
zeroCrossingLst1 = removeEqnfromZeroCrossingLst(eqn,zeroCrossingLst);
then BackendDAE.EVENT_INFO(whenClauseLst,zeroCrossingLst1);
end match;
end removeEqnfromEventInfo;

protected function removeEqnsfromZeroCrossingLst
" function: removeEqnsfromZeroCrossingLst
autor: Frenkel TUD 2010-12"
input list<Integer> inEqns;
input list<BackendDAE.ZeroCrossing> inZCLst;
output list<BackendDAE.ZeroCrossing> outZCLs;
algorithm
outZCLs := matchcontinue(inEqns,inZCLst)
local
Integer eqn;
list<Integer> rest;
list<BackendDAE.ZeroCrossing> zc,zc1;

case({},inZCLst) then inZCLst;

case(eqn::rest,inZCLst)
equation
zc = removeEqnfromZeroCrossingLst(eqn,inZCLst);
zc1 = removeEqnsfromZeroCrossingLst(rest,zc);
then zc1;
end matchcontinue;
end removeEqnsfromZeroCrossingLst;

protected function removeEqnfromZeroCrossingLst
" function: removeEqnfromZeroCrossingLst
autor: Frenkel TUD 2010-12"
input Integer inEqn;
input list<BackendDAE.ZeroCrossing> inZCLst;
output list<BackendDAE.ZeroCrossing> outZCLs;
algorithm
outZCLs := matchcontinue(inEqn,inZCLst)
local
Integer eqn;
list<BackendDAE.ZeroCrossing> rest,zclst;
DAE.Exp relation_;
list<Integer> occurEquLst,occurEquLst1;
list<Integer> occurWhenLst;

case(_,{}) then inZCLst;

case(eqn,BackendDAE.ZERO_CROSSING(relation_,{},occurWhenLst)::rest)
equation
zclst = removeEqnfromZeroCrossingLst(eqn,rest);
then BackendDAE.ZERO_CROSSING(relation_,{},occurWhenLst)::zclst;

// if list occurEquLst and occurWhenLst then remove zero crossing
case(eqn,BackendDAE.ZERO_CROSSING(relation_,occurEquLst,{})::rest)
equation
{} = Util.listRemoveOnTrue(eqn+1,intEq,occurEquLst);
zclst = removeEqnfromZeroCrossingLst(eqn,rest);
then zclst;

case(eqn,BackendDAE.ZERO_CROSSING(relation_,occurEquLst,occurWhenLst)::rest)
equation
occurEquLst1 = Util.listRemoveOnTrue(eqn+1,intEq,occurEquLst);
zclst = removeEqnfromZeroCrossingLst(eqn,rest);
then BackendDAE.ZERO_CROSSING(relation_,occurEquLst1,occurWhenLst)::zclst;
end matchcontinue;
end removeEqnfromZeroCrossingLst;

/*
* tearing system of equations stuff
*/
Expand Down
13 changes: 6 additions & 7 deletions Compiler/BackEnd/BackendDAETransform.mo
Expand Up @@ -443,7 +443,7 @@ algorithm

case (dae,m,mt,nv,nf,i,ass1,ass2,(BackendDAE.INDEX_REDUCTION(),eq_cons,r_simple),inFunctions,derivedAlgs,derivedMultiEqn)
equation
(dae,m,mt,derivedAlgs1,derivedMultiEqn1) = reduceIndexDummyDer(dae, m, mt, nv, nf, i, inFunctions,derivedAlgs,derivedMultiEqn)
(dae,m,mt,derivedAlgs1,derivedMultiEqn1) = reduceIndexDummyDer(dae, m, mt, nv, nf, inFunctions,derivedAlgs,derivedMultiEqn)
"path_found failed, Try index reduction using dummy derivatives.
When a constraint exist between states and index reduction is needed
the dummy derivative will select one of the states as a dummy state
Expand Down Expand Up @@ -1130,7 +1130,6 @@ protected function reduceIndexDummyDer
input BackendDAE.IncidenceMatrixT inIncidenceMatrixT3;
input Integer inInteger4;
input Integer inInteger5;
input Integer inInteger6;
input DAE.FunctionTree inFunctions;
input list<tuple<Integer,Integer,Integer>> inDerivedAlgs;
input list<tuple<Integer,Integer,Integer>> inDerivedMultiEqn;
Expand All @@ -1141,13 +1140,13 @@ protected function reduceIndexDummyDer
output list<tuple<Integer,Integer,Integer>> outDerivedMultiEqn;
algorithm
(outBackendDAE,outIncidenceMatrix,outIncidenceMatrixT,outDerivedAlgs,outDerivedMultiEqn):=
matchcontinue (inBackendDAE1,inIncidenceMatrix2,inIncidenceMatrixT3,inInteger4,inInteger5,inInteger6,inFunctions,inDerivedAlgs,inDerivedMultiEqn)
matchcontinue (inBackendDAE1,inIncidenceMatrix2,inIncidenceMatrixT3,inInteger4,inInteger5,inFunctions,inDerivedAlgs,inDerivedMultiEqn)
local
list<BackendDAE.Value> eqns,diff_eqns,eqns_1,stateindx,deqns,reqns,changedeqns;
list<BackendDAE.Key> states;
BackendDAE.BackendDAE dae;
array<list<BackendDAE.Value>> m,mt;
BackendDAE.Value nv,nf,stateno,i;
BackendDAE.Value nv,nf,stateno;
DAE.ComponentRef state,dummy_der;
list<String> es;
String es_1;
Expand All @@ -1156,7 +1155,7 @@ algorithm
DAE.Exp stateexp,stateexpcall,dummyderexp;
DAE.ExpType tp;

case (dae,m,mt,nv,nf,i,inFunctions,derivedAlgs,derivedMultiEqn)
case (dae,m,mt,nv,nf,inFunctions,derivedAlgs,derivedMultiEqn)
equation
eqns = BackendDAEEXT.getMarkedEqns();
//print("marked equations:");print(Util.stringDelimitList(Util.listMap(eqns,intString),","));
Expand Down Expand Up @@ -1194,7 +1193,7 @@ algorithm
then
(dae,m,mt,derivedAlgs1,derivedMultiEqn1);

case (dae,m,mt,nv,nf,i,_,_,_)
case (dae,m,mt,nv,nf,_,_,_)
equation
eqns = BackendDAEEXT.getMarkedEqns();
diff_eqns = BackendDAEEXT.getDifferentiatedEqns();
Expand All @@ -1213,7 +1212,7 @@ algorithm
then
fail();

case (_,_,_,_,_,_,_,_,_)
case (_,_,_,_,_,_,_,_)
equation
print("-reduce_index_dummy_der failed\n");
then
Expand Down
2 changes: 1 addition & 1 deletion Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -5575,7 +5575,7 @@ protected function getPastOptModules
protected
list<tuple<pastoptimiseDAEModule,String>> allPastOptModules;
algorithm
allPastOptModules := {(BackendDAEOptimize.lateInlineDAE,"lateInline"),
allPastOptModules := {(BackendDAEOptimize.lateInline,"lateInline"),
(BackendDAEOptimize.removeSimpleEquationsPast,"removeSimpleEquations"),
(BackendDump.dumpComponentsGraphStr,"dumpComponentsGraphStr")};
pastOptModules := selectOptModules(strPastOptModules,allPastOptModules,{});
Expand Down

0 comments on commit 4c043e5

Please sign in to comment.