Salome HOME
d72783adcccb045600b7139cb2ae9e4266d68dfd
[samples/datafiles.git] / Superv / Python / GraphMacroNodes1.py
1 # Copyright (C) 2007-2015  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, or (at your option) any later version.
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
23 # Generated python file of Graph GraphMacroNodes1
24 #
25 from SuperV import *
26
27 # Graph creation of GraphMacroNodes1
28 def DefGraphMacroNodes1() :
29     GraphMacroNodes1 = Graph( 'GraphMacroNodes1' )
30     GraphMacroNodes1.SetName( 'GraphMacroNodes1' )
31     GraphMacroNodes1.SetAuthor( '' )
32     GraphMacroNodes1.SetComment( '' )
33     GraphMacroNodes1.Coords( 0 , 0 )
34     
35     # Creation of Factory Nodes
36     
37     Add = GraphMacroNodes1.FNode( 'AddComponent' , 'AddComponent' , 'Add' )
38     Add.SetName( 'Add' )
39     Add.SetAuthor( '' )
40     Add.SetContainer( 'FactoryServer' )
41     Add.SetComment( 'Add from AddComponent' )
42     Add.Coords( 15 , 241 )
43     IAddx = Add.GetInPort( 'x' )
44     IAddy = Add.GetInPort( 'y' )
45     IAddGate = Add.GetInPort( 'Gate' )
46     OAddFuncValue = Add.GetOutPort( 'FuncValue' )
47     OAddz = Add.GetOutPort( 'z' )
48     OAddGate = Add.GetOutPort( 'Gate' )
49     
50     Sub = GraphMacroNodes1.FNode( 'SubComponent' , 'SubComponent' , 'Sub' )
51     Sub.SetName( 'Sub' )
52     Sub.SetAuthor( '' )
53     Sub.SetContainer( 'FactoryServer' )
54     Sub.SetComment( 'Sub from SubComponent' )
55     Sub.Coords( 227 , 99 )
56     ISubx = Sub.GetInPort( 'x' )
57     ISuby = Sub.GetInPort( 'y' )
58     ISubGate = Sub.GetInPort( 'Gate' )
59     OSubz = Sub.GetOutPort( 'z' )
60     OSubGate = Sub.GetOutPort( 'Gate' )
61     
62     Mul = GraphMacroNodes1.FNode( 'MulComponent' , 'MulComponent' , 'Mul' )
63     Mul.SetName( 'Mul' )
64     Mul.SetAuthor( '' )
65     Mul.SetContainer( 'FactoryServer' )
66     Mul.SetComment( 'Mul from MulComponent' )
67     Mul.Coords( 469 , 304 )
68     IMulx = Mul.GetInPort( 'x' )
69     IMuly = Mul.GetInPort( 'y' )
70     IMulGate = Mul.GetInPort( 'Gate' )
71     OMulz = Mul.GetOutPort( 'z' )
72     OMulGate = Mul.GetOutPort( 'Gate' )
73     
74     Div = GraphMacroNodes1.FNode( 'DivComponent' , 'DivComponent' , 'Div' )
75     Div.SetName( 'Div' )
76     Div.SetAuthor( '' )
77     Div.SetContainer( 'FactoryServer' )
78     Div.SetComment( 'Div from DivComponent' )
79     Div.Coords( 668 , 200 )
80     IDivx = Div.GetInPort( 'x' )
81     IDivy = Div.GetInPort( 'y' )
82     IDivGate = Div.GetInPort( 'Gate' )
83     ODivz = Div.GetOutPort( 'z' )
84     ODivGate = Div.GetOutPort( 'Gate' )
85     
86     # Creation of Macro Nodes
87     GraphAdd = DefGraphAdd()
88     Macro_GraphAdd = GraphMacroNodes1.GraphMNode( GraphAdd )
89     Macro_GraphAdd.SetCoupled( 'GraphAdd' )
90     Macro_GraphAdd.SetName( 'Macro_GraphAdd' )
91     Macro_GraphAdd.SetAuthor( '' )
92     Macro_GraphAdd.SetComment( 'Macro Node' )
93     Macro_GraphAdd.Coords( 434 , 128 )
94     IMacro_GraphAddAdd__x = Macro_GraphAdd.GetInPort( 'Add__x' )
95     IMacro_GraphAddAdd__y = Macro_GraphAdd.GetInPort( 'Add__y' )
96     IMacro_GraphAddGate = Macro_GraphAdd.GetInPort( 'Gate' )
97     OMacro_GraphAddAdd__FuncValue = Macro_GraphAdd.GetOutPort( 'Add__FuncValue' )
98     OMacro_GraphAddAdd__z = Macro_GraphAdd.GetOutPort( 'Add__z' )
99     OMacro_GraphAddGate = Macro_GraphAdd.GetOutPort( 'Gate' )
100     
101     GraphSub = DefGraphSub()
102     Macro_GraphSub = GraphMacroNodes1.GraphMNode( GraphSub )
103     Macro_GraphSub.SetCoupled( 'GraphSub' )
104     Macro_GraphSub.SetName( 'Macro_GraphSub' )
105     Macro_GraphSub.SetAuthor( '' )
106     Macro_GraphSub.SetComment( 'Macro Node' )
107     Macro_GraphSub.Coords( 240 , 301 )
108     IMacro_GraphSubSub__x = Macro_GraphSub.GetInPort( 'Sub__x' )
109     IMacro_GraphSubSub__y = Macro_GraphSub.GetInPort( 'Sub__y' )
110     IMacro_GraphSubGate = Macro_GraphSub.GetInPort( 'Gate' )
111     OMacro_GraphSubSub__z = Macro_GraphSub.GetOutPort( 'Sub__z' )
112     OMacro_GraphSubGate = Macro_GraphSub.GetOutPort( 'Gate' )
113     
114     # Creation of Links
115     LAddFuncValueMacro_GraphSubSub__x = GraphMacroNodes1.Link( OAddFuncValue , IMacro_GraphSubSub__x )
116     
117     LAddFuncValueMacro_GraphAddAdd__y = GraphMacroNodes1.Link( OAddFuncValue , IMacro_GraphAddAdd__y )
118     
119     LAddzSuby = GraphMacroNodes1.Link( OAddz , ISuby )
120     
121     LAddzMacro_GraphSubSub__y = GraphMacroNodes1.Link( OAddz , IMacro_GraphSubSub__y )
122     
123     LSubzMulx = GraphMacroNodes1.Link( OSubz , IMulx )
124     
125     LSubzMacro_GraphAddAdd__x = GraphMacroNodes1.Link( OSubz , IMacro_GraphAddAdd__x )
126     
127     LMacro_GraphAddGateDivGate = GraphMacroNodes1.Link( OMacro_GraphAddGate , IDivGate )
128     
129     LMacro_GraphSubSub__zMuly = GraphMacroNodes1.Link( OMacro_GraphSubSub__z , IMuly )
130     
131     LMacro_GraphSubGateMulGate = GraphMacroNodes1.Link( OMacro_GraphSubGate , IMulGate )
132     
133     # Input datas
134     IAddx.Input( 3 )
135     IAddy.Input( 4.5 )
136     ISubx.Input( 1.5 )
137     IDivx.Input( 1 )
138     IDivy.Input( 2 )
139     
140     # Output Ports of the graph
141     #OMulz = Mul.GetOutPort( 'z' )
142     #ODivz = Div.GetOutPort( 'z' )
143     #OMacro_GraphAddAdd__FuncValue = Macro_GraphAdd.GetOutPort( 'Add__FuncValue' )
144     #OMacro_GraphAddAdd__z = Macro_GraphAdd.GetOutPort( 'Add__z' )
145     return GraphMacroNodes1
146
147 # Graph creation of GraphAdd
148 def DefGraphAdd() :
149     GraphAdd = Graph( 'GraphAdd' )
150     GraphAdd.SetCoupled( 'Macro_GraphAdd' )
151     GraphAdd.SetName( 'GraphAdd' )
152     GraphAdd.SetAuthor( '' )
153     GraphAdd.SetComment( '' )
154     GraphAdd.Coords( 0 , 0 )
155     
156     # Creation of Factory Nodes
157     
158     Add = GraphAdd.FNode( 'AddComponent' , 'AddComponent' , 'Add' )
159     Add.SetName( 'Add' )
160     Add.SetAuthor( '' )
161     Add.SetContainer( 'localhost/FactoryServer' )
162     Add.SetComment( 'Add from AddComponent' )
163     Add.Coords( 55 , 61 )
164     IAddx = Add.GetInPort( 'x' )
165     IAddy = Add.GetInPort( 'y' )
166     IAddGate = Add.GetInPort( 'Gate' )
167     OAddFuncValue = Add.GetOutPort( 'FuncValue' )
168     OAddz = Add.GetOutPort( 'z' )
169     OAddGate = Add.GetOutPort( 'Gate' )
170     
171     # Input Ports of the graph
172     #IAddx = Add.GetInPort( 'x' )
173     #IAddy = Add.GetInPort( 'y' )
174     
175     # Output Ports of the graph
176     #OAddFuncValue = Add.GetOutPort( 'FuncValue' )
177     #OAddz = Add.GetOutPort( 'z' )
178     return GraphAdd
179
180 # Graph creation of GraphSub
181 def DefGraphSub() :
182     GraphSub = Graph( 'GraphSub' )
183     GraphSub.SetCoupled( 'Macro_GraphSub' )
184     GraphSub.SetName( 'GraphSub' )
185     GraphSub.SetAuthor( '' )
186     GraphSub.SetComment( '' )
187     GraphSub.Coords( 0 , 0 )
188     
189     # Creation of Factory Nodes
190     
191     Sub = GraphSub.FNode( 'SubComponent' , 'SubComponent' , 'Sub' )
192     Sub.SetName( 'Sub' )
193     Sub.SetAuthor( '' )
194     Sub.SetContainer( 'localhost/FactoryServer' )
195     Sub.SetComment( 'Sub from SubComponent' )
196     Sub.Coords( 55 , 71 )
197     ISubx = Sub.GetInPort( 'x' )
198     ISuby = Sub.GetInPort( 'y' )
199     ISubGate = Sub.GetInPort( 'Gate' )
200     OSubz = Sub.GetOutPort( 'z' )
201     OSubGate = Sub.GetOutPort( 'Gate' )
202     
203     # Input Ports of the graph
204     #ISubx = Sub.GetInPort( 'x' )
205     #ISuby = Sub.GetInPort( 'y' )
206     
207     # Output Ports of the graph
208     #OSubz = Sub.GetOutPort( 'z' )
209     return GraphSub
210
211
212 GraphMacroNodes1 = DefGraphMacroNodes1()
213
214 exec GraphMacroNodes1.ListNodes()
215 # Add,Sub,Mul,Div,Macro_GraphAdd,Macro_GraphSub
216
217 GraphMacroNodes1.Run()
218 GraphMacroNodes1.DoneW()
219 print "GraphMacroNodes1",GraphMacroNodes1.State()
220 print "Macro_GraphAdd",Macro_GraphAdd.State()
221 print "Macro_GraphSub",Macro_GraphSub.State()
222 print "Mul",Mul.State()
223 print "Div",Div.State()
224
225 Macro_GraphSub.PrintPorts()
226 Mul.PrintPorts()
227
228 Macro_GraphAdd.PrintPorts()
229 Div.PrintPorts()
230