Salome HOME
Fix for bug IPAL9983 : Object browser is not updated after dataflow run.
[modules/superv.git] / examples / GraphBadInputInLoop1.py
1
2 # Generated python file of Graph GraphBadInputInLoop1_1
3
4 from SuperV import *
5
6 # Graph creation of GraphBadInputInLoop1_1
7 def DefGraphBadInputInLoop1_1() :
8     GraphBadInputInLoop1_1 = Graph( 'GraphBadInputInLoop1_1' )
9     GraphBadInputInLoop1_1.SetName( 'GraphBadInputInLoop1_1' )
10     GraphBadInputInLoop1_1.SetAuthor( '' )
11     GraphBadInputInLoop1_1.SetComment( '' )
12     GraphBadInputInLoop1_1.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 = GraphBadInputInLoop1_1.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     PyBadInputOfLoop = []
34     PyBadInputOfLoop.append( 'def BadInputOfLoop() : ' )
35     PyBadInputOfLoop.append( '  return 1 ' )
36     PyBadInputOfLoop.append( '' )
37     BadInputOfLoop = GraphBadInputInLoop1_1.INode( 'BadInputOfLoop' , PyBadInputOfLoop )
38     BadInputOfLoop.SetName( 'BadInputOfLoop' )
39     BadInputOfLoop.SetAuthor( '' )
40     BadInputOfLoop.SetComment( 'Compute Node' )
41     BadInputOfLoop.Coords( 15 , 307 )
42     IBadInputOfLoopGate = BadInputOfLoop.GetInPort( 'Gate' )
43     OBadInputOfLoopInputInLoop = BadInputOfLoop.OutPort( 'InputInLoop' , 'boolean' )
44     OBadInputOfLoopGate = BadInputOfLoop.GetOutPort( 'Gate' )
45     
46     # Creation of Loop Nodes
47     PyInitLoop = []
48     PyMoreInitLoop = []
49     PyMoreInitLoop.append( '' )
50     PyNextInitLoop = []
51     PyNextInitLoop.append( '' )
52     InitLoop,EndOfInitLoop = GraphBadInputInLoop1_1.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 = GraphBadInputInLoop1_1.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 = GraphBadInputInLoop1_1.Link( OIsOdda , IEndSwitcha )
125     
126     LInitLoopIndexSwitcha = GraphBadInputInLoop1_1.Link( OInitLoopIndex , ISwitcha )
127     
128     LInitLoopMinEndOfInitLoopMin = GraphBadInputInLoop1_1.Link( OInitLoopMin , IEndOfInitLoopMin )
129     
130     LSwitchOddIsOddGate = GraphBadInputInLoop1_1.Link( OSwitchOdd , IIsOddGate )
131     
132     LSwitchEvenEndSwitchDefault = GraphBadInputInLoop1_1.Link( OSwitchEven , IEndSwitchDefault )
133     
134     LSwitchaIsOdda = GraphBadInputInLoop1_1.Link( OSwitcha , IIsOdda )
135     
136     LEndSwitchaEndOfInitLoopIndex = GraphBadInputInLoop1_1.Link( OEndSwitcha , IEndOfInitLoopIndex )
137     
138     LBadInputOfLoopInputInLoopEndOfInitLoopMax = GraphBadInputInLoop1_1.Link( OBadInputOfLoopInputInLoop , IEndOfInitLoopMax )
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 GraphBadInputInLoop1_1
150
151
152 GraphBadInputInLoop1_1 = DefGraphBadInputInLoop1_1()