Salome HOME
Fix for bug IPAL10200 : "Author" field is not saved in the copy of dataflow in the...
[modules/superv.git] / examples / GraphEditGraphSwitchs_5.py
1
2 # Generated python file of Graph GraphEditSwitchs_5
3
4 from SuperV import *
5
6 # Graph creation of GraphEditSwitchs_5
7 def DefGraphEditSwitchs_5() :
8     GraphEditSwitchs_5 = Graph( 'GraphEditSwitchs_5' )
9     GraphEditSwitchs_5.SetName( 'GraphEditSwitchs_5' )
10     GraphEditSwitchs_5.SetAuthor( '' )
11     GraphEditSwitchs_5.SetComment( '' )
12     GraphEditSwitchs_5.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_5.INode( 'IsOdd' , PyIsOdd )
24     IsOdd.SetName( 'IsOdd' )
25     IsOdd.SetAuthor( '' )
26     IsOdd.SetComment( 'Python function' )
27     IsOdd.Coords( 393 , 67 )
28     IIsOdda = IsOdd.InPort( 'a' , 'long' )
29     IIsOddGate = IsOdd.GetInPort( 'Gate' )
30     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
31     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
32     
33     PyIsEven = []
34     PyIsEven.append( 'from time import *    ' )
35     PyIsEven.append( 'def IsEven(a) :        ' )
36     PyIsEven.append( '    print a,"IsEven"       ' )
37     PyIsEven.append( '    sleep( 1 )    ' )
38     PyIsEven.append( '    return a      ' )
39     IsEven = GraphEditSwitchs_5.INode( 'IsEven' , PyIsEven )
40     IsEven.SetName( 'IsEven' )
41     IsEven.SetAuthor( '' )
42     IsEven.SetComment( 'Python function' )
43     IsEven.Coords( 408 , 343 )
44     IIsEvena = IsEven.InPort( 'a' , 'long' )
45     IIsEvenGate = IsEven.GetInPort( 'Gate' )
46     OIsEvena = IsEven.OutPort( 'a' , 'long' )
47     OIsEvenGate = IsEven.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_5.LNode( 'InitLoop' , PyInitLoop , 'MoreLoop' , PyMoreInitLoop , 'NextLoop' , PyNextInitLoop )
65     EndOfInitLoop.SetName( 'EndOfInitLoop' )
66     EndOfInitLoop.SetAuthor( '' )
67     EndOfInitLoop.SetComment( 'Compute Node' )
68     EndOfInitLoop.Coords( 823 , 259 )
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     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
87     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
88     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
89     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
90     InitLoop.SetName( 'InitLoop' )
91     InitLoop.SetAuthor( '' )
92     InitLoop.SetComment( 'Compute Node' )
93     InitLoop.Coords( 10 , 248 )
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_5.SNode( 'Switch' , PySwitch )
103     EndOfSwitch.SetName( 'EndOfSwitch' )
104     EndOfSwitch.SetAuthor( '' )
105     EndOfSwitch.SetComment( 'Compute Node' )
106     EndOfSwitch.Coords( 584 , 172 )
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( 199 , 132 )
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_5.SNode( 'Switch' , PySwitch_1 )
131     EndSwitch.SetName( 'EndSwitch' )
132     EndSwitch.SetAuthor( '' )
133     EndSwitch.SetComment( 'Compute Node' )
134     EndSwitch.Coords( 608 , 430 )
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( 201 , 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_5.Link( OIsOdda , IEndOfSwitcha )
154     
155     LIsEvenaEndSwitcha = GraphEditSwitchs_5.Link( OIsEvena , IEndSwitcha )
156     
157     LInitLoopIndexSwitch_1a = GraphEditSwitchs_5.Link( OInitLoopIndex , ISwitch_1a )
158     
159     LInitLoopIndexSwitcha = GraphEditSwitchs_5.Link( OInitLoopIndex , ISwitcha )
160     
161     LInitLoopMinEndOfInitLoopMin = GraphEditSwitchs_5.Link( OInitLoopMin , IEndOfInitLoopMin )
162     
163     LInitLoopMaxEndOfInitLoopMax = GraphEditSwitchs_5.Link( OInitLoopMax , IEndOfInitLoopMax )
164     
165     LSwitchOddIsOddGate = GraphEditSwitchs_5.Link( OSwitchOdd , IIsOddGate )
166     
167     LSwitchaIsOdda = GraphEditSwitchs_5.Link( OSwitcha , IIsOdda )
168     
169     LSwitchDefaultEndOfSwitchDefault = GraphEditSwitchs_5.Link( OSwitchDefault , IEndOfSwitchDefault )
170     
171     LEndOfSwitchaEndOfInitLoopIndex = GraphEditSwitchs_5.Link( OEndOfSwitcha , IEndOfInitLoopIndex )
172     
173     LSwitch_1EvenIsEvenGate = GraphEditSwitchs_5.Link( OSwitch_1Even , IIsEvenGate )
174     
175     LSwitch_1aIsEvena = GraphEditSwitchs_5.Link( OSwitch_1a , IIsEvena )
176     
177     LSwitch_1DefaultEndSwitchDefault = GraphEditSwitchs_5.Link( OSwitch_1Default , IEndSwitchDefault )
178     
179     LEndSwitchGateEndOfInitLoopGate = GraphEditSwitchs_5.Link( OEndSwitchGate , IEndOfInitLoopGate )
180     
181     # Input datas
182     IInitLoopIndex.Input( 0 )
183     IInitLoopMin.Input( 0 )
184     IInitLoopMax.Input( 20 )
185     
186     # Output Ports of the graph
187     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
188     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
189     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
190     #OSwitchEven = Switch.GetOutPort( 'Even' )
191     #OSwitch_1Odd = Switch_1.GetOutPort( 'Odd' )
192     #OEndSwitcha = EndSwitch.GetOutPort( 'a' )
193     return GraphEditSwitchs_5
194
195
196 GraphEditSwitchs_5 = DefGraphEditSwitchs_5()