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