Skip to content

Commit

Permalink
- remove commented handling of if equations because this was already …
Browse files Browse the repository at this point in the history
…moved to the Backend (r12372?)

- comment unused inline solver implementation (this is Backend stuff anyway)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@17040 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
lochel committed Sep 3, 2013
1 parent 024e3ea commit f4b596a
Showing 1 changed file with 49 additions and 52 deletions.
101 changes: 49 additions & 52 deletions Compiler/FrontEnd/DAEUtil.mo
Original file line number Diff line number Diff line change
Expand Up @@ -5424,55 +5424,55 @@ algorithm
end matchcontinue;
end getDAEDeclsFromValueblocks;

public function transformDerInline
"Simple euler inline of the equation system; only does explicit euler, and only der(cref)"
input DAE.DAElist dae;
output DAE.DAElist d;
algorithm
d := matchcontinue (dae)
local
HashTable.HashTable ht;
case _
equation
false = Flags.isSet(Flags.FRONTEND_INLINE_EULER);
then dae;
case _
equation
ht = HashTable.emptyHashTable();
(d,_,ht) = traverseDAE(dae,DAE.emptyFuncTree,simpleInlineDerEuler,ht);
then d;
end matchcontinue;
end transformDerInline;

public function simpleInlineDerEuler
"Simple euler inline of the equation system; only does explicit euler, and only der(cref)"
input tuple<DAE.Exp,HashTable.HashTable> itpl;
output tuple<DAE.Exp,HashTable.HashTable> otpl;
algorithm
otpl := matchcontinue (itpl)
local
DAE.ComponentRef cr,cref_1,cref_2;
HashTable.HashTable crs0,crs1;
DAE.Exp exp,e1,e2;

case ((DAE.CALL(path=Absyn.IDENT("der"),expLst={exp as DAE.CREF(componentRef = cr, ty = DAE.T_REAL(varLst = _))}),crs0))
equation
cref_1 = ComponentReference.makeCrefQual("$old",DAE.T_REAL_DEFAULT,{},cr);
cref_2 = ComponentReference.makeCrefIdent("$current_step_size",DAE.T_REAL_DEFAULT,{});
e1 = Expression.makeCrefExp(cref_1,DAE.T_REAL_DEFAULT);
e2 = Expression.makeCrefExp(cref_2,DAE.T_REAL_DEFAULT);
exp = DAE.BINARY(
DAE.BINARY(exp, DAE.SUB(DAE.T_REAL_DEFAULT), e1),
DAE.DIV(DAE.T_REAL_DEFAULT),
e2);
crs1 = BaseHashTable.add((cr,0),crs0);
then
((exp,crs1));

case ((exp,crs0)) then ((exp,crs0));

end matchcontinue;
end simpleInlineDerEuler;
// protected function transformDerInline "This is not used.
// Simple euler inline of the equation system; only does explicit euler, and only der(cref)"
// input DAE.DAElist dae;
// output DAE.DAElist d;
// algorithm
// d := matchcontinue (dae)
// local
// HashTable.HashTable ht;
// case _
// equation
// false = Flags.isSet(Flags.FRONTEND_INLINE_EULER);
// then dae;
// case _
// equation
// ht = HashTable.emptyHashTable();
// (d,_,ht) = traverseDAE(dae,DAE.emptyFuncTree,simpleInlineDerEuler,ht);
// then d;
// end matchcontinue;
// end transformDerInline;
//
// protected function simpleInlineDerEuler "This is not used.
// Helper function of transformDerInline."
// input tuple<DAE.Exp,HashTable.HashTable> itpl;
// output tuple<DAE.Exp,HashTable.HashTable> otpl;
// algorithm
// otpl := matchcontinue (itpl)
// local
// DAE.ComponentRef cr,cref_1,cref_2;
// HashTable.HashTable crs0,crs1;
// DAE.Exp exp,e1,e2;
//
// case ((DAE.CALL(path=Absyn.IDENT("der"),expLst={exp as DAE.CREF(componentRef = cr, ty = DAE.T_REAL(varLst = _))}),crs0))
// equation
// cref_1 = ComponentReference.makeCrefQual("$old",DAE.T_REAL_DEFAULT,{},cr);
// cref_2 = ComponentReference.makeCrefIdent("$current_step_size",DAE.T_REAL_DEFAULT,{});
// e1 = Expression.makeCrefExp(cref_1,DAE.T_REAL_DEFAULT);
// e2 = Expression.makeCrefExp(cref_2,DAE.T_REAL_DEFAULT);
// exp = DAE.BINARY(
// DAE.BINARY(exp, DAE.SUB(DAE.T_REAL_DEFAULT), e1),
// DAE.DIV(DAE.T_REAL_DEFAULT),
// e2);
// crs1 = BaseHashTable.add((cr,0),crs0);
// then
// ((exp,crs1));
//
// case ((exp,crs0)) then ((exp,crs0));
//
// end matchcontinue;
// end simpleInlineDerEuler;

public function transformationsBeforeBackend
input Env.Cache cache;
Expand All @@ -5485,9 +5485,6 @@ algorithm
DAE.DAE(elts) := dae;
elts := List.map1(elts,makeEvaluatedParamFinal,Env.getEvaluatedParams(cache));
d := DAE.DAE(elts);
// Transform if equations to if expression before going into code generation.
//d := evaluateAnnotation(cache,env,d);
//d := transformIfEqToExpr(d,false);
// Don't even run the function to try and do this; it doesn't work very well
// d := transformDerInline(d);
end transformationsBeforeBackend;
Expand Down

0 comments on commit f4b596a

Please sign in to comment.