Salome HOME
Merge from V6_main_20120808 08Aug12
[samples/datafiles.git] / Superv / Python / GraphInLines.py
1 #  Copyright (C) 2007-2011  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.
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 # Generated python file of Graph GraphInLines
23 #
24 from SuperV import *
25 # Graph creation 
26 GraphInLines = Graph( 'GraphInLines' )
27 GraphInLines.SetName( 'GraphInLines' )
28 GraphInLines.SetAuthor( '' )
29 GraphInLines.SetComment( '' )
30 GraphInLines.Coords( 0 , 0 )
31
32 # Creation of Factory Nodes
33
34 # Creation of InLine Nodes
35 PyAdd = []
36 PyAdd.append( 'def Add(a,b) :  ' )
37 PyAdd.append( '    return a+b  ' )
38 PyAdd.append( '' )
39 Add = GraphInLines.INode( 'Add' , PyAdd )
40 Add.InPort( 'a' , 'long' )
41 Add.InPort( 'b' , 'long' )
42 Add.OutPort( 'f' , 'long' )
43 Add.SetName( 'Add' )
44 Add.SetAuthor( '' )
45 Add.SetComment( 'Python function' )
46 Add.Coords( 351 , 77 )
47
48 PySub = []
49 PySub.append( 'def Sub(a,b) : ' )
50 PySub.append( '    return a-b ' )
51 PySub.append( '' )
52 Sub = GraphInLines.INode( 'Sub' , PySub )
53 Sub.InPort( 'a' , 'long' )
54 Sub.InPort( 'b' , 'long' )
55 Sub.OutPort( 'f' , 'long' )
56 Sub.SetName( 'Sub' )
57 Sub.SetAuthor( '' )
58 Sub.SetComment( 'Python function' )
59 Sub.Coords( 86 , 333 )
60
61 PyMul = []
62 PyMul.append( 'def Mul(a,b) : ' )
63 PyMul.append( '    return a*b ' )
64 Mul = GraphInLines.INode( 'Mul' , PyMul )
65 Mul.InPort( 'a' , 'long' )
66 Mul.InPort( 'b' , 'long' )
67 Mul.OutPort( 'Result' , 'long' )
68 Mul.SetName( 'Mul' )
69 Mul.SetAuthor( '' )
70 Mul.SetComment( 'Python function' )
71 Mul.Coords( 616 , 247 )
72
73 # Creation of Links
74 Addf = Add.Port( 'f' )
75 Mula = GraphInLines.Link( Addf , Mul.Port( 'a' ) )
76 Mula.AddCoord( 1 , 569 , 326 )
77 Mula.AddCoord( 2 , 569 , 158 )
78
79 Subf = Sub.Port( 'f' )
80 Mulb = GraphInLines.Link( Subf , Mul.Port( 'b' ) )
81 Mulb.AddCoord( 1 , 283 , 358 )
82 Mulb.AddCoord( 2 , 281 , 413 )
83
84 Addb = GraphInLines.Link( Subf , Add.Port( 'b' ) )
85 Addb.AddCoord( 1 , 283 , 187 )
86 Addb.AddCoord( 2 , 282 , 356 )
87 Addb.AddCoord( 3 , 281 , 414 )
88
89 # Creation of Input datas
90 Adda = Add.Input( 'a' , 1)
91 Suba = Sub.Input( 'a' , 3)
92 Subb = Sub.Input( 'b' , 4)
93
94 # Creation of Output variables
95 MulResult = Mul.Port( 'Result' )
96
97 GraphInLines.Run()
98
99 GraphInLines.DoneW()
100
101 GraphInLines.PrintPorts()
102