Salome HOME
f8c17e3a19878b2374e9c139229e9625ad91ca39
[modules/superv.git] / examples / GraphBadInputInLoop.py
1
2 # Generated python file of Graph GraphBadInputInLoop
3
4 from SuperV import *
5
6 # Graph creation of GraphBadInputInLoop
7 def DefGraphBadInputInLoop() :
8     GraphBadInputInLoop = Graph( 'GraphBadInputInLoop' )
9     GraphBadInputInLoop.SetName( 'GraphBadInputInLoop' )
10     GraphBadInputInLoop.SetAuthor( '' )
11     GraphBadInputInLoop.SetComment( '' )
12     GraphBadInputInLoop.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,Even) :        ' )
20     PyIsOdd.append( '    print a,"IsOdd (GraphLoopSwitch1)"       ' )
21     PyIsOdd.append( '    sleep( 1 )    ' )
22     PyIsOdd.append( '    return a      ' )
23     IsOdd = GraphBadInputInLoop.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     IIsOddEven = IsOdd.InPort( 'Even' , '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 = GraphBadInputInLoop.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 = GraphBadInputInLoop.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     IInitLoopInitLoop = InitLoop.GetInPort( 'InitLoop' )
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     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 = GraphBadInputInLoop.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 = GraphBadInputInLoop.Link( OIsOdda , IEndSwitcha )
125     LIsOddaEndSwitcha.AddCoord( 1 , 576 , 136 )
126     LIsOddaEndSwitcha.AddCoord( 2 , 575 , 81 )
127     
128     LInitLoopIndexSwitcha = GraphBadInputInLoop.Link( OInitLoopIndex , ISwitcha )
129     
130     LInitLoopMinEndOfInitLoopMin = GraphBadInputInLoop.Link( OInitLoopMin , IEndOfInitLoopMin )
131     
132     LSwitchOddIsOddGate = GraphBadInputInLoop.Link( OSwitchOdd , IIsOddGate )
133     
134     LSwitchEvenEndSwitchDefault = GraphBadInputInLoop.Link( OSwitchEven , IEndSwitchDefault )
135     
136     LSwitchEvenIsOddEven = GraphBadInputInLoop.Link( OSwitchEven , IIsOddEven )
137     LSwitchEvenIsOddEven.AddCoord( 1 , 375 , 111 )
138     LSwitchEvenIsOddEven.AddCoord( 2 , 375 , 172 )
139     
140     LSwitchaIsOdda = GraphBadInputInLoop.Link( OSwitcha , IIsOdda )
141     LSwitchaIsOdda.AddCoord( 1 , 362 , 82 )
142     LSwitchaIsOdda.AddCoord( 2 , 360 , 201 )
143     
144     LEndSwitchaEndOfInitLoopIndex = GraphBadInputInLoop.Link( OEndSwitcha , IEndOfInitLoopIndex )
145     
146     LBadInputOfLoopInputInLoopSwitchGate = GraphBadInputInLoop.Link( OBadInputOfLoopInputInLoop , ISwitchGate )
147     
148     # Input datas
149     IInitLoopIndex.Input( 0 )
150     IInitLoopMin.Input( 0 )
151     IInitLoopMax.Input( 100 )
152     IEndOfInitLoopMax.Input( 136221856 )
153     
154     # Output Ports of the graph
155     #OInitLoopMax = InitLoop.GetOutPort( 'Max' )
156     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
157     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
158     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
159     return GraphBadInputInLoop
160
161
162 GraphBadInputInLoop = DefGraphBadInputInLoop()