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