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