Skip to content

Commit

Permalink
Fix for bug #1346:
Browse files Browse the repository at this point in the history
- Allow InstSection.instArrayEquation to not expand non-expandable expressions.


git-svn-id: https://openmodelica.org/svn/OpenModelica/branches/sjoelund-functiontree@6864 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
perost committed Nov 4, 2010
1 parent 8b2a7af commit a7d7649
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Compiler/InstSection.mo
Expand Up @@ -1646,7 +1646,7 @@ algorithm
case (lhs, rhs, (DAE.T_ARRAY(arrayType = t, arrayDim = dim), _), source, initial_)
equation
true = RTOpts.splitArrays();
failure(equality(dim = DAE.DIM_UNKNOWN())); // adrpo: make sure the dimensions are known!
true = Expression.dimensionKnown(dim);
// Expand along the first dimensions of the expressions, and generate an
// equation for each pair of elements.
DAE.ET_ARRAY(arrayDimensions = lhs_dim :: _) = Expression.typeof(lhs);
Expand All @@ -1657,11 +1657,22 @@ algorithm
then
dae;

case (lhs, rhs, (DAE.T_ARRAY(arrayType = t, arrayDim = dim), _), source, initial_)
equation
true = RTOpts.splitArrays();
true = Expression.dimensionKnown(dim);
true = Expression.isRange(lhs) or Expression.isRange(rhs);
ds = Types.getDimensions(tp);
lhs = ExpressionSimplify.simplify(lhs);
rhs = ExpressionSimplify.simplify(rhs);
then
DAE.DAE({DAE.ARRAY_EQUATION(ds, lhs, rhs, source)});

// Array dimension of unknown size, expanding case.
case (lhs, rhs, (DAE.T_ARRAY(arrayType = t, arrayDim = dim), _), source, initial_)
equation
true = RTOpts.splitArrays();
equality(dim = DAE.DIM_UNKNOWN()); // adrpo: make sure the dimensions are known!
false = Expression.dimensionKnown(dim);
// It's ok with array equation of unknown size if checkModel is used.
true = OptManager.getOption("checkModel");
// Expand along the first dimensions of the expressions, and generate an
Expand Down

0 comments on commit a7d7649

Please sign in to comment.