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