2 # Generated python file of Graph GraphStream
6 GraphStream = StreamGraph( 'GraphStream' )
7 GraphStream.SetStreamParams( 0 , SUPERV.WithoutTrace , 0 )
8 GraphStream.SetName( 'GraphStream' )
9 GraphStream.SetAuthor( '' )
10 GraphStream.SetComment( 'Test of DataStreamPorts in FactoryNodes' )
11 GraphStream.Coords( 0 , 0 )
13 # Creation of Factory Nodes
15 NewDataStream = GraphStream.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'NewDataStream' )
16 NewDataStream.SetName( 'NewDataStream' )
17 NewDataStream.SetAuthor( '' )
18 NewDataStream.SetContainer( 'FactoryServer' )
19 NewDataStream.SetComment( 'NewDataStream from DataStreamFactory' )
20 NewDataStream.Coords( 4 , 10 )
21 INewDataStreamGate = NewDataStream.GetInPort( 'Gate' )
22 ONewDataStreamDataStream = NewDataStream.GetOutPort( 'DataStream' )
23 ONewDataStreamGate = NewDataStream.GetOutPort( 'Gate' )
25 Add = GraphStream.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Add' )
28 Add.SetContainer( 'FactoryServer' )
29 Add.SetComment( 'Add from DataStreamFactory from DataStreamComponent' )
31 IAddx = Add.GetInPort( 'x' )
32 IAddy = Add.GetInPort( 'y' )
33 IAddGate = Add.GetInPort( 'Gate' )
34 OAddz = Add.GetOutPort( 'z' )
35 OAddGate = Add.GetOutPort( 'Gate' )
36 IAddistream = Add.GetInStreamPort( 'istream' )
37 IAddistream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
38 OAddostream = Add.GetOutStreamPort( 'ostream' )
39 OAddostream.SetNumberOfValues( 0 )
40 OAddOStream = Add.GetOutStreamPort( 'OStream' )
41 OAddOStream.SetNumberOfValues( 0 )
43 Sub = GraphStream.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Sub' )
46 Sub.SetContainer( 'FactoryServer' )
47 Sub.SetComment( 'Sub from DataStreamFactory from DataStreamComponent' )
48 Sub.Coords( 234 , 216 )
49 ISubx = Sub.GetInPort( 'x' )
50 ISuby = Sub.GetInPort( 'y' )
51 ISubGate = Sub.GetInPort( 'Gate' )
52 OSubz = Sub.GetOutPort( 'z' )
53 OSubGate = Sub.GetOutPort( 'Gate' )
54 ISubistream = Sub.GetInStreamPort( 'istream' )
55 ISubistream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
56 ISubIstream = Sub.GetInStreamPort( 'Istream' )
57 ISubIstream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
59 Mul = GraphStream.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Mul' )
62 Mul.SetContainer( 'FactoryServer' )
63 Mul.SetComment( 'Mul from DataStreamFactory from DataStreamComponent' )
64 Mul.Coords( 448 , 342 )
65 IMulx = Mul.GetInPort( 'x' )
66 IMuly = Mul.GetInPort( 'y' )
67 IMulGate = Mul.GetInPort( 'Gate' )
68 OMulz = Mul.GetOutPort( 'z' )
69 OMulGate = Mul.GetOutPort( 'Gate' )
71 Div = GraphStream.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Div' )
74 Div.SetContainer( 'FactoryServer' )
75 Div.SetComment( 'Div from DataStreamFactory from DataStreamComponent' )
76 Div.Coords( 678 , 214 )
77 IDivx = Div.GetInPort( 'x' )
78 IDivy = Div.GetInPort( 'y' )
79 IDivGate = Div.GetInPort( 'Gate' )
80 ODivz = Div.GetOutPort( 'z' )
81 ODivGate = Div.GetOutPort( 'Gate' )
82 ODivostream = Div.GetOutStreamPort( 'ostream' )
83 ODivostream.SetNumberOfValues( 0 )
85 # Creation of Computing Nodes
86 StreamAdd_ServiceinParameter = []
87 StreamAdd_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( 'objref' , 'this' ) )
88 StreamAdd_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( 'long' , 'x' ) )
89 StreamAdd_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( 'long' , 'y' ) )
90 StreamAdd_ServiceoutParameter = []
91 StreamAdd_ServiceoutParameter.append( SALOME_ModuleCatalog.ServicesParameter( 'long' , 'z' ) )
92 StreamAdd_ServiceinStreamParameter = []
93 StreamAdd_ServiceinStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog.DATASTREAM_INTEGER , 'istream' , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE ) )
94 StreamAdd_ServiceoutStreamParameter = []
95 StreamAdd_ServiceoutStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog.DATASTREAM_INTEGER , 'ostream' , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE ) )
96 StreamAdd_ServiceoutStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog.DATASTREAM_INTEGER , 'OStream' , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE ) )
97 StreamAdd_Service = SALOME_ModuleCatalog.Service( 'StreamAdd' , StreamAdd_ServiceinParameter , StreamAdd_ServiceoutParameter , StreamAdd_ServiceinStreamParameter , StreamAdd_ServiceoutStreamParameter , 0 , 0 )
98 StreamAdd = GraphStream.CNode( StreamAdd_Service )
99 StreamAdd.SetName( 'StreamAdd' )
100 StreamAdd.SetAuthor( '' )
101 StreamAdd.SetComment( 'Compute Node' )
102 StreamAdd.Coords( 448 , 9 )
103 IStreamAddthis = StreamAdd.GetInPort( 'this' )
104 IStreamAddx = StreamAdd.GetInPort( 'x' )
105 IStreamAddy = StreamAdd.GetInPort( 'y' )
106 IStreamAddGate = StreamAdd.GetInPort( 'Gate' )
107 OStreamAddz = StreamAdd.GetOutPort( 'z' )
108 OStreamAddGate = StreamAdd.GetOutPort( 'Gate' )
109 IStreamAddistream = StreamAdd.GetInStreamPort( 'istream' )
110 IStreamAddistream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
111 OStreamAddostream = StreamAdd.GetOutStreamPort( 'ostream' )
112 OStreamAddostream.SetNumberOfValues( 0 )
113 OStreamAddOStream = StreamAdd.GetOutStreamPort( 'OStream' )
114 OStreamAddOStream.SetNumberOfValues( 0 )
117 LNewDataStreamDataStreamStreamAddthis = GraphStream.Link( ONewDataStreamDataStream , IStreamAddthis )
119 LAddzSuby = GraphStream.Link( OAddz , ISuby )
120 LAddzSuby.AddCoord( 1 , 185 , 310 )
121 LAddzSuby.AddCoord( 2 , 185 , 437 )
123 LAddzMuly = GraphStream.Link( OAddz , IMuly )
125 LAddostreamSubistream = GraphStream.StreamLink( OAddostream , ISubistream )
126 LAddostreamSubistream.AddCoord( 1 , 199 , 343 )
127 LAddostreamSubistream.AddCoord( 2 , 200 , 497 )
129 LAddOStreamSubIstream = GraphStream.StreamLink( OAddOStream , ISubIstream )
130 LAddOStreamSubIstream.AddCoord( 1 , 219 , 374 )
131 LAddOStreamSubIstream.AddCoord( 2 , 218 , 529 )
133 LSubzMulx = GraphStream.Link( OSubz , IMulx )
134 LSubzMulx.AddCoord( 1 , 426 , 408 )
135 LSubzMulx.AddCoord( 2 , 427 , 282 )
137 LSubzDivx = GraphStream.Link( OSubz , IDivx )
139 LMulzDivy = GraphStream.Link( OMulz , IDivy )
140 LMulzDivy.AddCoord( 1 , 648 , 309 )
141 LMulzDivy.AddCoord( 2 , 648 , 406 )
147 IStreamAddx.Input( 1 )
148 IStreamAddy.Input( 2 )
149 IAddistream.Input( 1 )
150 IStreamAddistream.Input( 136159896 )
152 # Output Ports of the graph
153 #ODivz = Div.GetOutPort( 'z' )
154 #OStreamAddz = StreamAdd.GetOutPort( 'z' )
156 GraphStream.PrintPorts()
157 GraphStream.IsValid()
158 status = GraphStream.IsExecutable()
160 print 'Input of port IStreamAddistream is required : Ok'
162 print 'Input of port IStreamAddistream is required : ERROR'
163 # Following input is required :
164 IStreamAddistream.Input( 1 )
165 GraphStream.IsExecutable()
169 GraphStream.PrintPorts()
172 subgraphs = GraphStream.SubGraphsNumber()
174 while i <= subgraphs :
175 nodes = GraphStream.SubGraphsNodes( i )
177 while j < len(nodes) :
178 print 'SubGraph',i,nodes[j].Name()
183 substreamgraphs = GraphStream.SubStreamGraphsNumber()
185 while i <= substreamgraphs :
186 nodes = GraphStream.SubStreamGraphsNodes( i )
188 while j < len(nodes) :
189 print 'SubStreamGraph',i,nodes[j].Name()
193 GraphStream.Export('/tmp/GraphStream.xml')
195 GraphStream = StreamGraph( '/tmp/GraphStream.xml' )
198 GraphStream.PrintPorts()
199 print GraphStream.State()
201 subgraphs = GraphStream.SubGraphsNumber()
203 while i <= subgraphs :
204 nodes = GraphStream.SubGraphsNodes( i )
206 while j < len(nodes) :
207 print 'SubGraph',i,nodes[j].Name()
212 substreamgraphs = GraphStream.SubStreamGraphsNumber()
214 while i <= substreamgraphs :
215 nodes = GraphStream.SubStreamGraphsNodes( i )
217 while j < len(nodes) :
218 print 'SubStreamGraph',i,nodes[j].Name()