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