Salome HOME
Developpement of control of validity of SwitchNodes
[modules/superv.git] / examples / GraphUnValid.py
1
2 # Generated python file of Graph GraphEssai
3
4 from SuperV import *
5 # Graph creation 
6 GraphUnValid = Graph( 'GraphUnValid' )
7 GraphUnValid.SetName( 'GraphUnValid' )
8 GraphUnValid.SetAuthor( '' )
9 GraphUnValid.SetComment( '' )
10 GraphUnValid.Coords( 0 , 0 )
11
12 # Creation of Factory Nodes
13
14 Add = GraphUnValid.FNode( 'AddComponent' , 'AddComponent' , 'Add' )
15 Add.SetName( 'Add' )
16 Add.SetAuthor( '' )
17 Add.SetContainer( 'FactoryServer' )
18 Add.SetComment( 'Add from AddComponent' )
19 Add.Coords( 8 , 62 )
20
21 Sub = GraphUnValid.FNode( 'SubComponent' , 'SubComponent' , 'Sub' )
22 Sub.SetName( 'Sub' )
23 Sub.SetAuthor( '' )
24 Sub.SetContainer( 'FactoryServer' )
25 Sub.SetComment( 'Sub from SubComponent' )
26 Sub.Coords( 203 , 4 )
27
28 Mul = GraphUnValid.FNode( 'MulComponent' , 'MulComponent' , 'Mul' )
29 Mul.SetName( 'Mul' )
30 Mul.SetAuthor( '' )
31 Mul.SetContainer( 'FactoryServer' )
32 Mul.SetComment( 'Mul from MulComponent' )
33 Mul.Coords( 390 , 62 )
34
35 Div = GraphUnValid.FNode( 'DivComponent' , 'DivComponent' , 'Div' )
36 Div.SetName( 'Div' )
37 Div.SetAuthor( '' )
38 Div.SetContainer( 'FactoryServer' )
39 Div.SetComment( 'Div from DivComponent' )
40 Div.Coords( 575 , 11 )
41
42 # Creation of Links
43 Addz = Add.Port( 'z' )
44 Muly = GraphUnValid.Link( Addz , Mul.Port( 'y' ) )
45
46 Suby = GraphUnValid.Link( Addz , Sub.Port( 'y' ) )
47 Suby.AddCoord( 1 , 182 , 113 )
48 Suby.AddCoord( 2 , 183 , 170 )
49
50 Subz = Sub.Port( 'z' )
51 Divx = GraphUnValid.Link( Subz , Div.Port( 'x' ) )
52 Divx.AddCoord( 1 , 566 , 91 )
53 Divx.AddCoord( 2 , 566 , 49 )
54 Divx.AddCoord( 3 , 380 , 49 )
55 Divx.AddCoord( 4 , 379 , 84 )
56
57 Mulx = GraphUnValid.Link( Subz , Mul.Port( 'x' ) )
58 Mulx.AddCoord( 1 , 379 , 141 )
59 Mulx.AddCoord( 2 , 378 , 85 )
60
61 Mulz = Mul.Port( 'z' )
62 Divy = GraphUnValid.Link( Mulz , Div.Port( 'y' ) )
63 Divy.AddCoord( 1 , 565 , 120 )
64 Divy.AddCoord( 2 , 565 , 141 )
65
66 Subx = GraphUnValid.Link( Mulz , Sub.Port( 'x' ) )
67 Subx.AddCoord( 1 , 194 , 84 )
68 Subx.AddCoord( 2 , 195 , 252 )
69 Subx.AddCoord( 3 , 566 , 252 )
70 Subx.AddCoord( 4 , 565 , 141 )
71
72 # Creation of Output variables
73 AddFuncValue = Add.Port( 'FuncValue' )
74 Divz = Div.Port( 'z' )
75
76 statvalid = GraphInLinesUnValid.IsValid()
77 if statvalid == 0 :
78     print "Unvalid graph : Ok"
79 else :
80     print "Error : the graph should not be valid"
81
82 # Creation of Output variables
83 statrun = GraphUnValid.Run()
84 if statrun == 0 :
85     print "Unvalid graph ==> No Run : Ok"
86 else :
87     print "Error : the graph is not valid and is running"
88
89 GraphUnValid.IsDone()
90
91 GraphUnValid.State()
92
93 GraphUnValid.PrintPorts()
94