Skip to content

Commit

Permalink
- more fixes for differentiation module
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@20671 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Willi Braun committed May 18, 2014
1 parent 5c07e18 commit 27d7cb7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Compiler/BackEnd/BackendDAECreate.mo
Expand Up @@ -1088,6 +1088,8 @@ algorithm
then inType;
case (DAE.T_ARRAY(ty = _))
then inType;
case (DAE.T_FUNCTION(funcResultType = _))
then inType;
else equation print("lowerType: " +& Types.printTypeStr(inType) +& " failed\n"); then fail();
end matchcontinue;
end lowerType;
Expand Down
15 changes: 7 additions & 8 deletions Compiler/BackEnd/Differentiate.mo
Expand Up @@ -59,7 +59,7 @@ protected import BackendVariable;
protected import ClassInf;
protected import ComponentReference;
protected import DAEDump;
//protected import DAEDumpTpl;
protected import DAEDumpTpl;
protected import Debug;
protected import Error;
protected import Expression;
Expand All @@ -68,7 +68,7 @@ protected import ExpressionDump;
protected import Flags;
protected import Inline;
protected import List;
//protected import Tpl;
protected import Tpl;
protected import Util;


Expand Down Expand Up @@ -221,7 +221,7 @@ algorithm
//Error.addSourceMessage(Error.INTERNAL_ERROR, {msg}, DAEUtil.getElementSourceFileInfo(DAE.emptyElementSource));

true = Flags.isSet(Flags.FAILTRACE);
msg = "\nDifferentiate.differentiateExpTime failed for " +& ExpressionDump.printExpStr(inExp) +& "\n\n";
msg = "\nDifferentiate.differentiateExpCref failed for " +& ExpressionDump.printExpStr(inExp) +& "\n\n";
Error.addMessage(Error.NON_EXISTING_DERIVATIVE, {msg});
then fail();

Expand Down Expand Up @@ -254,7 +254,7 @@ algorithm
//Error.addSourceMessage(Error.INTERNAL_ERROR, {msg}, DAEUtil.getElementSourceFileInfo(DAE.emptyElementSource));

true = Flags.isSet(Flags.FAILTRACE);
msg = "\nDifferentiate.differentiateExpTime failed for " +& ExpressionDump.printExpStr(inExp) +& "\n\n";
msg = "\nDifferentiate.differentiateExpCrefFunction failed for " +& ExpressionDump.printExpStr(inExp) +& "\n\n";
Error.addMessage(Error.NON_EXISTING_DERIVATIVE, {msg});
then fail();

Expand Down Expand Up @@ -295,7 +295,7 @@ algorithm
//Error.addSourceMessage(Error.INTERNAL_ERROR, {msg}, DAEUtil.getElementSourceFileInfo(DAE.emptyElementSource));

true = Flags.isSet(Flags.FAILTRACE);
msg = "\nDifferentiate.differentiateExpTime failed for " +& ExpressionDump.printExpStr(inExp) +& "\n\n";
msg = "\nDifferentiate.differentiateCrefFullJacobian failed for " +& ExpressionDump.printExpStr(inExp) +& "\n\n";
Error.addMessage(Error.NON_EXISTING_DERIVATIVE, {msg});
then fail();

Expand Down Expand Up @@ -2059,7 +2059,7 @@ algorithm
DAE.FunctionDefinition derfuncdef;
DAE.Function func,dfunc;
list<DAE.Function> fns;
String funcname;
String funcname, s1;
list<DAE.FuncArg> falst;

case (DAE.CALL(path=path,expLst=expl,attr=DAE.CALL_ATTR(tuple_=b,builtin=c,isImpure=isImpure,ty=ty,tailCall=tc)), _, _, BackendDAE.DIFFERENTATION_TIME(), _)
Expand Down Expand Up @@ -2098,8 +2098,7 @@ algorithm
// try to inline
case (DAE.CALL(expLst = _,attr=DAE.CALL_ATTR(tuple_=_,builtin=false,tailCall=_)), _, _, _, _)
equation
//s1 = ExpressionDump.printExpStr(e);
//print("\nExp-CALL\n build-funcs force-inline: " +& s1);
failure(BackendDAE.DIFF_FULL_JACOBIAN() = inDiffType);
(e,_,true) = Inline.forceInlineExp(inExp,(SOME(inFunctionTree),{DAE.NORM_INLINE(),DAE.NO_INLINE()}),DAE.emptyElementSource);
e = Expression.addNoEventToRelations(e);
(e, functions) = differentiateExp(e, inDiffwrtCref, inInputData, inDiffType, inFunctionTree);
Expand Down

0 comments on commit 27d7cb7

Please sign in to comment.