﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1569	Bug of arrayDimension in daeExpArray	Dongliang Li	Dongliang Li	"In the daeExpArray(shown following), when we use the method ""listLength"" to get the dimension of the array according to the information of ""arrayDimensions"" in ET_ARRAY,  it (<%dimsLenStr%>) always just returns ""1"", but not the correct dimension. See example in the attachment, ""AlgorithmFor6.mo"" has an array dimension of ""2"", but the code generator returns ""1"".\\
------------------------------------------------------------------------------------------------------------------\\
{{{
template daeExpArray(Exp exp, Context context, Text &preExp /*BUFP*/,Text &varDecls /*BUFP*/,SimCode simCode)
 ""Generates code for an array expression.""
::=
match exp
case ARRAY(ty=ET_ARRAY(arrayDimensions=dims)) then
  let arrayTypeStr = expTypeArray(ty)
  let dimsLenStr = listLength(dims)
  let arrayVar = tempDecl(arrayTypeStr, &varDecls /*BUFD*/)
  let scalarPrefix = if scalar then ""scalar_"" else """"
  let scalarRef = if scalar then ""&"" else """"
  let params = (array |> e =>
      '<%daeExp(e, context, &preExp /*BUFC*/, &varDecls /*BUFD*/,simCode)%>'
    ;separator="", "")
   let &preExp += ' multi_array<<%arrayTypeStr%>,<%dimsLenStr%>> <%arrayVar%>(boost::extents[<%listLength(array)%>]);
   <%arrayTypeStr%> <%arrayVar%>_data[]={<%params%>};
   <%arrayVar%>.assign(<%arrayVar%>_data,<%arrayVar%>_data+<%listLength(array)%>);
   <%arrayVar%>.reindex(1);<%\n%>'
  arrayVar
end daeExpArray;
}}}
\\
--------------------------------------------------------------------------------------------------------------------\\"	defect	closed	high		Backend	trunk	fixed		Dongliang Li
