Skip to content

Commit

Permalink
- Automatic refactoring
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15630 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Mar 25, 2013
1 parent d718851 commit 98feb33
Show file tree
Hide file tree
Showing 77 changed files with 409 additions and 1,058 deletions.
29 changes: 8 additions & 21 deletions Compiler/BackEnd/BackendDAECreate.mo
Expand Up @@ -258,8 +258,6 @@ algorithm
list<BackendDAE.Equation> eqns, reqns, ieqns;
list<BackendDAE.WhenClause> whenclauses;
DAE.ElementSource source;
list<DAE.Exp> explst;
DAE.Exp e2;
HashTableExpToExp.HashTable inlineHT;
// class for external object
case (DAE.EXTOBJECTCLASS(path, source), _, _, _, _, _, _, _, _, _, _, _, _, _)
Expand Down Expand Up @@ -1082,7 +1080,6 @@ algorithm
list<list<DAE.Element>> eqnslstlst;
list<DAE.Element> eqnslst,daeElts;
String s;
DAE.Algorithm alg;
list<BackendDAE.Equation> eqns,reqns,ieqns;
Absyn.Path path;

Expand Down Expand Up @@ -1321,7 +1318,6 @@ algorithm
outEqns := matchcontinue(cond, conditions, theneqn, theneqns, elseenqs, conditions1, theneqns1, source, functionTree, inEqns)
local
list<DAE.Exp> explst;
list<list<DAE.Element>> eqnslst;
list<list<BackendDAE.Equation>> beqnslst;
list<BackendDAE.Equation> beqns,breqns,bieqns;

Expand Down Expand Up @@ -1454,7 +1450,6 @@ algorithm
list<DAE.Exp> explst;
DAE.Element eqn;
list<DAE.Element> eqns, beqns;
list<list<DAE.Element>> eqnslst;
DAE.ElementSource source;
case ({}, _, _, _, _)
then
Expand Down Expand Up @@ -1675,7 +1670,7 @@ algorithm
DAE.Exp cond;
list<DAE.Element> eqnl;
DAE.Element elsePart;
String scond, str;
String str;
DAE.ElementSource source;

case (DAE.WHEN_EQUATION(condition = cond, equations = eqnl, elsewhen_ = NONE(), source=source), _, _, _)
Expand Down Expand Up @@ -1731,8 +1726,6 @@ algorithm
DAE.Dimensions ds;
list<DAE.Exp> expl;
list<list<DAE.Element>> eqnslst;
Boolean b;
String s;
Absyn.Path functionName;
HashTableCrToExpSourceTpl.HashTable ht;
list<tuple<DAE.ComponentRef, tuple<DAE.Exp, DAE.ElementSource>>> crexplst;
Expand Down Expand Up @@ -2207,12 +2200,11 @@ protected function getWhenEquationFromVariable
output BackendDAE.WhenEquation outEquation;
output list<BackendDAE.Equation> outEquations;
algorithm
(outEquation, outEquations) := matchcontinue(inCr, inEquations)
(outEquation, outEquations) := match(inCr, inEquations)
local
DAE.ComponentRef cr1, cr2;
BackendDAE.WhenEquation eq;
BackendDAE.Equation eq2;
list<BackendDAE.Equation> rest, rest2;
list<BackendDAE.Equation> rest;

case (cr1, BackendDAE.WHEN_EQUATION(whenEquation=eq as BackendDAE.WHEN_EQ(left=cr2))::rest)
equation
Expand All @@ -2224,7 +2216,7 @@ algorithm
Error.addMessage(Error.DIFFERENT_VARIABLES_SOLVED_IN_ELSEWHEN, {});
then
fail();
end matchcontinue;
end match;
end getWhenEquationFromVariable;


