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