1 # Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 # Generated python file of Graph GraphStreams
26 GraphStreams = StreamGraph( 'GraphStreams' )
27 GraphStreams.SetStreamParams( 1000 , SUPERV.SummaryTrace , 1.5 )
28 GraphStreams.SetName( 'GraphStreams' )
29 GraphStreams.SetAuthor( 'JR' )
30 GraphStreams.SetComment( 'Graph with DataStreamPorts CEA/EDF : Calcium' )
31 GraphStreams.Coords( 0 , 0 )
33 # Creation of Factory Nodes
35 Add = GraphStreams.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Add' )
38 Add.SetContainer( 'FactoryServer' )
39 Add.SetComment( 'Add from DataStreamFactory' )
40 Add.Coords( 255 , 171 )
41 IAddx = Add.GetInPort( 'x' )
42 IAddy = Add.GetInPort( 'y' )
43 IAddGate = Add.GetInPort( 'Gate' )
44 OAddz = Add.GetOutPort( 'z' )
45 OAddGate = Add.GetOutPort( 'Gate' )
46 IAddistream = Add.GetInStreamPort( 'istream' )
47 IAddistream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
48 OAddostream = Add.GetOutStreamPort( 'ostream' )
49 OAddostream.SetNumberOfValues( 0 )
50 OAddOStream = Add.GetOutStreamPort( 'OStream' )
51 OAddOStream.SetNumberOfValues( 10 )
53 Sub = GraphStreams.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Sub' )
56 Sub.SetContainer( 'FactoryServer' )
57 Sub.SetComment( 'Sub from DataStreamFactory' )
58 Sub.Coords( 519 , 48 )
59 ISubx = Sub.GetInPort( 'x' )
60 ISuby = Sub.GetInPort( 'y' )
61 ISubGate = Sub.GetInPort( 'Gate' )
62 OSubz = Sub.GetOutPort( 'z' )
63 OSubGate = Sub.GetOutPort( 'Gate' )
64 ISubistream = Sub.GetInStreamPort( 'istream' )
65 ISubistream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
66 ISubIstream = Sub.GetInStreamPort( 'Istream' )
67 ISubIstream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
69 Mul = GraphStreams.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Mul' )
72 Mul.SetContainer( 'FactoryServer' )
73 Mul.SetComment( 'Mul from DataStreamFactory' )
74 Mul.Coords( 724 , 142 )
75 IMulx = Mul.GetInPort( 'x' )
76 IMuly = Mul.GetInPort( 'y' )
77 IMulGate = Mul.GetInPort( 'Gate' )
78 OMulz = Mul.GetOutPort( 'z' )
79 OMulGate = Mul.GetOutPort( 'Gate' )
81 Div = GraphStreams.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Div' )
84 Div.SetContainer( 'FactoryServer' )
85 Div.SetComment( 'Div from DataStreamFactory' )
86 Div.Coords( 935 , 48 )
87 IDivx = Div.GetInPort( 'x' )
88 IDivy = Div.GetInPort( 'y' )
89 IDivGate = Div.GetInPort( 'Gate' )
90 ODivz = Div.GetOutPort( 'z' )
91 ODivGate = Div.GetOutPort( 'Gate' )
92 ODivostream = Div.GetOutStreamPort( 'ostream' )
93 ODivostream.SetNumberOfValues( 0 )
95 Add_1 = GraphStreams.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Add' )
96 Add_1.SetName( 'Add_1' )
98 Add_1.SetContainer( 'localhost/FactoryServer' )
99 Add_1.SetComment( 'Add from DataStreamFactory' )
100 Add_1.Coords( 252 , 499 )
101 IAdd_1x = Add_1.GetInPort( 'x' )
102 IAdd_1y = Add_1.GetInPort( 'y' )
103 IAdd_1Gate = Add_1.GetInPort( 'Gate' )
104 OAdd_1z = Add_1.GetOutPort( 'z' )
105 OAdd_1Gate = Add_1.GetOutPort( 'Gate' )
106 IAdd_1istream = Add_1.GetInStreamPort( 'istream' )
107 IAdd_1istream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
108 OAdd_1ostream = Add_1.GetOutStreamPort( 'ostream' )
109 OAdd_1ostream.SetNumberOfValues( 0 )
110 OAdd_1OStream = Add_1.GetOutStreamPort( 'OStream' )
111 OAdd_1OStream.SetNumberOfValues( 0 )
113 Sub_1 = GraphStreams.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Sub' )
114 Sub_1.SetName( 'Sub_1' )
115 Sub_1.SetAuthor( '' )
116 Sub_1.SetContainer( 'localhost/FactoryServer' )
117 Sub_1.SetComment( 'Sub from DataStreamFactory' )
118 Sub_1.Coords( 516 , 385 )
119 ISub_1x = Sub_1.GetInPort( 'x' )
120 ISub_1y = Sub_1.GetInPort( 'y' )
121 ISub_1Gate = Sub_1.GetInPort( 'Gate' )
122 OSub_1z = Sub_1.GetOutPort( 'z' )
123 OSub_1Gate = Sub_1.GetOutPort( 'Gate' )
124 ISub_1istream = Sub_1.GetInStreamPort( 'istream' )
125 ISub_1istream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
126 ISub_1Istream = Sub_1.GetInStreamPort( 'Istream' )
127 ISub_1Istream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
129 Mul_1 = GraphStreams.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Mul' )
130 Mul_1.SetName( 'Mul_1' )
131 Mul_1.SetAuthor( '' )
132 Mul_1.SetContainer( 'localhost/FactoryServer' )
133 Mul_1.SetComment( 'Mul from DataStreamFactory' )
134 Mul_1.Coords( 731 , 487 )
135 IMul_1x = Mul_1.GetInPort( 'x' )
136 IMul_1y = Mul_1.GetInPort( 'y' )
137 IMul_1Gate = Mul_1.GetInPort( 'Gate' )
138 OMul_1z = Mul_1.GetOutPort( 'z' )
139 OMul_1Gate = Mul_1.GetOutPort( 'Gate' )
141 Div_1 = GraphStreams.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Div' )
142 Div_1.SetName( 'Div_1' )
143 Div_1.SetAuthor( '' )
144 Div_1.SetContainer( 'localhost/FactoryServer' )
145 Div_1.SetComment( 'Div from DataStreamFactory' )
146 Div_1.Coords( 931 , 385 )
147 IDiv_1x = Div_1.GetInPort( 'x' )
148 IDiv_1y = Div_1.GetInPort( 'y' )
149 IDiv_1Gate = Div_1.GetInPort( 'Gate' )
150 ODiv_1z = Div_1.GetOutPort( 'z' )
151 ODiv_1Gate = Div_1.GetOutPort( 'Gate' )
152 ODiv_1ostream = Div_1.GetOutStreamPort( 'ostream' )
153 ODiv_1ostream.SetNumberOfValues( 0 )
155 # Creation of Loop Nodes
157 PyLoop.append( 'import time ' )
158 PyLoop.append( 'def Init(Index,Min,Max,Incr,Z_Div,Z_Div_1,y_Add,x_Sub) : ' )
159 PyLoop.append( ' if Min <= Max : ' )
160 PyLoop.append( ' Index = Min ' )
161 PyLoop.append( ' else : ' )
162 PyLoop.append( ' Index = Max ' )
163 PyLoop.append( ' time.sleep( 1 ) ' )
164 PyLoop.append( ' return Index,Min,Max,Incr,Z_Div,Z_Div_1,y_Add,x_Sub ' )
166 PyMoreLoop.append( 'import time ' )
167 PyMoreLoop.append( 'def More(Index,Min,Max,Incr,Z_Div,Z_Div_1,y_Add,x_Sub) : ' )
168 PyMoreLoop.append( ' if Index < Max : ' )
169 PyMoreLoop.append( ' DoLoop = 1 ' )
170 PyMoreLoop.append( ' else : ' )
171 PyMoreLoop.append( ' DoLoop = 0 ' )
172 PyMoreLoop.append( ' time.sleep( 1 ) ' )
173 PyMoreLoop.append( ' return DoLoop,Index,Min,Max,Incr,Z_Div,Z_Div_1,y_Add,x_Sub ' )
175 PyNextLoop.append( 'import time ' )
176 PyNextLoop.append( 'def Next(Index,Min,Max,Incr,Z_Div,Z_Div_1,y_Add,x_Sub) : ' )
177 PyNextLoop.append( ' Index = Index + Incr ' )
178 PyNextLoop.append( ' time.sleep( 1 ) ' )
179 PyNextLoop.append( ' return Index,Min,Max,Incr,Z_Div,Z_Div_1,y_Add,x_Sub ' )
180 Loop,EndLoop = GraphStreams.LNode( 'Init' , PyLoop , 'More' , PyMoreLoop , 'Next' , PyNextLoop )
181 EndLoop.SetName( 'EndLoop' )
182 EndLoop.SetAuthor( '' )
183 EndLoop.SetComment( '' )
184 EndLoop.Coords( 1158 , 393 )
186 EndLoop.SetPyFunction( 'EndInit' , PyEndLoop )
187 ILoopInitLoop = Loop.GetInPort( 'DoLoop' )
188 ILoopIndex = Loop.InPort( 'Index' , 'long' )
189 ILoopMin = Loop.InPort( 'Min' , 'long' )
190 ILoopMax = Loop.InPort( 'Max' , 'long' )
191 ILoopIncr = Loop.InPort( 'Incr' , 'long' )
192 ILoopz_Div = Loop.InPort( 'z_Div' , 'double' )
193 ILoopz_Div_1 = Loop.InPort( 'z_Div_1' , 'double' )
194 ILoopy_Add = Loop.InPort( 'y_Add' , 'double' )
195 ILoopx_Sub = Loop.InPort( 'x_Sub' , 'double' )
196 ILoopGate = Loop.GetInPort( 'Gate' )
197 OLoopDoLoop = Loop.GetOutPort( 'DoLoop' )
198 OLoopIndex = Loop.GetOutPort( 'Index' )
199 OLoopMin = Loop.GetOutPort( 'Min' )
200 OLoopMax = Loop.GetOutPort( 'Max' )
201 OLoopIncr = Loop.GetOutPort( 'Incr' )
202 OLoopz_Div = Loop.GetOutPort( 'z_Div' )
203 OLoopz_Div_1 = Loop.GetOutPort( 'z_Div_1' )
204 OLoopy_Add = Loop.GetOutPort( 'y_Add' )
205 OLoopx_Sub = Loop.GetOutPort( 'x_Sub' )
206 IEndLoopDoLoop = EndLoop.GetInPort( 'DoLoop' )
207 IEndLoopIndex = EndLoop.GetInPort( 'Index' )
208 IEndLoopMin = EndLoop.GetInPort( 'Min' )
209 IEndLoopMax = EndLoop.GetInPort( 'Max' )
210 IEndLoopIncr = EndLoop.GetInPort( 'Incr' )
211 IEndLoopz_Div = EndLoop.GetInPort( 'z_Div' )
212 IEndLoopz_Div_1 = EndLoop.GetInPort( 'z_Div_1' )
213 IEndLoopy_Add = EndLoop.GetInPort( 'y_Add' )
214 IEndLoopx_Sub = EndLoop.GetInPort( 'x_Sub' )
215 IEndLoopGate = EndLoop.GetInPort( 'Gate' )
216 OEndLoopDoLoop = EndLoop.GetOutPort( 'DoLoop' )
217 OEndLoopIndex = EndLoop.GetOutPort( 'Index' )
218 OEndLoopMin = EndLoop.GetOutPort( 'Min' )
219 OEndLoopMax = EndLoop.GetOutPort( 'Max' )
220 OEndLoopIncr = EndLoop.GetOutPort( 'Incr' )
221 OEndLoopz_Div = EndLoop.GetOutPort( 'z_Div' )
222 OEndLoopz_Div_1 = EndLoop.GetOutPort( 'z_Div_1' )
223 OEndLoopy_Add = EndLoop.GetOutPort( 'y_Add' )
224 OEndLoopx_Sub = EndLoop.GetOutPort( 'x_Sub' )
225 Loop.SetName( 'Loop' )
227 Loop.SetComment( '' )
228 Loop.Coords( 5 , 391 )
231 LAddzSuby = GraphStreams.Link( OAddz , ISuby )
232 LAddzSuby.AddCoord( 1 , 448 , 143 )
233 LAddzSuby.AddCoord( 2 , 449 , 237 )
235 LAddzMuly = GraphStreams.Link( OAddz , IMuly )
236 LAddzMuly.AddCoord( 1 , 708 , 237 )
237 LAddzMuly.AddCoord( 2 , 708 , 270 )
238 LAddzMuly.AddCoord( 3 , 449 , 270 )
239 LAddzMuly.AddCoord( 4 , 448 , 238 )
241 LAddostreamSubistream = GraphStreams.StreamLink( OAddostream , ISubistream )
242 LAddostreamSubistream.AddCoord( 1 , 474 , 175 )
243 LAddostreamSubistream.AddCoord( 2 , 474 , 297 )
245 LAddOStreamSubIstream = GraphStreams.StreamLink( OAddOStream , ISubIstream )
246 LAddOStreamSubIstream.AddCoord( 1 , 497 , 207 )
247 LAddOStreamSubIstream.AddCoord( 2 , 498 , 328 )
249 LSubzMulx = GraphStreams.Link( OSubz , IMulx )
250 LSubzMulx.AddCoord( 1 , 706 , 207 )
251 LSubzMulx.AddCoord( 2 , 706 , 114 )
253 LSubzDivx = GraphStreams.Link( OSubz , IDivx )
255 LMulzDivy = GraphStreams.Link( OMulz , IDivy )
256 LMulzDivy.AddCoord( 1 , 912 , 143 )
257 LMulzDivy.AddCoord( 2 , 911 , 208 )
259 LDivzEndLoopz_Div = GraphStreams.Link( ODivz , IEndLoopz_Div )
260 LDivzEndLoopz_Div.AddCoord( 1 , 1147 , 537 )
261 LDivzEndLoopz_Div.AddCoord( 2 , 1148 , 113 )
263 LDivostreamAdd_1istream = GraphStreams.StreamLink( ODivostream , IAdd_1istream )
264 LDivostreamAdd_1istream.AddCoord( 1 , 233 , 626 )
265 LDivostreamAdd_1istream.AddCoord( 2 , 232 , 763 )
266 LDivostreamAdd_1istream.AddCoord( 3 , 1126 , 763 )
267 LDivostreamAdd_1istream.AddCoord( 4 , 1125 , 175 )
269 LAdd_1zSub_1y = GraphStreams.Link( OAdd_1z , ISub_1y )
270 LAdd_1zSub_1y.AddCoord( 1 , 445 , 478 )
271 LAdd_1zSub_1y.AddCoord( 2 , 444 , 566 )
273 LAdd_1zMul_1y = GraphStreams.Link( OAdd_1z , IMul_1y )
274 LAdd_1zMul_1y.AddCoord( 1 , 703 , 582 )
275 LAdd_1zMul_1y.AddCoord( 2 , 703 , 677 )
276 LAdd_1zMul_1y.AddCoord( 3 , 445 , 678 )
277 LAdd_1zMul_1y.AddCoord( 4 , 444 , 567 )
279 LAdd_1ostreamSub_1istream = GraphStreams.StreamLink( OAdd_1ostream , ISub_1istream )
280 LAdd_1ostreamSub_1istream.AddCoord( 1 , 473 , 511 )
281 LAdd_1ostreamSub_1istream.AddCoord( 2 , 473 , 627 )
283 LAdd_1OStreamSub_1Istream = GraphStreams.StreamLink( OAdd_1OStream , ISub_1Istream )
284 LAdd_1OStreamSub_1Istream.AddCoord( 1 , 498 , 543 )
285 LAdd_1OStreamSub_1Istream.AddCoord( 2 , 497 , 658 )
287 LSub_1zMul_1x = GraphStreams.Link( OSub_1z , IMul_1x )
288 LSub_1zMul_1x.AddCoord( 1 , 708 , 552 )
289 LSub_1zMul_1x.AddCoord( 2 , 707 , 450 )
291 LSub_1zDiv_1x = GraphStreams.Link( OSub_1z , IDiv_1x )
293 LMul_1zDiv_1y = GraphStreams.Link( OMul_1z , IDiv_1y )
294 LMul_1zDiv_1y.AddCoord( 1 , 913 , 479 )
295 LMul_1zDiv_1y.AddCoord( 2 , 913 , 551 )
297 LDiv_1zEndLoopz_Div_1 = GraphStreams.Link( ODiv_1z , IEndLoopz_Div_1 )
298 LDiv_1zEndLoopz_Div_1.AddCoord( 1 , 1138 , 567 )
299 LDiv_1zEndLoopz_Div_1.AddCoord( 2 , 1138 , 449 )
301 LDiv_1ostreamAddistream = GraphStreams.StreamLink( ODiv_1ostream , IAddistream )
302 LDiv_1ostreamAddistream.AddCoord( 1 , 229 , 297 )
303 LDiv_1ostreamAddistream.AddCoord( 2 , 229 , 426 )
304 LDiv_1ostreamAddistream.AddCoord( 3 , 475 , 425 )
305 LDiv_1ostreamAddistream.AddCoord( 4 , 475 , 352 )
306 LDiv_1ostreamAddistream.AddCoord( 5 , 1110 , 352 )
307 LDiv_1ostreamAddistream.AddCoord( 6 , 1111 , 512 )
309 LLoopIndexEndLoopIndex = GraphStreams.Link( OLoopIndex , IEndLoopIndex )
311 LLoopIndexAddx = GraphStreams.Link( OLoopIndex , IAddx )
312 LLoopIndexAddx.AddCoord( 1 , 201 , 236 )
313 LLoopIndexAddx.AddCoord( 2 , 202 , 420 )
315 LLoopIndexAdd_1x = GraphStreams.Link( OLoopIndex , IAdd_1x )
316 LLoopIndexAdd_1x.AddCoord( 1 , 201 , 562 )
317 LLoopIndexAdd_1x.AddCoord( 2 , 202 , 422 )
319 LLoopMinEndLoopMin = GraphStreams.Link( OLoopMin , IEndLoopMin )
321 LLoopMaxEndLoopMax = GraphStreams.Link( OLoopMax , IEndLoopMax )
323 LLoopIncrEndLoopIncr = GraphStreams.Link( OLoopIncr , IEndLoopIncr )
325 LLoopy_AddEndLoopy_Add = GraphStreams.Link( OLoopy_Add , IEndLoopy_Add )
327 LLoopy_AddAddy = GraphStreams.Link( OLoopy_Add , IAddy )
328 LLoopy_AddAddy.AddCoord( 1 , 183 , 266 )
329 LLoopy_AddAddy.AddCoord( 2 , 182 , 593 )
331 LLoopy_AddAdd_1y = GraphStreams.Link( OLoopy_Add , IAdd_1y )
333 LLoopx_SubEndLoopx_Sub = GraphStreams.Link( OLoopx_Sub , IEndLoopx_Sub )
335 LLoopx_SubSubx = GraphStreams.Link( OLoopx_Sub , ISubx )
336 LLoopx_SubSubx.AddCoord( 1 , 167 , 113 )
337 LLoopx_SubSubx.AddCoord( 2 , 167 , 625 )
339 LLoopx_SubSub_1x = GraphStreams.Link( OLoopx_Sub , ISub_1x )
340 LLoopx_SubSub_1x.AddCoord( 1 , 167 , 450 )
341 LLoopx_SubSub_1x.AddCoord( 2 , 168 , 624 )
344 ILoopIndex.Input( 0 )
348 ILoopz_Div.Input( 0 )
349 ILoopz_Div_1.Input( 0 )
350 ILoopy_Add.Input( 4.5 )
351 ILoopx_Sub.Input( 1.5 )
353 # Output Ports of the graph
354 #OLoopz_Div = Loop.GetOutPort( 'z_Div' )
355 #OLoopz_Div_1 = Loop.GetOutPort( 'z_Div_1' )
356 #OEndLoopIndex = EndLoop.GetOutPort( 'Index' )
357 #OEndLoopMin = EndLoop.GetOutPort( 'Min' )
358 #OEndLoopMax = EndLoop.GetOutPort( 'Max' )
359 #OEndLoopIncr = EndLoop.GetOutPort( 'Incr' )
360 #OEndLoopz_Div = EndLoop.GetOutPort( 'z_Div' )
361 #OEndLoopz_Div_1 = EndLoop.GetOutPort( 'z_Div_1' )
362 #OEndLoopy_Add = EndLoop.GetOutPort( 'y_Add' )
363 #OEndLoopx_Sub = EndLoop.GetOutPort( 'x_Sub' )
370 GraphStreams.PrintPorts()
372 subgraphs = GraphStreams.SubGraphsNumber()
374 while i <= subgraphs :
375 nodes = GraphStreams.SubGraphsNodes( i )
377 while j < len(nodes) :
378 print 'SubGraph',i,nodes[j].Name()
383 substreamgraphs = GraphStreams.SubStreamGraphsNumber()
385 while i <= substreamgraphs :
386 nodes = GraphStreams.SubStreamGraphsNodes( i )
388 while j < len(nodes) :
389 print 'SubStreamGraph',i,nodes[j].Name()
394 GraphStreams.Export('/tmp/GraphStreams.xml')
396 GraphStreams = StreamGraph( '/tmp/GraphStreams.xml' )
399 GraphStreams.PrintPorts()
400 print GraphStreams.State()
402 GraphStreams.IsExecutable()
404 subgraphs = GraphStreams.SubGraphsNumber()
406 while i <= subgraphs :
407 nodes = GraphStreams.SubGraphsNodes( i )
409 while j < len(nodes) :
410 print 'SubGraph',i,nodes[j].Name()
415 substreamgraphs = GraphStreams.SubStreamGraphsNumber()
417 while i <= substreamgraphs :
418 nodes = GraphStreams.SubStreamGraphsNodes( i )
420 while j < len(nodes) :
421 print 'SubStreamGraph',i,nodes[j].Name()