Skip to content

Commit

Permalink
- Cleaned up some code.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@20422 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed May 7, 2014
1 parent a656c4c commit 31de92b
Show file tree
Hide file tree
Showing 74 changed files with 1,439 additions and 1,613 deletions.
8 changes: 4 additions & 4 deletions Compiler/BackEnd/BackendDAECreate.mo
Expand Up @@ -2531,7 +2531,7 @@ algorithm
b = Expression.isConst(e1);
v1 = Debug.bcallret2(not b, BackendVariable.setBindExp, v, SOME(e1), v);
then ((v1, repl));
else then inTpl;
else inTpl;
end matchcontinue;
end replaceAliasVarTraverser;

Expand Down Expand Up @@ -3302,7 +3302,7 @@ algorithm
(v, e) = addOptimizationVarsEqns2(inConstraint, 1, v, e, true);

then (v, e);
else then (inVars, inEqns);
else (inVars, inEqns);
end match;
end addOptimizationVarsEqns;

Expand Down Expand Up @@ -3335,7 +3335,7 @@ algorithm
eqns = listAppend(conEqn, inEqns);
(v, eqns)= addOptimizationVarsEqns1(conLst, inI + 1, v, eqns, b);
then (v, eqns);
else then (inVars, inEqns);
else (inVars, inEqns);
end match;
end addOptimizationVarsEqns1;

Expand All @@ -3356,7 +3356,7 @@ algorithm
case({DAE.CONSTRAINT_EXPS(constraintLst = constraintLst)}, _, _, _, _) equation
(v, e) = addOptimizationVarsEqns1(constraintLst, inI, inVars, inEqns, b);
then (v, e);
else then (inVars, inEqns);
else (inVars, inEqns);
end match;
end addOptimizationVarsEqns2;

Expand Down
30 changes: 15 additions & 15 deletions Compiler/BackEnd/BackendDAEOptimize.mo
Expand Up @@ -1537,7 +1537,7 @@ algorithm
treelst = DAEUtil.avlTreeToList(usedfuncs2);
usedfuncs = DAEUtil.avlTreeAddLst(treelst, usedfuncs);
then removeUnusedFunctionsSymJacs(rest,(funcs,usedfuncs));
//else then inFuncsTpl;
//else inFuncsTpl;
end match;
end removeUnusedFunctionsSymJacs;

Expand Down Expand Up @@ -2134,7 +2134,7 @@ algorithm
(_, maxdegree) = List.mapFold(sparsepatternT, findDegrees, 1);
print("analytical Jacobians[SPARSE] -> got sparse pattern nonZeroElements: "+& intString(nonZeroElements) +& " maxNodeDegree: " +& intString(maxdegree) +& " time : " +& realString(clock()) +& "\n");
then ();
else then ();
else ();
end match;
end dumpSparsePatternStatistics;

Expand Down Expand Up @@ -2560,7 +2560,7 @@ algorithm
eqn = BackendDAE.RESIDUAL_EQUATION(e1, DAE.emptyElementSource,false,BackendDAE.INITIAL_EQUATION());
then ((var,eqn::eqns));

else then inTpl;
else inTpl;
end matchcontinue;
end generateImplicitInitialEquations;

Expand Down Expand Up @@ -2589,7 +2589,7 @@ algorithm
eqn = BackendDAE.RESIDUAL_EQUATION(e1, DAE.emptyElementSource,false,BackendDAE.INITIAL_EQUATION());
then ((var,eqn::eqns));

else then inTpl;
else inTpl;
end matchcontinue;
end generateImplicitInitialEquationsForParameters;

Expand Down Expand Up @@ -2669,7 +2669,7 @@ algorithm
//true = BackendVariable.isVarOnTopLevelAndOutput(variable);
var = BackendVariable.setVarDirection(var, DAE.BIDIR());
then ((var,i));
else then inTpl;
else inTpl;
end matchcontinue;
end redirectOutputToBiDir;

Expand Down Expand Up @@ -2935,7 +2935,7 @@ algorithm
_ = System.realtimeTock(GlobalScript.RT_CLOCK_EXECSTAT_JACOBIANS);
then outBackendDAE;

else then inBackendDAE;
else inBackendDAE;
end matchcontinue;
end generateSymbolicJacobianPast;

Expand Down Expand Up @@ -2969,7 +2969,7 @@ algorithm
_ = System.realtimeTock(GlobalScript.RT_CLOCK_EXECSTAT_JACOBIANS);
then outBackendDAE;

else then inBackendDAE;
else inBackendDAE;
end matchcontinue;
end generateSymbolicLinearizationPast;

Expand Down Expand Up @@ -4086,7 +4086,7 @@ algorithm
Error.addMessage(Error.INTERNAL_ERROR, {errorMessage});
then (BackendDAE.EMPTY_JACOBIAN(), inShared);

else then (BackendDAE.EMPTY_JACOBIAN(), inShared);
else (BackendDAE.EMPTY_JACOBIAN(), inShared);
end matchcontinue;
end getSymbolicJacobian;

