Salome HOME
Imported using TkCVS
[samples/datafiles.git] / Superv / Python / GraphSwitchCheckDefault.py
1
2 # Generated python file of Graph GraphSwitchCheckDefault_1
3
4 from SuperV import *
5
6 # Graph creation of GraphSwitchCheckDefault_1
7 def DefGraphSwitchCheckDefault_1() :
8     GraphSwitchCheckDefault_1 = Graph( 'GraphSwitchCheckDefault_1' )
9     GraphSwitchCheckDefault_1.SetName( 'GraphSwitchCheckDefault_1' )
10     GraphSwitchCheckDefault_1.SetAuthor( 'JR' )
11     GraphSwitchCheckDefault_1.SetComment( '' )
12     GraphSwitchCheckDefault_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) :       ' )
20     PyIsOdd.append( '    print a,"IsOdd (GraphSwitch)"      ' )
21     PyIsOdd.append( '    sleep( 1 )   ' )
22     PyIsOdd.append( '    return a     ' )
23     IsOdd = GraphSwitchCheckDefault_1.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 = GraphSwitchCheckDefault_1.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     PyPrintOdd = []
50     PyPrintOdd.append( 'from time import * ' )
51     PyPrintOdd.append( 'def Print(a,Branch) :     ' )
52     PyPrintOdd.append( '    print "Print ",a,Branch ' )
53     PyPrintOdd.append( '    sleep(1) ' )
54     PyPrintOdd.append( '    return Branch     ' )
55     PrintOdd = GraphSwitchCheckDefault_1.INode( 'Print' , PyPrintOdd )
56     PrintOdd.SetName( 'PrintOdd' )
57     PrintOdd.SetAuthor( '' )
58     PrintOdd.SetComment( 'Compute Node' )
59     PrintOdd.Coords( 415 , 130 )
60     IPrintOdda = PrintOdd.InPort( 'a' , 'long' )
61     IPrintOddBranch = PrintOdd.InPort( 'Branch' , 'string' )
62     IPrintOddGate = PrintOdd.GetInPort( 'Gate' )
63     OPrintOddBranch = PrintOdd.OutPort( 'Branch' , 'string' )
64     OPrintOddGate = PrintOdd.GetOutPort( 'Gate' )
65     
66     PyPrintEven = []
67     PyPrintEven.append( 'from time import * ' )
68     PyPrintEven.append( 'def Print_1(a,Branch) :     ' )
69     PyPrintEven.append( '    print "Print ",a,Branch ' )
70     PyPrintEven.append( '    sleep(1) ' )
71     PyPrintEven.append( '    return Branch     ' )
72     PrintEven = GraphSwitchCheckDefault_1.INode( 'Print_1' , PyPrintEven )
73     PrintEven.SetName( 'PrintEven' )
74     PrintEven.SetAuthor( '' )
75     PrintEven.SetComment( 'Compute Node' )
76     PrintEven.Coords( 423 , 289 )
77     IPrintEvena = PrintEven.InPort( 'a' , 'long' )
78     IPrintEvenBranch = PrintEven.InPort( 'Branch' , 'string' )
79     IPrintEvenGate = PrintEven.GetInPort( 'Gate' )
80     OPrintEvenBranch = PrintEven.OutPort( 'Branch' , 'string' )
81     OPrintEvenGate = PrintEven.GetOutPort( 'Gate' )
82     
83     PyEmptyNode = []
84     PyEmptyNode.append( 'from time import * ' )
85     PyEmptyNode.append( 'def EmptyNode(a,Branch) : ' )
86     PyEmptyNode.append( '    sleep(1) ' )
87     PyEmptyNode.append( '    return a,Branch  ' )
88     EmptyNode = GraphSwitchCheckDefault_1.INode( 'EmptyNode' , PyEmptyNode )
89     EmptyNode.SetName( 'EmptyNode' )
90     EmptyNode.SetAuthor( '' )
91     EmptyNode.SetComment( 'Compute Node' )
92     EmptyNode.Coords( 652 , 110 )
93     IEmptyNodea = EmptyNode.InPort( 'a' , 'long' )
94     IEmptyNodeBranch = EmptyNode.InPort( 'Branch' , 'string' )
95     IEmptyNodeGate = EmptyNode.GetInPort( 'Gate' )
96     OEmptyNodea = EmptyNode.OutPort( 'a' , 'long' )
97     OEmptyNodeBranch = EmptyNode.OutPort( 'Branch' , 'string' )
98     OEmptyNodeGate = EmptyNode.GetOutPort( 'Gate' )
99     
100     # Creation of Loop Nodes
101     PyInitLoopSwitch = []
102     PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) :        ' )
103     PyInitLoopSwitch.append( '  Index = Max  ' )
104     PyInitLoopSwitch.append( '  return Index,Min,Max       ' )
105     PyMoreInitLoopSwitch = []
106     PyMoreInitLoopSwitch.append( 'from time import * ' )
107     PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) : ' )
108     PyMoreInitLoopSwitch.append( '      sleep(1)  ' )
109     PyMoreInitLoopSwitch.append( '      if Index >= Min :     ' )
110     PyMoreInitLoopSwitch.append( '              DoLoop = 1       ' )
111     PyMoreInitLoopSwitch.append( '      else :       ' )
112     PyMoreInitLoopSwitch.append( '              DoLoop = 0       ' )
113     PyMoreInitLoopSwitch.append( '      return DoLoop,Index,Min,Max       ' )
114     PyNextInitLoopSwitch = []
115     PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) :       ' )
116     PyNextInitLoopSwitch.append( '      Index = Index - 1       ' )
117     PyNextInitLoopSwitch.append( '      return Index,Min,Max       ' )
118     InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchCheckDefault_1.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
119     EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
120     EndOfInitLoopSwitch.SetAuthor( '' )
121     EndOfInitLoopSwitch.SetComment( 'Compute Node' )
122     EndOfInitLoopSwitch.Coords( 1074 , 194 )
123     PyEndOfInitLoopSwitch = []
124     PyEndOfInitLoopSwitch.append( 'from time import *  ' )
125     PyEndOfInitLoopSwitch.append( 'def EndOfInitLoopSwitch(DoLoop,Index,Min,Max) :  ' )
126     PyEndOfInitLoopSwitch.append( '    sleep(1)  ' )
127     PyEndOfInitLoopSwitch.append( '    return DoLoop,Index,Min,Max  ' )
128     EndOfInitLoopSwitch.SetPyFunction( 'EndOfInitLoopSwitch' , PyEndOfInitLoopSwitch )
129     IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
130     IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
131     IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
132     IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
133     IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
134     OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
135     OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
136     OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
137     OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
138     IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
139     IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
140     IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
141     IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
142     IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
143     OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
144     OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
145     OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
146     OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
147     OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
148     InitLoopSwitch.SetName( 'InitLoopSwitch' )
149     InitLoopSwitch.SetAuthor( '' )
150     InitLoopSwitch.SetComment( 'Compute Node' )
151     InitLoopSwitch.Coords( 10 , 129 )
152     
153     # Creation of Switch Nodes
154     PySwitch = []
155     PySwitch.append( 'from time import *        ' )
156     PySwitch.append( 'def Switch(a) : ' )
157     PySwitch.append( '    sleep(1) ' )
158     PySwitch.append( '    Branch = "Negative or null"    ' )
159     PySwitch.append( '    if a <= 0 :       ' )
160     PySwitch.append( '        return 0,0,a,Branch,1  ' )
161     PySwitch.append( '    if ( a & 1 ) == 0 :    ' )
162     PySwitch.append( '        Branch = "Even"    ' )
163     PySwitch.append( '    else :    ' )
164     PySwitch.append( '        Branch = "Odd"    ' )
165     PySwitch.append( '    return a & 1,1-(a&1),a,Branch,0  ' )
166     Switch,EndOfSwitch = GraphSwitchCheckDefault_1.SNode( 'Switch' , PySwitch )
167     EndOfSwitch.SetName( 'EndOfSwitch' )
168     EndOfSwitch.SetAuthor( '' )
169     EndOfSwitch.SetComment( 'Compute Node' )
170     EndOfSwitch.Coords( 882 , 194 )
171     PyEndOfSwitch = []
172     PyEndOfSwitch.append( 'from time import * ' )
173     PyEndOfSwitch.append( 'def EndOfSwitch(a,Branch) : ' )
174     PyEndOfSwitch.append( '    sleep(1) ' )
175     PyEndOfSwitch.append( '    return a ' )
176     EndOfSwitch.SetPyFunction( 'EndOfSwitch' , PyEndOfSwitch )
177     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
178     IEndOfSwitchBranch = EndOfSwitch.InPort( 'Branch' , 'string' )
179     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
180     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
181     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
182     Switch.SetName( 'Switch' )
183     Switch.SetAuthor( '' )
184     Switch.SetComment( 'Compute Node' )
185     Switch.Coords( 190 , 129 )
186     ISwitcha = Switch.InPort( 'a' , 'long' )
187     ISwitchGate = Switch.GetInPort( 'Gate' )
188     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
189     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
190     OSwitcha = Switch.OutPort( 'a' , 'int' )
191     OSwitchBranch = Switch.OutPort( 'Branch' , 'string' )
192     OSwitchdefault = Switch.OutPort( 'default' , 'boolean' )
193     OSwitchDefault = Switch.GetOutPort( 'Default' )
194     
195     # Creation of Links
196     LIsOddaEmptyNodea = GraphSwitchCheckDefault_1.Link( OIsOdda , IEmptyNodea )
197     LIsOddaEmptyNodea.AddCoord( 1 , 646 , 78 )
198     
199     LIsEvenaEndOfSwitcha = GraphSwitchCheckDefault_1.Link( OIsEvena , IEndOfSwitcha )
200     
201     LPrintOddBranchEmptyNodeBranch = GraphSwitchCheckDefault_1.Link( OPrintOddBranch , IEmptyNodeBranch )
202     
203     LPrintEvenBranchEndOfSwitchBranch = GraphSwitchCheckDefault_1.Link( OPrintEvenBranch , IEndOfSwitchBranch )
204     
205     LEmptyNodeaEndOfSwitcha = GraphSwitchCheckDefault_1.Link( OEmptyNodea , IEndOfSwitcha )
206     
207     LEmptyNodeBranchEndOfSwitchBranch = GraphSwitchCheckDefault_1.Link( OEmptyNodeBranch , IEndOfSwitchBranch )
208     
209     LInitLoopSwitchIndexSwitcha = GraphSwitchCheckDefault_1.Link( OInitLoopSwitchIndex , ISwitcha )
210     
211     LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchCheckDefault_1.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
212     
213     LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchCheckDefault_1.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
214     
215     LSwitchOddIsOddGate = GraphSwitchCheckDefault_1.Link( OSwitchOdd , IIsOddGate )
216     LSwitchOddIsOddGate.AddCoord( 1 , 401 , 101 )
217     LSwitchOddIsOddGate.AddCoord( 2 , 401 , 160 )
218     
219     LSwitchOddPrintOddGate = GraphSwitchCheckDefault_1.Link( OSwitchOdd , IPrintOddGate )
220     LSwitchOddPrintOddGate.AddCoord( 1 , 401 , 245 )
221     LSwitchOddPrintOddGate.AddCoord( 2 , 401 , 159 )
222     
223     LSwitchEvenIsEvenGate = GraphSwitchCheckDefault_1.Link( OSwitchEven , IIsEvenGate )
224     LSwitchEvenIsEvenGate.AddCoord( 1 , 392 , 533 )
225     LSwitchEvenIsEvenGate.AddCoord( 2 , 392 , 182 )
226     
227     LSwitchEvenPrintEvenGate = GraphSwitchCheckDefault_1.Link( OSwitchEven , IPrintEvenGate )
228     LSwitchEvenPrintEvenGate.AddCoord( 1 , 392 , 403 )
229     LSwitchEvenPrintEvenGate.AddCoord( 2 , 392 , 181 )
230     
231     LSwitchaIsOdda = GraphSwitchCheckDefault_1.Link( OSwitcha , IIsOdda )
232     LSwitchaIsOdda.AddCoord( 1 , 382 , 78 )
233     LSwitchaIsOdda.AddCoord( 2 , 382 , 199 )
234     
235     LSwitchaIsEvena = GraphSwitchCheckDefault_1.Link( OSwitcha , IIsEvena )
236     LSwitchaIsEvena.AddCoord( 1 , 381 , 509 )
237     LSwitchaIsEvena.AddCoord( 2 , 382 , 200 )
238     
239     LSwitchaPrintOdda = GraphSwitchCheckDefault_1.Link( OSwitcha , IPrintOdda )
240     
241     LSwitchaPrintEvena = GraphSwitchCheckDefault_1.Link( OSwitcha , IPrintEvena )
242     LSwitchaPrintEvena.AddCoord( 1 , 381 , 361 )
243     LSwitchaPrintEvena.AddCoord( 2 , 382 , 200 )
244     
245     LSwitchBranchPrintOddBranch = GraphSwitchCheckDefault_1.Link( OSwitchBranch , IPrintOddBranch )
246     
247     LSwitchBranchPrintEvenBranch = GraphSwitchCheckDefault_1.Link( OSwitchBranch , IPrintEvenBranch )
248     LSwitchBranchPrintEvenBranch.AddCoord( 1 , 369 , 381 )
249     LSwitchBranchPrintEvenBranch.AddCoord( 2 , 369 , 219 )
250     
251     LSwitchDefaultEndOfSwitchDefault = GraphSwitchCheckDefault_1.Link( OSwitchDefault , IEndOfSwitchDefault )
252     
253     LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchCheckDefault_1.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
254     
255     # Input datas
256     IInitLoopSwitchIndex.Input( 0 )
257     IInitLoopSwitchMin.Input( -5 )
258     IInitLoopSwitchMax.Input( 10 )
259     
260     # Output Ports of the graph
261     #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
262     #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
263     #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
264     #OSwitchdefault = Switch.GetOutPort( 'default' )
265     return GraphSwitchCheckDefault_1
266
267
268 GraphSwitchCheckDefault_1 = DefGraphSwitchCheckDefault_1()