Salome HOME
d8481510afd5510375fc7e6230f51e45e8a208e1
[samples/datafiles.git] / Superv / Python / GraphEditGraphSwitchs_1.py
1
2 # Generated python file of Graph GraphEditSwitchs
3
4 from SuperV import *
5
6 # Graph creation of GraphEditSwitchs
7 def DefGraphEditSwitchs() :
8     GraphEditSwitchs = Graph( 'GraphEditSwitchs' )
9     GraphEditSwitchs.SetName( 'GraphEditSwitchs' )
10     GraphEditSwitchs.SetAuthor( '' )
11     GraphEditSwitchs.SetComment( '' )
12     GraphEditSwitchs.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) :       ' )
20     PyIsOdd.append( '    print a,"IsOdd (GraphSwitchs)"      ' )
21     PyIsOdd.append( '    sleep( 1 )   ' )
22     PyIsOdd.append( '    return a     ' )
23     IsOdd = GraphEditSwitchs.INode( 'IsOdd' , PyIsOdd )
24     IsOdd.SetName( 'IsOdd' )
25     IsOdd.SetAuthor( '' )
26     IsOdd.SetComment( 'Python function' )
27     IsOdd.Coords( 388 , 50 )
28     IIsOdda = IsOdd.InPort( 'a' , 'long' )
29     IIsOddGate = IsOdd.GetInPort( 'Gate' )
30     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
31     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
32     
33     PyIsOdd_1 = []
34     PyIsOdd_1.append( 'from time import *   ' )
35     PyIsOdd_1.append( 'def IsOdd(a) :       ' )
36     PyIsOdd_1.append( '    print a,"IsOdd_1 (GraphSwitchs)"      ' )
37     PyIsOdd_1.append( '    sleep( 1 )   ' )
38     PyIsOdd_1.append( '    return a     ' )
39     IsOdd_1 = GraphEditSwitchs.INode( 'IsOdd' , PyIsOdd_1 )
40     IsOdd_1.SetName( 'IsOdd_1' )
41     IsOdd_1.SetAuthor( '' )
42     IsOdd_1.SetComment( 'Python function' )
43     IsOdd_1.Coords( 419 , 308 )
44     IIsOdd_1a = IsOdd_1.InPort( 'a' , 'long' )
45     IIsOdd_1Gate = IsOdd_1.GetInPort( 'Gate' )
46     OIsOdd_1a = IsOdd_1.OutPort( 'a' , 'long' )
47     OIsOdd_1Gate = IsOdd_1.GetOutPort( 'Gate' )
48     
49     # Creation of Loop Nodes
50     PyInitLoop = []
51     PyInitLoop.append( 'def InitLoop(Index,Min,Max) :      ' )
52     PyInitLoop.append( '        return Index,Min,Max     ' )
53     PyMoreInitLoop = []
54     PyMoreInitLoop.append( 'def MoreLoop(Index,Min,Max) :     ' )
55     PyMoreInitLoop.append( '    if Index <= Max :   ' )
56     PyMoreInitLoop.append( '            DoLoop = 1     ' )
57     PyMoreInitLoop.append( '    else :     ' )
58     PyMoreInitLoop.append( '            DoLoop = 0     ' )
59     PyMoreInitLoop.append( '    return DoLoop,Index,Min,Max     ' )
60     PyNextInitLoop = []
61     PyNextInitLoop.append( 'def NextLoop(Index,Min,Max) :     ' )
62     PyNextInitLoop.append( '    Index = Index + 1     ' )
63     PyNextInitLoop.append( '    return Index,Min,Max     ' )
64     InitLoop,EndOfInitLoop = GraphEditSwitchs.LNode( 'InitLoop' , PyInitLoop , 'MoreLoop' , PyMoreInitLoop , 'NextLoop' , PyNextInitLoop )
65     EndOfInitLoop.SetName( 'EndOfInitLoop' )
66     EndOfInitLoop.SetAuthor( '' )
67     EndOfInitLoop.SetComment( 'Compute Node' )
68     EndOfInitLoop.Coords( 783 , 381 )
69     PyEndOfInitLoop = []
70     EndOfInitLoop.SetPyFunction( '' , PyEndOfInitLoop )
71     IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
72     IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
73     IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
74     IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
75     IInitLoopGate = InitLoop.GetInPort( 'Gate' )
76     OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
77     OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
78     OInitLoopMin = InitLoop.GetOutPort( 'Min' )
79     OInitLoopMax = InitLoop.GetOutPort( 'Max' )
80     IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
81     IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
82     IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
83     IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
84     IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
85     OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
86     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
87     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
88     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
89     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
90     InitLoop.SetName( 'InitLoop' )
91     InitLoop.SetAuthor( '' )
92     InitLoop.SetComment( 'Compute Node' )
93     InitLoop.Coords( 10 , 388 )
94     
95     # Creation of Switch Nodes
96     PySwitch = []
97     PySwitch.append( 'from time import * ' )
98     PySwitch.append( 'def Switch(a) :   ' )
99     PySwitch.append( '    if ( a & 1 ) == 0 : ' )
100     PySwitch.append( '        sleep(1)    ' )
101     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
102     Switch,EndOfSwitch = GraphEditSwitchs.SNode( 'Switch' , PySwitch )
103     EndOfSwitch.SetName( 'EndOfSwitch' )
104     EndOfSwitch.SetAuthor( '' )
105     EndOfSwitch.SetComment( 'Compute Node' )
106     EndOfSwitch.Coords( 587 , 126 )
107     PyEndOfSwitch = []
108     EndOfSwitch.SetPyFunction( '' , PyEndOfSwitch )
109     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
110     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
111     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
112     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
113     Switch.SetName( 'Switch' )
114     Switch.SetAuthor( '' )
115     Switch.SetComment( 'Compute Node' )
116     Switch.Coords( 186 , 130 )
117     ISwitcha = Switch.InPort( 'a' , 'long' )
118     ISwitchGate = Switch.GetInPort( 'Gate' )
119     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
120     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
121     OSwitcha = Switch.OutPort( 'a' , 'int' )
122     OSwitchDefault = Switch.GetOutPort( 'Default' )
123     
124     PySwitch_1 = []
125     PySwitch_1.append( 'from time import *  ' )
126     PySwitch_1.append( 'def Switch(a) :    ' )
127     PySwitch_1.append( '    if ( a & 1 ) == 0 :  ' )
128     PySwitch_1.append( '        sleep(1)  ' )
129     PySwitch_1.append( '    return a & 1,1-(a&1),a    ' )
130     Switch_1,EndSwitch = GraphEditSwitchs.SNode( 'Switch' , PySwitch_1 )
131     EndSwitch.SetName( 'EndSwitch' )
132     EndSwitch.SetAuthor( '' )
133     EndSwitch.SetComment( 'Compute Node' )
134     EndSwitch.Coords( 605 , 382 )
135     PyEndSwitch = []
136     EndSwitch.SetPyFunction( '' , PyEndSwitch )
137     IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
138     IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
139     OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
140     OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
141     Switch_1.SetName( 'Switch_1' )
142     Switch_1.SetAuthor( '' )
143     Switch_1.SetComment( 'Compute Node' )
144     Switch_1.Coords( 193 , 388 )
145     ISwitch_1a = Switch_1.InPort( 'a' , 'long' )
146     ISwitch_1Gate = Switch_1.GetInPort( 'Gate' )
147     OSwitch_1Odd = Switch_1.OutPort( 'Odd' , 'long' )
148     OSwitch_1Even = Switch_1.OutPort( 'Even' , 'int' )
149     OSwitch_1a = Switch_1.OutPort( 'a' , 'int' )
150     OSwitch_1Default = Switch_1.GetOutPort( 'Default' )
151     
152     # Creation of Links
153     LIsOddaEndOfSwitcha = GraphEditSwitchs.Link( OIsOdda , IEndOfSwitcha )
154     LIsOddaEndOfSwitcha.AddCoord( 1 , 573 , 160 )
155     LIsOddaEndOfSwitcha.AddCoord( 2 , 572 , 130 )
156     
157     LIsOdd_1aEndSwitcha = GraphEditSwitchs.Link( OIsOdd_1a , IEndSwitcha )
158     LIsOdd_1aEndSwitcha.AddCoord( 1 , 599 , 416 )
159     LIsOdd_1aEndSwitcha.AddCoord( 2 , 598 , 389 )
160     
161     LInitLoopIndexSwitch_1a = GraphEditSwitchs.Link( OInitLoopIndex , ISwitch_1a )
162     
163     LInitLoopMinEndOfInitLoopMin = GraphEditSwitchs.Link( OInitLoopMin , IEndOfInitLoopMin )
164     
165     LInitLoopMaxEndOfInitLoopMax = GraphEditSwitchs.Link( OInitLoopMax , IEndOfInitLoopMax )
166     
167     LSwitchOddIsOddGate = GraphEditSwitchs.Link( OSwitchOdd , IIsOddGate )
168     
169     LSwitchaIsOdda = GraphEditSwitchs.Link( OSwitcha , IIsOdda )
170     LSwitchaIsOdda.AddCoord( 1 , 365 , 129 )
171     LSwitchaIsOdda.AddCoord( 2 , 365 , 222 )
172     
173     LSwitchDefaultEndOfSwitchDefault = GraphEditSwitchs.Link( OSwitchDefault , IEndOfSwitchDefault )
174     LSwitchDefaultEndOfSwitchDefault.AddCoord( 1 , 572 , 194 )
175     LSwitchDefaultEndOfSwitchDefault.AddCoord( 2 , 571 , 257 )
176     
177     LSwitch_1OddIsOdd_1Gate = GraphEditSwitchs.Link( OSwitch_1Odd , IIsOdd_1Gate )
178     
179     LSwitch_1EvenEndSwitchDefault = GraphEditSwitchs.Link( OSwitch_1Even , IEndSwitchDefault )
180     
181     LSwitch_1aIsOdd_1a = GraphEditSwitchs.Link( OSwitch_1a , IIsOdd_1a )
182     LSwitch_1aIsOdd_1a.AddCoord( 1 , 379 , 387 )
183     LSwitch_1aIsOdd_1a.AddCoord( 2 , 378 , 481 )
184     
185     LEndSwitchaEndOfInitLoopIndex = GraphEditSwitchs.Link( OEndSwitcha , IEndOfInitLoopIndex )
186     
187     # Input datas
188     IInitLoopIndex.Input( 0 )
189     IInitLoopMin.Input( 0 )
190     IInitLoopMax.Input( 20 )
191     
192     # Input Ports of the graph
193     #ISwitcha = Switch.GetInPort( 'a' )
194     
195     # Output Ports of the graph
196     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
197     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
198     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
199     #OSwitchEven = Switch.GetOutPort( 'Even' )
200     #OEndOfSwitcha = EndOfSwitch.GetOutPort( 'a' )
201     return GraphEditSwitchs
202
203
204 GraphEditSwitchs = DefGraphEditSwitchs()