Skip to content

Commit

Permalink
- test new interface for index reduction
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@12370 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Jul 30, 2012
1 parent cd759d1 commit 97174c4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -8260,8 +8260,8 @@ algorithm
(optdae,Util.SUCCESS()) := preoptimiseDAE(inDAE,preOptModules);

// transformation phase (matching and sorting using a index reduction method
sode := transformDAE(optdae,NONE(),matchingAlgorithm,daeHandler);
//sode := reduceIndexDAE(optdae,NONE(),matchingAlgorithm,daeHandler);
//sode := transformDAE(optdae,NONE(),matchingAlgorithm,daeHandler);
sode := reduceIndexDAE(optdae,NONE(),matchingAlgorithm,daeHandler);
Debug.fcall(Flags.BLT_DUMP, BackendDump.bltdump, ("bltdump",sode));

// past optimisation phase
Expand Down Expand Up @@ -8346,8 +8346,8 @@ protected
algorithm
matchingAlgorithm := getMatchingAlgorithm(strmatchingAlgorithm);
indexReductionMethod := getIndexReductionMethod(strindexReductionMethod);
outDAE := transformDAE(inDAE,inMatchingOptions,matchingAlgorithm,indexReductionMethod);
//outDAE := reduceIndexDAE(inDAE,inMatchingOptions,matchingAlgorithm,indexReductionMethod);
//outDAE := transformDAE(inDAE,inMatchingOptions,matchingAlgorithm,indexReductionMethod);
outDAE := reduceIndexDAE(inDAE,inMatchingOptions,matchingAlgorithm,indexReductionMethod);
end transformBackendDAE;

public function transformDAE
Expand Down Expand Up @@ -8702,8 +8702,8 @@ algorithm
BackendDAE.BackendDAE sode;
case (true,_,_,_)
equation
sode = transformDAE(inDAE,NONE(),matchingAlgorithm,daeHandler);
//sode = reduceIndexDAE(inDAE,NONE(),matchingAlgorithm,daeHandler);
//sode = transformDAE(inDAE,NONE(),matchingAlgorithm,daeHandler);
sode = reduceIndexDAE(inDAE,NONE(),matchingAlgorithm,daeHandler);
Debug.fcall(Flags.BLT_DUMP, BackendDump.bltdump, ("bltdump",sode));
then sode;
case (false,_,_,_)
Expand Down Expand Up @@ -8799,8 +8799,8 @@ algorithm
(optdae,Util.SUCCESS()) := preoptimiseDAE(inDAE,preOptModules);

// transformation phase (matching and sorting using a index reduction method
sode := transformDAE(optdae,NONE(),matchingAlgorithm,daeHandler);
//sode := reduceIndexDAE(optdae,NONE(),matchingAlgorithm,daeHandler);
//sode := transformDAE(optdae,NONE(),matchingAlgorithm,daeHandler);
sode := reduceIndexDAE(optdae,NONE(),matchingAlgorithm,daeHandler);
Debug.fcall(Flags.DUMP_DAE_LOW, BackendDump.bltdump, ("bltdump",sode));

// past optimisation phase
Expand Down
27 changes: 27 additions & 0 deletions Compiler/BackEnd/BackendDump.mo
Expand Up @@ -1423,6 +1423,9 @@ algorithm
print(str);
print(":");
dumpKind(kind);
print(" ");
dumpFlow(flowPrefix);
print(" ");
dumpAttributes(dae_var_attr);
paths = DAEUtil.getElementSourceTypes(source);
paths_lst = List.map(paths, Absyn.pathString);
Expand Down Expand Up @@ -1472,6 +1475,9 @@ algorithm
print(str);
print(":");
dumpKind(kind);
print(" ");
dumpFlow(flowPrefix);
print(" ");
dumpAttributes(dae_var_attr);
print(path_str);
indx_str = intString(indx) "print \" former: \" & print old_name &" ;
Expand Down Expand Up @@ -1521,6 +1527,17 @@ algorithm
end match;
end dumpKind;

public function dumpFlow
input DAE.Flow flowPrefix;
algorithm
_:=
match(flowPrefix)
case DAE.FLOW() equation print("flow=true"); then ();
case DAE.NON_FLOW() equation print("flow=false"); then ();
case DAE.NON_CONNECTOR() equation print(""); then ();
end match;
end dumpFlow;

public function dumpAttributes
"function: dumpAttributes
Helper function to dump."
Expand All @@ -1534,6 +1551,8 @@ algorithm
Option<Boolean> isProtected,finalPrefix;
Option<DAE.Distribution> dist;
case NONE() then ();
case SOME(DAE.VAR_ATTR_REAL(min=(NONE(),NONE()),initial_=NONE(),fixed=NONE(),nominal=NONE(),isProtected=NONE(),finalPrefix=NONE(),distributionOption=NONE()))
then ();
case SOME(DAE.VAR_ATTR_REAL(min=(min,max),initial_=start,fixed=fixed,nominal=nominal,isProtected=isProtected,finalPrefix=finalPrefix,distributionOption=dist))
equation
print("(");
Expand All @@ -1547,6 +1566,8 @@ algorithm
dumpOptDistribution(dist);
print(") ");
then ();
case SOME(DAE.VAR_ATTR_INT(min=(NONE(),NONE()),initial_=NONE(),fixed=NONE(),isProtected=NONE(),finalPrefix=NONE(),distributionOption=NONE()))
then ();
case SOME(DAE.VAR_ATTR_INT(min=(min,max),initial_=start,fixed=fixed,isProtected=isProtected,finalPrefix=finalPrefix,distributionOption=dist))
equation
print("(");
Expand All @@ -1559,6 +1580,8 @@ algorithm
dumpOptDistribution(dist);
print(") ");
then ();
case SOME(DAE.VAR_ATTR_BOOL(initial_=NONE(),fixed=NONE(),isProtected=NONE(),finalPrefix=NONE()))
then ();
case SOME(DAE.VAR_ATTR_BOOL(initial_=start,fixed=fixed,isProtected=isProtected,finalPrefix=finalPrefix))
equation
print("(");
Expand All @@ -1568,6 +1591,8 @@ algorithm
dumpOptBoolean(finalPrefix,"final");
print(") ");
then ();
case SOME(DAE.VAR_ATTR_STRING(initial_=NONE(),isProtected=NONE(),finalPrefix=NONE()))
then ();
case SOME(DAE.VAR_ATTR_STRING(initial_=start,isProtected=isProtected,finalPrefix=finalPrefix))
equation
print("(");
Expand All @@ -1576,6 +1601,8 @@ algorithm
dumpOptBoolean(finalPrefix,"final");
print(") ");
then ();
case SOME(DAE.VAR_ATTR_ENUMERATION(min=(NONE(),NONE()),start=NONE(),fixed=NONE(),isProtected=NONE(),finalPrefix=NONE()))
then ();
case SOME(DAE.VAR_ATTR_ENUMERATION(min=(min,max),start=start,fixed=fixed,isProtected=isProtected,finalPrefix=finalPrefix))
equation
print("(");
Expand Down

0 comments on commit 97174c4

Please sign in to comment.