Salome HOME
Imported using TkCVS
[samples/datafiles.git] / Superv / Python / GraphSwitchErrExec.py
1
2 # Generated python file of Graph GraphSwitchErrExec
3
4 from SuperV import *
5
6 # Graph creation of GraphSwitchErrExec
7 def DefGraphSwitchErrExec() :
8     GraphSwitchErrExec = Graph( 'GraphSwitchErrExec' )
9     GraphSwitchErrExec.SetName( 'GraphSwitchErrExec' )
10     GraphSwitchErrExec.SetAuthor( '' )
11     GraphSwitchErrExec.SetComment( '' )
12     GraphSwitchErrExec.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 = GraphSwitchErrExec.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 = GraphSwitchErrExec.INode( 'IsEven' , PyIsEven )
40     IsEven.SetName( 'IsEven' )
41     IsEven.SetAuthor( '' )
42     IsEven.SetComment( 'Compute Node' )
43     IsEven.Coords( 397 , 279 )
44     IIsEvena = IsEven.InPort( 'a' , 'long' )
45     IIsEvenGate = IsEven.GetInPort( 'Gate' )
46     OIsEvena = IsEven.OutPort( 'a' , 'long' )
47     OIsEvenGate = IsEven.GetOutPort( 'Gate' )
48     
49     # Creation of Loop Nodes
50     PyInitLoopSwitch = []
51     PyInitLoopSwitch.append( 'def InitLoop(Index,Min,Max) :       ' )
52     PyInitLoopSwitch.append( '  Index = Max ' )
53     PyInitLoopSwitch.append( '  return Index,Min,Max      ' )
54     PyMoreInitLoopSwitch = []
55     PyMoreInitLoopSwitch.append( 'def MoreLoop(Index,Min,Max) :      ' )
56     PyMoreInitLoopSwitch.append( '      if Index >= Min :    ' )
57     PyMoreInitLoopSwitch.append( '              DoLoop = 1      ' )
58     PyMoreInitLoopSwitch.append( '      else :      ' )
59     PyMoreInitLoopSwitch.append( '              DoLoop = 0      ' )
60     PyMoreInitLoopSwitch.append( '      return DoLoop,Index,Min,Max      ' )
61     PyNextInitLoopSwitch = []
62     PyNextInitLoopSwitch.append( 'def NextLoop(Index,Min,Max) :      ' )
63     PyNextInitLoopSwitch.append( '      Index = Index - 1      ' )
64     PyNextInitLoopSwitch.append( '      return Index,Min,Max      ' )
65     InitLoopSwitch,EndOfInitLoopSwitch = GraphSwitchErrExec.LNode( 'InitLoop' , PyInitLoopSwitch , 'MoreLoop' , PyMoreInitLoopSwitch , 'NextLoop' , PyNextInitLoopSwitch )
66     EndOfInitLoopSwitch.SetName( 'EndOfInitLoopSwitch' )
67     EndOfInitLoopSwitch.SetAuthor( '' )
68     EndOfInitLoopSwitch.SetComment( 'Compute Node' )
69     EndOfInitLoopSwitch.Coords( 766 , 127 )
70     PyEndOfInitLoopSwitch = []
71     EndOfInitLoopSwitch.SetPyFunction( '' , PyEndOfInitLoopSwitch )
72     IInitLoopSwitchDoLoop = InitLoopSwitch.GetInPort( 'DoLoop' )
73     IInitLoopSwitchIndex = InitLoopSwitch.InPort( 'Index' , 'long' )
74     IInitLoopSwitchMin = InitLoopSwitch.InPort( 'Min' , 'long' )
75     IInitLoopSwitchMax = InitLoopSwitch.InPort( 'Max' , 'long' )
76     IInitLoopSwitchGate = InitLoopSwitch.GetInPort( 'Gate' )
77     OInitLoopSwitchDoLoop = InitLoopSwitch.GetOutPort( 'DoLoop' )
78     OInitLoopSwitchIndex = InitLoopSwitch.GetOutPort( 'Index' )
79     OInitLoopSwitchMin = InitLoopSwitch.GetOutPort( 'Min' )
80     OInitLoopSwitchMax = InitLoopSwitch.GetOutPort( 'Max' )
81     IEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetInPort( 'DoLoop' )
82     IEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetInPort( 'Index' )
83     IEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetInPort( 'Min' )
84     IEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetInPort( 'Max' )
85     IEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetInPort( 'Gate' )
86     OEndOfInitLoopSwitchDoLoop = EndOfInitLoopSwitch.GetOutPort( 'DoLoop' )
87     OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
88     OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
89     OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
90     OEndOfInitLoopSwitchGate = EndOfInitLoopSwitch.GetOutPort( 'Gate' )
91     InitLoopSwitch.SetName( 'InitLoopSwitch' )
92     InitLoopSwitch.SetAuthor( '' )
93     InitLoopSwitch.SetComment( 'Compute Node' )
94     InitLoopSwitch.Coords( 10 , 129 )
95     
96     # Creation of Switch Nodes
97     PySwitch = []
98     PySwitch.append( 'from time import *     ' )
99     PySwitch.append( 'def Switch(a) :       ' )
100     PySwitch.append( '    if a == 0 :    ' )
101     PySwitch.append( '        return 0,0,a ' )
102     PySwitch.append( '    if a < 0 : ' )
103     PySwitch.append( '        return 1,1,a ' )
104     PySwitch.append( '    if ( a & 1 ) == 0 :     ' )
105     PySwitch.append( '        sleep(1)        ' )
106     PySwitch.append( '    return a & 1,1-(a&1),a        ' )
107     Switch,EndOfSwitch = GraphSwitchErrExec.SNode( 'Switch' , PySwitch )
108     EndOfSwitch.SetName( 'EndOfSwitch' )
109     EndOfSwitch.SetAuthor( '' )
110     EndOfSwitch.SetComment( 'Compute Node' )
111     EndOfSwitch.Coords( 580 , 147 )
112     PyEndOfSwitch = []
113     EndOfSwitch.SetPyFunction( 'EndSwitch_1' , PyEndOfSwitch )
114     IEndOfSwitcha = EndOfSwitch.InPort( 'a' , 'long' )
115     IEndOfSwitchDefault = EndOfSwitch.GetInPort( 'Default' )
116     OEndOfSwitcha = EndOfSwitch.OutPort( 'a' , 'long' )
117     OEndOfSwitchGate = EndOfSwitch.GetOutPort( 'Gate' )
118     Switch.SetName( 'Switch' )
119     Switch.SetAuthor( '' )
120     Switch.SetComment( 'Compute Node' )
121     Switch.Coords( 195 , 129 )
122     ISwitcha = Switch.InPort( 'a' , 'long' )
123     ISwitchGate = Switch.GetInPort( 'Gate' )
124     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
125     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
126     OSwitcha = Switch.OutPort( 'a' , 'int' )
127     OSwitchDefault = Switch.GetOutPort( 'Default' )
128     
129     # Creation of Links
130     LIsOddaEndOfSwitcha = GraphSwitchErrExec.Link( OIsOdda , IEndOfSwitcha )
131     
132     LInitLoopSwitchIndexSwitcha = GraphSwitchErrExec.Link( OInitLoopSwitchIndex , ISwitcha )
133     
134     LInitLoopSwitchMinEndOfInitLoopSwitchMin = GraphSwitchErrExec.Link( OInitLoopSwitchMin , IEndOfInitLoopSwitchMin )
135     
136     LInitLoopSwitchMaxEndOfInitLoopSwitchMax = GraphSwitchErrExec.Link( OInitLoopSwitchMax , IEndOfInitLoopSwitchMax )
137     
138     LIsEvenaEndOfSwitcha = GraphSwitchErrExec.Link( OIsEvena , IEndOfSwitcha )
139     
140     LSwitchOddIsOddGate = GraphSwitchErrExec.Link( OSwitchOdd , IIsOddGate )
141     
142     LSwitchEvenIsEvenGate = GraphSwitchErrExec.Link( OSwitchEven , IIsEvenGate )
143     
144     LSwitchaIsOdda = GraphSwitchErrExec.Link( OSwitcha , IIsOdda )
145     
146     LSwitchaIsEvena = GraphSwitchErrExec.Link( OSwitcha , IIsEvena )
147     
148     LSwitchDefaultEndOfSwitchDefault = GraphSwitchErrExec.Link( OSwitchDefault , IEndOfSwitchDefault )
149     
150     LEndOfSwitchaEndOfInitLoopSwitchIndex = GraphSwitchErrExec.Link( OEndOfSwitcha , IEndOfInitLoopSwitchIndex )
151     
152     # Input datas
153     IInitLoopSwitchIndex.Input( 0 )
154     IInitLoopSwitchMin.Input( -5 )
155     IInitLoopSwitchMax.Input( 10 )
156     
157     # Output Ports of the graph
158     #OEndOfInitLoopSwitchIndex = EndOfInitLoopSwitch.GetOutPort( 'Index' )
159     #OEndOfInitLoopSwitchMin = EndOfInitLoopSwitch.GetOutPort( 'Min' )
160     #OEndOfInitLoopSwitchMax = EndOfInitLoopSwitch.GetOutPort( 'Max' )
161     return GraphSwitchErrExec
162
163
164 GraphSwitchErrExec = DefGraphSwitchErrExec()