Salome HOME
Imported using TkCVS
[samples/datafiles.git] / Superv / Python / GraphInputInLoop.py
1
2 # Generated python file of Graph GraphInputInLoop_2_1
3
4 from SuperV import *
5
6 # Graph creation of GraphInputInLoop_2_1
7 def DefGraphInputInLoop_2_1() :
8     GraphInputInLoop_2_1 = Graph( 'GraphInputInLoop_2_1' )
9     GraphInputInLoop_2_1.SetName( 'GraphInputInLoop_2_1' )
10     GraphInputInLoop_2_1.SetAuthor( '' )
11     GraphInputInLoop_2_1.SetComment( '' )
12     GraphInputInLoop_2_1.Coords( 0 , 0 )
13     
14     # Creation of Factory Nodes
15     
16     # Creation of InLine Nodes
17     PyIsOdd = []
18     PyIsOdd.append( 'from time import *      ' )
19     PyIsOdd.append( 'def IsOdd(a,Even,Const) :  ' )
20     PyIsOdd.append( '    print 'IsOdd',a,Even,Const  ' )
21     PyIsOdd.append( '    sleep( 1 )      ' )
22     PyIsOdd.append( '    return a,Const ' )
23     IsOdd = GraphInputInLoop_2_1.INode( 'IsOdd' , PyIsOdd )
24     IsOdd.SetName( 'IsOdd' )
25     IsOdd.SetAuthor( '' )
26     IsOdd.SetComment( 'Python function' )
27     IsOdd.Coords( 397 , 5 )
28     IIsOdda = IsOdd.InPort( 'a' , 'long' )
29     IIsOddEven = IsOdd.InPort( 'Even' , 'boolean' )
30     IIsOddConst = IsOdd.InPort( 'Const' , 'string' )
31     IIsOddGate = IsOdd.GetInPort( 'Gate' )
32     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
33     OIsOddConst = IsOdd.OutPort( 'Const' , 'string' )
34     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
35     
36     # Creation of Loop Nodes
37     PyInitLoop = []
38     PyMoreInitLoop = []
39     PyMoreInitLoop.append( '' )
40     PyNextInitLoop = []
41     PyNextInitLoop.append( '' )
42     InitLoop,EndOfInitLoop = GraphInputInLoop_2_1.LNode( '' , PyInitLoop , '' , PyMoreInitLoop , '' , PyNextInitLoop )
43     EndOfInitLoop.SetName( 'EndOfInitLoop' )
44     EndOfInitLoop.SetAuthor( '' )
45     EndOfInitLoop.SetComment( 'Compute Node' )
46     EndOfInitLoop.Coords( 770 , 147 )
47     PyEndOfInitLoop = []
48     PyEndOfInitLoop.append( 'def EndOfInitLoop( DoLoop , Index , Min , Max ) :' )
49     PyEndOfInitLoop.append( '   Index = Index + 1     ' )
50     PyEndOfInitLoop.append( '   if Index <= Max :   ' )
51     PyEndOfInitLoop.append( '           DoLoop = 1     ' )
52     PyEndOfInitLoop.append( '   else :     ' )
53     PyEndOfInitLoop.append( '           DoLoop = 0     ' )
54     PyEndOfInitLoop.append( '   return DoLoop,Index,Min,Max     ' )
55     EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
56     IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
57     IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
58     IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
59     IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
60     IInitLoopGate = InitLoop.GetInPort( 'Gate' )
61     OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
62     OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
63     OInitLoopMin = InitLoop.GetOutPort( 'Min' )
64     OInitLoopMax = InitLoop.GetOutPort( 'Max' )
65     IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
66     IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
67     IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
68     IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
69     IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
70     OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
71     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
72     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
73     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
74     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
75     InitLoop.SetName( 'InitLoop' )
76     InitLoop.SetAuthor( '' )
77     InitLoop.SetComment( 'Compute Node' )
78     InitLoop.Coords( 10 , 108 )
79     
80     # Creation of Switch Nodes
81     PySwitch = []
82     PySwitch.append( 'from time import *  ' )
83     PySwitch.append( 'def Switch(a) :    ' )
84     PySwitch.append( '    if ( a & 1 ) == 0 :  ' )
85     PySwitch.append( '        sleep(1)  ' )
86     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
87     Switch,EndSwitch = GraphInputInLoop_2_1.SNode( 'Switch' , PySwitch )
88     EndSwitch.SetName( 'EndSwitch' )
89     EndSwitch.SetAuthor( '' )
90     EndSwitch.SetComment( 'Compute Node' )
91     EndSwitch.Coords( 588 , 147 )
92     PyEndSwitch = []
93     PyEndSwitch.append( 'def EndSwitch(a) :    ' )
94     PyEndSwitch.append( '    if ( a & 1 ) == 0 :  ' )
95     PyEndSwitch.append( '        sleep(1)  ' )
96     PyEndSwitch.append( '    return a    ' )
97     EndSwitch.SetPyFunction( 'EndSwitch' , PyEndSwitch )
98     IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
99     IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
100     OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
101     OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
102     Switch.SetName( 'Switch' )
103     Switch.SetAuthor( '' )
104     Switch.SetComment( 'Compute Node' )
105     Switch.Coords( 194 , 109 )
106     ISwitcha = Switch.InPort( 'a' , 'long' )
107     ISwitchGate = Switch.GetInPort( 'Gate' )
108     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
109     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
110     OSwitcha = Switch.OutPort( 'a' , 'int' )
111     OSwitchDefault = Switch.GetOutPort( 'Default' )
112     
113     # Creation of Links
114     LIsOddaEndSwitcha = GraphInputInLoop_2_1.Link( OIsOdda , IEndSwitcha )
115     LIsOddaEndSwitcha.AddCoord( 1 , 573 , 178 )
116     LIsOddaEndSwitcha.AddCoord( 2 , 573 , 76 )
117     
118     LInitLoopIndexSwitcha = GraphInputInLoop_2_1.Link( OInitLoopIndex , ISwitcha )
119     
120     LInitLoopMinEndOfInitLoopMin = GraphInputInLoop_2_1.Link( OInitLoopMin , IEndOfInitLoopMin )
121     
122     LInitLoopMaxEndOfInitLoopMax = GraphInputInLoop_2_1.Link( OInitLoopMax , IEndOfInitLoopMax )
123     
124     LSwitchOddIsOddGate = GraphInputInLoop_2_1.Link( OSwitchOdd , IIsOddGate )
125     
126     LSwitchEvenIsOddEven = GraphInputInLoop_2_1.Link( OSwitchEven , IIsOddEven )
127     
128     LSwitchaIsOdda = GraphInputInLoop_2_1.Link( OSwitcha , IIsOdda )
129     LSwitchaIsOdda.AddCoord( 1 , 366 , 71 )
130     LSwitchaIsOdda.AddCoord( 2 , 366 , 182 )
131     
132     LSwitchDefaultEndSwitchDefault = GraphInputInLoop_2_1.Link( OSwitchDefault , IEndSwitchDefault )
133     
134     LEndSwitchaEndOfInitLoopIndex = GraphInputInLoop_2_1.Link( OEndSwitcha , IEndOfInitLoopIndex )
135     
136     # Input datas
137     IIsOddConst.Input( 'Const Input Value' )
138     IInitLoopIndex.Input( 0 )
139     IInitLoopMin.Input( 0 )
140     IInitLoopMax.Input( 23 )
141     
142     # Output Ports of the graph
143     #OIsOddConst = IsOdd.GetOutPort( 'Const' )
144     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
145     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
146     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
147     return GraphInputInLoop_2_1
148
149
150 GraphInputInLoop_2_1 = DefGraphInputInLoop_2_1()