Salome HOME
c06ee1ee129b27e32ea4922852f28c24ba063761
[samples/datafiles.git] / Superv / Python / GraphTwoLoops1.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 GraphTwoLoops1
24 #
25 from SuperV import *
26
27 # Graph creation of GraphTwoLoops1
28 def DefGraphTwoLoops1() :
29     GraphTwoLoops1 = Graph( 'GraphTwoLoops1' )
30     GraphTwoLoops1.SetName( 'GraphTwoLoops1' )
31     GraphTwoLoops1.SetAuthor( 'JR' )
32     GraphTwoLoops1.SetComment( '' )
33     GraphTwoLoops1.Coords( 0 , 0 )
34     
35     # Creation of Factory Nodes
36     
37     # Creation of Loop Nodes
38     PyLoop1 = []
39     PyLoop1.append( 'def Loop1(Index,Max) :      ' )
40     PyLoop1.append( '   return Index,Max        ' )
41     PyLoop1.append( '' )
42     PyMoreLoop1 = []
43     PyMoreLoop1.append( 'import time  ' )
44     PyMoreLoop1.append( 'def More(Index,Max) :   ' )
45     PyMoreLoop1.append( '       time.sleep(2)  ' )
46     PyMoreLoop1.append( '       DoLoop = 0       ' )
47     PyMoreLoop1.append( '       if Index < Max :       ' )
48     PyMoreLoop1.append( '               DoLoop = 1       ' )
49     PyMoreLoop1.append( '       return DoLoop,Index,Max       ' )
50     PyMoreLoop1.append( '' )
51     PyNextLoop1 = []
52     PyNextLoop1.append( 'def Next(Index,Max) :       ' )
53     PyNextLoop1.append( '       Index = Index + 1       ' )
54     PyNextLoop1.append( '       return Index,Max       ' )
55     PyNextLoop1.append( '' )
56     Loop1,EndLoop1 = GraphTwoLoops1.LNode( 'Loop1' , PyLoop1 , 'More' , PyMoreLoop1 , 'Next' , PyNextLoop1 )
57     EndLoop1.SetName( 'EndLoop1' )
58     EndLoop1.SetAuthor( '' )
59     EndLoop1.SetComment( 'Compute Node' )
60     EndLoop1.Coords( 634 , 177 )
61     PyEndLoop1 = []
62     EndLoop1.SetPyFunction( 'EndLoop1' , PyEndLoop1 )
63     ILoop1DoLoop = Loop1.GetInPort( 'DoLoop' )
64     ILoop1Index = Loop1.InPort( 'Index' , 'long' )
65     ILoop1Max = Loop1.InPort( 'Max' , 'long' )
66     ILoop1Gate = Loop1.GetInPort( 'Gate' )
67     OLoop1DoLoop = Loop1.GetOutPort( 'DoLoop' )
68     OLoop1Index = Loop1.GetOutPort( 'Index' )
69     OLoop1Max = Loop1.GetOutPort( 'Max' )
70     IEndLoop1DoLoop = EndLoop1.GetInPort( 'DoLoop' )
71     IEndLoop1Index = EndLoop1.GetInPort( 'Index' )
72     IEndLoop1Max = EndLoop1.GetInPort( 'Max' )
73     IEndLoop1Gate = EndLoop1.GetInPort( 'Gate' )
74     OEndLoop1DoLoop = EndLoop1.GetOutPort( 'DoLoop' )
75     OEndLoop1Index = EndLoop1.GetOutPort( 'Index' )
76     OEndLoop1Max = EndLoop1.GetOutPort( 'Max' )
77     OEndLoop1Gate = EndLoop1.GetOutPort( 'Gate' )
78     Loop1.SetName( 'Loop1' )
79     Loop1.SetAuthor( '' )
80     Loop1.SetComment( 'Compute Node' )
81     Loop1.Coords( 7 , 175 )
82     
83     PyLoop = []
84     PyMoreLoop = []
85     PyMoreLoop.append( '' )
86     PyNextLoop = []
87     PyNextLoop.append( 'def Next(Index,Max) : ' )
88     PyNextLoop.append( '        Index = Index + 1 ' )
89     PyNextLoop.append( '        return Index,Max ' )
90     PyNextLoop.append( '' )
91     Loop,EndLoop = GraphTwoLoops1.LNode( '' , PyLoop , '' , PyMoreLoop , 'Next' , PyNextLoop )
92     EndLoop.SetName( 'EndLoop' )
93     EndLoop.SetAuthor( '' )
94     EndLoop.SetComment( 'Compute Node' )
95     EndLoop.Coords( 426 , 180 )
96     PyEndLoop = []
97     PyEndLoop.append( 'import time ' )
98     PyEndLoop.append( 'def EndLoop(DoLoop,Index,Max) :  ' )
99     PyEndLoop.append( ' time.sleep(1) ' )
100     PyEndLoop.append( ' DoLoop = 0  ' )
101     PyEndLoop.append( ' if Index < Max :  ' )
102     PyEndLoop.append( '         DoLoop = 1  ' )
103     PyEndLoop.append( ' return DoLoop,Index,Max  ' )
104     PyEndLoop.append( '' )
105     EndLoop.SetPyFunction( 'EndLoop' , PyEndLoop )
106     ILoopDoLoop = Loop.GetInPort( 'DoLoop' )
107     ILoopIndex = Loop.InPort( 'Index' , 'long' )
108     ILoopMax = Loop.InPort( 'Max' , 'long' )
109     ILoopGate = Loop.GetInPort( 'Gate' )
110     OLoopDoLoop = Loop.GetOutPort( 'DoLoop' )
111     OLoopIndex = Loop.GetOutPort( 'Index' )
112     OLoopMax = Loop.GetOutPort( 'Max' )
113     IEndLoopDoLoop = EndLoop.GetInPort( 'DoLoop' )
114     IEndLoopIndex = EndLoop.GetInPort( 'Index' )
115     IEndLoopMax = EndLoop.GetInPort( 'Max' )
116     IEndLoopGate = EndLoop.GetInPort( 'Gate' )
117     OEndLoopDoLoop = EndLoop.GetOutPort( 'DoLoop' )
118     OEndLoopIndex = EndLoop.GetOutPort( 'Index' )
119     OEndLoopMax = EndLoop.GetOutPort( 'Max' )
120     OEndLoopGate = EndLoop.GetOutPort( 'Gate' )
121     Loop.SetName( 'Loop' )
122     Loop.SetAuthor( '' )
123     Loop.SetComment( 'Compute Node' )
124     Loop.Coords( 208 , 179 )
125     
126     # Creation of Links
127     LLoop1IndexEndLoop1Index = GraphTwoLoops1.Link( OLoop1Index , IEndLoop1Index )
128     
129     LLoop1IndexLoopIndex = GraphTwoLoops1.Link( OLoop1Index , ILoopIndex )
130     
131     LLoop1MaxEndLoop1Max = GraphTwoLoops1.Link( OLoop1Max , IEndLoop1Max )
132     
133     LLoop1GateLoopGate = GraphTwoLoops1.Link( OLoop1Gate , ILoopGate )
134     
135     LLoopIndexEndLoopIndex = GraphTwoLoops1.Link( OLoopIndex , IEndLoopIndex )
136     
137     LLoopMaxEndLoopMax = GraphTwoLoops1.Link( OLoopMax , IEndLoopMax )
138     
139     LEndLoopGateEndLoop1Gate = GraphTwoLoops1.Link( OEndLoopGate , IEndLoop1Gate )
140     
141     # Input datas
142     ILoop1Index.Input( 5 )
143     ILoop1Max.Input( 15 )
144     ILoopMax.Input( 20 )
145     
146     # Output Ports of the graph
147     #OEndLoop1Index = EndLoop1.GetOutPort( 'Index' )
148     #OEndLoop1Max = EndLoop1.GetOutPort( 'Max' )
149     #OEndLoopIndex = EndLoop.GetOutPort( 'Index' )
150     #OEndLoopMax = EndLoop.GetOutPort( 'Max' )
151     return GraphTwoLoops1
152
153
154 GraphTwoLoops1 = DefGraphTwoLoops1()