Salome HOME
add new files for mesh
[samples/datafiles.git] / Superv / Python / GraphInLinesParall.py
1 # Copyright (C) 2007-2014  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 GraphInLines
24 #
25 from SuperV import *
26 # Graph creation 
27 GraphInLinesParall = Graph( 'GraphInLinesParall' )
28 GraphInLinesParall.SetName( 'GraphInLinesParall' )
29 GraphInLinesParall.SetAuthor( '' )
30 GraphInLinesParall.SetComment( '' )
31 GraphInLinesParall.Coords( 0 , 0 )
32
33 # Creation of Factory Nodes
34
35 # Creation of InLine Nodes
36 PyAdd = []
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   ' )
43 PyAdd.append( '' )
44 Add = GraphInLinesParall.INode( 'Add' , PyAdd )
45 Add.InPort( 'a' , 'long' )
46 Add.InPort( 'b' , 'long' )
47 Add.OutPort( 'f' , 'long' )
48 Add.SetName( 'Add' )
49 Add.SetAuthor( '' )
50 Add.SetComment( 'Python function' )
51 Add.Coords( 351 , 77 )
52
53 PySub = []
54 PySub.append( 'def Sub(a,b) : ' )
55 PySub.append( '    return a-b ' )
56 PySub.append( '' )
57 Sub = GraphInLinesParall.INode( 'Sub' , PySub )
58 Sub.InPort( 'a' , 'long' )
59 Sub.InPort( 'b' , 'long' )
60 Sub.OutPort( 'f' , 'long' )
61 Sub.SetName( 'Sub' )
62 Sub.SetAuthor( '' )
63 Sub.SetComment( 'Python function' )
64 Sub.Coords( 86 , 333 )
65
66 PyMul = []
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' )
77 Mul.SetName( 'Mul' )
78 Mul.SetAuthor( '' )
79 Mul.SetComment( 'Python function' )
80 Mul.Coords( 616 , 247 )
81
82 # Creation of Links
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 )
88
89 Addb = GraphInLinesParall.Link( Subf , Add.Port( 'b' ) )
90 Addb.AddCoord( 1 , 282 , 186 )
91 Addb.AddCoord( 2 , 283 , 413 )
92
93 Mula = GraphInLinesParall.Link( Subf , Mul.Port( 'a' ) )
94 Mula.AddCoord( 1 , 583 , 328 )
95 Mula.AddCoord( 2 , 583 , 412 )
96
97 # Creation of Input datas
98 Adda = Add.Input( 'a' , 1)
99 Suba = Sub.Input( 'a' , 3)
100 Subb = Sub.Input( 'b' , 4)
101
102 # Creation of Output variables
103 Addf = Add.Port( 'f' )
104 MulResult = Mul.Port( 'Result' )
105
106 GraphInLinesParall.Run()
107 GraphInLinesParall.DoneW()
108 GraphInLinesParall.PrintPorts()