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