Expand Down Expand Up @@ -2525,7 +2517,6 @@ algorithm
DAE.ComponentRef cr1, cr2;
list<DAE.Exp> explst1, explst2;
list<list<DAE.Exp>> explstlst1, explstlst2;
list<DAE.Var> varLst1, varLst2;
list<DAE.ComponentRef> crefs1, crefs2;
DAE.Dimensions dims1, dims2;
Integer arrayTyp1, arrayTyp2, i1, i2;
Expand Down Expand Up @@ -2924,7 +2915,6 @@ algorithm
outVariables := matchcontinue (inEquation, inKnVariables, inVariables)
local
DAE.ComponentRef cr;
list<DAE.ComponentRef> crlst;
list<BackendDAE.Var> vars;
list<DAE.Statement> statementLst;
case (BackendDAE.WHEN_EQUATION(whenEquation = BackendDAE.WHEN_EQ(left = cr)), _, _)
Expand Down Expand Up @@ -3451,7 +3441,7 @@ algorithm
BackendDAE.EventInfo einfo, einfo1;
BackendDAE.ExternalObjectClasses eoc;
BackendDAE.SampleLookup sampleLookup;
list<BackendDAE.WhenClause> whenclauses, whenclauses1;
list<BackendDAE.WhenClause> whenclauses;
list<BackendDAE.Equation> eqs_lst, eqs_lst1;
list<BackendDAE.ZeroCrossing> zero_crossings;
list<BackendDAE.ZeroCrossing> relationsLst, sampleLst;
Expand Down Expand Up @@ -3561,12 +3551,10 @@ algorithm
matchcontinue (inVariables1, knvars, inEquationLst2, inEqnCount, inWhenClauseLst4, inWhenClauseCount, inNumberOfRelations, inNumberOfMathFunctions, inZeroCrossingLst, inRelationsLst, inSamplesLst)
local
BackendDAE.Variables v;
list<DAE.Exp> conds;
list<BackendDAE.ZeroCrossing> zcs, zcs1, res, res1, relationsLst, sampleLst;
Integer size, countRelations, eq_count_1, eq_count, wc_count, countMathFunctions;
BackendDAE.Equation e;
list<BackendDAE.Equation> xs, el, eq_reslst, eqnselse;
list<list<BackendDAE.Equation>> eqnslst;
list<BackendDAE.Equation> xs, el, eq_reslst;
DAE.Exp daeExp, e1, e2, eres1, eres2;
BackendDAE.WhenClause wc;
list<BackendDAE.WhenClause> xsWhen, wc_reslst;
Expand Down Expand Up @@ -3733,7 +3721,7 @@ algorithm
(oIfEqn, outcountRelations, outcountMathFunctions, outZeroCrossings, outrelationsinZC, outSamplesLst) :=
match(inIfEqn, inZeroCrossings, inrelationsinZC, inSamplesLst, incountRelations, incountMathFunctions, counteq, countwc, vars, knvars)
local
DAE.Exp condition, e;
DAE.Exp condition;
list<DAE.Exp> conditions, restconditions;
BackendDAE.Equation ifeqn;
list<BackendDAE.Equation> eqnstrue, elseeqns;
Expand Down Expand Up @@ -3968,7 +3956,7 @@ algorithm
BackendDAE.Variables vars, knvars;
list<BackendDAE.ZeroCrossing> zeroCrossings, zc_lst, relations, samples;
DAE.Operator op;
Integer numRelations, alg_indx, new_idx, itmp, numRelations1, numMathFunctions;
Integer numRelations, alg_indx, itmp, numRelations1, numMathFunctions;
BackendDAE.ZeroCrossing zc;
DAE.CallAttributes attr;
DAE.Type ty;
Expand Down Expand Up @@ -4337,7 +4325,6 @@ algorithm
DAE.Operator op;
list<BackendDAE.ZeroCrossing> newzero, zc_lst;
BackendDAE.ZeroCrossing z_c;
Integer indx, length;
String str;
case ((DAE.RELATION(exp1 = e1, operator = op, exp2 = e2)), _, _, z_c)
equation
Expand Down
51 changes: 6 additions & 45 deletions Compiler/BackEnd/BackendDAEOptimize.mo
Expand Up @@ -143,7 +143,6 @@ algorithm
BackendDAE.Variables vars;
BackendDAE.EquationArray eqns;
list<BackendDAE.Equation> eqnslst;
Integer oldsize,newsize;
BackendDAE.Matching matching;
Option<BackendDAE.IncidenceMatrix> m;
Option<BackendDAE.IncidenceMatrixT> mT;
Expand Down Expand Up @@ -2001,8 +2000,6 @@ algorithm
local
BackendDAE.Variables vars;
BackendDAE.EquationArray eqns;
BackendDAE.StrongComponents comps;
array<Integer> ass1,ass2;
BackendDAE.StateSets stateSets;
case (false,_) then isyst;
// case (true,BackendDAE.EQSYSTEM(orderedVars=vars,orderedEqs=eqns,matching=BackendDAE.NO_MATCHING()))
Expand Down Expand Up @@ -2292,12 +2289,11 @@ algorithm
list<Integer> nodesList, nodesEqnsIndex;
list<list<Integer>> sparsepattern,sparsepatternT, coloredlist;
list<BackendDAE.Var> jacDiffVars, indiffVars, indiffedVars;
BackendDAE.Variables diffedVars, diffVars, varswithDiffs;
BackendDAE.Variables diffedVars, varswithDiffs;
BackendDAE.EquationArray orderedEqns;
array<Option<list<Integer>>> forbiddenColor;
array<Integer> colored, colored1, ass1, ass2;
array<list<Integer>> coloredArray;
list<Integer> varsIndexes;

