From: caremoli Date: Fri, 23 Jan 2009 18:17:22 +0000 (+0000) Subject: CCAR : add example pyth2 (standalone component python) X-Git-Tag: V5_1_1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6c9012492918b43ab397abed1acb7f01f1592e2e;p=tools%2Fyacsgen.git CCAR : add example pyth2 (standalone component python) --- diff --git a/Examples/pyth2/README.txt b/Examples/pyth2/README.txt new file mode 100644 index 0000000..2f25931 --- /dev/null +++ b/Examples/pyth2/README.txt @@ -0,0 +1,25 @@ +A Python component +==================== + +To build this example, modify the components.py file +to take into account your configuration. + +1- your prerequisite file +2- your KERNEL_ROOT_DIR + +Then set the environment (including PYTHONPATH for YACGEN, ../.. from here and execute components.py :: + + source + python components.py + +You should get a SALOME module in source form (pycompos_SRC), its installation (install) and +a SALOME application (appli) composed of modules KERNEL, GUI, YACS and pycompos. + +To run a coupling: + + 1. start SALOME in background : ./appli/runAppli -t + 2. start a SALOME session : ./appli/runSession + 3. start YACS coupler with coupling file : driver coupling.xml + 4. examine output files in /tmp + 5. shutdown SALOME : shutdowSalome.py + 6. exit session : CTRL-D (or exit) diff --git a/Examples/pyth2/components.py b/Examples/pyth2/components.py new file mode 100644 index 0000000..336c58c --- /dev/null +++ b/Examples/pyth2/components.py @@ -0,0 +1,46 @@ +import os +from module_generator import Generator,Module,Service,PYComponent + +context={'update':1, + "prerequisites":"/local/cchris/.packages.d/envSalome50", + "kernel":"/local/chris/SALOME2/RELEASES/Install/KERNEL_V5", + } + +cwd=os.getcwd() + + +body=""" + #b1 + dep=calcium.CP_ITERATION + val=numpy.zeros(10,'d') + val[5]=a*b + nval=10 + print "--------> Appel calcium.cp_edb" + info=calcium.cp_edb(component, dep, 0., 1, "ba", nval,val) + val=numpy.zeros(10,'d') + info,tt,ii,mval=calcium.cp_ldb(component, dep, 0.,1., 1, "aa", nval,val) + print mval,val + c=a+b + d=a-b + err=calcium.cp_fin(component,calcium.CP_ARRET) +""" +c1=PYComponent("compo2",services=[ + Service("s1",inport=[("a","double"),("b","double")], + outport=[("c","double"),("d","double")], + instream=[("aa","CALCIUM_double","I"),], + outstream=[("ba","CALCIUM_double","I"),], + defs="#def1",body=body, + ), + ], + kind="exe", + ) + + +g=Generator(Module("pycompos",components=[c1],prefix="./install"),context) +g.generate() +g.bootstrap() +g.configure() +g.make() +g.install() +g.make_appli("appli",restrict=["KERNEL","GUI","YACS"]) + diff --git a/Examples/pyth2/coupling.xml b/Examples/pyth2/coupling.xml new file mode 100644 index 0000000..cd9b441 --- /dev/null +++ b/Examples/pyth2/coupling.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + compo2 + s1 + + + + + + + + + + + compo2 + s1 + + + + + + + + + + + + node1ba + node2aa + + + node2ba + node1aa + + + + node1 a + 23 + + + node1 b + 53 + + + node2 a + 63 + + + node2 b + 73 + + + +