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