list<DAE.ComponentRef> diffCompRefs, diffedCompRefs;

Expand Down Expand Up @@ -3048,14 +3044,12 @@ algorithm
BackendDAE.Variables initialVars;
BackendDAE.EquationArray initialEqs;
BackendDAE.EqSystem initEqSystem;
BackendDAE.SymbolicJacobian jacobian;

BackendDAE.Variables orderedVars, knownVars;
BackendDAE.EquationArray orderedEqs;

list<BackendDAE.Var> orderedVarList, knownVarList, states, inputs, outputs, parameters;
list<DAE.ComponentRef> orderedVarCrefList, knownVarCrefList;
BackendDAE.SparsePattern sparsityPattern;

BackendDAE.Shared shared;

Expand Down Expand Up @@ -6176,7 +6170,6 @@ algorithm
DAE.ComponentRef cr;
BackendDAE.Var v;
DAE.Exp e;
Boolean b;
case ((DAE.CREF(componentRef = cr),(knvars,_)))
equation
(v::{},_::{}) = BackendVariable.getVar(cr,knvars);
Expand Down Expand Up @@ -6280,10 +6273,8 @@ protected function simplifyIfEquation1
algorithm
outEqns := matchcontinue(conditions,theneqns,elseenqs,source,knvars,inEqns)
local
DAE.Exp e;
list<DAE.Exp> explst,fbsExp;
list<DAE.Exp> fbsExp;
list<list<DAE.Exp>> tbsExp;
list<list<BackendDAE.Equation>> eqnslst;
list<BackendDAE.Equation> eqns;
HashTable2.HashTable ht;
list<tuple<DAE.ComponentRef,DAE.Exp>> crexplst;
Expand Down Expand Up @@ -6491,10 +6482,8 @@ algorithm
(obrancheqns,outEqns) := match(brancheqns,condition,conditions,brancheqns1,inEqns)
local
DAE.Exp e,cond,msg,level;
list<DAE.Exp> explst;
BackendDAE.Equation eqn;
list<BackendDAE.Equation> eqns,beqns;
list<list<BackendDAE.Equation>> eqnslst;
Integer size;
DAE.ElementSource source,source1;
case ({},_,_,_,_)
Expand Down Expand Up @@ -6779,12 +6768,11 @@ protected function simplifysemiLinearWork "function simplifysemiLinearWork
algorithm
(osyst,oshared) := matchcontinue (isyst,ishared)
local
BackendDAE.Variables vars,knvars;
BackendDAE.Variables vars;
BackendDAE.EquationArray eqns;
list<tuple<BackendDAE.Equation,Integer>> eqnslst;
BackendDAE.EqSystem syst;
BackendDAE.Shared shared;
Boolean b;
HashTableExpToIndex.HashTable ht;
array<list<tuple<BackendDAE.Equation,Integer>>> eqnsarray;
BackendDAE.StateSets stateSets;
Expand Down Expand Up @@ -6881,9 +6869,7 @@ algorithm
DAE.Exp sa,sb,s1,y,x;
list<DAE.Exp> rest;
list<tuple<DAE.Exp,Integer,DAE.ElementSource>> explst;
array<tuple<BackendDAE.Equation,Integer>> eqnsarray;
list<tuple<BackendDAE.Equation,Integer>> acc;
HashTableExpToIndex.HashTable ht;
BackendDAE.Equation eqn,eqn1;
Integer i1,index,index1;
Absyn.Path path;
Expand Down Expand Up @@ -7297,7 +7283,7 @@ algorithm
local
BackendDAE.Variables vars;
DAE.Type tp;
DAE.Exp e,zero;
DAE.Exp e;
DAE.ComponentRef cr;
BackendDAE.Var var;
list<DAE.Exp> explst;
Expand Down Expand Up @@ -7601,8 +7587,7 @@ algorithm
HashTable2.HashTable initalAliases;
Boolean optimizationfound,negate;
DAE.ComponentRef cr1,cr2;
DAE.Exp e1,e2,e1_1,e2_1;
list<DAE.Exp> ea1,ea2;
DAE.Exp e1,e2;

