Salome HOME
NRI : Merge from BRANCH_Superv_DataStream.
[modules/superv.git] / examples / 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( 'def Init(Index,Min,Max,Incr) :  ' )
17 PyInit.append( '    if Min <= Max :  ' )
18 PyInit.append( '        Index = Min  ' )
19 PyInit.append( '    else :  ' )
20 PyInit.append( '        Index = Max  ' )
21 PyInit.append( '    return Index,Min,Max,Incr  ' )
22 PyMoreInit = []
23 PyMoreInit.append( 'def More(Index,Min,Max,Incr) :  ' )
24 PyMoreInit.append( '    if Index < Max :  ' )
25 PyMoreInit.append( '        DoLoop = 1  ' )
26 PyMoreInit.append( '    else :  ' )
27 PyMoreInit.append( '        DoLoop = 0  ' )
28 PyMoreInit.append( '    return DoLoop,Index,Min,Max,Incr  ' )
29 PyNextInit = []
30 PyNextInit.append( 'def Next(Index,Min,Max,Incr) :  ' )
31 PyNextInit.append( '    Index = Index + Incr  ' )
32 PyNextInit.append( '    return Index,Min,Max,Incr ' )
33 Init,EndInit = GraphLoop.LNode( 'Init' , PyInit , 'More' , PyMoreInit , 'Next' , PyNextInit )
34 EndInit.SetName( 'EndInit' )
35 EndInit.SetAuthor( '' )
36 EndInit.SetComment( '' )
37 EndInit.Coords( 314 , 91 )
38 Init.InPort( 'Index' , 'long' )
39 Init.InPort( 'Min' , 'long' )
40 Init.InPort( 'Max' , 'long' )
41 Init.InPort( 'Incr' , 'long' )
42 Init.OutPort( 'Index' , 'long' )
43 Init.OutPort( 'Min' , 'long' )
44 Init.OutPort( 'Max' , 'long' )
45 Init.OutPort( 'Incr' , 'long' )
46 Init.SetName( 'Init' )
47 Init.SetAuthor( '' )
48 Init.SetComment( '' )
49 Init.Coords( 31 , 74 )
50
51 # Creation of Links
52 InitIndex = Init.Port( 'Index' )
53 EndInitIndex = GraphLoop.Link( InitIndex , EndInit.Port( 'Index' ) )
54
55 InitMin = Init.Port( 'Min' )
56 EndInitMin = GraphLoop.Link( InitMin , EndInit.Port( 'Min' ) )
57
58 InitMax = Init.Port( 'Max' )
59 EndInitMax = GraphLoop.Link( InitMax , EndInit.Port( 'Max' ) )
60
61 InitIncr = Init.Port( 'Incr' )
62 EndInitIncr = GraphLoop.Link( InitIncr , EndInit.Port( 'Incr' ) )
63
64 # Creation of Input datas
65 InitIndex = Init.Input( 'Index' , 0)
66 InitMin = Init.Input( 'Min' , 0)
67 InitMax = Init.Input( 'Max' , 1000)
68 InitIncr = Init.Input( 'Incr' , 1)
69
70 # Creation of Output variables
71 EndInitIndex = EndInit.Port( 'Index' )
72 EndInitMin = EndInit.Port( 'Min' )
73 EndInitMax = EndInit.Port( 'Max' )
74 EndInitIncr = EndInit.Port( 'Incr' )
75
76 GraphLoop.Run()
77
78 GraphLoop.DoneW()
79
80 GraphLoop.PrintPorts()
81