Salome HOME
cddb0bd712226b2185814052449aef12a101bc43
[samples/datafiles.git] / Superv / Python / GraphContainer.py
1 #  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
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.
10 #
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.
15 #
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
19 #
20 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22 # Generated python file of Graph GraphEssai
23 #
24 from SuperV import *
25 # Graph creation 
26 GraphEssai = Graph( 'GraphEssai' )
27 GraphEssai.SetName( 'GraphEssai' )
28 GraphEssai.SetAuthor( '' )
29 GraphEssai.SetComment( '' )
30 GraphEssai.Coords( 0 , 0 )
31
32 # Creation of Factory Nodes
33
34 Add = GraphEssai.FNode( 'AddComponent' , 'AddComponent' , 'Add' )
35 Add.SetName( 'Add' )
36 Add.SetAuthor( '' )
37 Add.SetContainer( 'FactoryServer' )
38 Add.SetComment( 'Add from AddComponent' )
39 Add.Coords( 15 , 241 )
40
41 Sub = GraphEssai.FNode( 'SubComponent' , 'SubComponent' , 'Sub' )
42 Sub.SetName( 'Sub' )
43 Sub.SetAuthor( '' )
44 Sub.SetContainer( 'FactoryServer' )
45 Sub.SetComment( 'Sub from SubComponent' )
46 Sub.Coords( 227 , 96 )
47
48 Mul = GraphEssai.FNode( 'MulComponent' , 'MulComponent' , 'Mul' )
49 Mul.SetName( 'Mul' )
50 Mul.SetAuthor( '' )
51 Mul.SetContainer( 'FactoryServer' )
52 Mul.SetComment( 'Mul from MulComponent' )
53 Mul.Coords( 435 , 242 )
54
55 Div = GraphEssai.FNode( 'DivComponent' , 'DivComponent' , 'Div' )
56 Div.SetName( 'Div' )
57 Div.SetAuthor( '' )
58 Div.SetContainer( 'FactoryServer' )
59 Div.SetComment( 'Div from DivComponent' )
60 Div.Coords( 634 , 97 )
61
62 # Creation of Links
63 Addz = Add.Port( 'z' )
64 Muly = GraphEssai.Link( Addz , Mul.Port( 'y' ) )
65
66 Suby = GraphEssai.Link( Addz , Sub.Port( 'y' ) )
67 Suby.AddCoord( 1 , 197 , 204 )
68 Suby.AddCoord( 2 , 198 , 351 )
69
70 Subz = Sub.Port( 'z' )
71 Divx = GraphEssai.Link( Subz , Div.Port( 'x' ) )
72
73 Mulx = GraphEssai.Link( Subz , Mul.Port( 'x' ) )
74 Mulx.AddCoord( 1 , 411 , 323 )
75 Mulx.AddCoord( 2 , 411 , 177 )
76
77 Mulz = Mul.Port( 'z' )
78 Divy = GraphEssai.Link( Mulz , Div.Port( 'y' ) )
79 Divy.AddCoord( 1 , 612 , 207 )
80 Divy.AddCoord( 2 , 612 , 322 )
81
82 # Creation of Input datas
83 Addx = Add.Input( 'x' , 3)
84 Addy = Add.Input( 'y' , 4.5)
85 Subx = Sub.Input( 'x' , 1.5)
86
87 # Creation of Output variables
88 AddFuncValue = Add.Port( 'FuncValue' )
89 Divz = Div.Port( 'z' )
90
91 Add.Print()
92 Sub.Print()
93 Mul.Print()
94 Div.Print()
95
96 GraphEssai.PrintPorts()
97
98 nodes = GraphEssai.LevelNodes( 0 )
99 i = 0
100 while i < len( nodes ) :
101     print 'Nodes of level 0',nodes[i].Name()
102     i = i + 1
103
104 GraphEssai.Run()
105
106 GraphEssai.DoneW()
107
108 GraphEssai.State()
109
110 GraphEssai.PrintPorts()
111