Salome HOME
Fix for bug PAL10426 ( SAMPLES_SRC: some examples doesn't have the correct path ).
[samples/datafiles.git] / Superv / Python / GraphStreamsXmlTest.py
1 from SuperV import *
2
3 FlowGraph = Graph( 'FlowGraph' )
4 Add = FlowGraph.FNode( 'AddComponent' , 'AddComponent' , 'Add' )
5
6 Sub = FlowGraph.FNode( 'SubComponent' , 'SubComponent' , 'Sub' )
7 Addz = Add.GetOutStreamPort( 'z' )
8 if Addz != None :
9     print "Error : GetOutStreamPort of a FlowPort in a FlowGraph"
10 else :
11     print 'None : Ok'
12
13 Addz = Add.Port( 'z' )
14 try :
15     Suby = FlowGraph.StreamLink( Addz , Sub.Port( 'y' ) )
16     print "Error : creation of a StreamLink in a FlowGraph"
17 except :
18     print "Ok"
19
20 links = FlowGraph.StreamLinks()
21 if len(links) != 0 :
22     print "Error : StreamLinks in a FlowGraph"
23
24 ports = FlowGraph.StreamPorts()
25 if len( ports ) != 0 :
26     print "Error : StreamPorts in a FlowGraph"
27
28 links = Add.StreamLinks()
29 if len(links) != 0 :
30     print "Error : StreamLinks in a FlowNode"
31
32 ports = Add.StreamPorts()
33 if len( ports ) != 0 :
34     print "Error : StreamPorts in a FlowNode"
35
36 try :
37     FlowGraph.SetStreamParams( 100 , SUPERV.WithoutTrace , 10. )
38 except :
39     print "No SetStreamParams Ok"
40
41 try :
42     Timeout,DataStreamTrace,DeltaTime = FlowGraph.StreamParams()
43 except :
44     print "No StreamParams Ok"
45
46
47
48
49 from SuperV import *
50
51 anXmlFile = os.getenv('DATA_DIR') + '/Superv/Graphs/GraphStreams.xml'
52 GraphStreams = StreamGraph( anXmlFile )
53
54 GraphStreams.PrintPorts()
55 GraphStreams.PrintLinks()
56
57 exec GraphStreams.ListNodes()
58 Add.PrintPorts()
59 Add.PrintLinks()
60
61 exec Loop.ListPorts()
62 ILoopIndex.Print()
63 OLoopIndex.Print()
64 exec EndLoop.ListPorts()
65 IEndLoopGate.Print()
66 OEndLoopx_Sub.Print()
67 exec Add.ListPorts()
68 IAddx.Print()
69 IAddistream.Print()
70 OAddOStream.Print()
71 exec Sub.ListPorts()
72 exec Mul.ListPorts()
73 exec Div.ListPorts()
74 exec Add_1.ListPorts()
75 exec Sub_1.ListPorts()
76 exec Mul_1.ListPorts()
77 exec Div_1.ListPorts()
78 exec  Add.ListLinks()
79 LLoopIndexAddx.Print()
80 LAddzMuly.Print()
81 LDiv_1ostreamAddistream.Print()
82 LAddOStreamSubIstream.Print()
83
84
85 GraphStreams.IsExecutable()
86
87 GraphStreams.Run()
88 GraphStreams.DoneW()
89 GraphStreams.PrintPorts()
90
91
92
93 subgraphs = GraphStreams.SubGraphsNumber()
94 i = 1
95 while i <= subgraphs :
96     nodes = GraphStreams.SubGraphsNodes( i )
97     j = 0
98     while j < len(nodes) :
99         print 'SubGraph',i,nodes[j].Name()
100         j = j + 1
101     i = i + 1
102
103
104 substreamgraphs = GraphStreams.SubStreamGraphsNumber()
105 i = 1
106 while i <= substreamgraphs :
107     nodes = GraphStreams.SubStreamGraphsNodes( i )
108     j = 0
109     while j < len(nodes) :
110         print 'SubStreamGraph',i,nodes[j].Name()
111         j = j + 1
112     i = i + 1
113