Skip to content

Commit

Permalink
Processing of fill(val,dims) with parametric dimensions in the case o…
Browse files Browse the repository at this point in the history
…f non-expanded arrays.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7906 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Alexey Lebedev committed Feb 11, 2011
1 parent 7186372 commit 5b166cb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Compiler/FrontEnd/Inst.mo
Expand Up @@ -2299,6 +2299,7 @@ algorithm
then v::varLst;
case(cache,env,DAE.MOD(f,e,DAE.NAMEMOD("max",DAE.MOD(_,_,_,SOME(DAE.TYPED(exp,optVal,p,_))))::submods,eqmod),pre,ty)
equation
true = RTOpts.splitArrays();
varLst = instRealClass(cache,env,DAE.MOD(f,e,submods,eqmod),pre,ty);
v = instBuiltinAttribute(cache,env,"max",optVal,exp,DAE.T_REAL_DEFAULT,p);
then v::varLst;
Expand All @@ -2311,6 +2312,7 @@ algorithm
then v::varLst;
case(cache,env,DAE.MOD(f,e,DAE.NAMEMOD("start",DAE.MOD(_,_,_,SOME(DAE.TYPED(exp,optVal,p,_))))::submods,eqmod),pre,ty)
equation
true = RTOpts.splitArrays();
varLst = instRealClass(cache,env,DAE.MOD(f,e,submods,eqmod),pre,ty);
v = instBuiltinAttribute(cache,env,"start",optVal,exp,DAE.T_REAL_DEFAULT,p);
then v::varLst;
Expand Down Expand Up @@ -9543,16 +9545,16 @@ protected function elabArraydimType2
algorithm
outDimensionOptionLst := matchcontinue (inType,inArrayDim,inSubs)
local
DAE.Dimension d;
DAE.Dimension d,d1;
list<DAE.Dimension> l;
tuple<DAE.TType, Option<Absyn.Path>> t;
list<Absyn.Subscript> ad;
list<DAE.Subscript> subs;
DAE.Subscript sub;
case ((DAE.T_ARRAY(arrayDim = d, arrayType = t), _), ad, (sub::subs))
equation
//d1 = Expression.subscriptDimension(sub);
// _ = compatibleArraydim(d,d1); TODO: Implement the comparison in the non-expanded case! -- alleb
d1 = Expression.subscriptDimension(sub);
_ = compatibleArraydim(d,d1);
l = elabArraydimType2(t, ad,subs);
then
l;
Expand Down
15 changes: 15 additions & 0 deletions Compiler/FrontEnd/Static.mo
Expand Up @@ -3272,6 +3272,21 @@ algorithm
exp = Expression.makeBuiltinCall("fill", s_1 :: dims_1, exp_type);
then
(cache, exp, prop);

// Non-constant dimensons are also allowed in the case of non-expanded arrays
// TODO: check that the diemnsions are parametric?
case (cache, env, (s :: dims), _, impl,pre,info)
equation
false = RTOpts.splitArrays();
(cache, s_1, DAE.PROP(sty, c1), _) = elabExp(cache, env, s, impl,NONE(), true,pre,info);
(cache, dims_1, dimprops, _) = elabExpList(cache, env, dims, impl,NONE(), true,pre,info);
sty = makeFillArgListType(sty, dimprops);
exp_type = Types.elabType(sty);
c1 = Types.constAnd(c1, DAE.C_PARAM());
prop = DAE.PROP(sty, c1);
exp = Expression.makeBuiltinCall("fill", s_1 :: dims_1, exp_type);
then
(cache, exp, prop);

case (cache,env,dims,_,impl,pre,info)
equation
Expand Down

0 comments on commit 5b166cb

Please sign in to comment.