Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new debug flag combineSubscripts
- Add new debug flag combineSubscripts that when used together with newInst moves all subscripts to the end of component references.
- Loading branch information
Showing
10 changed files
with
157 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
testsuite/flattening/modelica/scodeinst/CombineSubscripts1.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// name: CombineSubscripts1 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst,-nfScalarize,combineSubscripts | ||
// | ||
|
||
model B | ||
Real[10] c; | ||
end B; | ||
|
||
model CombineSubscripts1 | ||
B[100] b; | ||
equation | ||
for i in 1:100 loop | ||
b[i].c[10] = 2; | ||
end for; | ||
end CombineSubscripts1; | ||
|
||
// Result: | ||
// class CombineSubscripts1 | ||
// Real[100, 10] b.c; | ||
// equation | ||
// for i in 1:100 loop | ||
// b.c[i,10] = 2.0; | ||
// end for; | ||
// end CombineSubscripts1; | ||
// endResult |
41 changes: 41 additions & 0 deletions
41
testsuite/flattening/modelica/scodeinst/CombineSubscripts2.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// name: CombineSubscripts2 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst,-nfScalarize,combineSubscripts | ||
// | ||
|
||
record A | ||
Real[4] a; | ||
end A; | ||
|
||
model CombineSubscripts2 | ||
A[3] b; | ||
equation | ||
for i in 1:4 loop | ||
b[3].a[i] = 1; | ||
end for; | ||
|
||
for i in 1:4 loop | ||
b.a[i] = {1, 2, 3}; | ||
end for; | ||
|
||
for i in 1:3 loop | ||
b[i].a = {1, 2, 3, 4}; | ||
end for; | ||
end CombineSubscripts2; | ||
|
||
// Result: | ||
// class CombineSubscripts2 | ||
// Real[3, 4] b.a; | ||
// equation | ||
// for i in 1:4 loop | ||
// b.a[3,i] = 1.0; | ||
// end for; | ||
// for i in 1:4 loop | ||
// b.a[i] = {1.0, 2.0, 3.0}; | ||
// end for; | ||
// for i in 1:3 loop | ||
// b.a[i,:] = {1.0, 2.0, 3.0, 4.0}; | ||
// end for; | ||
// end CombineSubscripts2; | ||
// endResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters