From: caremoli Date: Fri, 23 Jan 2009 18:16:00 +0000 (+0000) Subject: CCAR : add example fort2 (standalone component fortran) X-Git-Tag: V5_1_1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=edb782a5e2f34a206469ed00fbb43e596905ace5;p=tools%2Fyacsgen.git CCAR : add example fort2 (standalone component fortran) --- diff --git a/Examples/fort2/Makefile b/Examples/fort2/Makefile new file mode 100644 index 0000000..b5b693e --- /dev/null +++ b/Examples/fort2/Makefile @@ -0,0 +1,18 @@ + +FC=g77 + +KERNEL_ROOT_DIR=/local/chris/SALOME2/RELEASES/Install/KERNEL_V5 + +all:prog1 prog2 +prog1:code1.o + $(FC) -o prog1 code1.o -L./install/lib/salome -lfcode1Exelib +code1.o:code1.f + $(FC) -c code1.f -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions + +prog2:code2.o + $(FC) -o prog2 code2.o -L./install/lib/salome -lfcode2Exelib +code2.o:code2.f + $(FC) -c code2.f -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions + +clean: + rm -rf *.o prog1 prog2 diff --git a/Examples/fort2/README.txt b/Examples/fort2/README.txt new file mode 100644 index 0000000..5cef309 --- /dev/null +++ b/Examples/fort2/README.txt @@ -0,0 +1,32 @@ +A Fortran component +====================== + +To build this example, modify the components.py and Makefile files +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):: + + source + +Build the code1 et code2 libraries :: + + make + +and process components.py :: + + python components.py + +You should get a SALOME module in source form (fcompos_SRC), its installation (Installfort) and +a SALOME application (appli) composed of modules KERNEL, GUI, YACS and fcompos. + +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/fort2/code1.f b/Examples/fort2/code1.f new file mode 100644 index 0000000..ac9543a --- /dev/null +++ b/Examples/fort2/code1.f @@ -0,0 +1,15 @@ + PROGRAM P + CALL YACSINIT() + END + + SUBROUTINE SERV1(compo,a,b,c) + include 'calcium.hf' + integer compo(2) + real*8 tt,a,b,c + write(6,*)a,b + tt=125.45 + CALL cpeDB(compo,CP_ITERATION,0.,1,'PARAM',1,tt,info) + write(6,*)'info=',info + c=a+b + return + end diff --git a/Examples/fort2/code2.f b/Examples/fort2/code2.f new file mode 100644 index 0000000..1a5c654 --- /dev/null +++ b/Examples/fort2/code2.f @@ -0,0 +1,15 @@ + PROGRAM P + CALL YACSINIT() + END + + SUBROUTINE SERV1(compo,a,b,c) + include 'calcium.hf' + integer compo(2),nval + real*8 tt,t0,t1,a,b,c + write(6,*)a,b + CALL cplDB(compo,CP_ITERATION,t0,t1,1,'PARAM',1,nval,tt,info) + write(6,*)'info=',info + write(6,*)'tt=',tt + c=a+b + return + end diff --git a/Examples/fort2/components.py b/Examples/fort2/components.py new file mode 100644 index 0000000..b92f78d --- /dev/null +++ b/Examples/fort2/components.py @@ -0,0 +1,31 @@ +import os +from module_generator import Generator,Module,Service,F77Component + +context={'update':1, + "prerequisites":"/local/cchris/.packages.d/envSalome50", + "kernel":"/local/chris/SALOME2/RELEASES/Install/KERNEL_V5", + } + +cwd=os.getcwd() + +c1=F77Component("fcode1", services=[Service("serv1",inport=[("a","double"),("b","double")], + outport=[("c","double")], + outstream=[("PARAM","CALCIUM_double","I")],), ], + kind="exe", + exe_path=os.path.join(cwd,"prog1"), + ) +c2=F77Component("fcode2", services=[Service("serv1",inport=[("a","double"),("b","double")], + outport=[("c","double")], + instream=[("PARAM","CALCIUM_double","I")],), ], + kind="exe", + exe_path=os.path.join(cwd,"prog2"), + ) + +g=Generator(Module("fcompos",components=[c1,c2],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/fort2/coupling.xml b/Examples/fort2/coupling.xml new file mode 100644 index 0000000..c3d4ef8 --- /dev/null +++ b/Examples/fort2/coupling.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + fcode1 + serv1 + + + + + + + + + fcode2 + serv1 + + + + + + + + + + + node1PARAM + node2PARAM + + + + node1 a + 23 + + + node1 b + 53 + + + node2 a + 63 + + + node2 b + 73 + + + + +