case ({},_,_,_,_) then (listReverse(iAcc),iInitalAliases,iOptimizationfound);
case ((eqn as BackendDAE.EQUATION(exp=e1,scalar=e2))::eqnslst,_,_,_,_)
Expand Down Expand Up @@ -7967,7 +7952,6 @@ algorithm
BackendDAE.WhenEquation elsewhenPart, whenEquation;
list<BackendDAE.Var> vars, vars1;
list<BackendDAE.Equation> eqns, eqns1, additionalInitialEquations, additionalInitialEquations1;
String crStr;

DAE.Exp condition;
DAE.ComponentRef left;
Expand Down Expand Up @@ -8014,7 +7998,6 @@ algorithm
(outCondition, outVars, outEqns, outAdditionalInitialEquations, outIndex, outHT) := matchcontinue(inCondition, inSource, inIndex, inHT)
local
Integer index, localIndex;
BackendDAE.WhenEquation elsewhenPart, whenEquation;
BackendDAE.Var var;
BackendDAE.Equation eqn;
BackendDAE.Equation initialEqn;
Expand All @@ -8025,8 +8008,6 @@ algorithm
DAE.Exp crefPreExp;

DAE.Exp condition;
DAE.ComponentRef left;
DAE.Exp right;
list<DAE.Exp> array;

DAE.Type ty;
Expand Down Expand Up @@ -8086,18 +8067,11 @@ algorithm
(outConditionList, outVars, outEqns, outAdditionalInitialEquations, outIndex, outHT) := matchcontinue(inConditionList, inSource, inIndex, inHT)
local
Integer index;
BackendDAE.WhenEquation elsewhenPart, whenEquation;
BackendDAE.Var var;
BackendDAE.Equation eqn;
list<BackendDAE.Var> vars1, vars2;
list<BackendDAE.Equation> eqns1, eqns2;
String crStr;

DAE.Exp condition;
list<DAE.Exp> conditionList;
DAE.ComponentRef left;
DAE.Exp right;
list<DAE.Exp> array;
list<BackendDAE.Equation> additionalInitialEquations, additionalInitialEquations1;

