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