Salome HOME
Imported using TkCVS
[samples/datafiles.git] / Superv / Python / GraphPyFunctions.py
1
2 # Generated python file of Graph GraphPyFunctions_1
3
4 from SuperV import *
5
6 # Graph creation of GraphPyFunctions_1
7 def DefGraphPyFunctions_1() :
8     GraphPyFunctions_1 = Graph( 'GraphPyFunctions_1' )
9     GraphPyFunctions_1.SetName( 'GraphPyFunctions_1' )
10     GraphPyFunctions_1.SetAuthor( '' )
11     GraphPyFunctions_1.SetComment( '' )
12     GraphPyFunctions_1.Coords( 0 , 0 )
13     
14     # Creation of Factory Nodes
15     
16     # Creation of InLine Nodes
17     PyIsOdd = []
18     IsOdd = GraphPyFunctions_1.INode( 'IsOdd' , PyIsOdd )
19     IsOdd.SetName( 'IsOdd' )
20     IsOdd.SetAuthor( '' )
21     IsOdd.SetComment( 'Python function' )
22     IsOdd.Coords( 388 , 50 )
23     IIsOdda = IsOdd.InPort( 'a' , 'long' )
24     IIsOddGate = IsOdd.GetInPort( 'Gate' )
25     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
26     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
27     
28     PyIsOdd_1 = []
29     PyIsOdd_1.append( 'from time import *   ' )
30     PyIsOdd_1.append( 'def IsOdd(a) :       ' )
31     PyIsOdd_1.append( '    print a,"IsOdd"      ' )
32     PyIsOdd_1.append( '    sleep( 1 )   ' )
33     PyIsOdd_1.append( '    return a     ' )
34     IsOdd_1 = GraphPyFunctions_1.INode( 'IsOdd' , PyIsOdd_1 )
35     IsOdd_1.SetName( 'IsOdd_1' )
36     IsOdd_1.SetAuthor( '' )
37     IsOdd_1.SetComment( 'Python function' )
38     IsOdd_1.Coords( 391 , 288 )
39     IIsOdd_1a = IsOdd_1.InPort( 'a' , 'long' )
40     IIsOdd_1Gate = IsOdd_1.GetInPort( 'Gate' )
41     OIsOdd_1a = IsOdd_1.OutPort( 'a' , 'long' )
42     OIsOdd_1Gate = IsOdd_1.GetOutPort( 'Gate' )
43     
44     # Creation of Loop Nodes
45     PyInitLoop = []
46     PyInitLoop.append( 'def InitLoop(Index,Min,Max) :      ' )
47     PyInitLoop.append( '        return Index,Min,Max     ' )
48     PyMoreInitLoop = []
49     PyMoreInitLoop.append( 'def MoreLoop(Index,Min,Max) :     ' )
50     PyMoreInitLoop.append( '    if Index <= Max :   ' )
51     PyMoreInitLoop.append( '            DoLoop = 1     ' )
52     PyMoreInitLoop.append( '    else :     ' )
53     PyMoreInitLoop.append( '            DoLoop = 0     ' )
54     PyMoreInitLoop.append( '    return DoLoop,Index,Min,Max     ' )
55     PyNextInitLoop = []
56     PyNextInitLoop.append( 'def NextLoop(Index,Min,Max) :     ' )
57     PyNextInitLoop.append( '    Index = Index + 1     ' )
58     PyNextInitLoop.append( '    return Index,Min,Max     ' )
59     InitLoop,EndOfInitLoop = GraphPyFunctions_1.LNode( 'InitLoop' , PyInitLoop , 'MoreLoop' , PyMoreInitLoop , 'NextLoop' , PyNextInitLoop )
60     EndOfInitLoop.SetName( 'EndOfInitLoop' )
61     EndOfInitLoop.SetAuthor( '' )
62     EndOfInitLoop.SetComment( 'Compute Node' )
63     EndOfInitLoop.Coords( 766 , 127 )
64     PyEndOfInitLoop = []
65     EndOfInitLoop.SetPyFunction( 'EndInitLoop' , PyEndOfInitLoop )
66     IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
67     IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
68     IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
69     IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
70     IInitLoopGate = InitLoop.GetInPort( 'Gate' )
71     OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
72     OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
73     OInitLoopMin = InitLoop.GetOutPort( 'Min' )
74     OInitLoopMax = InitLoop.GetOutPort( 'Max' )
75     IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
76     IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
77     IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
78     IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
79     IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
80     OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
81     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
82     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
83     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
84     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
85     InitLoop.SetName( 'InitLoop' )
86     InitLoop.SetAuthor( '' )
87     InitLoop.SetComment( 'Compute Node' )
88     InitLoop.Coords( 10 , 129 )
89     
90     PyInitLoop_1 = []
91     PyMoreInitLoop_1 = []
92     PyMoreInitLoop_1.append( '' )
93     PyNextInitLoop_1 = []
94     PyNextInitLoop_1.append( '' )
95     InitLoop_1,EndOfInitLoop_1 = GraphPyFunctions_1.LNode( 'InitLoop' , PyInitLoop_1 , 'MoreLoop' , PyMoreInitLoop_1 , 'NextLoop' , PyNextInitLoop_1 )
96     EndOfInitLoop_1.SetName( 'EndOfInitLoop_1' )
97     EndOfInitLoop_1.SetAuthor( '' )
98     EndOfInitLoop_1.SetComment( 'Compute Node' )
99     EndOfInitLoop_1.Coords( 784 , 361 )
100     PyEndOfInitLoop_1 = []
101     EndOfInitLoop_1.SetPyFunction( 'EndInitLoop' , PyEndOfInitLoop_1 )
102     IInitLoop_1DoLoop = InitLoop_1.GetInPort( 'DoLoop' )
103     IInitLoop_1Index = InitLoop_1.InPort( 'Index' , 'long' )
104     IInitLoop_1Min = InitLoop_1.InPort( 'Min' , 'long' )
105     IInitLoop_1Max = InitLoop_1.InPort( 'Max' , 'long' )
106     IInitLoop_1Gate = InitLoop_1.GetInPort( 'Gate' )
107     OInitLoop_1DoLoop = InitLoop_1.GetOutPort( 'DoLoop' )
108     OInitLoop_1Index = InitLoop_1.GetOutPort( 'Index' )
109     OInitLoop_1Min = InitLoop_1.GetOutPort( 'Min' )
110     OInitLoop_1Max = InitLoop_1.GetOutPort( 'Max' )
111     IEndOfInitLoop_1DoLoop = EndOfInitLoop_1.GetInPort( 'DoLoop' )
112     IEndOfInitLoop_1Index = EndOfInitLoop_1.GetInPort( 'Index' )
113     IEndOfInitLoop_1Min = EndOfInitLoop_1.GetInPort( 'Min' )
114     IEndOfInitLoop_1Max = EndOfInitLoop_1.GetInPort( 'Max' )
115     IEndOfInitLoop_1Gate = EndOfInitLoop_1.GetInPort( 'Gate' )
116     OEndOfInitLoop_1DoLoop = EndOfInitLoop_1.GetOutPort( 'DoLoop' )
117     OEndOfInitLoop_1Index = EndOfInitLoop_1.GetOutPort( 'Index' )
118     OEndOfInitLoop_1Min = EndOfInitLoop_1.GetOutPort( 'Min' )
119     OEndOfInitLoop_1Max = EndOfInitLoop_1.GetOutPort( 'Max' )
120     OEndOfInitLoop_1Gate = EndOfInitLoop_1.GetOutPort( 'Gate' )
121     InitLoop_1.SetName( 'InitLoop_1' )
122     InitLoop_1.SetAuthor( '' )
123     InitLoop_1.SetComment( 'Compute Node' )
124     InitLoop_1.Coords( 12 , 369 )
125     
126     # Creation of Switch Nodes
127     PySwitch = []
128     Switch,EndOfSwitch = GraphPyFunctions_1.SNode( 'Switch' , PySwitch )
129     EndOfSwitch.SetName( 'EndOfSwitch' )
130     EndOfSwitch.SetAuthor( '' )
131     EndOfSwitch.SetComment( 'Compute Node' )
132     EndOfSwitch.Coords( 587 , 126 )
133     PyEndOfSwitch = []
134     EndOfSwitch.SetPyFunction( 'EndOfSwitch_1' , PyEndOfSwitch )
135     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
136     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
137     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
138     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
139     Switch.SetName( 'Switch' )
140     Switch.SetAuthor( '' )
141     Switch.SetComment( 'Compute Node' )
142     Switch.Coords( 186 , 130 )
143     ISwitcha = Switch.InPort( 'a' , 'long' )
144     ISwitchGate = Switch.GetInPort( 'Gate' )
145     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
146     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
147     OSwitcha = Switch.OutPort( 'a' , 'int' )
148     OSwitchDefault = Switch.GetOutPort( 'Default' )
149     
150     PySwitch_1 = []
151     PySwitch_1.append( 'from time import *  ' )
152     PySwitch_1.append( 'def Switch(a) :    ' )
153     PySwitch_1.append( '    if ( a & 1 ) == 0 :  ' )
154     PySwitch_1.append( '        sleep(1)  ' )
155     PySwitch_1.append( '    return a & 1,1-(a&1),a    ' )
156     Switch_1,EndOfSwitch_1 = GraphPyFunctions_1.SNode( 'Switch' , PySwitch_1 )
157     EndOfSwitch_1.SetName( 'EndOfSwitch_1' )
158     EndOfSwitch_1.SetAuthor( '' )
159     EndOfSwitch_1.SetComment( 'Compute Node' )
160     EndOfSwitch_1.Coords( 594 , 362 )
161     PyEndOfSwitch_1 = []
162     EndOfSwitch_1.SetPyFunction( 'EndOfSwitch_1' , PyEndOfSwitch_1 )
163     IEndOfSwitch_1a = EndOfSwitch_1.InPort( 'a' , 'long' )
164     IEndOfSwitch_1Default = EndOfSwitch_1.GetInPort( 'Default' )
165     OEndOfSwitch_1a = EndOfSwitch_1.OutPort( 'a' , 'long' )
166     OEndOfSwitch_1Gate = EndOfSwitch_1.GetOutPort( 'Gate' )
167     Switch_1.SetName( 'Switch_1' )
168     Switch_1.SetAuthor( '' )
169     Switch_1.SetComment( 'Compute Node' )
170     Switch_1.Coords( 185 , 368 )
171     ISwitch_1a = Switch_1.InPort( 'a' , 'long' )
172     ISwitch_1Gate = Switch_1.GetInPort( 'Gate' )
173     OSwitch_1Odd = Switch_1.OutPort( 'Odd' , 'long' )
174     OSwitch_1Even = Switch_1.OutPort( 'Even' , 'int' )
175     OSwitch_1a = Switch_1.OutPort( 'a' , 'int' )
176     OSwitch_1Default = Switch_1.GetOutPort( 'Default' )
177     
178     # Creation of Links
179     LIsOddaEndOfSwitcha = GraphPyFunctions_1.Link( OIsOdda , IEndOfSwitcha )
180     LIsOddaEndOfSwitcha.AddCoord( 1 , 571 , 160 )
181     LIsOddaEndOfSwitcha.AddCoord( 2 , 571 , 129 )
182     
183     LIsOdd_1aEndOfSwitch_1a = GraphPyFunctions_1.Link( OIsOdd_1a , IEndOfSwitch_1a )
184     LIsOdd_1aEndOfSwitch_1a.AddCoord( 1 , 580 , 396 )
185     LIsOdd_1aEndOfSwitch_1a.AddCoord( 2 , 580 , 368 )
186     
187     LInitLoopIndexSwitcha = GraphPyFunctions_1.Link( OInitLoopIndex , ISwitcha )
188     
189     LInitLoopMinEndOfInitLoopMin = GraphPyFunctions_1.Link( OInitLoopMin , IEndOfInitLoopMin )
190     
191     LInitLoopMaxEndOfInitLoopMax = GraphPyFunctions_1.Link( OInitLoopMax , IEndOfInitLoopMax )
192     
193     LInitLoop_1IndexSwitch_1a = GraphPyFunctions_1.Link( OInitLoop_1Index , ISwitch_1a )
194     
195     LInitLoop_1MinEndOfInitLoop_1Min = GraphPyFunctions_1.Link( OInitLoop_1Min , IEndOfInitLoop_1Min )
196     
197     LInitLoop_1MaxEndOfInitLoop_1Max = GraphPyFunctions_1.Link( OInitLoop_1Max , IEndOfInitLoop_1Max )
198     
199     LSwitchOddIsOddGate = GraphPyFunctions_1.Link( OSwitchOdd , IIsOddGate )
200     
201     LSwitchaIsOdda = GraphPyFunctions_1.Link( OSwitcha , IIsOdda )
202     LSwitchaIsOdda.AddCoord( 1 , 366 , 131 )
203     LSwitchaIsOdda.AddCoord( 2 , 365 , 223 )
204     
205     LSwitchDefaultEndOfSwitchDefault = GraphPyFunctions_1.Link( OSwitchDefault , IEndOfSwitchDefault )
206     LSwitchDefaultEndOfSwitchDefault.AddCoord( 1 , 572 , 194 )
207     LSwitchDefaultEndOfSwitchDefault.AddCoord( 2 , 571 , 257 )
208     
209     LEndOfSwitchaEndOfInitLoopIndex = GraphPyFunctions_1.Link( OEndOfSwitcha , IEndOfInitLoopIndex )
210     
211     LSwitch_1OddIsOdd_1Gate = GraphPyFunctions_1.Link( OSwitch_1Odd , IIsOdd_1Gate )
212     
213     LSwitch_1aIsOdd_1a = GraphPyFunctions_1.Link( OSwitch_1a , IIsOdd_1a )
214     LSwitch_1aIsOdd_1a.AddCoord( 1 , 368 , 368 )
215     LSwitch_1aIsOdd_1a.AddCoord( 2 , 367 , 460 )
216     
217     LSwitch_1DefaultEndOfSwitch_1Default = GraphPyFunctions_1.Link( OSwitch_1Default , IEndOfSwitch_1Default )
218     
219     LEndOfSwitch_1aEndOfInitLoop_1Index = GraphPyFunctions_1.Link( OEndOfSwitch_1a , IEndOfInitLoop_1Index )
220     
221     # Input datas
222     IInitLoopIndex.Input( 0 )
223     IInitLoopMin.Input( 0 )
224     IInitLoopMax.Input( 25 )
225     IInitLoop_1Index.Input( 0 )
226     IInitLoop_1Min.Input( 0 )
227     IInitLoop_1Max.Input( 35 )
228     
229     # Output Ports of the graph
230     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
231     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
232     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
233     #OEndOfInitLoop_1Index = EndOfInitLoop_1.GetOutPort( 'Index' )
234     #OEndOfInitLoop_1Min = EndOfInitLoop_1.GetOutPort( 'Min' )
235     #OEndOfInitLoop_1Max = EndOfInitLoop_1.GetOutPort( 'Max' )
236     #OSwitchEven = Switch.GetOutPort( 'Even' )
237     #OSwitch_1Even = Switch_1.GetOutPort( 'Even' )
238     return GraphPyFunctions_1
239
240
241 GraphPyFunctions_1 = DefGraphPyFunctions_1()