1 # Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 # Generated python file of Graph test_superv_basic_loop
27 test_superv_basic_loop = Graph( 'test_superv_basic_loop' )
28 test_superv_basic_loop.SetName( 'test_superv_basic_loop' )
29 test_superv_basic_loop.SetAuthor( '' )
30 test_superv_basic_loop.SetComment( '' )
31 test_superv_basic_loop.Coords( 0 , 0 )
33 # Creation of Factory Nodes
35 # Creation of InLine Nodes
37 PyAdd.append( 'def Sum(sum,incr): ' )
38 PyAdd.append( ' result = sum+incr ' )
39 PyAdd.append( ' return result,incr ' )
40 Add = test_superv_basic_loop.INode( 'Sum' , PyAdd )
41 Add.InPort( 'sum' , 'long' )
42 Add.InPort( 'incr' , 'long' )
43 Add.OutPort( 'Sum' , 'long' )
44 Add.OutPort( 'incr' , 'long' )
47 Add.SetComment( 'Python function' )
48 Add.Coords( 220 , 40 )
50 # Creation of Loop Nodes
52 Pyfori.append( 'def Init(index,min,max,sum): ' )
53 Pyfori.append( ' if max > min : ' )
54 Pyfori.append( ' index = min ' )
55 Pyfori.append( ' else : ' )
56 Pyfori.append( ' index = max ' )
57 Pyfori.append( ' #print index,min,max,sum ' )
58 Pyfori.append( ' return index,min,max,sum ' )
60 PyMorefori.append( 'def More(index,min,max,sum): ' )
61 PyMorefori.append( ' OutLoop = 0 ' )
62 PyMorefori.append( ' if max > index : ' )
63 PyMorefori.append( ' OutLoop = 1 ' )
64 PyMorefori.append( ' #print OutLoop,index,min,max,sum ' )
65 PyMorefori.append( ' return OutLoop,index,min,max,sum ' )
67 PyNextfori.append( 'def Next(index,min,max,sum): ' )
68 PyNextfori.append( ' index = index + 1 ' )
69 PyNextfori.append( ' #print index,min,max,sum ' )
70 PyNextfori.append( ' return index,min,max,sum ' )
71 fori,Endfori = test_superv_basic_loop.LNode( 'Init' , Pyfori , 'More' , PyMorefori , 'Next' , PyNextfori )
72 Endfori.SetName( 'Endfori' )
73 Endfori.SetAuthor( '' )
74 Endfori.SetComment( '' )
75 Endfori.Coords( 432 , 0 )
76 fori.InPort( 'index' , 'long' )
77 fori.InPort( 'min' , 'long' )
78 fori.InPort( 'max' , 'long' )
79 fori.InPort( 'sum' , 'long' )
80 fori.OutPort( 'index' , 'long' )
81 fori.OutPort( 'min' , 'long' )
82 fori.OutPort( 'max' , 'long' )
83 fori.OutPort( 'sum' , 'long' )
84 fori.SetName( 'fori' )
90 AddSum = Add.Port( 'Sum' )
91 Endforisum = test_superv_basic_loop.Link( AddSum , Endfori.Port( 'sum' ) )
93 foriindex = fori.Port( 'index' )
94 Endforiindex = test_superv_basic_loop.Link( foriindex , Endfori.Port( 'index' ) )
96 Addincr = test_superv_basic_loop.Link( foriindex , Add.Port( 'incr' ) )
97 Addincr.AddCoord( 1 , 186 , 150 )
98 Addincr.AddCoord( 2 , 187 , 34 )
100 forimin = fori.Port( 'min' )
101 Endforimin = test_superv_basic_loop.Link( forimin , Endfori.Port( 'min' ) )
103 forimax = fori.Port( 'max' )
104 Endforimax = test_superv_basic_loop.Link( forimax , Endfori.Port( 'max' ) )
106 forisum = fori.Port( 'sum' )
107 Addsum = test_superv_basic_loop.Link( forisum , Add.Port( 'sum' ) )
109 # Creation of Input datas
110 foriindex = fori.Input( 'index' , 0)
111 forimin = fori.Input( 'min' , 0)
112 forimax = fori.Input( 'max' , 1001)
113 forisum = fori.Input( 'sum' , 0)
115 # Creation of Output variables
116 Addincr = Add.Port( 'incr' )
117 Endforiindex = Endfori.Port( 'index' )
118 Endforimin = Endfori.Port( 'min' )
119 Endforimax = Endfori.Port( 'max' )
120 Endforisum = Endfori.Port( 'sum' )
122 test_superv_basic_loop.Run()
123 test_superv_basic_loop.DoneW()
124 test_superv_basic_loop.PrintPorts()