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