Salome HOME
Merge from V6_main_20120808 08Aug12
[samples/datafiles.git] / Superv / Python / GraphLoopsGates.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 GraphLoopsGates_1
23 #
24 from SuperV import *
25
26 # Graph creation of GraphLoopsGates_1
27 def DefGraphLoopsGates_1() :
28     GraphLoopsGates_1 = Graph( 'GraphLoopsGates_1' )
29     GraphLoopsGates_1.SetName( 'GraphLoopsGates_1' )
30     GraphLoopsGates_1.SetAuthor( 'JR' )
31     GraphLoopsGates_1.SetComment( '' )
32     GraphLoopsGates_1.Coords( 0 , 0 )
33     
34     # Creation of Factory Nodes
35     
36     Add = GraphLoopsGates_1.FNode( 'AddComponent' , 'AddComponent' , 'Add' )
37     Add.SetName( 'Add' )
38     Add.SetAuthor( '' )
39     Add.SetContainer( 'localhost/FactoryServer' )
40     Add.SetComment( 'Add from AddComponent' )
41     Add.Coords( 230 , 76 )
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     Add_1 = GraphLoopsGates_1.FNode( 'AddComponent' , 'AddComponent' , 'Add' )
50     Add_1.SetName( 'Add_1' )
51     Add_1.SetAuthor( '' )
52     Add_1.SetContainer( 'localhost/FactoryServer' )
53     Add_1.SetComment( 'Add from AddComponent' )
54     Add_1.Coords( 225 , 304 )
55     IAdd_1x = Add_1.GetInPort( 'x' )
56     IAdd_1y = Add_1.GetInPort( 'y' )
57     IAdd_1Gate = Add_1.GetInPort( 'Gate' )
58     OAdd_1FuncValue = Add_1.GetOutPort( 'FuncValue' )
59     OAdd_1z = Add_1.GetOutPort( 'z' )
60     OAdd_1Gate = Add_1.GetOutPort( 'Gate' )
61     
62     Sub = GraphLoopsGates_1.FNode( 'SubComponent' , 'SubComponent' , 'Sub' )
63     Sub.SetName( 'Sub' )
64     Sub.SetAuthor( '' )
65     Sub.SetContainer( 'localhost/FactoryServer' )
66     Sub.SetComment( 'Sub from SubComponent' )
67     Sub.Coords( 447 , 77 )
68     ISubx = Sub.GetInPort( 'x' )
69     ISuby = Sub.GetInPort( 'y' )
70     ISubGate = Sub.GetInPort( 'Gate' )
71     OSubz = Sub.GetOutPort( 'z' )
72     OSubGate = Sub.GetOutPort( 'Gate' )
73     
74     Sub_1 = GraphLoopsGates_1.FNode( 'SubComponent' , 'SubComponent' , 'Sub' )
75     Sub_1.SetName( 'Sub_1' )
76     Sub_1.SetAuthor( '' )
77     Sub_1.SetContainer( 'localhost/FactoryServer' )
78     Sub_1.SetComment( 'Sub from SubComponent' )
79     Sub_1.Coords( 448 , 304 )
80     ISub_1x = Sub_1.GetInPort( 'x' )
81     ISub_1y = Sub_1.GetInPort( 'y' )
82     ISub_1Gate = Sub_1.GetInPort( 'Gate' )
83     OSub_1z = Sub_1.GetOutPort( 'z' )
84     OSub_1Gate = Sub_1.GetOutPort( 'Gate' )
85     
86     # Creation of InLine Nodes
87     PyGate = []
88     PyGate.append( 'from time import *  ' )
89     PyGate.append( 'def Gate(G1,G2) :  ' )
90     PyGate.append( '    sleep(1)  ' )
91     PyGate.append( '    return G1&G2  ' )
92     Gate = GraphLoopsGates_1.INode( 'Gate' , PyGate )
93     Gate.SetName( 'Gate' )
94     Gate.SetAuthor( '' )
95     Gate.SetComment( 'Compute Node' )
96     Gate.Coords( 640 , 224 )
97     IGateG1 = Gate.InPort( 'G1' , 'long' )
98     IGateG2 = Gate.InPort( 'G2' , 'long' )
99     IGateGate = Gate.GetInPort( 'Gate' )
100     OGateG = Gate.OutPort( 'G' , 'long' )
101     OGateGate = Gate.GetOutPort( 'Gate' )
102     
103     # Creation of Loop Nodes
104     PyInit = []
105     PyInit.append( 'from time import *    ' )
106     PyInit.append( 'def Init(Index,Min,Max) :    ' )
107     PyInit.append( '    Index = Min    ' )
108     PyInit.append( '    sleep(1)    ' )
109     PyInit.append( '    return Index,Min,Max    ' )
110     PyMoreInit = []
111     PyMoreInit.append( 'def More(Index,Min,Max) :   ' )
112     PyMoreInit.append( '    if Index < Max :   ' )
113     PyMoreInit.append( '        DoLoop = 1   ' )
114     PyMoreInit.append( '    else :   ' )
115     PyMoreInit.append( '        DoLoop = 0  ' )
116     PyMoreInit.append( '    return DoLoop,Index,Min,Max   ' )
117     PyNextInit = []
118     PyNextInit.append( 'from time import * ' )
119     PyNextInit.append( 'def Next(Index,Min,Max) :   ' )
120     PyNextInit.append( '    Index = Index + 1 ' )
121     PyNextInit.append( '    sleep(1) ' )
122     PyNextInit.append( '    return Index,Min,Max    ' )
123     Init,EndInit = GraphLoopsGates_1.LNode( 'Init' , PyInit , 'More' , PyMoreInit , 'Next' , PyNextInit )
124     EndInit.SetName( 'EndInit' )
125     EndInit.SetAuthor( '' )
126     EndInit.SetComment( 'Compute Node' )
127     EndInit.Coords( 838 , 243 )
128     PyEndInit = []
129     EndInit.SetPyFunction( 'EndInit' , PyEndInit )
130     IInitDoLoop = Init.GetInPort( 'DoLoop' )
131     IInitIndex = Init.InPort( 'Index' , 'long' )
132     IInitMin = Init.InPort( 'Min' , 'long' )
133     IInitMax = Init.InPort( 'Max' , 'long' )
134     IInitGate = Init.GetInPort( 'Gate' )
135     OInitDoLoop = Init.GetOutPort( 'DoLoop' )
136     OInitIndex = Init.GetOutPort( 'Index' )
137     OInitMin = Init.GetOutPort( 'Min' )
138     OInitMax = Init.GetOutPort( 'Max' )
139     IEndInitDoLoop = EndInit.GetInPort( 'DoLoop' )
140     IEndInitIndex = EndInit.GetInPort( 'Index' )
141     IEndInitMin = EndInit.GetInPort( 'Min' )
142     IEndInitMax = EndInit.GetInPort( 'Max' )
143     IEndInitGate = EndInit.GetInPort( 'Gate' )
144     OEndInitDoLoop = EndInit.GetOutPort( 'DoLoop' )
145     OEndInitIndex = EndInit.GetOutPort( 'Index' )
146     OEndInitMin = EndInit.GetOutPort( 'Min' )
147     OEndInitMax = EndInit.GetOutPort( 'Max' )
148     OEndInitGate = EndInit.GetOutPort( 'Gate' )
149     Init.SetName( 'Init' )
150     Init.SetAuthor( '' )
151     Init.SetComment( 'Compute Node' )
152     Init.Coords( 29 , 251 )
153     
154     PyInit_1 = []
155     PyInit_1.append( 'from time import *    ' )
156     PyInit_1.append( 'def Init_1(Index,Min,Max) :    ' )
157     PyInit_1.append( '    Index = Min    ' )
158     PyInit_1.append( '    sleep(1)    ' )
159     PyInit_1.append( '    return Index,Min,Max    ' )
160     PyMoreInit_1 = []
161     PyMoreInit_1.append( 'def More_1(Index,Min,Max) :   ' )
162     PyMoreInit_1.append( '    if Index < Max :   ' )
163     PyMoreInit_1.append( '        DoLoop = 1   ' )
164     PyMoreInit_1.append( '    else :   ' )
165     PyMoreInit_1.append( '        DoLoop = 0  ' )
166     PyMoreInit_1.append( '    return DoLoop,Index,Min,Max   ' )
167     PyNextInit_1 = []
168     PyNextInit_1.append( 'from time import * ' )
169     PyNextInit_1.append( 'def Next_1(Index,Min,Max) :   ' )
170     PyNextInit_1.append( '    Index = Index + 1 ' )
171     PyNextInit_1.append( '    sleep(1) ' )
172     PyNextInit_1.append( '    return Index,Min,Max    ' )
173     Init_1,EndInit_1 = GraphLoopsGates_1.LNode( 'Init_1' , PyInit_1 , 'More_1' , PyMoreInit_1 , 'Next_1' , PyNextInit_1 )
174     EndInit_1.SetName( 'EndInit_1' )
175     EndInit_1.SetAuthor( '' )
176     EndInit_1.SetComment( 'Compute Node' )
177     EndInit_1.Coords( 1049 , 201 )
178     PyEndInit_1 = []
179     EndInit_1.SetPyFunction( 'EndInit_1' , PyEndInit_1 )
180     IInit_1DoLoop = Init_1.GetInPort( 'DoLoop' )
181     IInit_1Index = Init_1.InPort( 'Index' , 'long' )
182     IInit_1Min = Init_1.InPort( 'Min' , 'long' )
183     IInit_1Max = Init_1.InPort( 'Max' , 'long' )
184     IInit_1Gate = Init_1.GetInPort( 'Gate' )
185     OInit_1DoLoop = Init_1.GetOutPort( 'DoLoop' )
186     OInit_1Index = Init_1.GetOutPort( 'Index' )
187     OInit_1Min = Init_1.GetOutPort( 'Min' )
188     OInit_1Max = Init_1.GetOutPort( 'Max' )
189     IEndInit_1DoLoop = EndInit_1.GetInPort( 'DoLoop' )
190     IEndInit_1Index = EndInit_1.GetInPort( 'Index' )
191     IEndInit_1Min = EndInit_1.GetInPort( 'Min' )
192     IEndInit_1Max = EndInit_1.GetInPort( 'Max' )
193     IEndInit_1Gate = EndInit_1.GetInPort( 'Gate' )
194     OEndInit_1DoLoop = EndInit_1.GetOutPort( 'DoLoop' )
195     OEndInit_1Index = EndInit_1.GetOutPort( 'Index' )
196     OEndInit_1Min = EndInit_1.GetOutPort( 'Min' )
197     OEndInit_1Max = EndInit_1.GetOutPort( 'Max' )
198     OEndInit_1Gate = EndInit_1.GetOutPort( 'Gate' )
199     Init_1.SetName( 'Init_1' )
200     Init_1.SetAuthor( '' )
201     Init_1.SetComment( 'Compute Node' )
202     Init_1.Coords( 9 , 24 )
203     
204     # Creation of Links
205     LInitIndexEndInitIndex = GraphLoopsGates_1.Link( OInitIndex , IEndInitIndex )
206     
207     LInitIndexSubx = GraphLoopsGates_1.Link( OInitIndex , ISubx )
208     
209     LInitMinEndInitMin = GraphLoopsGates_1.Link( OInitMin , IEndInitMin )
210     
211     LInitMinSuby = GraphLoopsGates_1.Link( OInitMin , ISuby )
212     
213     LInitMinSub_1x = GraphLoopsGates_1.Link( OInitMin , ISub_1x )
214     
215     LInitMaxEndInitMax = GraphLoopsGates_1.Link( OInitMax , IEndInitMax )
216     
217     LInitMaxSub_1y = GraphLoopsGates_1.Link( OInitMax , ISub_1y )
218     
219     LInitGateAdd_1Gate = GraphLoopsGates_1.Link( OInitGate , IAdd_1Gate )
220     
221     LInitGateAddGate = GraphLoopsGates_1.Link( OInitGate , IAddGate )
222     
223     LEndInitGateEndInit_1Gate = GraphLoopsGates_1.Link( OEndInitGate , IEndInit_1Gate )
224     
225     LAddGateSubGate = GraphLoopsGates_1.Link( OAddGate , ISubGate )
226     
227     LAdd_1GateSub_1Gate = GraphLoopsGates_1.Link( OAdd_1Gate , ISub_1Gate )
228     
229     LSubGateGateG1 = GraphLoopsGates_1.Link( OSubGate , IGateG1 )
230     
231     LSub_1GateGateG2 = GraphLoopsGates_1.Link( OSub_1Gate , IGateG2 )
232     
233     LGateGateEndInitGate = GraphLoopsGates_1.Link( OGateGate , IEndInitGate )
234     
235     LInit_1IndexEndInit_1Index = GraphLoopsGates_1.Link( OInit_1Index , IEndInit_1Index )
236     
237     LInit_1MinEndInit_1Min = GraphLoopsGates_1.Link( OInit_1Min , IEndInit_1Min )
238     
239     LInit_1MaxEndInit_1Max = GraphLoopsGates_1.Link( OInit_1Max , IEndInit_1Max )
240     
241     LInit_1GateInitGate = GraphLoopsGates_1.Link( OInit_1Gate , IInitGate )
242     LInit_1GateInitGate.AddCoord( 1 , 9 , 346 )
243     LInit_1GateInitGate.AddCoord( 2 , 9 , 199 )
244     LInit_1GateInitGate.AddCoord( 3 , 194 , 199 )
245     LInit_1GateInitGate.AddCoord( 4 , 194 , 119 )
246     
247     # Input datas
248     IInitIndex.Input( 0 )
249     IInitMin.Input( 5 )
250     IInitMax.Input( 8 )
251     IAddx.Input( 1 )
252     IAddy.Input( 2 )
253     IAdd_1x.Input( 3 )
254     IAdd_1y.Input( 4 )
255     IInit_1Index.Input( 0 )
256     IInit_1Min.Input( 1 )
257     IInit_1Max.Input( 3 )
258     
259     # Output Ports of the graph
260     #OEndInitIndex = EndInit.GetOutPort( 'Index' )
261     #OEndInitMin = EndInit.GetOutPort( 'Min' )
262     #OEndInitMax = EndInit.GetOutPort( 'Max' )
263     #OAddFuncValue = Add.GetOutPort( 'FuncValue' )
264     #OAddz = Add.GetOutPort( 'z' )
265     #OAdd_1FuncValue = Add_1.GetOutPort( 'FuncValue' )
266     #OAdd_1z = Add_1.GetOutPort( 'z' )
267     #OSubz = Sub.GetOutPort( 'z' )
268     #OSub_1z = Sub_1.GetOutPort( 'z' )
269     #OGateG = Gate.GetOutPort( 'G' )
270     #OEndInit_1Index = EndInit_1.GetOutPort( 'Index' )
271     #OEndInit_1Min = EndInit_1.GetOutPort( 'Min' )
272     #OEndInit_1Max = EndInit_1.GetOutPort( 'Max' )
273     return GraphLoopsGates_1
274
275
276 GraphLoopsGates_1 = DefGraphLoopsGates_1()