Salome HOME
Increment version of 7.1.0
[tools/yacsgen.git] / Examples / ast1 / components.py
1 # Copyright (C) 2009-2012  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 libfcompodir=os.path.join(os.getcwd(),"fcompo")
32 myasterdir=os.path.join(os.getcwd(),"myaster","bibpyt")
33 install_prefix="./install"
34 appli_dir="appli"
35
36 c1=ASTERComponent("caster",services=[
37           Service("s1",inport=[("argv","string"),("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          ],
47          aster_dir=aster_root,
48          python_path=[myasterdir],
49          argv=["-memjeveux","4",'-rep_outils',os.path.join(aster_home,'outils')],
50          )
51
52 c2=F77Component("cfort",services=[
53           Service("s1",inport=[("a","double"),("b","long"),("c","string")],
54                        outport=[("d","double"),("e","long"),("f","string")],
55                        instream=[("a","CALCIUM_double","T"),("b","CALCIUM_double","I")],
56                        outstream=[("ba","CALCIUM_double","T"),("bb","CALCIUM_double","I"),
57                                   ("bc","CALCIUM_integer","I"),("bd","CALCIUM_real","I"),
58                                   ("be","CALCIUM_string","I"),("bf","CALCIUM_complex","I"),
59                                   ("bg","CALCIUM_logical","I"),
60                          ],
61                        defs="",body="",
62                  ),
63          ],libs="-L%s -lfcompo" % libfcompodir,
64            rlibs="-Wl,--rpath -Wl,%s" % libfcompodir)
65
66 g=Generator(Module("astmod",components=[c1,c2],prefix=install_prefix),context)
67 g.generate()
68 g.bootstrap()
69 g.configure()
70 g.make()
71 g.install()
72 g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR})