Skip to content

Commit

Permalink
- added flag to set tolerance for reshuffle algorithm +reshuffle=0/1/2/3
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@22407 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Volker Waurich committed Sep 23, 2014
1 parent cfa38aa commit 9f2caf5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Compiler/BackEnd/ResolveLoops.mo
Expand Up @@ -1167,6 +1167,7 @@ protected function evaluateLoop
input tuple<BackendDAE.IncidenceMatrix,BackendDAE.IncidenceMatrixT,list<Integer>> tplIn;
output Boolean resolve;
protected
Boolean r1,r2;
Integer numInLoop,numOutLoop;
list<Integer> nonLoopEqs,nonLoopVars,loopEqs, loopVars, allVars, eqCrossLst;
list<list<Integer>> eqVars;
Expand All @@ -1185,7 +1186,11 @@ algorithm
(eqCrossLst,_,_) := List.intersection1OnTrue(loopVars,eqCrossLst,intEq);
numInLoop := listLength(loopVars);
numOutLoop := listLength(nonLoopVars);
resolve := intGe(numInLoop,numOutLoop-1) and intLe(numInLoop,6);
r1 := intGe(numInLoop,numOutLoop-1) and intLe(numInLoop,6);
r2 := intGe(numInLoop,numOutLoop-2);
r1 := Util.if_(intEq(Flags.getConfigInt(Flags.RESHUFFLE),1),r1,false);
r2 := Util.if_(intEq(Flags.getConfigInt(Flags.RESHUFFLE),2),r2,r1);
resolve := Util.if_(intEq(Flags.getConfigInt(Flags.RESHUFFLE),3),true,r2);
end evaluateLoop;

protected function sumUp2Equations "author:Waurich TUD 2013-12
Expand Down
8 changes: 7 additions & 1 deletion Compiler/Util/Flags.mo
Expand Up @@ -895,6 +895,11 @@ constant ConfigFlag PROFILING_LEVEL = CONFIG_FLAG(57, "profiling",
})),
Util.gettext("Sets the profiling level to use. Profiled equations and functions record execution time and count for each time step taken by the integrator."));

constant ConfigFlag RESHUFFLE = CONFIG_FLAG(58, "reshuffle",
NONE(), EXTERNAL(), INT_FLAG(1), NONE(),
Util.gettext("sets tolerance of reshuffling algorithm: 1: conservative, 2: more tolerant, 3 resolve all"));


// This is a list of all configuration flags. A flag can not be used unless it's
// in this list, and the list is checked at initialization so that all flags are
// sorted by index (and thus have unique indices).
Expand Down Expand Up @@ -955,7 +960,8 @@ constant list<ConfigFlag> allConfigFlags = {
GENERATE_SYMBOLIC_JACOBIAN,
GENERATE_SYMBOLIC_LINEARIZATION,
INT_ENUM_CONVERSION,
PROFILING_LEVEL
PROFILING_LEVEL,
RESHUFFLE
};

public function new
Expand Down

0 comments on commit 9f2caf5

Please sign in to comment.