Expand Down Expand Up @@ -4262,7 +4262,7 @@ algorithm
b := match(inEqn)
case BackendDAE.ARRAY_EQUATION(source=DAE.SOURCE(info=Absyn.INFO(fileName="stateselection"))) then false;
case BackendDAE.EQUATION(source=DAE.SOURCE(info=Absyn.INFO(fileName="stateselection"))) then false;
else then true;
else true;
end match;
end removeStateSetEqn;

Expand Down Expand Up @@ -4771,7 +4771,7 @@ algorithm
(outDAE,_) = BackendDAEUtil.mapEqSystemAndFold(inDAE,countOperations0,false);
then
outDAE;
else then inDAE;
else inDAE;
end matchcontinue;
end countOperations;

Expand Down Expand Up @@ -6431,7 +6431,7 @@ algorithm
repl_1 = BackendVarTransform.addReplacement(repl, varName, exp, NONE());
then ((v, repl_1));

else then inTpl;
else inTpl;
end matchcontinue;
end removeConstantsFinder;

Expand Down Expand Up @@ -6471,7 +6471,7 @@ algorithm
_ = BackendDAEUtil.traverseBackendDAEExpsEqnsWithUpdate(orderedEqs, traverserreplaceEdgeChange, false);
then (BackendDAE.EQSYSTEM(orderedVars, orderedEqs, m, mT, matching, stateSets), (shared, true));

else then (isyst, sharedChanged);
else (isyst, sharedChanged);
end matchcontinue;
end replaceEdgeChange0;

Expand Down Expand Up @@ -6505,7 +6505,7 @@ algorithm
ty = Expression.typeof(e);
then ((DAE.LBINARY(e, DAE.AND(ty), DAE.LUNARY(DAE.NOT(ty), DAE.CALL(Absyn.IDENT("pre"), {e}, DAE.CALL_ATTR(ty, false, true, false, DAE.NO_INLINE(), DAE.NO_TAIL())))), true));

else then tpl;
else tpl;
end matchcontinue;
end traverserExpreplaceEdgeChange;

Expand Down Expand Up @@ -7622,7 +7622,7 @@ algorithm
then
(BackendDAE.EQSYSTEM(orderedVars, orderedEqs, m, mT, matching, stateSets), (shared, true));

else then (isyst, sharedChanged);
else (isyst, sharedChanged);
end matchcontinue;
end applyRewriteRulesBackend0;

Expand Down Expand Up @@ -7655,7 +7655,7 @@ algorithm
then
((e, true));

else then tpl;
else tpl;
end matchcontinue;
end traverserExpapplyRewriteRulesBackend;

Expand Down
8 changes: 4 additions & 4 deletions Compiler/BackEnd/BackendDAETransform.mo
Expand Up @@ -548,7 +548,7 @@ algorithm
Debug.bcall2(intLt(linInfo,0), Error.addMessage, Error.LINEAR_SYSTEM_INVALID, {"LAPACK/dgesv",syst});
then
false;
else then true;
else true;
end matchcontinue;
end analyzeConstantJacobian;

Expand Down Expand Up @@ -589,7 +589,7 @@ algorithm
then
BackendDAE.VAR(cr,BackendDAE.STATE_DER(),dir,prl,tp,exp,v,dim,source,attr,comment,ct);

else then inVar;
else inVar;
end match;
end transformXToXd;

Expand Down Expand Up @@ -1355,7 +1355,7 @@ algorithm
(stack,comps) = checkStack(nv, istack, number, stackflag, {});
then
(stack,comps);
else then (istack,{});
else (istack,{});
end matchcontinue;
end checkRoot;

Expand Down Expand Up @@ -1386,7 +1386,7 @@ algorithm
(stack,comp) = checkStack(vn, rest, number, stackflag, top :: icomp);
then
(stack,comp);
else then (istack,listReverse(icomp));
else (istack,listReverse(icomp));
end matchcontinue;
end checkStack;

Expand Down
14 changes: 7 additions & 7 deletions Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -115,7 +115,7 @@ public function isInitializationDAE
algorithm
res := match(inShared)
case (BackendDAE.SHARED(backendDAEType=BackendDAE.INITIALSYSTEM())) then true;
else then false;
else false;
end match;
end isInitializationDAE;

Expand Down Expand Up @@ -6104,7 +6104,7 @@ algorithm
(jac, shared) = calculateJacobianRows(eqn_lst,vars,m,1,1,differentiateIfExp,iShared,varsInEqn,{});
then
(SOME(jac),shared);
else then (NONE(), iShared); /* no analytic jacobian available */
else (NONE(), iShared); /* no analytic jacobian available */
end matchcontinue;
end calculateJacobian;

Expand All @@ -6130,7 +6130,7 @@ algorithm
(jac, shared) = calculateJacobianRows(eqn_lst,vars,m,1,1,differentiateIfExp,iShared,varsInEqnEnhanced,{});
then
(SOME(jac), shared);
else then (NONE(), iShared); /* no analytic jacobian available */
else (NONE(), iShared); /* no analytic jacobian available */
end matchcontinue;
end calculateJacobianEnhanced;

