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