Salome HOME
New test of MacroNodes
[samples/datafiles.git] / Superv / Python / GraphBadInputInLoop.py
1
2 # Generated python file of Graph GraphBadInputInLoop_1
3
4 from SuperV import *
5
6 # Graph creation of GraphBadInputInLoop_1
7 def DefGraphBadInputInLoop_1() :
8     GraphBadInputInLoop_1 = Graph( 'GraphBadInputInLoop_1' )
9     GraphBadInputInLoop_1.SetName( 'GraphBadInputInLoop_1' )
10     GraphBadInputInLoop_1.SetAuthor( '' )
11     GraphBadInputInLoop_1.SetComment( '' )
12     GraphBadInputInLoop_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 = GraphBadInputInLoop_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 = GraphBadInputInLoop_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' , 'long' )
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 = GraphBadInputInLoop_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 = GraphBadInputInLoop_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     ISwitchInputInLoop = Switch.InPort( 'InputInLoop' , '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 = GraphBadInputInLoop_1.Link( OIsOdda , IEndSwitcha )
126     
127     LInitLoopIndexSwitcha = GraphBadInputInLoop_1.Link( OInitLoopIndex , ISwitcha )
128     
129     LInitLoopMinEndOfInitLoopMin = GraphBadInputInLoop_1.Link( OInitLoopMin , IEndOfInitLoopMin )
130     
131     LSwitchOddIsOddGate = GraphBadInputInLoop_1.Link( OSwitchOdd , IIsOddGate )
132     
133     LSwitchaIsOdda = GraphBadInputInLoop_1.Link( OSwitcha , IIsOdda )
134     
135     LEndSwitchaEndOfInitLoopIndex = GraphBadInputInLoop_1.Link( OEndSwitcha , IEndOfInitLoopIndex )
136     
137     LBadInputOfLoopInputInLoopSwitchInputInLoop = GraphBadInputInLoop_1.Link( OBadInputOfLoopInputInLoop , ISwitchInputInLoop )
138     
139     # Input datas
140     IInitLoopIndex.Input( 0 )
141     IInitLoopMin.Input( 0 )
142     IInitLoopMax.Input( 100 )
143     
144     # Output Ports of the graph
145     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
146     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
147     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
148     #OSwitchEven = Switch.GetOutPort( 'Even' )
149     return GraphBadInputInLoop_1
150
151
152 GraphBadInputInLoop_1 = DefGraphBadInputInLoop_1()