1 # Copyright (C) 2007-2015 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 GraphInLines
27 GraphInLinesParall = Graph( 'GraphInLinesParall' )
28 GraphInLinesParall.SetName( 'GraphInLinesParall' )
29 GraphInLinesParall.SetAuthor( '' )
30 GraphInLinesParall.SetComment( '' )
31 GraphInLinesParall.Coords( 0 , 0 )
33 # Creation of Factory Nodes
35 # Creation of InLine Nodes
37 PyAdd.append( 'import time ' )
38 PyAdd.append( 'def Add(a,b) : ' )
39 PyAdd.append( ' print "Add will wait 5 seconds" ' )
40 PyAdd.append( ' time.sleep(5) ' )
41 PyAdd.append( ' print "Add waited" ' )
42 PyAdd.append( ' return a+b ' )
44 Add = GraphInLinesParall.INode( 'Add' , PyAdd )
45 Add.InPort( 'a' , 'long' )
46 Add.InPort( 'b' , 'long' )
47 Add.OutPort( 'f' , 'long' )
50 Add.SetComment( 'Python function' )
51 Add.Coords( 351 , 77 )
54 PySub.append( 'def Sub(a,b) : ' )
55 PySub.append( ' return a-b ' )
57 Sub = GraphInLinesParall.INode( 'Sub' , PySub )
58 Sub.InPort( 'a' , 'long' )
59 Sub.InPort( 'b' , 'long' )
60 Sub.OutPort( 'f' , 'long' )
63 Sub.SetComment( 'Python function' )
64 Sub.Coords( 86 , 333 )
67 PyMul.append( 'import time ' )
68 PyMul.append( 'def Mul(a,b) : ' )
69 PyMul.append( ' print "Mul will wait 5 seconds" ' )
70 PyMul.append( ' time.sleep(5) ' )
71 PyMul.append( ' print "Mul waited" ' )
72 PyMul.append( ' return a*b ' )
73 Mul = GraphInLinesParall.INode( 'Mul' , PyMul )
74 Mul.InPort( 'a' , 'long' )
75 Mul.InPort( 'b' , 'long' )
76 Mul.OutPort( 'Result' , 'long' )
79 Mul.SetComment( 'Python function' )
80 Mul.Coords( 616 , 247 )
83 Subf = Sub.Port( 'f' )
84 Mulb = GraphInLinesParall.Link( Subf , Mul.Port( 'b' ) )
85 Mulb.AddCoord( 1 , 583 , 357 )
86 Mulb.AddCoord( 2 , 583 , 413 )
87 Mulb.AddCoord( 3 , 282 , 413 )
89 Addb = GraphInLinesParall.Link( Subf , Add.Port( 'b' ) )
90 Addb.AddCoord( 1 , 282 , 186 )
91 Addb.AddCoord( 2 , 283 , 413 )
93 Mula = GraphInLinesParall.Link( Subf , Mul.Port( 'a' ) )
94 Mula.AddCoord( 1 , 583 , 328 )
95 Mula.AddCoord( 2 , 583 , 412 )
97 # Creation of Input datas
98 Adda = Add.Input( 'a' , 1)
99 Suba = Sub.Input( 'a' , 3)
100 Subb = Sub.Input( 'b' , 4)
102 # Creation of Output variables
103 Addf = Add.Port( 'f' )
104 MulResult = Mul.Port( 'Result' )
106 GraphInLinesParall.Run()
107 GraphInLinesParall.DoneW()
108 GraphInLinesParall.PrintPorts()