2 # Generated python file of Graph GraphStreamInLines
6 GraphStreamInLines = StreamGraph( 'GraphStreamInLines' )
7 GraphStreamInLines.SetStreamParams( 300 , SUPERV.WithoutTrace , 0 )
8 GraphStreamInLines.SetName( 'GraphStreamInLines' )
9 GraphStreamInLines.SetAuthor( '' )
10 GraphStreamInLines.SetComment( '' )
11 GraphStreamInLines.Coords( 0 , 0 )
13 # Creation of Factory Nodes
15 # Creation of InLine Nodes
17 PyIsOdd.append( 'from time import * ' )
18 PyIsOdd.append( 'def IsOdd(a,Even) : ' )
19 PyIsOdd.append( ' print a,"IsOdd (GraphStreamInLines1)" ' )
20 PyIsOdd.append( ' sleep( 1 ) ' )
21 PyIsOdd.append( ' return a ' )
22 IsOdd = GraphStreamInLines.INode( 'IsOdd' , PyIsOdd )
23 IsOdd.SetName( 'IsOdd' )
25 IsOdd.SetComment( 'Python function' )
26 IsOdd.Coords( 394 , 59 )
27 IIsOdda = IsOdd.InPort( 'a' , 'long' )
28 IIsOddEven = IsOdd.InPort( 'Even' , 'boolean' )
29 IIsOddGate = IsOdd.GetInPort( 'Gate' )
30 OIsOdda = IsOdd.OutPort( 'a' , 'long' )
31 OIsOddGate = IsOdd.GetOutPort( 'Gate' )
32 IIsOddistream = IsOdd.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
33 IIsOddistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
34 OIsOddostream = IsOdd.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
35 OIsOddostream.SetNumberOfValues( 0 )
37 # Creation of Loop Nodes
40 PyMoreInitLoop.append( '' )
42 PyNextInitLoop.append( '' )
43 InitLoop,EndOfInitLoop = GraphStreamInLines.LNode( '' , PyInitLoop , '' , PyMoreInitLoop , '' , PyNextInitLoop )
44 EndOfInitLoop.SetName( 'EndOfInitLoop' )
45 EndOfInitLoop.SetAuthor( '' )
46 EndOfInitLoop.SetComment( '' )
47 EndOfInitLoop.Coords( 776 , 105 )
49 PyEndOfInitLoop.append( 'def EndOfInitLoop( DoLoop , Index , Min , Max ) :' )
50 PyEndOfInitLoop.append( ' Index = Index + 1 ' )
51 PyEndOfInitLoop.append( ' if Index <= Max : ' )
52 PyEndOfInitLoop.append( ' DoLoop = 1 ' )
53 PyEndOfInitLoop.append( ' else : ' )
54 PyEndOfInitLoop.append( ' DoLoop = 0 ' )
55 PyEndOfInitLoop.append( ' return DoLoop,Index,Min,Max ' )
56 EndOfInitLoop.SetPyFunction( 'EndOfInitLoop' , PyEndOfInitLoop )
57 IInitLoopInitLoop = InitLoop.GetInPort( 'DoLoop' )
58 IInitLoopIndex = InitLoop.InPort( 'Index' , 'long' )
59 IInitLoopMin = InitLoop.InPort( 'Min' , 'long' )
60 IInitLoopMax = InitLoop.InPort( 'Max' , 'long' )
61 IInitLoopistream = InitLoop.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
62 IInitLoopistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
63 IInitLoopGate = InitLoop.GetInPort( 'Gate' )
64 OInitLoopDoLoop = InitLoop.GetOutPort( 'DoLoop' )
65 OInitLoopIndex = InitLoop.GetOutPort( 'Index' )
66 OInitLoopMin = InitLoop.GetOutPort( 'Min' )
67 OInitLoopMax = InitLoop.GetOutPort( 'Max' )
68 OInitLoopostream = InitLoop.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
69 OInitLoopostream.SetNumberOfValues( 0 )
70 IEndOfInitLoopDoLoop = EndOfInitLoop.GetInPort( 'DoLoop' )
71 IEndOfInitLoopIndex = EndOfInitLoop.GetInPort( 'Index' )
72 IEndOfInitLoopMin = EndOfInitLoop.GetInPort( 'Min' )
73 IEndOfInitLoopMax = EndOfInitLoop.GetInPort( 'Max' )
74 IEndOfInitLoopistream = EndOfInitLoop.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
75 IEndOfInitLoopistream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
76 IEndOfInitLoopGate = EndOfInitLoop.GetInPort( 'Gate' )
77 OEndOfInitLoopDoLoop = EndOfInitLoop.GetOutPort( 'DoLoop' )
78 OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
79 OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
80 OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
81 OEndOfInitLoopostream = EndOfInitLoop.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
82 OEndOfInitLoopostream.SetNumberOfValues( 0 )
83 InitLoop.SetName( 'InitLoop' )
84 InitLoop.SetAuthor( '' )
85 InitLoop.SetComment( '' )
86 InitLoop.Coords( 11 , 119 )
87 IInitLoopistream = InitLoop.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
88 IInitLoopistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
89 OInitLoopostream = InitLoop.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
90 OInitLoopostream.SetNumberOfValues( 0 )
92 # Creation of Switch Nodes
94 PySwitch.append( 'from time import * ' )
95 PySwitch.append( 'def Switch(a) : ' )
96 PySwitch.append( ' if ( a & 1 ) == 0 : ' )
97 PySwitch.append( ' sleep(1) ' )
98 PySwitch.append( ' return a & 1,1-(a&1),a ' )
99 Switch,EndSwitch = GraphStreamInLines.SNode( 'Switch' , PySwitch )
100 EndSwitch.SetName( 'EndSwitch' )
101 EndSwitch.SetAuthor( '' )
102 EndSwitch.SetComment( '' )
103 EndSwitch.Coords( 587 , 104 )
105 PyEndSwitch.append( 'def EndOfSwitch(a) : ' )
106 PyEndSwitch.append( ' if ( a & 1 ) == 0 : ' )
107 PyEndSwitch.append( ' sleep(1) ' )
108 PyEndSwitch.append( ' return a ' )
109 EndSwitch.SetPyFunction( 'EndOfSwitch' , PyEndSwitch )
110 IEndSwitcha = EndSwitch.InPort( 'a' , 'long' )
111 IEndSwitchistream = EndSwitch.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
112 IEndSwitchistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
113 IEndSwitchDefault = EndSwitch.GetInPort( 'Default' )
114 OEndSwitcha = EndSwitch.OutPort( 'a' , 'long' )
115 OEndSwitchostream = EndSwitch.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
116 OEndSwitchostream.SetNumberOfValues( 0 )
117 OEndSwitchGate = EndSwitch.GetOutPort( 'Gate' )
118 Switch.SetName( 'Switch' )
119 Switch.SetAuthor( '' )
120 Switch.SetComment( '' )
121 Switch.Coords( 197 , 119 )
122 ISwitcha = Switch.InPort( 'a' , 'long' )
123 ISwitchGate = Switch.GetInPort( 'Gate' )
124 OSwitchOdd = Switch.OutPort( 'Odd' , 'long' )
125 OSwitchEven = Switch.OutPort( 'Even' , 'int' )
126 OSwitcha = Switch.OutPort( 'a' , 'int' )
127 OSwitchDefault = Switch.GetOutPort( 'Default' )
128 ISwitchistream = Switch.InStreamPort( 'istream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_TEMPORAL )
129 ISwitchistream.SetParams( SUPERV.TI , SUPERV.L1 , SUPERV.EXTRANULL )
130 OSwitchostream = Switch.OutStreamPort( 'ostream' , SALOME_ModuleCatalog.DATASTREAM_INTEGER , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE )
131 OSwitchostream.SetNumberOfValues( 0 )
134 LIsOddaEndSwitcha = GraphStreamInLines.Link( OIsOdda , IEndSwitcha )
136 LIsOddostreamInitLoopistream = GraphStreamInLines.StreamLink( OIsOddostream , IInitLoopistream )
137 LIsOddostreamInitLoopistream.AddCoord( 1 , 3 , 240 )
138 LIsOddostreamInitLoopistream.AddCoord( 2 , 3 , 395 )
139 LIsOddostreamInitLoopistream.AddCoord( 3 , 571 , 394 )
140 LIsOddostreamInitLoopistream.AddCoord( 4 , 571 , 187 )
142 LInitLoopIndexSwitcha = GraphStreamInLines.Link( OInitLoopIndex , ISwitcha )
144 LInitLoopMinEndOfInitLoopMin = GraphStreamInLines.Link( OInitLoopMin , IEndOfInitLoopMin )
146 LInitLoopMaxEndOfInitLoopMax = GraphStreamInLines.Link( OInitLoopMax , IEndOfInitLoopMax )
148 LInitLoopostreamEndSwitchistream = GraphStreamInLines.StreamLink( OInitLoopostream , IEndSwitchistream )
149 LInitLoopostreamEndSwitchistream.AddCoord( 1 , 584 , 167 )
150 LInitLoopostreamEndSwitchistream.AddCoord( 2 , 584 , 369 )
151 LInitLoopostreamEndSwitchistream.AddCoord( 3 , 184 , 368 )
152 LInitLoopostreamEndSwitchistream.AddCoord( 4 , 185 , 240 )
154 LSwitchOddIsOddGate = GraphStreamInLines.Link( OSwitchOdd , IIsOddGate )
155 LSwitchOddIsOddGate.AddCoord( 1 , 373 , 222 )
156 LSwitchOddIsOddGate.AddCoord( 2 , 373 , 147 )
158 LSwitchEvenEndSwitchDefault = GraphStreamInLines.Link( OSwitchEven , IEndSwitchDefault )
160 LSwitchEvenIsOddEven = GraphStreamInLines.Link( OSwitchEven , IIsOddEven )
161 LSwitchEvenIsOddEven.AddCoord( 1 , 363 , 154 )
162 LSwitchEvenIsOddEven.AddCoord( 2 , 362 , 177 )
164 LSwitchaIsOdda = GraphStreamInLines.Link( OSwitcha , IIsOdda )
165 LSwitchaIsOdda.AddCoord( 1 , 385 , 123 )
166 LSwitchaIsOdda.AddCoord( 2 , 386 , 206 )
168 LSwitchostreamIsOddistream = GraphStreamInLines.StreamLink( OSwitchostream , IIsOddistream )
169 LSwitchostreamIsOddistream.AddCoord( 1 , 360 , 185 )
170 LSwitchostreamIsOddistream.AddCoord( 2 , 361 , 240 )
172 LSwitchostreamEndOfInitLoopistream = GraphStreamInLines.StreamLink( OSwitchostream , IEndOfInitLoopistream )
173 LSwitchostreamEndOfInitLoopistream.AddCoord( 1 , 775 , 226 )
174 LSwitchostreamEndOfInitLoopistream.AddCoord( 2 , 775 , 261 )
175 LSwitchostreamEndOfInitLoopistream.AddCoord( 3 , 361 , 261 )
176 LSwitchostreamEndOfInitLoopistream.AddCoord( 4 , 361 , 240 )
178 LEndSwitchaEndOfInitLoopIndex = GraphStreamInLines.Link( OEndSwitcha , IEndOfInitLoopIndex )
180 LEndSwitchostreamSwitchistream = GraphStreamInLines.StreamLink( OEndSwitchostream , ISwitchistream )
181 LEndSwitchostreamSwitchistream.AddCoord( 1 , 186 , 240 )
182 LEndSwitchostreamSwitchistream.AddCoord( 2 , 186 , 331 )
183 LEndSwitchostreamSwitchistream.AddCoord( 3 , 766 , 330 )
184 LEndSwitchostreamSwitchistream.AddCoord( 4 , 766 , 167 )
187 IInitLoopIndex.Input( 0 )
188 IInitLoopMin.Input( 0 )
189 IInitLoopMax.Input( 100 )
191 # Output Ports of the graph
192 #OEndOfInitLoopIndex = EndOfInitLoop.GetOutPort( 'Index' )
193 #OEndOfInitLoopMin = EndOfInitLoop.GetOutPort( 'Min' )
194 #OEndOfInitLoopMax = EndOfInitLoop.GetOutPort( 'Max' )
198 GraphStreamInLines.Run()
199 GraphStreamInLines.DoneW()
200 print GraphStreamInLines.State()
202 GraphStreamInLines.PrintPorts()
205 subgraphs = GraphStreamInLines.SubGraphsNumber()
207 while i <= subgraphs :
208 nodes = GraphStreamInLines.SubGraphsNodes( i )
210 while j < len(nodes) :
211 print 'SubGraph',i,nodes[j].Name()
216 substreamgraphs = GraphStreamInLines.SubStreamGraphsNumber()
218 while i <= substreamgraphs :
219 nodes = GraphStreamInLines.SubStreamGraphsNodes( i )
221 while j < len(nodes) :
222 print 'SubStreamGraph',i,nodes[j].Name()
226 GraphStreamInLines.Export('/tmp/GraphStreamInLines.xml')
229 GraphStreamInLines = StreamGraph('/tmp/GraphStreamInLines.xml')
232 GraphStreamInLines.Run()
233 GraphStreamInLines.DoneW()
234 print GraphStreamInLines.State()
236 subgraphs = GraphStreamInLines.SubGraphsNumber()
238 while i <= subgraphs :
239 nodes = GraphStreamInLines.SubGraphsNodes( i )
241 while j < len(nodes) :
242 print 'SubGraph',i,nodes[j].Name()
247 substreamgraphs = GraphStreamInLines.SubStreamGraphsNumber()
249 while i <= substreamgraphs :
250 nodes = GraphStreamInLines.SubStreamGraphsNodes( i )
252 while j < len(nodes) :
253 print 'SubStreamGraph',i,nodes[j].Name()