Salome HOME
Merge from BR_V5_DEV 17Feb09
[samples/datafiles.git] / Superv / Python / GraphLoopDoWhile.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 GraphLoopDoWhile
23 #
24 from SuperV import *
25
26 # Graph creation of GraphLoopDoWhile
27 def DefGraphLoopDoWhile() :
28     GraphLoopDoWhile = Graph( 'GraphLoopDoWhile' )
29     GraphLoopDoWhile.SetName( 'GraphLoopDoWhile' )
30     GraphLoopDoWhile.SetAuthor( 'JR' )
31     GraphLoopDoWhile.SetComment( '' )
32     GraphLoopDoWhile.Coords( 0 , 0 )
33     
34     # Creation of Factory Nodes
35     
36     # Creation of Loop Nodes
37     PyLoop = []
38     PyMoreLoop = []
39     PyMoreLoop.append( '' )
40     PyNextLoop = []
41     PyNextLoop.append( 'def LoopWhileNext(Index,Max) :   ' )
42     PyNextLoop.append( '        Index = Index + 1   ' )
43     PyNextLoop.append( '        return Index,Max   ' )
44     PyNextLoop.append( '' )
45     Loop,EndLoop = GraphLoopDoWhile.LNode( '' , PyLoop , '' , PyMoreLoop , 'LoopWhileNext' , PyNextLoop )
46     EndLoop.SetName( 'EndLoop' )
47     EndLoop.SetAuthor( '' )
48     EndLoop.SetComment( 'Compute Node' )
49     EndLoop.Coords( 414 , 232 )
50     PyEndLoop = []
51     PyEndLoop.append( 'import time    ' )
52     PyEndLoop.append( 'def DoWhile(DoLoop,Index,Max) :   ' )
53     PyEndLoop.append( ' print 'DoWhile',DoLoop,Index,Max ' )
54     PyEndLoop.append( ' time.sleep(2)     ' )
55     PyEndLoop.append( ' if Index == Max :     ' )
56     PyEndLoop.append( '         DoLoop = 0     ' )
57     PyEndLoop.append( ' else :     ' )
58     PyEndLoop.append( '         DoLoop = 1     ' )
59     PyEndLoop.append( ' print 'DoWhile',DoLoop,Index,Max ' )
60     PyEndLoop.append( ' return DoLoop,Index,Max     ' )
61     EndLoop.SetPyFunction( 'DoWhile' , PyEndLoop )
62     ILoopDoLoop = Loop.GetInPort( 'DoLoop' )
63     ILoopIndex = Loop.InPort( 'Index' , 'long' )
64     ILoopMax = Loop.InPort( 'Max' , 'long' )
65     ILoopGate = Loop.GetInPort( 'Gate' )
66     OLoopDoLoop = Loop.GetOutPort( 'DoLoop' )
67     OLoopIndex = Loop.GetOutPort( 'Index' )
68     OLoopMax = Loop.GetOutPort( 'Max' )
69     IEndLoopDoLoop = EndLoop.GetInPort( 'DoLoop' )
70     IEndLoopIndex = EndLoop.GetInPort( 'Index' )
71     IEndLoopMax = EndLoop.GetInPort( 'Max' )
72     IEndLoopGate = EndLoop.GetInPort( 'Gate' )
73     OEndLoopDoLoop = EndLoop.GetOutPort( 'DoLoop' )
74     OEndLoopIndex = EndLoop.GetOutPort( 'Index' )
75     OEndLoopMax = EndLoop.GetOutPort( 'Max' )
76     Loop.SetName( 'Loop' )
77     Loop.SetAuthor( '' )
78     Loop.SetComment( 'Compute Node' )
79     Loop.Coords( 105 , 226 )
80     
81     # Creation of Links
82     LLoopIndexEndLoopIndex = GraphLoopDoWhile.Link( OLoopIndex , IEndLoopIndex )
83     
84     LLoopMaxEndLoopMax = GraphLoopDoWhile.Link( OLoopMax , IEndLoopMax )
85     
86     # Input datas
87     ILoopIndex.Input( 5 )
88     ILoopMax.Input( 10 )
89     
90     # Output Ports of the graph
91     #OEndLoopIndex = EndLoop.GetOutPort( 'Index' )
92     #OEndLoopMax = EndLoop.GetOutPort( 'Max' )
93     return GraphLoopDoWhile
94
95
96 GraphLoopDoWhile = DefGraphLoopDoWhile()