1 # Copyright (C) 2007-2014 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, or (at your option) any later version.
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
23 # Generated python file of Graph GraphStream
27 GraphStream = StreamGraph( 'GraphStream' )
28 GraphStream.SetStreamParams( 0 , SUPERV.WithoutTrace , 0 )
29 GraphStream.SetName( 'GraphStream' )
30 GraphStream.SetAuthor( '' )
31 GraphStream.SetComment( 'Test of DataStreamPorts in FactoryNodes' )
32 GraphStream.Coords( 0 , 0 )
34 # Creation of Factory Nodes
36 NewDataStream = GraphStream.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'NewDataStream' )
37 NewDataStream.SetName( 'NewDataStream' )
38 NewDataStream.SetAuthor( '' )
39 NewDataStream.SetContainer( 'FactoryServer' )
40 NewDataStream.SetComment( 'NewDataStream from DataStreamFactory' )
41 NewDataStream.Coords( 4 , 10 )
42 INewDataStreamGate = NewDataStream.GetInPort( 'Gate' )
43 ONewDataStreamDataStream = NewDataStream.GetOutPort( 'DataStream' )
44 ONewDataStreamGate = NewDataStream.GetOutPort( 'Gate' )
46 Add = GraphStream.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Add' )
49 Add.SetContainer( 'FactoryServer' )
50 Add.SetComment( 'Add from DataStreamFactory from DataStreamComponent' )
52 IAddx = Add.GetInPort( 'x' )
53 IAddy = Add.GetInPort( 'y' )
54 IAddGate = Add.GetInPort( 'Gate' )
55 OAddz = Add.GetOutPort( 'z' )
56 OAddGate = Add.GetOutPort( 'Gate' )
57 IAddistream = Add.GetInStreamPort( 'istream' )
58 IAddistream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
59 OAddostream = Add.GetOutStreamPort( 'ostream' )
60 OAddostream.SetNumberOfValues( 0 )
61 OAddOStream = Add.GetOutStreamPort( 'OStream' )
62 OAddOStream.SetNumberOfValues( 0 )
64 Sub = GraphStream.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Sub' )
67 Sub.SetContainer( 'FactoryServer' )
68 Sub.SetComment( 'Sub from DataStreamFactory from DataStreamComponent' )
69 Sub.Coords( 234 , 216 )
70 ISubx = Sub.GetInPort( 'x' )
71 ISuby = Sub.GetInPort( 'y' )
72 ISubGate = Sub.GetInPort( 'Gate' )
73 OSubz = Sub.GetOutPort( 'z' )
74 OSubGate = Sub.GetOutPort( 'Gate' )
75 ISubistream = Sub.GetInStreamPort( 'istream' )
76 ISubistream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
77 ISubIstream = Sub.GetInStreamPort( 'Istream' )
78 ISubIstream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
80 Mul = GraphStream.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Mul' )
83 Mul.SetContainer( 'FactoryServer' )
84 Mul.SetComment( 'Mul from DataStreamFactory from DataStreamComponent' )
85 Mul.Coords( 448 , 342 )
86 IMulx = Mul.GetInPort( 'x' )
87 IMuly = Mul.GetInPort( 'y' )
88 IMulGate = Mul.GetInPort( 'Gate' )
89 OMulz = Mul.GetOutPort( 'z' )
90 OMulGate = Mul.GetOutPort( 'Gate' )
92 Div = GraphStream.FNode( 'DataStreamFactory' , 'DataStreamFactory' , 'Div' )
95 Div.SetContainer( 'FactoryServer' )
96 Div.SetComment( 'Div from DataStreamFactory from DataStreamComponent' )
97 Div.Coords( 678 , 214 )
98 IDivx = Div.GetInPort( 'x' )
99 IDivy = Div.GetInPort( 'y' )
100 IDivGate = Div.GetInPort( 'Gate' )
101 ODivz = Div.GetOutPort( 'z' )
102 ODivGate = Div.GetOutPort( 'Gate' )
103 ODivostream = Div.GetOutStreamPort( 'ostream' )
104 ODivostream.SetNumberOfValues( 0 )
106 # Creation of Computing Nodes
107 StreamAdd_ServiceinParameter = []
108 StreamAdd_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( 'objref' , 'this' ) )
109 StreamAdd_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( 'long' , 'x' ) )
110 StreamAdd_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( 'long' , 'y' ) )
111 StreamAdd_ServiceoutParameter = []
112 StreamAdd_ServiceoutParameter.append( SALOME_ModuleCatalog.ServicesParameter( 'long' , 'z' ) )
113 StreamAdd_ServiceinStreamParameter = []
114 StreamAdd_ServiceinStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog.DATASTREAM_INTEGER , 'istream' , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE ) )
115 StreamAdd_ServiceoutStreamParameter = []
116 StreamAdd_ServiceoutStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog.DATASTREAM_INTEGER , 'ostream' , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE ) )
117 StreamAdd_ServiceoutStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog.DATASTREAM_INTEGER , 'OStream' , SALOME_ModuleCatalog.DATASTREAM_ITERATIVE ) )
118 StreamAdd_Service = SALOME_ModuleCatalog.Service( 'StreamAdd' , StreamAdd_ServiceinParameter , StreamAdd_ServiceoutParameter , StreamAdd_ServiceinStreamParameter , StreamAdd_ServiceoutStreamParameter , 0 , 0 )
119 StreamAdd = GraphStream.CNode( StreamAdd_Service )
120 StreamAdd.SetName( 'StreamAdd' )
121 StreamAdd.SetAuthor( '' )
122 StreamAdd.SetComment( 'Compute Node' )
123 StreamAdd.Coords( 448 , 9 )
124 IStreamAddthis = StreamAdd.GetInPort( 'this' )
125 IStreamAddx = StreamAdd.GetInPort( 'x' )
126 IStreamAddy = StreamAdd.GetInPort( 'y' )
127 IStreamAddGate = StreamAdd.GetInPort( 'Gate' )
128 OStreamAddz = StreamAdd.GetOutPort( 'z' )
129 OStreamAddGate = StreamAdd.GetOutPort( 'Gate' )
130 IStreamAddistream = StreamAdd.GetInStreamPort( 'istream' )
131 IStreamAddistream.SetParams( SUPERV.SCHENULL , SUPERV.INTERNULL , SUPERV.EXTRANULL )
132 OStreamAddostream = StreamAdd.GetOutStreamPort( 'ostream' )
133 OStreamAddostream.SetNumberOfValues( 0 )
134 OStreamAddOStream = StreamAdd.GetOutStreamPort( 'OStream' )
135 OStreamAddOStream.SetNumberOfValues( 0 )
138 LNewDataStreamDataStreamStreamAddthis = GraphStream.Link( ONewDataStreamDataStream , IStreamAddthis )
140 LAddzSuby = GraphStream.Link( OAddz , ISuby )
141 LAddzSuby.AddCoord( 1 , 185 , 310 )
142 LAddzSuby.AddCoord( 2 , 185 , 437 )
144 LAddzMuly = GraphStream.Link( OAddz , IMuly )
146 LAddostreamSubistream = GraphStream.StreamLink( OAddostream , ISubistream )
147 LAddostreamSubistream.AddCoord( 1 , 199 , 343 )
148 LAddostreamSubistream.AddCoord( 2 , 200 , 497 )
150 LAddOStreamSubIstream = GraphStream.StreamLink( OAddOStream , ISubIstream )
151 LAddOStreamSubIstream.AddCoord( 1 , 219 , 374 )
152 LAddOStreamSubIstream.AddCoord( 2 , 218 , 529 )
154 LSubzMulx = GraphStream.Link( OSubz , IMulx )
155 LSubzMulx.AddCoord( 1 , 426 , 408 )
156 LSubzMulx.AddCoord( 2 , 427 , 282 )
158 LSubzDivx = GraphStream.Link( OSubz , IDivx )
160 LMulzDivy = GraphStream.Link( OMulz , IDivy )
161 LMulzDivy.AddCoord( 1 , 648 , 309 )
162 LMulzDivy.AddCoord( 2 , 648 , 406 )
168 IStreamAddx.Input( 1 )
169 IStreamAddy.Input( 2 )
170 IAddistream.Input( 1 )
171 IStreamAddistream.Input( 136159896 )
173 # Output Ports of the graph
174 #ODivz = Div.GetOutPort( 'z' )
175 #OStreamAddz = StreamAdd.GetOutPort( 'z' )
177 GraphStream.PrintPorts()
178 GraphStream.IsValid()
179 status = GraphStream.IsExecutable()
181 print 'Input of port IStreamAddistream is required : Ok'
183 print 'Input of port IStreamAddistream is required : ERROR'
184 # Following input is required :
185 IStreamAddistream.Input( 1 )
186 GraphStream.IsExecutable()
190 GraphStream.PrintPorts()
193 subgraphs = GraphStream.SubGraphsNumber()
195 while i <= subgraphs :
196 nodes = GraphStream.SubGraphsNodes( i )
198 while j < len(nodes) :
199 print 'SubGraph',i,nodes[j].Name()
204 substreamgraphs = GraphStream.SubStreamGraphsNumber()
206 while i <= substreamgraphs :
207 nodes = GraphStream.SubStreamGraphsNodes( i )
209 while j < len(nodes) :
210 print 'SubStreamGraph',i,nodes[j].Name()
214 GraphStream.Export('/tmp/GraphStream.xml')
216 GraphStream = StreamGraph( '/tmp/GraphStream.xml' )
219 GraphStream.PrintPorts()
220 print GraphStream.State()
222 subgraphs = GraphStream.SubGraphsNumber()
224 while i <= subgraphs :
225 nodes = GraphStream.SubGraphsNodes( i )
227 while j < len(nodes) :
228 print 'SubGraph',i,nodes[j].Name()
233 substreamgraphs = GraphStream.SubStreamGraphsNumber()
235 while i <= substreamgraphs :
236 nodes = GraphStream.SubStreamGraphsNodes( i )
238 while j < len(nodes) :
239 print 'SubStreamGraph',i,nodes[j].Name()