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