Changeset 8ede334 in OpenModelica


Ignore:
Timestamp:
2024-06-21T15:43:54+02:00 (6 days ago)
Author:
GitHub <noreply@…>
Branches:
master
Children:
02772939, 0422d67a, 0483724a, 1c2530e, 1f65e83e, 3d6a6ba, 3f030e1, 4d1e92c4, 75f0f503, 7e886b6d, 954e35ae, 95ab1834, 9d197a6, adb4b27, c0d0c458, e61cdc26, e762ba3, f2ee82ff, f6e5801b, facded5b
Parents:
537f41e
git-author:
kabdelhak <38032125+kabdelhak@…> (06/21/24 15:43:54)
git-committer:
GitHub <noreply@…> (06/21/24 15:43:54)
Message:

[NB] add array compression after simplify to remove DUMMY equations (#12624)

  • dumping updates
Location:
OMCompiler/Compiler/NBackEnd/Classes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/Compiler/NBackEnd/Classes/NBEquation.mo

    r261d3c8 r8ede334  
    702702        case IF_EQUATION()     then str + IfEquationBody.toString(eq.body, str + "[----] ", "[-IF-] " + s + EquationAttributes.toString(eq.attr, " "));
    703703        case FOR_EQUATION()    then str + forEquationToString(eq.iter, eq.body, "", str + "[----] ", "[FOR-] " + s + EquationAttributes.toString(eq.attr, " "));
    704         case WHEN_EQUATION()   then str + WhenEquationBody.toString(eq.body, str + "[----] ", "[WHEN] " + s + EquationAttributes.toString(eq.attr, " ") + "\n[----] ");
     704        case WHEN_EQUATION()   then str + WhenEquationBody.toString(eq.body, str + "[----] ", "[WHEN] " + s + EquationAttributes.toString(eq.attr, " ") + "\n");
    705705        case AUX_EQUATION()    then str + "[AUX-] " + s + "Auxiliary equation for " + Variable.toString(Pointer.access(eq.auxiliary));
    706706        case DUMMY_EQUATION()  then str + "[DUMY] (0) Dummy equation.";
     
    25242524      WhenEquationBody elseWhen;
    25252525    algorithm
    2526       str := elseStr + "when " + Expression.toString(body.condition) + " then \n";
     2526      str := elseStr;
     2527      if not selfCall then
     2528        str := str + indent;
     2529      end if;
     2530      str := str + "when " + Expression.toString(body.condition) + " then \n";
    25272531      for stmt in body.when_stmts loop
    25282532        str := str + WhenStatement.toString(stmt, indent + "  ") + "\n";
     
    36883692          eqn := ExpandableArray.get(i, equations.eqArr);
    36893693          () := match Pointer.access(eqn)
     3694            local
     3695              list<Equation> body;
     3696            // todo: add for IF and WHEN
    36903697            case Equation.DUMMY_EQUATION() then ();
     3698            case Equation.FOR_EQUATION(body = body) guard(List.all(body, Equation.isDummy)) then ();
    36913699            else algorithm
    36923700              eqns := eqn :: eqns;
  • OMCompiler/Compiler/NBackEnd/Classes/NBackendDAE.mo

    r025d351 r8ede334  
    336336    input output BackendDAE bdae;
    337337  algorithm
    338     // no output needed, all pointers
    339     () := match bdae
    340       local
    341         EquationPointers equations;
    342       case MAIN(eqData = BEquation.EQ_DATA_SIM(equations = equations)) algorithm
    343         _ := EquationPointers.map(equations, function Equation.simplify(name = getInstanceName(), indent = ""));
    344       then ();
    345       else ();
     338    bdae := match bdae
     339      local
     340        EqData eqData;
     341      case MAIN(eqData = eqData as BEquation.EQ_DATA_SIM()) algorithm
     342        eqData.equations := EquationPointers.map(eqData.equations, function Equation.simplify(name = getInstanceName(), indent = ""));
     343        bdae.eqData := EqData.compress(eqData);
     344      then bdae;
     345      else bdae;
    346346    end match;
    347347  end simplify;
Note: See TracChangeset for help on using the changeset viewer.