Salome HOME
Merge from V6_main 01/04/2013
[tools/yacsgen.git] / Examples / ast2 / components.py
1 # Copyright (C) 2009-2013  EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 """
21  Example with one Code_Aster component and one fortran component
22 """
23 import os
24
25 #import context from ..
26 execfile("../context.py")
27 from module_generator import Generator,Module,ASTERComponent,Service,F77Component
28
29 aster_root=os.path.join(aster_home,aster_version)
30
31 fcompodir=os.path.join(os.getcwd(),"fcompo")
32
33 install_prefix="./install"
34 appli_dir="appli"
35
36 c1=ASTERComponent("caster",services=[
37           Service("s1",inport=[("jdc","file"),("a","double"),("b","long"),("c","string")],
38                        outport=[("d","double")],
39                        instream=[("aa","CALCIUM_double","T"),("ab","CALCIUM_double","I"),
40                                  ("ac","CALCIUM_integer","I"),("ad","CALCIUM_real","I"),
41                                  ("ae","CALCIUM_string","I"),("af","CALCIUM_complex","I"),
42                                  ("ag","CALCIUM_logical","I"),
43                          ],
44                        outstream=[("ba","CALCIUM_double","T"),("bb","CALCIUM_double","I")],
45                  ),
46           Service("s2",inport=[("a","double"),],
47                        outport=[("d","double")],
48                  ),
49          ],
50          aster_dir=aster_root,
51          kind="exe",
52          exe_path=os.path.join(os.getcwd(),"exeaster"),
53          )
54
55 c2=F77Component("cfort",services=[
56           Service("s1",inport=[("a","double"),("b","long"),("c","string")],
57                        outport=[("d","double"),("e","long"),("f","string")],
58                        instream=[("a","CALCIUM_double","T"),("b","CALCIUM_double","I")],
59                        outstream=[("ba","CALCIUM_double","T"),("bb","CALCIUM_double","I"),
60                                   ("bc","CALCIUM_integer","I"),("bd","CALCIUM_real","I"),
61                                   ("be","CALCIUM_string","I"),("bf","CALCIUM_complex","I"),
62                                   ("bg","CALCIUM_logical","I"),
63                          ],
64                        defs="",body="",
65                  ),
66          ],
67          kind="exe",
68          exe_path=os.path.join(fcompodir,"prog"),
69          )
70
71 g=Generator(Module("astmod",components=[c1,c2],prefix=install_prefix),context)
72 g.generate()
73 g.bootstrap()
74 g.configure()
75 g.make()
76 g.install()
77 g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})