Expand Down Expand Up @@ -6741,7 +6741,7 @@ algorithm
true = Expression.isConst(e);
then
jacobianConstant(eqns);
else then false;
else false;
end matchcontinue;
end jacobianConstant;

Expand Down Expand Up @@ -6769,7 +6769,7 @@ algorithm
then
jacobianNonlinear(vars, xs);
case (_,{}) then false;
else then true;
else true;
end matchcontinue;
end jacobianNonlinear;

Expand Down Expand Up @@ -7099,7 +7099,7 @@ algorithm
repl1 = BackendVarTransform.addReplacement(repl,cr,Expression.makeConstZero(ComponentReference.crefLastType(cr)),NONE());
then
((var,repl1));
else then inTpl;
else inTpl;
end matchcontinue;
end makeZeroReplacement;

Expand Down Expand Up @@ -8452,7 +8452,7 @@ algorithm
Debug.execStat("transformDAE -> state selection " +& methodstr,GlobalScript.RT_CLOCK_EXECSTAT_BACKEND_MODULES);
then
outDAE;
else then inDAE;
else inDAE;
end match;
end stateDeselectionDAE;

Expand Down
6 changes: 3 additions & 3 deletions Compiler/BackEnd/BackendDump.mo
Expand Up @@ -1504,7 +1504,7 @@ algorithm
str2 = stringAppendList({str," in equations [",eq_s,"] and when conditions [",wc_s,"]"});
then str2;

else then "";
else "";
end match;
end zeroCrossingString;

Expand Down Expand Up @@ -1542,7 +1542,7 @@ algorithm
str = stringAppendList({" whenclause = ",sc," then ",s1});
then str;

else then "";
else "";
end match;
end whenClauseString;

Expand Down Expand Up @@ -1988,7 +1988,7 @@ algorithm
local
Type_A a;
case (SOME(a), _) equation infunc(a); then();
else then ();
else ();
end match;
end dumpOption;

Expand Down
10 changes: 5 additions & 5 deletions Compiler/BackEnd/BackendEquation.mo
Expand Up @@ -2214,7 +2214,7 @@ algorithm
DAE.ComponentRef lhs;
case (lhs, SOME(rhs), _)
then {BackendDAE.SOLVED_EQUATION(lhs,rhs,Source,false,BackendDAE.UNKNOWN_EQUATION_KIND())};
else then {};
else {};
end match;
end generateSolvedEqnsfromOption;

Expand All @@ -2241,7 +2241,7 @@ algorithm
case (lhs, DAE.RELATION(e1,DAE.GREATEREQ(_),e2,_,_), _) equation
(rhs,_) = ExpressionSimplify.simplify(DAE.BINARY(e2,DAE.SUB(DAE.T_REAL_DEFAULT),e1));
then {BackendDAE.SOLVED_EQUATION(lhs, rhs,Source,false,BackendDAE.UNKNOWN_EQUATION_KIND())};
else then {};
else {};
end match;
end generateResidualfromRealtion;

Expand Down Expand Up @@ -2782,7 +2782,7 @@ public function isWhenEquation
algorithm
b := match(inEqn)
case BackendDAE.WHEN_EQUATION(whenEquation=_) then true;
else then false;
else false;
end match;
end isWhenEquation;

Expand All @@ -2792,7 +2792,7 @@ public function isArrayEquation
algorithm
b := match(inEqn)
case BackendDAE.ARRAY_EQUATION(source=_) then true;
else then false;
else false;
end match;
end isArrayEquation;

Expand All @@ -2802,7 +2802,7 @@ public function isAlgorithm
algorithm
b := match(inEqn)
case BackendDAE.ALGORITHM(source=_) then true;
else then false;
else false;
end match;
end isAlgorithm;

Expand Down
6 changes: 3 additions & 3 deletions Compiler/BackEnd/BackendVarTransform.mo
Expand Up @@ -482,7 +482,7 @@ algorithm
repl_1 = makeTransitive12(lst,repl,singleRepl,inFuncTypeExpExpToBooleanOption,HashSet.emptyHashSet());
then
(repl_1,src,dst);
else then (repl,src,dst);
else (repl,src,dst);
end matchcontinue;
end makeTransitive1;

Expand Down Expand Up @@ -1498,7 +1498,7 @@ algorithm
case DAE.CREF_QUAL(ident = "$pDER") then true;
// keep same a while untill we know which are needed
//case DAE.CREF_QUAL(ident = "$DER") then true;
else then false;
else false;
end match;
end selfGeneratedVar;

Expand Down Expand Up @@ -2586,7 +2586,7 @@ algorithm
print("\n");
then
();
else then ();
else ();
end match;
end dumpDerConstReplacements;

Expand Down

0 comments on commit 31de92b

Please sign in to comment.