Salome HOME
Imported using TkCVS
[samples/datafiles.git] / Superv / Python / GraphSwitchOutput.py
1
2 # Generated python file of Graph GraphSwitch_1_1_2
3
4 from SuperV import *
5
6 # Graph creation of GraphSwitch_1_1_2
7 def DefGraphSwitch_1_1_2() :
8     GraphSwitch_1_1_2 = Graph( 'GraphSwitch_1_1_2' )
9     GraphSwitch_1_1_2.SetName( 'GraphSwitch_1_1_2' )
10     GraphSwitch_1_1_2.SetAuthor( '' )
11     GraphSwitch_1_1_2.SetComment( '' )
12     GraphSwitch_1_1_2.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,Branch) :        ' )
20     PyIsOdd.append( '    print a,"IsOdd (GraphSwitch)"       ' )
21     PyIsOdd.append( '    sleep( 1 )    ' )
22     PyIsOdd.append( '    return a,Branch ' )
23     IsOdd = GraphSwitch_1_1_2.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     IIsOddBranch = IsOdd.InPort( 'Branch' , 'string' )
30     IIsOddGate = IsOdd.GetInPort( 'Gate' )
31     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
32     OIsOddBranch = IsOdd.OutPort( 'Branch' , 'string' )
33     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
34     
35     PyIsEven = []
36     PyIsEven.append( 'from time import *     ' )
37     PyIsEven.append( 'def IsEven(a,Branch) :         ' )
38     PyIsEven.append( '    print a,"IsEven (GraphSwitch)"        ' )
39     PyIsEven.append( '    sleep( 1 )     ' )
40     PyIsEven.append( '    return a,Branch ' )
41     IsEven = GraphSwitch_1_1_2.INode( 'IsEven' , PyIsEven )
42     IsEven.SetName( 'IsEven' )
43     IsEven.SetAuthor( '' )
44     IsEven.SetComment( 'Compute Node' )
45     IsEven.Coords( 395 , 334 )
46     IIsEvena = IsEven.InPort( 'a' , 'long' )
47     IIsEvenBranch = IsEven.InPort( 'Branch' , 'string' )
48     IIsEvenGate = IsEven.GetInPort( 'Gate' )
49     OIsEvena = IsEven.OutPort( 'a' , 'long' )
50     OIsEvenBranch = IsEven.OutPort( 'Branch' , 'string' )
51     OIsEvenGate = IsEven.GetOutPort( 'Gate' )
52     
53     PyPrint = []
54     PyPrint.append( 'def Print(a,Branch) :   ' )
55     PyPrint.append( '    print "Print ",Branch   ' )
56     PyPrint.append( '    return a,Branch   ' )
57     Print = GraphSwitch_1_1_2.INode( 'Print' , PyPrint )
58     Print.SetName( 'Print' )
59     Print.SetAuthor( '' )
60     Print.SetComment( 'Compute Node' )
61     Print.Coords( 639 , 63 )
62     IPrinta = Print.InPort( 'a' , 'long' )
63     IPrintBranch = Print.InPort( 'Branch' , 'string' )
64     IPrintGate = Print.GetInPort( 'Gate' )
65     OPrinta = Print.OutPort( 'a' , 'long' )
66     OPrintBranch = Print.OutPort( 'Branch' , 'string' )
67     OPrintGate = Print.GetOutPort( 'Gate' )
68     
69     PyPrint_1 = []
70     PyPrint_1.append( 'def Print_1(a,Branch) :   ' )
71     PyPrint_1.append( '    print "Print ",Branch   ' )
72     PyPrint_1.append( '    return a,Branch   ' )
73     Print_1 = GraphSwitch_1_1_2.INode( 'Print_1' , PyPrint_1 )
74     Print_1.SetName( 'Print_1' )
75     Print_1.SetAuthor( '' )
76     Print_1.SetComment( 'Compute Node' )
77     Print_1.Coords( 639 , 263 )
78     IPrint_1a = Print_1.InPort( 'a' , 'long' )
79     IPrint_1Branch = Print_1.InPort( 'Branch' , 'string' )
80     IPrint_1Gate = Print_1.GetInPort( 'Gate' )
81     OPrint_1a = Print_1.OutPort( 'a' , 'long' )
82     OPrint_1Branch = Print_1.OutPort( 'Branch' , 'string' )
83     OPrint_1Gate = Print_1.GetOutPort( 'Gate' )
84     
85     # Creation of Loop Nodes
86     PyInitLoopSwitch = []
87     PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) :       ' )
88     PyInitLoopSwitch.append( '  Index = Max ' )
89     PyInitLoopSwitch.append( '  return Index,Min,Max      ' )
90     PyMoreInitLoopSwitch = []
91     PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) :      ' )
92     PyMoreInitLoopSwitch.append( '      if Index >= Min :    ' )
93     PyMoreInitLoopSwitch.append( '              DoLoop = 1      ' )
94     PyMoreInitLoopSwitch.append( '      else :      ' )
95     PyMoreInitLoopSwitch.append( '              DoLoop = 0      ' )
96     PyMoreInitLoopSwitch.append( '      return DoLoop,Index,Min,Max      ' )
97     PyNextInitLoopSwitch = []
98     PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) :      ' )
99     PyNextInitLoopSwitch.append( '      Index = Index - 1      ' )
100     PyNextInitLoopSwitch.append( '      return Index,Min,Max      ' )
101     InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitch_1_1_2.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
102     EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
103     EndOfInitLoopSwitch.SetAuthor( '' )
104     EndOfInitLoopSwitch.SetComment( 'Compute Node' )
105     EndOfInitLoopSwitch.Coords( 1082 , 150 )
106     PyEndOfInitLoopSwitch = []
107     EndOfInitLoopSwitch.SetPyFunction( '' , PyEndOfInitLoopSwitch )
108     IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
109     IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
110     IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
111     IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
112     IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
113     OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
114     OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
115     OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
116     OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
117     IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
118     IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
119     IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
120     IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
121     IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
122     OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
123     OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
124     OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
125     OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
126     OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
127     InitLoopSwitch.SetName( 'InitLoopSwitch' )
128     InitLoopSwitch.SetAuthor( '' )
129     InitLoopSwitch.SetComment( 'Compute Node' )
130     InitLoopSwitch.Coords( 10 , 129 )
131     
132     # Creation of Switch Nodes
133     PySwitch = []
134     PySwitch.append( 'from time import *       ' )
135     PySwitch.append( 'def Switch(a) :   ' )
136     PySwitch.append( '    Branch = 'Negative or null'   ' )
137     PySwitch.append( '    if a <= 0 :      ' )
138     PySwitch.append( '        return 0,0,a,Branch,1 ' )
139     PySwitch.append( '    if ( a & 1 ) == 0 :   ' )
140     PySwitch.append( '        Branch = 'Even'   ' )
141     PySwitch.append( '    else :   ' )
142     PySwitch.append( '        Branch = 'Odd'   ' )
143     PySwitch.append( '    sleep(1)   ' )
144     PySwitch.append( '    return a & 1,1-(a&1),a,Branch,0 ' )
145     Switch,EndOfSwitch = GraphSwitch_1_1_2.SNode( 'Switch' , PySwitch )
146     EndOfSwitch.SetName( 'EndOfSwitch' )
147     EndOfSwitch.SetAuthor( '' )
148     EndOfSwitch.SetComment( 'Compute Node' )
149     EndOfSwitch.Coords( 880 , 150 )
150     PyEndOfSwitch = []
151     EndOfSwitch.SetPyFunction( 'EndSwitch_1' , PyEndOfSwitch )
152     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
153     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
154     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
155     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
156     Switch.SetName( 'Switch' )
157     Switch.SetAuthor( '' )
158     Switch.SetComment( 'Compute Node' )
159     Switch.Coords( 195 , 129 )
160     ISwitcha = Switch.InPort( 'a' , 'long' )
161     ISwitchGate = Switch.GetInPort( 'Gate' )
162     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
163     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
164     OSwitcha = Switch.OutPort( 'a' , 'int' )
165     OSwitchBranch = Switch.OutPort( 'Branch' , 'string' )
166     OSwitchdefault = Switch.OutPort( 'default' , 'boolean' )
167     OSwitchDefault = Switch.GetOutPort( 'Default' )
168     
169     # Creation of Links
170     LIsOddaPrinta = GraphSwitch_1_1_2.Link( OIsOdda , IPrinta )
171     
172     LIsOddBranchPrintBranch = GraphSwitch_1_1_2.Link( OIsOddBranch , IPrintBranch )
173     
174     LInitLoopSwitchIndexSwitcha = GraphSwitch_1_1_2.Link( OInitLoopSwitchIndex , ISwitcha )
175     
176     LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitch_1_1_2.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
177     
178     LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitch_1_1_2.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
179     
180     LIsEvenaPrint_1a = GraphSwitch_1_1_2.Link( OIsEvena , IPrint_1a )
181     
182     LIsEvenBranchPrint_1Branch = GraphSwitch_1_1_2.Link( OIsEvenBranch , IPrint_1Branch )
183     
184     LSwitchOddIsOddGate = GraphSwitch_1_1_2.Link( OSwitchOdd , IIsOddGate )
185     
186     LSwitchEvenIsEvenGate = GraphSwitch_1_1_2.Link( OSwitchEven , IIsEvenGate )
187     
188     LSwitchaIsOdda = GraphSwitch_1_1_2.Link( OSwitcha , IIsOdda )
189     
190     LSwitchaIsEvena = GraphSwitch_1_1_2.Link( OSwitcha , IIsEvena )
191     
192     LSwitchBranchIsOddBranch = GraphSwitch_1_1_2.Link( OSwitchBranch , IIsOddBranch )
193     
194     LSwitchBranchIsEvenBranch = GraphSwitch_1_1_2.Link( OSwitchBranch , IIsEvenBranch )
195     
196     LSwitchDefaultEndOfSwitchDefault = GraphSwitch_1_1_2.Link( OSwitchDefault , IEndOfSwitchDefault )
197     
198     LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitch_1_1_2.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
199     
200     LPrintaEndOfSwitcha = GraphSwitch_1_1_2.Link( OPrinta , IEndOfSwitcha )
201     
202     LPrint_1aEndOfSwitcha = GraphSwitch_1_1_2.Link( OPrint_1a , IEndOfSwitcha )
203     
204     # Input datas
205     IInitLoopSwitchIndex.Input( 0 )
206     IInitLoopSwitchMin.Input( -5 )
207     IInitLoopSwitchMax.Input( 10 )
208     
209     # Output Ports of the graph
210     #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
211     #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
212     #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
213     #OSwitchdefault = Switch.GetOutPort( 'default' )
214     #OPrintBranch = Print.GetOutPort( 'Branch' )
215     #OPrint_1Branch = Print_1.GetOutPort( 'Branch' )
216     return GraphSwitch_1_1_2
217
218
219 GraphSwitch_1_1_2 = DefGraphSwitch_1_1_2()