Salome HOME
Imported using TkCVS
[samples/datafiles.git] / Superv / Python / GraphLoopSwitchDefaultAborted.py
1
2 # Generated python file of Graph GraphLoopSwitchDefaultAborted
3
4 from SuperV import *
5
6 # Graph creation of GraphLoopSwitchDefaultAborted
7 def DefGraphLoopSwitchDefaultAborted() :
8     GraphLoopSwitchDefaultAborted = Graph( 'GraphLoopSwitchDefaultAborted' )
9     GraphLoopSwitchDefaultAborted.SetName( 'GraphLoopSwitchDefaultAborted' )
10     GraphLoopSwitchDefaultAborted.SetAuthor( 'JR' )
11     GraphLoopSwitchDefaultAborted.SetComment( 'Default Ports are not connected and the Executor will detect a Default condition ==> ABORT' )
12     GraphLoopSwitchDefaultAborted.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 (GraphLoopSwitch1)"        ' )
21     PyIsOdd.append( '    sleep( 1 )     ' )
22     PyIsOdd.append( '    return a       ' )
23     IsOdd = GraphLoopSwitchDefaultAborted.INode( 'IsOdd' , PyIsOdd )
24     IsOdd.SetName( 'IsOdd' )
25     IsOdd.SetAuthor( '' )
26     IsOdd.SetComment( 'Python function' )
27     IsOdd.Coords( 397 , 1 )
28     IIsOdda = IsOdd.InPort( 'a' , 'long' )
29     IIsOddGate = IsOdd.GetInPort( 'Gate' )
30     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
31     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
32     
33     PyVala = []
34     PyVala.append( 'from time import * ' )
35     PyVala.append( 'def ValEven(Even) : ' )
36     PyVala.append( '    sleep(1) ' )
37     PyVala.append( '    return Even   ' )
38     PyVala.append( '' )
39     Vala = GraphLoopSwitchDefaultAborted.INode( 'ValEven' , PyVala )
40     Vala.SetName( 'Vala' )
41     Vala.SetAuthor( '' )
42     Vala.SetComment( 'Compute Node' )
43     Vala.Coords( 394 , 137 )
44     IValaEven = Vala.InPort( 'Even' , 'long' )
45     IValaGate = Vala.GetInPort( 'Gate' )
46     OValaEven = Vala.OutPort( 'Even' , 'long' )
47     OValaGate = Vala.GetOutPort( 'Gate' )
48     
49     # Creation of Loop Nodes
50     PyInitLoop = []
51     PyInitLoop.append( 'def InitLoop(Index,Min,Max) : ' )
52     PyInitLoop.append( '        Index = Min ' )
53     PyInitLoop.append( '        return Index,Min,Max ' )
54     PyInitLoop.append( '' )
55     PyMoreInitLoop = []
56     PyMoreInitLoop.append( '' )
57     PyNextInitLoop = []
58     PyNextInitLoop.append( '' )
59     InitLoop,EndOfInitLoop = GraphLoopSwitchDefaultAborted.LNode( 'InitLoop' , PyInitLoop , '' , PyMoreInitLoop , '' , PyNextInitLoop )
60     EndOfInitLoop.SetName( 'EndOfInitLoop' )
61     EndOfInitLoop.SetAuthor( '' )
62     EndOfInitLoop.SetComment( 'Compute Node' )
63     EndOfInitLoop.Coords( 767 , 102 )
64     PyEndOfInitLoop = []
65     PyEndOfInitLoop.append( 'def EndOfInitLoop( DoLoop , Index , Min , Max ) :' )
66     PyEndOfInitLoop.append( '   Index = Index + 1     ' )
67     PyEndOfInitLoop.append( '   if Index <= Max :   ' )
68     PyEndOfInitLoop.append( '           DoLoop = 1     ' )
69     PyEndOfInitLoop.append( '   else :     ' )
70     PyEndOfInitLoop.append( '           DoLoop = 0     ' )
71     PyEndOfInitLoop.append( '   return DoLoop,Index,Min,Max     ' )
72     EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
73     IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
74     IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
75     IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
76     IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
77     IInitLoopGate = InitLoop.GetInPort( 'Gate' )
78     OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
79     OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
80     OInitLoopMin = InitLoop.GetOutPort( 'Min' )
81     OInitLoopMax = InitLoop.GetOutPort( 'Max' )
82     IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
83     IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
84     IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
85     IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
86     IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
87     OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
88     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
89     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
90     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
91     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
92     InitLoop.SetName( 'InitLoop' )
93     InitLoop.SetAuthor( '' )
94     InitLoop.SetComment( 'Compute Node' )
95     InitLoop.Coords( 10 , 108 )
96     
97     # Creation of Switch Nodes
98     PySwitch = []
99     PySwitch.append( 'from time import *  ' )
100     PySwitch.append( 'def Switch(a) :    ' )
101     PySwitch.append( '    if ( a & 1 ) == 0 :  ' )
102     PySwitch.append( '        sleep(1)  ' )
103     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
104     Switch,EndSwitch = GraphLoopSwitchDefaultAborted.SNode( 'Switch' , PySwitch )
105     EndSwitch.SetName( 'EndSwitch' )
106     EndSwitch.SetAuthor( '' )
107     EndSwitch.SetComment( 'Compute Node' )
108     EndSwitch.Coords( 587 , 103 )
109     PyEndSwitch = []
110     PyEndSwitch.append( 'def EndSwitch(a,Even) : ' )
111     PyEndSwitch.append( '    sleep(1)     ' )
112     PyEndSwitch.append( '    return a       ' )
113     EndSwitch.SetPyFunction( 'EndSwitch' , PyEndSwitch )
114     IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
115     IEndSwitchEven = EndSwitch.InPort( 'Even' , 'long' )
116     IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
117     OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
118     OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
119     Switch.SetName( 'Switch' )
120     Switch.SetAuthor( '' )
121     Switch.SetComment( 'Compute Node' )
122     Switch.Coords( 194 , 109 )
123     ISwitcha = Switch.InPort( 'a' , 'long' )
124     ISwitchGate = Switch.GetInPort( 'Gate' )
125     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
126     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
127     OSwitcha = Switch.OutPort( 'a' , 'int' )
128     OSwitchDefault = Switch.GetOutPort( 'Default' )
129     
130     # Creation of Links
131     LIsOddaEndSwitcha = GraphLoopSwitchDefaultAborted.Link( OIsOdda , IEndSwitcha )
132     
133     LInitLoopIndexSwitcha = GraphLoopSwitchDefaultAborted.Link( OInitLoopIndex , ISwitcha )
134     
135     LInitLoopMinEndOfInitLoopMin = GraphLoopSwitchDefaultAborted.Link( OInitLoopMin , IEndOfInitLoopMin )
136     
137     LInitLoopMaxEndOfInitLoopMax = GraphLoopSwitchDefaultAborted.Link( OInitLoopMax , IEndOfInitLoopMax )
138     
139     LSwitchOddIsOddGate = GraphLoopSwitchDefaultAborted.Link( OSwitchOdd , IIsOddGate )
140     
141     LSwitchEvenValaEven = GraphLoopSwitchDefaultAborted.Link( OSwitchEven , IValaEven )
142     
143     LSwitchaIsOdda = GraphLoopSwitchDefaultAborted.Link( OSwitcha , IIsOdda )
144     
145     LEndSwitchaEndOfInitLoopIndex = GraphLoopSwitchDefaultAborted.Link( OEndSwitcha , IEndOfInitLoopIndex )
146     
147     LValaEvenEndSwitchEven = GraphLoopSwitchDefaultAborted.Link( OValaEven , IEndSwitchEven )
148     
149     # Input datas
150     IInitLoopIndex.Input( 0 )
151     IInitLoopMin.Input( 5 )
152     IInitLoopMax.Input( 23 )
153     
154     # Output Ports of the graph
155     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
156     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
157     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
158     return GraphLoopSwitchDefaultAborted
159
160
161 GraphLoopSwitchDefaultAborted = DefGraphLoopSwitchDefaultAborted()