HashTableExpToIndex.HashTable ht;
Expand Down Expand Up @@ -8134,12 +8108,9 @@ algorithm
(outStmts, outPreStmts, outVars, outAdditionalInitialEquations, outIndex) := matchcontinue(inStmts, inVars, inIndex)
local
DAE.Exp condition;
list<DAE.ComponentRef> crefLst;
DAE.Statement stmt, elseWhen;
list<DAE.Statement> stmts, rest, stmts1, stmts_, preStmts, preStmts2, elseWhenList;
list<tuple<DAE.ComponentRef, Integer>> crintLst;
list<BackendDAE.Var> vars1, vars2;
list<BackendDAE.Equation> eqns, additionalInitialEquations, additionalInitialEquations1;
list<BackendDAE.Equation> additionalInitialEquations, additionalInitialEquations1;
Integer index;
DAE.ElementSource source;
list<BackendDAE.Var> vars;
Expand Down Expand Up @@ -8240,7 +8211,6 @@ algorithm
(outCondition, outVars, outStmts, outAdditionalInitialEquations, outIndex) := matchcontinue(inCondition, inSource, inIndex)
local
Integer index;
BackendDAE.WhenEquation elsewhenPart, whenEquation;
BackendDAE.Var var;
DAE.Statement stmt;
list<BackendDAE.Var> vars;
Expand All @@ -8249,8 +8219,6 @@ algorithm
DAE.Exp crefPreExp;

DAE.Exp condition;
DAE.ComponentRef left;
DAE.Exp right;
list<DAE.Exp> array;

DAE.Type ty;
Expand Down Expand Up @@ -8313,18 +8281,11 @@ algorithm
(outConditionList, outVars, outStmts, outAdditionalInitialEquations, outIndex) := matchcontinue(inConditionList, inSource, inIndex)
local
Integer index;
BackendDAE.WhenEquation elsewhenPart, whenEquation;
BackendDAE.Var var;
BackendDAE.Equation eqn;
list<BackendDAE.Var> vars1, vars2;
list<DAE.Statement> stmt1, stmt2;
String crStr;

DAE.Exp condition;
list<DAE.Exp> conditionList;
DAE.ComponentRef left;
DAE.Exp right;
list<DAE.Exp> array;

list<BackendDAE.Equation> additionalInitialEquations, additionalInitialEquations1;

Expand Down
6 changes: 2 additions & 4 deletions Compiler/BackEnd/BackendDAETransform.mo
Expand Up @@ -235,8 +235,6 @@ algorithm
list<BackendDAE.Equation> eqn_lst;
BackendDAE.EquationArray eqns;
BackendDAE.StrongComponent compX;
Integer mark,low,high;
Boolean foundequal;
case (comp,BackendDAE.EQSYSTEM(orderedVars=vars,orderedEqs=eqns),_,ass1,ass2,_,_,_,_)
equation
vlst = List.map1r(comp,arrayGet,ass2);
Expand Down Expand Up @@ -408,7 +406,7 @@ algorithm
array<Integer> ass1,ass2;
BackendDAE.IncidenceMatrix m;
BackendDAE.IncidenceMatrixT mt;
BackendDAE.Variables vars,evars,vars_1;
BackendDAE.Variables vars,vars_1;
list<BackendDAE.Equation> eqn_lst,eqn_lst1,cont_eqn,disc_eqn;
list<BackendDAE.Var> var_lst,var_lst_1,cont_var,disc_var;
list<Integer> indxcont_var,indxdisc_var,indxcont_eqn,indxdisc_eqn;
Expand Down Expand Up @@ -1640,7 +1638,7 @@ algorithm
DAE.ElementSource source;
Type_a ext_arg_1,ext_arg_2;
Absyn.Path functionName;
list<DAE.Exp> functionArgs,functionArgs1;
list<DAE.Exp> functionArgs;

case ({},_,_) then ({},inTypeA);

Expand Down

0 comments on commit 98feb33

Please sign in to comment.