Salome HOME
782ac5258fd1d92b68ae984209d06d4368849c93
[modules/superv.git] / GraphLoop.py
1
2 # Generated python file of Graph GraphLoop
3
4 from SuperV import *
5 # Graph creation 
6 GraphLoop = Graph( 'GraphLoop' )
7 GraphLoop.SetName( 'GraphLoop' )
8 GraphLoop.SetAuthor( '' )
9 GraphLoop.SetComment( '' )
10 GraphLoop.Coords( 0 , 0 )
11
12 # Creation of Factory Nodes
13
14 # Creation of Loop Nodes
15 PyInit = []
16 PyInit.append( 'import time' )
17 PyInit.append( 'def Init(Index,Min,Max,Incr) :  ' )
18 PyInit.append( '    if Min <= Max :  ' )
19 PyInit.append( '        Index = Min  ' )
20 PyInit.append( '    else :  ' )
21 PyInit.append( '        Index = Max  ' )
22 PyInit.append( '    time.sleep( 1 )' )
23 PyInit.append( '    return Index,Min,Max,Incr  ' )
24 PyMoreInit = []
25 PyMoreInit.append( 'import time' )
26 PyMoreInit.append( 'def More(Index,Min,Max,Incr) :  ' )
27 PyMoreInit.append( '    if Index < Max :  ' )
28 PyMoreInit.append( '        DoLoop = 1  ' )
29 PyMoreInit.append( '    else :  ' )
30 PyMoreInit.append( '        DoLoop = 0  ' )
31 PyMoreInit.append( '    time.sleep( 1 )' )
32 PyMoreInit.append( '    return DoLoop,Index,Min,Max,Incr  ' )
33 PyNextInit = []
34 PyNextInit.append( 'import time' )
35 PyNextInit.append( 'def Next(Index,Min,Max,Incr) :  ' )
36 PyNextInit.append( '    Index = Index + Incr  ' )
37 PyNextInit.append( '    time.sleep( 1 )' )
38 PyNextInit.append( '    return Index,Min,Max,Incr ' )
39 Init,EndInit = GraphLoop.LNode( 'Init' , PyInit , 'More' , PyMoreInit , 'Next' , PyNextInit )
40 EndInit.SetName( 'EndInit' )
41 EndInit.SetAuthor( '' )
42 EndInit.SetComment( '' )
43 EndInit.Coords( 626 , 259 )
44 Init.InPort( 'Index' , 'long' )
45 Init.InPort( 'Min' , 'long' )
46 Init.InPort( 'Max' , 'long' )
47 Init.InPort( 'Incr' , 'long' )
48 Init.OutPort( 'Index' , 'long' )
49 Init.OutPort( 'Min' , 'long' )
50 Init.OutPort( 'Max' , 'long' )
51 Init.OutPort( 'Incr' , 'long' )
52 Init.SetName( 'Init' )
53 Init.SetAuthor( '' )
54 Init.SetComment( '' )
55 Init.Coords( 17 , 257 )
56
57 # Creation of intermediate Output variables and of Control Links
58 InitDoLoop = Init.Port( 'DoLoop' )
59 EndInitDoLoop = GraphLoop.Link( InitDoLoop , EndInit.Port( 'DoLoop' ) )
60 InitIndex = Init.Port( 'Index' )
61 EndInitIndex = GraphLoop.Link( InitIndex , EndInit.Port( 'Index' ) )
62 InitMin = Init.Port( 'Min' )
63 EndInitMin = GraphLoop.Link( InitMin , EndInit.Port( 'Min' ) )
64 InitMax = Init.Port( 'Max' )
65 EndInitMax = GraphLoop.Link( InitMax , EndInit.Port( 'Max' ) )
66 InitIncr = Init.Port( 'Incr' )
67 EndInitIncr = GraphLoop.Link( InitIncr , EndInit.Port( 'Incr' ) )
68 EndInitDoLoop = EndInit.Port( 'DoLoop' )
69 InitInitLoop = GraphLoop.Link( EndInitDoLoop , Init.Port( 'InitLoop' ) )
70
71 # Creation of Input datas
72 InitIndex = Init.Input( 'Index' , 0)
73 InitMin = Init.Input( 'Min' , 0)
74 InitMax = Init.Input( 'Max' , 10)
75 InitIncr = Init.Input( 'Incr' , 1)
76
77 # Creation of Output variables
78 EndInitIndex = EndInit.Port( 'Index' )
79 EndInitMin = EndInit.Port( 'Min' )
80 EndInitMax = EndInit.Port( 'Max' )
81 EndInitIncr = EndInit.Port( 'Incr' )
82
83 GraphLoop.Run()
84
85 GraphLoop.DoneW()
86
87 GraphLoop.PrintPorts()
88