]> SALOME platform Git repositories - tools/yacsgen.git/commitdiff
Salome HOME
CCAR : add example fort2 (standalone component fortran)
authorcaremoli <caremoli>
Fri, 23 Jan 2009 18:16:00 +0000 (18:16 +0000)
committercaremoli <caremoli>
Fri, 23 Jan 2009 18:16:00 +0000 (18:16 +0000)
Examples/fort2/Makefile [new file with mode: 0644]
Examples/fort2/README.txt [new file with mode: 0644]
Examples/fort2/code1.f [new file with mode: 0644]
Examples/fort2/code2.f [new file with mode: 0644]
Examples/fort2/components.py [new file with mode: 0644]
Examples/fort2/coupling.xml [new file with mode: 0644]

diff --git a/Examples/fort2/Makefile b/Examples/fort2/Makefile
new file mode 100644 (file)
index 0000000..b5b693e
--- /dev/null
@@ -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 (file)
index 0000000..5cef309
--- /dev/null
@@ -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 <your prerequisite file>
+
+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 (file)
index 0000000..ac9543a
--- /dev/null
@@ -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 (file)
index 0000000..1a5c654
--- /dev/null
@@ -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 (file)
index 0000000..b92f78d
--- /dev/null
@@ -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 (file)
index 0000000..c3d4ef8
--- /dev/null
@@ -0,0 +1,59 @@
+
+<proc>
+
+<!-- types -->
+
+
+<container name="A">
+</container>
+
+<container name="B">
+</container>
+
+<service name="node1" >
+  <component>fcode1</component>
+  <method>serv1</method>
+  <load container="A"/>
+  <inport name="a" type="double"/>
+  <inport name="b" type="double"/>
+  <outport name="c" type="double"/>
+  <outstream name="PARAM" type="CALCIUM_double"/>
+</service>
+
+<service name="node2" >
+  <component>fcode2</component>
+  <method>serv1</method>
+  <load container="B"/>
+  <inport name="a" type="double"/>
+  <inport name="b" type="double"/>
+  <outport name="c" type="double"/>
+  <instream name="PARAM" type="CALCIUM_double"/>
+</service>
+
+
+<!--datalinks -->
+<stream>
+  <fromnode>node1</fromnode><fromport>PARAM</fromport>
+  <tonode>node2</tonode><toport>PARAM</toport>
+</stream>
+
+<parameter>
+  <tonode>node1</tonode> <toport>a</toport>
+  <value><double>23</double> </value>
+</parameter>
+<parameter>
+  <tonode>node1</tonode> <toport>b</toport>
+  <value><double>53</double> </value>
+</parameter>
+<parameter>
+  <tonode>node2</tonode> <toport>a</toport>
+  <value><double>63</double> </value>
+</parameter>
+<parameter>
+  <tonode>node2</tonode> <toport>b</toport>
+  <value><double>73</double> </value>
+</parameter>
+
+
+</proc>
+