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

Commit 708e996

Browse files
sjoelundOpenModelica-Hudson
authored andcommitted
Update debugging code
Belonging to [master]: - #2099 - OpenModelica/OpenModelica-testsuite#815
1 parent f16fbfd commit 708e996

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

Compiler/BackEnd/Initialization.mo

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,7 @@ protected
13051305
array<Integer> mapIncRowEqn;
13061306
Boolean perfectMatching;
13071307
Integer maxMixedDeterminedIndex = intMax(0, Flags.getConfigInt(Flags.MAX_MIXED_DETERMINED_INDEX));
1308+
constant Boolean debug = false;
13081309
algorithm
13091310
for index in 0:maxMixedDeterminedIndex loop
13101311
//print("index-" + intString(index) + " start\n");
@@ -1315,22 +1316,24 @@ algorithm
13151316
syst := BackendDAEUtil.createEqSystem(inEqSystem.orderedVars, inEqSystem.orderedEqs);
13161317
funcs := BackendDAEUtil.getFunctions(inShared);
13171318
(m_, _, _, mapIncRowEqn) := BackendDAEUtil.incidenceMatrixScalar(syst, BackendDAE.SOLVABLE(), SOME(funcs));
1318-
//BackendDump.dumpEqSystem(syst, "fixInitialSystem");
1319-
//BackendDump.dumpVariables(initVars, "selected initialization variables");
1320-
//BackendDump.dumpVariables(inEqSystem.orderedVars, "vars in the system");
1321-
//BackendDump.dumpIncidenceMatrix(m_);
1319+
if debug then
1320+
BackendDump.dumpEqSystem(syst, "fixInitialSystem");
1321+
BackendDump.dumpVariables(initVars, "selected initialization variables");
1322+
BackendDump.dumpVariables(inEqSystem.orderedVars, "vars in the system");
1323+
BackendDump.dumpIncidenceMatrix(m_);
1324+
end if;
13221325

13231326
// get state-index list
13241327
stateIndices := BackendVariable.getVarIndexFromVariablesIndexInFirstSet(inEqSystem.orderedVars, initVars);
13251328

13261329
// modify incidence matrix for under-determined systems
13271330
nAddEqs := intMax(nVars-nEqns + index, index);
1328-
//print("nAddEqs: " + intString(nAddEqs) + "\n");
1331+
if debug then print("nAddEqs: " + intString(nAddEqs) + "\n"); end if;
13291332
m := fixUnderDeterminedSystem(m_, stateIndices, nEqns, nAddEqs);
13301333

13311334
// modify incidence matrix for over-determined systems
13321335
nAddVars := intMax(nEqns-nVars + index, index);
1333-
//print("nAddVars: " + intString(nAddVars) + "\n");
1336+
if debug then print("nAddVars: " + intString(nAddVars) + "\n"); end if;
13341337
m := fixOverDeterminedSystem(m, inEqSystem.orderedEqs, nVars, nAddVars);
13351338

13361339
// match the system (nVars+nAddVars == nEqns+nAddEqs)
@@ -1341,8 +1344,10 @@ algorithm
13411344
//BackendDAEEXT.getAssignment(ass2, ass1);
13421345
//perfectMatching := listEmpty(Matching.getUnassigned(nVars+nAddVars, ass1, {}));
13431346
(ass1, ass2, perfectMatching) := Matching.RegularMatching(m, nVars+nAddVars, nEqns+nAddEqs);
1344-
//BackendDump.dumpMatchingVars(ass1);
1345-
//BackendDump.dumpMatchingEqns(ass2);
1347+
if debug then
1348+
BackendDump.dumpMatchingVars(ass1);
1349+
BackendDump.dumpMatchingEqns(ass2);
1350+
end if;
13461351

13471352
// check whether or not a complete matching was found
13481353
if perfectMatching then
@@ -1388,7 +1393,9 @@ algorithm
13881393
//execStat("fixInitialSystem (initialization) [nEqns: " + intString(nEqns) + ", nAddEqs: " + intString(nAddEqs) + ", nAddVars: " + intString(nAddVars) + "]");
13891394
return;
13901395
end if;
1391-
//print("index-" + intString(index) + " ende\n");
1396+
if debug then
1397+
print("index-" + intString(index) + " ende\n");
1398+
end if;
13921399
end for;
13931400
Error.addMessage(Error.MIXED_DETERMINED, {intString(maxMixedDeterminedIndex)});
13941401
fail();

0 commit comments

Comments
 (0)