From: vsr Date: Fri, 14 May 2010 15:56:44 +0000 (+0000) Subject: Merge from V5_1_main 14/05/2010 X-Git-Tag: TRIPOLI_302~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f91a2064b0b9f222d0f18056d4000f4391bf65aa;p=tools%2Fyacsgen.git Merge from V5_1_main 14/05/2010 --- diff --git a/Examples/ast1/Makefile b/Examples/ast1/Makefile new file mode 100644 index 0000000..32f8cbe --- /dev/null +++ b/Examples/ast1/Makefile @@ -0,0 +1,21 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +clean: + rm -rf *.o *.so *.pyc astmod_SRC astmod_SRC.bak appli appli.bak install install.bak traceExec_proc diff --git a/Examples/ast1/components.py b/Examples/ast1/components.py index beb099e..2243a4b 100644 --- a/Examples/ast1/components.py +++ b/Examples/ast1/components.py @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + """ Example with one Code_Aster component and one fortran component """ @@ -50,4 +69,4 @@ g.bootstrap() g.configure() g.make() g.install() -g.make_appli(appli_dir,restrict=["KERNEL","GUI","YACS"]) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) diff --git a/Examples/ast1/fcompo/Makefile b/Examples/ast1/fcompo/Makefile index 525e299..6835e82 100644 --- a/Examples/ast1/fcompo/Makefile +++ b/Examples/ast1/fcompo/Makefile @@ -1,6 +1,23 @@ -include ../../makefile.inc +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# -FC=gfortran +include ../../makefile.inc KERNEL_LIBS= -L$(KERNEL_ROOT_DIR)/lib/salome -lCalciumC -lSalomeDSCSuperv -lSalomeDSCContainer -lSalomeDatastream -lSalomeDSCSupervBasic diff --git a/Examples/ast1/fcompo/compo.f b/Examples/ast1/fcompo/compo.f index 7abff52..6480631 100644 --- a/Examples/ast1/fcompo/compo.f +++ b/Examples/ast1/fcompo/compo.f @@ -1,3 +1,22 @@ +C Copyright (C) 2009-2010 EDF R&D +C +C This library is free software; you can redistribute it and/or +C modify it under the terms of the GNU Lesser General Public +C License as published by the Free Software Foundation; either +C version 2.1 of the License. +C +C This library is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +C Lesser General Public License for more details. +C +C You should have received a copy of the GNU Lesser General Public +C License along with this library; if not, write to the Free Software +C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +C +C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +C + SUBROUTINE S1(compo,A,B,C,D,E,F) include 'calcium.hf' integer compo diff --git a/Examples/ast1/myaster/Makefile b/Examples/ast1/myaster/Makefile index f9c3922..13292fc 100644 --- a/Examples/ast1/myaster/Makefile +++ b/Examples/ast1/myaster/Makefile @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + include ../../makefile.inc ASTER_INSTALL=$(ASTER_ROOT)/$(ASTER_VERSION) @@ -45,4 +64,4 @@ op0181.o:src/op0181.f astermodule.so: $(OBJETS) $(LD) -shared -o $@ $(OBJETS) $(KERNEL_LIBS) $(ASTER_LIBS) clean: - rm -rf *.o *.so bibpyt commande/cata.py* + rm -rf *.o *.so bibpyt commande/cata.py* make-cmd commande diff --git a/Examples/ast1/myaster/make_cata b/Examples/ast1/myaster/make_cata index 0846dbf..8d82dbc 100755 --- a/Examples/ast1/myaster/make_cata +++ b/Examples/ast1/myaster/make_cata @@ -1,4 +1,23 @@ #!/bin/sh +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + cat >make-cmd << END P debug nodebug P mode interactif diff --git a/Examples/ast2/Makefile b/Examples/ast2/Makefile new file mode 100644 index 0000000..52504ce --- /dev/null +++ b/Examples/ast2/Makefile @@ -0,0 +1,21 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +clean: + rm -rf *.o *.so *.pyc astmod_SRC astmod_SRC.bak appli appli.bak install install.bak traceExec_proc caster_inst_1 cfort_inst_1 monfichier diff --git a/Examples/ast2/components.py b/Examples/ast2/components.py index 889d9fe..68fc30f 100644 --- a/Examples/ast2/components.py +++ b/Examples/ast2/components.py @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + """ Example with one Code_Aster component and one fortran component """ @@ -53,4 +72,4 @@ g.bootstrap() g.configure() g.make() g.install() -g.make_appli(appli_dir,restrict=["KERNEL","GUI","YACS"]) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) diff --git a/Examples/ast2/exeaster b/Examples/ast2/exeaster index 1d35279..ed02ec7 100755 --- a/Examples/ast2/exeaster +++ b/Examples/ast2/exeaster @@ -1,10 +1,29 @@ +#!/bin/sh +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# cat > temp.comm << END END cat > temp.export << END P actions make_etude -P version STA10.0 +P version STA10.1 P nomjob salome P ncpus 1 A memjeveux 4.000000 @@ -28,5 +47,5 @@ F resu $PWD/resu R 8 F erre $PWD/erre R 9 END -/local/cchris/Aster/V10/Install/ASTK/ASTK_SERV/bin/as_run temp.export +/local/cchris/Aster/V10.1/aster/ASTK/ASTK_SERV/bin/as_run temp.export diff --git a/Examples/ast2/fcompo/Makefile b/Examples/ast2/fcompo/Makefile index 36e79c1..a28228b 100644 --- a/Examples/ast2/fcompo/Makefile +++ b/Examples/ast2/fcompo/Makefile @@ -1,8 +1,24 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# include ../../makefile.inc -FC=gfortran - all:prog prog:compo.o $(FC) -o prog compo.o -L../install/lib/salome -lcfortExelib diff --git a/Examples/ast2/fcompo/compo.f b/Examples/ast2/fcompo/compo.f index a4423e4..6aa7721 100644 --- a/Examples/ast2/fcompo/compo.f +++ b/Examples/ast2/fcompo/compo.f @@ -1,3 +1,22 @@ +C Copyright (C) 2009-2010 EDF R&D +C +C This library is free software; you can redistribute it and/or +C modify it under the terms of the GNU Lesser General Public +C License as published by the Free Software Foundation; either +C version 2.1 of the License. +C +C This library is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +C Lesser General Public License for more details. +C +C You should have received a copy of the GNU Lesser General Public +C License along with this library; if not, write to the Free Software +C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +C +C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +C + PROGRAM P CALL YACSINIT() END diff --git a/Examples/ast2/myaster/Makefile b/Examples/ast2/myaster/Makefile index dc8cb89..7ff9da7 100644 --- a/Examples/ast2/myaster/Makefile +++ b/Examples/ast2/myaster/Makefile @@ -1,3 +1,21 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# include ../../makefile.inc diff --git a/Examples/ast2/myaster/config.txt b/Examples/ast2/myaster/config.txt index d172477..27aac3a 100644 --- a/Examples/ast2/myaster/config.txt +++ b/Examples/ast2/myaster/config.txt @@ -1,3 +1,21 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# # Configuration file # $Id$ # $Name$ @@ -37,17 +55,17 @@ # ID_PERF | id | - | claui2c6 # -ENV_SH | env | - | /local/cchris/Aster/V10/Install/STA10.0/profile.sh +ENV_SH | env | - | /local/cchris/Aster/V10.1/aster/STA10.1/profile.sh # LIB | ar | ? | /usr/bin/ar -rv # -BIBL | python | 2.4 | -lpython2.5 -BIBL | med | 2.3.5 | -Wl,-R -Wl,/local/cchris/pkg/med235/install/lib -L/local/cchris/pkg/med235/install/lib -lmed -BIBL | hdf5 | 1.6.5 | -lhdf5 +BIBL | python | 2.4 | -L/usr/lib -L/usr/lib/python2.5/config -lpython2.5 +BIBL | med | 2.3.5 | -L/local/cchris/Aster/V10.1/aster/public/med-2.3.6/lib -lmed +BIBL | hdf5 | 1.6.5 | -L/usr/lib -lhdf5 BIBL | zmat | 8.4 | -BIBL | mumps | ? | /local/cchris/Aster/V10/Install/public/mumps-4.7.3/lib/libdmumps.a /local/cchris/Aster/V10/Install/public/mumps-4.7.3/lib/libzmumps.a /local/cchris/Aster/V10/Install/public/mumps-4.7.3/lib/libpord.a /local/cchris/Aster/V10/Install/public/mumps-4.7.3/libseq/libmpiseq.a +BIBL | mumps | ? | /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libdmumps.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libzmumps.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libsmumps.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libcmumps.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libmumps_common.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libpord.a /local/cchris/Aster/V10.1/aster/public/mumps-4.8.4/lib/libmpiseq.a -L/local/cchris/Aster/V10.1/aster/public/metis-4.0/lib -lmetis BIBL | scotch | 4.0 | -BIBL | math | ? | /usr/lib/liblapack.a /usr/lib/libblas.a /usr/lib/gcc/x86_64-linux-gnu/4.3/libgfortran.a /usr/lib/gcc/x86_64-linux-gnu/4.3/libgfortran.a +BIBL | math | ? | -L/usr/lib -llapack -L/usr/lib -lblas -L/usr/lib/gcc/x86_64-linux-gnu/4.3 -lgfortran BIBL | mpi | 2 | BIBL | c++ | ? | -L/usr/lib/gcc/x86_64-linux-gnu/4.3 -lstdc++ -lsupc++ BIBL | sys | ? | -Wl,--allow-multiple-definition -Wl,--export-dynamic -lieee -ldl -lpthread -lutil -lm -lz @@ -63,24 +81,23 @@ LINK | link | ? | /usr/bin/gfortran OPTL | link | ? | -fopenmp # CC | cc | ? | /usr/bin/gcc -OPTC_D | cc | ? | -c -g -fno-stack-protector -OPTC_O | cc | ? | -c -O2 -fno-stack-protector -INCL | include | ? | -I/local/cchris/Aster/V10/Install/STA10.0/bibc/include -I/usr/include/python2.5 -I/local/cchris/Aster/V10/Install/public/hdf5-1.6.5/include +OPTC_D | cc | ? | -c -g -fno-stack-protector -fPIC +OPTC_O | cc | ? | -c -O2 -fno-stack-protector -fPIC +INCL | include | ? | -I/local/cchris/Aster/V10.1/aster/STA10.1/bibc/include -I/usr/include/python2.5 # F77 | f77 | ? | /usr/bin/gfortran -OPTF_D | f77 | ? | -c -g -fopenmp -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 -OPTF_O | f77 | ? | -c -O2 -fopenmp -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 +OPTF_D | f77 | ? | -c -g -fopenmp -fPIC -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 +OPTF_O | f77 | ? | -c -O2 -fopenmp -fPIC -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 INCLF | include | ? | -I/local/cchris/Salome/Install/KERNEL_V5/include/salome # F90 | f90 | ? | /usr/bin/gfortran -OPTF90_D | f90 | ? | -c -g -ffixed-line-length-0 -x f77-cpp-input -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 -OPTF90_O | f90 | ? | -c -O2 -ffixed-line-length-0 -x f77-cpp-input -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 -INCLF90 | include | ? | -I/local/cchris/Aster/V10/Install/STA10.0/bibf90/include_mumps-4.7.3 +OPTF90_D | f90 | ? | -c -g -ffixed-line-length-0 -x f77-cpp-input -fPIC -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 +OPTF90_O | f90 | ? | -c -O2 -ffixed-line-length-0 -x f77-cpp-input -fPIC -fdefault-double-8 -fdefault-integer-8 -fdefault-real-8 +INCLF90 | include | ? | -I/local/cchris/Aster/V10.1/aster/STA10.1/bibf90/include_mumps-4.8.4 # G77_AGLA | g77 | ? | unused # SRCFOR | src | 11-04 | bibfor -#Comment following line if you have no f90 compiler SRCF90 | src | 11-04 | bibf90 SRCFERM | src | 11-04 | fermetur SRCC | src | 11-04 | bibc @@ -113,9 +130,9 @@ ARGEXE | exec | 03-02 | -eficas_path ./Python MAKE_SURCH_OFFI | build | 11-04 | Lecture_Cata_Ele/make_surch_offi.py MAKE_CAPY_OFFI | build | 11-04 | Lecture_Cata_Ele/make_capy_offi.py # -REPOUT | exec | 11-04 | /local/cchris/Aster/V10/Install/outils -REPMAT | exec | 02-05 | /local/cchris/Aster/V10/Install/STA10.0/materiau -REPDEX | exec | 02-05 | /local/cchris/Aster/V10/Install/STA10.0/datg +REPOUT | exec | 11-04 | /local/cchris/Aster/V10.1/aster/outils +REPMAT | exec | 02-05 | /local/cchris/Aster/V10.1/aster/STA10.1/materiau +REPDEX | exec | 02-05 | /local/cchris/Aster/V10.1/aster/STA10.1/datg # SUPERV | exec | 03-02 | Accas SUPERV | exec | 03-02 | Build diff --git a/Examples/ast2/myaster/make_exec b/Examples/ast2/myaster/make_exec index 6dcc041..45117e9 100755 --- a/Examples/ast2/myaster/make_exec +++ b/Examples/ast2/myaster/make_exec @@ -1,4 +1,22 @@ #!/bin/sh +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# cat >make-exe << END P actions make_exec diff --git a/Examples/calcium1/Makefile b/Examples/calcium1/Makefile new file mode 100644 index 0000000..c490fb9 --- /dev/null +++ b/Examples/calcium1/Makefile @@ -0,0 +1,30 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +include ../makefile.inc + +all:libcode1.so + +libcode1.so:code1.o + $(FC) -shared -fPIC -o libcode1.so code1.o +code1.o:code1.f + $(FC) -c code1.f -fPIC -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions + +clean: + rm -rf *.o *.so install install.bak traceExec_proc appli appli.bak pycompos_SRC pycompos_SRC.bak diff --git a/Examples/calcium1/code1.f b/Examples/calcium1/code1.f new file mode 100644 index 0000000..d6b7546 --- /dev/null +++ b/Examples/calcium1/code1.f @@ -0,0 +1,268 @@ +C Copyright (C) 2009-2010 EDF R&D +C +C This library is free software; you can redistribute it and/or +C modify it under the terms of the GNU Lesser General Public +C License as published by the Free Software Foundation; either +C version 2.1 of the License. +C +C This library is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +C Lesser General Public License for more details. +C +C You should have received a copy of the GNU Lesser General Public +C License along with this library; if not, write to the Free Software +C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +C +C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +C + + SUBROUTINE SERV1(compo,a,b,c) + include 'calcium.hf' + integer compo(2) + integer i, nval, info, z(10), l + integer*8 lz(10) + integer*4 z4(10),lo(10) + + real*8 dd(10),a,b,c,ti,tf,t + real*4 u(20) + real*4 tti,ttf,tt + character*10 s(3) + character*20 rs(3) + character*64 instance + + write(6,*)a,b + call cpcd(compo,instance,info) + write(6,*)"instance name=",instance + +C write + tt=0. + t=0. + dd(1)=125.45 + dd(2)=8.8 + i=1 + l=10 + CALL cpedb(compo,CP_ITERATION,t,i,'ba',l,dd,info) + CALL cpedb(compo,CP_ITERATION,t,2,'ba',l,dd,info) + CALL cpedb(compo,CP_ITERATION,t,3,'ba',l,dd,info) + write(6,*)'info=',info + call flush(6) + + s(1)="titi" + s(2)="tututu" + s(3)="tatatata" + write(6,*)'s=',s + l=3 + CALL cpech(compo,CP_ITERATION,tt,i,'bb',l,s,info) + write(6,*)'info=',info + call flush(6) + + z(1)=1 + z(2)=8 + z(3)=0 + write(6,*)'z=',z(1) + write(6,*)'z=',z(2) + write(6,*)'z=',z(3) + l=10 + CALL cpeen(compo,CP_ITERATION,tt,i,'bc',l,z,info) + write(6,*)'info=',info + call flush(6) + + u(1)=1 + u(2)=8 + u(3)=4 + u(4)=4 + u(5)=5 + u(6)=5 + write(6,*)'u=',u(1) + write(6,*)'u=',u(2) + write(6,*)'u=',u(3) + write(6,*)'u=',u(4) + write(6,*)'u=',u(5) + write(6,*)'u=',u(6) + CALL cpecp(compo,CP_ITERATION,tt,i,'bd',l,u,info) + write(6,*)'info=',info + call flush(6) + + u(1)=1.1 + u(2)=8.8 + u(3)=4.4 + write(6,*)'u=',u(1) + write(6,*)'u=',u(2) + write(6,*)'u=',u(3) + CALL cpere(compo,CP_ITERATION,tt,i,'be',l,u,info) + write(6,*)'info=',info + call flush(6) + + lo(1)=1 + lo(2)=0 + lo(3)=1 + write(6,*)'lo=',lo(1) + write(6,*)'lo=',lo(2) + write(6,*)'lo=',lo(3) + CALL cpelo(compo,CP_ITERATION,tt,i,'bf',l,lo,info) + write(6,*)'info=',info + call flush(6) + + lz(1)=11 + lz(2)=22 + lz(3)=33 + write(6,*)'lz=',lz(1) + write(6,*)'lz=',lz(2) + write(6,*)'lz=',lz(3) + CALL cpeln(compo,CP_ITERATION,tt,i,'bg',l,lz,info) + write(6,*)'info=',info + call flush(6) + + z4(1)=1 + z4(2)=8 + z4(3)=0 + write(6,*)'z4=',z4(1) + write(6,*)'z4=',z4(2) + write(6,*)'z4=',z4(3) + CALL cpein(compo,CP_ITERATION,tt,i,'bh',l,z4,info) + write(6,*)'info=',info + call flush(6) + + lz(1)=11 + lz(2)=22 + lz(3)=2**30 + lz(3)=2**20*lz(3) + write(6,*)'lz=',lz(1) + write(6,*)'lz=',lz(2) + write(6,*)'lz=',lz(3) + CALL cpelg(compo,CP_ITERATION,tt,i,'bi',l,lz,info) + write(6,*)'info=',info + call flush(6) + +C read + ti=0. + tf=1. + i=1 + dd(1)=0. + dd(2)=0. + dd(3)=0. + l=3 + CALL cpldb(compo,CP_ITERATION,ti,tf,i,'aa',l,nval,dd,info) + write(6,*)'info=',info + write(6,*)'dd=',dd(1) + write(6,*)'dd=',dd(2) + write(6,*)'dd=',dd(3) + write(6,*)'nval=',nval + call flush(6) + + tti=0. + ttf=1. + i=1 + CALL cplch(compo,CP_ITERATION,tti,ttf,i,'ab',l,nval,rs,info) + write(6,*)'info=',info + write(6,*)'rs=',rs + write(6,*)'nval=',nval + call flush(6) + + z(1)=0 + z(2)=0 + z(3)=0 + CALL cplen(compo,CP_ITERATION,tti,ttf,i,'ac',l,nval,z,info) + write(6,*)'info=',info + write(6,*)'nval=',nval + write(6,*)'z=',z(1) + write(6,*)'z=',z(2) + write(6,*)'z=',z(3) + call flush(6) + + u(1)=0 + u(2)=0 + u(3)=0 + u(4)=0 + u(5)=0 + u(6)=0 + CALL cplcp(compo,CP_ITERATION,tti,ttf,i,'ad',l,nval,u,info) + write(6,*)'info=',info + write(6,*)'nval=',nval + write(6,*)'u=',u(1) + write(6,*)'u=',u(2) + write(6,*)'u=',u(3) + write(6,*)'u=',u(4) + write(6,*)'u=',u(5) + write(6,*)'u=',u(6) + call flush(6) + + u(1)=0 + u(2)=0 + u(3)=0 + CALL cplre(compo,CP_ITERATION,tti,ttf,i,'ae',l,nval,u,info) + write(6,*)'info=',info + write(6,*)'nval=',nval + write(6,*)'u=',u(1) + write(6,*)'u=',u(2) + write(6,*)'u=',u(3) + call flush(6) + + lo(1)=0 + lo(2)=0 + lo(3)=0 + CALL cpllo(compo,CP_ITERATION,tti,ttf,i,'af',l,nval,lo,info) + write(6,*)'info=',info + write(6,*)'nval=',nval + write(6,*)'lo=',lo(1) + write(6,*)'lo=',lo(2) + write(6,*)'lo=',lo(3) + call flush(6) + + lz(1)=0 + lz(2)=0 + lz(3)=0 + CALL cplln(compo,CP_ITERATION,tti,ttf,i,'ag',l,nval,lz,info) + write(6,*)'info=',info + write(6,*)'nval=',nval + write(6,*)'lz=',lz(1) + write(6,*)'lz=',lz(2) + write(6,*)'lz=',lz(3) + call flush(6) + + z4(1)=0 + z4(2)=0 + z4(3)=0 + CALL cplin(compo,CP_ITERATION,tti,ttf,i,'ah',l,nval,z4,info) + write(6,*)'info=',info + write(6,*)'nval=',nval + write(6,*)'z4=',z4(1) + write(6,*)'z4=',z4(2) + write(6,*)'z4=',z4(3) + call flush(6) + + lz(1)=0 + lz(2)=0 + lz(3)=0 + CALL cpllg(compo,CP_ITERATION,tti,ttf,i,'ai',l,nval,lz,info) + write(6,*)'info=',info + write(6,*)'nval=',nval + write(6,*)'lz=',lz(1) + write(6,*)'lz=',lz(2) + write(6,*)'lz=',lz(3) + call flush(6) + + call cpfini(compo,'aa',1,info) + write(6,*)'info=',info + call flush(6) + + i=1 + l=3 + CALL cpldb(compo,CP_ITERATION,ti,tf,i,'aa',l,nval,dd,info) + write(6,*)'info=',info + call flush(6) + + call cpeffi(compo,'aa',3,info) + write(6,*)'info=',info + call flush(6) + + i=3 + l=3 + CALL cpldb(compo,CP_ITERATION,ti,tf,i,'aa',l,nval,dd,info) + write(6,*)'info=',info + call flush(6) + + c=a+b + return + end diff --git a/Examples/calcium1/components.py b/Examples/calcium1/components.py new file mode 100644 index 0000000..85e08c0 --- /dev/null +++ b/Examples/calcium1/components.py @@ -0,0 +1,459 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +import os +from module_generator import Generator,Module,Service,PYComponent,CPPComponent,F77Component + +#import context from .. +execfile("../context.py") + +# C++ component + +body=""" +std::cerr << "a: " << a << std::endl; +std::cerr << "b: " << b << std::endl; +int info; +double t1,t2; +float tt1,tt2; +int i=1; +int mval; +double val[10],rval[10]; +int ival[10],rival[10]; +long lval[10],rlval[10]; +float cval[20],rcval[20]; +char* sval[]={"coucou","bonjour","salut"}; +char* rsval[3]; +char mystring1[10]; +char mystring2[10]; +char mystring3[10]; +rsval[0]=mystring1; +rsval[1]=mystring2; +rsval[2]=mystring3; + +val[0]=3.2; +val[1]=5.2; +val[2]=9.8; +std::cerr << "val: " << val[0] << std::endl; +std::cerr << "val: " << val[1] << std::endl; +std::cerr << "val: " << val[2] << std::endl; +cp_edb(component,CP_ITERATION,0.,1,(char*)"ba",10,val); +cp_edb(component,CP_ITERATION,0.,2,(char*)"ba",10,val); +cp_edb(component,CP_ITERATION,0.,3,(char*)"ba",10,val); + +std::cerr << "sval: " << sval[0] << std::endl; +std::cerr << "sval: " << sval[1] << std::endl; +std::cerr << "sval: " << sval[2] << std::endl; +cp_ech(component,CP_ITERATION,0.,1,(char*)"bb",3,sval,6); + +ival[0]=1; +ival[1]=2; +ival[2]=3; +std::cerr << "ival: " << ival[0] << std::endl; +std::cerr << "ival: " << ival[1] << std::endl; +std::cerr << "ival: " << ival[2] << std::endl; +cp_een(component,CP_ITERATION,0.,1,(char*)"bc",10,ival); + +cval[0]=1; +cval[1]=2; +cval[2]=3; +cval[3]=4.5; +cval[4]=5.6; +cval[5]=7.8; +std::cerr << "cval: " << cval[0] << std::endl; +std::cerr << "cval: " << cval[1] << std::endl; +std::cerr << "cval: " << cval[2] << std::endl; +std::cerr << "cval: " << cval[3] << std::endl; +std::cerr << "cval: " << cval[4] << std::endl; +std::cerr << "cval: " << cval[5] << std::endl; +cp_ecp(component,CP_ITERATION,0.,1,(char*)"bd",10,cval); + +cval[0]=1.1; +cval[1]=2.2; +cval[2]=3.3; +std::cerr << "cval: " << cval[0] << std::endl; +std::cerr << "cval: " << cval[1] << std::endl; +std::cerr << "cval: " << cval[2] << std::endl; +cp_ere(component,CP_ITERATION,0.,1,(char*)"be",10,cval); + +ival[0]=1; +ival[1]=0; +ival[2]=1; +std::cerr << "ival: " << ival[0] << std::endl; +std::cerr << "ival: " << ival[1] << std::endl; +std::cerr << "ival: " << ival[2] << std::endl; +cp_elo(component,CP_ITERATION,0.,1,(char*)"bf",10,ival); + +lval[0]=1; +lval[1]=2; +lval[2]=3; +std::cerr << "lval: " << lval[0] << std::endl; +std::cerr << "lval: " << lval[1] << std::endl; +std::cerr << "lval: " << lval[2] << std::endl; +cp_eln(component,CP_ITERATION,0.,1,(char*)"bg",10,lval); + +ival[0]=1; +ival[1]=2; +ival[2]=3; +std::cerr << "ival: " << ival[0] << std::endl; +std::cerr << "ival: " << ival[1] << std::endl; +std::cerr << "ival: " << ival[2] << std::endl; +cp_een(component,CP_ITERATION,0.,1,(char*)"bh",10,ival); + +lval[0]=1; +lval[1]=2; +lval[2]=3; +std::cerr << "lval: " << lval[0] << std::endl; +std::cerr << "lval: " << lval[1] << std::endl; +std::cerr << "lval: " << lval[2] << std::endl; +cp_elg(component,CP_ITERATION,0.,1,(char*)"bi",10,lval); + +/* read */ +info=cp_ldb(component,CP_ITERATION,&t1,&t2,&i,(char*)"aa",3,&mval,rval); +std::cerr << "info: " << info << std::endl; +std::cerr << "rval: " << rval[0] << std::endl; +std::cerr << "rval: " << rval[1] << std::endl; +std::cerr << "rval: " << rval[2] << std::endl; + +info=cp_lch(component,CP_ITERATION,&tt1,&tt2,&i,(char*)"ab",3,&mval,rsval,7); +std::cerr << "info: " << info << std::endl; +std::cerr << "rsval: " << rsval[0] << std::endl; +std::cerr << "rsval: " << rsval[1] << std::endl; +std::cerr << "rsval: " << rsval[2] << std::endl; + +info=cp_len(component,CP_ITERATION,&tt1,&tt2,&i,(char*)"ac",3,&mval,rival); +std::cerr << "info: " << info << std::endl; +std::cerr << "rival: " << rival[0] << std::endl; +std::cerr << "rival: " << rival[1] << std::endl; +std::cerr << "rival: " << rival[2] << std::endl; + +info=cp_lcp(component,CP_ITERATION,&tt1,&tt2,&i,(char*)"ad",3,&mval,rcval); +std::cerr << "info: " << info << std::endl; +std::cerr << "rcval: " << rcval[0] << std::endl; +std::cerr << "rcval: " << rcval[1] << std::endl; +std::cerr << "rcval: " << rcval[2] << std::endl; +std::cerr << "rcval: " << rcval[3] << std::endl; +std::cerr << "rcval: " << rcval[4] << std::endl; +std::cerr << "rcval: " << rcval[5] << std::endl; + +rcval[0]=0.; +rcval[1]=0.; +rcval[2]=0.; +info=cp_lre(component,CP_ITERATION,&tt1,&tt2,&i,(char*)"ae",3,&mval,rcval); +std::cerr << "info: " << info << std::endl; +std::cerr << "rcval: " << rcval[0] << std::endl; +std::cerr << "rcval: " << rcval[1] << std::endl; +std::cerr << "rcval: " << rcval[2] << std::endl; + +rival[0]=0; +rival[1]=0; +rival[2]=0; +i=1; +info=cp_llo(component,CP_ITERATION,&tt1,&tt2,&i,(char*)"af",3,&mval,rival); +std::cerr << "info: " << info << std::endl; +std::cerr << "rival: " << rival[0] << std::endl; +std::cerr << "rival: " << rival[1] << std::endl; +std::cerr << "rival: " << rival[2] << std::endl; + +info=cp_lln(component,CP_ITERATION,&tt1,&tt2,&i,(char*)"ag",3,&mval,rlval); +std::cerr << "info: " << info << std::endl; +std::cerr << "rlval: " << rlval[0] << std::endl; +std::cerr << "rlval: " << rlval[1] << std::endl; +std::cerr << "rlval: " << rlval[2] << std::endl; + +rival[0]=0; +rival[1]=0; +rival[2]=0; +i=1; +info=cp_len(component,CP_ITERATION,&tt1,&tt2,&i,(char*)"ah",3,&mval,rival); +std::cerr << "info: " << info << std::endl; +std::cerr << "rival: " << rival[0] << std::endl; +std::cerr << "rival: " << rival[1] << std::endl; +std::cerr << "rival: " << rival[2] << std::endl; + +info=cp_llg(component,CP_ITERATION,&tt1,&tt2,&i,(char*)"ai",3,&mval,rlval); +std::cerr << "info: " << info << std::endl; +std::cerr << "rlval: " << rlval[0] << std::endl; +std::cerr << "rlval: " << rlval[1] << std::endl; +std::cerr << "rlval: " << rlval[2] << std::endl; + +info=cp_fini(component,(char*)"aa",1); +std::cerr << "info: " << info << std::endl; + +info=cp_effi(component,(char*)"aa",3); +std::cerr << "info: " << info << std::endl; + +c=2*rval[0]; +std::cerr << "c: " << c << std::endl; +""" +c1=CPPComponent("compo1",services=[ + Service("s1",inport=[("a","double"),("b","double")], + outport=[("c","double")], + instream=[("aa","CALCIUM_double","I"), + ("ab","CALCIUM_string","I"), + ("ac","CALCIUM_integer","I"), + ("ad","CALCIUM_complex","I"), + ("ae","CALCIUM_real","I"), + ("af","CALCIUM_logical","I"), + ("ag","CALCIUM_long","I"), + ("ah","CALCIUM_integer","I"), + ("ai","CALCIUM_integer","I"), + ], + outstream=[("ba","CALCIUM_double","I"), + ("bb","CALCIUM_string","I"), + ("bc","CALCIUM_integer","I"), + ("bd","CALCIUM_complex","I"), + ("be","CALCIUM_real","I"), + ("bf","CALCIUM_logical","I"), + ("bg","CALCIUM_long","I"), + ("bh","CALCIUM_integer","I"), + ("bi","CALCIUM_integer","I"), + ], + defs="//def1",body=body, + ), + ], + ) + +# python component + +defs=""" +""" + +body=""" +#b1 +info,name= calcium.cp_cd(component) +print "name=",name +print "info=",info +dep=calcium.CP_ITERATION + +#double +val=numpy.zeros(10,'d') +val[0]=7.7 +val[5]=a*b +nval=10 +print "--------> Appel calcium.cp_edb",val +info=calcium.cp_edb(component, dep, 0., 1, "ba", nval,val) +info=calcium.cp_edb(component, dep, 0., 2, "ba", nval,val) +info=calcium.cp_edb(component, dep, 0., 3, "ba", nval,val) + +#string +val=numpy.array(["coucouc ","bonjour ","salut "]) +val=calcium.stringArray(3,8) +val[0]="coucouc" +val[1]="bonjour" +val[2]="salut" +print "--------> Appel calcium.cp_ech",val +info=calcium.cp_ech(component, dep, 0., 1, "bb", 3,val) + +#int +val=numpy.zeros(10,'i') +val[0]=1 +val[1]=3 +print "--------> Appel calcium.cp_een",val +info=calcium.cp_een(component, dep, 0., 1, "bc", 3,val) + +val=numpy.zeros(10,'F') +val[0]=1+2j +val[1]=3+2j +print "--------> Appel calcium.cp_ecp",val +info=calcium.cp_ecp(component, dep, 0., 1, "bd", 3,val) + +val=numpy.zeros(10,'f') +val[0]=1.3 +val[1]=3.2 +print "--------> Appel calcium.cp_ere",val +info=calcium.cp_ere(component, dep, 0., 1, "be", 3,val) + +val=numpy.zeros(10,'i') +val[0]=True +val[1]=False +val[2]=False +print "--------> Appel calcium.cp_elo",val +info=calcium.cp_elo(component, dep, 0., 1, "bf", 3,val) + +val=numpy.zeros(10,'l') +val[0]=1 +val[1]=3 +val[2]=333 +print "--------> Appel calcium.cp_eln",val +info=calcium.cp_eln(component, dep, 0., 1, "bg", 3,val) + +val=numpy.zeros(10,'i') +val[0]=1 +val[1]=3 +val[2]=4 +print "--------> Appel calcium.cp_een",val +info=calcium.cp_een(component, dep, 0., 1, "bh", 3,val) + +val=numpy.zeros(10,'l') +val[0]=1 +val[1]=3 +val[2]=333 +print "--------> Appel calcium.cp_elg",val +info=calcium.cp_elg(component, dep, 0., 1, "bi", 3,val) +print "info=",info + +#read +val=numpy.zeros(10,'d') +print "--------> Appel calcium.cp_ldb" +info,tt,ii,mval=calcium.cp_ldb(component, dep, 0.,1., 1, "aa", 3,val) +print mval,val + +val=numpy.array(["","","",], dtype='S13') +print "--------> Appel calcium.cp_lch" +info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val) +print mval,val +print val.dtype + +val=numpy.array([" "," "," ",], dtype='S13') +print "--------> Appel calcium.cp_lch" +info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val) +print mval,val +print val.dtype + +val=calcium.stringArray(3,8) +print "--------> Appel calcium.cp_lch" +info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val) +print mval,val +print val[0] +print val[1] +print val[2] + +val=numpy.zeros(10,'i') +print "--------> Appel calcium.cp_len" +info,tt,ii,mval=calcium.cp_len(component, dep, 0.,1., 1, "ac", 3,val) +print mval,val + +val=numpy.zeros(10,'F') +print "--------> Appel calcium.cp_lcp" +info,tt,ii,mval=calcium.cp_lcp(component, dep, 0.,1., 1, "ad", 3,val) +print mval,val + +val=numpy.zeros(10,'f') +print "--------> Appel calcium.cp_lre" +info,tt,ii,mval=calcium.cp_lre(component, dep, 0.,1., 1, "ae", 3,val) +print mval,val + +val=numpy.zeros(10,'i') +print "--------> Appel calcium.cp_llo" +info,tt,ii,mval=calcium.cp_llo(component, dep, 0.,1., 1, "af", 3,val) +print mval,val + +val=numpy.zeros(10,'l') +print "--------> Appel calcium.cp_lln" +info,tt,ii,mval=calcium.cp_lln(component, dep, 0.,1., 1, "ag", 3,val) +print mval,val + +val=numpy.zeros(10,'i') +print "--------> Appel calcium.cp_len" +info,tt,ii,mval=calcium.cp_len(component, dep, 0.,1., 1, "ah", 3,val) +print mval,val + +val=numpy.zeros(10,'l') +print "--------> Appel calcium.cp_llg" +info,tt,ii,mval=calcium.cp_llg(component, dep, 0.,1., 1, "ai", 3,val) +print "info=",info +print mval,val + +info=calcium.cp_fini(component,"aa",1) +print "info=",info + +info=calcium.cp_effi(component,"aa",3) +print "info=",info + +import time +time.sleep(15) + +c=a+b +d=a-b +err=calcium.cp_fin(component,calcium.CP_ARRET) +print "err=",err +""" +c2=PYComponent("compo2",services=[ + Service("s1",inport=[("a","double"),("b","double")], + outport=[("c","double"),("d","double")], + instream=[("aa","CALCIUM_double","I"), + ("ab","CALCIUM_string","I"), + ("ac","CALCIUM_integer","I"), + ("ad","CALCIUM_complex","I"), + ("ae","CALCIUM_real","I"), + ("af","CALCIUM_logical","I"), + ("ag","CALCIUM_long","I"), + ("ah","CALCIUM_integer","I"), + ("ai","CALCIUM_integer","I"), + ], + outstream=[("ba","CALCIUM_double","I"), + ("bb","CALCIUM_string","I"), + ("bc","CALCIUM_integer","I"), + ("bd","CALCIUM_complex","I"), + ("be","CALCIUM_real","I"), + ("bf","CALCIUM_logical","I"), + ("bg","CALCIUM_long","I"), + ("bh","CALCIUM_integer","I"), + ("bi","CALCIUM_integer","I"), + ], + defs=defs,body=body, + ), + ], + ) + +#fortran component + +cwd=os.getcwd() + +c3=F77Component("fcode1", + services=[ + Service("serv1", + inport=[("a","double"),("b","double")], + outport=[("c","double")], + instream=[("aa","CALCIUM_double","I"), + ("ab","CALCIUM_string","I"), + ("ac","CALCIUM_integer","I"), + ("ad","CALCIUM_complex","I"), + ("ae","CALCIUM_real","I"), + ("af","CALCIUM_logical","I"), + ("ag","CALCIUM_long","I"), + ("ah","CALCIUM_integer","I"), + ("ai","CALCIUM_integer","I"), + ], + outstream=[("ba","CALCIUM_double","I"), + ("bb","CALCIUM_string","I"), + ("bc","CALCIUM_integer","I"), + ("bd","CALCIUM_complex","I"), + ("be","CALCIUM_real","I"), + ("bf","CALCIUM_logical","I"), + ("bg","CALCIUM_long","I"), + ("bh","CALCIUM_integer","I"), + ("bi","CALCIUM_integer","I"), + ], + ), + ], + libs="-L%s -lcode1" % cwd, + rlibs="-Wl,--rpath -Wl,%s" % cwd, + ) + +g=Generator(Module("pycompos",components=[c1,c2,c3],prefix="./install",layout="multidir"),context) +g.generate() +g.bootstrap() +g.configure() +g.make() +g.install() +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) + + + diff --git a/Examples/calcium1/coupling.xml b/Examples/calcium1/coupling.xml new file mode 100644 index 0000000..8d6075a --- /dev/null +++ b/Examples/calcium1/coupling.xml @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + compo1 + s1 + + + + + + + + + + + + + + + + + + + + + + + + + + compo2 + s1 + + + + + + + + + + + + + + + + + + + + + + + + + + + fcode1 + serv1 + + + + + + + + + + + + + + + + + + + + + + + + + + + node1ba + node2aa + + + node2ba + node3aa + + + node3ba + node1aa + + + + node1bb + node2ab + + + node2bb + node3ab + + + node3bb + node1ab + + + + node1bc + node2ac + + + node2bc + node3ac + + + node3bc + node1ac + + + + node1bd + node2ad + + + node2bd + node3ad + + + node3bd + node1ad + + + + node1be + node2ae + + + node2be + node3ae + + + node3be + node1ae + + + + node1bf + node2af + + + node2bf + node3af + + + node3bf + node1af + + + + node1bg + node2ag + + + node2bg + node3ag + + + node3bg + node1ag + + + + node1bh + node2ah + + + node2bh + node3ah + + + node3bh + node1ah + + + + node1bi + node2ai + + + node2bi + node3ai + + + node3bi + node1ai + + + + node1 a + 23 + + + node1 b + 53 + + + node2 a + 63 + + + node2 b + 73 + + + node3 a + 63 + + + node3 b + 73 + + + + diff --git a/Examples/calcium2/Makefile b/Examples/calcium2/Makefile new file mode 100644 index 0000000..c490fb9 --- /dev/null +++ b/Examples/calcium2/Makefile @@ -0,0 +1,30 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +include ../makefile.inc + +all:libcode1.so + +libcode1.so:code1.o + $(FC) -shared -fPIC -o libcode1.so code1.o +code1.o:code1.f + $(FC) -c code1.f -fPIC -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions + +clean: + rm -rf *.o *.so install install.bak traceExec_proc appli appli.bak pycompos_SRC pycompos_SRC.bak diff --git a/Examples/calcium2/code1.f b/Examples/calcium2/code1.f new file mode 100644 index 0000000..c7bc853 --- /dev/null +++ b/Examples/calcium2/code1.f @@ -0,0 +1,272 @@ +C Copyright (C) 2009-2010 EDF R&D +C +C This library is free software; you can redistribute it and/or +C modify it under the terms of the GNU Lesser General Public +C License as published by the Free Software Foundation; either +C version 2.1 of the License. +C +C This library is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +C Lesser General Public License for more details. +C +C You should have received a copy of the GNU Lesser General Public +C License along with this library; if not, write to the Free Software +C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +C +C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +C + + SUBROUTINE SERV1(compo,a,b,c) + include 'calcium.hf' + integer compo(2) + integer i, nval, info, z(10), l + integer*8 lz(10) + integer*4 z4(10),lo(10) + + real*8 dd(10),a,b,c,ti,tf,t + real*4 u(20) + real*4 tti,ttf,tt + character*10 s(3) + character*20 rs(3) + character*64 instance + + write(6,*)a,b + call cpcd(compo,instance,info) + write(6,*)"instance name=",instance + +C write + tt=0. + t=0. + dd(1)=125.45 + dd(2)=8.8 + i=1 + l=10 + CALL cpedb(compo,CP_TEMPS,t,i,'ba',l,dd,info) + t=1. + CALL cpedb(compo,CP_TEMPS,t,i,'ba',l,dd,info) + t=2. + CALL cpedb(compo,CP_TEMPS,t,i,'ba',l,dd,info) + write(6,*)'info=',info + call flush(6) + + s(1)="titi" + s(2)="tututu" + s(3)="tatatata" + write(6,*)'s=',s + l=3 + CALL cpech(compo,CP_TEMPS,tt,i,'bb',l,s,info) + write(6,*)'info=',info + call flush(6) + + z(1)=1 + z(2)=8 + z(3)=0 + write(6,*)'z=',z(1) + write(6,*)'z=',z(2) + write(6,*)'z=',z(3) + l=10 + CALL cpeen(compo,CP_TEMPS,tt,i,'bc',l,z,info) + write(6,*)'info=',info + call flush(6) + + u(1)=1 + u(2)=8 + u(3)=4 + u(4)=4 + u(5)=5 + u(6)=5 + write(6,*)'u=',u(1) + write(6,*)'u=',u(2) + write(6,*)'u=',u(3) + write(6,*)'u=',u(4) + write(6,*)'u=',u(5) + write(6,*)'u=',u(6) + CALL cpecp(compo,CP_TEMPS,tt,i,'bd',l,u,info) + write(6,*)'info=',info + call flush(6) + + u(1)=1.1 + u(2)=8.8 + u(3)=4.4 + write(6,*)'u=',u(1) + write(6,*)'u=',u(2) + write(6,*)'u=',u(3) + CALL cpere(compo,CP_TEMPS,tt,i,'be',l,u,info) + write(6,*)'info=',info + call flush(6) + + lo(1)=1 + lo(2)=0 + lo(3)=1 + write(6,*)'lo=',lo(1) + write(6,*)'lo=',lo(2) + write(6,*)'lo=',lo(3) + CALL cpelo(compo,CP_TEMPS,tt,i,'bf',l,lo,info) + write(6,*)'info=',info + call flush(6) + + lz(1)=11 + lz(2)=22 + lz(3)=33 + write(6,*)'lz=',lz(1) + write(6,*)'lz=',lz(2) + write(6,*)'lz=',lz(3) + CALL cpeln(compo,CP_TEMPS,tt,i,'bg',l,lz,info) + write(6,*)'info=',info + call flush(6) + + z4(1)=1 + z4(2)=8 + z4(3)=0 + write(6,*)'z4=',z4(1) + write(6,*)'z4=',z4(2) + write(6,*)'z4=',z4(3) + CALL cpein(compo,CP_TEMPS,tt,i,'bh',l,z4,info) + write(6,*)'info=',info + call flush(6) + + lz(1)=11 + lz(2)=22 + lz(3)=2**30 + lz(3)=2**20*lz(3) + write(6,*)'lz=',lz(1) + write(6,*)'lz=',lz(2) + write(6,*)'lz=',lz(3) + CALL cpelg(compo,CP_TEMPS,tt,i,'bi',l,lz,info) + write(6,*)'info=',info + call flush(6) + +C read + ti=0. + tf=1. + i=1 + dd(1)=0. + dd(2)=0. + dd(3)=0. + l=3 + CALL cpldb(compo,CP_TEMPS,ti,tf,i,'aa',l,nval,dd,info) + write(6,*)'info=',info + write(6,*)'dd=',dd(1) + write(6,*)'dd=',dd(2) + write(6,*)'dd=',dd(3) + write(6,*)'nval=',nval + call flush(6) + + tti=0. + ttf=1. + i=1 + CALL cplch(compo,CP_TEMPS,tti,ttf,i,'ab',l,nval,rs,info) + write(6,*)'info=',info + write(6,*)'rs=',rs + write(6,*)'nval=',nval + call flush(6) + + z(1)=0 + z(2)=0 + z(3)=0 + CALL cplen(compo,CP_TEMPS,tti,ttf,i,'ac',l,nval,z,info) + write(6,*)'info=',info + write(6,*)'nval=',nval + write(6,*)'z=',z(1) + write(6,*)'z=',z(2) + write(6,*)'z=',z(3) + call flush(6) + + u(1)=0 + u(2)=0 + u(3)=0 + u(4)=0 + u(5)=0 + u(6)=0 + CALL cplcp(compo,CP_TEMPS,tti,ttf,i,'ad',l,nval,u,info) + write(6,*)'info=',info + write(6,*)'nval=',nval + write(6,*)'u=',u(1) + write(6,*)'u=',u(2) + write(6,*)'u=',u(3) + write(6,*)'u=',u(4) + write(6,*)'u=',u(5) + write(6,*)'u=',u(6) + call flush(6) + + u(1)=0 + u(2)=0 + u(3)=0 + CALL cplre(compo,CP_TEMPS,tti,ttf,i,'ae',l,nval,u,info) + write(6,*)'info=',info + write(6,*)'nval=',nval + write(6,*)'u=',u(1) + write(6,*)'u=',u(2) + write(6,*)'u=',u(3) + call flush(6) + + lo(1)=0 + lo(2)=0 + lo(3)=0 + CALL cpllo(compo,CP_TEMPS,tti,ttf,i,'af',l,nval,lo,info) + write(6,*)'info=',info + write(6,*)'nval=',nval + write(6,*)'lo=',lo(1) + write(6,*)'lo=',lo(2) + write(6,*)'lo=',lo(3) + call flush(6) + + lz(1)=0 + lz(2)=0 + lz(3)=0 + CALL cplln(compo,CP_TEMPS,tti,ttf,i,'ag',l,nval,lz,info) + write(6,*)'info=',info + write(6,*)'nval=',nval + write(6,*)'lz=',lz(1) + write(6,*)'lz=',lz(2) + write(6,*)'lz=',lz(3) + call flush(6) + + z4(1)=0 + z4(2)=0 + z4(3)=0 + CALL cplin(compo,CP_TEMPS,tti,ttf,i,'ah',l,nval,z4,info) + write(6,*)'info=',info + write(6,*)'nval=',nval + write(6,*)'z4=',z4(1) + write(6,*)'z4=',z4(2) + write(6,*)'z4=',z4(3) + call flush(6) + + lz(1)=0 + lz(2)=0 + lz(3)=0 + CALL cpllg(compo,CP_TEMPS,tti,ttf,i,'ai',l,nval,lz,info) + write(6,*)'info=',info + write(6,*)'nval=',nval + write(6,*)'lz=',lz(1) + write(6,*)'lz=',lz(2) + write(6,*)'lz=',lz(3) + call flush(6) + + call cpfint(compo,'aa',0.5,info) + write(6,*)'info=',info + call flush(6) + + ti=0. + tf=0. + l=3 + CALL cpldb(compo,CP_TEMPS,ti,tf,i,'aa',l,nval,dd,info) + write(6,*)'info=',info + call flush(6) + + call cpefft(compo,'aa',1.5,info) + write(6,*)'info=',info + call flush(6) + + ti=2. + tf=2. + l=3 + CALL cpldb(compo,CP_TEMPS,ti,tf,i,'aa',l,nval,dd,info) + write(6,*)'info=',info + call flush(6) + + c=a+b + return + end diff --git a/Examples/calcium2/components.py b/Examples/calcium2/components.py new file mode 100644 index 0000000..e571047 --- /dev/null +++ b/Examples/calcium2/components.py @@ -0,0 +1,463 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +import os +from module_generator import Generator,Module,Service,PYComponent,CPPComponent,F77Component + +#import context from .. +execfile("../context.py") + +# C++ component + +body=""" +std::cerr << "a: " << a << std::endl; +std::cerr << "b: " << b << std::endl; +int info; +double t1,t2; +float tt1,tt2; +int i=1; +int mval; +double val[10],rval[10]; +int ival[10],rival[10]; +long lval[10],rlval[10]; +float cval[20],rcval[20]; +char* sval[]={"coucou","bonjour","salut"}; +char* rsval[3]; +char mystring1[10]; +char mystring2[10]; +char mystring3[10]; +rsval[0]=mystring1; +rsval[1]=mystring2; +rsval[2]=mystring3; + +val[0]=3.2; +val[1]=5.2; +val[2]=9.8; +std::cerr << "val: " << val[0] << std::endl; +std::cerr << "val: " << val[1] << std::endl; +std::cerr << "val: " << val[2] << std::endl; +cp_edb(component,CP_TEMPS,0.,1,(char*)"ba",10,val); +cp_edb(component,CP_TEMPS,1.,2,(char*)"ba",10,val); +cp_edb(component,CP_TEMPS,2.,3,(char*)"ba",10,val); + +std::cerr << "sval: " << sval[0] << std::endl; +std::cerr << "sval: " << sval[1] << std::endl; +std::cerr << "sval: " << sval[2] << std::endl; +cp_ech(component,CP_TEMPS,0.,1,(char*)"bb",3,sval,6); + +ival[0]=1; +ival[1]=2; +ival[2]=3; +std::cerr << "ival: " << ival[0] << std::endl; +std::cerr << "ival: " << ival[1] << std::endl; +std::cerr << "ival: " << ival[2] << std::endl; +cp_een(component,CP_TEMPS,0.,1,(char*)"bc",10,ival); + +cval[0]=1; +cval[1]=2; +cval[2]=3; +cval[3]=4.5; +cval[4]=5.6; +cval[5]=7.8; +std::cerr << "cval: " << cval[0] << std::endl; +std::cerr << "cval: " << cval[1] << std::endl; +std::cerr << "cval: " << cval[2] << std::endl; +std::cerr << "cval: " << cval[3] << std::endl; +std::cerr << "cval: " << cval[4] << std::endl; +std::cerr << "cval: " << cval[5] << std::endl; +cp_ecp(component,CP_TEMPS,0.,1,(char*)"bd",10,cval); + +cval[0]=1.1; +cval[1]=2.2; +cval[2]=3.3; +std::cerr << "cval: " << cval[0] << std::endl; +std::cerr << "cval: " << cval[1] << std::endl; +std::cerr << "cval: " << cval[2] << std::endl; +cp_ere(component,CP_TEMPS,0.,1,(char*)"be",10,cval); + +ival[0]=1; +ival[1]=0; +ival[2]=1; +std::cerr << "ival: " << ival[0] << std::endl; +std::cerr << "ival: " << ival[1] << std::endl; +std::cerr << "ival: " << ival[2] << std::endl; +cp_elo(component,CP_TEMPS,0.,1,(char*)"bf",10,ival); + +lval[0]=1; +lval[1]=2; +lval[2]=3; +std::cerr << "lval: " << lval[0] << std::endl; +std::cerr << "lval: " << lval[1] << std::endl; +std::cerr << "lval: " << lval[2] << std::endl; +cp_eln(component,CP_TEMPS,0.,1,(char*)"bg",10,lval); + +ival[0]=1; +ival[1]=2; +ival[2]=3; +std::cerr << "ival: " << ival[0] << std::endl; +std::cerr << "ival: " << ival[1] << std::endl; +std::cerr << "ival: " << ival[2] << std::endl; +cp_een(component,CP_TEMPS,0.,1,(char*)"bh",10,ival); + +lval[0]=1; +lval[1]=2; +lval[2]=3; +std::cerr << "lval: " << lval[0] << std::endl; +std::cerr << "lval: " << lval[1] << std::endl; +std::cerr << "lval: " << lval[2] << std::endl; +cp_elg(component,CP_TEMPS,0.,1,(char*)"bi",10,lval); + +/* read */ +t1=0.; +t2=1.; +info=cp_ldb(component,CP_TEMPS,&t1,&t2,&i,(char*)"aa",3,&mval,rval); +std::cerr << "info: " << info << std::endl; +std::cerr << "rval: " << rval[0] << std::endl; +std::cerr << "rval: " << rval[1] << std::endl; +std::cerr << "rval: " << rval[2] << std::endl; + +tt1=0.; +tt2=1.; +info=cp_lch(component,CP_TEMPS,&tt1,&tt2,&i,(char*)"ab",3,&mval,rsval,7); +std::cerr << "info: " << info << std::endl; +std::cerr << "rsval: " << rsval[0] << std::endl; +std::cerr << "rsval: " << rsval[1] << std::endl; +std::cerr << "rsval: " << rsval[2] << std::endl; + +info=cp_len(component,CP_TEMPS,&tt1,&tt2,&i,(char*)"ac",3,&mval,rival); +std::cerr << "info: " << info << std::endl; +std::cerr << "rival: " << rival[0] << std::endl; +std::cerr << "rival: " << rival[1] << std::endl; +std::cerr << "rival: " << rival[2] << std::endl; + +info=cp_lcp(component,CP_TEMPS,&tt1,&tt2,&i,(char*)"ad",3,&mval,rcval); +std::cerr << "info: " << info << std::endl; +std::cerr << "rcval: " << rcval[0] << std::endl; +std::cerr << "rcval: " << rcval[1] << std::endl; +std::cerr << "rcval: " << rcval[2] << std::endl; +std::cerr << "rcval: " << rcval[3] << std::endl; +std::cerr << "rcval: " << rcval[4] << std::endl; +std::cerr << "rcval: " << rcval[5] << std::endl; + +rcval[0]=0.; +rcval[1]=0.; +rcval[2]=0.; +info=cp_lre(component,CP_TEMPS,&tt1,&tt2,&i,(char*)"ae",3,&mval,rcval); +std::cerr << "info: " << info << std::endl; +std::cerr << "rcval: " << rcval[0] << std::endl; +std::cerr << "rcval: " << rcval[1] << std::endl; +std::cerr << "rcval: " << rcval[2] << std::endl; + +rival[0]=0; +rival[1]=0; +rival[2]=0; +i=1; +info=cp_llo(component,CP_TEMPS,&tt1,&tt2,&i,(char*)"af",3,&mval,rival); +std::cerr << "info: " << info << std::endl; +std::cerr << "rival: " << rival[0] << std::endl; +std::cerr << "rival: " << rival[1] << std::endl; +std::cerr << "rival: " << rival[2] << std::endl; + +info=cp_lln(component,CP_TEMPS,&tt1,&tt2,&i,(char*)"ag",3,&mval,rlval); +std::cerr << "info: " << info << std::endl; +std::cerr << "rlval: " << rlval[0] << std::endl; +std::cerr << "rlval: " << rlval[1] << std::endl; +std::cerr << "rlval: " << rlval[2] << std::endl; + +rival[0]=0; +rival[1]=0; +rival[2]=0; +i=1; +info=cp_len(component,CP_TEMPS,&tt1,&tt2,&i,(char*)"ah",3,&mval,rival); +std::cerr << "info: " << info << std::endl; +std::cerr << "rival: " << rival[0] << std::endl; +std::cerr << "rival: " << rival[1] << std::endl; +std::cerr << "rival: " << rival[2] << std::endl; + +info=cp_llg(component,CP_TEMPS,&tt1,&tt2,&i,(char*)"ai",3,&mval,rlval); +std::cerr << "info: " << info << std::endl; +std::cerr << "rlval: " << rlval[0] << std::endl; +std::cerr << "rlval: " << rlval[1] << std::endl; +std::cerr << "rlval: " << rlval[2] << std::endl; + +info=cp_fint(component,(char*)"aa",0.5); +std::cerr << "info: " << info << std::endl; + +info=cp_efft(component,(char*)"aa",1.5); +std::cerr << "info: " << info << std::endl; + +c=2*rval[0]; +std::cerr << "c: " << c << std::endl; +""" +c1=CPPComponent("compo1",services=[ + Service("s1",inport=[("a","double"),("b","double")], + outport=[("c","double")], + instream=[("aa","CALCIUM_double","T"), + ("ab","CALCIUM_string","T"), + ("ac","CALCIUM_integer","T"), + ("ad","CALCIUM_complex","T"), + ("ae","CALCIUM_real","T"), + ("af","CALCIUM_logical","T"), + ("ag","CALCIUM_long","T"), + ("ah","CALCIUM_integer","T"), + ("ai","CALCIUM_integer","T"), + ], + outstream=[("ba","CALCIUM_double","T"), + ("bb","CALCIUM_string","T"), + ("bc","CALCIUM_integer","T"), + ("bd","CALCIUM_complex","T"), + ("be","CALCIUM_real","T"), + ("bf","CALCIUM_logical","T"), + ("bg","CALCIUM_long","T"), + ("bh","CALCIUM_integer","T"), + ("bi","CALCIUM_integer","T"), + ], + defs="//def1",body=body, + ), + ], + ) + +# python component + +defs=""" +""" + +body=""" +#b1 +info,name= calcium.cp_cd(component) +print "name=",name +print "info=",info +dep=calcium.CP_TEMPS + +#double +val=numpy.zeros(10,'d') +val[0]=7.7 +val[5]=a*b +nval=10 +print "--------> Appel calcium.cp_edb",val +info=calcium.cp_edb(component, dep, 0., 1, "ba", nval,val) +info=calcium.cp_edb(component, dep, 1., 2, "ba", nval,val) +info=calcium.cp_edb(component, dep, 2., 3, "ba", nval,val) + +#string +val=numpy.array(["coucouc ","bonjour ","salut "]) +val=calcium.stringArray(3,8) +val[0]="coucouc" +val[1]="bonjour" +val[2]="salut" +print "--------> Appel calcium.cp_ech",val +info=calcium.cp_ech(component, dep, 0., 1, "bb", 3,val) + +#int +val=numpy.zeros(10,'i') +val[0]=1 +val[1]=3 +print "--------> Appel calcium.cp_een",val +info=calcium.cp_een(component, dep, 0., 1, "bc", 3,val) + +val=numpy.zeros(10,'F') +val[0]=1+2j +val[1]=3+2j +print "--------> Appel calcium.cp_ecp",val +info=calcium.cp_ecp(component, dep, 0., 1, "bd", 3,val) + +val=numpy.zeros(10,'f') +val[0]=1.3 +val[1]=3.2 +print "--------> Appel calcium.cp_ere",val +info=calcium.cp_ere(component, dep, 0., 1, "be", 3,val) + +val=numpy.zeros(10,'i') +val[0]=True +val[1]=False +val[2]=False +print "--------> Appel calcium.cp_elo",val +info=calcium.cp_elo(component, dep, 0., 1, "bf", 3,val) + +val=numpy.zeros(10,'l') +val[0]=1 +val[1]=3 +val[2]=333 +print "--------> Appel calcium.cp_eln",val +info=calcium.cp_eln(component, dep, 0., 1, "bg", 3,val) + +val=numpy.zeros(10,'i') +val[0]=1 +val[1]=3 +val[2]=4 +print "--------> Appel calcium.cp_een",val +info=calcium.cp_een(component, dep, 0., 1, "bh", 3,val) + +val=numpy.zeros(10,'l') +val[0]=1 +val[1]=3 +val[2]=333 +print "--------> Appel calcium.cp_elg",val +info=calcium.cp_elg(component, dep, 0., 1, "bi", 3,val) +print "info=",info + +#read +val=numpy.zeros(10,'d') +print "--------> Appel calcium.cp_ldb" +info,tt,ii,mval=calcium.cp_ldb(component, dep, 0.,1., 1, "aa", 3,val) +print mval,val + +val=numpy.array(["","","",], dtype='S13') +print "--------> Appel calcium.cp_lch" +info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val) +print mval,val +print val.dtype + +val=numpy.array([" "," "," ",], dtype='S13') +print "--------> Appel calcium.cp_lch" +info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val) +print mval,val +print val.dtype + +val=calcium.stringArray(3,8) +print "--------> Appel calcium.cp_lch" +info,tt,ii,mval=calcium.cp_lch(component, dep, 0.,1., 1, "ab", 3,val) +print mval,val +print val[0] +print val[1] +print val[2] + +val=numpy.zeros(10,'i') +print "--------> Appel calcium.cp_len" +info,tt,ii,mval=calcium.cp_len(component, dep, 0.,1., 1, "ac", 3,val) +print mval,val + +val=numpy.zeros(10,'F') +print "--------> Appel calcium.cp_lcp" +info,tt,ii,mval=calcium.cp_lcp(component, dep, 0.,1., 1, "ad", 3,val) +print mval,val + +val=numpy.zeros(10,'f') +print "--------> Appel calcium.cp_lre" +info,tt,ii,mval=calcium.cp_lre(component, dep, 0.,1., 1, "ae", 3,val) +print mval,val + +val=numpy.zeros(10,'i') +print "--------> Appel calcium.cp_llo" +info,tt,ii,mval=calcium.cp_llo(component, dep, 0.,1., 1, "af", 3,val) +print mval,val + +val=numpy.zeros(10,'l') +print "--------> Appel calcium.cp_lln" +info,tt,ii,mval=calcium.cp_lln(component, dep, 0.,1., 1, "ag", 3,val) +print mval,val + +val=numpy.zeros(10,'i') +print "--------> Appel calcium.cp_len" +info,tt,ii,mval=calcium.cp_len(component, dep, 0.,1., 1, "ah", 3,val) +print mval,val + +val=numpy.zeros(10,'l') +print "--------> Appel calcium.cp_llg" +info,tt,ii,mval=calcium.cp_llg(component, dep, 0.,1., 1, "ai", 3,val) +print "info=",info +print mval,val + +info=calcium.cp_fint(component,"aa",0.5) +print "info=",info + +info=calcium.cp_efft(component,"aa",1.5) +print "info=",info + +import time +time.sleep(15) + +c=a+b +d=a-b +err=calcium.cp_fin(component,calcium.CP_ARRET) +print "err=",err +""" +c2=PYComponent("compo2",services=[ + Service("s1",inport=[("a","double"),("b","double")], + outport=[("c","double"),("d","double")], + instream=[("aa","CALCIUM_double","T"), + ("ab","CALCIUM_string","T"), + ("ac","CALCIUM_integer","T"), + ("ad","CALCIUM_complex","T"), + ("ae","CALCIUM_real","T"), + ("af","CALCIUM_logical","T"), + ("ag","CALCIUM_long","T"), + ("ah","CALCIUM_integer","T"), + ("ai","CALCIUM_integer","T"), + ], + outstream=[("ba","CALCIUM_double","T"), + ("bb","CALCIUM_string","T"), + ("bc","CALCIUM_integer","T"), + ("bd","CALCIUM_complex","T"), + ("be","CALCIUM_real","T"), + ("bf","CALCIUM_logical","T"), + ("bg","CALCIUM_long","T"), + ("bh","CALCIUM_integer","T"), + ("bi","CALCIUM_integer","T"), + ], + defs=defs,body=body, + ), + ], + ) + +#fortran component + +cwd=os.getcwd() + +c3=F77Component("fcode1", + services=[ + Service("serv1", + inport=[("a","double"),("b","double")], + outport=[("c","double")], + instream=[("aa","CALCIUM_double","T"), + ("ab","CALCIUM_string","T"), + ("ac","CALCIUM_integer","T"), + ("ad","CALCIUM_complex","T"), + ("ae","CALCIUM_real","T"), + ("af","CALCIUM_logical","T"), + ("ag","CALCIUM_long","T"), + ("ah","CALCIUM_integer","T"), + ("ai","CALCIUM_integer","T"), + ], + outstream=[("ba","CALCIUM_double","T"), + ("bb","CALCIUM_string","T"), + ("bc","CALCIUM_integer","T"), + ("bd","CALCIUM_complex","T"), + ("be","CALCIUM_real","T"), + ("bf","CALCIUM_logical","T"), + ("bg","CALCIUM_long","T"), + ("bh","CALCIUM_integer","T"), + ("bi","CALCIUM_integer","T"), + ], + ), + ], + libs="-L%s -lcode1" % cwd, + rlibs="-Wl,--rpath -Wl,%s" % cwd, + ) + +g=Generator(Module("pycompos",components=[c1,c2,c3],prefix="./install",layout="multidir"),context) +g.generate() +g.bootstrap() +g.configure() +g.make() +g.install() +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) + + + diff --git a/Examples/calcium2/coupling.xml b/Examples/calcium2/coupling.xml new file mode 100644 index 0000000..8d6075a --- /dev/null +++ b/Examples/calcium2/coupling.xml @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + compo1 + s1 + + + + + + + + + + + + + + + + + + + + + + + + + + compo2 + s1 + + + + + + + + + + + + + + + + + + + + + + + + + + + fcode1 + serv1 + + + + + + + + + + + + + + + + + + + + + + + + + + + node1ba + node2aa + + + node2ba + node3aa + + + node3ba + node1aa + + + + node1bb + node2ab + + + node2bb + node3ab + + + node3bb + node1ab + + + + node1bc + node2ac + + + node2bc + node3ac + + + node3bc + node1ac + + + + node1bd + node2ad + + + node2bd + node3ad + + + node3bd + node1ad + + + + node1be + node2ae + + + node2be + node3ae + + + node3be + node1ae + + + + node1bf + node2af + + + node2bf + node3af + + + node3bf + node1af + + + + node1bg + node2ag + + + node2bg + node3ag + + + node3bg + node1ag + + + + node1bh + node2ah + + + node2bh + node3ah + + + node3bh + node1ah + + + + node1bi + node2ai + + + node2bi + node3ai + + + node3bi + node1ai + + + + node1 a + 23 + + + node1 b + 53 + + + node2 a + 63 + + + node2 b + 73 + + + node3 a + 63 + + + node3 b + 73 + + + + diff --git a/Examples/context.py b/Examples/context.py index 3ed110f..2b4fdb5 100644 --- a/Examples/context.py +++ b/Examples/context.py @@ -1,9 +1,38 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +import os + +KERNEL_ROOT_DIR=os.getenv("KERNEL_ROOT_DIR","/local/cchris/Salome/Install/KERNEL_V5") +GUI_ROOT_DIR=os.getenv("GUI_ROOT_DIR","/local/cchris/Salome/Install/GUI_V5") +YACS_ROOT_DIR=os.getenv("YACS_ROOT_DIR","/local/cchris/Salome/Install/YACS_V5_1_main") context={'update':1, + "makeflags":"", "prerequisites":"/local/cchris/.packages.d/envSalome5", - "kernel":"/local/cchris/Salome/Install/KERNEL_V5" + "kernel":KERNEL_ROOT_DIR, } -aster_home="/local/cchris/Aster/V10/Install" -aster_version="STA10.0" + + +aster_home="/local/cchris/Aster/V10.1/aster" +aster_version="STA10.1" +#aster_home="/local/cchris/Aster/V10/Install" +#aster_version="STA10.0" diff --git a/Examples/cpp1/Makefile b/Examples/cpp1/Makefile new file mode 100644 index 0000000..747f989 --- /dev/null +++ b/Examples/cpp1/Makefile @@ -0,0 +1,21 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +clean: + rm -rf *.o *.so cppcompos_SRC cppcompos_SRC.bak appli appli.bak install install.bak traceExec_proc diff --git a/Examples/cpp1/components.py b/Examples/cpp1/components.py index c3f9f62..169c376 100644 --- a/Examples/cpp1/components.py +++ b/Examples/cpp1/components.py @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + import os from module_generator import Generator,Module,Service,CPPComponent @@ -39,5 +58,5 @@ g.bootstrap() g.configure() g.make() g.install() -g.make_appli("appli",restrict=["KERNEL","GUI","YACS"]) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) diff --git a/Examples/cpp2/Makefile b/Examples/cpp2/Makefile index 9a186ed..f794b74 100644 --- a/Examples/cpp2/Makefile +++ b/Examples/cpp2/Makefile @@ -1,6 +1,25 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +include ../makefile.inc prog:prog.cxx g++ -o prog prog.cxx -L./install/lib/salome -lcompo1Exelib clean: - rm -rf *.o prog install appli cppcompos_SRC cppcompos_SRC.bak compo1_inst_1 traceExec_proc + rm -rf *.o prog install install.bak appli appli.bak cppcompos_SRC cppcompos_SRC.bak compo1_inst_1 traceExec_proc diff --git a/Examples/cpp2/components.py b/Examples/cpp2/components.py index bc85669..a2eab50 100644 --- a/Examples/cpp2/components.py +++ b/Examples/cpp2/components.py @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + import os from module_generator import Generator,Module,Service,CPPComponent @@ -41,4 +60,4 @@ g.bootstrap() g.configure() g.make() g.install() -g.make_appli("appli",restrict=["KERNEL","GUI","YACS"]) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) diff --git a/Examples/cpp2/prog.cxx b/Examples/cpp2/prog.cxx index 363c697..bdbe9f5 100644 --- a/Examples/cpp2/prog.cxx +++ b/Examples/cpp2/prog.cxx @@ -1,3 +1,21 @@ +// Copyright (C) 2009-2010 EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// extern "C" void yacsinit(); diff --git a/Examples/fort1/Makefile b/Examples/fort1/Makefile index 9a4c689..08682be 100644 --- a/Examples/fort1/Makefile +++ b/Examples/fort1/Makefile @@ -1,8 +1,24 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# include ../makefile.inc -FC=gfortran - all:libcode1.so libcode2.so libcode1.so:code1.o $(FC) -shared -fPIC -o libcode1.so code1.o @@ -14,4 +30,4 @@ code2.o:code2.f $(FC) -c code2.f -fPIC -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions clean: - rm -rf *.o *.so fcompos_SRC install fcompos_SRC.bak traceExec_proc appli appli.bak + rm -rf *.o *.so fcompos_SRC install fcompos_SRC.bak traceExec_proc appli appli.bak install.bak diff --git a/Examples/fort1/bidul.f b/Examples/fort1/bidul.f index 64011d9..148c5b0 100644 --- a/Examples/fort1/bidul.f +++ b/Examples/fort1/bidul.f @@ -1,3 +1,22 @@ +C Copyright (C) 2009-2010 EDF R&D +C +C This library is free software; you can redistribute it and/or +C modify it under the terms of the GNU Lesser General Public +C License as published by the Free Software Foundation; either +C version 2.1 of the License. +C +C This library is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +C Lesser General Public License for more details. +C +C You should have received a copy of the GNU Lesser General Public +C License along with this library; if not, write to the Free Software +C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +C +C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +C + subroutine bidul() write(6,*)"coucou" return diff --git a/Examples/fort1/code1.f b/Examples/fort1/code1.f index 37a4fa1..1f04ea2 100644 --- a/Examples/fort1/code1.f +++ b/Examples/fort1/code1.f @@ -1,3 +1,22 @@ +C Copyright (C) 2009-2010 EDF R&D +C +C This library is free software; you can redistribute it and/or +C modify it under the terms of the GNU Lesser General Public +C License as published by the Free Software Foundation; either +C version 2.1 of the License. +C +C This library is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +C Lesser General Public License for more details. +C +C You should have received a copy of the GNU Lesser General Public +C License along with this library; if not, write to the Free Software +C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +C +C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +C + SUBROUTINE SERV1(compo,a,b,c) include 'calcium.hf' integer compo(2) diff --git a/Examples/fort1/code2.f b/Examples/fort1/code2.f index d5ab3b1..180e5b4 100644 --- a/Examples/fort1/code2.f +++ b/Examples/fort1/code2.f @@ -1,3 +1,22 @@ +C Copyright (C) 2009-2010 EDF R&D +C +C This library is free software; you can redistribute it and/or +C modify it under the terms of the GNU Lesser General Public +C License as published by the Free Software Foundation; either +C version 2.1 of the License. +C +C This library is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +C Lesser General Public License for more details. +C +C You should have received a copy of the GNU Lesser General Public +C License along with this library; if not, write to the Free Software +C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +C +C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +C + SUBROUTINE SERV1(compo,a,b,c) include 'calcium.hf' integer compo(2),nval diff --git a/Examples/fort1/components.py b/Examples/fort1/components.py index 5bbd2e8..5948ed3 100644 --- a/Examples/fort1/components.py +++ b/Examples/fort1/components.py @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + import os from module_generator import Generator,Module,Service,F77Component @@ -24,5 +43,5 @@ g.bootstrap() g.configure() g.make() g.install() -g.make_appli("appli",restrict=["KERNEL","GUI","YACS"]) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) diff --git a/Examples/fort2/Makefile b/Examples/fort2/Makefile index c4a7dd6..231472e 100644 --- a/Examples/fort2/Makefile +++ b/Examples/fort2/Makefile @@ -1,8 +1,24 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# include ../makefile.inc -FC=gfortran - all:prog1 prog2 prog1:code1.o $(FC) -o prog1 code1.o -L./install/lib/salome -lfcode1Exelib @@ -15,4 +31,4 @@ code2.o:code2.f $(FC) -c code2.f -I$(KERNEL_ROOT_DIR)/include/salome -fexceptions clean: - rm -rf *.o prog1 prog2 fcode1_inst_1 fcode2_inst_1 fcompos_SRC install traceExec_proc + rm -rf *.o prog1 prog2 fcode1_inst_1 fcode2_inst_1 fcompos_SRC install traceExec_proc install.bak fcompos_SRC.bak appli appli.bak diff --git a/Examples/fort2/code1.f b/Examples/fort2/code1.f index ac9543a..5406355 100644 --- a/Examples/fort2/code1.f +++ b/Examples/fort2/code1.f @@ -1,3 +1,22 @@ +C Copyright (C) 2009-2010 EDF R&D +C +C This library is free software; you can redistribute it and/or +C modify it under the terms of the GNU Lesser General Public +C License as published by the Free Software Foundation; either +C version 2.1 of the License. +C +C This library is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +C Lesser General Public License for more details. +C +C You should have received a copy of the GNU Lesser General Public +C License along with this library; if not, write to the Free Software +C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +C +C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +C + PROGRAM P CALL YACSINIT() END diff --git a/Examples/fort2/code2.f b/Examples/fort2/code2.f index 1a5c654..93c1f63 100644 --- a/Examples/fort2/code2.f +++ b/Examples/fort2/code2.f @@ -1,3 +1,22 @@ +C Copyright (C) 2009-2010 EDF R&D +C +C This library is free software; you can redistribute it and/or +C modify it under the terms of the GNU Lesser General Public +C License as published by the Free Software Foundation; either +C version 2.1 of the License. +C +C This library is distributed in the hope that it will be useful, +C but WITHOUT ANY WARRANTY; without even the implied warranty of +C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +C Lesser General Public License for more details. +C +C You should have received a copy of the GNU Lesser General Public +C License along with this library; if not, write to the Free Software +C Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +C +C See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +C + PROGRAM P CALL YACSINIT() END diff --git a/Examples/fort2/components.py b/Examples/fort2/components.py index aa01198..c33fa5d 100644 --- a/Examples/fort2/components.py +++ b/Examples/fort2/components.py @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + import os from module_generator import Generator,Module,Service,F77Component @@ -25,5 +44,5 @@ g.bootstrap() g.configure() g.make() g.install() -g.make_appli("appli",restrict=["KERNEL","GUI","YACS"]) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) diff --git a/Examples/makefile.inc b/Examples/makefile.inc index a1e9eb1..7b69741 100644 --- a/Examples/makefile.inc +++ b/Examples/makefile.inc @@ -1,5 +1,27 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# KERNEL_ROOT_DIR=/local/cchris/Salome/Install/KERNEL_V5 -ASTER_ROOT=/local/cchris/Aster/V10/Install -ASTER_VERSION=STA10.0 +ASTER_ROOT=/local/cchris/Aster/V10.1/aster +ASTER_VERSION=STA10.1 +#ASTER_ROOT=/local/cchris/Aster/V10/Install +#ASTER_VERSION=STA10.0 + +FC=gfortran diff --git a/Examples/paco1/Makefile b/Examples/paco1/Makefile new file mode 100644 index 0000000..ae6ef33 --- /dev/null +++ b/Examples/paco1/Makefile @@ -0,0 +1,21 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +clean: + rm -rf *.o *.so *.pyc pacocompos_SRC pacocompos_SRC.bak appli appli.bak install install.bak traceExec_proc diff --git a/Examples/paco1/components.py b/Examples/paco1/components.py index 599d719..430dba3 100644 --- a/Examples/paco1/components.py +++ b/Examples/paco1/components.py @@ -1,11 +1,27 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + import os from module_generator import Generator,Module,Service,PACOComponent -context={'update':1, - "prerequisites":"/home/aribes/Dev/Scripts_env/prerequis.sh", - "kernel":"/home/aribes/Dev/Install/SALOME/KERNEL_INSTALL-RIBES", - "paco":"/home/aribes/Dev/Install/PaCO++_install" - } +#import context from .. +execfile("../pacocontext.py") cwd=os.getcwd() @@ -31,8 +47,5 @@ g.bootstrap() g.configure() g.make() g.install() -g.make_appli("appli", - restrict=["KERNEL","GUI","YACS"], - altmodules={"GUI":"/home/aribes/Dev/Install/SALOME/GUI_INSTALL", - "YACS":"/home/aribes/Dev/Install/SALOME/YACS_INSTALL"}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) diff --git a/Examples/paco2/Makefile b/Examples/paco2/Makefile new file mode 100644 index 0000000..ae6ef33 --- /dev/null +++ b/Examples/paco2/Makefile @@ -0,0 +1,21 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +clean: + rm -rf *.o *.so *.pyc pacocompos_SRC pacocompos_SRC.bak appli appli.bak install install.bak traceExec_proc diff --git a/Examples/paco2/components.py b/Examples/paco2/components.py index c5eb466..f152d96 100644 --- a/Examples/paco2/components.py +++ b/Examples/paco2/components.py @@ -1,12 +1,27 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + import os from module_generator import Generator,Module,Service,PACOComponent -context={'update':1, - "prerequisites":"/home/aribes/Dev/Scripts_env/prerequis.sh", - "kernel":"/home/aribes/Dev/Install/SALOME/KERNEL_INSTALL-RIBES", - "paco":"/home/aribes/Dev/Install/PaCO++_install", - "mpi":"/usr/lib/openmpi" - } +#import context from .. +execfile("../pacocontext.py") cwd=os.getcwd() @@ -32,8 +47,5 @@ g.bootstrap() g.configure() g.make() g.install() -g.make_appli("appli", - restrict=["KERNEL","GUI","YACS"], - altmodules={"GUI":"/home/aribes/Dev/Install/SALOME/GUI_INSTALL", - "YACS":"/home/aribes/Dev/Install/SALOME/YACS_INSTALL"}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) diff --git a/Examples/paco3/Makefile b/Examples/paco3/Makefile new file mode 100644 index 0000000..0356080 --- /dev/null +++ b/Examples/paco3/Makefile @@ -0,0 +1,21 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +clean: + rm -rf *.o *.so *.pyc DSC_PARALLEL_PARAM_SRC DSC_PARALLEL_PARAM_SRC.bak appli appli.bak install install.bak traceExec_proc diff --git a/Examples/paco3/components.py b/Examples/paco3/components.py index 759679a..5ec5ec1 100644 --- a/Examples/paco3/components.py +++ b/Examples/paco3/components.py @@ -1,14 +1,28 @@ # -*- coding: utf-8 *- +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + import os from module_generator import Generator,Module,Service,PACOComponent -context={'update':1, - "makeflags":"-j2", - "prerequisites":"/home/aribes/Dev/Scripts_env/prerequis.sh", - "kernel":"/home/aribes/Dev/Install/SALOME/KERNEL_INSTALL-RIBES", - "paco":"/home/aribes/Dev/Install/PaCO++_install", - "mpi":"/usr/lib/openmpi" - } +#import context from .. +execfile("../pacocontext.py") cwd=os.getcwd() @@ -78,8 +92,5 @@ g.bootstrap() g.configure() g.make() g.install() -g.make_appli("appli", - restrict=["KERNEL","GUI","YACS"], - altmodules={"GUI":"/home/aribes/Dev/Install/SALOME/GUI_INSTALL", - "YACS":"/home/aribes/Dev/Install/SALOME/YACS_INSTALL"}) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) diff --git a/Examples/pacocontext.py b/Examples/pacocontext.py new file mode 100644 index 0000000..6e3dd18 --- /dev/null +++ b/Examples/pacocontext.py @@ -0,0 +1,40 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +import os + +KERNEL_ROOT_DIR=os.getenv("KERNEL_ROOT_DIR","/local/cchris/Salome/Install/KERNEL_V5") +GUI_ROOT_DIR=os.getenv("GUI_ROOT_DIR","/local/cchris/Salome/Install/GUI_V5") +YACS_ROOT_DIR=os.getenv("YACS_ROOT_DIR","/local/cchris/Salome/Install/YACS_V5_1_main") + +context={'update':1, + "makeflags":"", + "prerequisites":"/local/cchris/.packages.d/envSalome5", + "kernel":KERNEL_ROOT_DIR, + "paco":"/local/cchris/pkg/paco/install", + "mpi":"/usr/lib/openmpi", + } + + +aster_home="/local/cchris/Aster/V10.1/aster" +aster_version="STA10.1" +#aster_home="/local/cchris/Aster/V10/Install" +#aster_version="STA10.0" + + diff --git a/Examples/pyth1/Makefile b/Examples/pyth1/Makefile new file mode 100644 index 0000000..6b389cf --- /dev/null +++ b/Examples/pyth1/Makefile @@ -0,0 +1,21 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +clean: + rm -rf *.o *.so *.pyc pycompos_SRC pycompos_SRC.bak appli appli.bak install install.bak traceExec_proc diff --git a/Examples/pyth1/bidul.py b/Examples/pyth1/bidul.py index f622882..4839a67 100644 --- a/Examples/pyth1/bidul.py +++ b/Examples/pyth1/bidul.py @@ -1,2 +1,21 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + def f(): print "coucou" diff --git a/Examples/pyth1/components.py b/Examples/pyth1/components.py index f7c3083..b7e2ee8 100644 --- a/Examples/pyth1/components.py +++ b/Examples/pyth1/components.py @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + import os from module_generator import Generator,Module,Service,PYComponent @@ -44,6 +63,6 @@ g.bootstrap() g.configure() g.make() g.install() -g.make_appli("appli",restrict=["KERNEL","GUI","YACS"]) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) diff --git a/Examples/pyth2/Makefile b/Examples/pyth2/Makefile new file mode 100644 index 0000000..85192fc --- /dev/null +++ b/Examples/pyth2/Makefile @@ -0,0 +1,21 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +clean: + rm -rf *.o *.so *.pyc pycompos_SRC pycompos_SRC.bak appli appli.bak install install.bak traceExec_proc compo2_inst_1 diff --git a/Examples/pyth2/components.py b/Examples/pyth2/components.py index 56cbb18..bc8ef03 100644 --- a/Examples/pyth2/components.py +++ b/Examples/pyth2/components.py @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + import os from module_generator import Generator,Module,Service,PYComponent @@ -40,5 +59,5 @@ g.bootstrap() g.configure() g.make() g.install() -g.make_appli("appli",restrict=["KERNEL","GUI","YACS"]) +g.make_appli("appli", restrict=["KERNEL"], altmodules={"GUI":GUI_ROOT_DIR, "YACS":YACS_ROOT_DIR}) diff --git a/MANIFEST.in b/MANIFEST.in index 3f6bec4..381adcb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + include Examples/context.py include Examples/makefile.inc include Examples/*/*.f diff --git a/module_generator/__init__.py b/module_generator/__init__.py index e25bec1..585afa1 100644 --- a/module_generator/__init__.py +++ b/module_generator/__init__.py @@ -1,7 +1,26 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + """ - Pacakge to generate SALOME modules with components + Package to generate SALOME modules with components implemented in C++, Fortran or Python - that can use datastream ports + that can use datastream ports """ from gener import Module, Service, Generator from fcompo import F77Component diff --git a/module_generator/astcompo.py b/module_generator/astcompo.py index f4f1efb..f124fbb 100644 --- a/module_generator/astcompo.py +++ b/module_generator/astcompo.py @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + """ This module defines the ASTERComponent class for ASTER component generation An ASTER component comes in 3 flavors : @@ -10,6 +29,7 @@ import re, os, sys from gener import Component, Invalid, makedirs from pyth_tmpl import pyinitEXEService, pyinitCEXEService, pyinitService +import aster_tmpl from aster_tmpl import asterCEXEService, asterEXEService from aster_tmpl import asterService, asterEXECompo, asterCEXECompo, asterCompo from aster_tmpl import comm, make_etude, cexe, exeaster @@ -62,6 +82,16 @@ class ASTERComponent(Component): filename = "%s.py" % self.name #on suppose que les composants ASTER sont homogenes (utilisent meme install) gen.aster = self.aster_dir + + #get ASTER version + f = os.path.join(self.aster_dir, "bibpyt", 'Accas', 'properties.py') + self.version=(0,0,0) + if os.path.isfile(f): + mydict = {} + execfile(f, mydict) + v,r,p = mydict['version'].split('.') + self.version=(int(v),int(r),int(p)) + if self.kind == "lib": return {"Makefile.am":gen.makeMakefile(self.getMakefileItems(gen)), filename:self.makeaster(gen)} @@ -99,15 +129,20 @@ class ASTERComponent(Component): def makeexepath(self, gen): """standalone component: generate files for calculation code""" - #patch to E_SUPERV.py + + #copy and patch E_SUPERV.py fil = open(os.path.join(self.aster_dir, "bibpyt", "Execution", "E_SUPERV.py")) esuperv = fil.read() fil.close() - esuperv = re.sub("def Execute\(self\)", "def Execute(self, params)", esuperv) - esuperv = re.sub("j=self.JdC", "self.jdc=j=self.JdC", esuperv) - esuperv = re.sub("\*\*args", "context_ini=params, **args", esuperv) - esuperv = re.sub("def main\(self\)", "def main(self,params={})", esuperv) - esuperv = re.sub("return self.Execute\(\)", "return self.Execute(params)", esuperv) + + if self.version < (10,1,2): + #patch to E_SUPERV.py + esuperv = re.sub("def Execute\(self\)", "def Execute(self, params)", esuperv) + esuperv = re.sub("j=self.JdC", "self.jdc=j=self.JdC", esuperv) + esuperv = re.sub("\*\*args", "context_ini=params, **args", esuperv) + esuperv = re.sub("def main\(self\)", "def main(self,params={})", esuperv) + esuperv = re.sub("return self.Execute\(\)", "return self.Execute(params)", esuperv) + #use a specific main program (modification of config.txt file) fil = open(os.path.join(self.aster_dir, "config.txt")) config = fil.read() @@ -128,15 +163,20 @@ class ASTERComponent(Component): def makecexepath(self, gen): """specific container: generate files""" - #patch to E_SUPERV.py + + #copy and patch E_SUPERV.py fil = open(os.path.join(self.aster_dir, "bibpyt", "Execution", "E_SUPERV.py")) esuperv = fil.read() fil.close() - esuperv = re.sub("def Execute\(self\)", "def Execute(self, params)", esuperv) - esuperv = re.sub("j=self.JdC", "self.jdc=j=self.JdC", esuperv) - esuperv = re.sub("\*\*args", "context_ini=params, **args", esuperv) - esuperv = re.sub("def main\(self\)", "def main(self,params={})", esuperv) - esuperv = re.sub("return self.Execute\(\)", "return self.Execute(params)", esuperv) + + if self.version < (10,1,2): + #patch to E_SUPERV.py + esuperv = re.sub("def Execute\(self\)", "def Execute(self, params)", esuperv) + esuperv = re.sub("j=self.JdC", "self.jdc=j=self.JdC", esuperv) + esuperv = re.sub("\*\*args", "context_ini=params, **args", esuperv) + esuperv = re.sub("def main\(self\)", "def main(self,params={})", esuperv) + esuperv = re.sub("return self.Execute\(\)", "return self.Execute(params)", esuperv) + #use a specific main program fil = open(os.path.join(self.aster_dir, "config.txt")) @@ -207,6 +247,7 @@ class ASTERComponent(Component): instream=instream, outstream=outstream) services.append(service) inits.append(init) + return asterEXECompo.substitute(component=self.name, module=gen.module.name, servicesdef="\n".join(defs), servicesimpl="\n".join(services), @@ -266,12 +307,14 @@ class ASTERComponent(Component): outstream=outstream) services.append(service) inits.append(init) + return asterCEXECompo.substitute(component=self.name, module=gen.module.name, servicesdef="\n".join(defs), servicesimpl="\n".join(services), initservice='\n'.join(inits), aster_dir=self.aster_dir) + def getImpl(self): if self.kind == "cexe": return "CEXE", self.name+".exe" diff --git a/module_generator/aster_tmpl.py b/module_generator/aster_tmpl.py index 9df3e47..b871375 100644 --- a/module_generator/aster_tmpl.py +++ b/module_generator/aster_tmpl.py @@ -1,3 +1,21 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# try: from string import Template diff --git a/module_generator/cata_tmpl.py b/module_generator/cata_tmpl.py index 8b714d4..e0258f5 100644 --- a/module_generator/cata_tmpl.py +++ b/module_generator/cata_tmpl.py @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + try: from string import Template except: @@ -13,6 +32,8 @@ idl=""" #include "SALOME_Exception.idl" #include "SALOME_PACOExtension.idl" +${idldefs} + module ${module} { typedef sequence stringvec; @@ -82,8 +103,8 @@ salomepython_DATA = ${module}_idl.py ${PACO_salomepython_DATA} lib${module}_la_SOURCES = nodist_lib${module}_la_SOURCES = ${module}SK.cc nodist_salomeinclude_HEADERS= ${module}.hh ${PACO_SALOMEINCLUDE_HEADERS} -lib${module}_la_CXXFLAGS = -I. $$(KERNEL_INCLUDES) -lib${module}_la_LIBADD = $$(KERNEL_LIBS) +lib${module}_la_CXXFLAGS = -I. $$(SALOME_INCLUDES) +lib${module}_la_LIBADD = $$(SALOME_IDL_LIBS) ########################################################## %SK.cc %.hh : %.idl \t$$(OMNIORB_IDL) -bcxx $$(IDLCXXFLAGS) $$(OMNIORB_IDLCXXFLAGS) $$(IDL_INCLUDES) $$< diff --git a/module_generator/compat.py b/module_generator/compat.py index f4c5bf9..672b33d 100644 --- a/module_generator/compat.py +++ b/module_generator/compat.py @@ -1,162 +1,162 @@ -#!/usr/bin/env python -#coding: iso-8859-15 -# -# Copyright (C) 2005 Gaëtan Lehmann -# -# this file is part of uptodate -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# - -# this module sets python 2.3 compatibility - - -# python 2.4 now have set in __builtin__ module - -import sets -set = sets.Set -del sets - -# python 2.4 enhance sort method in list object with key and reverse parameters, and introduced sorted function which do the same as sort but on a copied list -# as it's far more difficult to modify sort method, we implement a sorted fuction for python 2.3 - -def sorted(iterable, cmp=None, key=None, reverse=False) : - i = list(iterable) - if key : - d = {} - for v in iterable : - k = key(v) - if not d.has_key(k) : - d[k] = [] - d[k].append(v) - keys = d.keys() - keys.sort(cmp) - i = [] - for k in keys : - i += d[k] - else : - i.sort(cmp) - if reverse : - i.reverse() - return i - -# string.Template allow us to create templated command without problem : -# configparser use standard substitution, so an error in template can make the config file invalid. With the new template, we avoid this problem -# thoses classes are stollen from python 2.4 string module -import re -class _TemplateMetaclass(type): - pattern = r""" - %(delim)s(?: - (?P%(delim)s) | # Escape sequence of two delimiters - (?P%(id)s) | # delimiter and a Python identifier - {(?P%(id)s)} | # delimiter and a braced identifier - (?P) # Other ill-formed delimiter exprs - ) - """ - - def __init__(cls, name, bases, dct): - super(_TemplateMetaclass, cls).__init__(name, bases, dct) - if 'pattern' in dct: - pattern = cls.pattern - else: - pattern = _TemplateMetaclass.pattern % { - 'delim' : re.escape(cls.delimiter), - 'id' : cls.idpattern, - } - cls.pattern = re.compile(pattern, re.IGNORECASE | re.VERBOSE) - - -class Template: - """A string class for supporting $-substitutions.""" - __metaclass__ = _TemplateMetaclass - - delimiter = '$' - idpattern = r'[_a-z][_a-z0-9]*' - - def __init__(self, template): - self.template = template - - # Search for $$, $identifier, ${identifier}, and any bare $'s - - def _invalid(self, mo): - i = mo.start('invalid') - lines = self.template[:i].splitlines(True) - if not lines: - colno = 1 - lineno = 1 - else: - colno = i - len(''.join(lines[:-1])) - lineno = len(lines) - raise ValueError('Invalid placeholder in string: line %d, col %d' % - (lineno, colno)) - - def substitute(self, *args, **kws): - if len(args) > 1: - raise TypeError('Too many positional arguments') - if not args: - mapping = kws - elif kws: - mapping = _multimap(kws, args[0]) - else: - mapping = args[0] - # Helper function for .sub() - def convert(mo): - # Check the most common path first. - named = mo.group('named') or mo.group('braced') - if named is not None: - val = mapping[named] - # We use this idiom instead of str() because the latter will - # fail if val is a Unicode containing non-ASCII characters. - return '%s' % val - if mo.group('escaped') is not None: - return self.delimiter - if mo.group('invalid') is not None: - self._invalid(mo) - raise ValueError('Unrecognized named group in pattern', - self.pattern) - return self.pattern.sub(convert, self.template) - - def safe_substitute(self, *args, **kws): - if len(args) > 1: - raise TypeError('Too many positional arguments') - if not args: - mapping = kws - elif kws: - mapping = _multimap(kws, args[0]) - else: - mapping = args[0] - # Helper function for .sub() - def convert(mo): - named = mo.group('named') - if named is not None: - try: - # We use this idiom instead of str() because the latter - # will fail if val is a Unicode containing non-ASCII - return '%s' % mapping[named] - except KeyError: - return self.delimiter + named - braced = mo.group('braced') - if braced is not None: - try: - return '%s' % mapping[braced] - except KeyError: - return self.delimiter + '{' + braced + '}' - if mo.group('escaped') is not None: - return self.delimiter - if mo.group('invalid') is not None: - return self.delimiter - raise ValueError('Unrecognized named group in pattern', - self.pattern) - return self.pattern.sub(convert, self.template) +#!/usr/bin/env python +#coding: iso-8859-15 +# +# Copyright (C) 2005 Gaëtan Lehmann +# +# this file is part of uptodate +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# + +# this module sets python 2.3 compatibility + + +# python 2.4 now have set in __builtin__ module + +import sets +set = sets.Set +del sets + +# python 2.4 enhance sort method in list object with key and reverse parameters, and introduced sorted function which do the same as sort but on a copied list +# as it's far more difficult to modify sort method, we implement a sorted fuction for python 2.3 + +def sorted(iterable, cmp=None, key=None, reverse=False) : + i = list(iterable) + if key : + d = {} + for v in iterable : + k = key(v) + if not d.has_key(k) : + d[k] = [] + d[k].append(v) + keys = d.keys() + keys.sort(cmp) + i = [] + for k in keys : + i += d[k] + else : + i.sort(cmp) + if reverse : + i.reverse() + return i + +# string.Template allow us to create templated command without problem : +# configparser use standard substitution, so an error in template can make the config file invalid. With the new template, we avoid this problem +# thoses classes are stollen from python 2.4 string module +import re +class _TemplateMetaclass(type): + pattern = r""" + %(delim)s(?: + (?P%(delim)s) | # Escape sequence of two delimiters + (?P%(id)s) | # delimiter and a Python identifier + {(?P%(id)s)} | # delimiter and a braced identifier + (?P) # Other ill-formed delimiter exprs + ) + """ + + def __init__(cls, name, bases, dct): + super(_TemplateMetaclass, cls).__init__(name, bases, dct) + if 'pattern' in dct: + pattern = cls.pattern + else: + pattern = _TemplateMetaclass.pattern % { + 'delim' : re.escape(cls.delimiter), + 'id' : cls.idpattern, + } + cls.pattern = re.compile(pattern, re.IGNORECASE | re.VERBOSE) + + +class Template: + """A string class for supporting $-substitutions.""" + __metaclass__ = _TemplateMetaclass + + delimiter = '$' + idpattern = r'[_a-z][_a-z0-9]*' + + def __init__(self, template): + self.template = template + + # Search for $$, $identifier, ${identifier}, and any bare $'s + + def _invalid(self, mo): + i = mo.start('invalid') + lines = self.template[:i].splitlines(True) + if not lines: + colno = 1 + lineno = 1 + else: + colno = i - len(''.join(lines[:-1])) + lineno = len(lines) + raise ValueError('Invalid placeholder in string: line %d, col %d' % + (lineno, colno)) + + def substitute(self, *args, **kws): + if len(args) > 1: + raise TypeError('Too many positional arguments') + if not args: + mapping = kws + elif kws: + mapping = _multimap(kws, args[0]) + else: + mapping = args[0] + # Helper function for .sub() + def convert(mo): + # Check the most common path first. + named = mo.group('named') or mo.group('braced') + if named is not None: + val = mapping[named] + # We use this idiom instead of str() because the latter will + # fail if val is a Unicode containing non-ASCII characters. + return '%s' % val + if mo.group('escaped') is not None: + return self.delimiter + if mo.group('invalid') is not None: + self._invalid(mo) + raise ValueError('Unrecognized named group in pattern', + self.pattern) + return self.pattern.sub(convert, self.template) + + def safe_substitute(self, *args, **kws): + if len(args) > 1: + raise TypeError('Too many positional arguments') + if not args: + mapping = kws + elif kws: + mapping = _multimap(kws, args[0]) + else: + mapping = args[0] + # Helper function for .sub() + def convert(mo): + named = mo.group('named') + if named is not None: + try: + # We use this idiom instead of str() because the latter + # will fail if val is a Unicode containing non-ASCII + return '%s' % mapping[named] + except KeyError: + return self.delimiter + named + braced = mo.group('braced') + if braced is not None: + try: + return '%s' % mapping[braced] + except KeyError: + return self.delimiter + '{' + braced + '}' + if mo.group('escaped') is not None: + return self.delimiter + if mo.group('invalid') is not None: + return self.delimiter + raise ValueError('Unrecognized named group in pattern', + self.pattern) + return self.pattern.sub(convert, self.template) diff --git a/module_generator/cpp_tmpl.py b/module_generator/cpp_tmpl.py index f564728..4979bfa 100644 --- a/module_generator/cpp_tmpl.py +++ b/module_generator/cpp_tmpl.py @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + try: from string import Template except: @@ -253,7 +272,11 @@ hxxCompo=""" #include "Superv_Component_i.hxx" #include "${module}.hh" -class ${component}_i: +//COMPODEFS +${compodefs} +//ENDDEF + +class ${component}_i: ${inheritedclass} public virtual POA_${module}::${component}, public virtual Superv_Component_i { @@ -377,9 +400,9 @@ exeCPP=Template(exeCPP) compoMakefile=""" lib${component}Engine_la_SOURCES = ${component}.cxx ${sources} nodist_lib${component}Engine_la_SOURCES = -lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl $$(KERNEL_INCLUDES) ${includes} -lib${component}Engine_la_FFLAGS = $$(KERNEL_INCLUDES) -fexceptions ${includes} -lib${component}Engine_la_LIBADD = -L$$(top_builddir)/idl -l${module} $$(FLIBS) ${libs} +lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl $$(SALOME_INCLUDES) ${includes} +lib${component}Engine_la_FFLAGS = $$(SALOME_INCLUDES) -fexceptions ${includes} +lib${component}Engine_la_LIBADD = ${libs} -L$$(top_builddir)/idl -l${module} $${SALOME_LIBS} $$(FLIBS) lib${component}Engine_la_LDFLAGS = ${rlibs} """ compoMakefile=Template(compoMakefile) @@ -387,9 +410,9 @@ compoMakefile=Template(compoMakefile) compoEXEMakefile=""" lib${component}Exelib_la_SOURCES = ${component}.cxx nodist_lib${component}Exelib_la_SOURCES = -lib${component}Exelib_la_CXXFLAGS = -I$$(top_builddir)/idl $$(KERNEL_INCLUDES) ${includes} -lib${component}Exelib_la_FFLAGS = $$(KERNEL_INCLUDES) -fexceptions ${includes} -lib${component}Exelib_la_LIBADD = -L$$(top_builddir)/idl -l${module} $$(FLIBS) ${libs} +lib${component}Exelib_la_CXXFLAGS = -I$$(top_builddir)/idl $$(SALOME_INCLUDES) ${includes} +lib${component}Exelib_la_FFLAGS = $$(SALOME_INCLUDES) -fexceptions ${includes} +lib${component}Exelib_la_LIBADD = ${libs} -L$$(top_builddir)/idl -l${module} $${SALOME_LIBS} $$(FLIBS) lib${component}Exelib_la_LDFLAGS = ${rlibs} """ compoEXEMakefile=Template(compoEXEMakefile) diff --git a/module_generator/cppcompo.py b/module_generator/cppcompo.py index adc8977..eb6edea 100644 --- a/module_generator/cppcompo.py +++ b/module_generator/cppcompo.py @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + """ Module that defines CPPComponent for SALOME components implemented in C++ """ @@ -9,11 +28,13 @@ from cpp_tmpl import exeCPP, compoEXEMakefile, compoMakefile class CPPComponent(Component): def __init__(self, name, services=None, libs="", rlibs="", includes="", - kind="lib", exe_path=None, sources=None): + kind="lib", exe_path=None, sources=None, inheritedclass="", + compodefs=""): self.exe_path = exe_path Component.__init__(self, name, services, impl="CPP", libs=libs, rlibs=rlibs, includes=includes, kind=kind, - sources=sources) + sources=sources,inheritedclass=inheritedclass, + compodefs=compodefs) def validate(self): """ validate component definition parameters""" @@ -50,7 +71,7 @@ class CPPComponent(Component): makefileItems={"header":""" include $(top_srcdir)/adm_local/make_common_starter.am -AM_CFLAGS=$(KERNEL_INCLUDES) -fexceptions +AM_CFLAGS=$(SALOME_INCLUDES) -fexceptions """} if self.kind == "lib": makefileItems["lib_LTLIBRARIES"]=["lib"+self.name+"Engine.la"] @@ -81,8 +102,14 @@ AM_CFLAGS=$(KERNEL_INCLUDES) -fexceptions service = service+gen.makeArgs(serv)+");" services.append(service) servicesdef = "\n".join(services) + + inheritedclass=self.inheritedclass + if self.inheritedclass: + inheritedclass= " public virtual " + self.inheritedclass + "," + return hxxCompo.substitute(component=self.name, module=gen.module.name, - servicesdef=servicesdef) + servicesdef=servicesdef, inheritedclass=inheritedclass, + compodefs=self.compodefs) def makecxx(self, gen, exe=0): """return a string that is the content of .cxx file diff --git a/module_generator/fcompo.py b/module_generator/fcompo.py index bb484eb..55d2baf 100644 --- a/module_generator/fcompo.py +++ b/module_generator/fcompo.py @@ -1,3 +1,21 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# from gener import Component from cppcompo import CPPComponent @@ -21,7 +39,9 @@ class F77Component(CPPComponent): """generate definitions (defs attribute of services) et bodys (body attribute of services)""" for serv in self.services: #defs generation - params = ["void *compo"] + params=[] + if serv.instream or serv.outstream: + params = ["void *compo"] strparams = [] for name, typ in serv.inport: if typ == "file":continue #files are not passed through service interface @@ -41,7 +61,9 @@ class F77Component(CPPComponent): serv.defs = serv.defs+'\nextern "C" void F_FUNC(%s,%s)(%s);' % (serv.name.lower(), serv.name.upper(), args) #body generation - params = ["&component"] + params=[] + if serv.instream or serv.outstream: + params = ["&component"] strparams = [] strallocs = [] #length allocated for out string diff --git a/module_generator/gener.py b/module_generator/gener.py index 7f39254..704f2f0 100644 --- a/module_generator/gener.py +++ b/module_generator/gener.py @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + import os, shutil, glob, socket import traceback @@ -22,56 +41,19 @@ from cata_tmpl import cataOutStream, cataInStream, cataOutparam, cataInparam from cata_tmpl import cataOutParallelStream, cataInParallelStream from cata_tmpl import cataService, cataCompo from aster_tmpl import check_aster - -corbaTypes = {"double":"CORBA::Double", "long":"CORBA::Long", - "string":"const char*", "dblevec":"const %s::dblevec&", - "stringvec":"const %s::stringvec&", "intvec":"const %s::intvec&", - "dataref":"const Engines::dataref&","file":None - } - -corbaOutTypes = {"double":"CORBA::Double&", "long":"CORBA::Long&", - "string":"CORBA::String_out", "dblevec":"%s::dblevec_out", - "stringvec":"%s::stringvec_out", "intvec":"%s::intvec_out", - "dataref":"Engines::dataref_out","file":None - } - -def corba_in_type(typ, module): - if typ in ("dblevec", "intvec", "stringvec"): - return corbaTypes[typ] % module - else: - return corbaTypes[typ] - -def corba_out_type(typ, module): - if typ in ("dblevec", "intvec", "stringvec"): - return corbaOutTypes[typ] % module - else: - return corbaOutTypes[typ] - -calciumTypes = {"CALCIUM_double":"CALCIUM_double", - "CALCIUM_integer":"CALCIUM_integer", - "CALCIUM_real":"CALCIUM_real", - "CALCIUM_string":"CALCIUM_string", - "CALCIUM_complex":"CALCIUM_complex", - "CALCIUM_logical":"CALCIUM_logical", - } - -DatastreamParallelTypes = {"Param_Double_Port":"Param_Double_Port"} - -ValidImpl = ("CPP", "PY", "F77", "ASTER", "PACO") -ValidImplTypes = ("sequential", "parallel") -ValidTypes = corbaTypes.keys() -ValidStreamTypes = calciumTypes.keys() -ValidParallelStreamTypes = DatastreamParallelTypes.keys() -ValidDependencies = ("I", "T") -PyValidTypes = ValidTypes+["pyobj"] +from salomemodules import salome_modules +from yacstypes import corbaTypes, corbaOutTypes, moduleTypes, idlTypes, corba_in_type, corba_out_type +from yacstypes import ValidTypes, PyValidTypes, calciumTypes, DatastreamParallelTypes +from yacstypes import ValidImpl, ValidImplTypes, ValidStreamTypes, ValidParallelStreamTypes, ValidDependencies def makedirs(namedir): + """Create a new directory named namedir. If a directory already exists copy it to namedir.bak""" if os.path.exists(namedir): dirbak = namedir+".bak" if os.path.exists(dirbak): shutil.rmtree(dirbak) os.rename(namedir, dirbak) - os.listdir(dirbak) #sert seulement a mettre a jour le systeme de fichier sur certaines machines + os.listdir(dirbak) #needed to update filesystem on special machines (cluster with NFS, for example) os.makedirs(namedir) class Module(object): @@ -91,7 +73,7 @@ class Module(object): def validate(self): # Test Module name, canot have a "-" in the name if self.name.find("-") != -1: - raise Invalid("Module name %s is not valid, remove caracter - in the module name" % self.name) + raise Invalid("Module name %s is not valid, remove character - in the module name" % self.name) lcompo = set() for compo in self.components: if compo.name in lcompo: @@ -100,8 +82,9 @@ class Module(object): compo.validate() class Component(object): - def __init__(self, name, services=None, impl="PY", libs="", rlibs="", - includes="", kind="lib", sources=None): + def __init__(self, name, services=None, impl="PY", libs="", rlibs="", + includes="", kind="lib", sources=None, + inheritedclass="",compodefs=""): self.name = name self.impl = impl self.kind = kind @@ -110,6 +93,8 @@ class Component(object): self.rlibs = rlibs self.includes = includes self.sources = sources or [] + self.inheritedclass=inheritedclass + self.compodefs=compodefs def validate(self): if self.impl not in ValidImpl: @@ -257,7 +242,7 @@ class Generator(object): makefile = "SUBDIRS=" makefileItems={"header":""" include $(top_srcdir)/adm_local/make_common_starter.am -AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions +AM_CFLAGS=$$(SALOME_INCLUDES) -fexceptions """, "salomepython_PYTHON":[], "dist_salomescript_SCRIPTS":[], @@ -267,13 +252,31 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions "body":"", } + #get the list of SALOME modules used and put it in used_modules attribute + def get_dependent_modules(mod,modules): + modules[mod]=1 + if not salome_modules[mod].has_key("depends"):return + for m in salome_modules[mod]["depends"]: + if modules.has_key(m):continue + get_dependent_modules(m,modules) + + modules = {} + for compo in module.components: + for serv in compo.services: + for name, typ in serv.inport + serv.outport: + mod = moduleTypes[typ] + if mod: + get_dependent_modules(mod,modules) + + self.used_modules = modules.keys() + for compo in module.components: #for components files fdict=compo.makeCompo(self) if self.module.layout=="multidir": srcs[compo.name] = fdict #for src/Makefile.am - makefile = makefile+" "+compo.name + makefile = makefile + " " + compo.name else: srcs.update(fdict) #for src/Makefile.am @@ -285,7 +288,7 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions makefileItems["salomeinclude_HEADERS"]=makefileItems["salomeinclude_HEADERS"]+mdict.get("salomeinclude_HEADERS",[]) makefileItems["body"]=makefileItems["body"]+mdict.get("body","")+'\n' - if self.module.layout=="multidir": + if self.module.layout == "multidir": srcs["Makefile.am"] = makefile+'\n' else: srcs["Makefile.am"] = self.makeMakefile(makefileItems) @@ -293,14 +296,24 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions #for catalog files catalogfile = "%sCatalog.xml" % module.name + #add makefile definitions to make_common_starter.am + common_starter = makecommon + for mod in self.used_modules: + common_starter = common_starter + salome_modules[mod]["makefiledefs"] + '\n' + self.makeFiles({"autogen.sh":autogen, "Makefile.am":mainMakefile, "README":"", "NEWS":"", "AUTHORS":"", "ChangeLog":"", "src":srcs, "resources":{"Makefile.am":resMakefile.substitute(module=module.name), catalogfile:self.makeCatalog()}, - "adm_local":{"make_common_starter.am":makecommon, "check_aster.m4":check_aster}, + "adm_local":{"make_common_starter.am": common_starter, "check_aster.m4":check_aster}, }, namedir) + #add checks for modules in configure.ac + configure_modules="" + for mod in self.used_modules: + configure_modules = configure_modules + salome_modules[mod]["configdefs"] + '\n' + #for configure.ac configure_makefiles = [] if self.module.layout=="multidir": @@ -319,20 +332,22 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions self.makeFiles({"configure.ac":configure.substitute(module=module.name.lower(), makefiles='\n'.join(configure_makefiles), - paco_configure=paco_configure), - "idl":{"Makefile.am":idlMakefile.substitute(module=module.name, + paco_configure=paco_configure, + modules=configure_modules), + "idl":{"Makefile.am":idlMakefile.substitute(module=module.name, PACO_BUILT_SOURCES=PACO_BUILT_SOURCES, PACO_SALOMEINCLUDE_HEADERS=PACO_SALOMEINCLUDE_HEADERS, PACO_INCLUDES=PACO_INCLUDES, PACO_salomepython_DATA=PACO_salomepython_DATA, - PACO_salomeidl_DATA=PACO_salomeidl_DATA), - idlfile:self.makeidl(), - xmlfile:self.makexml()}, + PACO_salomeidl_DATA=PACO_salomeidl_DATA), + idlfile:self.makeidl(), + xmlfile:self.makexml()}, }, namedir) else : - self.makeFiles({"configure.ac":configure.substitute(module=module.name.lower(), + self.makeFiles({"configure.ac":configure.substitute(module=module.name.lower(), makefiles='\n'.join(configure_makefiles), - paco_configure=""), + paco_configure="", + modules=configure_modules), "idl":{"Makefile.am":idlMakefile.substitute(module=module.name, PACO_BUILT_SOURCES="", PACO_SALOMEINCLUDE_HEADERS="", @@ -432,10 +447,10 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions params = [] for name, typ in serv.inport: if typ == "file":continue #files are not passed through IDL interface - params.append("in %s %s" % (typ, name)) + params.append("in %s %s" % (idlTypes[typ], name)) for name, typ in serv.outport: if typ == "file":continue #files are not passed through IDL interface - params.append("out %s %s" % (typ, name)) + params.append("out %s %s" % (idlTypes[typ], name)) service = " void %s(" % serv.name service = service+",".join(params)+");" services.append(service) @@ -448,17 +463,27 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions if typ == "file":continue #files are not passed through IDL interface if compo.impl in ("PY", "ASTER") and typ == "pyobj": typ = "Engines::fileBlock" + else: + typ=idlTypes[typ] params.append("in %s %s" % (typ, name)) for name, typ in serv.outport: if typ == "file":continue #files are not passed through IDL interface if compo.impl in ("PY", "ASTER") and typ == "pyobj": typ = "Engines::fileBlock" + else: + typ=idlTypes[typ] params.append("out %s %s" % (typ, name)) service = " void %s(" % serv.name service = service+",".join(params)+") raises (SALOME::SALOME_Exception);" services.append(service) interfaces.append(interface.substitute(component=compo.name, services="\n".join(services))) - return idl.substitute(module=self.module.name, interfaces='\n'.join(interfaces)) + + #build idl includes for SALOME modules + idldefs="" + for mod in self.used_modules: + idldefs = idldefs + salome_modules[mod]["idldefs"] + + return idl.substitute(module=self.module.name, interfaces='\n'.join(interfaces),idldefs=idldefs) # For PaCO++ def makexml(self): @@ -543,7 +568,7 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions if ier != 0: raise Invalid("install has ended in error") - def make_appli(self, appliname, restrict=None, altmodules=None): + def make_appli(self, appliname, restrict=None, altmodules=None, resources=""): """generate SALOME application""" makedirs(appliname) @@ -598,8 +623,15 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) -fexceptions if not os.path.exists(prerequisites): raise Invalid("Can not create an application : prerequisites file not defined or does not exist") + #add resources catalog if it exists + resources_spec="" + if os.path.isfile(resources): + resources_spec='' % os.path.abspath(resources) + #create config_appli.xml file - appli = application.substitute(prerequisites=prerequisites, modules="\n".join(modules)) + appli = application.substitute(prerequisites=prerequisites, + modules="\n".join(modules), + resources=resources_spec) fil = open(os.path.join(appliname, "config_appli.xml"), 'w') fil.write(appli) fil.close() diff --git a/module_generator/mod_tmpl.py b/module_generator/mod_tmpl.py index cc6f16c..61f41e3 100644 --- a/module_generator/mod_tmpl.py +++ b/module_generator/mod_tmpl.py @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + try: from string import Template except: @@ -6,6 +25,7 @@ except: application=""" +${resources} ${modules} @@ -43,6 +63,9 @@ if test "x$$Kernel_ok" = "xno"; then AC_MSG_ERROR([You must define a correct KERNEL_ROOT_DIR or use the --with-kernel= configure option !]) fi +dnl Check Salome modules Install +${modules} + AC_PROG_LIBTOOL AC_PROG_CC AC_PROG_CXX @@ -143,6 +166,10 @@ IDL_INCLUDES = -I$(KERNEL_ROOT_DIR)/idl/salome KERNEL_LIBS= -L$(KERNEL_ROOT_DIR)/lib/salome -lSalomeContainer -lOpUtil -lSalomeDSCContainer -lSalomeDSCSuperv -lSalomeDatastream -lSalomeDSCSupervBasic -lCalciumC KERNEL_INCLUDES= -I$(KERNEL_ROOT_DIR)/include/salome $(OMNIORB_INCLUDES) $(BOOST_CPPFLAGS) +SALOME_LIBS= ${KERNEL_LIBS} +SALOME_IDL_LIBS= -L$(KERNEL_ROOT_DIR)/lib/salome -lSalomeIDLKernel +SALOME_INCLUDES= ${KERNEL_INCLUDES} + """ resMakefile=""" diff --git a/module_generator/paco_tmpl.py b/module_generator/paco_tmpl.py index b8312c2..72692ca 100644 --- a/module_generator/paco_tmpl.py +++ b/module_generator/paco_tmpl.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 *- -# Copyright (C) 2009 - EDF R&D +# Copyright (C) 2009-2010 EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -16,6 +16,9 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + # Author : Andre RIBES (EDF R&D) try: @@ -36,8 +39,8 @@ AM_CFLAGS=$$(KERNEL_INCLUDES) $$(PACO_INCLUDES) -fexceptions lib_LTLIBRARIES = lib${component}Engine.la lib${component}Engine_la_SOURCES = ${component}.cxx ${sources} nodist_lib${component}Engine_la_SOURCES = -lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl $$(KERNEL_INCLUDES) $$(PACO_INCLUDES) $$(MPI_INCLUDES) ${includes} -lib${component}Engine_la_LIBADD = -L$$(top_builddir)/idl -l${module} @KERNEL_ROOT_DIR@/lib/salome/libSalomeParallelDSCContainer.la @PACOPATH@/lib/libPaCO_direct_comScheduling.la $$(FLIBS) ${libs} $$(PACO_LIBS) +lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl $$(SALOME_INCLUDES) $$(PACO_INCLUDES) $$(MPI_INCLUDES) ${includes} +lib${component}Engine_la_LIBADD = -L$$(top_builddir)/idl -l${module} @KERNEL_ROOT_DIR@/lib/salome/libSalomeParallelDSCContainer.la @PACOPATH@/lib/libPaCO_direct_comScheduling.la $$(FLIBS) ${libs} $$(PACO_LIBS) $$(SALOME_LIBS) lib${component}Engine_la_LDFLAGS = ${rlibs} salomeinclude_HEADERS = ${component}.hxx """ diff --git a/module_generator/pacocompo.py b/module_generator/pacocompo.py index f16b2a3..8b60d6a 100644 --- a/module_generator/pacocompo.py +++ b/module_generator/pacocompo.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 *- -# Copyright (C) 2009 - EDF R&D +# Copyright (C) 2009-2010 EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -16,6 +16,9 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + # Author : Andre RIBES (EDF R&D) """ diff --git a/module_generator/pycompo.py b/module_generator/pycompo.py index 2b71161..411c936 100644 --- a/module_generator/pycompo.py +++ b/module_generator/pycompo.py @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + """ Module that defines PYComponent for SALOME components implemented in Python """ @@ -17,11 +36,12 @@ def indent(text, prefix=' '): class PYComponent(Component): def __init__(self, name, services=None, python_path=None, kind="lib", - sources=None): + sources=None, inheritedclass="", compodefs=""): """initialise component attributes""" self.python_path = python_path or [] Component.__init__(self, name, services, impl="PY", kind=kind, - sources=sources) + sources=sources, inheritedclass=inheritedclass, + compodefs=compodefs) def validate(self): """validate component attributes""" @@ -103,10 +123,20 @@ class PYComponent(Component): inits.append(init) python_path = ",".join([repr(p) for p in self.python_path]) + + inheritedclass=self.inheritedclass + callconstructor="" + if self.inheritedclass: + inheritedclass= self.inheritedclass + "," + callconstructor=""" + if hasattr(%s,"__init__"): + %s.__init__(self)""" % (self.inheritedclass,self.inheritedclass) + return pyCompo.substitute(component=self.name, module=gen.module.name, - servicesdef="\n".join(defs), servicesimpl="\n".join(services), + servicesdef="\n".join(defs), servicesimpl="\n".join(services), initservice='\n'.join(inits), - python_path=python_path) + python_path=python_path,inheritedclass=inheritedclass, + compodefs=self.compodefs, callconstructor=callconstructor) def makepyexe(self, gen): """generate standalone component source (python executable)""" @@ -158,11 +188,19 @@ class PYComponent(Component): inits.append(init) python_path = ",".join([repr(p) for p in self.python_path]) - return pyCompoEXE.substitute(component=self.name, module=gen.module.name, - servicesdef="\n".join(defs), - servicesimpl="\n".join(services), - initservice='\n'.join(inits), - python_path=python_path) + inheritedclass=self.inheritedclass + callconstructor="" + if self.inheritedclass: + inheritedclass= self.inheritedclass + "," + callconstructor=""" + if hasattr(%s,"__init__"): + %s.__init__(self)""" % (self.inheritedclass,self.inheritedclass) + return pyCompoEXE.substitute(component=self.name, module=gen.module.name, + servicesdef="\n".join(defs), + servicesimpl="\n".join(services), + initservice='\n'.join(inits), + python_path=python_path,inheritedclass=inheritedclass, + compodefs=self.compodefs, callconstructor=callconstructor) diff --git a/module_generator/pyth_tmpl.py b/module_generator/pyth_tmpl.py index ad4eb4f..4996d6d 100644 --- a/module_generator/pyth_tmpl.py +++ b/module_generator/pyth_tmpl.py @@ -1,3 +1,22 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + try: from string import Template except: @@ -18,11 +37,15 @@ try: except: numpy=None +#COMPODEFS +${compodefs} +#ENDDEF + #DEFS ${servicesdef} #ENDDEF -class ${component}(${module}__POA.${component},dsccalcium.PyDSCComponent): +class ${component}(${inheritedclass} ${module}__POA.${component},dsccalcium.PyDSCComponent): ''' To be identified as a SALOME component this Python class must have the same name as the component, inherit omniorb @@ -31,6 +54,7 @@ class ${component}(${module}__POA.${component},dsccalcium.PyDSCComponent): ''' def __init__ ( self, orb, poa, contID, containerName, instanceName, interfaceName ): dsccalcium.PyDSCComponent.__init__(self, orb, poa,contID,containerName,instanceName,interfaceName) +${callconstructor} def init_service(self,service): ${initservice} diff --git a/module_generator/salomemodules.py b/module_generator/salomemodules.py new file mode 100644 index 0000000..c296765 --- /dev/null +++ b/module_generator/salomemodules.py @@ -0,0 +1,126 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +####################################################################### +# SALOME modules # +####################################################################### +salome_modules={} + +#module GEOM +idldefs=""" +#include "GEOM_Gen.idl" +""" +makefiledefs=""" +#module GEOM +GEOM_IDL_INCLUDES = -I$(GEOM_ROOT_DIR)/idl/salome +GEOM_INCLUDES= -I$(GEOM_ROOT_DIR)/include/salome +GEOM_IDL_LIBS= -L$(GEOM_ROOT_DIR)/lib/salome -lSalomeIDLGEOM +GEOM_LIBS= -L$(GEOM_ROOT_DIR)/lib/salome +SALOME_LIBS += ${GEOM_LIBS} +SALOME_IDL_LIBS += ${GEOM_IDL_LIBS} +SALOME_INCLUDES += ${GEOM_INCLUDES} +IDL_INCLUDES += ${GEOM_IDL_INCLUDES} +""" +configdefs=""" +if test "x${GEOM_ROOT_DIR}" != "x" && test -d ${GEOM_ROOT_DIR} ; then + AC_MSG_RESULT(Using GEOM installation in ${GEOM_ROOT_DIR}) +else + AC_MSG_ERROR([Cannot find module GEOM. Have you set GEOM_ROOT_DIR ?],1) +fi +""" + +salome_modules["GEOM"]={"idldefs" : idldefs, "makefiledefs" : makefiledefs, "configdefs" : configdefs} + +#module MED +idldefs=""" +#include "MED_Gen.idl" +#include "MED.idl" +""" +makefiledefs=""" +#module MED +MED_IDL_INCLUDES = -I$(MED_ROOT_DIR)/idl/salome +MED_INCLUDES= -I$(MED_ROOT_DIR)/include/salome +MED_IDL_LIBS= -L$(MED_ROOT_DIR)/lib/salome -lSalomeIDLMED +MED_LIBS= -L$(MED_ROOT_DIR)/lib/salome +SALOME_LIBS += ${MED_LIBS} +SALOME_IDL_LIBS += ${MED_IDL_LIBS} +SALOME_INCLUDES += ${MED_INCLUDES} +IDL_INCLUDES += ${MED_IDL_INCLUDES} +""" +configdefs=""" +if test "x${MED_ROOT_DIR}" != "x" && test -d ${MED_ROOT_DIR} ; then + AC_MSG_RESULT(Using MED installation in ${MED_ROOT_DIR}) +else + AC_MSG_ERROR([Cannot find module MED. Have you set MED_ROOT_DIR ?],1) +fi +""" + +salome_modules["MED"]={"idldefs" : idldefs, "makefiledefs" : makefiledefs, "configdefs" : configdefs} + +#module SMESH +idldefs=""" +#include "SMESH_Gen.idl" +#include "SMESH_Mesh.idl" +""" +makefiledefs=""" +#module SMESH +SMESH_IDL_INCLUDES = -I$(SMESH_ROOT_DIR)/idl/salome +SMESH_INCLUDES= -I$(SMESH_ROOT_DIR)/include/salome +SMESH_IDL_LIBS= -L$(SMESH_ROOT_DIR)/lib/salome -lSalomeIDLSMESH +SMESH_LIBS= -L$(SMESH_ROOT_DIR)/lib/salome +SALOME_LIBS += ${SMESH_LIBS} +SALOME_IDL_LIBS += ${SMESH_IDL_LIBS} +SALOME_INCLUDES += ${SMESH_INCLUDES} +IDL_INCLUDES += ${SMESH_IDL_INCLUDES} +""" +configdefs=""" +if test "x${SMESH_ROOT_DIR}" != "x" && test -d ${SMESH_ROOT_DIR} ; then + AC_MSG_RESULT(Using SMESH installation in ${SMESH_ROOT_DIR}) +else + AC_MSG_ERROR([Cannot find module SMESH. Have you set SMESH_ROOT_DIR ?],1) +fi +""" + +salome_modules["SMESH"]={"idldefs" : idldefs, "makefiledefs" : makefiledefs, "configdefs" : configdefs, + "depends":["GEOM","MED"]} + +#module VISU +idldefs=""" +#include "VISU_Gen.idl" +""" +makefiledefs=""" +#module VISU +VISU_IDL_INCLUDES = -I$(VISU_ROOT_DIR)/idl/salome +VISU_INCLUDES= -I$(VISU_ROOT_DIR)/include/salome +VISU_IDL_LIBS= -L$(VISU_ROOT_DIR)/lib/salome -lSalomeIDLVISU +VISU_LIBS= -L$(VISU_ROOT_DIR)/lib/salome +SALOME_LIBS += ${VISU_LIBS} +SALOME_IDL_LIBS += ${VISU_IDL_LIBS} +SALOME_INCLUDES += ${VISU_INCLUDES} +IDL_INCLUDES += ${VISU_IDL_INCLUDES} +""" +configdefs=""" +if test "x${VISU_ROOT_DIR}" != "x" && test -d ${VISU_ROOT_DIR} ; then + AC_MSG_RESULT(Using VISU installation in ${VISU_ROOT_DIR}) +else + AC_MSG_ERROR([Cannot find module VISU. Have you set VISU_ROOT_DIR ?],1) +fi +""" + +salome_modules["VISU"]={"idldefs" : idldefs, "makefiledefs" : makefiledefs, "configdefs" : configdefs} diff --git a/module_generator/yacstypes.py b/module_generator/yacstypes.py new file mode 100644 index 0000000..125254e --- /dev/null +++ b/module_generator/yacstypes.py @@ -0,0 +1,100 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +########################################################### +# Types definitions # +########################################################### +corbaTypes = {"double":"CORBA::Double", "long":"CORBA::Long", + "string":"const char*", "dblevec":"const %s::dblevec&", + "stringvec":"const %s::stringvec&", "intvec":"const %s::intvec&", + "file":None + } + +corbaOutTypes = {"double":"CORBA::Double&", "long":"CORBA::Long&", + "string":"CORBA::String_out", "dblevec":"%s::dblevec_out", + "stringvec":"%s::stringvec_out", "intvec":"%s::intvec_out", + "file":None + } +moduleTypes = {"double":"", "long":"", "string":"", "dblevec":"", "stringvec":"", "intvec":"", "file":"" } + +idlTypes = {"double":"double", "long":"long", "string":"string", "dblevec":"dblevec", "stringvec":"stringvec", "intvec":"intvec", "file":"" } + +def corba_in_type(typ, module): + if corbaTypes[typ].count("%s")>0: + return corbaTypes[typ] % module + else: + return corbaTypes[typ] + +def corba_out_type(typ, module): + if corbaOutTypes[typ].count("%s")>0: + return corbaOutTypes[typ] % module + else: + return corbaOutTypes[typ] + +ValidTypes = corbaTypes.keys() +PyValidTypes = ValidTypes+["pyobj"] + +def add_type(typename, corbaType, corbaOutType, module, idltype): + """ add a data type YACS from other module than KERNEL to the list of available types + + :param typename: YACS data type name + :type typename: string + :param corbaType: representation for C++ CORBA in parameter + :type corbaType: string + :param corbaOutType: representation for C++ CORBA out parameter + :type corbaOutType: string + :param module: name of the module that defines the data type (GEOM for GEOM_Object) + :type module: string + :param idltype: representation for CORBA idl + :type idltype: string + """ + corbaTypes[typename] = corbaType + corbaOutTypes[typename] = corbaOutType + moduleTypes[typename] = module + idlTypes[typename] = idltype + ValidTypes.append(typename) + PyValidTypes.append(typename) + +calciumTypes = {"CALCIUM_double":"CALCIUM_double", + "CALCIUM_integer":"CALCIUM_integer", + "CALCIUM_real":"CALCIUM_real", + "CALCIUM_string":"CALCIUM_string", + "CALCIUM_complex":"CALCIUM_complex", + "CALCIUM_logical":"CALCIUM_logical", + "CALCIUM_long":"CALCIUM_long", + } + +DatastreamParallelTypes = {"Param_Double_Port":"Param_Double_Port"} + +ValidImpl = ("CPP", "PY", "F77", "ASTER", "PACO") +ValidImplTypes = ("sequential", "parallel") +ValidStreamTypes = calciumTypes.keys() +ValidParallelStreamTypes = DatastreamParallelTypes.keys() +ValidDependencies = ("I", "T") + +add_type("dataref", "const Engines::dataref&", "Engines::dataref_out", "", "dataref") +add_type("GEOM_Object", "GEOM::GEOM_Object_ptr", "GEOM::GEOM_Object_out", "GEOM", "GEOM::GEOM_Object") +add_type("SMESH_Mesh", "SMESH::SMESH_Mesh_ptr", "SMESH::SMESH_Mesh_out", "SMESH", "SMESH::SMESH_Mesh") +add_type("SMESH_Hypothesis", "SMESH::SMESH_Hypothesis_ptr", "SMESH::SMESH_Hypothesis_out", "SMESH", "SMESH::SMESH_Hypothesis") +add_type("SALOME_MED/MED", "SALOME_MED::MED_ptr", "SALOME_MED::MED_out", "MED", "SALOME_MED::MED") +add_type("SALOME_MED/MESH", "SALOME_MED::MESH_ptr", "SALOME_MED::MESH_out", "MED", "SALOME_MED::MESH") +add_type("SALOME_MED/SUPPORT", "SALOME_MED::SUPPORT_ptr", "SALOME_MED::SUPPORT_out", "MED", "SALOME_MED::SUPPORT") +add_type("SALOME_MED/FIELD", "SALOME_MED::FIELD_ptr", "SALOME_MED::FIELD_out", "MED", "SALOME_MED::FIELD") +add_type("SALOME_MED/FIELDDOUBLE", "SALOME_MED::FIELDDOUBLE_ptr", "SALOME_MED::FIELDDOUBLE_out", "MED", "SALOME_MED::FIELDDOUBLE") +add_type("SALOME_MED/FIELDINT", "SALOME_MED::FIELDINT_ptr", "SALOME_MED::FIELDINT_out", "MED", "SALOME_MED::FIELDINT") diff --git a/setup.py b/setup.py index d752c00..6bc29e7 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,25 @@ +# Copyright (C) 2009-2010 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + from distutils.core import setup setup(name='YACSGEN', - version='5.1.3', + version='5.1.4', author='C. Caremoli', packages=['module_generator'], )