Skip to content

Commit

Permalink
- added function: BackendDAEUtil.replaceKnownVarsInShared
Browse files Browse the repository at this point in the history
- extended Expression.getComplexContents for ASUB and cref defined arrays
- extended ExpressionDump.dumpExpStr for ASUB BOX and UNBOX

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@20407 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Volker Waurich committed May 6, 2014
1 parent 2568dd3 commit 9d1a1fa
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
25 changes: 25 additions & 0 deletions Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -5640,6 +5640,31 @@ algorithm
end matchcontinue;
end replaceVartraverser;

public function replaceKnownVarsInShared"replaces the knownVars in the BackendDAE.Shared
author:Waurich TUD 2014-04"
input BackendDAE.Shared sharedIn;
input BackendDAE.Variables knVars;
output BackendDAE.Shared sharedOut;
protected
BackendDAE.Variables knownVars,externalObjects,aliasVars;
BackendDAE.EquationArray initialEqs,removedEqs;
list<DAE.Constraint> constraints;
list<DAE.ClassAttributes> classAttrs;
Env.Cache cache;
Env.Env env;
DAE.FunctionTree functionTree;
BackendDAE.EventInfo eventInfo;
BackendDAE.ExternalObjectClasses extObjClasses;
BackendDAE.BackendDAEType backendDAEType;
BackendDAE.SymbolicJacobians symjacs;
BackendDAE.ExtraInfo info;
algorithm
BackendDAE.SHARED(knownVars=knownVars,externalObjects=externalObjects,aliasVars=aliasVars,initialEqs=initialEqs,removedEqs=removedEqs,
constraints=constraints,classAttrs=classAttrs,cache=cache,env=env,functionTree=functionTree,eventInfo=eventInfo,extObjClasses=extObjClasses,
backendDAEType=backendDAEType,symjacs=symjacs,info=info) := sharedIn;
sharedOut := BackendDAE.SHARED(knVars,externalObjects,aliasVars,initialEqs,removedEqs, constraints,classAttrs,cache,env,functionTree,eventInfo,extObjClasses,backendDAEType,symjacs,info);
end replaceKnownVarsInShared;

protected function adjacencyRowExpEnhanced
"author: Frenkel TUD 2012-05
Helper function to adjacencyRowEnhanced, investigates expressions for
Expand Down
19 changes: 18 additions & 1 deletion Compiler/FrontEnd/Expression.mo
Expand Up @@ -1572,17 +1572,29 @@ author:Waurich TUD 2014-04"
algorithm
es := match(e)
local
Boolean noArr;
DAE.ComponentRef cref;
DAE.Exp exp;
list<DAE.Exp> expLst;
list<DAE.ComponentRef> crefs;
case(DAE.CREF(componentRef=cref,ty=_))
equation
expLst = arrayElements(e);
noArr = listLength(expLst)==1;
exp = List.first(expLst);
noArr = noArr and expEqual(exp,e);
expLst = Util.if_(noArr,{},expLst);
then
expLst;
case(DAE.CALL(path=_,expLst=expLst,attr=_))
then
expLst;
case(DAE.RECORD(path=_,exps=expLst, comp=_,ty=_))
then
expLst;
case(DAE.ARRAY(ty=_,scalar=_,array=expLst))
case(DAE.ARRAY(ty=_,scalar=_,array=_))
equation
expLst = arrayElements(e);
then
expLst;
case(DAE.TUPLE(PR=expLst))
Expand All @@ -1593,6 +1605,11 @@ algorithm
expLst = getComplexContents(exp);
then
expLst;
case(DAE.ASUB(exp=exp,sub=_))
equation
expLst = getComplexContents(exp);
then
expLst;
else
equation
then
Expand Down
27 changes: 27 additions & 0 deletions Compiler/FrontEnd/ExpressionDump.mo
Expand Up @@ -1442,6 +1442,15 @@ algorithm
then
res_str;

case (DAE.ASUB(exp = e,sub = _),level)
equation
gen_str = genStringNTime(" |", level);
new_level1 = level + 1;
ct = dumpExpStr(e, new_level1);
res_str = stringAppendList({gen_str,"ASUB ","\n",ct,""});
then
res_str;

case (DAE.SIZE(exp = cr,sz = SOME(dim)),level)
equation
gen_str = genStringNTime(" |", level);
Expand Down Expand Up @@ -1485,6 +1494,24 @@ algorithm
then
res_str;

case (DAE.BOX(exp=e),level)
equation
gen_str = genStringNTime(" |", level);
new_level1 = level + 1;
ct = dumpExpStr(e, new_level1);
res_str = stringAppendList({gen_str,"BOX ","\n",ct,""});
then
res_str;

case (DAE.UNBOX(exp=e,ty=_),level)
equation
gen_str = genStringNTime(" |", level);
new_level1 = level + 1;
ct = dumpExpStr(e, new_level1);
res_str = stringAppendList({gen_str,"UNBOX ","\n",ct,""});
then
res_str;

case (_,level)
equation
gen_str = genStringNTime(" |", level);
Expand Down

0 comments on commit 9d1a1fa

Please sign in to comment.