Ignore:
Timestamp:
2020-10-21T15:09:21+02:00 (4 years ago)
Author:
Adrian Pop <adrian.pop@…>
Children:
9960cdcd
Parents:
5c431b26
git-author:
Per Östlund <perost86@…> (10/20/20 12:57:27)
git-committer:
Adrian Pop <adrian.pop@…> (10/21/20 15:09:21)
Message:

Array connection improvements.

  • Make sure all iterators get unique components when creating them and not sharing a constant literal, to make the simplification for removing unused for loops work correctly.
  • Avoid creating unnecessary for loops for ranges with the same lower and upper bound.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/Compiler/NFFrontEnd/NFSimplifyModel.mo

    rc9471b8 r1019c41e  
    161161    case Equation.FOR(range = SOME(e))
    162162      algorithm
    163         if not Equation.containsExpList(eq.body, function Expression.containsIterator(iterator = eq.iterator)) then
    164           body := simplifyEquations(eq.body);
     163        body := simplifyEquations(eq.body);
     164
     165        if not Equation.containsExpList(body, function Expression.containsIterator(iterator = eq.iterator)) then
    165166          equations := List.append_reverse(body, equations);
    166167        else
     
    171172          //  e := Expression.applySubscript(Subscript.INDEX(Expression.INTEGER(1)), e);
    172173
    173           //  body := Equation.mapExpList(eq.body,
     174          //  body := Equation.mapExpList(body,
    174175          //    function Expression.replaceIterator(iterator = eq.iterator, iteratorValue = e));
    175176          //  body := simplifyEquations(body);
     
    177178          //elseif not Dimension.isZero(dim) then
    178179            eq.range := SimplifyExp.simplifyOpt(eq.range);
    179             eq.body := simplifyEquations(eq.body);
     180            eq.body := body;
    180181            equations := eq :: equations;
    181182          //end if;
Note: See TracChangeset for help on using the changeset viewer.