Salome HOME
Update copyrights 2014.
[samples/datafiles.git] / Superv / Python / GraphLoopsStupidCoupledSwitchs.py
1 # Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22
23 # Generated python file of Graph GraphLoopsStupidCoupledSwitchs
24 #
25 from SuperV import *
26
27 # Graph creation of GraphLoopsStupidCoupledSwitchs
28 def DefGraphLoopsStupidCoupledSwitchs() :
29     GraphLoopsStupidCoupledSwitchs = Graph( 'GraphLoopsStupidCoupledSwitchs' )
30     GraphLoopsStupidCoupledSwitchs.SetName( 'GraphLoopsStupidCoupledSwitchs' )
31     GraphLoopsStupidCoupledSwitchs.SetAuthor( '' )
32     GraphLoopsStupidCoupledSwitchs.SetComment( '' )
33     GraphLoopsStupidCoupledSwitchs.Coords( 0 , 0 )
34     
35     # Creation of Factory Nodes
36     
37     # Creation of InLine Nodes
38     PyIsOdd = []
39     PyIsOdd.append( 'from time import *   ' )
40     PyIsOdd.append( 'def IsOdd(a) :       ' )
41     PyIsOdd.append( '    print a,"IsOdd (GraphSwitchs)"      ' )
42     PyIsOdd.append( '    sleep( 1 )   ' )
43     PyIsOdd.append( '    return a     ' )
44     IsOdd = GraphLoopsStupidCoupledSwitchs.INode( 'IsOdd' , PyIsOdd )
45     IsOdd.SetName( 'IsOdd' )
46     IsOdd.SetAuthor( '' )
47     IsOdd.SetComment( 'Python function' )
48     IsOdd.Coords( 458 , 52 )
49     IIsOdda = IsOdd.InPort( 'a' , 'long' )
50     IIsOddGate = IsOdd.GetInPort( 'Gate' )
51     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
52     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
53     
54     PyIsOdd_1 = []
55     PyIsOdd_1.append( 'from time import *   ' )
56     PyIsOdd_1.append( 'def IsOdd(a) :       ' )
57     PyIsOdd_1.append( '    print a,"IsOdd_1 (GraphSwitchs)"      ' )
58     PyIsOdd_1.append( '    sleep( 1 )   ' )
59     PyIsOdd_1.append( '    return a     ' )
60     IsOdd_1 = GraphLoopsStupidCoupledSwitchs.INode( 'IsOdd' , PyIsOdd_1 )
61     IsOdd_1.SetName( 'IsOdd_1' )
62     IsOdd_1.SetAuthor( '' )
63     IsOdd_1.SetComment( 'Python function' )
64     IsOdd_1.Coords( 487 , 321 )
65     IIsOdd_1a = IsOdd_1.InPort( 'a' , 'long' )
66     IIsOdd_1Gate = IsOdd_1.GetInPort( 'Gate' )
67     OIsOdd_1a = IsOdd_1.OutPort( 'a' , 'long' )
68     OIsOdd_1Gate = IsOdd_1.GetOutPort( 'Gate' )
69     
70     # Creation of Loop Nodes
71     PyInitLoopSwitch = []
72     PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) :      ' )
73     PyInitLoopSwitch.append( '  return Index,Min,Max     ' )
74     PyMoreInitLoopSwitch = []
75     PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) :     ' )
76     PyMoreInitLoopSwitch.append( '      if Index <= Max :   ' )
77     PyMoreInitLoopSwitch.append( '              DoLoop = 1     ' )
78     PyMoreInitLoopSwitch.append( '      else :     ' )
79     PyMoreInitLoopSwitch.append( '              DoLoop = 0     ' )
80     PyMoreInitLoopSwitch.append( '      return DoLoop,Index,Min,Max     ' )
81     PyNextInitLoopSwitch = []
82     PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) :     ' )
83     PyNextInitLoopSwitch.append( '      Index = Index + 1     ' )
84     PyNextInitLoopSwitch.append( '      return Index,Min,Max     ' )
85     InitLoopSwitch,EndOfInitLoopSwitch = GraphLoopsStupidCoupledSwitchs.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
86     EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
87     EndOfInitLoopSwitch.SetAuthor( '' )
88     EndOfInitLoopSwitch.SetComment( 'Compute Node' )
89     EndOfInitLoopSwitch.Coords( 955 , 122 )
90     PyEndOfInitLoopSwitch = []
91     EndOfInitLoopSwitch.SetPyFunction( '' , PyEndOfInitLoopSwitch )
92     IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
93     IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
94     IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
95     IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
96     IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
97     OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
98     OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
99     OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
100     OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
101     IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
102     IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
103     IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
104     IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
105     IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
106     OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
107     OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
108     OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
109     OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
110     OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
111     InitLoopSwitch.SetName( 'InitLoopSwitch' )
112     InitLoopSwitch.SetAuthor( '' )
113     InitLoopSwitch.SetComment( 'Compute Node' )
114     InitLoopSwitch.Coords( 14 , 136 )
115     
116     PyInitLoop = []
117     PyInitLoop.append( 'def InitLoop(Index,Min,Max) :      ' )
118     PyInitLoop.append( '        return Index,Min,Max     ' )
119     PyMoreInitLoop = []
120     PyMoreInitLoop.append( 'def MoreLoop(Index,Min,Max) :     ' )
121     PyMoreInitLoop.append( '    if Index <= Max :   ' )
122     PyMoreInitLoop.append( '            DoLoop = 1     ' )
123     PyMoreInitLoop.append( '    else :     ' )
124     PyMoreInitLoop.append( '            DoLoop = 0     ' )
125     PyMoreInitLoop.append( '    return DoLoop,Index,Min,Max     ' )
126     PyNextInitLoop = []
127     PyNextInitLoop.append( 'def NextLoop(Index,Min,Max) :     ' )
128     PyNextInitLoop.append( '    Index = Index + 1     ' )
129     PyNextInitLoop.append( '    return Index,Min,Max     ' )
130     InitLoop,EndOfInitLoop = GraphLoopsStupidCoupledSwitchs.LNode( 'InitLoop' , PyInitLoop , 'MoreLoop' , PyMoreInitLoop , 'NextLoop' , PyNextInitLoop )
131     EndOfInitLoop.SetName( 'EndOfInitLoop' )
132     EndOfInitLoop.SetAuthor( '' )
133     EndOfInitLoop.SetComment( 'Compute Node' )
134     EndOfInitLoop.Coords( 961 , 369 )
135     PyEndOfInitLoop = []
136     EndOfInitLoop.SetPyFunction( '' , PyEndOfInitLoop )
137     IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
138     IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
139     IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
140     IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
141     IInitLoopGate = InitLoop.GetInPort( 'Gate' )
142     OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
143     OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
144     OInitLoopMin = InitLoop.GetOutPort( 'Min' )
145     OInitLoopMax = InitLoop.GetOutPort( 'Max' )
146     IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
147     IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
148     IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
149     IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
150     IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
151     OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
152     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
153     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
154     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
155     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
156     InitLoop.SetName( 'InitLoop' )
157     InitLoop.SetAuthor( '' )
158     InitLoop.SetComment( 'Compute Node' )
159     InitLoop.Coords( 10 , 391 )
160     
161     # Creation of Switch Nodes
162     PySwitch = []
163     PySwitch.append( 'from time import * ' )
164     PySwitch.append( 'def Switch(a) :   ' )
165     PySwitch.append( '    if ( a & 1 ) == 0 : ' )
166     PySwitch.append( '        sleep(1)    ' )
167     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
168     Switch,EndOfSwitch = GraphLoopsStupidCoupledSwitchs.SNode( 'Switch' , PySwitch )
169     EndOfSwitch.SetName( 'EndOfSwitch' )
170     EndOfSwitch.SetAuthor( '' )
171     EndOfSwitch.SetComment( 'Compute Node' )
172     EndOfSwitch.Coords( 690 , 129 )
173     PyEndOfSwitch = []
174     EndOfSwitch.SetPyFunction( '' , PyEndOfSwitch )
175     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
176     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
177     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
178     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
179     Switch.SetName( 'Switch' )
180     Switch.SetAuthor( '' )
181     Switch.SetComment( 'Compute Node' )
182     Switch.Coords( 245 , 136 )
183     ISwitcha = Switch.InPort( 'a' , 'long' )
184     ISwitchGate = Switch.GetInPort( 'Gate' )
185     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
186     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
187     OSwitcha = Switch.OutPort( 'a' , 'int' )
188     OSwitchDefault = Switch.GetOutPort( 'Default' )
189     
190     PySwitch_1 = []
191     PySwitch_1.append( 'from time import *  ' )
192     PySwitch_1.append( 'def Switch(a) :    ' )
193     PySwitch_1.append( '    if ( a & 1 ) == 0 :  ' )
194     PySwitch_1.append( '        sleep(1)  ' )
195     PySwitch_1.append( '    return a & 1,1-(a&1),a    ' )
196     Switch_1,EndSwitch = GraphLoopsStupidCoupledSwitchs.SNode( 'Switch' , PySwitch_1 )
197     EndSwitch.SetName( 'EndSwitch' )
198     EndSwitch.SetAuthor( '' )
199     EndSwitch.SetComment( 'Compute Node' )
200     EndSwitch.Coords( 695 , 387 )
201     PyEndSwitch = []
202     EndSwitch.SetPyFunction( '' , PyEndSwitch )
203     IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
204     IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
205     OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
206     OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
207     Switch_1.SetName( 'Switch_1' )
208     Switch_1.SetAuthor( '' )
209     Switch_1.SetComment( 'Compute Node' )
210     Switch_1.Coords( 258 , 391 )
211     ISwitch_1a = Switch_1.InPort( 'a' , 'long' )
212     ISwitch_1Gate = Switch_1.GetInPort( 'Gate' )
213     OSwitch_1Odd = Switch_1.OutPort( 'Odd' , 'long' )
214     OSwitch_1Even = Switch_1.OutPort( 'Even' , 'int' )
215     OSwitch_1a = Switch_1.OutPort( 'a' , 'int' )
216     OSwitch_1Default = Switch_1.GetOutPort( 'Default' )
217     
218     # Creation of Links
219     LIsOddaEndOfSwitcha = GraphLoopsStupidCoupledSwitchs.Link( OIsOdda , IEndOfSwitcha )
220     
221     LIsOddGateEndOfSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OIsOddGate , IEndOfSwitchDefault )
222     
223     LInitLoopSwitchIndexSwitcha = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopSwitchIndex , ISwitcha )
224     
225     LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
226     
227     LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
228     
229     LInitLoopSwitchGateEndSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopSwitchGate , IEndSwitchDefault )
230     
231     LSwitchaIsOdda = GraphLoopsStupidCoupledSwitchs.Link( OSwitcha , IIsOdda )
232     
233     LSwitchDefaultEndSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OSwitchDefault , IEndSwitchDefault )
234     
235     LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphLoopsStupidCoupledSwitchs.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
236     
237     LIsOdd_1aEndSwitcha = GraphLoopsStupidCoupledSwitchs.Link( OIsOdd_1a , IEndSwitcha )
238     
239     LIsOdd_1GateEndSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OIsOdd_1Gate , IEndSwitchDefault )
240     
241     LIsOdd_1GateEndOfSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OIsOdd_1Gate , IEndOfSwitchDefault )
242     
243     LInitLoopIndexSwitch_1a = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopIndex , ISwitch_1a )
244     
245     LInitLoopMinEndOfInitLoopMin = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopMin , IEndOfInitLoopMin )
246     
247     LInitLoopMaxEndOfInitLoopMax = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopMax , IEndOfInitLoopMax )
248     
249     LInitLoopGateSwitchGate = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopGate , ISwitchGate )
250     
251     LInitLoopGateSwitch_1Gate = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopGate , ISwitch_1Gate )
252     
253     LInitLoopGateIsOdd_1Gate = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopGate , IIsOdd_1Gate )
254     
255     LInitLoopGateEndOfSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopGate , IEndOfSwitchDefault )
256     
257     LSwitch_1EvenEndSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OSwitch_1Even , IEndSwitchDefault )
258     
259     LSwitch_1aIsOdd_1a = GraphLoopsStupidCoupledSwitchs.Link( OSwitch_1a , IIsOdd_1a )
260     
261     LSwitch_1DefaultIsOddGate = GraphLoopsStupidCoupledSwitchs.Link( OSwitch_1Default , IIsOddGate )
262     
263     LSwitch_1DefaultEndOfSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OSwitch_1Default , IEndOfSwitchDefault )
264     
265     LSwitch_1DefaultEndOfInitLoopSwitchGate = GraphLoopsStupidCoupledSwitchs.Link( OSwitch_1Default , IEndOfInitLoopSwitchGate )
266     
267     LSwitch_1DefaultEndOfInitLoopGate = GraphLoopsStupidCoupledSwitchs.Link( OSwitch_1Default , IEndOfInitLoopGate )
268     
269     LSwitch_1DefaultEndSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OSwitch_1Default , IEndSwitchDefault )
270     
271     LEndSwitchaEndOfInitLoopIndex = GraphLoopsStupidCoupledSwitchs.Link( OEndSwitcha , IEndOfInitLoopIndex )
272     
273     # Input datas
274     IInitLoopSwitchIndex.Input( 0 )
275     IInitLoopSwitchMin.Input( 0 )
276     IInitLoopSwitchMax.Input( 20 )
277     IInitLoopIndex.Input( 0 )
278     IInitLoopMin.Input( 0 )
279     IInitLoopMax.Input( 20 )
280     
281     # Output Ports of the graph
282     #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
283     #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
284     #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
285     #OSwitchOdd = Switch.GetOutPort( 'Odd' )
286     #OSwitchEven = Switch.GetOutPort( 'Even' )
287     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
288     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
289     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
290     #OSwitch_1Odd = Switch_1.GetOutPort( 'Odd' )
291     return GraphLoopsStupidCoupledSwitchs
292
293
294 GraphLoopsStupidCoupledSwitchs = DefGraphLoopsStupidCoupledSwitchs()