Salome HOME
Merge from BR_V5_DEV 17Feb09
[samples/datafiles.git] / Superv / Python / GraphNonVoidEndLoop.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 GraphNonVoidEndLoop
23 #
24 from SuperV import *
25
26 # Graph creation of GraphNonVoidEndLoop
27 def DefGraphNonVoidEndLoop() :
28     GraphNonVoidEndLoop = Graph( 'GraphNonVoidEndLoop' )
29     GraphNonVoidEndLoop.SetName( 'GraphNonVoidEndLoop' )
30     GraphNonVoidEndLoop.SetAuthor( '' )
31     GraphNonVoidEndLoop.SetComment( '' )
32     GraphNonVoidEndLoop.Coords( 0 , 0 )
33     
34     # Creation of Factory Nodes
35     
36     # Creation of Loop Nodes
37     PyInit = []
38     PyInit.append( 'def Init(Index,Min,Max,Incr) :     ' )
39     PyInit.append( '    if Min <= Max :     ' )
40     PyInit.append( '        Index = Min     ' )
41     PyInit.append( '    else :     ' )
42     PyInit.append( '        Index = Max     ' )
43     PyInit.append( '    print 'Init',Index,Min,Max,Incr   ' )
44     PyInit.append( '    return Index,Min,Max,Incr     ' )
45     PyMoreInit = []
46     PyMoreInit.append( 'import time ' )
47     PyMoreInit.append( 'def More(Index,Min,Max,Incr) :   ' )
48     PyMoreInit.append( '    time.sleep(2) ' )
49     PyMoreInit.append( '    if Index < Max :     ' )
50     PyMoreInit.append( '        DoLoop = 1     ' )
51     PyMoreInit.append( '    else :     ' )
52     PyMoreInit.append( '        DoLoop = 0     ' )
53     PyMoreInit.append( '    print 'More', DoLoop,Index,Min,Max,Incr   ' )
54     PyMoreInit.append( '    return DoLoop,Index,Min,Max,Incr     ' )
55     PyNextInit = []
56     PyNextInit.append( 'def Next(Index,Min,Max,Incr) :     ' )
57     PyNextInit.append( '    Index = Index + Incr     ' )
58     PyNextInit.append( '    print 'Next', Index,Min,Max,Incr   ' )
59     PyNextInit.append( '    return Index,Min,Max,Incr    ' )
60     Init,EndInit = GraphNonVoidEndLoop.LNode( 'Init' , PyInit , 'More' , PyMoreInit , 'Next' , PyNextInit )
61     EndInit.SetName( 'EndInit' )
62     EndInit.SetAuthor( '' )
63     EndInit.SetComment( 'Compute Node' )
64     EndInit.Coords( 411 , 260 )
65     PyEndInit = []
66     PyEndInit.append( 'def EndLoop(DoLoop,Index,Min,Max,Incr) : ' )
67     PyEndInit.append( ' print 'EndLoop',DoLoop,Index,Min,Max,Incr ' )
68     PyEndInit.append( ' return DoLoop,Index,Min,Max,Incr ' )
69     PyEndInit.append( '' )
70     EndInit.SetPyFunction( 'EndLoop' , PyEndInit )
71     IInitDoLoop = Init.GetInPort( 'DoLoop' )
72     IInitIndex = Init.InPort( 'Index' , 'long' )
73     IInitMin = Init.InPort( 'Min' , 'long' )
74     IInitMax = Init.InPort( 'Max' , 'long' )
75     IInitIncr = Init.InPort( 'Incr' , 'long' )
76     IInitGate = Init.GetInPort( 'Gate' )
77     OInitDoLoop = Init.GetOutPort( 'DoLoop' )
78     OInitIndex = Init.GetOutPort( 'Index' )
79     OInitMin = Init.GetOutPort( 'Min' )
80     OInitMax = Init.GetOutPort( 'Max' )
81     OInitIncr = Init.GetOutPort( 'Incr' )
82     IEndInitDoLoop = EndInit.GetInPort( 'DoLoop' )
83     IEndInitIndex = EndInit.GetInPort( 'Index' )
84     IEndInitMin = EndInit.GetInPort( 'Min' )
85     IEndInitMax = EndInit.GetInPort( 'Max' )
86     IEndInitIncr = EndInit.GetInPort( 'Incr' )
87     IEndInitGate = EndInit.GetInPort( 'Gate' )
88     OEndInitDoLoop = EndInit.GetOutPort( 'DoLoop' )
89     OEndInitIndex = EndInit.GetOutPort( 'Index' )
90     OEndInitMin = EndInit.GetOutPort( 'Min' )
91     OEndInitMax = EndInit.GetOutPort( 'Max' )
92     OEndInitIncr = EndInit.GetOutPort( 'Incr' )
93     Init.SetName( 'Init' )
94     Init.SetAuthor( '' )
95     Init.SetComment( 'Compute Node' )
96     Init.Coords( 17 , 257 )
97     
98     # Creation of Links
99     LInitIndexEndInitIndex = GraphNonVoidEndLoop.Link( OInitIndex , IEndInitIndex )
100     
101     LInitMinEndInitMin = GraphNonVoidEndLoop.Link( OInitMin , IEndInitMin )
102     
103     LInitMaxEndInitMax = GraphNonVoidEndLoop.Link( OInitMax , IEndInitMax )
104     
105     LInitIncrEndInitIncr = GraphNonVoidEndLoop.Link( OInitIncr , IEndInitIncr )
106     
107     # Input datas
108     IInitIndex.Input( 0 )
109     IInitMin.Input( 5 )
110     IInitMax.Input( 10 )
111     IInitIncr.Input( 1 )
112     
113     # Output Ports of the graph
114     #OEndInitIndex = EndInit.GetOutPort( 'Index' )
115     #OEndInitMin = EndInit.GetOutPort( 'Min' )
116     #OEndInitMax = EndInit.GetOutPort( 'Max' )
117     #OEndInitIncr = EndInit.GetOutPort( 'Incr' )
118     return GraphNonVoidEndLoop
119
120
121 GraphNonVoidEndLoop = DefGraphNonVoidEndLoop()