Salome HOME
Merge from V6_main_20120808 08Aug12
[samples/datafiles.git] / Superv / Python / GraphLoopsStupidCoupledSwitchs.py
1 #  Copyright (C) 2007-2011  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.
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 # Generated python file of Graph GraphLoopsStupidCoupledSwitchs
23 #
24 from SuperV import *
25
26 # Graph creation of GraphLoopsStupidCoupledSwitchs
27 def DefGraphLoopsStupidCoupledSwitchs() :
28     GraphLoopsStupidCoupledSwitchs = Graph( 'GraphLoopsStupidCoupledSwitchs' )
29     GraphLoopsStupidCoupledSwitchs.SetName( 'GraphLoopsStupidCoupledSwitchs' )
30     GraphLoopsStupidCoupledSwitchs.SetAuthor( '' )
31     GraphLoopsStupidCoupledSwitchs.SetComment( '' )
32     GraphLoopsStupidCoupledSwitchs.Coords( 0 , 0 )
33     
34     # Creation of Factory Nodes
35     
36     # Creation of InLine Nodes
37     PyIsOdd = []
38     PyIsOdd.append( 'from time import *   ' )
39     PyIsOdd.append( 'def IsOdd(a) :       ' )
40     PyIsOdd.append( '    print a,"IsOdd (GraphSwitchs)"      ' )
41     PyIsOdd.append( '    sleep( 1 )   ' )
42     PyIsOdd.append( '    return a     ' )
43     IsOdd = GraphLoopsStupidCoupledSwitchs.INode( 'IsOdd' , PyIsOdd )
44     IsOdd.SetName( 'IsOdd' )
45     IsOdd.SetAuthor( '' )
46     IsOdd.SetComment( 'Python function' )
47     IsOdd.Coords( 458 , 52 )
48     IIsOdda = IsOdd.InPort( 'a' , 'long' )
49     IIsOddGate = IsOdd.GetInPort( 'Gate' )
50     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
51     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
52     
53     PyIsOdd_1 = []
54     PyIsOdd_1.append( 'from time import *   ' )
55     PyIsOdd_1.append( 'def IsOdd(a) :       ' )
56     PyIsOdd_1.append( '    print a,"IsOdd_1 (GraphSwitchs)"      ' )
57     PyIsOdd_1.append( '    sleep( 1 )   ' )
58     PyIsOdd_1.append( '    return a     ' )
59     IsOdd_1 = GraphLoopsStupidCoupledSwitchs.INode( 'IsOdd' , PyIsOdd_1 )
60     IsOdd_1.SetName( 'IsOdd_1' )
61     IsOdd_1.SetAuthor( '' )
62     IsOdd_1.SetComment( 'Python function' )
63     IsOdd_1.Coords( 487 , 321 )
64     IIsOdd_1a = IsOdd_1.InPort( 'a' , 'long' )
65     IIsOdd_1Gate = IsOdd_1.GetInPort( 'Gate' )
66     OIsOdd_1a = IsOdd_1.OutPort( 'a' , 'long' )
67     OIsOdd_1Gate = IsOdd_1.GetOutPort( 'Gate' )
68     
69     # Creation of Loop Nodes
70     PyInitLoopSwitch = []
71     PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) :      ' )
72     PyInitLoopSwitch.append( '  return Index,Min,Max     ' )
73     PyMoreInitLoopSwitch = []
74     PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) :     ' )
75     PyMoreInitLoopSwitch.append( '      if Index <= Max :   ' )
76     PyMoreInitLoopSwitch.append( '              DoLoop = 1     ' )
77     PyMoreInitLoopSwitch.append( '      else :     ' )
78     PyMoreInitLoopSwitch.append( '              DoLoop = 0     ' )
79     PyMoreInitLoopSwitch.append( '      return DoLoop,Index,Min,Max     ' )
80     PyNextInitLoopSwitch = []
81     PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) :     ' )
82     PyNextInitLoopSwitch.append( '      Index = Index + 1     ' )
83     PyNextInitLoopSwitch.append( '      return Index,Min,Max     ' )
84     InitLoopSwitch,EndOfInitLoopSwitch = GraphLoopsStupidCoupledSwitchs.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
85     EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
86     EndOfInitLoopSwitch.SetAuthor( '' )
87     EndOfInitLoopSwitch.SetComment( 'Compute Node' )
88     EndOfInitLoopSwitch.Coords( 955 , 122 )
89     PyEndOfInitLoopSwitch = []
90     EndOfInitLoopSwitch.SetPyFunction( '' , PyEndOfInitLoopSwitch )
91     IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
92     IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
93     IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
94     IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
95     IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
96     OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
97     OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
98     OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
99     OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
100     IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
101     IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
102     IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
103     IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
104     IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
105     OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
106     OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
107     OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
108     OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
109     OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
110     InitLoopSwitch.SetName( 'InitLoopSwitch' )
111     InitLoopSwitch.SetAuthor( '' )
112     InitLoopSwitch.SetComment( 'Compute Node' )
113     InitLoopSwitch.Coords( 14 , 136 )
114     
115     PyInitLoop = []
116     PyInitLoop.append( 'def InitLoop(Index,Min,Max) :      ' )
117     PyInitLoop.append( '        return Index,Min,Max     ' )
118     PyMoreInitLoop = []
119     PyMoreInitLoop.append( 'def MoreLoop(Index,Min,Max) :     ' )
120     PyMoreInitLoop.append( '    if Index <= Max :   ' )
121     PyMoreInitLoop.append( '            DoLoop = 1     ' )
122     PyMoreInitLoop.append( '    else :     ' )
123     PyMoreInitLoop.append( '            DoLoop = 0     ' )
124     PyMoreInitLoop.append( '    return DoLoop,Index,Min,Max     ' )
125     PyNextInitLoop = []
126     PyNextInitLoop.append( 'def NextLoop(Index,Min,Max) :     ' )
127     PyNextInitLoop.append( '    Index = Index + 1     ' )
128     PyNextInitLoop.append( '    return Index,Min,Max     ' )
129     InitLoop,EndOfInitLoop = GraphLoopsStupidCoupledSwitchs.LNode( 'InitLoop' , PyInitLoop , 'MoreLoop' , PyMoreInitLoop , 'NextLoop' , PyNextInitLoop )
130     EndOfInitLoop.SetName( 'EndOfInitLoop' )
131     EndOfInitLoop.SetAuthor( '' )
132     EndOfInitLoop.SetComment( 'Compute Node' )
133     EndOfInitLoop.Coords( 961 , 369 )
134     PyEndOfInitLoop = []
135     EndOfInitLoop.SetPyFunction( '' , PyEndOfInitLoop )
136     IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
137     IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
138     IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
139     IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
140     IInitLoopGate = InitLoop.GetInPort( 'Gate' )
141     OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
142     OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
143     OInitLoopMin = InitLoop.GetOutPort( 'Min' )
144     OInitLoopMax = InitLoop.GetOutPort( 'Max' )
145     IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
146     IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
147     IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
148     IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
149     IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
150     OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
151     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
152     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
153     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
154     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
155     InitLoop.SetName( 'InitLoop' )
156     InitLoop.SetAuthor( '' )
157     InitLoop.SetComment( 'Compute Node' )
158     InitLoop.Coords( 10 , 391 )
159     
160     # Creation of Switch Nodes
161     PySwitch = []
162     PySwitch.append( 'from time import * ' )
163     PySwitch.append( 'def Switch(a) :   ' )
164     PySwitch.append( '    if ( a & 1 ) == 0 : ' )
165     PySwitch.append( '        sleep(1)    ' )
166     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
167     Switch,EndOfSwitch = GraphLoopsStupidCoupledSwitchs.SNode( 'Switch' , PySwitch )
168     EndOfSwitch.SetName( 'EndOfSwitch' )
169     EndOfSwitch.SetAuthor( '' )
170     EndOfSwitch.SetComment( 'Compute Node' )
171     EndOfSwitch.Coords( 690 , 129 )
172     PyEndOfSwitch = []
173     EndOfSwitch.SetPyFunction( '' , PyEndOfSwitch )
174     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
175     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
176     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
177     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
178     Switch.SetName( 'Switch' )
179     Switch.SetAuthor( '' )
180     Switch.SetComment( 'Compute Node' )
181     Switch.Coords( 245 , 136 )
182     ISwitcha = Switch.InPort( 'a' , 'long' )
183     ISwitchGate = Switch.GetInPort( 'Gate' )
184     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
185     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
186     OSwitcha = Switch.OutPort( 'a' , 'int' )
187     OSwitchDefault = Switch.GetOutPort( 'Default' )
188     
189     PySwitch_1 = []
190     PySwitch_1.append( 'from time import *  ' )
191     PySwitch_1.append( 'def Switch(a) :    ' )
192     PySwitch_1.append( '    if ( a & 1 ) == 0 :  ' )
193     PySwitch_1.append( '        sleep(1)  ' )
194     PySwitch_1.append( '    return a & 1,1-(a&1),a    ' )
195     Switch_1,EndSwitch = GraphLoopsStupidCoupledSwitchs.SNode( 'Switch' , PySwitch_1 )
196     EndSwitch.SetName( 'EndSwitch' )
197     EndSwitch.SetAuthor( '' )
198     EndSwitch.SetComment( 'Compute Node' )
199     EndSwitch.Coords( 695 , 387 )
200     PyEndSwitch = []
201     EndSwitch.SetPyFunction( '' , PyEndSwitch )
202     IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
203     IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
204     OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
205     OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
206     Switch_1.SetName( 'Switch_1' )
207     Switch_1.SetAuthor( '' )
208     Switch_1.SetComment( 'Compute Node' )
209     Switch_1.Coords( 258 , 391 )
210     ISwitch_1a = Switch_1.InPort( 'a' , 'long' )
211     ISwitch_1Gate = Switch_1.GetInPort( 'Gate' )
212     OSwitch_1Odd = Switch_1.OutPort( 'Odd' , 'long' )
213     OSwitch_1Even = Switch_1.OutPort( 'Even' , 'int' )
214     OSwitch_1a = Switch_1.OutPort( 'a' , 'int' )
215     OSwitch_1Default = Switch_1.GetOutPort( 'Default' )
216     
217     # Creation of Links
218     LIsOddaEndOfSwitcha = GraphLoopsStupidCoupledSwitchs.Link( OIsOdda , IEndOfSwitcha )
219     
220     LIsOddGateEndOfSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OIsOddGate , IEndOfSwitchDefault )
221     
222     LInitLoopSwitchIndexSwitcha = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopSwitchIndex , ISwitcha )
223     
224     LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
225     
226     LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
227     
228     LInitLoopSwitchGateEndSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopSwitchGate , IEndSwitchDefault )
229     
230     LSwitchaIsOdda = GraphLoopsStupidCoupledSwitchs.Link( OSwitcha , IIsOdda )
231     
232     LSwitchDefaultEndSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OSwitchDefault , IEndSwitchDefault )
233     
234     LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphLoopsStupidCoupledSwitchs.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
235     
236     LIsOdd_1aEndSwitcha = GraphLoopsStupidCoupledSwitchs.Link( OIsOdd_1a , IEndSwitcha )
237     
238     LIsOdd_1GateEndSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OIsOdd_1Gate , IEndSwitchDefault )
239     
240     LIsOdd_1GateEndOfSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OIsOdd_1Gate , IEndOfSwitchDefault )
241     
242     LInitLoopIndexSwitch_1a = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopIndex , ISwitch_1a )
243     
244     LInitLoopMinEndOfInitLoopMin = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopMin , IEndOfInitLoopMin )
245     
246     LInitLoopMaxEndOfInitLoopMax = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopMax , IEndOfInitLoopMax )
247     
248     LInitLoopGateSwitchGate = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopGate , ISwitchGate )
249     
250     LInitLoopGateSwitch_1Gate = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopGate , ISwitch_1Gate )
251     
252     LInitLoopGateIsOdd_1Gate = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopGate , IIsOdd_1Gate )
253     
254     LInitLoopGateEndOfSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OInitLoopGate , IEndOfSwitchDefault )
255     
256     LSwitch_1EvenEndSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OSwitch_1Even , IEndSwitchDefault )
257     
258     LSwitch_1aIsOdd_1a = GraphLoopsStupidCoupledSwitchs.Link( OSwitch_1a , IIsOdd_1a )
259     
260     LSwitch_1DefaultIsOddGate = GraphLoopsStupidCoupledSwitchs.Link( OSwitch_1Default , IIsOddGate )
261     
262     LSwitch_1DefaultEndOfSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OSwitch_1Default , IEndOfSwitchDefault )
263     
264     LSwitch_1DefaultEndOfInitLoopSwitchGate = GraphLoopsStupidCoupledSwitchs.Link( OSwitch_1Default , IEndOfInitLoopSwitchGate )
265     
266     LSwitch_1DefaultEndOfInitLoopGate = GraphLoopsStupidCoupledSwitchs.Link( OSwitch_1Default , IEndOfInitLoopGate )
267     
268     LSwitch_1DefaultEndSwitchDefault = GraphLoopsStupidCoupledSwitchs.Link( OSwitch_1Default , IEndSwitchDefault )
269     
270     LEndSwitchaEndOfInitLoopIndex = GraphLoopsStupidCoupledSwitchs.Link( OEndSwitcha , IEndOfInitLoopIndex )
271     
272     # Input datas
273     IInitLoopSwitchIndex.Input( 0 )
274     IInitLoopSwitchMin.Input( 0 )
275     IInitLoopSwitchMax.Input( 20 )
276     IInitLoopIndex.Input( 0 )
277     IInitLoopMin.Input( 0 )
278     IInitLoopMax.Input( 20 )
279     
280     # Output Ports of the graph
281     #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
282     #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
283     #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
284     #OSwitchOdd = Switch.GetOutPort( 'Odd' )
285     #OSwitchEven = Switch.GetOutPort( 'Even' )
286     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
287     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
288     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
289     #OSwitch_1Odd = Switch_1.GetOutPort( 'Odd' )
290     return GraphLoopsStupidCoupledSwitchs
291
292
293 GraphLoopsStupidCoupledSwitchs = DefGraphLoopsStupidCoupledSwitchs()