Salome HOME
1b32665f0fe73227329d2fde9cbd823f3e7fa0ef
[samples/datafiles.git] / Superv / Python / GraphSwitchs.py
1 # Copyright (C) 2007-2015  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 GraphSwitchs
24 #
25 from SuperV import *
26
27 # Graph creation of GraphSwitchs
28 def DefGraphSwitchs() :
29     GraphSwitchs = Graph( 'GraphSwitchs' )
30     GraphSwitchs.SetName( 'GraphSwitchs' )
31     GraphSwitchs.SetAuthor( '' )
32     GraphSwitchs.SetComment( '' )
33     GraphSwitchs.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 = GraphSwitchs.INode( 'IsOdd' , PyIsOdd )
45     IsOdd.SetName( 'IsOdd' )
46     IsOdd.SetAuthor( '' )
47     IsOdd.SetComment( 'Python function' )
48     IsOdd.Coords( 388 , 50 )
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 = GraphSwitchs.INode( 'IsOdd' , PyIsOdd_1 )
61     IsOdd_1.SetName( 'IsOdd_1' )
62     IsOdd_1.SetAuthor( '' )
63     IsOdd_1.SetComment( 'Python function' )
64     IsOdd_1.Coords( 419 , 308 )
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 = GraphSwitchs.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
86     EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
87     EndOfInitLoopSwitch.SetAuthor( '' )
88     EndOfInitLoopSwitch.SetComment( 'Compute Node' )
89     EndOfInitLoopSwitch.Coords( 766 , 127 )
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     OInitLoopSwitchGate = InitLoopSwitch.GetOutPort( 'Gate' )
102     IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
103     IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
104     IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
105     IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
106     IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
107     OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
108     OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
109     OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
110     OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
111     OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
112     InitLoopSwitch.SetName( 'InitLoopSwitch' )
113     InitLoopSwitch.SetAuthor( '' )
114     InitLoopSwitch.SetComment( 'Compute Node' )
115     InitLoopSwitch.Coords( 10 , 129 )
116     
117     PyInitLoop = []
118     PyInitLoop.append( 'def InitLoop(Index,Min,Max) :      ' )
119     PyInitLoop.append( '        return Index,Min,Max     ' )
120     PyMoreInitLoop = []
121     PyMoreInitLoop.append( 'def MoreLoop(Index,Min,Max) :     ' )
122     PyMoreInitLoop.append( '    if Index <= Max :   ' )
123     PyMoreInitLoop.append( '            DoLoop = 1     ' )
124     PyMoreInitLoop.append( '    else :     ' )
125     PyMoreInitLoop.append( '            DoLoop = 0     ' )
126     PyMoreInitLoop.append( '    return DoLoop,Index,Min,Max     ' )
127     PyNextInitLoop = []
128     PyNextInitLoop.append( 'def NextLoop(Index,Min,Max) :     ' )
129     PyNextInitLoop.append( '    Index = Index + 1     ' )
130     PyNextInitLoop.append( '    return Index,Min,Max     ' )
131     InitLoop,EndOfInitLoop = GraphSwitchs.LNode( 'InitLoop' , PyInitLoop , 'MoreLoop' , PyMoreInitLoop , 'NextLoop' , PyNextInitLoop )
132     EndOfInitLoop.SetName( 'EndOfInitLoop' )
133     EndOfInitLoop.SetAuthor( '' )
134     EndOfInitLoop.SetComment( 'Compute Node' )
135     EndOfInitLoop.Coords( 783 , 381 )
136     PyEndOfInitLoop = []
137     EndOfInitLoop.SetPyFunction( '' , PyEndOfInitLoop )
138     IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
139     IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
140     IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
141     IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
142     IInitLoopGate = InitLoop.GetInPort( 'Gate' )
143     OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
144     OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
145     OInitLoopMin = InitLoop.GetOutPort( 'Min' )
146     OInitLoopMax = InitLoop.GetOutPort( 'Max' )
147     OInitLoopGate = InitLoop.GetOutPort( 'Gate' )
148     IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
149     IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
150     IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
151     IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
152     IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
153     OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
154     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
155     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
156     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
157     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
158     InitLoop.SetName( 'InitLoop' )
159     InitLoop.SetAuthor( '' )
160     InitLoop.SetComment( 'Compute Node' )
161     InitLoop.Coords( 10 , 388 )
162     
163     # Creation of Switch Nodes
164     PySwitch = []
165     PySwitch.append( 'from time import * ' )
166     PySwitch.append( 'def Switch(a) :   ' )
167     PySwitch.append( '    if ( a & 1 ) == 0 : ' )
168     PySwitch.append( '        sleep(1)    ' )
169     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
170     Switch,EndOfSwitch = GraphSwitchs.SNode( 'Switch' , PySwitch )
171     EndOfSwitch.SetName( 'EndOfSwitch' )
172     EndOfSwitch.SetAuthor( '' )
173     EndOfSwitch.SetComment( 'Compute Node' )
174     EndOfSwitch.Coords( 587 , 126 )
175     PyEndOfSwitch = []
176     EndOfSwitch.SetPyFunction( '' , PyEndOfSwitch )
177     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
178     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
179     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
180     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
181     Switch.SetName( 'Switch' )
182     Switch.SetAuthor( '' )
183     Switch.SetComment( 'Compute Node' )
184     Switch.Coords( 186 , 130 )
185     ISwitcha = Switch.InPort( 'a' , 'long' )
186     ISwitchGate = Switch.GetInPort( 'Gate' )
187     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
188     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
189     OSwitcha = Switch.OutPort( 'a' , 'int' )
190     OSwitchDefault = Switch.GetOutPort( 'Default' )
191     
192     PySwitch_1 = []
193     PySwitch_1.append( 'from time import *  ' )
194     PySwitch_1.append( 'def Switch(a) :    ' )
195     PySwitch_1.append( '    if ( a & 1 ) == 0 :  ' )
196     PySwitch_1.append( '        sleep(1)  ' )
197     PySwitch_1.append( '    return a & 1,1-(a&1),a    ' )
198     Switch_1,EndSwitch = GraphSwitchs.SNode( 'Switch' , PySwitch_1 )
199     EndSwitch.SetName( 'EndSwitch' )
200     EndSwitch.SetAuthor( '' )
201     EndSwitch.SetComment( 'Compute Node' )
202     EndSwitch.Coords( 605 , 382 )
203     PyEndSwitch = []
204     EndSwitch.SetPyFunction( '' , PyEndSwitch )
205     IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
206     IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
207     OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
208     OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
209     Switch_1.SetName( 'Switch_1' )
210     Switch_1.SetAuthor( '' )
211     Switch_1.SetComment( 'Compute Node' )
212     Switch_1.Coords( 193 , 388 )
213     ISwitch_1a = Switch_1.InPort( 'a' , 'long' )
214     ISwitch_1Gate = Switch_1.GetInPort( 'Gate' )
215     OSwitch_1Odd = Switch_1.OutPort( 'Odd' , 'long' )
216     OSwitch_1Even = Switch_1.OutPort( 'Even' , 'int' )
217     OSwitch_1a = Switch_1.OutPort( 'a' , 'int' )
218     OSwitch_1Default = Switch_1.GetOutPort( 'Default' )
219     
220     # Creation of Links
221     LIsOddaEndOfSwitcha = GraphSwitchs.Link( OIsOdda , IEndOfSwitcha )
222     LIsOddaEndOfSwitcha.AddCoord( 1 , 573 , 160 )
223     LIsOddaEndOfSwitcha.AddCoord( 2 , 572 , 130 )
224     
225     LInitLoopSwitchIndexSwitcha = GraphSwitchs.Link( OInitLoopSwitchIndex , ISwitcha )
226     
227     LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchs.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
228     
229     LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchs.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
230     
231     LSwitchOddIsOddGate = GraphSwitchs.Link( OSwitchOdd , IIsOddGate )
232     
233     LSwitchaIsOdda = GraphSwitchs.Link( OSwitcha , IIsOdda )
234     LSwitchaIsOdda.AddCoord( 1 , 365 , 129 )
235     LSwitchaIsOdda.AddCoord( 2 , 365 , 222 )
236     
237     LSwitchDefaultEndOfSwitchDefault = GraphSwitchs.Link( OSwitchDefault , IEndOfSwitchDefault )
238     LSwitchDefaultEndOfSwitchDefault.AddCoord( 1 , 572 , 194 )
239     LSwitchDefaultEndOfSwitchDefault.AddCoord( 2 , 571 , 257 )
240     
241     LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchs.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
242     
243     LIsOdd_1aEndSwitcha = GraphSwitchs.Link( OIsOdd_1a , IEndSwitcha )
244     LIsOdd_1aEndSwitcha.AddCoord( 1 , 599 , 416 )
245     LIsOdd_1aEndSwitcha.AddCoord( 2 , 598 , 389 )
246     
247     LInitLoopIndexSwitch_1a = GraphSwitchs.Link( OInitLoopIndex , ISwitch_1a )
248     
249     LInitLoopMinEndOfInitLoopMin = GraphSwitchs.Link( OInitLoopMin , IEndOfInitLoopMin )
250     
251     LInitLoopMaxEndOfInitLoopMax = GraphSwitchs.Link( OInitLoopMax , IEndOfInitLoopMax )
252     
253     LSwitch_1OddIsOdd_1Gate = GraphSwitchs.Link( OSwitch_1Odd , IIsOdd_1Gate )
254     
255     LSwitch_1EvenEndSwitchDefault = GraphSwitchs.Link( OSwitch_1Even , IEndSwitchDefault )
256     
257     LSwitch_1aIsOdd_1a = GraphSwitchs.Link( OSwitch_1a , IIsOdd_1a )
258     LSwitch_1aIsOdd_1a.AddCoord( 1 , 379 , 387 )
259     LSwitch_1aIsOdd_1a.AddCoord( 2 , 378 , 481 )
260     
261     LEndSwitchaEndOfInitLoopIndex = GraphSwitchs.Link( OEndSwitcha , IEndOfInitLoopIndex )
262     
263     # Input datas
264     IInitLoopSwitchIndex.Input( 0 )
265     IInitLoopSwitchMin.Input( 0 )
266     IInitLoopSwitchMax.Input( 20 )
267     IInitLoopIndex.Input( 0 )
268     IInitLoopMin.Input( 0 )
269     IInitLoopMax.Input( 20 )
270     
271     # Output Ports of the graph
272     #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
273     #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
274     #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
275     #OSwitchEven = Switch.GetOutPort( 'Even' )
276     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
277     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
278     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
279     return GraphSwitchs
280
281
282 GraphSwitchs = DefGraphSwitchs()