Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
Always apply tearing if MAX_SIZE > 0 and dense matrices are used
Browse files Browse the repository at this point in the history
See ticket:4751.
Tearing can be disabled with --maxSizeNon/LinearTearing=0

Belonging to [master]:
  - #2176
  • Loading branch information
rfranke authored and OpenModelica-Hudson committed Feb 7, 2018
1 parent 70ef32b commit cce5d83
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Compiler/BackEnd/Tearing.mo
Expand Up @@ -311,7 +311,11 @@ algorithm
case ((BackendDAE.EQUATIONSYSTEM(eqns=eindex, vars=vindx, jac=BackendDAE.FULL_JACOBIAN(ojac), jacType=jacType, mixedSystem=mixedSystem)), _, _, _) equation
true = BackendDAEUtil.getLinearfromJacType(jacType);
maxSize = Flags.getConfigInt(Flags.MAX_SIZE_LINEAR_TEARING);
if intGt(listLength(vindx),maxSize) then
if intGt(listLength(vindx), maxSize) and not
// always apply tearing if maxSize > 0 and dense matrices are used
(intGt(maxSize, 0) and stringEqual(Config.simCodeTarget(), "Cpp") and
stringEqual(Flags.getConfigString(Flags.MATRIX_FORMAT), "dense"))
then
Error.addMessage(Error.MAX_TEARING_SIZE, {intString(strongComponentIndexOut), intString(listLength(vindx)),"linear",intString(maxSize)});
fail();
end if;
Expand All @@ -325,8 +329,6 @@ algorithm
if debugFlag then
print("\nTearing of LINEAR component\nUse Flag '-d=tearingdumpV' and '-d=iterationVars' for more details\n\n");
end if;
// TODO: Remove when cpp runtime ready for doLinearTearing
//false = stringEqual(Config.simCodeTarget(), "Cpp");
if Flags.isSet(Flags.TEARING_DUMPVERBOSE) then
print("Jacobian:\n" + BackendDump.dumpJacobianStr(ojac) + "\n\n");
end if;
Expand All @@ -338,7 +340,11 @@ algorithm
case ((BackendDAE.EQUATIONSYSTEM(eqns=eindex, vars=vindx, jac=BackendDAE.FULL_JACOBIAN(ojac), jacType=jacType, mixedSystem=mixedSystem)), _, _, _) equation
false = BackendDAEUtil.getLinearfromJacType(jacType);
maxSize = Flags.getConfigInt(Flags.MAX_SIZE_NONLINEAR_TEARING);
if intGt(listLength(vindx),maxSize) then
if intGt(listLength(vindx), maxSize) and not
// always apply tearing if maxSize > 0 and dense matrices are used
(intGt(maxSize, 0) and stringEqual(Config.simCodeTarget(), "Cpp") and
stringEqual(Flags.getConfigString(Flags.MATRIX_FORMAT), "dense"))
then
Error.addMessage(Error.MAX_TEARING_SIZE, {intString(strongComponentIndexOut), intString(listLength(vindx)),"nonlinear",intString(maxSize)});
fail();
end if;
Expand Down

0 comments on commit cce5d83

Please sign in to comment.