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

Commit 7827a66

Browse files
vwaurichOpenModelica-Hudson
authored andcommitted
new subclock partitioning implementation with new partition adjacency matrix
1 parent 95cea6e commit 7827a66

File tree

6 files changed

+1057
-302
lines changed

6 files changed

+1057
-302
lines changed

Compiler/BackEnd/BackendDAE.mo

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ public uniontype SubClock
8888
MMath.Rational shift;
8989
Option<String> solver;
9090
end SUBCLOCK;
91+
record INFERED_SUBCLOCK
92+
end INFERED_SUBCLOCK;
9193
end SubClock;
9294

9395
public constant SubClock DEFAULT_SUBCLOCK = SUBCLOCK(MMath.RAT1, MMath.RAT0, NONE());

Compiler/BackEnd/BackendDAEOptimize.mo

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,7 +1626,7 @@ algorithm
16261626
(systs,oshared) := matchcontinue (isyst,ishared,numErrorMessages,throwNoError)
16271627
local
16281628
BackendDAE.IncidenceMatrix m, mT, rm, rmT;
1629-
array<Integer> ixs, rixs;
1629+
array<Integer> eqPartMap, varPartMap, rixs;
16301630
array<Boolean> vars, rvars;
16311631
Boolean b;
16321632
Integer i;
@@ -1638,20 +1638,22 @@ algorithm
16381638
funcs = BackendDAEUtil.getFunctions(ishared);
16391639
(syst, m, mT) = BackendDAEUtil.getIncidenceMatrixfromOption(syst, BackendDAE.NORMAL(), SOME(funcs));
16401640
(rm, rmT) = BackendDAEUtil.removedIncidenceMatrix(syst, BackendDAE.NORMAL(), SOME(funcs));
1641-
ixs = arrayCreate(arrayLength(m), 0);
1641+
eqPartMap = arrayCreate(arrayLength(m), 0);
1642+
varPartMap = arrayCreate(arrayLength(mT), 0);
16421643
rixs = arrayCreate(arrayLength(rm), 0);
16431644
vars = arrayCreate(arrayLength(mT), false);
16441645
rvars = arrayCreate(arrayLength(rmT), false);
16451646
// ixsT = arrayCreate(arrayLength(mT),0);
1646-
i = SynchronousFeatures.partitionIndependentBlocks0(m, mT, rm, rmT, ixs, rixs, vars, rvars);
1647+
i = SynchronousFeatures.partitionIndependentBlocks0(m, mT, rm, rmT, eqPartMap, varPartMap, rixs, vars, rvars);
16471648
// i2 = SynchronousFeatures.partitionIndependentBlocks0(mT,m,ixsT);
16481649
b = i > 1;
16491650
// bcall2(b,BackendDump.dumpBackendDAE,BackendDAE.DAE({syst},shared), "partitionIndependentBlocksHelper");
16501651
// printPartition(b,ixs);
1651-
systs = if b then SynchronousFeatures.partitionIndependentBlocksSplitBlocks(i, syst, ixs, rixs, mT, rmT, throwNoError) else {syst};
1652+
systs = if b then SynchronousFeatures.partitionIndependentBlocksSplitBlocks(i, syst, eqPartMap, rixs, mT, rmT, throwNoError) else {syst};
16521653
// print("Number of partitioned systems: " + intString(listLength(systs)) + "\n");
16531654
// List.map1_0(systs, BackendDump.dumpEqSystem, "System");
1654-
GC.free(ixs);
1655+
GC.free(eqPartMap);
1656+
GC.free(varPartMap);
16551657
GC.free(rixs);
16561658
then (systs,shared);
16571659
else

Compiler/BackEnd/BackendDump.mo

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -313,17 +313,24 @@ end printSubPartitions;
313313
public function subClockString
314314
input BackendDAE.SubClock subClock;
315315
output String subClockString;
316-
protected
317-
String factorStr, shiftStr, solverStr;
318316
algorithm
319-
factorStr := "factor(" + MMath.rationalString(subClock.factor) + ")";
320-
shiftStr := "shift(" + MMath.rationalString(subClock.shift) + ")";
321-
solverStr := "solver(" + optionString(subClock.solver) + ")";
322-
if stringLength(solverStr) > 8 then
323-
subClockString := factorStr + " " + shiftStr + " " + solverStr;
324-
else
325-
subClockString := factorStr + " " + shiftStr + " ";
326-
end if;
317+
subClockString := match(subClock)
318+
local
319+
String factorStr, shiftStr, solverStr;
320+
case(BackendDAE.INFERED_SUBCLOCK())
321+
then "INFERED_SUBCLOCK";
322+
case(BackendDAE.SUBCLOCK(_))
323+
algorithm
324+
factorStr := "factor(" + MMath.rationalString(subClock.factor) + ")";
325+
shiftStr := "shift(" + MMath.rationalString(subClock.shift) + ")";
326+
solverStr := "solver(" + optionString(subClock.solver) + ")";
327+
if stringLength(solverStr) > 8 then
328+
subClockString := factorStr + " " + shiftStr + " " + solverStr;
329+
else
330+
subClockString := factorStr + " " + shiftStr + " ";
331+
end if;
332+
then subClockString;
333+
end match;
327334
end subClockString;
328335

329336
public function optionString

0 commit comments

Comments
 (0)