Changeset 6a1e39bc in OpenModelica


Ignore:
Timestamp:
2016-04-05T16:10:28+02:00 (8 years ago)
Author:
hkiel <henning.kiel@…>
Branches:
Added-citation-metadata, maintenance/v1.14, maintenance/v1.15, maintenance/v1.16, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, maintenance/v1.23, master, omlib-staging
Children:
9027e889
Parents:
6c0fc0dd
Message:

recursion -> loop

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Compiler/FrontEnd/ConnectionGraph.mo

    r141c87f0 r6a1e39bc  
    748748  input list<tuple<String,String>> inUserSelectedBreaking;
    749749  output DaeEdges outOrderedConnections;
    750 algorithm
    751   outOrderedConnections := match(inConnections, inUserSelectedBreaking)
    752     local
    753       String sc1,sc2;
    754       DAE.ComponentRef c1, c2;
    755       DaeEdge e;
    756       list<DAE.Element> els;
    757       DaeEdges rest, ordered;
    758       Boolean  b1, b2;
    759 
    760     // handle empty case
    761     case ({}, _) then {};
    762 
    763     // handle match and miss
    764     case ((e as (c1, c2, _))::rest, _)
    765       equation
    766         sc1 = ComponentReference.printComponentRefStr(c1);
    767         sc2 = ComponentReference.printComponentRefStr(c2);
    768         ordered = orderConnectsGuidedByUser(rest, inUserSelectedBreaking);
    769         // see both ways!
    770         b1 = listMember((sc1, sc2), inUserSelectedBreaking);
    771         b2 = listMember((sc2, sc1), inUserSelectedBreaking);
    772         if b1 or b2 then
    773           // put them at the end to be tried last (more chance to be broken)
    774           ordered = List.appendElt(e, ordered);
    775         else
    776           // put them at the front to be tried first (less chance to be broken)
    777           ordered = e::ordered;
    778         end if;
    779       then
    780         ordered;
    781 
    782   end match;
     750protected
     751  DaeEdges front = {};
     752  DaeEdges back = {};
     753  DAE.ComponentRef c1, c2;
     754  String sc1,sc2;
     755algorithm
     756  for e in inConnections loop
     757    (c1, c2, _) := e;
     758    sc1 := ComponentReference.printComponentRefStr(c1);
     759    sc2 := ComponentReference.printComponentRefStr(c2);
     760
     761    if listMember((sc1, sc2), inUserSelectedBreaking) or listMember((sc2, sc1), inUserSelectedBreaking) then
     762      // put them at the end to be tried last (more chance to be broken)
     763      back := e::back;
     764    else
     765      // put them at the front to be tried first (less chance to be broken)
     766      front := e::front;
     767    end if;
     768  end for;
     769  outOrderedConnections := List.append_reverse(front, back);
    783770end orderConnectsGuidedByUser;
    784771
Note: See TracChangeset for help on using the changeset viewer.