Salome HOME
Imported using TkCVS
[samples/datafiles.git] / Superv / Python / GraphMerge1.py
1
2 # Check the Merge of two graphs and python functions definitions
3
4 # Creation of GraphSwitch
5 from GraphSwitch import *
6
7 # Creation of GraphSwitch1
8 from GraphSwitch1 import *
9
10 # Merge of GraphSwitch1 in GraphSwitch
11 statmerge = GraphSwitch.Merge( GraphSwitch1 )
12 if statmerge == 0 :
13     print "Failed to merge GraphSwitch1 in GraphSwitch"
14
15 # Create a variable for each node of GraphSwitch :
16 # IsOdd,IsOdd_1,InitLoopSwitch,InitLoop,EndOfInitLoopSwitch,EndOfInitLoop,Switch,Switch_1,EndOfSwitch,EndSwitch
17 exec GraphSwitch.ListNodes()
18
19 funcname = InitLoopSwitch.PyInitName()
20 funcname1 = InitLoop.PyInitName()
21 print "Init python function names of InitLoopSwitch and InitLoop :",funcname,funcname1
22 InitLoop.PyInit()
23 # Erase python functions of InitLoop
24 InitLoop.SetPyInit( funcname , [] )
25 InitLoop.PyInit()
26 InitLoop.SetPyMore( InitLoop.PyMoreName() , [] )
27 InitLoop.PyMore()
28 InitLoop.SetPyNext( InitLoop.PyNextName() , [] )
29 InitLoop.PyNext()
30
31 IsOdd.SetPyFunction( IsOdd.PyFuncName() , [] )
32 IsOdd.PyFunction()
33
34 # Print Input and Output Ports values of InitLoopSwitch
35 InitLoopSwitch.PrintPorts()
36
37 # Print Input and Output Ports values of InitLoop
38 InitLoop.PrintPorts()
39
40 # Print Input and Output Ports values of GraphSwitch
41 GraphSwitch.PrintPorts()
42
43 # Start asynchronous execution of GraphSwitch
44 GraphSwitch.Run()
45
46 # Wait for completion of GraphSwitch
47 GraphSwitch.DoneW()
48
49 # Print the state of GraphSwitch
50 GraphSwitch.State()
51
52 # Print the results of GraphSwitch
53 GraphSwitch.PrintPorts()
54
55 GraphSwitch.Export( "../GraphPyFunctions.xml" )
56