Salome HOME
Fix for improvement IPAL9815 : Remove "Add Port" functionality as duplicate of "Edit...
[modules/superv.git] / examples / GraphStreamInLines.py
1
2 # Generated python file of Graph GraphStreamInLines
3
4 from SuperV import *
5
6 # Graph creation of GraphStreamInLines
7 def DefGraphStreamInLines() :
8     GraphStreamInLines = StreamGraph( 'GraphStreamInLines' )
9     GraphStreamInLines.SetStreamParams( 300 , SUPERV.WithoutTrace , 0 )
10     GraphStreamInLines.SetName( 'GraphStreamInLines' )
11     GraphStreamInLines.SetAuthor( '' )
12     GraphStreamInLines.SetComment( '' )
13     GraphStreamInLines.Coords( 0 , 0 )
14     
15     # Creation of Factory Nodes
16     
17     # Creation of InLine Nodes
18     PyIsOdd = []
19     PyIsOdd.append( 'from time import *    ' )
20     PyIsOdd.append( 'def IsOdd(a,Even) :        ' )
21     PyIsOdd.append( '    print a,"IsOdd (GraphStreamInLines1)"       ' )
22     PyIsOdd.append( '    sleep( 1 )    ' )
23     PyIsOdd.append( '    return a      ' )
24     IsOdd = GraphStreamInLines.INode( 'IsOdd' , PyIsOdd )
25     IsOdd.SetName( 'IsOdd' )
26     IsOdd.SetAuthor( '' )
27     IsOdd.SetComment( 'Python function' )
28     IsOdd.Coords( 404 , 7 )
29     IIsOdda = IsOdd.InPort( 'a' , 'long' )
30     IIsOddEven = IsOdd.InPort( 'Even' , 'boolean' )
31     IIsOddGate = IsOdd.GetInPort( 'Gate' )
32     OIsOdda = IsOdd.OutPort( 'a' , 'long' )
33     OIsOddGate = IsOdd.GetOutPort( 'Gate' )
34     IIsOddistream = IsOdd.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
35     IIsOddistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
36     OIsOddostream = IsOdd.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
37     OIsOddostream.SetNumberOfValues( 0 )
38     
39     # Creation of Loop Nodes
40     PyInitLoop = []
41     PyMoreInitLoop = []
42     PyMoreInitLoop.append( '' )
43     PyNextInitLoop = []
44     PyNextInitLoop.append( '' )
45     InitLoop,EndOfInitLoop = GraphStreamInLines.LNode( '' , PyInitLoop , '' , PyMoreInitLoop , '' , PyNextInitLoop )
46     EndOfInitLoop.SetName( 'EndOfInitLoop' )
47     EndOfInitLoop.SetAuthor( '' )
48     EndOfInitLoop.SetComment( 'Compute Node' )
49     EndOfInitLoop.Coords( 807 , 104 )
50     PyEndOfInitLoop = []
51     PyEndOfInitLoop.append( 'def EndOfInitLoop( DoLoop , Index , Min , Max ) :' )
52     PyEndOfInitLoop.append( '   Index = Index + 1     ' )
53     PyEndOfInitLoop.append( '   if Index <= Max :   ' )
54     PyEndOfInitLoop.append( '           DoLoop = 1     ' )
55     PyEndOfInitLoop.append( '   else :     ' )
56     PyEndOfInitLoop.append( '           DoLoop = 0     ' )
57     PyEndOfInitLoop.append( '   return DoLoop,Index,Min,Max     ' )
58     EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
59     IInitLoopDoLoop = InitLoop.GetInPort( 'DoLoop' )
60     IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
61     IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
62     IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
63     IInitLoopistream = InitLoop.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
64     IInitLoopistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
65     IInitLoopGate = InitLoop.GetInPort( 'Gate' )
66     OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
67     OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
68     OInitLoopMin = InitLoop.GetOutPort( 'Min' )
69     OInitLoopMax = InitLoop.GetOutPort( 'Max' )
70     OInitLoopostream = InitLoop.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
71     OInitLoopostream.SetNumberOfValues( 0 )
72     IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
73     IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
74     IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
75     IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
76     IEndOfInitLoopistream = EndOfInitLoop.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
77     IEndOfInitLoopistream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
78     IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
79     OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
80     OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
81     OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
82     OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
83     OEndOfInitLoopGate = EndOfInitLoop.GetOutPort( 'Gate' )
84     OEndOfInitLoopostream = EndOfInitLoop.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
85     OEndOfInitLoopostream.SetNumberOfValues( 0 )
86     InitLoop.SetName( 'InitLoop' )
87     InitLoop.SetAuthor( '' )
88     InitLoop.SetComment( 'Compute Node' )
89     InitLoop.Coords( 11 , 119 )
90     IInitLoopistream = InitLoop.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
91     IInitLoopistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
92     OInitLoopostream = InitLoop.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
93     OInitLoopostream.SetNumberOfValues( 0 )
94     
95     # Creation of Switch Nodes
96     PySwitch = []
97     PySwitch.append( 'from time import *  ' )
98     PySwitch.append( 'def Switch(a) :    ' )
99     PySwitch.append( '    if ( a & 1 ) == 0 :  ' )
100     PySwitch.append( '        sleep(1)  ' )
101     PySwitch.append( '    return a & 1,1-(a&1),a    ' )
102     Switch,EndSwitch = GraphStreamInLines.SNode( 'Switch' , PySwitch )
103     EndSwitch.SetName( 'EndSwitch' )
104     EndSwitch.SetAuthor( '' )
105     EndSwitch.SetComment( 'Compute Node' )
106     EndSwitch.Coords( 604 , 105 )
107     PyEndSwitch = []
108     PyEndSwitch.append( 'def EndOfSwitch(a) :    ' )
109     PyEndSwitch.append( '    if ( a & 1 ) == 0 :  ' )
110     PyEndSwitch.append( '        sleep(1)  ' )
111     PyEndSwitch.append( '    return a    ' )
112     EndSwitch.SetPyFunction( 'EndOfSwitch' , PyEndSwitch )
113     IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
114     IEndSwitchistream = EndSwitch.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
115     IEndSwitchistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
116     IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
117     OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
118     OEndSwitchostream = EndSwitch.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
119     OEndSwitchostream.SetNumberOfValues( 0 )
120     OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
121     Switch.SetName( 'Switch' )
122     Switch.SetAuthor( '' )
123     Switch.SetComment( 'Compute Node' )
124     Switch.Coords( 198 , 115 )
125     ISwitcha = Switch.InPort( 'a' , 'long' )
126     ISwitchGate = Switch.GetInPort( 'Gate' )
127     OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
128     OSwitchEven = Switch.OutPort( 'Even' , 'int' )
129     OSwitcha = Switch.OutPort( 'a' , 'int' )
130     OSwitchDefault = Switch.GetOutPort( 'Default' )
131     ISwitchistream = Switch.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
132     ISwitchistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
133     OSwitchostream = Switch.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
134     OSwitchostream.SetNumberOfValues( 0 )
135     
136     # Creation of Links
137     LIsOddaEndSwitcha = GraphStreamInLines.Link( OIsOdda , IEndSwitcha )
138     
139     LIsOddostreamInitLoopistream = GraphStreamInLines.StreamLink( OIsOddostream , IInitLoopistream )
140     LIsOddostreamInitLoopistream.AddCoord( 1 , 3 , 240 )
141     LIsOddostreamInitLoopistream.AddCoord( 2 , 3 , 395 )
142     LIsOddostreamInitLoopistream.AddCoord( 3 , 571 , 394 )
143     LIsOddostreamInitLoopistream.AddCoord( 4 , 577 , 122 )
144     
145     LInitLoopIndexSwitcha = GraphStreamInLines.Link( OInitLoopIndex , ISwitcha )
146     
147     LInitLoopMinEndOfInitLoopMin = GraphStreamInLines.Link( OInitLoopMin , IEndOfInitLoopMin )
148     
149     LInitLoopMaxEndOfInitLoopMax = GraphStreamInLines.Link( OInitLoopMax , IEndOfInitLoopMax )
150     
151     LInitLoopostreamEndSwitchistream = GraphStreamInLines.StreamLink( OInitLoopostream , IEndSwitchistream )
152     LInitLoopostreamEndSwitchistream.AddCoord( 1 , 586 , 158 )
153     LInitLoopostreamEndSwitchistream.AddCoord( 2 , 586 , 362 )
154     LInitLoopostreamEndSwitchistream.AddCoord( 3 , 591 , 362 )
155     LInitLoopostreamEndSwitchistream.AddCoord( 4 , 591 , 359 )
156     LInitLoopostreamEndSwitchistream.AddCoord( 5 , 180 , 359 )
157     LInitLoopostreamEndSwitchistream.AddCoord( 6 , 180 , 212 )
158     LInitLoopostreamEndSwitchistream.AddCoord( 7 , 181 , 212 )
159     LInitLoopostreamEndSwitchistream.AddCoord( 8 , 181 , 214 )
160     LInitLoopostreamEndSwitchistream.AddCoord( 9 , 584 , 167 )
161     LInitLoopostreamEndSwitchistream.AddCoord( 10 , 584 , 369 )
162     LInitLoopostreamEndSwitchistream.AddCoord( 11 , 184 , 368 )
163     LInitLoopostreamEndSwitchistream.AddCoord( 12 , 185 , 240 )
164     
165     LSwitchOddIsOddGate = GraphStreamInLines.Link( OSwitchOdd , IIsOddGate )
166     
167     LSwitchEvenIsOddEven = GraphStreamInLines.Link( OSwitchEven , IIsOddEven )
168     
169     LSwitchaIsOdda = GraphStreamInLines.Link( OSwitcha , IIsOdda )
170     
171     LSwitchostreamIsOddistream = GraphStreamInLines.StreamLink( OSwitchostream , IIsOddistream )
172     
173     LSwitchostreamEndOfInitLoopistream = GraphStreamInLines.StreamLink( OSwitchostream , IEndOfInitLoopistream )
174     LSwitchostreamEndOfInitLoopistream.AddCoord( 1 , 779 , 203 )
175     LSwitchostreamEndOfInitLoopistream.AddCoord( 2 , 775 , 261 )
176     LSwitchostreamEndOfInitLoopistream.AddCoord( 3 , 397 , 260 )
177     LSwitchostreamEndOfInitLoopistream.AddCoord( 4 , 403 , 217 )
178     
179     LSwitchDefaultEndSwitchDefault = GraphStreamInLines.Link( OSwitchDefault , IEndSwitchDefault )
180     
181     LEndSwitchaEndOfInitLoopIndex = GraphStreamInLines.Link( OEndSwitcha , IEndOfInitLoopIndex )
182     
183     LEndSwitchostreamSwitchistream = GraphStreamInLines.StreamLink( OEndSwitchostream , ISwitchistream )
184     LEndSwitchostreamSwitchistream.AddCoord( 1 , 186 , 240 )
185     LEndSwitchostreamSwitchistream.AddCoord( 2 , 186 , 331 )
186     LEndSwitchostreamSwitchistream.AddCoord( 3 , 790 , 329 )
187     LEndSwitchostreamSwitchistream.AddCoord( 4 , 786 , 161 )
188     
189     # Input datas
190     IInitLoopIndex.Input( 0 )
191     IInitLoopMin.Input( 0 )
192     IInitLoopMax.Input( 35 )
193     
194     # Output Ports of the graph
195     #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
196     #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
197     #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
198     return GraphStreamInLines
199
200
201 GraphStreamInLines = DefGraphStreamInLines()