Skip to content

Commit

Permalink
revert r24844, don't work
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@24868 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Vitalij Ruge committed Mar 3, 2015
1 parent 26071c2 commit 8d0f908
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 31 deletions.
16 changes: 2 additions & 14 deletions Compiler/BackEnd/Differentiate.mo
Expand Up @@ -2053,15 +2053,6 @@ algorithm
then
fail();

//differentiate function partial
case (e as DAE.CALL(), _, _, _, _)
guard(Flags.isSet(Flags.SIMPLIFY_JAC_FUN))
equation
(e, functions) = differentiateFunctionCallPartial(e, inDiffwrtCref, inInputData, inDiffType, inFunctionTree);
(e,_,_,_) = Inline.inlineExp(e,(SOME(functions),{DAE.NORM_INLINE(),DAE.NO_INLINE()}),DAE.emptyElementSource);
then
(e, functions);

// try to inline
case (DAE.CALL(attr=DAE.CALL_ATTR(builtin=false)), _, _, _, _)
equation
Expand All @@ -2074,7 +2065,6 @@ algorithm

//differentiate function partial
case (e as DAE.CALL(), _, _, _, _)
guard(not Flags.isSet(Flags.SIMPLIFY_JAC_FUN))
equation
(e, functions) = differentiateFunctionCallPartial(e, inDiffwrtCref, inInputData, inDiffType, inFunctionTree);
(e,_,_,_) = Inline.inlineExp(e,(SOME(functions),{DAE.NORM_INLINE(),DAE.NO_INLINE()}),DAE.emptyElementSource);
Expand Down Expand Up @@ -2385,15 +2375,13 @@ algorithm

case (expLst::rest, de::restDiff, DAE.TSUB(exp=DAE.CALL(path=path, attr=attr), ix =ix, ty=ty), _) equation
res = DAE.TSUB(DAE.CALL(path, expLst, attr), ix, ty);
//res = Expression.expMul(de, res);
res = if Flags.isSet(Flags.SIMPLIFY_JAC_FUN) then Expression.makeWeightProduct(de, res) else Expression.expMul(de, res);
res = Expression.expMul(de, res);
res = Expression.expAdd(inAccum, res);
then createPartialSum(rest, restDiff, inCall, res);

case (expLst::rest, de::restDiff, DAE.CALL(path=path, attr=attr), _) equation
res = DAE.CALL(path, expLst, attr);
//res = Expression.expMul(de, res);
res = if Flags.isSet(Flags.SIMPLIFY_JAC_FUN) then Expression.makeWeightProduct(de, res) else Expression.expMul(de, res);
res = Expression.expMul(de, res);
res = Expression.expAdd(inAccum, res);
then createPartialSum(rest, restDiff, inCall, res);
end match;
Expand Down
13 changes: 0 additions & 13 deletions Compiler/FrontEnd/Expression.mo
Expand Up @@ -3566,19 +3566,6 @@ algorithm
end match;
end makeLBinary;

public function makeWeightProduct
" w*f(x) => w==0 ? w : w*f(x)"
input DAE.Exp w;
input DAE.Exp x;
output DAE.Exp y;
protected
DAE.Type tp = typeof(w);
DAE.Exp z = makeConstZero(tp);
DAE.Exp con = DAE.RELATION(w,DAE.EQUAL(tp),z,-1,NONE());
algorithm
y := makeNoEvent(DAE.IFEXP(con,w,expMul(w,x)));
end makeWeightProduct;

public function makeSum1
"Takes a list of expressions an makes a sum
expression sorting adding all elements in the list.
Expand Down
5 changes: 1 addition & 4 deletions Compiler/Util/Flags.mo
Expand Up @@ -426,8 +426,6 @@ constant DebugFlag NO_START_CALC = DEBUG_FLAG(128, "disableStartCalc", false,
Util.gettext("Deactivates the pre-calculation of start values during compile-time."));
constant DebugFlag NO_PARTITIONING = DEBUG_FLAG(129, "disablePartitioning", false,
Util.gettext("Deactivates partitioning of entire equation system."));
constant DebugFlag SIMPLIFY_JAC_FUN = DEBUG_FLAG(130, "simplifyDiffFun", false,
Util.gettext("activate special simplifications for differentiation of function calls"));

// This is a list of all debug flags, to keep track of which flags are used. A
// flag can not be used unless it's in this list, and the list is checked at
Expand Down Expand Up @@ -563,8 +561,7 @@ constant list<DebugFlag> allDebugFlags = {
ADD_DER_ALIASES,
DISABLE_COMSUBEXP,
NO_START_CALC,
NO_PARTITIONING,
SIMPLIFY_JAC_FUN
NO_PARTITIONING
};

public
Expand Down

0 comments on commit 8d0f908

Please sign in to comment.