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