Skip to content

Commit

Permalink
- add flag to run OnRelaxation
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14897 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Jan 23, 2013
1 parent 90674b3 commit d7ec12f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 10 additions & 1 deletion Compiler/BackEnd/OnRelaxation.mo
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ protected import Derive;
protected import Expression;
protected import ExpressionDump;
protected import ExpressionSimplify;
protected import Flags;
protected import HashSet;
protected import HashTable4;
protected import IndexReduction;
Expand All @@ -73,7 +74,15 @@ public function relaxSystem
input BackendDAE.BackendDAE inDAE;
output BackendDAE.BackendDAE outDAE;
algorithm
(outDAE,_) := BackendDAEUtil.mapEqSystemAndFold(inDAE,relaxSystem0,false);
outDAE := matchcontinue(inDAE)
case (_)
equation
true = Flags.isSet(Flags.ON_RELAXATION);
(outDAE,_) = BackendDAEUtil.mapEqSystemAndFold(inDAE, relaxSystem0, false);
then
outDAE;
else then inDAE;
end matchcontinue;
end relaxSystem;

protected function relaxSystem0
Expand Down
8 changes: 5 additions & 3 deletions Compiler/Util/Flags.mo
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,8 @@ constant DebugFlag DUMP_INLINE_SOLVER = DEBUG_FLAG(114, "dumpInlineSolver",
Util.gettext("dumps the inline solver equation system"));
constant DebugFlag DUMP_ENCAPSULATEWHENCONDITIONS = DEBUG_FLAG(115, "dumpEncapsulateWhenConditions",
Util.gettext("Dumps the results of the preOptModule encapsulateWhenConditions"));
constant DebugFlag ON_RELAXATION = DEBUG_FLAG(116, "onRelaxation",
Util.gettext("perform O(n) Relaxation"));

// 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 @@ -515,7 +517,8 @@ constant list<DebugFlag> allDebugFlags = {
NLS_ANALYTIC_JACOBIAN,
INLINE_SOLVER,
DUMP_INLINE_SOLVER,
DUMP_ENCAPSULATEWHENCONDITIONS
DUMP_ENCAPSULATEWHENCONDITIONS,
ON_RELAXATION
};

// CONFIGURATION FLAGS
Expand Down Expand Up @@ -628,7 +631,7 @@ constant ConfigFlag INDEX_REDUCTION_METHOD = CONFIG_FLAG(15, "indexReductionMeth
Util.gettext("Sets the index reduction method to use. See +help=optmodules for more info."));
constant ConfigFlag POST_OPT_MODULES = CONFIG_FLAG(16, "postOptModules",
NONE(), EXTERNAL(), STRING_LIST_FLAG({
// "relaxSystem",
"relaxSystem",
"removeFinalParameters",
"removeevaluateParameters",
"inlineArrayEqn",
Expand All @@ -643,7 +646,6 @@ constant ConfigFlag POST_OPT_MODULES = CONFIG_FLAG(16, "postOptModules",
"detectJacobianSparsePattern",
// "generateSymbolicJacobian",
"removeConstants"
// "optimizeInitialSystem"
// "partitionIndependentBlocks"
}),
SOME(STRING_DESC_OPTION({
Expand Down

0 comments on commit d7ec12f

Please sign in to comment.