Skip to content

Commit

Permalink
fix: allow numeric ranges in subscript range definitions (#375)
Browse files Browse the repository at this point in the history
Fixes #318
  • Loading branch information
ToddFincannonEI authored Oct 18, 2023
1 parent a032779 commit da13dc4
Show file tree
Hide file tree
Showing 8 changed files with 287 additions and 72 deletions.
20 changes: 20 additions & 0 deletions models/subscript/subscript.dat
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,25 @@ SAVEPER
1 1
Selected A
0 2
t[C1]
0 1
t[C2]
0 1
t[C3]
0 1
t[C4]
0 1
t[C5]
0 1
TIME STEP
0 1
u[C1]
0 1
u[C2]
0 2
u[C3]
0 3
u[C4]
0 4
u[C5]
0 5
94 changes: 54 additions & 40 deletions models/subscript/subscript.mdl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ DimA: A1, A2, A3 ~~|

DimB: B1, B2, B3 -> DimA ~~|

DimC: C1, (C2-C4), C5 ~~|

b[DimB] = 1, 2, 3 ~~|

a[DimA] = b[DimB] ~~~:SUPPLEMENTARY|
Expand Down Expand Up @@ -39,6 +41,18 @@ s[DimA] = DimB
~:SUPPLEMENTARY
|

t[DimC] = 1
~
~ subscript range with an embedded numeric range
~:SUPPLEMENTARY
|

u[C1] = 1 ~~~:SUPPLEMENTARY|
u[C2] = 2 ~~~:SUPPLEMENTARY|
u[C3] = 3 ~~~:SUPPLEMENTARY|
u[C4] = 4 ~~~:SUPPLEMENTARY|
u[C5] = 5 ~~~:SUPPLEMENTARY|

********************************************************
.Control
********************************************************~
Expand Down Expand Up @@ -71,43 +85,43 @@ V300 Do not put anything below this section - it will be ignored
*View 1
$192-192-192,0,Times New Roman|12||0-0-0|0-0-0|0-0-255|-1--1--1|-1--1--1|96,96,100,0
///---\\\
:L<%^E!@
1:subscript.vdfx
9:subscript
15:0,0,0,0,0,0
19:100,0
27:2,
34:0,
4:Time
5:p[DimB,DimA]
76:0
77:0
78:0
79:0
80:0
81:0
24:0
25:1
26:1
57:1
54:0
55:0
59:0
56:0
58:0
71:0
44:65001
46:0
45:0
49:0
50:0
51:
52:
53:
43:subscript
47:subscript
48:
75:
43:subscript
6:A1
6:B1
:L<%^E!@
1:subscript.vdfx
9:subscript
15:0,0,0,0,0,0
19:100,0
27:2,
34:0,
4:Time
5:p[DimB,DimA]
76:0
77:0
78:0
79:0
80:0
81:0
24:0
25:1
26:1
57:1
54:0
55:0
59:0
56:0
58:0
71:0
44:65001
46:0
45:0
49:0
50:0
51:
52:
53:
43:subscript
47:subscript
48:
75:
43:subscript
6:A1
6:B1
Binary file removed models/subscript/subscript.vdfx
Binary file not shown.
69 changes: 69 additions & 0 deletions models/subscript/subscript_subs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
_dima:
{
modelName: 'DimA',
modelValue: [ 'A1', 'A2', 'A3' ],
modelMappings: [],
name: '_dima',
value: [ '_a1', '_a2', '_a3' ],
size: 3,
family: '_dima',
mappings: {}
}

_dimb:
{
modelName: 'DimB',
modelValue: [ 'B1', 'B2', 'B3' ],
modelMappings: [ { toDim: 'DimA', value: [] } ],
name: '_dimb',
value: [ '_b1', '_b2', '_b3' ],
size: 3,
family: '_dimb',
mappings: { _dima: [ '_b1', '_b2', '_b3' ] }
}

_dimc:
{
modelName: 'DimC',
modelValue: [ 'C1', 'C2', 'C3', 'C4', 'C5' ],
modelMappings: [],
name: '_dimc',
value: [ '_c1', '_c2', '_c3', '_c4', '_c5' ],
size: 5,
family: '_dimc',
mappings: {}
}

_a1:
{ name: '_a1', value: 0, size: 1, family: '_dima', mappings: {} }

_a2:
{ name: '_a2', value: 1, size: 1, family: '_dima', mappings: {} }

_a3:
{ name: '_a3', value: 2, size: 1, family: '_dima', mappings: {} }

_b1:
{ name: '_b1', value: 0, size: 1, family: '_dimb', mappings: {} }

_b2:
{ name: '_b2', value: 1, size: 1, family: '_dimb', mappings: {} }

_b3:
{ name: '_b3', value: 2, size: 1, family: '_dimb', mappings: {} }

_c1:
{ name: '_c1', value: 0, size: 1, family: '_dimc', mappings: {} }

_c2:
{ name: '_c2', value: 1, size: 1, family: '_dimc', mappings: {} }

_c3:
{ name: '_c3', value: 2, size: 1, family: '_dimc', mappings: {} }

_c4:
{ name: '_c4', value: 3, size: 1, family: '_dimc', mappings: {} }

_c5:
{ name: '_c5', value: 4, size: 1, family: '_dimc', mappings: {} }

Loading

0 comments on commit da13dc4

Please sign in to comment.