1 # Copyright (C) 2007-2011 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.
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
22 # Generated python file of Graph GraphInLines
26 GraphInLinesParall = Graph( 'GraphInLinesParall' )
27 GraphInLinesParall.SetName( 'GraphInLinesParall' )
28 GraphInLinesParall.SetAuthor( '' )
29 GraphInLinesParall.SetComment( '' )
30 GraphInLinesParall.Coords( 0 , 0 )
32 # Creation of Factory Nodes
34 # Creation of InLine Nodes
36 PyAdd.append( 'import time ' )
37 PyAdd.append( 'def Add(a,b) : ' )
38 PyAdd.append( ' print "Add will wait 5 seconds" ' )
39 PyAdd.append( ' time.sleep(5) ' )
40 PyAdd.append( ' print "Add waited" ' )
41 PyAdd.append( ' return a+b ' )
43 Add = GraphInLinesParall.INode( 'Add' , PyAdd )
44 Add.InPort( 'a' , 'long' )
45 Add.InPort( 'b' , 'long' )
46 Add.OutPort( 'f' , 'long' )
49 Add.SetComment( 'Python function' )
50 Add.Coords( 351 , 77 )
53 PySub.append( 'def Sub(a,b) : ' )
54 PySub.append( ' return a-b ' )
56 Sub = GraphInLinesParall.INode( 'Sub' , PySub )
57 Sub.InPort( 'a' , 'long' )
58 Sub.InPort( 'b' , 'long' )
59 Sub.OutPort( 'f' , 'long' )
62 Sub.SetComment( 'Python function' )
63 Sub.Coords( 86 , 333 )
66 PyMul.append( 'import time ' )
67 PyMul.append( 'def Mul(a,b) : ' )
68 PyMul.append( ' print "Mul will wait 5 seconds" ' )
69 PyMul.append( ' time.sleep(5) ' )
70 PyMul.append( ' print "Mul waited" ' )
71 PyMul.append( ' return a*b ' )
72 Mul = GraphInLinesParall.INode( 'Mul' , PyMul )
73 Mul.InPort( 'a' , 'long' )
74 Mul.InPort( 'b' , 'long' )
75 Mul.OutPort( 'Result' , 'long' )
78 Mul.SetComment( 'Python function' )
79 Mul.Coords( 616 , 247 )
82 Subf = Sub.Port( 'f' )
83 Mulb = GraphInLinesParall.Link( Subf , Mul.Port( 'b' ) )
84 Mulb.AddCoord( 1 , 583 , 357 )
85 Mulb.AddCoord( 2 , 583 , 413 )
86 Mulb.AddCoord( 3 , 282 , 413 )
88 Addb = GraphInLinesParall.Link( Subf , Add.Port( 'b' ) )
89 Addb.AddCoord( 1 , 282 , 186 )
90 Addb.AddCoord( 2 , 283 , 413 )
92 Mula = GraphInLinesParall.Link( Subf , Mul.Port( 'a' ) )
93 Mula.AddCoord( 1 , 583 , 328 )
94 Mula.AddCoord( 2 , 583 , 412 )
96 # Creation of Input datas
97 Adda = Add.Input( 'a' , 1)
98 Suba = Sub.Input( 'a' , 3)
99 Subb = Sub.Input( 'b' , 4)
101 # Creation of Output variables
102 Addf = Add.Port( 'f' )
103 MulResult = Mul.Port( 'Result' )
105 GraphInLinesParall.Run()
106 GraphInLinesParall.DoneW()
107 GraphInLinesParall.PrintPorts()