Salome HOME
0022763: [EDF] Shape processing
[samples/datafiles.git] / Superv / Python / GraphLoop1.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 GraphLoop1
24 #
25 from SuperV import *
26
27 # Graph creation of GraphLoop1
28 def DefGraphLoop1() :
29     GraphLoop1 = Graph( 'GraphLoop1' )
30     GraphLoop1.SetName( 'GraphLoop1' )
31     GraphLoop1.SetAuthor( '' )
32     GraphLoop1.SetComment( '' )
33     GraphLoop1.Coords( 0 , 0 )
34     
35     # Creation of Factory Nodes
36     
37     # Creation of InLine Nodes
38     PyNodeIndex = []
39     NodeIndex = GraphLoop1.INode( '' , PyNodeIndex )
40     NodeIndex.SetName( 'NodeIndex' )
41     NodeIndex.SetAuthor( '' )
42     NodeIndex.SetComment( 'Compute Node' )
43     NodeIndex.Coords( 281 , 215 )
44     INodeIndexIndex = NodeIndex.InPort( 'Index' , 'long' )
45     INodeIndexGate = NodeIndex.GetInPort( 'Gate' )
46     ONodeIndexIndex = NodeIndex.OutPort( 'Index' , 'long' )
47     ONodeIndexGate = NodeIndex.GetOutPort( 'Gate' )
48     
49     PyNodeIncr = []
50     NodeIncr = GraphLoop1.INode( '' , PyNodeIncr )
51     NodeIncr.SetName( 'NodeIncr' )
52     NodeIncr.SetAuthor( '' )
53     NodeIncr.SetComment( 'Compute Node' )
54     NodeIncr.Coords( 278 , 372 )
55     INodeIncrIncr = NodeIncr.InPort( 'Incr' , 'long' )
56     INodeIncrGate = NodeIncr.GetInPort( 'Gate' )
57     ONodeIncrIncr = NodeIncr.OutPort( 'Incr' , 'long' )
58     ONodeIncrGate = NodeIncr.GetOutPort( 'Gate' )
59     
60     # Creation of Loop Nodes
61     PyInit = []
62     PyInit.append( 'def Init(Index,Min,Max,Incr) :   ' )
63     PyInit.append( '    if Min <= Max :   ' )
64     PyInit.append( '        Index = Min   ' )
65     PyInit.append( '    else :   ' )
66     PyInit.append( '        Index = Max   ' )
67     PyInit.append( '    return Index,Min,Max,Incr   ' )
68     PyMoreInit = []
69     PyMoreInit.append( 'import time ' )
70     PyMoreInit.append( 'def More(Index,Min,Max,Incr) :   ' )
71     PyMoreInit.append( '    time.sleep(2) ' )
72     PyMoreInit.append( '    if Index < Max :   ' )
73     PyMoreInit.append( '        DoLoop = 1   ' )
74     PyMoreInit.append( '    else :   ' )
75     PyMoreInit.append( '        DoLoop = 0   ' )
76     PyMoreInit.append( '    return DoLoop,Index,Min,Max,Incr   ' )
77     PyNextInit = []
78     PyNextInit.append( 'def Next(Index,Min,Max,Incr) :   ' )
79     PyNextInit.append( '    Index = Index + Incr   ' )
80     PyNextInit.append( '    return Index,Min,Max,Incr  ' )
81     Init,EndInit = GraphLoop1.LNode( 'Init' , PyInit , 'More' , PyMoreInit , 'Next' , PyNextInit )
82     EndInit.SetName( 'EndInit' )
83     EndInit.SetAuthor( '' )
84     EndInit.SetComment( 'Compute Node' )
85     EndInit.Coords( 555 , 255 )
86     PyEndInit = []
87     EndInit.SetPyFunction( '' , PyEndInit )
88     IInitDoLoop = Init.GetInPort( 'DoLoop' )
89     IInitIndex = Init.InPort( 'Index' , 'long' )
90     IInitMin = Init.InPort( 'Min' , 'long' )
91     IInitMax = Init.InPort( 'Max' , 'long' )
92     IInitIncr = Init.InPort( 'Incr' , 'long' )
93     IInitGate = Init.GetInPort( 'Gate' )
94     OInitDoLoop = Init.GetOutPort( 'DoLoop' )
95     OInitIndex = Init.GetOutPort( 'Index' )
96     OInitMin = Init.GetOutPort( 'Min' )
97     OInitMax = Init.GetOutPort( 'Max' )
98     OInitIncr = Init.GetOutPort( 'Incr' )
99     IEndInitDoLoop = EndInit.GetInPort( 'DoLoop' )
100     IEndInitIndex = EndInit.GetInPort( 'Index' )
101     IEndInitMin = EndInit.GetInPort( 'Min' )
102     IEndInitMax = EndInit.GetInPort( 'Max' )
103     IEndInitIncr = EndInit.GetInPort( 'Incr' )
104     IEndInitGate = EndInit.GetInPort( 'Gate' )
105     OEndInitDoLoop = EndInit.GetOutPort( 'DoLoop' )
106     OEndInitIndex = EndInit.GetOutPort( 'Index' )
107     OEndInitMin = EndInit.GetOutPort( 'Min' )
108     OEndInitMax = EndInit.GetOutPort( 'Max' )
109     OEndInitIncr = EndInit.GetOutPort( 'Incr' )
110     OEndInitGate = EndInit.GetOutPort( 'Gate' )
111     Init.SetName( 'Init' )
112     Init.SetAuthor( '' )
113     Init.SetComment( 'Compute Node' )
114     Init.Coords( 17 , 257 )
115     
116     # Creation of Links
117     LInitIndexNodeIndexIndex = GraphLoop1.Link( OInitIndex , INodeIndexIndex )
118     
119     LInitMinEndInitMin = GraphLoop1.Link( OInitMin , IEndInitMin )
120     
121     LInitMaxEndInitMax = GraphLoop1.Link( OInitMax , IEndInitMax )
122     
123     LInitIncrNodeIncrIncr = GraphLoop1.Link( OInitIncr , INodeIncrIncr )
124     
125     LNodeIndexIndexEndInitIndex = GraphLoop1.Link( ONodeIndexIndex , IEndInitIndex )
126     
127     LNodeIncrIncrEndInitIncr = GraphLoop1.Link( ONodeIncrIncr , IEndInitIncr )
128     
129     # Input datas
130     IInitIndex.Input( 0 )
131     IInitMin.Input( 5 )
132     IInitMax.Input( 10 )
133     IInitIncr.Input( 1 )
134     
135     # Output Ports of the graph
136     #OEndInitIndex = EndInit.GetOutPort( 'Index' )
137     #OEndInitMin = EndInit.GetOutPort( 'Min' )
138     #OEndInitMax = EndInit.GetOutPort( 'Max' )
139     #OEndInitIncr = EndInit.GetOutPort( 'Incr' )
140     return GraphLoop1
141
142
143 GraphLoop1 = DefGraphLoop1()