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