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