1 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # Generated python file of Graph GraphSwitchCheckNoDefault2
26 # Graph creation of GraphSwitchCheckNoDefault2
27 def DefGraphSwitchCheckNoDefault2() :
28 GraphSwitchCheckNoDefault2 = Graph( 'GraphSwitchCheckNoDefault2' )
29 GraphSwitchCheckNoDefault2.SetName( 'GraphSwitchCheckNoDefault2' )
30 GraphSwitchCheckNoDefault2.SetAuthor( 'JR' )
31 GraphSwitchCheckNoDefault2.SetComment( '' )
32 GraphSwitchCheckNoDefault2.Coords( 0 , 0 )
34 # Creation of Factory Nodes
36 # Creation of InLine Nodes
38 PyIsOdd.append( 'from time import * ' )
39 PyIsOdd.append( 'def IsOdd(a) : ' )
40 PyIsOdd.append( ' print a,"IsOdd (GraphSwitch)" ' )
41 PyIsOdd.append( ' sleep( 1 ) ' )
42 PyIsOdd.append( ' return a ' )
43 IsOdd = GraphSwitchCheckNoDefault2.INode( 'IsOdd' , PyIsOdd )
44 IsOdd.SetName( 'IsOdd' )
46 IsOdd.SetComment( 'Python function' )
47 IsOdd.Coords( 415 , 7 )
48 IIsOdda = IsOdd.InPort( 'a' , 'long' )
49 IIsOddGate = IsOdd.GetInPort( 'Gate' )
50 OIsOdda = IsOdd.OutPort( 'a' , 'long' )
51 OIsOddGate = IsOdd.GetOutPort( 'Gate' )
54 PyIsEven.append( 'from time import * ' )
55 PyIsEven.append( 'def IsEven(a) : ' )
56 PyIsEven.append( ' print a,"IsEven (GraphSwitch)" ' )
57 PyIsEven.append( ' sleep( 1 ) ' )
58 PyIsEven.append( ' return a ' )
59 IsEven = GraphSwitchCheckNoDefault2.INode( 'IsEven' , PyIsEven )
60 IsEven.SetName( 'IsEven' )
61 IsEven.SetAuthor( '' )
62 IsEven.SetComment( 'Compute Node' )
63 IsEven.Coords( 421 , 438 )
64 IIsEvena = IsEven.InPort( 'a' , 'long' )
65 IIsEvenGate = IsEven.GetInPort( 'Gate' )
66 OIsEvena = IsEven.OutPort( 'a' , 'long' )
67 OIsEvenGate = IsEven.GetOutPort( 'Gate' )
70 PyPrintOdd.append( 'from time import * ' )
71 PyPrintOdd.append( 'def Print(a,Branch) : ' )
72 PyPrintOdd.append( ' print "Print ",a,Branch ' )
73 PyPrintOdd.append( ' sleep(1) ' )
74 PyPrintOdd.append( ' return Branch ' )
75 PrintOdd = GraphSwitchCheckNoDefault2.INode( 'Print' , PyPrintOdd )
76 PrintOdd.SetName( 'PrintOdd' )
77 PrintOdd.SetAuthor( '' )
78 PrintOdd.SetComment( 'Compute Node' )
79 PrintOdd.Coords( 415 , 130 )
80 IPrintOdda = PrintOdd.InPort( 'a' , 'long' )
81 IPrintOddBranch = PrintOdd.InPort( 'Branch' , 'string' )
82 IPrintOddGate = PrintOdd.GetInPort( 'Gate' )
83 OPrintOddBranch = PrintOdd.OutPort( 'Branch' , 'string' )
84 OPrintOddGate = PrintOdd.GetOutPort( 'Gate' )
87 PyPrintEven.append( 'from time import * ' )
88 PyPrintEven.append( 'def Print_1(a,Branch) : ' )
89 PyPrintEven.append( ' print "Print ",a,Branch ' )
90 PyPrintEven.append( ' sleep(1) ' )
91 PyPrintEven.append( ' return Branch ' )
92 PrintEven = GraphSwitchCheckNoDefault2.INode( 'Print_1' , PyPrintEven )
93 PrintEven.SetName( 'PrintEven' )
94 PrintEven.SetAuthor( '' )
95 PrintEven.SetComment( 'Compute Node' )
96 PrintEven.Coords( 423 , 289 )
97 IPrintEvena = PrintEven.InPort( 'a' , 'long' )
98 IPrintEvenBranch = PrintEven.InPort( 'Branch' , 'string' )
99 IPrintEvenGate = PrintEven.GetInPort( 'Gate' )
100 OPrintEvenBranch = PrintEven.OutPort( 'Branch' , 'string' )
101 OPrintEvenGate = PrintEven.GetOutPort( 'Gate' )
104 PyEmptyNode.append( 'from time import * ' )
105 PyEmptyNode.append( 'def EmptyNode(a,Branch) : ' )
106 PyEmptyNode.append( ' sleep(1) ' )
107 PyEmptyNode.append( ' return a,Branch ' )
108 EmptyNode = GraphSwitchCheckNoDefault2.INode( 'EmptyNode' , PyEmptyNode )
109 EmptyNode.SetName( 'EmptyNode' )
110 EmptyNode.SetAuthor( '' )
111 EmptyNode.SetComment( 'Compute Node' )
112 EmptyNode.Coords( 652 , 110 )
113 IEmptyNodea = EmptyNode.InPort( 'a' , 'long' )
114 IEmptyNodeBranch = EmptyNode.InPort( 'Branch' , 'string' )
115 IEmptyNodeGate = EmptyNode.GetInPort( 'Gate' )
116 OEmptyNodea = EmptyNode.OutPort( 'a' , 'long' )
117 OEmptyNodeBranch = EmptyNode.OutPort( 'Branch' , 'string' )
118 OEmptyNodeGate = EmptyNode.GetOutPort( 'Gate' )
121 PyDefault.append( 'from time import * ' )
122 PyDefault.append( 'def Default(a,Branch) : ' )
123 PyDefault.append( ' sleep(1) ' )
124 PyDefault.append( ' return a,Branch ' )
125 Default = GraphSwitchCheckNoDefault2.INode( 'Default' , PyDefault )
126 Default.SetName( 'Default' )
127 Default.SetAuthor( '' )
128 Default.SetComment( 'Compute Node' )
129 Default.Coords( 421 , 592 )
130 IDefaulta = Default.InPort( 'a' , 'long' )
131 IDefaultBranch = Default.InPort( 'Branch' , 'string' )
132 IDefaultGate = Default.GetInPort( 'Gate' )
133 ODefaulta = Default.OutPort( 'a' , 'long' )
134 ODefaultBranch = Default.OutPort( 'Branch' , 'string' )
135 ODefaultGate = Default.GetOutPort( 'Gate' )
138 PyPuta.append( 'from time import * ' )
139 PyPuta.append( 'def Puta(a) : ' )
140 PyPuta.append( ' sleep(1) ' )
141 PyPuta.append( ' return a ' )
142 Puta = GraphSwitchCheckNoDefault2.INode( 'Puta' , PyPuta )
143 Puta.SetName( 'Puta' )
145 Puta.SetComment( 'Compute Node' )
146 Puta.Coords( 665 , 486 )
147 IPutaa = Puta.InPort( 'a' , 'long' )
148 IPutaGate = Puta.GetInPort( 'Gate' )
149 OPutaa = Puta.OutPort( 'a' , 'long' )
150 OPutaGate = Puta.GetOutPort( 'Gate' )
153 PyPutBranch.append( 'from time import * ' )
154 PyPutBranch.append( 'def PutBranch(Branch) : ' )
155 PyPutBranch.append( ' sleep(1) ' )
156 PyPutBranch.append( ' return Branch ' )
157 PutBranch = GraphSwitchCheckNoDefault2.INode( 'PutBranch' , PyPutBranch )
158 PutBranch.SetName( 'PutBranch' )
159 PutBranch.SetAuthor( '' )
160 PutBranch.SetComment( 'Compute Node' )
161 PutBranch.Coords( 662 , 613 )
162 IPutBranchBranch = PutBranch.InPort( 'Branch' , 'string' )
163 IPutBranchGate = PutBranch.GetInPort( 'Gate' )
164 OPutBranchBranch = PutBranch.OutPort( 'Branch' , 'string' )
165 OPutBranchGate = PutBranch.GetOutPort( 'Gate' )
167 # Creation of Loop Nodes
168 PyInitLoopSwitch = []
169 PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) : ' )
170 PyInitLoopSwitch.append( ' Index = Max ' )
171 PyInitLoopSwitch.append( ' return Index,Min,Max ' )
172 PyMoreInitLoopSwitch = []
173 PyMoreInitLoopSwitch.append( 'from time import * ' )
174 PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' )
175 PyMoreInitLoopSwitch.append( ' sleep(1) ' )
176 PyMoreInitLoopSwitch.append( ' if Index >= Min : ' )
177 PyMoreInitLoopSwitch.append( ' DoLoop = 1 ' )
178 PyMoreInitLoopSwitch.append( ' else : ' )
179 PyMoreInitLoopSwitch.append( ' DoLoop = 0 ' )
180 PyMoreInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
181 PyNextInitLoopSwitch = []
182 PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) : ' )
183 PyNextInitLoopSwitch.append( ' Index = Index - 1 ' )
184 PyNextInitLoopSwitch.append( ' return Index,Min,Max ' )
185 InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchCheckNoDefault2.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
186 EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
187 EndOfInitLoopSwitch.SetAuthor( '' )
188 EndOfInitLoopSwitch.SetComment( 'Compute Node' )
189 EndOfInitLoopSwitch.Coords( 1074 , 194 )
190 PyEndOfInitLoopSwitch = []
191 PyEndOfInitLoopSwitch.append( 'from time import * ' )
192 PyEndOfInitLoopSwitch.append( 'def EndOfInitLoopSwitch(DoLoop,Index,Min,Max) : ' )
193 PyEndOfInitLoopSwitch.append( ' sleep(1) ' )
194 PyEndOfInitLoopSwitch.append( ' return DoLoop,Index,Min,Max ' )
195 EndOfInitLoopSwitch.SetPyFunction( 'EndOfInitLoopSwitch' , PyEndOfInitLoopSwitch )
196 IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
197 IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
198 IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
199 IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
200 IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
201 OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
202 OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
203 OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
204 OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
205 IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
206 IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
207 IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
208 IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
209 IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
210 OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
211 OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
212 OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
213 OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
214 OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
215 InitLoopSwitch.SetName( 'InitLoopSwitch' )
216 InitLoopSwitch.SetAuthor( '' )
217 InitLoopSwitch.SetComment( 'Compute Node' )
218 InitLoopSwitch.Coords( 10 , 129 )
220 # Creation of Switch Nodes
222 PySwitch.append( 'from time import * ' )
223 PySwitch.append( 'def Switch(a) : ' )
224 PySwitch.append( ' sleep(1) ' )
225 PySwitch.append( ' Branch = "Negative or null" ' )
226 PySwitch.append( ' if a <= 0 : ' )
227 PySwitch.append( ' return 0,0,a,Branch,1 ' )
228 PySwitch.append( ' if ( a & 1 ) == 0 : ' )
229 PySwitch.append( ' Branch = "Even" ' )
230 PySwitch.append( ' else : ' )
231 PySwitch.append( ' Branch = "Odd" ' )
232 PySwitch.append( ' return a & 1,1-(a&1),a,Branch,0 ' )
233 Switch,EndOfSwitch = GraphSwitchCheckNoDefault2.SNode( 'Switch' , PySwitch )
234 EndOfSwitch.SetName( 'EndOfSwitch' )
235 EndOfSwitch.SetAuthor( '' )
236 EndOfSwitch.SetComment( 'Compute Node' )
237 EndOfSwitch.Coords( 882 , 194 )
239 PyEndOfSwitch.append( 'from time import * ' )
240 PyEndOfSwitch.append( 'def EndOfSwitch(a,Branch) : ' )
241 PyEndOfSwitch.append( ' sleep(1) ' )
242 PyEndOfSwitch.append( ' return a ' )
243 EndOfSwitch.SetPyFunction( 'EndOfSwitch' , PyEndOfSwitch )
244 IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
245 IEndOfSwitchBranch = EndOfSwitch.InPort( 'Branch' , 'string' )
246 IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
247 OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
248 OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
249 Switch.SetName( 'Switch' )
250 Switch.SetAuthor( '' )
251 Switch.SetComment( 'Compute Node' )
252 Switch.Coords( 190 , 129 )
253 ISwitcha = Switch.InPort( 'a' , 'long' )
254 ISwitchGate = Switch.GetInPort( 'Gate' )
255 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
256 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
257 OSwitcha = Switch.OutPort( 'a' , 'int' )
258 OSwitchBranch = Switch.OutPort( 'Branch' , 'string' )
259 OSwitchdefault = Switch.OutPort( 'default' , 'boolean' )
260 OSwitchDefault = Switch.GetOutPort( 'Default' )
263 LIsOddaEmptyNodea = GraphSwitchCheckNoDefault2.Link( OIsOdda , IEmptyNodea )
264 LIsOddaEmptyNodea.AddCoord( 1 , 646 , 78 )
266 LIsEvenaEndOfSwitcha = GraphSwitchCheckNoDefault2.Link( OIsEvena , IEndOfSwitcha )
268 LPrintOddBranchEmptyNodeBranch = GraphSwitchCheckNoDefault2.Link( OPrintOddBranch , IEmptyNodeBranch )
270 LPrintEvenBranchEndOfSwitchBranch = GraphSwitchCheckNoDefault2.Link( OPrintEvenBranch , IEndOfSwitchBranch )
272 LEmptyNodeaEndOfSwitcha = GraphSwitchCheckNoDefault2.Link( OEmptyNodea , IEndOfSwitcha )
274 LEmptyNodeBranchEndOfSwitchBranch = GraphSwitchCheckNoDefault2.Link( OEmptyNodeBranch , IEndOfSwitchBranch )
276 LDefaultaPutaa = GraphSwitchCheckNoDefault2.Link( ODefaulta , IPutaa )
278 LDefaultBranchPutBranchBranch = GraphSwitchCheckNoDefault2.Link( ODefaultBranch , IPutBranchBranch )
280 LInitLoopSwitchIndexSwitcha = GraphSwitchCheckNoDefault2.Link( OInitLoopSwitchIndex , ISwitcha )
282 LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchCheckNoDefault2.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
284 LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchCheckNoDefault2.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
286 LSwitchOddIsOddGate = GraphSwitchCheckNoDefault2.Link( OSwitchOdd , IIsOddGate )
287 LSwitchOddIsOddGate.AddCoord( 1 , 401 , 101 )
288 LSwitchOddIsOddGate.AddCoord( 2 , 401 , 160 )
290 LSwitchOddPrintOddGate = GraphSwitchCheckNoDefault2.Link( OSwitchOdd , IPrintOddGate )
291 LSwitchOddPrintOddGate.AddCoord( 1 , 401 , 245 )
292 LSwitchOddPrintOddGate.AddCoord( 2 , 401 , 159 )
294 LSwitchEvenIsEvenGate = GraphSwitchCheckNoDefault2.Link( OSwitchEven , IIsEvenGate )
295 LSwitchEvenIsEvenGate.AddCoord( 1 , 392 , 533 )
296 LSwitchEvenIsEvenGate.AddCoord( 2 , 392 , 182 )
298 LSwitchEvenPrintEvenGate = GraphSwitchCheckNoDefault2.Link( OSwitchEven , IPrintEvenGate )
299 LSwitchEvenPrintEvenGate.AddCoord( 1 , 392 , 403 )
300 LSwitchEvenPrintEvenGate.AddCoord( 2 , 392 , 181 )
302 LSwitchaIsOdda = GraphSwitchCheckNoDefault2.Link( OSwitcha , IIsOdda )
303 LSwitchaIsOdda.AddCoord( 1 , 382 , 78 )
304 LSwitchaIsOdda.AddCoord( 2 , 382 , 199 )
306 LSwitchaIsEvena = GraphSwitchCheckNoDefault2.Link( OSwitcha , IIsEvena )
307 LSwitchaIsEvena.AddCoord( 1 , 381 , 509 )
308 LSwitchaIsEvena.AddCoord( 2 , 382 , 200 )
310 LSwitchaPrintOdda = GraphSwitchCheckNoDefault2.Link( OSwitcha , IPrintOdda )
312 LSwitchaPrintEvena = GraphSwitchCheckNoDefault2.Link( OSwitcha , IPrintEvena )
313 LSwitchaPrintEvena.AddCoord( 1 , 381 , 361 )
314 LSwitchaPrintEvena.AddCoord( 2 , 382 , 200 )
316 LSwitchaDefaulta = GraphSwitchCheckNoDefault2.Link( OSwitcha , IDefaulta )
317 LSwitchaDefaulta.AddCoord( 1 , 382 , 663 )
318 LSwitchaDefaulta.AddCoord( 2 , 382 , 199 )
320 LSwitchBranchPrintOddBranch = GraphSwitchCheckNoDefault2.Link( OSwitchBranch , IPrintOddBranch )
322 LSwitchBranchPrintEvenBranch = GraphSwitchCheckNoDefault2.Link( OSwitchBranch , IPrintEvenBranch )
323 LSwitchBranchPrintEvenBranch.AddCoord( 1 , 369 , 381 )
324 LSwitchBranchPrintEvenBranch.AddCoord( 2 , 369 , 219 )
326 LSwitchBranchDefaultBranch = GraphSwitchCheckNoDefault2.Link( OSwitchBranch , IDefaultBranch )
327 LSwitchBranchDefaultBranch.AddCoord( 1 , 370 , 683 )
328 LSwitchBranchDefaultBranch.AddCoord( 2 , 370 , 220 )
330 LSwitchdefaultDefaultGate = GraphSwitchCheckNoDefault2.Link( OSwitchdefault , IDefaultGate )
331 LSwitchdefaultDefaultGate.AddCoord( 1 , 363 , 707 )
332 LSwitchdefaultDefaultGate.AddCoord( 2 , 362 , 239 )
334 LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchCheckNoDefault2.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
336 LPutaaEndOfSwitcha = GraphSwitchCheckNoDefault2.Link( OPutaa , IEndOfSwitcha )
338 LPutBranchBranchEndOfSwitchBranch = GraphSwitchCheckNoDefault2.Link( OPutBranchBranch , IEndOfSwitchBranch )
341 IInitLoopSwitchIndex.Input( 0 )
342 IInitLoopSwitchMin.Input( -5 )
343 IInitLoopSwitchMax.Input( 10 )
345 # Output Ports of the graph
346 #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
347 #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
348 #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
349 return GraphSwitchCheckNoDefault2
352 GraphSwitchCheckNoDefault2 = DefGraphSwitchCheckNoDefault2()