2 # Check the Merge of two graphs and python functions definitions
4 # Creation of GraphSwitch
5 from GraphSwitch import *
7 # Creation of GraphSwitch1
8 from GraphSwitch1 import *
10 # Merge of GraphSwitch1 in GraphSwitch
11 statmerge = GraphSwitch.Merge( GraphSwitch1 )
13 print "Failed to merge GraphSwitch1 in GraphSwitch"
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()
19 funcname = InitLoopSwitch.PyInitName()
20 funcname1 = InitLoop.PyInitName()
21 print "Init python function names of InitLoopSwitch and InitLoop :",funcname,funcname1
23 # Erase python functions of InitLoop
24 InitLoop.SetPyInit( funcname , [] )
26 InitLoop.SetPyMore( InitLoop.PyMoreName() , [] )
28 InitLoop.SetPyNext( InitLoop.PyNextName() , [] )
31 IsOdd.SetPyFunction( IsOdd.PyFuncName() , [] )
34 # Print Input and Output Ports values of InitLoopSwitch
35 InitLoopSwitch.PrintPorts()
37 # Print Input and Output Ports values of InitLoop
40 # Print Input and Output Ports values of GraphSwitch
41 GraphSwitch.PrintPorts()
43 # Start asynchronous execution of GraphSwitch
46 # Wait for completion of GraphSwitch
49 # Print the state of GraphSwitch
52 # Print the results of GraphSwitch
53 GraphSwitch.PrintPorts()
55 GraphSwitch.Export( "../GraphPyFunctions.xml" )