Salome HOME
Imported using TkCVS
[samples/datafiles.git] / Superv / Python / GraphSwitchCheckBranch1NoDefault.py
1
2 # Generated python file of Graph GraphSwitchCheckBranch1NoDefault
3
4 from SuperV import *
5
6 # Graph creation of GraphSwitchCheckBranch1NoDefault
7 def DefGraphSwitchCheckBranch1NoDefault() :
8     GraphSwitchCheckBranch1NoDefault = Graph( 'GraphSwitchCheckBranch1NoDefault' )
9     GraphSwitchCheckBranch1NoDefault.SetName( 'GraphSwitchCheckBranch1NoDefault' )
10     GraphSwitchCheckBranch1NoDefault.SetAuthor( 'JR' )
11     GraphSwitchCheckBranch1NoDefault.SetComment( 'Switch with two SwitchBranches, One NotSwitchBranch and the DefaultBranch' )
12     GraphSwitchCheckBranch1NoDefault.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 (GraphSwitch)"      ' )
21     PyIsOdd.append( '    sleep( 1 )   ' )
22     PyIsOdd.append( '    return a     ' )
23     IsOdd = GraphSwitchCheckBranch1NoDefault.INode( 'IsOdd' , PyIsOdd )
24     IsOdd.SetName( 'IsOdd' )
25     IsOdd.SetAuthor( '' )
26     IsOdd.SetComment( 'Python function' )
27     IsOdd.Coords( 415 , 7 )
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 (GraphSwitch)"       ' )
37     PyIsEven.append( '    sleep( 1 )    ' )
38     PyIsEven.append( '    return a      ' )
39     IsEven = GraphSwitchCheckBranch1NoDefault.INode( 'IsEven' , PyIsEven )
40     IsEven.SetName( 'IsEven' )
41     IsEven.SetAuthor( '' )
42     IsEven.SetComment( 'Compute Node' )
43     IsEven.Coords( 421 , 438 )
44     IIsEvena = IsEven.InPort( 'a' , 'long' )
45     IIsEvenGate = IsEven.GetInPort( 'Gate' )
46     OIsEvena = IsEven.OutPort( 'a' , 'long' )
47     OIsEvenGate = IsEven.GetOutPort( 'Gate' )
48     
49     PyBranchNode = []
50     PyBranchNode.append( 'from time import *  ' )
51     PyBranchNode.append( 'def Print_1(Branch) :      ' )
52     PyBranchNode.append( '    print "Print ",Branch  ' )
53     PyBranchNode.append( '    sleep(1)  ' )
54     PyBranchNode.append( '    return Branch      ' )
55     BranchNode = GraphSwitchCheckBranch1NoDefault.INode( 'Print_1' , PyBranchNode )
56     BranchNode.SetName( 'BranchNode' )
57     BranchNode.SetAuthor( '' )
58     BranchNode.SetComment( 'Compute Node' )
59     BranchNode.Coords( 529 , 177 )
60     IBranchNodeBranch = BranchNode.InPort( 'Branch' , 'string' )
61     IBranchNodeGate = BranchNode.GetInPort( 'Gate' )
62     OBranchNodeBranch = BranchNode.OutPort( 'Branch' , 'string' )
63     OBranchNodeGate = BranchNode.GetOutPort( 'Gate' )
64     
65     Pydefault = []
66     Pydefault.append( 'from time import * ' )
67     Pydefault.append( 'def default(a) : ' )
68     Pydefault.append( '    sleep(1) ' )
69     Pydefault.append( '    return a  ' )
70     default = GraphSwitchCheckBranch1NoDefault.INode( 'default' , Pydefault )
71     default.SetName( 'default' )
72     default.SetAuthor( '' )
73     default.SetComment( 'Compute Node' )
74     default.Coords( 428 , 308 )
75     Idefaulta = default.InPort( 'a' , 'long' )
76     IdefaultGate = default.GetInPort( 'Gate' )
77     Odefaulta = default.OutPort( 'a' , 'long' )
78     OdefaultGate = default.GetOutPort( 'Gate' )
79     
80     # Creation of Loop Nodes
81     PyInitLoopSwitch = []
82     PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) :        ' )
83     PyInitLoopSwitch.append( '  Index = Max  ' )
84     PyInitLoopSwitch.append( '  return Index,Min,Max       ' )
85     PyMoreInitLoopSwitch = []
86     PyMoreInitLoopSwitch.append( 'from time import * ' )
87     PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' )
88     PyMoreInitLoopSwitch.append( '      sleep(1)  ' )
89     PyMoreInitLoopSwitch.append( '      if Index >= Min :     ' )
90     PyMoreInitLoopSwitch.append( '              DoLoop = 1       ' )
91     PyMoreInitLoopSwitch.append( '      else :       ' )
92     PyMoreInitLoopSwitch.append( '              DoLoop = 0       ' )
93     PyMoreInitLoopSwitch.append( '      return DoLoop,Index,Min,Max       ' )
94     PyNextInitLoopSwitch = []
95     PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) :       ' )
96     PyNextInitLoopSwitch.append( '      Index = Index - 1       ' )
97     PyNextInitLoopSwitch.append( '      return Index,Min,Max       ' )
98     InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchCheckBranch1NoDefault.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
99     EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
100     EndOfInitLoopSwitch.SetAuthor( '' )
101     EndOfInitLoopSwitch.SetComment( 'Compute Node' )
102     EndOfInitLoopSwitch.Coords( 1073 , 216 )
103     PyEndOfInitLoopSwitch = []
104     PyEndOfInitLoopSwitch.append( 'from time import *  ' )
105     PyEndOfInitLoopSwitch.append( 'def EndOfInitLoopSwitch(DoLoop,Index,Min,Max) :  ' )
106     PyEndOfInitLoopSwitch.append( '    sleep(1)  ' )
107     PyEndOfInitLoopSwitch.append( '    return DoLoop,Index,Min,Max  ' )
108     EndOfInitLoopSwitch.SetPyFunction( 'EndOfInitLoopSwitch' , PyEndOfInitLoopSwitch )
109     IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
110     IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
111     IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
112     IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
113     IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
114     OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
115     OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
116     OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
117     OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
118     IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
119     IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
120     IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
121     IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
122     IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
123     OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
124     OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
125     OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
126     OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
127     OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
128     InitLoopSwitch.SetName( 'InitLoopSwitch' )
129     InitLoopSwitch.SetAuthor( '' )
130     InitLoopSwitch.SetComment( 'Compute Node' )
131     InitLoopSwitch.Coords( 10 , 157 )
132     
133     # Creation of Switch Nodes
134     PySwitch = []
135     PySwitch.append( 'from time import *        ' )
136     PySwitch.append( 'def Switch(a) : ' )
137     PySwitch.append( '    sleep(1) ' )
138     PySwitch.append( '    Branch = "Negative or null"    ' )
139     PySwitch.append( '    if a <= 0 :       ' )
140     PySwitch.append( '        return 0,0,a,Branch,1  ' )
141     PySwitch.append( '    if ( a & 1 ) == 0 :    ' )
142     PySwitch.append( '        Branch = "Even"    ' )
143     PySwitch.append( '    else :    ' )
144     PySwitch.append( '        Branch = "Odd"    ' )
145     PySwitch.append( '    return a & 1,1-(a&1),a,Branch,0  ' )
146     Switch,EndOfSwitch = GraphSwitchCheckBranch1NoDefault.SNode( 'Switch' , PySwitch )
147     EndOfSwitch.SetName( 'EndOfSwitch' )
148     EndOfSwitch.SetAuthor( '' )
149     EndOfSwitch.SetComment( 'Compute Node' )
150     EndOfSwitch.Coords( 880 , 216 )
151     PyEndOfSwitch = []
152     PyEndOfSwitch.append( 'from time import * ' )
153     PyEndOfSwitch.append( 'def EndOfSwitch(a,Branch) : ' )
154     PyEndOfSwitch.append( '    sleep(1) ' )
155     PyEndOfSwitch.append( '    return a ' )
156     EndOfSwitch.SetPyFunction( 'EndOfSwitch' , PyEndOfSwitch )
157     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
158     IEndOfSwitchBranch = EndOfSwitch.InPort( 'Branch' , 'string' )
159     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
160     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
161     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
162     Switch.SetName( 'Switch' )
163     Switch.SetAuthor( '' )
164     Switch.SetComment( 'Compute Node' )
165     Switch.Coords( 194 , 157 )
166     ISwitcha = Switch.InPort( 'a' , 'long' )
167     ISwitchGate = Switch.GetInPort( 'Gate' )
168     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
169     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
170     OSwitcha = Switch.OutPort( 'a' , 'int' )
171     OSwitchBranch = Switch.OutPort( 'Branch' , 'string' )
172     OSwitchdefault = Switch.OutPort( 'default' , 'boolean' )
173     OSwitchDefault = Switch.GetOutPort( 'Default' )
174     
175     # Creation of Links
176     LIsOddaEndOfSwitcha = GraphSwitchCheckBranch1NoDefault.Link( OIsOdda , IEndOfSwitcha )
177     
178     LIsEvenaEndOfSwitcha = GraphSwitchCheckBranch1NoDefault.Link( OIsEvena , IEndOfSwitcha )
179     
180     LBranchNodeBranchEndOfSwitchBranch = GraphSwitchCheckBranch1NoDefault.Link( OBranchNodeBranch , IEndOfSwitchBranch )
181     
182     LInitLoopSwitchIndexSwitcha = GraphSwitchCheckBranch1NoDefault.Link( OInitLoopSwitchIndex , ISwitcha )
183     
184     LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchCheckBranch1NoDefault.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
185     
186     LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchCheckBranch1NoDefault.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
187     
188     LSwitchOddIsOddGate = GraphSwitchCheckBranch1NoDefault.Link( OSwitchOdd , IIsOddGate )
189     LSwitchOddIsOddGate.AddCoord( 1 , 401 , 101 )
190     LSwitchOddIsOddGate.AddCoord( 2 , 401 , 188 )
191     
192     LSwitchEvenIsEvenGate = GraphSwitchCheckBranch1NoDefault.Link( OSwitchEven , IIsEvenGate )
193     LSwitchEvenIsEvenGate.AddCoord( 1 , 392 , 533 )
194     LSwitchEvenIsEvenGate.AddCoord( 2 , 392 , 208 )
195     
196     LSwitchaIsOdda = GraphSwitchCheckBranch1NoDefault.Link( OSwitcha , IIsOdda )
197     LSwitchaIsOdda.AddCoord( 1 , 382 , 78 )
198     LSwitchaIsOdda.AddCoord( 2 , 382 , 229 )
199     
200     LSwitchaIsEvena = GraphSwitchCheckBranch1NoDefault.Link( OSwitcha , IIsEvena )
201     LSwitchaIsEvena.AddCoord( 1 , 381 , 509 )
202     LSwitchaIsEvena.AddCoord( 2 , 381 , 229 )
203     
204     LSwitchadefaulta = GraphSwitchCheckBranch1NoDefault.Link( OSwitcha , Idefaulta )
205     LSwitchadefaulta.AddCoord( 1 , 382 , 377 )
206     LSwitchadefaulta.AddCoord( 2 , 382 , 228 )
207     
208     LSwitchBranchBranchNodeBranch = GraphSwitchCheckBranch1NoDefault.Link( OSwitchBranch , IBranchNodeBranch )
209     
210     LSwitchdefaultdefaultGate = GraphSwitchCheckBranch1NoDefault.Link( OSwitchdefault , IdefaultGate )
211     LSwitchdefaultdefaultGate.AddCoord( 1 , 410 , 403 )
212     LSwitchdefaultdefaultGate.AddCoord( 2 , 410 , 269 )
213     LSwitchdefaultdefaultGate.AddCoord( 3 , 410 , 268 )
214     
215     LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchCheckBranch1NoDefault.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
216     
217     LdefaultaEndOfSwitcha = GraphSwitchCheckBranch1NoDefault.Link( Odefaulta , IEndOfSwitcha )
218     
219     # Input datas
220     IInitLoopSwitchIndex.Input( 0 )
221     IInitLoopSwitchMin.Input( -5 )
222     IInitLoopSwitchMax.Input( 10 )
223     
224     # Output Ports of the graph
225     #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
226     #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
227     #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
228     return GraphSwitchCheckBranch1NoDefault
229
230
231 GraphSwitchCheckBranch1NoDefault = DefGraphSwitchCheckBranch1NoDefault()