From: jfa Date: Sat, 6 May 2006 08:25:41 +0000 (+0000) Subject: Join modifications from branch CEAFor_V3_2_0 X-Git-Tag: T3_2_0b1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0b4f10553c1233eaa005b80fe8eee38b7f7a6a21;p=modules%2Fmed.git Join modifications from branch CEAFor_V3_2_0 --- diff --git a/INSTALL b/INSTALL index 89f4f2411..ea43398f3 100644 --- a/INSTALL +++ b/INSTALL @@ -1,4 +1,4 @@ -This is the version 3.2.0a2 of MED +This is the version 3.2.0b1 of MED Compatible with : - - KERNEL 3.2.0a2 - - SALOMEGUI 3.2.0a2 + - KERNEL 3.2.0b1 + - SALOMEGUI 3.2.0b1 diff --git a/Makefile.in b/Makefile.in index 9e82a9312..82d3f2289 100644 --- a/Makefile.in +++ b/Makefile.in @@ -30,6 +30,7 @@ RESOURCES_FILES = \ MEDCatalog.xml \ MED_en.xml \ MED.config \ +SalomeApp.xml \ Data.png \ Infos.png \ Structure.png \ @@ -65,6 +66,13 @@ elle_3D_HPr_10x10x10_2.med \ elle_3D_HPr_2x2x2_2.med \ elle_3D_HPr_4x4x4_2.med \ test_2D.med \ +maill.00.med \ +maill.00_nofield.med \ +maill.00_nomesh.med \ +maill.00_without_seg2.med \ +zzzz121b_without_tr6.med \ +geomMesh21.med \ +geomMesh22.med \ Darcy3_3D_H_10x10x10.sauve \ dx200_dy1_avec_2couches.sauve \ elle_2D_QT_10x10.sauve \ @@ -112,8 +120,8 @@ titi.xyz BIN_SCRIPT= \ VERSION -LDFLAGS= -L$(top_builddir)/lib/salome -LDFLAGSFORBIN= -L$(top_builddir)/lib/salome +LDFLAGS= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome +LDFLAGSFORBIN= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome # copy header files in common directory include_list=include/salome/SALOMEconfig.h diff --git a/adm_local/unix/config_files/check_Med.m4 b/adm_local/unix/config_files/check_Med.m4 index 727bf4381..b741c5b9f 100644 --- a/adm_local/unix/config_files/check_Med.m4 +++ b/adm_local/unix/config_files/check_Med.m4 @@ -4,37 +4,46 @@ # AC_DEFUN([CHECK_MED],[ +AC_REQUIRE([AC_LINKER_OPTIONS])dnl AC_CHECKING(for Med) Med_ok=no +MED_LDFLAGS="" +MED_CXXFLAGS="" + AC_ARG_WITH(med, [ --with-med=DIR root directory path of MED installation ], MED_DIR="$withval",MED_DIR="") -if test "x$MED_DIR" == "x" ; then - +if test "x${MED_DIR}" == "x" ; then + AC_MSG_RESULT(for \${MED_ROOT_DIR}: ${MED_ROOT_DIR}) # no --with-med-dir option used - - if test "x$MED_ROOT_DIR" != "x" ; then + if test "x${MED_ROOT_DIR}" != "x" ; then # MED_ROOT_DIR environment variable defined - MED_DIR=$MED_ROOT_DIR + MED_DIR=${MED_ROOT_DIR} fi -# + fi if test -f ${MED_DIR}/idl/salome/MED.idl ; then - Med_ok=yes AC_MSG_RESULT(Using Med module distribution in ${MED_DIR}) + Med_ok=yes if test "x$MED_ROOT_DIR" == "x" ; then MED_ROOT_DIR=${MED_DIR} fi + AC_SUBST(MED_ROOT_DIR) + MED_LDFLAGS=-L${MED_DIR}/lib${LIB_LOCATION_SUFFIX}/salome + MED_CXXFLAGS=-I${MED_DIR}/include/salome + + AC_SUBST(MED_LDFLAGS) + AC_SUBST(MED_CXXFLAGS) else AC_MSG_WARN("Cannot find Med module sources") fi diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in index 9f3ba60b5..476347b71 100644 --- a/adm_local/unix/make_commence.in +++ b/adm_local/unix/make_commence.in @@ -12,8 +12,8 @@ HAVE_SSTREAM=@HAVE_SSTREAM@ LIBS=@LIBS@ LIBSFORBIN=@LIBS@ -LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome -LDFLAGSFORBIN=@LDFLAGS@ -L$(top_builddir)/lib/salome +LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome +LDFLAGSFORBIN=@LDFLAGS@ -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome # add libstdc++ to link c++ library with libtool ! LDFLAGS+= @STDLIB@ LDFLAGSFORBIN+= @STDLIB@ @@ -60,8 +60,8 @@ PYTHON_VERSION = @PYTHON_VERSION@ # Changes from the SalomePro V1.2c #PYTHON_SITE = @PYTHON_SITE@ #PYTHON_SITE_INSTALL = @PYTHON_SITE_INSTALL@ -PYTHON_SITE = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages -PYTHON_SITE_INSTALL = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome +PYTHON_SITE = $(prefix)/lib@LIB_LOCATION_SUFFIX@/python$(PYTHON_VERSION)/site-packages +PYTHON_SITE_INSTALL = $(prefix)/lib@LIB_LOCATION_SUFFIX@/python$(PYTHON_VERSION)/site-packages/salome # QT @@ -127,6 +127,11 @@ CAS_MODELER=@CAS_MODELER@ CAS_DATAEXCHANGE=@CAS_DATAEXCHANGE@ CAS_LDPATH=@CAS_LDPATH@ +# CPPUNIT + +CPPUNIT_INCLUDES = @CPPUNIT_INCLUDES@ +CPPUNIT_LIBS = @CPPUNIT_LIBS@ + # MPICH MPICH_INCLUDES=@MPICH_INCLUDES@ @@ -186,6 +191,8 @@ ifeq ($(MED_WITH_KERNEL),yes) endif DOXYGEN = @DOXYGEN@ +DOXYGEN_WITH_PYTHON = @DOXYGEN_WITH_PYTHON@ +DOXYGEN_WITH_STL = @DOXYGEN_WITH_STL@ ## Shared libraries LT_STATIC_EXEC=@LT_STATIC_EXEC@ @@ -207,16 +214,26 @@ INSTALL_DATA=@INSTALL_DATA@ # create a symbolic link (or a copie ?) LN_S=@LN_S@ +KERNEL_ROOT_DIR=@KERNEL_ROOT_DIR@ +KERNEL_SITE_DIR=@KERNEL_SITE_DIR@ + +KERNEL_LDFLAGS=@KERNEL_LDFLAGS@ +KERNEL_CXXFLAGS=@KERNEL_CXXFLAGS@ + +GUI_ROOT_DIR=@GUI_ROOT_DIR@ +GUI_LDFLAGS=@GUI_LDFLAGS@ +GUI_CXXFLAGS=@GUI_CXXFLAGS@ + ## Installation points prefix=@prefix@ exec_prefix=@exec_prefix@ -bindir=@bindir@/salome -libdir=@libdir@/salome +bindir=@exec_prefix@/bin/salome +libdir=@exec_prefix@/lib@LIB_LOCATION_SUFFIX@/salome # warning : if user give this path in configure we could have salome/salome :-( includedir=@includedir@/salome datadir=@datadir@/salome -idldir=$(prefix)/idl/salome -sharedpydir=@libdir@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules +idldir=${prefix}/idl/salome +sharedpydir=@exec_prefix@/lib@LIB_LOCATION_SUFFIX@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules incmakedir=${prefix}/salome_adm/unix docdir=${prefix}/doc/salome @@ -244,7 +261,21 @@ all: Makefile: $(top_builddir)/config.status $(srcdir)/Makefile.in cd $(top_builddir) ; ./config.status -$(top_builddir)/config.status: $(top_srcdir)/configure +LOCAL_MAKE = make_commence make_conclude + +ifeq ($(MED_WITH_KERNEL),yes) + LOCAL_MAKE += make_omniorb +endif + +KERNEL_MAKE = make_module depend SALOMEconfig.h sstream + +ifeq ($(MED_WITH_KERNEL),yes) + KERNEL_MAKE += F77config.h envScript +endif + +$(top_builddir)/config.status: $(top_srcdir)/configure \ + $(LOCAL_MAKE:%=$(top_srcdir)/adm_local/unix/%.in) \ + $(KERNEL_MAKE:%=$(KERNEL_ROOT_DIR)/salome_adm/unix/%.in) cd $(top_builddir) ; ./config.status --recheck # VPATH contain $(srcdir), so make configure is good in top_srcdir and we must add target configure otherwise :-) @@ -281,6 +312,6 @@ check_GUI.m4 check_corba_in_GUI.m4 $(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%) \ $(ACLOCAL_GUI:%=@GUI_ROOT_DIR@/adm_local/unix/config_files/%) - cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files \ + cd $(top_srcdir) ; aclocal -I adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files \ -I @GUI_ROOT_DIR@/adm_local/unix/config_files diff --git a/adm_local/unix/make_conclude.in b/adm_local/unix/make_conclude.in index 770153f86..e53acdf51 100644 --- a/adm_local/unix/make_conclude.in +++ b/adm_local/unix/make_conclude.in @@ -37,9 +37,9 @@ LIB_OBJ_F = $(patsubst %.f, %.lo, $(filter %.f, $(LIB_SRC))) # all libtool obj file in library LIB_OBJ = $(LIB_OBJ_CXX) $(LIB_OBJ_CC) $(LIB_OBJ_C) $(LIB_CLIENT_OBJ:%.o=%.lo) $(LIB_SERVER_OBJ:%.o=%.lo) $(LIB_SWIG_OBJ) $(LIB_OBJ_F) -# LIB_BUILD = $(LIB:%.la=$(top_builddir)/lib/salome/%.la) -LIB_BUILD = $(patsubst %.la, $(top_builddir)/lib/salome/%.la, $(filter %.la, $(LIB))) -LIB_BUILD_A = $(patsubst %.a, $(top_builddir)/lib/salome/%.a, $(filter %.a, $(LIB))) +# LIB_BUILD = $(LIB:%.la=$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.la) +LIB_BUILD = $(patsubst %.la, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.la, $(filter %.la, $(LIB))) +LIB_BUILD_A = $(patsubst %.a, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.a, $(filter %.a, $(LIB))) ifneq ($(findstring cmodule.la,$(filter %.la, $(LIB))),) LIB_SWIG = $(patsubst %cmodule.la,%.so, $(filter %.la, $(LIB))) @@ -50,7 +50,7 @@ endif lib: $(LIB_BUILD) $(LIB_CLIENT_PY) # we don't build static library ! -$(LIB_BUILD): $(top_builddir)/lib/salome/%.la: %.la +$(LIB_BUILD): $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.la: %.la -$(RM) $@ -$(RM) $(patsubst %.la, %.so, $@) -$(RM) $(patsubst %.la, %.a, $@) @@ -61,10 +61,10 @@ $(LIB_BUILD): $(top_builddir)/lib/salome/%.la: %.la $(patsubst %.la, %.so, $@).0 || true if test "X$(LIB_SWIG)" != X; then \ - ln -sf $(patsubst %.la,%.so, $(CURDIR)/.libs/$<) $(top_builddir)/lib/salome/_$(LIB_SWIG) || true;\ + ln -sf $(patsubst %.la,%.so, $(CURDIR)/.libs/$<) $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/_$(LIB_SWIG) || true;\ fi; -$(LIB_BUILD_A): $(top_builddir)/lib/salome/%.a: %.a +$(LIB_BUILD_A): $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/%.a: %.a -$(RM) $@ ln -sf $(CURDIR)/$< $@ || true @@ -108,7 +108,7 @@ $(DEST_PYSCRIPTS): $(top_builddir)/bin/salome/%: % # copy pyqt files in $(PYTHON_SHARED_SITE) # -PYTHON_SHARED_SITE=$(top_builddir)/lib/python$(PYTHON_VERSION)/site-packages/salome/shared_modules +PYTHON_SHARED_SITE=$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules $(PYTHON_SHARED_SITE): $(INSTALL) -d $@ @@ -118,11 +118,65 @@ sharedpyscripts: $(PYTHON_SHARED_SITE) $(DEST_SHAREDPYSCRIPTS) $(DEST_SHAREDPYSCRIPTS): $(PYTHON_SHARED_SITE)/%: % cp -f $< $@ -check: test +#check: test !!!! version before AG changes + +#tests: test !!!! version before AG changes + +#test: $(LIB) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%) !!!! version before AG changes + +check: tests + + + + + +runtest_%: + @( LD_LIBRARY_PATH=$(top_builddir)/src/MEDMEM/.libs:$(top_builddir)/src/MEDWrapper/V2_1/Core/.libs:$${LD_LIBRARY_PATH} ; \ + SALOME_trace=local ; \ + export SALOME_trace ; \ + x=$@ ; \ + x=$${x#runtest_*} ; \ + echo -n "Passing test : "$$x ; \ + ./$$x > /dev/null ; \ + if test $$? != "0"; then \ + echo $$'\033'[1\;31m [ FAILED ] $$'\033'[0m ; \ + exit 2; \ + else \ + echo $$'\033'[1\;32m [ OK ] $$'\033'[0m \ ; \ + fi; ) + +runpytest_%: + @( LD_LIBRARY_PATH=$(top_builddir)/src/MEDMEM/.libs:$(top_builddir)/src/MEDWrapper/V2_1/Core/.libs:$${LD_LIBRARY_PATH} ; \ + PYTHONPATH=$(top_builddir)/src/MEDMEM_SWIG:$${PYTHONPATH} ; \ + SALOME_trace=local ; \ + export SALOME_trace ; \ + x=$@ ; \ + x=$${x#runpytest_*} ; \ + echo -n "Passing python test : "$$x ; \ + python $(srcdir)/$$x > /dev/null ; \ + if test $$? != "0"; then \ + echo $$'\033'[1\;31m [ FAILED ] $$'\033'[0m ; \ + exit 2; \ + else \ + echo $$'\033'[1\;32m [ OK ] $$'\033'[0m \ ; \ + fi; ) + +ALL_CHECK_TARGETS = $(patsubst %, runtest_%, $(TEST_PROGS)) + +tests: $(LIB) $(TEST_PROGS) $(ALL_CHECK_TARGETS) + @ln -fs $(top_builddir)/src/MEDMEM_SWIG/.libs/libMEDMEM_Swigcmodule.so $(top_builddir)/src/MEDMEM_SWIG/_libMEDMEM_Swig.so ; \ + for f in $(TEST_PYSCRIPTS); do \ + if [ x"$${f#*test}" != x"$${f}" ]; then \ + $(MAKE) runpytest_$$f ; \ + if test $$? != "0"; then \ + rm -f $(top_builddir)/src/MEDMEM_SWIG/_libMEDMEM_Swig.so ; \ + exit 2; \ + fi; \ + fi; \ + done ; \ + rm -f $(top_builddir)/src/MEDMEM_SWIG/_libMEDMEM_Swig.so ; -tests: test -test: $(LIB) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%) # copy header file in $(inc_builddir) @@ -141,6 +195,7 @@ $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) $(sharedpydir): # Install the library, the public header files, and programs. install: $(LIB) $(BIN) $(TEST_PROGS) $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) install-python install-sharedpyqt install-qm +#install: $(LIB) $(BIN) $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) install-python install-sharedpyqt install-qm @for f in X $(LIB); do \ if test $$f != X; then \ ($(LT_INSTALL_LIB) $$f $(libdir)/. || exit 1); \ @@ -262,10 +317,10 @@ clean: mostlyclean -$(RM) $(LIB) $(TEST_PROGS) $(BIN) $(CLEAN) -$(RM) TAGS *~ *# core *.core -$(RM) -r .libs - -$(RM) $(top_builddir)/lib/salome/$(LIB) + -$(RM) $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/$(LIB) -$(RM) $(patsubst %,$(top_builddir)/bin/salome/%, $(BIN)) - -$(RM) $(patsubst %.la, %.so, $(top_builddir)/lib/salome/$(LIB)) - -$(RM) $(patsubst %.la, %.a, $(top_builddir)/lib/salome/$(LIB)) + -$(RM) $(patsubst %.la, %.so, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/$(LIB)) + -$(RM) $(patsubst %.la, %.a, $(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome/$(LIB)) # remove idl generated files (sources) -$(RM) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC) # remove idl generated files (headers) diff --git a/adm_local_without_kernel/config_files/ac_linker_options.m4 b/adm_local_without_kernel/config_files/ac_linker_options.m4 new file mode 100644 index 000000000..9006a46fe --- /dev/null +++ b/adm_local_without_kernel/config_files/ac_linker_options.m4 @@ -0,0 +1,57 @@ +dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +dnl +dnl +dnl +dnl @synopsis AC_LINKER_OPTIONS +dnl +dnl Check warning flags for C++ compiler to control warning messages +dnl +dnl @author Bernard Secher (CEA) - 04/12/2003 +dnl +AC_DEFUN([AC_LINKER_OPTIONS],[ + + AC_CHECKING(for LIB_LOCATION_SUFFIX) + LIB_LOCATION_SUFFIX="" + case "$build_cpu" in + x86_64*) LIB_LOCATION_SUFFIX="64" ;; + *) LIB_LOCATION_SUFFIX="" ;; + esac + AC_SUBST(LIB_LOCATION_SUFFIX) + AC_MSG_RESULT(LIB_LOCATION_SUFFIX is $LIB_LOCATION_SUFFIX) + + for opt in "-Xlinker -export-dynamic" -transitive_link; do + AC_CXX_OPTION($opt,LDEXPDYNFLAGS,flag=yes,flag=no) + if test "$flag" = "yes"; then + break + fi + done + AC_SUBST(LDEXPDYNFLAGS) + +dnl + case $host_os in + osf*) + STDLIB="-lcxxstd" + ;; + *) + STDLIB="-lstdc++" + ;; + esac + AC_SUBST(STDLIB) +]) diff --git a/adm_local_without_kernel/config_files/config.sub b/adm_local_without_kernel/config_files/config.sub new file mode 100755 index 000000000..6218dd954 --- /dev/null +++ b/adm_local_without_kernel/config_files/config.sub @@ -0,0 +1,1268 @@ +#! /bin/sh +# Configuration validation subroutine script, version 1.1. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Free Software Foundation, Inc. +# +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +if [ x$1 = x ] +then + echo Configuration name missing. 1>&2 + echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 + echo "or $0 ALIAS" 1>&2 + echo where ALIAS is a recognized configuration type. 1>&2 + exit 1 +fi + +# First pass through any local machine types. +case $1 in + *local*) + echo $1 + exit 0 + ;; + *) + ;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ + | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ + | 580 | i960 | h8300 \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ + | hppa64 \ + | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ + | alphaev6[78] \ + | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ + | mips64orion | mips64orionel | mipstx39 | mipstx39el \ + | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ + | mips64vr5000 | miprs64vr5000el | mcore \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ + | thumb | d10v | fr30 | avr) + basic_machine=$basic_machine-unknown + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i[34567]86) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + # FIXME: clean up the formatting here. + vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ + | xmp-* | ymp-* \ + | x86-* | x86_64-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ + | hppa2.0n-* | hppa64-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ + | alphaev6[78]-* \ + | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ + | clipper-* | orion-* \ + | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ + | mipstx39-* | mipstx39el-* | mcore-* \ + | f301-* | armv*-* | s390-* | sv1-* | t3e-* \ + | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ + | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \ + | bs2000-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-cbm + ;; + amigaos | amigados) + basic_machine=m68k-cbm + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-cbm + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [ctj]90-cray) + basic_machine=c90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[34567]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i[34567]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i[34567]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i[34567]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + i386-go32 | go32) + basic_machine=i386-unknown + os=-go32 + ;; + i386-mingw32 | mingw32) + basic_machine=i386-unknown + os=-mingw32 + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-unknown + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=rs6000-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sparc | sparcv9) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i[34567]86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -*MiNT) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f301-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -*MiNT) + vendor=atari + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os diff --git a/adm_local_without_kernel/config_files/production.m4 b/adm_local_without_kernel/config_files/production.m4 new file mode 100644 index 000000000..8157d677d --- /dev/null +++ b/adm_local_without_kernel/config_files/production.m4 @@ -0,0 +1,106 @@ +dnl Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +dnl +dnl +dnl +dnl define macros : +dnl AC_ENABLE_PRODUCTION AC_DISABLE_PRODUCTION +dnl and +dnl AC_ENABLE_DEBUG AC_DISABLE_DEBUG +dnl +dnl version $Id$ +dnl author Patrick GOLDBRONN +dnl + +# AC_ENABLE_PRODUCTION +AC_DEFUN([AC_ENABLE_PRODUCTION], [dnl +define([AC_ENABLE_PRODUCTION_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(production, +changequote(<<, >>)dnl +<< --enable-production[=PKGS] build without debug information [default=>>AC_ENABLE_PRODUCTION_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_production=yes ;; +no) enable_production=no ;; +*) + enable_production=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_production=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_production=AC_ENABLE_PRODUCTION_DEFAULT)dnl + +AC_CXX_OPTION(-Wno-deprecated,CXXFLAGS) +AC_CXX_OPTION(-Wparentheses,CXXFLAGS) +AC_CXX_OPTION(-Wreturn-type,CXXFLAGS) +AC_CXX_OPTION(-Wmissing-declarations,CXXFLAGS) +AC_CXX_OPTION(-fmessage-length=0,CXXFLAGS) +AC_CXX_OPTION(-Wunused,CXXFLAGS) +AC_CXX_OPTION(-pipe,CXXFLAGS) + +if test "X$enable_production" = "Xyes"; then + CFLAGS="$CFLAGS -O" + AC_CXX_OPTION(-Wuninitialized,CXXFLAGS) + CXXFLAGS="$CXXFLAGS -O " +fi +]) + +# AC_DISABLE_PRODUCTION - set the default flag to --disable-production +AC_DEFUN([AC_DISABLE_PRODUCTION], [AC_ENABLE_PRODUCTION(no)]) + +# AC_ENABLE_DEBUG +AC_DEFUN([AC_ENABLE_DEBUG], [dnl +define([AC_ENABLE_DEBUG_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(debug, +changequote(<<, >>)dnl +<< --enable-debug[=PKGS] build without debug information [default=>>AC_ENABLE_DEBUG_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_debug=yes ;; +no) enable_debug=no ;; +*) + enable_debug=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_debug=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_debug=AC_ENABLE_DEBUG_DEFAULT)dnl + +if test "X$enable_debug" = "Xyes"; then + CFLAGS="$CFLAGS -g -D_DEBUG_ " + CXXFLAGS="$CXXFLAGS -g -D_DEBUG_ " +fi +]) + +# AC_DISABLE_DEBUG - set the default flag to --disable-debug +AC_DEFUN([AC_DISABLE_DEBUG], [AC_ENABLE_DEBUG(no)]) \ No newline at end of file diff --git a/bin/VERSION b/bin/VERSION index 28be3296b..f534ec466 100755 --- a/bin/VERSION +++ b/bin/VERSION @@ -1 +1 @@ -THIS IS SALOME - MED VERSION: 3.2.0a2 +THIS IS SALOME - MED VERSION: 3.2.0b1 diff --git a/build_configure b/build_configure index 561a09d78..6a1c282ca 100755 --- a/build_configure +++ b/build_configure @@ -181,7 +181,7 @@ echo 'if test $MED_WITH_KERNEL = yes; then' >> configure.in_tmp1 echo "{" >> configure.in_tmp1 echo "AC_OUTPUT([ \\" >> configure.in_tmp1 echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1 -echo " ./adm_local/unix/make_omniorb \\" >> configure.in_tmp1 +echo " ./adm_local/unix/make_omniorb:${ABS_CONF_DIR}/adm_local/unix/make_omniorb.in \\" >> configure.in_tmp1 echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1 echo " ])" >> configure.in_tmp1 echo "}" >> configure.in_tmp1 @@ -196,8 +196,8 @@ echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1 # salome_adm, par le make_conclude (resp. make_commence) du module, # c'est à dire le make_conclude (resp. make_commence) du répertoire # adm_local -echo " ./adm_local/unix/make_commence \\" >> configure.in_tmp1 -echo " ./adm_local/unix/make_conclude \\" >> configure.in_tmp1 +echo " ./adm_local/unix/make_commence:${ABS_CONF_DIR}/adm_local/unix/make_commence.in \\" >> configure.in_tmp1 +echo " ./adm_local/unix/make_conclude:${ABS_CONF_DIR}/adm_local/unix/make_conclude.in \\" >> configure.in_tmp1 \rm -f configure.in_tmp2 configure.in_tmp3 touch configure.in_tmp2 diff --git a/configure.in.base b/configure.in.base index 0891d9967..0f5c0952e 100644 --- a/configure.in.base +++ b/configure.in.base @@ -49,7 +49,7 @@ if test "x${old_with_kernel}" != "x${MED_WITH_KERNEL}"; then echo "Configuration changed: without KERNEL -> with KERNEL" echo -n "Updating 'configure' script ... " cd $ROOT_SRCDIR - aclocal --acdir=adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files + aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files if autoconf; then echo "done" else @@ -318,6 +318,23 @@ echo CHECK_MED2 +dnl +dnl --------------------------------------------- +dnl testing MPI +dnl --------------------------------------------- +dnl + +CHECK_MPI +CHECK_MPICH + +echo +echo ---------------------------------------------- +echo testing CPPUNIT only required for unit testing +echo ---------------------------------------------- +echo + +CHECK_CPPUNIT + echo "MED_WITH_KERNEL ${MED_WITH_KERNEL}" if test "${MED_WITH_KERNEL}" = "yes"; then @@ -331,15 +348,6 @@ if test "${MED_WITH_KERNEL}" = "yes"; then dnl CHECK_JAVA - dnl - dnl --------------------------------------------- - dnl testing MPI - dnl --------------------------------------------- - dnl - - CHECK_MPI - CHECK_MPICH - echo echo --------------------------------------------- echo testing omniORB @@ -508,7 +516,7 @@ else fi # make other build directories -for rep in salome_adm adm_local doc bin/salome include/salome lib/salome share/salome/resources idl +for rep in salome_adm adm_local doc bin/salome include/salome lib${LIB_LOCATION_SUFFIX}/salome share/salome/resources idl do # if test ! -d $rep ; then # eval mkdir $rep diff --git a/doc/MEDMEM/Makefile.in b/doc/MEDMEM/Makefile.in index 7595e14ff..b06d7820e 100644 --- a/doc/MEDMEM/Makefile.in +++ b/doc/MEDMEM/Makefile.in @@ -15,20 +15,28 @@ doxygen=@DOXYGEN@ # Executables targets BIN = MESHgeneral MESHcoordinates MESHconnectivities MESHINGexample FIELDcreate FIELDgeneral MEDMEM_InvokingDriverByAttachingItToAnObject MEDMEM_InvokingDriverFromStandardObjectMethod MEDMEM_InvokingDriverAtObjectCreationTime -CPPFLAGS+=$(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS+= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome +LDFLAGSFORBIN+= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome -CXXFLAGS+=-ftemplate-depth-42 -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS+=$(MED2_INCLUDES) $(HDF5_INCLUDES) +CXXFLAGS+=@CXXTMPDPTHFLAGS@ +#LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) # change motivated by the bug KERNEL4778. -#LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lSalomeLoggerServer -L${KERNEL_ROOT_DIR}/lib/salome -LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lmedmem -lmed_V2_1 $(STDLIB) -#LDFLAGSFORBIN+=$(MED2_LIBS) $(HDF5_LIBS) -lSalomeLoggerServer -L${KERNEL_ROOT_DIR}/lib/salome -lmedmem -LDFLAGSFORBIN+=$(MED2_LIBS) $(HDF5_LIBS) -lSALOMELocalTrace -L${KERNEL_ROOT_DIR}/lib/salome -lmedmem +#LDFLAGSFORBIN+=$(MED2_LIBS) $(HDF5_LIBS) +# change motivated by the bug KERNEL4778. +LDFLAGSFORBIN+=-lm $(MED2_LIBS) $(HDF5_LIBS) -lmedmem -lmed_V2_1 -LIBSFORBIN= +ifeq ($(MED_WITH_KERNEL),yes) + CPPFLAGS+= ${KERNEL_CXXFLAGS} + CXXFLAGS+= ${KERNEL_CXXFLAGS} + LDFLAGS+= ${KERNEL_LDFLAGS} -lSALOMELocalTrace + LDFLAGSFORBIN+= ${KERNEL_LDFLAGS} -lSALOMELocalTrace -lSALOMEBasics +endif -LDFLAGS= +LIBSFORBIN= LIBS= diff --git a/doc/salome/tui/MED/doxyfile b/doc/salome/tui/MED/doxyfile index a529e1b27..7b65febdb 100755 --- a/doc/salome/tui/MED/doxyfile +++ b/doc/salome/tui/MED/doxyfile @@ -3,7 +3,7 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "SALOME - MED - v.3.2.0a2" +PROJECT_NAME = "SALOME - MED - v.3.2.0b1" PROJECT_NUMBER = id#1.1 OUTPUT_DIRECTORY = ../ CREATE_SUBDIRS = NO @@ -71,8 +71,9 @@ WARN_LOGFILE = log.txt # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = ../../../share/salome/src \ - ../../../share/salome/idl -FILE_PATTERNS = *.idl *.h *.hh *.hxx *.c *.cc *.cxx *.ixx *.jxx + ../../../share/salome/idl \ + ../../../build/salome/bin +FILE_PATTERNS = *.idl *.h *.hh *.hxx *.c *.cc *.cxx *.ixx *.jxx python_extension_must_be_here RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO diff --git a/doc/salome/tui/MED/sources/static/tree.js b/doc/salome/tui/MED/sources/static/tree.js index 46589c42c..6ea5bb6ca 100755 --- a/doc/salome/tui/MED/sources/static/tree.js +++ b/doc/salome/tui/MED/sources/static/tree.js @@ -1,4 +1,4 @@ -foldersTree = gFld("SALOME v.3.2.0a2 ", "", "") +foldersTree = gFld("SALOME v.3.2.0b1 ", "", "") insDoc(foldersTree, gLnk("Main Page", "", "main.html")) aux1 = insFld(foldersTree, gFld("TUI Reference Guide", "")) diff --git a/doc/salome/tui/Makefile.in b/doc/salome/tui/Makefile.in index 1c1967600..5434c5517 100644 --- a/doc/salome/tui/Makefile.in +++ b/doc/salome/tui/Makefile.in @@ -20,6 +20,17 @@ docs: cp -fr $(srcdir)/MED ./INPUT; \ cd INPUT; \ sed 's|../../../share/salome|$(root_srcdir)|' ./doxyfile > ./doxyfile1; \ + sed 's|../../build/salome|$(top_builddir)|' ./doxyfile1 > ./doxyfile2; \ + mv -f doxyfile2 doxyfile1; \ + echo "DOXYGEN SUPPORT PYTHON - @DOXYGEN_WITH_PYTHON@"; \ + if( test "x@DOXYGEN_WITH_PYTHON@" = "xyes"); then \ + sed 's|python_extension_must_be_here|*.py|' ./doxyfile1 > ./doxyfile2; \ + mv -f doxyfile2 doxyfile1; \ + $(doxygen) -u ./doxyfile1; \ + else \ + sed 's|python_extension_must_be_here||' ./doxyfile1 > ./doxyfile2; \ + mv -f doxyfile2 doxyfile1; \ + fi; \ mv -f doxyfile1 doxyfile; \ $(doxygen) ./doxyfile; \ cd ..; \ diff --git a/idl/Compo1Py.idl b/idl/Compo1Py.idl index 5b53f9db0..35b2fbd1a 100644 --- a/idl/Compo1Py.idl +++ b/idl/Compo1Py.idl @@ -20,10 +20,10 @@ #include "SALOME_Component.idl" #include "MED.idl" -module Engines +module Compo1Py_ORB { - interface Compo1Py : Component + interface Compo1Py : Engines::Component { void Initialise(in string medFile); SALOME_MED::MESH Calcul1(); diff --git a/idl/Makefile.in b/idl/Makefile.in index 076128e90..a0f1340a8 100644 --- a/idl/Makefile.in +++ b/idl/Makefile.in @@ -30,7 +30,7 @@ $(IDL_FILES:%=$(top_builddir)/idl/salome/%):$(IDL_FILES:%=$(top_srcdir)/idl/%) lib: pyidl -PYTHON_BUILD_SITE=$(top_builddir)/lib/python$(PYTHON_VERSION)/site-packages/@PACKAGE@ +PYTHON_BUILD_SITE=$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/python$(PYTHON_VERSION)/site-packages/@PACKAGE@ pyidl: $(PYTHON_BUILD_SITE) $(IDL_FILES:%.idl=$(PYTHON_BUILD_SITE)/%_idl.py) diff --git a/resources/MEDCatalog.xml b/resources/MEDCatalog.xml index 2c28419e0..d610f69eb 100644 --- a/resources/MEDCatalog.xml +++ b/resources/MEDCatalog.xml @@ -16,7 +16,7 @@ Med MESH Patrick GOLDBRONN - 3.2.0a2 + 3.2.0b1 MED memory component 1 ModuleMed.png diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml new file mode 100644 index 000000000..8760c1bb3 --- /dev/null +++ b/resources/SalomeApp.xml @@ -0,0 +1,11 @@ + +
+ + + +
+
+ + +
+
diff --git a/resources/geomMesh21.med b/resources/geomMesh21.med new file mode 100644 index 000000000..7f78a8e93 Binary files /dev/null and b/resources/geomMesh21.med differ diff --git a/resources/geomMesh22.med b/resources/geomMesh22.med new file mode 100644 index 000000000..92879c15c Binary files /dev/null and b/resources/geomMesh22.med differ diff --git a/resources/maill.00.med b/resources/maill.00.med new file mode 100644 index 000000000..34effd924 Binary files /dev/null and b/resources/maill.00.med differ diff --git a/resources/maill.00_nofield.med b/resources/maill.00_nofield.med new file mode 100644 index 000000000..56d95456d Binary files /dev/null and b/resources/maill.00_nofield.med differ diff --git a/resources/maill.00_nomesh.med b/resources/maill.00_nomesh.med new file mode 100644 index 000000000..0edf163ff Binary files /dev/null and b/resources/maill.00_nomesh.med differ diff --git a/resources/maill.00_without_seg2.med b/resources/maill.00_without_seg2.med new file mode 100644 index 000000000..0edfd8e22 Binary files /dev/null and b/resources/maill.00_without_seg2.med differ diff --git a/resources/zzzz121b_without_tr6.med b/resources/zzzz121b_without_tr6.med new file mode 100644 index 000000000..810e2f260 Binary files /dev/null and b/resources/zzzz121b_without_tr6.med differ diff --git a/src/INTERPOLATION/MEDMEM_WrapperCells.hxx b/src/INTERPOLATION/MEDMEM_WrapperCells.hxx index ab8af2996..c37fafc73 100644 --- a/src/INTERPOLATION/MEDMEM_WrapperCells.hxx +++ b/src/INTERPOLATION/MEDMEM_WrapperCells.hxx @@ -553,7 +553,7 @@ public : type=5; int pn[4] = {0,1,2,3}; - int sb[12] = {2,0,1,3,1,2,0,2,3,1,0,2}; + int sb[12] = {2,0,1,3,1,2,0,2,3,1,3,0}; int fa[8] = {0,1,1,2,2,3,3,0}; int po[5] = {0,2,4,6,8}; nbr_noeuds = 4; @@ -590,7 +590,7 @@ public : type=6; int pn[4] = {0,1,2,3}; - int sb[12] = {2,0,1,3,1,2,0,2,3,1,0,2}; + int sb[12] = {2,0,1,3,1,2,0,2,3,1,3,0}; int fa[8] = {0,1,1,2,2,3,3,0}; int po[5] = {0,2,4,6,8}; nbr_noeuds = 8; diff --git a/src/INTERPOLATION/Makefile.in b/src/INTERPOLATION/Makefile.in index 7e566ea9d..50683a716 100644 --- a/src/INTERPOLATION/Makefile.in +++ b/src/INTERPOLATION/Makefile.in @@ -88,13 +88,13 @@ LDFLAGS+=-lm $(MED2_LIBS) $(HDF5_LIBS) -lmed_V2_1 LDFLAGSFORBIN+=-lm $(MED2_LIBS) $(HDF5_LIBS) -L../.libs -lmedmem -lmed_V2_1 ifeq ($(MED_WITH_KERNEL),yes) - CPPFLAGS+= -I${KERNEL_ROOT_DIR}/include/salome - CXXFLAGS+= -I${KERNEL_ROOT_DIR}/include/salome - #LDFLAGS+= -lSalomeLoggerServer -L${KERNEL_ROOT_DIR}/lib/salome - LDFLAGS+= -lSALOMELocalTrace -L${KERNEL_ROOT_DIR}/lib/salome + CPPFLAGS+= ${KERNEL_CXXFLAGS} + CXXFLAGS+= ${KERNEL_CXXFLAGS} + #LDFLAGS+= -lSalomeLoggerServer ${KERNEL_LDFLAGS} + LDFLAGS+= -lSALOMELocalTrace ${KERNEL_LDFLAGS} - #LDFLAGSFORBIN+= -lSalomeLoggerServer -L${KERNEL_ROOT_DIR}/lib/salome - LDFLAGSFORBIN+= -lSALOMELocalTrace -lSALOMEBasics -L${KERNEL_ROOT_DIR}/lib/salome + #LDFLAGSFORBIN+= -lSalomeLoggerServer ${KERNEL_LDFLAGS} + LDFLAGSFORBIN+= -lSALOMELocalTrace -lSALOMEBasics ${KERNEL_LDFLAGS} endif LIBSFORBIN= diff --git a/src/MED/Makefile.in b/src/MED/Makefile.in index ce244f6ce..5a4598675 100644 --- a/src/MED/Makefile.in +++ b/src/MED/Makefile.in @@ -49,15 +49,15 @@ LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_ModuleCatalog.idl S BIN = BIN_SRC = -LDFLAGS= -L$(top_builddir)/lib/salome -LDFLAGSFORBIN= -L$(top_builddir)/lib/salome +LDFLAGS= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome +LDFLAGSFORBIN= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome # additionnal information to compil and link file -CPPFLAGS += $(OCC_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS += $(OCC_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) ${KERNEL_CXXFLAGS} +CXXFLAGS += $(OCC_CXXFLAGS) ${KERNEL_CXXFLAGS} -LDFLAGS+= $(OCC_LIBS) $(HDF5_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome \ +LDFLAGS+= $(OCC_LIBS) $(HDF5_LIBS) ${KERNEL_LDFLAGS} \ -lSalomeContainer -lSalomeHDFPersist -lSalomeDS -lSalomeNS -lRegistry -lOpUtil -lMEDMEMImpl MED.hh MEDSK.cc: MED.idl diff --git a/src/MED/Med_Gen_i.cxx b/src/MED/Med_Gen_i.cxx index cfa3c0429..e95211da5 100755 --- a/src/MED/Med_Gen_i.cxx +++ b/src/MED/Med_Gen_i.cxx @@ -407,7 +407,7 @@ throw (SALOME::SALOME_Exception) SCRUTE(myIteration.size()); } */ - myField = mymed->getField(fieldName,iter,ordre); + myField = mymed->getField(fieldName,ordre,iter); } catch (const std::exception & ex) { diff --git a/src/MEDGUI/Makefile.in b/src/MEDGUI/Makefile.in index f6fdb6d63..920db6059 100644 --- a/src/MEDGUI/Makefile.in +++ b/src/MEDGUI/Makefile.in @@ -58,9 +58,9 @@ LIB_SERVER_IDL = # additionnal information to compil and link file -CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome ${BOOST_CPPFLAGS} +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) ${KERNEL_CXXFLAGS} ${GUI_CXXFLAGS} ${BOOST_CPPFLAGS} -LDFLAGS += -lSalomeApp -lMEDMEMImpl -lmedmem -lMEDEngine -L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome +LDFLAGS += -lSalomeApp -lMEDMEMImpl -lmedmem -lMEDEngine ${KERNEL_LDFLAGS} ${GUI_LDFLAGS} MED.hh MEDSK.cc: MED.idl omniidl -bcxx -Wbtp -I$(top_builddir)/idl -I${KERNEL_ROOT_DIR}/idl/salome $^ diff --git a/src/MEDMEM/DataTest/Data/maill.00.med b/src/MEDMEM/DataTest/Data/maill.00.med deleted file mode 100644 index 34effd924..000000000 Binary files a/src/MEDMEM/DataTest/Data/maill.00.med and /dev/null differ diff --git a/src/MEDMEM/DataTest/Data/maill.00_nofield.med b/src/MEDMEM/DataTest/Data/maill.00_nofield.med deleted file mode 100644 index 56d95456d..000000000 Binary files a/src/MEDMEM/DataTest/Data/maill.00_nofield.med and /dev/null differ diff --git a/src/MEDMEM/DataTest/Data/maill.00_nomesh.med b/src/MEDMEM/DataTest/Data/maill.00_nomesh.med deleted file mode 100644 index 0edf163ff..000000000 Binary files a/src/MEDMEM/DataTest/Data/maill.00_nomesh.med and /dev/null differ diff --git a/src/MEDMEM/DataTest/Data/maill.00_without_seg2.med b/src/MEDMEM/DataTest/Data/maill.00_without_seg2.med deleted file mode 100644 index 0edfd8e22..000000000 Binary files a/src/MEDMEM/DataTest/Data/maill.00_without_seg2.med and /dev/null differ diff --git a/src/MEDMEM/DataTest/Data/zzzz121b_without_tr6.med b/src/MEDMEM/DataTest/Data/zzzz121b_without_tr6.med deleted file mode 100644 index 810e2f260..000000000 Binary files a/src/MEDMEM/DataTest/Data/zzzz121b_without_tr6.med and /dev/null differ diff --git a/src/MEDMEM/MEDMEM_DriverFactory.cxx b/src/MEDMEM/MEDMEM_DriverFactory.cxx index b75a172b6..ddcd4866a 100644 --- a/src/MEDMEM/MEDMEM_DriverFactory.cxx +++ b/src/MEDMEM/MEDMEM_DriverFactory.cxx @@ -61,6 +61,24 @@ void DRIVERFACTORY::setMedFileVersionForWriting(medFileVersion version) DRIVERFACTORY::globalMedFileVersionForWriting = version; } +driverTypes DRIVERFACTORY::deduceDriverTypeFromFileName(const std::string & fileName) +{ + string extension(fileName); + unsigned int pos=extension.rfind('.'); + if(pos==string::npos) + return NO_DRIVER; + extension.erase(0,pos+1); + if(extension=="med") + return MED_DRIVER; + if(extension=="sauve" || extension=="sauv") + return GIBI_DRIVER; + if(extension=="cnc" || extension=="inp" || extension=="xyz") + return PORFLOW_DRIVER; + if(extension=="vtk") + return VTK_DRIVER; + return NO_DRIVER; +} + GENDRIVER *DRIVERFACTORY::buildDriverForMesh(driverTypes driverType, const std::string & fileName, MESH *mesh, @@ -180,7 +198,7 @@ GENDRIVER *DRIVERFACTORY::buildDriverForMed(driverTypes driverType, break ; } case MED_REMP : { - ret=new MED_MED_RDONLY_DRIVER(fileName,med); + ret=new MED_MED_RDWR_DRIVER(fileName,med); break ; } default: diff --git a/src/MEDMEM/MEDMEM_DriverFactory.hxx b/src/MEDMEM/MEDMEM_DriverFactory.hxx index 90e524d74..8249ac830 100644 --- a/src/MEDMEM/MEDMEM_DriverFactory.hxx +++ b/src/MEDMEM/MEDMEM_DriverFactory.hxx @@ -47,6 +47,8 @@ namespace MEDMEM { void setMedFileVersionForWriting(MED_EN::medFileVersion version); + driverTypes deduceDriverTypeFromFileName(const std::string & fileName); + GENDRIVER * buildDriverForMesh(driverTypes driverType, const std::string & fileName, MESH *mesh,const string & driverName, diff --git a/src/MEDMEM/MEDMEM_Field.hxx b/src/MEDMEM/MEDMEM_Field.hxx index 32c17117a..5f06aafe9 100644 --- a/src/MEDMEM/MEDMEM_Field.hxx +++ b/src/MEDMEM/MEDMEM_Field.hxx @@ -739,6 +739,7 @@ public: const int getNumberOfGeometricTypes() const throw (MEDEXCEPTION); const GAUSS_LOCALIZATION & getGaussLocalization(MED_EN::medGeometryElement geomElement) const throw (MEDEXCEPTION); + const GAUSS_LOCALIZATION * getGaussLocalizationPtr(MED_EN::medGeometryElement geomElement) const throw (MEDEXCEPTION); const int * getNumberOfGaussPoints() const throw (MEDEXCEPTION); const int getNumberOfGaussPoints( MED_EN::medGeometryElement geomElement) const throw (MEDEXCEPTION); const int getNbGaussI(int i) const throw (MEDEXCEPTION); @@ -2592,6 +2593,22 @@ FIELD::getGaussLocalization(MED_EN::medGeometryElement geomEl }; +template const GAUSS_LOCALIZATION * +FIELD::getGaussLocalizationPtr(MED_EN::medGeometryElement geomElement) const throw (MEDEXCEPTION) +{ + const char * LOC ="getGaussLocalizationPtr(MED_EN::medGeometryElement geomElement) : "; + const GAUSS_LOCALIZATION_ * locPtr=0; + + locMap::const_iterator it; + if ( ( it = _gaussModel.find(geomElement)) != _gaussModel.end() ) { + locPtr = (*it).second; + return static_cast *>(locPtr); + } + else + throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"Can't find any GaussLocalization on this geometric type" )); + +}; + /*! Returns number of Gauss points for this medGeometryElement. diff --git a/src/MEDMEM/MEDMEM_GaussLocalization.hxx b/src/MEDMEM/MEDMEM_GaussLocalization.hxx index b488cb304..8705bfbd7 100644 --- a/src/MEDMEM/MEDMEM_GaussLocalization.hxx +++ b/src/MEDMEM/MEDMEM_GaussLocalization.hxx @@ -73,8 +73,11 @@ namespace MEDMEM { inline MED_EN::medModeSwitch getInterlacingType() const { return _interlacingType;} }; - template GAUSS_LOCALIZATION::GAUSS_LOCALIZATION() throw (MEDEXCEPTION) : _typeGeo(MED_EN::MED_NONE), _nGauss(-1), - _interlacingType(_interlacingType( SET_INTERLACING_TYPE::_interlacingType)) {}; + template GAUSS_LOCALIZATION::GAUSS_LOCALIZATION() throw (MEDEXCEPTION) : + _typeGeo(MED_EN::MED_NONE), _nGauss(-1), + _interlacingType( SET_INTERLACING_TYPE::_interlacingType) + {}; + template GAUSS_LOCALIZATION::GAUSS_LOCALIZATION(const string & locName, const MED_EN::medGeometryElement typeGeo, const int nGauss, diff --git a/src/MEDMEM/MEDMEM_GenDriver.cxx b/src/MEDMEM/MEDMEM_GenDriver.cxx index 9b88dab9e..21a471548 100644 --- a/src/MEDMEM/MEDMEM_GenDriver.cxx +++ b/src/MEDMEM/MEDMEM_GenDriver.cxx @@ -160,7 +160,8 @@ bool MEDMEM::GENDRIVER::operator ==(const GENDRIVER &genDriver) const { MESSAGE(LOC); return ( _id == genDriver._id ) && - ( _driverType == genDriver._driverType ); + ( _driverType == genDriver._driverType ) && + (_accessMode == genDriver._accessMode); }; diff --git a/src/MEDMEM/MEDMEM_GibiMeshDriver.cxx b/src/MEDMEM/MEDMEM_GibiMeshDriver.cxx index 269383e31..779cafce5 100644 --- a/src/MEDMEM/MEDMEM_GibiMeshDriver.cxx +++ b/src/MEDMEM/MEDMEM_GibiMeshDriver.cxx @@ -225,21 +225,21 @@ bool GIBI_MESH_RDONLY_DRIVER::readFile (_intermediateMED* medi, bool readFields const char* s = " NIVEAU 15 NIVEAU ERREUR 0 DIMENSION"; space_dimension = atoi( ligne + strlen( s ) + 1 ); if ( !GIBI_EQUAL( ligne, " NIVEAU" ) || space_dimension < 1 ) { - INFOS( " Could not read file: syntax error in type 4 record"); + INFOS( " Could not read file: syntax error in type 4 record" << DUMP_LINE_NB ); return false; } } else if (numero_enregistrement == ENREG_TYPE_2 ) { if ( space_dimension == 0 ) { - INFOS( "Missing ENREGISTREMENT DE TYPE 4"); + INFOS( "Missing ENREGISTREMENT DE TYPE 4" << DUMP_LINE_NB ); return false; } // FORMAT(' PILE NUMERO',I4,'NBRE OBJETS NOMMES',I8,'NBRE OBJETS',I8) getNextLine(ligne); const char *s1 = " PILE NUMERO", *s2 = "NBRE OBJETS NOMMES", *s3 = "NBRE OBJETS"; if ( ! GIBI_EQUAL( ligne, s1 ) ) { - INFOS( " Could not read file: error in type 2 record. " << ligne); + INFOS( " Could not read file: error in type 2 record. " << ligne << DUMP_LINE_NB ); return false; } ligne = ligne + strlen(s1); @@ -249,7 +249,7 @@ bool GIBI_MESH_RDONLY_DRIVER::readFile (_intermediateMED* medi, bool readFields ligne = ligne + 8 + strlen(s3); nb_objets = atoi( ligne ); if ( nb_objets_nommes<0 || nb_objets<0 ) { - INFOS(" Could not read file: " << nb_objets << " " < medi->groupes.size() ) { - INFOS("Error of field reading: wrong mesh reference "<< support_ids[ i_sub ]); + INFOS("Error of field reading: wrong mesh reference "<< + support_ids[ i_sub ] << DUMP_LINE_NB ); return false; } nb_values[ i_sub ] = getInt(); next(); // (b) nb points total_nb_values += nb_values[ i_sub ]; if ( nb_values[ i_sub ] < 0 ) { - INFOS(" Wrong nb of points: " << nb_values[ i_sub ] ); + INFOS(" Wrong nb of points: " << nb_values[ i_sub ] << DUMP_LINE_NB ); return false; } nb_comps[ i_sub ] = getInt(); next(); // (c) nb of components in i_sub @@ -607,13 +611,17 @@ bool GIBI_MESH_RDONLY_DRIVER::readFile (_intermediateMED* medi, bool readFields if ( ignoreField ) INFOS("Skip non-named field " << objet+1 << DUMP_LINE_NB); #endif - initIntReading( 1 ); + initIntReading( 4 ); int i_sub, nb_sub = getInt(); // (1) 2 6 if ( nb_sub < 1 ) { - INFOS("Error of field reading: wrong nb of subcomponents " << nb_sub); + INFOS("Error of field reading: wrong nb of subcomponents " << + nb_sub << DUMP_LINE_NB ); return false; } - getNextLine( ligne ); // (2) title + next(); next(); next(); // skip (1) <nb_sub> 2 6 + int title_length = getInt(); // <title length> + if ( title_length ) + getNextLine( ligne ); // (2) title // look for a line starting with '-' : <reference to support> do { initIntReading( nb_sub * 9 ); @@ -629,11 +637,13 @@ bool GIBI_MESH_RDONLY_DRIVER::readFile (_intermediateMED* medi, bool readFields for ( i = 0; i < 6; ++i ) // ignore 6 ints, in example 0 0 0 -2 0 3 next(); if ( support_ids[ i_sub ] < 1 || support_ids[ i_sub ] > medi->groupes.size() ) { - INFOS("Error of field reading: wrong mesh reference "<< support_ids[ i_sub ]); + INFOS("Error of field reading: wrong mesh reference "<< + support_ids[ i_sub ] << DUMP_LINE_NB ); return false; } if ( nb_comp[ i_sub ] < 1 ) { - INFOS("Error of field reading: wrong nb of components " << nb_comp[ i_sub ]); + INFOS("Error of field reading: wrong nb of components " << + nb_comp[ i_sub ] << DUMP_LINE_NB ); return false; } total_nb_comp += nb_comp[ i_sub ]; @@ -665,7 +675,8 @@ bool GIBI_MESH_RDONLY_DRIVER::readFile (_intermediateMED* medi, bool readFields // component types must be the same if ( index() > 0 && comp_type[ index() ] != comp_type[ index() - 1] ) { INFOS( "Error of field reading: diff component types <" - << comp_type[ index() ] << "> != <" << comp_type[ index() - 1 ] << ">"); + << comp_type[ index() ] << "> != <" << comp_type[ index() - 1 ] + << ">" << DUMP_LINE_NB ); return false; } } @@ -1118,11 +1129,86 @@ static void getReverseVector (const medGeometryElement type, swapVec[4] = make_pair( 12, 15 ); swapVec[5] = make_pair( 13, 14 ); swapVec[6] = make_pair( 17, 19 ); + break; + case MED_TRIA6: + swapVec.resize(2); + swapVec[0] = make_pair( 1, 2 ); + swapVec[1] = make_pair( 3, 5 ); + break; + case MED_QUAD8: + swapVec.resize(3); + swapVec[0] = make_pair( 1, 3 ); + swapVec[1] = make_pair( 4, 7 ); + swapVec[2] = make_pair( 5, 6 ); + break; default:; } END_OF("void getReverseVector()"); } +//======================================================================= +//function : reverse +//purpose : inverse element orientation using vector of indices to swap +//======================================================================= + +static void reverse(const _maille & aMaille, const vector<pair<int,int> > & swapVec ) +{ + _maille* ma = (_maille*) & aMaille; + for ( int i = 0; i < swapVec.size(); ++i ) { + _maille::iter tmp = ma->sommets[ swapVec[i].first ]; + ma->sommets[ swapVec[i].first ] = ma->sommets[ swapVec[i].second ]; + ma->sommets[ swapVec[i].second ] = tmp; + } + if ( swapVec.empty() ) + ma->reverse = true; + else + ma->reverse = false; +} + +//======================================================================= +//function : getGibi2MedConnectivity +//purpose : return array of indices to transform GIBI connectivity to MED one +//======================================================================= + +static const int * getGibi2MedConnectivity( const medGeometryElement type ) +{ + static vector<const int*> conn; + static int hexa20 [] = {0,6,4,2, 12,18,16,14, 7,5,3,1, 19,17,15,13, 8,11,10,9}; + static int penta15[] = {0,2,4, 9,11,13, 1,3,5, 10,12,14, 6,7,3}; + static int pyra13 [] = {0,2,4,6, 12, 1,3,5,7, 8,9,10,11}; + static int tetra10[] = {0,2,4, 9, 1,3,5, 6,7,8}; + static int quad8 [] = {0,2,4,6, 1,3,5,7}; + static int tria6 [] = {0,2,4, 1,3,5}; + if ( conn.empty() ) { + conn.resize( MED_HEXA20 + 1, 0 ); + conn[ MED_HEXA20 ] = hexa20; + conn[ MED_PENTA15] = penta15; + conn[ MED_PYRA13 ] = pyra13; + conn[ MED_TETRA10] = tetra10; + conn[ MED_TRIA6 ] = tria6; + conn[ MED_QUAD8 ] = quad8; + } + return conn[ type ]; +} + +//======================================================================= +//function : fixConnectivity +//purpose : GIBI connectivity -> MED one +//======================================================================= + +static inline void fixConnectivity(const _maille & aMaille ) +{ + if ( const int * conn = getGibi2MedConnectivity( aMaille.geometricType )) { + _maille* ma = (_maille*) & aMaille; + //cout << "###### BEFORE fixConnectivity() " << *ma << endl; + vector< _maille::iter > newSommets( ma->sommets.size() ); + for ( int i = 0; i < newSommets.size(); ++i ) + newSommets[ i ] = ma->sommets[ conn[ i ]]; + ma->sommets = newSommets; + //cout << "###### AFTER fixConnectivity() " << *ma << endl; + } +} + //======================================================================= //function : orientElements //purpose : @@ -1133,6 +1219,9 @@ static void orientElements( _intermediateMED& medi ) MESSAGE("orientElements()"); set<_maille>::iterator elemIt = medi.maillage.begin(); + int type = -100; + vector< pair<int,int> > swapVec; + if ( elemIt->sommets[0]->second.coord.size() == 2 ) { // space dimension // -------------------------- @@ -1142,8 +1231,13 @@ static void orientElements( _intermediateMED& medi ) for ( ; elemIt != medi.maillage.end(); elemIt++ ) if ( elemIt->dimension() == 2 ) { + // fix connectivity of quadratic faces + fixConnectivity( *elemIt ); + // look for index of the most left node int iLeft = 0, iNode, nbNodes = elemIt->sommets.size(); + if ( nbNodes > 4 ) // quadratic face + nbNodes /= 2; double minX = elemIt->sommets[0]->second.coord[0]; for ( iNode = 1; iNode < nbNodes; ++iNode ) { @@ -1173,113 +1267,22 @@ static void orientElements( _intermediateMED& medi ) yLN /= modLN; // summury direction of neighboring links must be positive bool clockwise = ( yPL + yLN > 0 ); - elemIt->reverse = ( !clockwise ); + if ( !clockwise ) { + if ( elemIt->geometricType != type ) { + type = elemIt->geometricType; + getReverseVector( type, swapVec ); + } + reverse( *elemIt, swapVec ); + } } } } else { - int type = -100; - vector< pair<int,int> > swapVec; - for ( ; elemIt != medi.maillage.end(); elemIt++ ) { - if ( elemIt->dimension() == 3 ) - { - // --------------------------------------------------- - // Orient volumes according to MED conventions: - // normal of a bottom (first) face should be downward - // --------------------------------------------------- - - int nbBottomNodes = 0; - switch ( elemIt->geometricType ) { - case MED_TETRA4: - case MED_TETRA10: - case MED_PENTA6: - case MED_PENTA15: - nbBottomNodes = 3; break; - case MED_PYRA5: - case MED_PYRA13: - case MED_HEXA8: - case MED_HEXA20: - nbBottomNodes = 4; break; - default: continue; - } - // find a normal to the bottom face - const _noeud* n[4] = { - &elemIt->sommets[0]->second, // 3 bottom nodes - &elemIt->sommets[1]->second, - &elemIt->sommets[2]->second, - &elemIt->sommets[nbBottomNodes]->second };// a top node - double vec01 [3] = { // vector n[0]-n[1] - n[1]->coord[0] - n[0]->coord[0], - n[1]->coord[1] - n[0]->coord[1], - n[1]->coord[2] - n[0]->coord[2], }; - double vec02 [3] = { // vector n[0]-n[2] - n[2]->coord[0] - n[0]->coord[0], - n[2]->coord[1] - n[0]->coord[1], - n[2]->coord[2] - n[0]->coord[2] }; - double normal [3] = { // vec01 ^ vec02 - vec01[1] * vec02[2] - vec01[2] * vec02[1], - vec01[2] * vec02[0] - vec01[0] * vec02[2], - vec01[0] * vec02[1] - vec01[1] * vec02[0] }; - // check if the 102 angle is convex - if ( nbBottomNodes > 3 ) { - const _noeud* n3 = &elemIt->sommets[nbBottomNodes-1]->second;// last bottom node - double vec03 [3] = { // vector n[0]-n3 - n3->coord[0] - n[0]->coord[0], - n3->coord[1] - n[0]->coord[1], - n3->coord[2] - n[0]->coord[2], }; - if ( fabs( normal[0]+normal[1]+normal[2] ) <= DBL_MIN ) { // vec01 || vec02 - normal[0] = vec01[1] * vec03[2] - vec01[2] * vec03[1]; // vec01 ^ vec03 - normal[1] = vec01[2] * vec03[0] - vec01[0] * vec03[2]; - normal[2] = vec01[0] * vec03[1] - vec01[1] * vec03[0]; - } - else { - double vec [3] = { // normal ^ vec01 - normal[1] * vec01[2] - normal[2] * vec01[1], - normal[2] * vec01[0] - normal[0] * vec01[2], - normal[0] * vec01[1] - normal[1] * vec01[0] }; - double dot2 = vec[0]*vec03[0] + vec[1]*vec03[1] + vec[2]*vec03[2]; // vec*vec03 - if ( dot2 < 0 ) { // concave -> reverse normal - normal[0] *= -1; - normal[1] *= -1; - normal[2] *= -1; - } - } - } - // direction from top to bottom - vector<double> tbDir(3); - tbDir[0] = n[0]->coord[0] - n[3]->coord[0]; - tbDir[1] = n[0]->coord[1] - n[3]->coord[1]; - tbDir[2] = n[0]->coord[2] - n[3]->coord[2]; - // compare 2 directions: normal and top-bottom - double dot = normal[0]*tbDir[0] + normal[1]*tbDir[1] + normal[2]*tbDir[2]; - bool reverse = ( dot < 0. ); - if ( reverse ) { - if ( elemIt->geometricType != type ) { - type = elemIt->geometricType; - getReverseVector( type, swapVec ); -// INFOS("vec01: " <<vec01[0] << " " <<vec01[1] << " " << vec01[2]); -// INFOS("vec02: " <<vec02[0] << " " <<vec02[1] << " " << vec02[2]); -// INFOS("normal: " <<normal[0] << " " <<normal[1] << " " << normal[2]); -// INFOS("tb: " << tbDir[0] << " " <<tbDir[1] << " " << tbDir[2]); -// INFOS( *elemIt ); -// for ( vector< _maille::iter >::const_iterator si = elemIt->sommets.begin(); -// si != elemIt->sommets.end(); si++ ) -// INFOS( (*si)->second ); - } - _maille* ma = (_maille*) & (*elemIt); - for ( int i = 0; i < swapVec.size(); ++i ) { - _maille::iter tmp = ma->sommets[ swapVec[i].first ]; - ma->sommets[ swapVec[i].first ] = ma->sommets[ swapVec[i].second ]; - ma->sommets[ swapVec[i].second ] = tmp; - } - } - } // dimension() == 3 - } // loop on maillage - // -------------------------------------- // orient equally all connected 3D faces // -------------------------------------- + // quadratic faces will be reversed in the following fixConnectivity(); // fill map of links and their faces set<const _maille*> faces; @@ -1396,6 +1399,106 @@ static void orientElements( _intermediateMED& medi ) if ( !manifold ) INFOS(" -> Non manifold mesh, faces orientation may be incorrect"); + + // --------------------------------------------------- + // Orient volumes according to MED conventions: + // normal of a bottom (first) face should be downward, + // fix connectivity of quadratic elements + // --------------------------------------------------- + + for ( ; elemIt != medi.maillage.end(); elemIt++ ) { + + // GIBI connectivity -> MED one + fixConnectivity( *elemIt ); + + // reverse quadratic faces + if ( elemIt->reverse ) { + if ( elemIt->geometricType != type ) { + type = elemIt->geometricType; + getReverseVector( type, swapVec ); + } + reverse ( *elemIt, swapVec ); + } + + // treate volumes + if ( elemIt->dimension() == 3 ) + { + int nbBottomNodes = 0; + switch ( elemIt->geometricType ) { + case MED_TETRA4: + case MED_TETRA10: + case MED_PENTA6: + case MED_PENTA15: + nbBottomNodes = 3; break; + case MED_PYRA5: + case MED_PYRA13: + case MED_HEXA8: + case MED_HEXA20: + nbBottomNodes = 4; break; + default: continue; + } + + // find a normal to the bottom face + const _noeud* n[4] = { + &elemIt->sommets[0]->second, // 3 bottom nodes + &elemIt->sommets[1]->second, + &elemIt->sommets[2]->second, + &elemIt->sommets[nbBottomNodes]->second };// a top node + double vec01 [3] = { // vector n[0]-n[1] + n[1]->coord[0] - n[0]->coord[0], + n[1]->coord[1] - n[0]->coord[1], + n[1]->coord[2] - n[0]->coord[2], }; + double vec02 [3] = { // vector n[0]-n[2] + n[2]->coord[0] - n[0]->coord[0], + n[2]->coord[1] - n[0]->coord[1], + n[2]->coord[2] - n[0]->coord[2] }; + double normal [3] = { // vec01 ^ vec02 + vec01[1] * vec02[2] - vec01[2] * vec02[1], + vec01[2] * vec02[0] - vec01[0] * vec02[2], + vec01[0] * vec02[1] - vec01[1] * vec02[0] }; + // check if the 102 angle is convex + if ( nbBottomNodes > 3 ) { + const _noeud* n3 = &elemIt->sommets[nbBottomNodes-1]->second;// last bottom node + double vec03 [3] = { // vector n[0]-n3 + n3->coord[0] - n[0]->coord[0], + n3->coord[1] - n[0]->coord[1], + n3->coord[2] - n[0]->coord[2], }; + if ( fabs( normal[0]+normal[1]+normal[2] ) <= DBL_MIN ) { // vec01 || vec02 + normal[0] = vec01[1] * vec03[2] - vec01[2] * vec03[1]; // vec01 ^ vec03 + normal[1] = vec01[2] * vec03[0] - vec01[0] * vec03[2]; + normal[2] = vec01[0] * vec03[1] - vec01[1] * vec03[0]; + } + else { + double vec [3] = { // normal ^ vec01 + normal[1] * vec01[2] - normal[2] * vec01[1], + normal[2] * vec01[0] - normal[0] * vec01[2], + normal[0] * vec01[1] - normal[1] * vec01[0] }; + double dot2 = vec[0]*vec03[0] + vec[1]*vec03[1] + vec[2]*vec03[2]; // vec*vec03 + if ( dot2 < 0 ) { // concave -> reverse normal + normal[0] *= -1; + normal[1] *= -1; + normal[2] *= -1; + } + } + } + // direction from top to bottom + vector<double> tbDir(3); + tbDir[0] = n[0]->coord[0] - n[3]->coord[0]; + tbDir[1] = n[0]->coord[1] - n[3]->coord[1]; + tbDir[2] = n[0]->coord[2] - n[3]->coord[2]; + // compare 2 directions: normal and top-bottom + double dot = normal[0]*tbDir[0] + normal[1]*tbDir[1] + normal[2]*tbDir[2]; + if ( dot < 0. ) { // need reverse + if ( elemIt->geometricType != type ) { + type = elemIt->geometricType; + getReverseVector( type, swapVec ); + } + reverse( *elemIt, swapVec ); + } + } // dimension() == 3 + } // loop on maillage + + } // space dimension == 3 } @@ -1802,6 +1905,19 @@ void GIBI_MESH_WRONLY_DRIVER::writeElements (medGeometryElement geomType, char* zeroI8 = " 0"; // FORMAT(I8) int nbElemNodes = geomType % 100; + // indices to transform MED connectivity to GIBI one + vector< int > toGibiConn; + toGibiConn.reserve( nbElemNodes ); + if ( const int * toMedConn = getGibi2MedConnectivity( geomType )) { + toGibiConn.resize( nbElemNodes ); + for ( int i = 0; i < nbElemNodes; ++i ) + toGibiConn[ toMedConn[ i ]] = i; + } + else { + while ( toGibiConn.size() < nbElemNodes ) + toGibiConn.push_back( toGibiConn.size() ); + } + // count total nb of elements int nbElements = 0; list< typeData >::iterator td = typeDataList.begin(); @@ -1844,7 +1960,7 @@ void GIBI_MESH_WRONLY_DRIVER::writeElements (medGeometryElement geomType, { int nodeId = nodalConnectIndex[ iElem - 1 ] - 1; for ( int iNode = 0; iNode < nbElemNodes; ++iNode, fcount++ ) { - _gibi << setw(8) << nodalConnect[ nodeId++ ]; + _gibi << setw(8) << nodalConnect[ nodeId + toGibiConn[ iNode ]]; } } } @@ -2170,10 +2286,14 @@ void GIBI_MESH_WRONLY_DRIVER::writeSupportsAndMesh() _gibi.setf( ios_base::uppercase ); const double * coords = _ptrMesh->getCoordinates(MED_FULL_INTERLACE); int j = 0; + const double precision = 1.e-99; // PAL12077 for ( fcount.init(3),i = 0; i < nbNodes; ++i, j += dim ) { - for ( int iCoord = 0; iCoord < dim; ++iCoord, fcount++ ) - _gibi << setw(22) << coords[ j + iCoord ]; + for ( int iCoord = 0; iCoord < dim; ++iCoord, fcount++ ) { + double coo = coords[ j + iCoord ]; + bool zero = ( -precision < coo && coo < precision ); + _gibi << setw(22) << ( zero ? 0.0 : coo ); + } _gibi << setw(22) << 0.0; // densite fcount++; } diff --git a/src/MEDMEM/MEDMEM_Med.cxx b/src/MEDMEM/MEDMEM_Med.cxx index ec9cbaadf..b8359d72e 100644 --- a/src/MEDMEM/MEDMEM_Med.cxx +++ b/src/MEDMEM/MEDMEM_Med.cxx @@ -331,6 +331,8 @@ void MED::read (int index/*=0*/) const char * LOC = "MED::read (int index=0): "; BEGIN_OF(LOC); + SCRUTE(index); + if (_drivers[index]) { // open and close are made by all objects ! SCRUTE(index); diff --git a/src/MEDMEM/MEDMEM_Med.hxx b/src/MEDMEM/MEDMEM_Med.hxx index 44c711827..97974a304 100644 --- a/src/MEDMEM/MEDMEM_Med.hxx +++ b/src/MEDMEM/MEDMEM_Med.hxx @@ -30,7 +30,7 @@ # include "MEDMEM_define.hxx" # include "MEDMEM_Exception.hxx" # include "MEDMEM_GenDriver.hxx" - +# include "MEDMEM_Field.hxx" namespace MEDMEM { class MESH; @@ -127,6 +127,10 @@ public: deque<DT_IT_> getFieldIteration (const string & fieldName) const throw (MEDEXCEPTION) ; FIELD_ * getField ( const string & fieldName, const int dt, const int it) const throw (MEDEXCEPTION) ; + template<class T> + FIELD<T> * getFieldT ( const string & fieldName, + const int dt, const int it) const throw (MEDEXCEPTION) ; + FIELD_ * getField2 ( const string & fieldName, double time, int it=0) const throw (MEDEXCEPTION) ; @@ -141,7 +145,19 @@ public: //friend ostream & operator<<(ostream &os,const MED & med); }; -}; + +template<class T> +FIELD<T> * MED::getFieldT( const string & fieldName, const int dt, const int it) const throw (MEDEXCEPTION) +{ + const char *LOC="Unexpected type of field"; + FIELD_ retUp=getField(fieldName,dt,it); + FIELD<T> *ret=dynamic_cast< FIELD<T> * >(retUp); + if(!ret) + throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) ) ); + return ret; +} + +} #endif diff --git a/src/MEDMEM/MEDMEM_MedFieldDriver22.hxx b/src/MEDMEM/MEDMEM_MedFieldDriver22.hxx index 97cff3838..9882667a1 100644 --- a/src/MEDMEM/MEDMEM_MedFieldDriver22.hxx +++ b/src/MEDMEM/MEDMEM_MedFieldDriver22.hxx @@ -887,18 +887,50 @@ template <class T> void MED_FIELD_RDONLY_DRIVER22<T>::read(void) this->getMeshGeometricTypeFromFile(id,meshName,entityType,meshGeoType, meshNbOfElOfType,meshNbOfElOfTypeC); + SCRUTE(meshGeoType.size()); + SCRUTE(MESHgeoType.size()); + SCRUTE(meshNbOfElOfTypeC.size()); + SCRUTE(MESHnbOfElOfTypeC.size()); + + if (meshGeoType.size() != MESHgeoType.size()) + { + for (int i = 0; i<meshGeoType.size();i++) + MESSAGE("debug meshGeotype " << meshGeoType[i]); + + for (int i = 0; i<MESHgeoType.size();i++) + MESSAGE("debug MESHgeoType. " << MESHgeoType[i]); + } + + if (meshNbOfElOfTypeC.size() == MESHnbOfElOfTypeC.size()) + { + for (int i = 0; i<meshNbOfElOfTypeC.size();i++) + MESSAGE("debug meshNbOfElOfTypeC " << meshNbOfElOfTypeC[i]); + + for (int i = 0; i<MESHnbOfElOfTypeC.size();i++) + MESSAGE("debug MESHnbOfElOfTypeC " << MESHnbOfElOfTypeC[i]); + } if (fileHasMesh && haveSupport ) if ( ( meshGeoType != MESHgeoType ) || (meshNbOfElOfTypeC != MESHnbOfElOfTypeC) ) - throw MEDEXCEPTION(LOCALIZED( STRING(LOC) <<": Error while getting mesh information from file for FIELD "<< fieldName - << " on entity " << MED_EN::entNames[entityType] - << " with (it,or) = (" - << MED_FIELD_DRIVER<T>::_ptrField->_iterationNumber << "," - << MED_FIELD_DRIVER<T>::_ptrField->_orderNumber << ")" - << " on mesh " << meshName - << " : geometric types or number of elements by type differs from MESH object !" - ) - ); + { + MESSAGE("Warning MedField driver 21 while getting mesh information from file for FIELD "<< fieldName + << " on entity " << MED_EN::entNames[entityType] + << " with (it,or) = (" + << MED_FIELD_DRIVER<T>::_ptrField->_iterationNumber << "," + << MED_FIELD_DRIVER<T>::_ptrField->_orderNumber << ")" + << " on mesh " << meshName + << " : geometric types or number of elements by type differs from MESH object !"); + +// throw MEDEXCEPTION(LOCALIZED( STRING(LOC) <<": Error while getting mesh information from file for FIELD "<< fieldName +// << " on entity " << MED_EN::entNames[entityType] +// << " with (it,or) = (" +// << MED_FIELD_DRIVER<T>::_ptrField->_iterationNumber << "," +// << MED_FIELD_DRIVER<T>::_ptrField->_orderNumber << ")" +// << " on mesh " << meshName +// << " : geometric types or number of elements by type differs from MESH object !" +// ) +// ); + } if ( !fileHasMesh && !haveSupport ) throw MEDEXCEPTION(LOCALIZED( STRING(LOC) <<": Error while getting mesh information for FIELD "<< fieldName diff --git a/src/MEDMEM/MEDMEM_MedMedDriver21.cxx b/src/MEDMEM/MEDMEM_MedMedDriver21.cxx index b17640a28..4fdcc7826 100644 --- a/src/MEDMEM/MEDMEM_MedMedDriver21.cxx +++ b/src/MEDMEM/MEDMEM_MedMedDriver21.cxx @@ -727,7 +727,7 @@ void MED_MED_WRONLY_DRIVER21::write(void ) const current = (*currentMesh).second->addDriver(MED_DRIVER,_fileName,(*currentMesh).second->getName()); // put right _id in Mesh driver (same as this._id) (*currentMesh).second->_drivers[current]->setId( getId() ); - //(*currentMesh).second->write(current) ; + (*currentMesh).second->write(current) ; } for ( currentField=_meshName.begin();currentField != _meshName.end(); currentField++ ) { @@ -735,11 +735,11 @@ void MED_MED_WRONLY_DRIVER21::write(void ) const current = (*currentField).first->addDriver(MED_DRIVER,_fileName,(*currentField).first->getName()); // put right _id in Field driver (same as this._id) (*currentField).first->_drivers[current]->setId( getId() ); - //(*currentField).first->write(current) ; + (*currentField).first->write(current) ; } // that's work, but it is more efficenty to write directly when we had driver, no ? - writeFrom(); + // writeFrom(); END_OF(LOC); diff --git a/src/MEDMEM/MEDMEM_MedMedDriver22.cxx b/src/MEDMEM/MEDMEM_MedMedDriver22.cxx index aec34b044..08cb41d03 100644 --- a/src/MEDMEM/MEDMEM_MedMedDriver22.cxx +++ b/src/MEDMEM/MEDMEM_MedMedDriver22.cxx @@ -808,7 +808,7 @@ void MED_MED_WRONLY_DRIVER22::write(void ) const current = (*currentMesh).second->addDriver(MED_DRIVER,_fileName,(*currentMesh).second->getName()); // put right _id in Mesh driver (same as this._id) (*currentMesh).second->_drivers[current]->setId( getId() ); - //(*currentMesh).second->write(current) ; + (*currentMesh).second->write(current) ; } for ( currentField=_meshName.begin();currentField != _meshName.end(); currentField++ ) { @@ -816,11 +816,11 @@ void MED_MED_WRONLY_DRIVER22::write(void ) const current = (*currentField).first->addDriver(MED_DRIVER,_fileName,(*currentField).first->getName()); // put right _id in Field driver (same as this._id) (*currentField).first->_drivers[current]->setId( getId() ); - //(*currentField).first->write(current) ; + (*currentField).first->write(current) ; } // that's work, but it is more efficenty to write directly when we had driver, no ? - writeFrom(); + //writeFrom(); END_OF(LOC); diff --git a/src/MEDMEM/MEDMEM_MedMeshDriver21.cxx b/src/MEDMEM/MEDMEM_MedMeshDriver21.cxx index 25d07bd20..cdd559c02 100644 --- a/src/MEDMEM/MEDMEM_MedMeshDriver21.cxx +++ b/src/MEDMEM/MEDMEM_MedMeshDriver21.cxx @@ -2471,6 +2471,13 @@ int MED_MESH_WRONLY_DRIVER21::writeFamilies(vector<FAMILY*> & families ) const { err =med_2_1::_MEDdatagroupOuvrir(_medIdt,const_cast <char *> (dataGroupFam.c_str()) ) ; if ( err < MED_VALID ) { SCRUTE(err); + if ( families[i]->getName().size() > MED_TAILLE_NOM ) + throw MEDEXCEPTION + ( LOCALIZED(STRING(LOC) << "The size of the name of the family |" << i+1 + << "| |" << families[i]->getName() + << "| with identifier |" << families[i]->getIdentifier() << "| is |" + << families[i]->getName().size() <<"| and is more than |" + << MED_TAILLE_NOM << "|")) ; MESSAGE(LOC<<"families[i]->getName().c_str() : "<<families[i]->getName().c_str()); MESSAGE(LOC<<"_meshName.c_str() : "<<_meshName.c_str()); diff --git a/src/MEDMEM/MEDMEM_MedMeshDriver22.cxx b/src/MEDMEM/MEDMEM_MedMeshDriver22.cxx index f7e8a0143..ded1a44bd 100644 --- a/src/MEDMEM/MEDMEM_MedMeshDriver22.cxx +++ b/src/MEDMEM/MEDMEM_MedMeshDriver22.cxx @@ -2432,6 +2432,7 @@ int MED_MESH_WRONLY_DRIVER22::writeConnectivities(medEntityMesh entity) const err = MEDconnEcr(_medIdt, const_cast <char *> ( _meshName.c_str()), _ptrMesh->_spaceDimension, connectivityArray, med_2_2::MED_FULL_INTERLACE , numberOfElements, +// (med_2_2::med_entite_maillage ) entity, because Med Memory works only in Nodal connectivity (med_2_2::med_entite_maillage ) MED_CELL, (med_2_2::med_geometrie_element) types[i], med_2_2::MED_NOD); @@ -2465,7 +2466,8 @@ int MED_MESH_WRONLY_DRIVER22::writeConnectivities(medEntityMesh entity) const tmp_PolygonsConnectivityIndex, _ptrMesh->getNumberOfPolygons()+1, tmp_PolygonsConnectivity, - (med_2_2::med_entite_maillage) entity, +// (med_2_2::med_entite_maillage) entity, because Med Memory works only in Nodal connectivity + (med_2_2::med_entite_maillage) MED_CELL, med_2_2::MED_NOD); delete [] tmp_PolygonsConnectivityIndex ; delete [] tmp_PolygonsConnectivity ; @@ -2475,7 +2477,8 @@ int MED_MESH_WRONLY_DRIVER22::writeConnectivities(medEntityMesh entity) const const_cast <med_int*> (_ptrMesh->getPolygonsConnectivityIndex(MED_NODAL,entity)), _ptrMesh->getNumberOfPolygons()+1, const_cast <med_int*> (_ptrMesh->getPolygonsConnectivity(MED_NODAL,entity)), - (med_2_2::med_entite_maillage) entity, +// (med_2_2::med_entite_maillage) entity, because Med Memory works only in Nodal connectivity + (med_2_2::med_entite_maillage) MED_CELL, med_2_2::MED_NOD); #endif @@ -2563,25 +2566,27 @@ int MED_MESH_WRONLY_DRIVER22::writeConnectivities(medEntityMesh entity) const for ( ii = 0 ; ii < numberOfElements ; ii++ ) tmp_Connectivity[ii] = connectivity[ii] ; err = med_2_2::MEDconnEcr(_medIdt, - const_cast <char *> ( _meshName.c_str()), - _ptrMesh->_spaceDimension, - tmp_Connectivity, - med_2_2::MED_FULL_INTERLACE, - numberOfElements, - (med_2_2::med_entite_maillage ) entity, - (med_2_2::med_geometrie_element) types[i], - med_2_2::MED_DESC ); + const_cast <char *> ( _meshName.c_str()), + _ptrMesh->_spaceDimension, + tmp_Connectivity, + med_2_2::MED_FULL_INTERLACE, + numberOfElements, +// (med_2_2::med_entite_maillage ) entity, because Med Memory works only in Nodal connectivity + (med_2_2::med_entite_maillage) MED_CELL, + (med_2_2::med_geometrie_element) types[i], + med_2_2::MED_DESC ); delete [] tmp_Connectivity ; #else err = med_2_2::MEDconnEcr(_medIdt, - const_cast <char *> ( _meshName.c_str()), - _ptrMesh->_spaceDimension, - const_cast <int *> (connectivity), - med_2_2::MED_FULL_INTERLACE, - numberOfElements, - (med_2_2::med_entite_maillage ) entity, - (med_2_2::med_geometrie_element) types[i], - med_2_2::MED_DESC ); + const_cast <char *> ( _meshName.c_str()), + _ptrMesh->_spaceDimension, + const_cast <int *> (connectivity), + med_2_2::MED_FULL_INTERLACE, + numberOfElements, +// (med_2_2::med_entite_maillage ) entity, because Med Memory works only in Nodal connectivity + (med_2_2::med_entite_maillage ) MED_CELL, + (med_2_2::med_geometrie_element) types[i], + med_2_2::MED_DESC ); #endif if (err<0) // ETENDRE LES EXPLICATIONS @@ -2604,14 +2609,15 @@ int MED_MESH_WRONLY_DRIVER22::writeConnectivities(medEntityMesh entity) const tmp_PolygonsConnectivityIndex[ii] = PolygonsConnectivityIndex[ii] ; med_2_2::med_int * tmp_PolygonsConnectivity = new med_2_2::med_int[_ptrMesh->getNumberOfPolygons()+1] ; const int * PolygonsConnectivity = _ptrMesh->getPolygonsConnectivity(MED_DESCENDING,entity) ; - for ( ii = 0 ; ii < _ptrMesh->getNumberOfPolygons()+1 ; ii++ ) - tmp_PolygonsConnectivity[ii] = PolygonsConnectivity[ii] ; + for ( ii = 0 ; ii < _ptrMesh->getNumberOfPolygons()+1 ; ii++ ) + tmp_PolygonsConnectivity[ii] = PolygonsConnectivity[ii] ; err = MEDpolygoneConnEcr(_medIdt, const_cast <char *> (_meshName.c_str()), tmp_PolygonsConnectivityIndex, _ptrMesh->getNumberOfPolygons()+1, tmp_PolygonsConnectivity, - (med_2_2::med_entite_maillage) entity, +// (med_2_2::med_entite_maillage) entity, because Med Memory works only in Nodal connectivity + (med_2_2::med_entite_maillage ) MED_CELL, med_2_2::MED_DESC); delete [] tmp_PolygonsConnectivityIndex ; delete [] tmp_PolygonsConnectivity ; @@ -2621,7 +2627,8 @@ int MED_MESH_WRONLY_DRIVER22::writeConnectivities(medEntityMesh entity) const const_cast <med_int*> (_ptrMesh->getPolygonsConnectivityIndex(MED_DESCENDING,entity)), _ptrMesh->getNumberOfPolygons()+1, const_cast <med_int*> (_ptrMesh->getPolygonsConnectivity(MED_DESCENDING,entity)), - (med_2_2::med_entite_maillage) entity, +// (med_2_2::med_entite_maillage) entity, because Med Memory works only in Nodal connectivity + (med_2_2::med_entite_maillage ) MED_CELL, med_2_2::MED_DESC); #endif @@ -2803,6 +2810,13 @@ int MED_MESH_WRONLY_DRIVER22::writeFamilyNumbers() const { } } + + + for (int i=0; i<NumberOfElements; i++) + SCRUTE(MEDArrayFamily[i]); + + + const int * typeCount = _ptrMesh->getGlobalNumberingIndex(entity) ; #if defined(IRIX64) || defined(OSF1) || defined(VPP5000) int lgth=NumberOfElements; @@ -2813,18 +2827,19 @@ int MED_MESH_WRONLY_DRIVER22::writeFamilyNumbers() const { for (int i=0; i<numberOfTypes; i++) { #if defined(IRIX64) || defined(OSF1) || defined(VPP5000) err = MEDfamEcr(_medIdt, const_cast <char *> ( _meshName.c_str() ), - temp+typeCount[i]-1,typeCount[i+1]-typeCount[i], -//CCRT med_2_2::MED_REMP , - (med_2_2::med_entite_maillage) entity, - (med_2_2::med_geometrie_element) types[i] -); + (temp+(typeCount[i]-1)),(typeCount[i+1]-typeCount[i]), + //CCRT med_2_2::MED_REMP , +// (med_2_2::med_entite_maillage) entity, because Med Memory works only in Nodal connectivity + (med_2_2::med_entite_maillage) MED_CELL, + (med_2_2::med_geometrie_element) types[i]); #else err = MEDfamEcr(_medIdt, const_cast <char *> ( _meshName.c_str() ), - (MEDArrayFamily+typeCount[i]-1), + (MEDArrayFamily+(typeCount[i]-1)), (typeCount[i+1]-typeCount[i]), - (med_2_2::med_entite_maillage) entity, +// (med_2_2::med_entite_maillage) entity, because Med Memory works only in Nodal connectivity + (med_2_2::med_entite_maillage) MED_CELL, (med_2_2::med_geometrie_element) types[i]); - +#endif MESSAGE("OK "<<i); if ( err != MED_VALID) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Can't write family for the |"<< _ptrMesh->getNumberOfElements(entity, types[i]) @@ -2889,20 +2904,37 @@ int MED_MESH_WRONLY_DRIVER22::writeFamilyNumbers() const { } } + for (int i=0;i<numberOfElements;i++) + SCRUTE(familyArray[i]); + const int * typeCount = _ptrMesh->getGlobalNumberingIndex(entity) ; //CCRT Clutter -//CCRT#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) -//CCRT int lgth=numberOfElements; -//CCRT med_2_2::med_int *temp=new med_2_2::med_int[lgth]; -//CCRT for(int i2=0;i2<lgth;i2++) -//CCRT temp[i2]=(med_2_2::med_int) (familyArray[i2]); -//CCRT#endif +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + int lgth=numberOfElements; + med_2_2::med_int *temp=new med_2_2::med_int[lgth]; + for(int i2=0;i2<lgth;i2++) + temp[i2]=(med_2_2::med_int) (familyArray[i2]); +#endif + SCRUTE(numberOfTypes); + for (int i=0; i<numberOfTypes; i++) { int typeNumberOfElements = typeCount[i+1] - typeCount[i] ; + SCRUTE(typeNumberOfElements); + SCRUTE(typeCount[i+1]); + SCRUTE(typeCount[i]); +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + err = MEDfamEcr(_medIdt, const_cast <char *> ( _meshName.c_str() ), + (temp+(typeCount[i]-1)), typeNumberOfElements, +// (med_2_2::med_entite_maillage) entity, because Med Memory works only in Nodal connectivity + (med_2_2::med_entite_maillage) MED_CELL, + (med_2_2::med_geometrie_element) types[i]); +#else + MESSAGE("On est bien la !!! entity = " << entity << " type " << types[i]); err = MEDfamEcr(_medIdt, const_cast <char *> ( _meshName.c_str() ), - familyArray+typeCount[i]-1, typeNumberOfElements, - (med_2_2::med_entite_maillage) entity, + (familyArray+(typeCount[i]-1)), typeNumberOfElements, +// (med_2_2::med_entite_maillage) entity, because Med Memory works only in Nodal connectivity + (med_2_2::med_entite_maillage) MED_CELL, (med_2_2::med_geometrie_element) types[i]); #endif if ( err != MED_VALID) @@ -2910,13 +2942,12 @@ int MED_MESH_WRONLY_DRIVER22::writeFamilyNumbers() const { << "| faces of geometric type |" << geoNames[types[i]] <<"|in mesh |" << _ptrMesh->_name.c_str() << "|" )); } -//CCRT there was "temp" for OSF and "familyArray" for Linux ... +//CCRT there was "temp" and "familyArray" for OSF, but only "familyArray" for Linux ... #if defined(IRIX64) || defined(OSF1) || defined(VPP5000) delete [] temp; //CCRT#endif -#else - delete[] familyArray ; #endif + delete[] familyArray ; //if (true == ToDestroy) { // int NumberOfFamilies = myFamilies->size(); // for (int i=0; i<NumberOfFamilies; i++) @@ -2935,8 +2966,8 @@ int MED_MESH_WRONLY_DRIVER22::writeFamilyNumbers() const { const medGeometryElement * types = _ptrMesh->getTypes (entity) ; int numberOfElements = _ptrMesh->getNumberOfElements(entity, MED_ALL_ELEMENTS) ; -//CCRT int * familyArray = new int[numberOfElements] ; - med_2_2::med_int * familyArray = new med_2_2::med_int[numberOfElements] ; + int * familyArray = new int[numberOfElements] ; + // med_2_2::med_int * familyArray = new int[numberOfElements] ; for (int i=0;i<numberOfElements;i++) familyArray[i]=0; @@ -2971,31 +3002,48 @@ int MED_MESH_WRONLY_DRIVER22::writeFamilyNumbers() const { } } + + for (int i=0;i<numberOfElements;i++) + SCRUTE(familyArray[i]); + + const int * typeCount = _ptrMesh->getGlobalNumberingIndex(entity) ; //CCRT : clutter : -//CCRT#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) -//CCRT int lgth=numberOfElements; -//CCRT med_2_2::med_int *temp=new med_2_2::med_int[lgth]; -//CCRT for(int i2=0;i2<lgth;i2++) -//CCRT temp[i2]=(med_2_2::med_int) (familyArray[i2]); -//CCRT#endif +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + int lgth=numberOfElements; + med_2_2::med_int *temp=new med_2_2::med_int[lgth]; + for(int i2=0;i2<lgth;i2++) + temp[i2]=(med_2_2::med_int) (familyArray[i2]); +#endif + SCRUTE(numberOfTypes); + for (int i=0; i<numberOfTypes; i++) { int typeNumberOfElements = typeCount[i+1] - typeCount[i] ; - + SCRUTE(typeNumberOfElements); + SCRUTE(typeCount[i+1]); + SCRUTE(typeCount[i]); +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) err = MEDfamEcr(_medIdt, const_cast <char *> ( _meshName.c_str() ), - familyArray+typeCount[i]-1, typeNumberOfElements, - (med_2_2::med_entite_maillage) entity, + (temp+(typeCount[i]-1)), typeNumberOfElements, +// (med_2_2::med_entite_maillage) entity, because Med Memory works only in Nodal connectivity + (med_2_2::med_entite_maillage) MED_CELL, (med_2_2::med_geometrie_element) types[i]); - +#else + err = MEDfamEcr(_medIdt, const_cast <char *> ( _meshName.c_str() ), + (familyArray+(typeCount[i]-1)), typeNumberOfElements, +// (med_2_2::med_entite_maillage) entity, because Med Memory works only in Nodal connectivity + (med_2_2::med_entite_maillage) MED_CELL, + (med_2_2::med_geometrie_element) types[i]); +#endif if ( err != MED_VALID) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Can't write family for the |"<< _ptrMesh->getNumberOfElements(entity, types[i]) << "| edges of geometric type |" << geoNames[types[i]] <<"|in mesh |" << _ptrMesh->_name.c_str() << "|" )); } -//CCRT : clutter : -//CCRT#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) -//CCRT delete [] temp; -//CCRT#endif + +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + delete [] temp; +#endif delete[] familyArray ; //if (true == ToDestroy) { // int NumberOfFamilies = myFamilies->size(); @@ -3068,6 +3116,13 @@ int MED_MESH_WRONLY_DRIVER22::writeFamilies(vector<FAMILY*> & families ) const err = med_2_2::_MEDdatagroupOuvrir(_medIdt,const_cast <char *> (dataGroupFam.c_str()) ) ; if ( err < MED_VALID ) { SCRUTE(err); + if ( families[i]->getName().size() > MED_TAILLE_NOM ) + throw MEDEXCEPTION + ( LOCALIZED(STRING(LOC) << "The size of the name of the family |" << i+1 + << "| |" << families[i]->getName() + << "| with identifier |" << families[i]->getIdentifier() << "| is |" + << families[i]->getName().size() <<"| and is more than |" + << MED_TAILLE_NOM << "|")) ; MESSAGE(LOC<<"families[i]->getName().c_str() : "<<families[i]->getName().c_str()); MESSAGE(LOC<<"_meshName.c_str() : "<<_meshName.c_str()); diff --git a/src/MEDMEM/MEDMEM_Mesh.cxx b/src/MEDMEM/MEDMEM_Mesh.cxx index f31061002..a3f055c3b 100644 --- a/src/MEDMEM/MEDMEM_Mesh.cxx +++ b/src/MEDMEM/MEDMEM_Mesh.cxx @@ -2158,6 +2158,8 @@ void MESH::createFamilies() medGeometryElement geometrictype=MED_NONE; vector<int> tab_index_types_geometriques; vector<int> tab_nombres_elements; + if ( fam->second.empty() ) + continue; // it is just a truncated long family name // scan family cells and fill the tab that are needed by the create a MED FAMILY for( int i=0; i!=fam->second.size(); ++i) @@ -2176,10 +2178,28 @@ void MESH::createFamilies() tab_nombres_elements.push_back(fam->second.size()+1-tab_index_types_geometriques.back()); tab_index_types_geometriques.push_back(fam->second.size()+1); - // create a empty MED FAMILY and fill it with the tabs we constructed + // family name sould not be longer than MED_TAILLE_NOM + string famName = fam->first; + if ( famName.size() > MED_TAILLE_NOM ) { + // try to cut off "FAM_" from the head + if ( famName.size() - 4 <= MED_TAILLE_NOM ) { + famName = famName.substr(4); + } + else { // try to make a unique name by cutting off char by char from the tail + famName.substr(0, MED_TAILLE_NOM); + map< string,vector<int> >::iterator foundName = tab_families.find( famName ); + while ( foundName != tab_families.end() && !famName.empty() ) { + famName = famName.substr( 0, famName.size() - 1 ); + foundName = tab_families.find( famName ); + } + } + tab_families[ famName ]; // add a new name in the table to assure uniqueness + } + + // create an empty MED FAMILY and fill it with the tabs we constructed FAMILY* newFam = new FAMILY(); newFam->setTotalNumberOfElements(fam->second.size()); - newFam->setName(fam->first); + newFam->setName(famName); newFam->setMesh(this); newFam->setNumberOfGeometricType(tab_types_geometriques.size()); newFam->setGeometricType(&tab_types_geometriques[0]); // we know the tab is not empy @@ -2258,28 +2278,52 @@ int MESH::getElementContainingPoint(const double *coord) { if(_spaceDimension==3) { - Meta_Wrapper<3> *fromWrapper=new Meta_Wrapper<3> (getNumberOfNodes(),const_cast<double *>(getCoordinates(MED_FULL_INTERLACE)), + Meta_Wrapper<3> fromWrapper(getNumberOfNodes(),const_cast<double *>(getCoordinates(MED_FULL_INTERLACE)), const_cast<CONNECTIVITY *>(getConnectivityptr())); - Meta_Wrapper<3> *toWrapper=new Meta_Wrapper<3> (1,const_cast<double *>(coord)); - Meta_Mapping<3> *mapping=new Meta_Mapping<3> (fromWrapper,toWrapper); - mapping->Cree_Mapping(1); - vector<int> vectormapping=mapping->Get_Mapping(); - return vectormapping[0]+1; + Meta_Wrapper<3> toWrapper(1,const_cast<double *>(coord)); + Meta_Mapping<3> mapping(&fromWrapper,&toWrapper); + mapping.Cree_Mapping(1); + return mapping.Get_Mapping()[0]+1; } else if(_spaceDimension==2) { - Meta_Wrapper<2> *fromWrapper=new Meta_Wrapper<2> (getNumberOfNodes(),const_cast<double *>(getCoordinates(MED_FULL_INTERLACE)), + Meta_Wrapper<2> fromWrapper(getNumberOfNodes(),const_cast<double *>(getCoordinates(MED_FULL_INTERLACE)), const_cast<CONNECTIVITY *>(getConnectivityptr())); - Meta_Wrapper<2> *toWrapper=new Meta_Wrapper<2> (1,const_cast<double *>(coord)); - Meta_Mapping<2> *mapping=new Meta_Mapping<2> (fromWrapper,toWrapper); - mapping->Cree_Mapping(1); - vector<int> vectormapping=mapping->Get_Mapping(); - return vectormapping[0]+1; + Meta_Wrapper<2> toWrapper(1,const_cast<double *>(coord)); + Meta_Mapping<2> mapping(&fromWrapper,&toWrapper); + mapping.Cree_Mapping(1); + return mapping.Get_Mapping()[0]+1; } else throw MEDEXCEPTION("MESH::getElementContainingPoint : invalid _spaceDimension must be equal to 2 or 3 !!!"); } +vector< vector<double> > MESH::getBoundingBox() const +{ + const double *myCoords=_coordinate->getCoordinates(MED_EN::MED_FULL_INTERLACE); + vector< vector<double> > ret(2); + int i,j; + ret[0].resize(_spaceDimension); + ret[1].resize(_spaceDimension); + for(i=0;i<_spaceDimension;i++) + { + ret[0][i]=1.e300; + ret[1][i]=-1.e300; + } + for(i=0;i<_coordinate->getNumberOfNodes();i++) + { + for(j=0;j<_spaceDimension;j++) + { + double tmp=myCoords[i*_spaceDimension+j]; + if(tmp<ret[0][j]) + ret[0][j]=tmp; + if(tmp>ret[1][j]) + ret[1][j]=tmp; + } + } + return ret; +} + //Presently disconnected in C++ void MESH::addReference() const { diff --git a/src/MEDMEM/MEDMEM_Mesh.hxx b/src/MEDMEM/MEDMEM_Mesh.hxx index dc2cf152f..0c51185a6 100644 --- a/src/MEDMEM/MEDMEM_Mesh.hxx +++ b/src/MEDMEM/MEDMEM_Mesh.hxx @@ -298,6 +298,7 @@ public : void fillSupportOnNodeFromElementList(const list<int>& listOfElt, SUPPORT *supportToFill) const throw (MEDEXCEPTION); SUPPORT *buildSupportOnElementsFromElementList(const list<int>& listOfElt, MED_EN::medEntityMesh entity) const throw (MEDEXCEPTION); int getElementContainingPoint(const double *coord); + vector< vector<double> > MESH::getBoundingBox() const; template<class T> static FIELD<T> * mergeFields(const vector< FIELD<T> * > & others, bool meshCompare=false); /*! diff --git a/src/MEDMEM/MEDMEM_Support.cxx b/src/MEDMEM/MEDMEM_Support.cxx index 167229385..49cac96a9 100644 --- a/src/MEDMEM/MEDMEM_Support.cxx +++ b/src/MEDMEM/MEDMEM_Support.cxx @@ -92,7 +92,7 @@ SUPPORT::SUPPORT(const SUPPORT & m) _totalNumberOfElements = m._totalNumberOfElements; - if (m._isOnAllElts == false) + if (m._isOnAllElts == false && m._number ) // m may be not filled SUPPORTClient _number = new MEDSKYLINEARRAY(* m._number); else _number = (MEDSKYLINEARRAY *) NULL; @@ -124,7 +124,10 @@ SUPPORT & SUPPORT::operator=(const SUPPORT & m) _totalNumberOfElements = m._totalNumberOfElements; if (m._isOnAllElts == false) { if (_number) delete _number; - _number = new MEDSKYLINEARRAY(* m._number); + if ( m._number ) // m may be not filled SUPPORTClient + _number = new MEDSKYLINEARRAY(* m._number); + else + _number = (MEDSKYLINEARRAY *) NULL; } else _number = (MEDSKYLINEARRAY *) NULL; @@ -165,7 +168,8 @@ ostream & MEDMEM::operator<<(ostream &os, const SUPPORT &my) os << "Is on all entities."<< endl; else { os << "Is not on all entities. "<< endl; - os << *my.getNumber(MED_ALL_ELEMENTS); + if ( my._number ) // m may be not filled SUPPORTClient + os << *my.getNumber(MED_ALL_ELEMENTS); } int numberoftypes = my._numberOfGeometricType ; os << "NumberOfTypes : "<<numberoftypes<<endl; @@ -204,10 +208,11 @@ void SUPPORT::update() _totalNumberOfElements=_numberOfElements[0]; } else - { // we duplicate information from _mesh + { // we duplicate information from _mesh _numberOfGeometricType=_mesh->getNumberOfTypesWithPoly(_entity); SCRUTE(_numberOfGeometricType); - _geometricType.set(_numberOfGeometricType,_mesh->getTypesWithPoly(_entity) ); + medGeometryElement * allType = _mesh->getTypesWithPoly(_entity); + _geometricType.set(_numberOfGeometricType,allType ); _numberOfElements.set(_numberOfGeometricType); _totalNumberOfElements=0; for (int i=0;i<_numberOfGeometricType;i++) @@ -215,6 +220,7 @@ void SUPPORT::update() _numberOfElements[i]=_mesh->getNumberOfElementsWithPoly(_entity,_geometricType[i]) ; _totalNumberOfElements+=_numberOfElements[i]; } + delete [] allType; } SCRUTE(_name); diff --git a/src/MEDMEM/MEDMEM_TopLevel.cxx b/src/MEDMEM/MEDMEM_TopLevel.cxx new file mode 100644 index 000000000..60c74e75b --- /dev/null +++ b/src/MEDMEM/MEDMEM_TopLevel.cxx @@ -0,0 +1,43 @@ +#include "MEDMEM_TopLevel.hxx" +#include "MEDMEM_Med.hxx" +#include "MEDMEM_Mesh.hxx" +#include "MEDMEM_Field.hxx" +#include "MEDMEM_DriverFactory.hxx" +#include "MEDMEM_MedMedDriver.hxx" + +using namespace MED_EN; +using namespace MEDMEM; + +MED *::MEDMEM::readMedInFile(const std::string& fileName) throw(MEDEXCEPTION) +{ + MED *myMedObj=new MED; + driverTypes type=DRIVERFACTORY::deduceDriverTypeFromFileName(fileName); + int id=myMedObj->addDriver(type,fileName,MED_REMP); + myMedObj->read(id); + return myMedObj; +} + +MESH *::MEDMEM::readMeshInFile(const std::string& fileName, const std::string& meshName) +{ + MESH *mesh=new MESH; + driverTypes type=DRIVERFACTORY::deduceDriverTypeFromFileName(fileName); + int id=mesh->addDriver(type,fileName,mesh->getName(),MED_REMP); + mesh->read(id); + return mesh; +} + +void ::MEDMEM::writeMedToFile(const MED *medObj, const std::string& fileName) +{ + MED *medObjNoC=(MED *)medObj;//MED::write should be a const method ... As it's not the case + driverTypes type=DRIVERFACTORY::deduceDriverTypeFromFileName(fileName); + int id=medObjNoC->addDriver(type,fileName,MED_REMP); + medObjNoC->write(id); +} + +void ::MEDMEM::writeMeshToFile(const MESH *meshObj, const std::string& fileName) +{ + MESH *meshObjNoC=(MESH *)meshObj;//MED::write should be a const method ... As it's not the case + driverTypes type=DRIVERFACTORY::deduceDriverTypeFromFileName(fileName); + int id=meshObjNoC->addDriver(type,fileName,meshObjNoC->getName(),MED_REMP); + meshObjNoC->write(id); +} diff --git a/src/MEDMEM/MEDMEM_TopLevel.hxx b/src/MEDMEM/MEDMEM_TopLevel.hxx new file mode 100644 index 000000000..5e96879d0 --- /dev/null +++ b/src/MEDMEM/MEDMEM_TopLevel.hxx @@ -0,0 +1,53 @@ +#ifndef __MEDMEM_TOPLEVEL_HXX__ +#define __MEDMEM_TOPLEVEL_HXX__ + +#include "MEDMEM_FieldForward.hxx" +#include "MEDMEM_Exception.hxx" +#include <string> + +namespace MEDMEM +{ + class MED; + class MESH; +} + +namespace MEDMEM +{ + //read part + MED *readMedInFile(const std::string& fileName) throw(MEDEXCEPTION); + MESH *readMeshInFile(const std::string& fileName, const std::string& meshName); + template<class T> + FIELD<T> *readFieldInFile(const std::string& fileName, const std::string& fieldName); + //write part + void writeMedToFile(const MED *medObj, const std::string& fileName); + void writeMeshToFile(const MESH *meshObj, const std::string& fileName); + template<class T> + void writeFieldToFile(const FIELD<T> *fieldObj, const std::string& fileName); +} + +#include "MEDMEM_Field.hxx" + +namespace MEDMEM +{ + template<class T> + FIELD<T> *readFieldInFile(const std::string& fileName, const std::string& fieldName) + { + FIELD<T> *ret=new FIELD<T>; + ret->setName(fieldName); + driverTypes type=DRIVERFACTORY::deduceDriverTypeFromFileName(fileName); + int id=ret->addDriver(type,fileName,fieldName); + ret->read(id); + return ret; + } + + template<class T> + void writeFieldToFile(const FIELD<T> *fieldObj, const std::string& fileName) + { + FIELD<T> *fieldObjNoC=(FIELD<T> *)fieldObj; + driverTypes type=DRIVERFACTORY::deduceDriverTypeFromFileName(fileName); + int id=fieldObj->addDriver(type, fileName, fieldObj->getName()); + fieldObjNoC->write(id); + } +} + +#endif diff --git a/src/MEDMEM/Makefile.in b/src/MEDMEM/Makefile.in index 401566816..9233a7582 100644 --- a/src/MEDMEM/Makefile.in +++ b/src/MEDMEM/Makefile.in @@ -82,6 +82,7 @@ MEDMEM_PolyhedronArray.hxx \ MEDMEM_MedFieldDriver22.hxx \ MEDMEM_MedMedDriver22.hxx \ MEDMEM_MedMeshDriver22.hxx \ +MEDMEM_TopLevel.hxx \ MEDMEM_Utilities.hxx \ MEDMEM_ArrayInterface.hxx \ MEDMEM_IndexCheckingPolicy.hxx \ @@ -135,6 +136,7 @@ MEDMEM_medimport_src.cxx \ MEDMEM_PolyhedronArray.cxx \ MEDMEM_MedMedDriver22.cxx \ MEDMEM_MedMeshDriver22.cxx \ +MEDMEM_TopLevel.cxx \ MEDMEM_MEDMEMgaussEcr.cxx \ MEDMEM_MEDMEMprofilEcr.cxx \ MEDMEM_MEDMEMchampLire.cxx @@ -158,10 +160,10 @@ TEST_PROGS = test_MEDMEM_ModulusArray test_MEDMEM_Array test_MEDMEM_SkyLineArray test_grid test_MEDMEM_PolyhedronArray test_MEDMEM_PolyConnectivity \ test_MEDMEM_PolyDriverMedMeshRead test_MEDMEM_PolyDriverMedMeshWrite \ test_MEDMEM_poly3D test_MEDMEM_nArray test_MEDMEM_Meshing_poly test_profil_MedFieldDriver \ - test_profil_gauss_MedFieldDriver test_GaussLocalization + test_profil_gauss_MedFieldDriver test_GaussLocalization testAnalFile -LDFLAGS+= -L$(top_builddir)/lib/salome -LDFLAGSFORBIN+= -L$(top_builddir)/lib/salome +LDFLAGS+= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome +LDFLAGSFORBIN+= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome CPPFLAGS+=$(MED2_INCLUDES) $(HDF5_INCLUDES) @@ -175,10 +177,10 @@ LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lmed_V2_1 $(STDLIB) LDFLAGSFORBIN+=-lm $(MED2_LIBS) $(HDF5_LIBS) -lmed_V2_1 ifeq ($(MED_WITH_KERNEL),yes) - CPPFLAGS+= -I${KERNEL_ROOT_DIR}/include/salome - CXXFLAGS+= -I${KERNEL_ROOT_DIR}/include/salome - LDFLAGS+= -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace - LDFLAGSFORBIN+= -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace -lSALOMEBasics + CPPFLAGS+= ${KERNEL_CXXFLAGS} + CXXFLAGS+= ${KERNEL_CXXFLAGS} + LDFLAGS+= ${KERNEL_LDFLAGS} -lSALOMELocalTrace + LDFLAGSFORBIN+= ${KERNEL_LDFLAGS} -lSALOMELocalTrace -lSALOMEBasics endif LIBSFORBIN= diff --git a/src/MEDMEM/testAnalFile.cxx b/src/MEDMEM/testAnalFile.cxx new file mode 100644 index 000000000..420a61329 --- /dev/null +++ b/src/MEDMEM/testAnalFile.cxx @@ -0,0 +1,83 @@ +#include <string> +#include <deque> +#include <iostream> +#include "MEDMEM_MedMedDriver.hxx" +#include "MEDMEM_Med.hxx" +#include "MEDMEM_MedMeshDriver.hxx" +#include "MEDMEM_Mesh.hxx" +#include "MEDMEM_Field.hxx" +#include "MEDMEM_DriverFactory.hxx" + +using namespace std; +using namespace MEDMEM; +using namespace MED_EN; + +int main(int argc, char *argv[]) +{ + if (argc !=2) + { + cerr << "Usage : " << argv[0] + << " fileName.med where fileName.med should be a med file" << endl; + cerr << " It will then generate two med files fileNameAnal_V21.med (med V2.1 format)" << endl; + cerr << "and fileNameAnal_V21.med (med V2.2 format)" << endl << endl; + exit(-1); + } + + int i; + // This test program is more or less designed to work with file TimeStamps.med + // If you want to use it for other Med files, you have to alter the mounting in memory of the fields f1 and f2 + //string fileIn="/export/home/geay32/SALOME225/KERNEL_SRC/examples/TimeStamps.med"; + + string fileIn = argv[1] ; + const string ext=".med"; + string::size_type pos=fileIn.find(ext,0); + string baseName (fileIn, 0, pos); // nom sans extension + string fileOut21=baseName + "Anal_V21.med"; + string fileOut22=baseName + "Anal_V22.med"; + + MED *myMed=new MED; + MED_MED_RDONLY_DRIVER *driverIn=new MED_MED_RDONLY_DRIVER(fileIn,myMed); + driverIn->open(); + driverIn->readFileStruct(); + driverIn->close(); + int nbOfMeshes=myMed->getNumberOfMeshes(); + int nbOfFields=myMed->getNumberOfFields(); + cout << nbOfMeshes << " --- " << nbOfFields << endl; + deque<string> names=myMed->getMeshNames(); + for(i=0;i<nbOfMeshes;i++) + cout << names[i] << endl; + cout << "************* " << endl; + deque<string> names2=myMed->getFieldNames(); + for(i=0;i<nbOfFields;i++) + cout << names2[i] << endl; + MESH *mesh=myMed->getMesh(names[0]); + mesh->read(); + myMed->updateSupport(); + deque<DT_IT_> iterations=myMed->getFieldIteration(names2[2]); + cout << iterations.size() << endl; + FIELD_ *f1=myMed->getField(names2[2],iterations[0].dt,iterations[0].it); + FIELD_ *f2=myMed->getField(names2[2],iterations[1].dt,iterations[1].it); + FIELD<double> *f1s=(FIELD<double> *)f1; + f1s->read(); + FIELD<double> *f2s=(FIELD<double> *)f2; + f2s->read(); + DRIVERFACTORY::setMedFileVersionForWriting(V21); + int id=mesh->addDriver(MED_DRIVER,fileOut21,mesh->getName()); + mesh->write(id); + id=f1s->addDriver(MED_DRIVER, fileOut21, f1s->getName()); + f1s->write(id); + id=f2s->addDriver(MED_DRIVER, fileOut21, f2s->getName()); + f2s->write(id); + + DRIVERFACTORY::setMedFileVersionForWriting(V22); + id=mesh->addDriver(MED_DRIVER,fileOut22,mesh->getName()); + mesh->write(id); + id=f1s->addDriver(MED_DRIVER, fileOut22, f1s->getName()); + f1s->write(id); + id=f2s->addDriver(MED_DRIVER, fileOut22, f2s->getName()); + f2s->write(id); + + delete myMed; + return 0; +} + diff --git a/src/MEDMEM_I/Makefile.in b/src/MEDMEM_I/Makefile.in index e95ff91df..a71357bbe 100644 --- a/src/MEDMEM_I/Makefile.in +++ b/src/MEDMEM_I/Makefile.in @@ -61,12 +61,12 @@ BIN_SRC = BIN_SERVER_IDL = BIN_CLIENT_IDL = -LDFLAGS= -L$(top_builddir)/lib/salome -LDFLAGSFORBIN= -L$(top_builddir)/lib/salome +LDFLAGS= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome +LDFLAGSFORBIN= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome -CPPFLAGS+= $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS+= -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lmedmem -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace -lSalomeCommunication -lSalomeGenericObj +CPPFLAGS+= $(MED2_INCLUDES) $(HDF5_INCLUDES) ${KERNEL_CXXFLAGS} +CXXFLAGS+= ${KERNEL_CXXFLAGS} +LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lmedmem ${KERNEL_LDFLAGS} -lSALOMELocalTrace -lSalomeCommunication -lSalomeGenericObj #LDFLAGS+=-lmedmem -L. -lSalomeContainer -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification # does we put only -lSalomeContainer and compiler retrieves -lSalomeNS -lRegistry -lOpUtil ???? diff --git a/src/MEDMEM_SWIG/Makefile.in b/src/MEDMEM_SWIG/Makefile.in index 9034c4d33..3709e499f 100644 --- a/src/MEDMEM_SWIG/Makefile.in +++ b/src/MEDMEM_SWIG/Makefile.in @@ -82,12 +82,16 @@ EXPORT_PYSCRIPTS = libMEDMEM_Swig.py \ test_gibi.py \ test_porflow.py \ testDriverAscii.py \ + testGaussLocalization.py \ + testMedObj.py \ + test_profil_MedFieldDriver.py \ + testWriteAndFam.py \ testMedMemGeneral.py ############################################################################# -LDFLAGS= -L$(top_builddir)/lib/salome -LDFLAGSFORBIN= -L$(top_builddir)/lib/salome +LDFLAGS= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@//salome +LDFLAGSFORBIN= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome CPPFLAGS+= $(PYTHON_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) CXXFLAGS+= @CXXTMPDPTHFLAGS@ @@ -95,9 +99,9 @@ LIBS= $(PYTHON_LIBS) LDFLAGS+= -lmedmem $(MED2_LIBS) $(HDF5_LIBS) ifeq ($(MED_WITH_KERNEL),yes) - CPPFLAGS+= -I${KERNEL_ROOT_DIR}/include/salome - CXXFLAGS+= -I${KERNEL_ROOT_DIR}/include/salome - LDFLAGS+= -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace + CPPFLAGS+= ${KERNEL_CXXFLAGS} + CXXFLAGS+= ${KERNEL_CXXFLAGS} + LDFLAGS+= ${KERNEL_LDFLAGS} -lSALOMELocalTrace endif ############################################################################# diff --git a/src/MEDMEM_SWIG/libMEDMEM_Swig.i b/src/MEDMEM_SWIG/libMEDMEM_Swig.i index a55f04363..f829c0fc7 100644 --- a/src/MEDMEM_SWIG/libMEDMEM_Swig.i +++ b/src/MEDMEM_SWIG/libMEDMEM_Swig.i @@ -48,6 +48,8 @@ #include "MEDMEM_Grid.hxx" #include "MEDMEM_Meshing.hxx" #include "MEDMEM_DriverFactory.hxx" +#include "MEDMEM_GaussLocalization.hxx" +#include "MEDMEM_ArrayInterface.hxx" #include "MEDMEM_SWIG_Templates.hxx" using namespace MEDMEM; @@ -78,6 +80,14 @@ typedef FIELD <int, NoInterlace> FIELDINTNOINTERLACE; %include "typemaps.i" %include "my_typemap.i" +%typecheck(SWIG_TYPECHECK_POINTER) double *, const double *, + const double * const, int *, const int *, const int * const, string *, + const string *, const string * const, medGeometryElement *, + const medGeometryElement *, const medGeometryElement * const +{ + $1 = ($input != 0); +} + /* mapping between stl string and python string */ @@ -349,6 +359,66 @@ typedef FIELD <int, NoInterlace> FIELDINTNOINTERLACE; $1 = $input; } +/* + MACRO converting C++ MEDMEM::FIELD_ pointer into a PyObject pointer rightly + casted following its value type (int or double) and its interlacing mode + (FullInterlace or NoInterlace) by calling the function SWIG_NewPointer with + the appropriate $descriptor(...) +*/ + +%define TYPEMAP_OUTPUT_FIELDT(myField) +{ + FIELD_ *arg1=myField; + PyObject *myResult=NULL; + if(arg1) + { + FIELD<double> *try1=dynamic_cast<FIELD<double> *>(arg1); + if(try1) + myResult = SWIG_NewPointerObj((void *) try1, $descriptor(FIELD<double, FullInterlace> *), 0); + else + { + FIELD<int> *try2=dynamic_cast<FIELD<int> *>(arg1); + if(try2) + myResult = SWIG_NewPointerObj((void *) try2, $descriptor(FIELD<int, FullInterlace> *), 0); + else + { + FIELD<double, NoInterlace> *try3=dynamic_cast<FIELD<double, NoInterlace> *>(arg1); + if(try3) + myResult = SWIG_NewPointerObj((void *) try3, $descriptor(FIELD<double, NoInterlace> *), 0); + else + { + FIELD<int, NoInterlace> *try4=dynamic_cast<FIELD<int, NoInterlace> *>(arg1); + if(try4) + myResult = SWIG_NewPointerObj((void *) try4, $descriptor(FIELD<int, NoInterlace> *), 0); + else + { + myResult = SWIG_NewPointerObj((void *) arg1, $descriptor(FIELD_ *), 0); + } + } + } + } + } + return myResult; +} +%enddef + +/* + MACRO to transforme a C++ deque<string> object into a proper Python List +*/ + +%define TYPEMAP_OUTPUT_DEQUE_STRING(myDeque) +{ + PyObject *py_list = PyList_New(myDeque.size()); + deque<string>::iterator iter4; + int i4=0; + for(iter4=myDeque.begin();iter4!=myDeque.end();iter4++,i4++) + { + PyList_SetItem(py_list, i4, PyString_FromString((*iter4).c_str())); + } + return py_list; +} +%enddef + /* MACRO converting C array <arrayvar> of length <size> into a PyList by calling type_converter() for each array element. @@ -510,6 +580,8 @@ class SUPPORT MESH * getMesh() const; + std::string getMeshName() const; + void setMesh(MESH * Mesh) const; medEntityMesh getEntity() const; @@ -760,6 +832,10 @@ public: const std::string& fileName, const std::string& fieldName, const int iterationNumber, const int orderNumber); + FIELD(driverTypes driverType, const std::string& fileName, + const std::string& fieldName, const int iterationNumber, + const int orderNumber); + void read(int index=0); T1 getValueIJ(int i,int j) const; @@ -800,6 +876,10 @@ public: void writeAppend(int index=0, const std::string& driverName=""); + bool getGaussPresence(); + + GAUSS_LOCALIZATION<INTERLACING_TAG> * getGaussLocalizationPtr(MED_EN::medGeometryElement geomElement); + %extend { PyObject * applyPyFunc( PyObject * func ) { @@ -925,7 +1005,7 @@ public: FIELD::getRow); } - // this method replaces getValueI() in NInterlace mode + // this method replaces getValueI() in NoInterlace mode /*%newobject getColum(int );*/ PyObject * getColumn(int index) { @@ -1487,6 +1567,8 @@ class MED void write (int index=0); + void read (int index=0); + void addField ( FIELD_ * const ptrField ); void addMesh ( MESH * const ptrMesh ); @@ -1504,6 +1586,12 @@ class MED return self->addDriver(driverType,string(fileName),access); } + PyObject *getMeshNames() + { + deque<string> list_string = self->getMeshNames(); + TYPEMAP_OUTPUT_DEQUE_STRING(list_string); + } + %newobject getMeshName(int ); const char * getMeshName(int i) { @@ -1513,6 +1601,12 @@ class MED return tmp; } + PyObject *getFieldNames() + { + deque<string> list_string = self->getFieldNames(); + TYPEMAP_OUTPUT_DEQUE_STRING(list_string); + } + %newobject getFieldName(int ); const char * getFieldName(int i) { @@ -1547,6 +1641,12 @@ class MED return self->getField(string(fieldName),dt,it); } + PyObject *getFieldT(char * fieldName, int dt, int it) + { + FIELD_ *ret=self->getField(string(fieldName),dt,it); + TYPEMAP_OUTPUT_FIELDT(ret); + } + FIELD_ * getField2(char * fieldName,double time, int it=0) { return self->getField2(string(fieldName),time,it); @@ -2163,7 +2263,7 @@ public: void read ( void ) ; %extend { - MED_FIELD_RDONLY_DRIVER(char * fileName, FIELD< T1 > * ptrField) + MED_FIELD_RDONLY_DRIVER(char * fileName, FIELD<T1, FullInterlace > * ptrField) { return new MED_FIELD_RDONLY_DRIVER< T1 >(string(fileName), ptrField); } @@ -2211,7 +2311,7 @@ public: void read ( void ) ; %extend { - MED_FIELD_WRONLY_DRIVER(char * fileName, FIELD< T1 > * ptrField) + MED_FIELD_WRONLY_DRIVER(char * fileName, FIELD<T1, FullInterlace> * ptrField) { return new MED_FIELD_WRONLY_DRIVER< T1 >(string(fileName), ptrField); } @@ -2259,7 +2359,7 @@ public: void read ( void ) ; %extend { - MED_FIELD_RDWR_DRIVER(char * fileName, FIELD< T1 > * ptrField) + MED_FIELD_RDWR_DRIVER(char * fileName, FIELD<T1, FullInterlace> * ptrField) { return new MED_FIELD_RDWR_DRIVER< T1 >(string(fileName), ptrField); } @@ -2304,15 +2404,96 @@ public: %extend { - ASCII_FIELD_DRIVER(const char *fileName, FIELD<T1> * ptrField, med_sort_direc direction, const char *priority) + ASCII_FIELD_DRIVER(const char *fileName, FIELD<T1, FullInterlace> * ptrField, med_sort_direc direction, const char *priority) { return new ASCII_FIELD_DRIVER<T1>(string(fileName), ptrField, (MED_EN::med_sort_direc)direction, priority); } } }; + %template (ASCII_FIELDDOUBLE_DRIVER) ASCII_FIELD_DRIVER< double >; %template (ASCII_FIELDINT_DRIVER) ASCII_FIELD_DRIVER< int >; +/* +*/ + + +template <class INTERLACING_TAG> class GAUSS_LOCALIZATION +{ + public: + + GAUSS_LOCALIZATION(); + + ~GAUSS_LOCALIZATION(); + + std::string getName() const ; + + medGeometryElement getType() const ; + + int getNbGauss() const ; + + medModeSwitch getInterlacingType() const; + + %extend { + GAUSS_LOCALIZATION<INTERLACING_TAG>(char * locName, + const medGeometryElement + typeGeo, + const int nGauss, + const double * cooRef, + const double * cooGauss, + const double * wg) + { + return new GAUSS_LOCALIZATION<INTERLACING_TAG>(string(locName), + typeGeo, nGauss, cooRef, + cooGauss, wg); + } + + %newobject __str__(); + const char* __str__() + { + ostringstream mess; + mess << "Python Printing GAUSS_LOCALIZATION : " << *self << endl; + return strdup(mess.str().c_str()); + } + + PyObject * getRefCoo () const + { + typedef MEDMEM_ArrayInterface<double,INTERLACING_TAG,NoGauss>::Array ArrayNoGauss; + + ArrayNoGauss cooRef = self->getRefCoo(); + int size = cooRef.getArraySize(); + double * cooRefPtr = cooRef.getPtr(); + TYPEMAP_OUTPUT_ARRAY(cooRefPtr, size, PyFloat_FromDouble, + GAUSS_LOCALIZATION::getRefCoo); + } + + PyObject * getGsCoo () const + { + typedef MEDMEM_ArrayInterface<double,INTERLACING_TAG,NoGauss>::Array ArrayNoGauss; + ArrayNoGauss cooGauss = self->getGsCoo(); + int size = cooGauss.getArraySize(); + double * cooGaussPtr = cooGauss.getPtr(); + TYPEMAP_OUTPUT_ARRAY(cooGaussPtr, size, PyFloat_FromDouble, + GAUSS_LOCALIZATION::getGsCoo); + } + + PyObject * getWeight () const + { + vector<double> wg = self->getWeight(); + int size = wg.size(); + double * wgPtr = new double [size]; + for (int index = 0; index<size; index++) + wgPtr[index] = wg[index]; + TYPEMAP_OUTPUT_ARRAY(wgPtr, size, PyFloat_FromDouble, + GAUSS_LOCALIZATION::getWeight); + delete wgPtr; + } + } +}; + +%template (GAUSS_LOCALIZATION_FULL) GAUSS_LOCALIZATION<FullInterlace> ; +%template (GAUSS_LOCALIZATION_NO) GAUSS_LOCALIZATION<NoInterlace> ; + %{ template <class T, class INTERLACING_TAG> FIELD<T, INTERLACING_TAG> * createFieldScalarProduct(FIELD<T, INTERLACING_TAG> * field1, @@ -2338,6 +2519,18 @@ public: MESSAGE("Its returns a proper cast of the input pointer :: FIELD_ --> FIELD<T>"); return (FIELD<T, INTERLACING_TAG> *) field; } + + template <class T> FIELD<T, FullInterlace> * + createTypedFieldConvertFullInterlace(const FIELD<T, NoInterlace> & field ) + { + return FieldConvert(field); + } + + template <class T> FIELD<T, NoInterlace> * + createTypedFieldConvertNoInterlace(const FIELD<T, FullInterlace> & field ) + { + return FieldConvert(field); + } %} template<class T, class INTERLACING_TAG> FIELD<T, INTERLACING_TAG> * createTypedFieldFromField(FIELD_ * field); @@ -2368,6 +2561,24 @@ template <class T, class INTERLACING_TAG> FIELD<T, INTERLACING_TAG> * createFiel template<class T, class INTERLACING_TAG> FIELD<T, INTERLACING_TAG> * createFieldFromAnalytic(SUPPORT * Support, int NumberOfComponents, PyObject * double_function); +template <class T> FIELD<T, FullInterlace> * createTypedFieldConvertFullInterlace(const FIELD<T, NoInterlace> & field ); + +%template (createFieldDoubleConvertFullInterlace) createTypedFieldConvertFullInterlace<double>; + +%template (createFieldIntConvertFullInterlace) createTypedFieldConvertFullInterlace<int>; + +template <class T> FIELD<T, NoInterlace> * createTypedFieldConvertNoInterlace(const FIELD<T, FullInterlace> & field ); + +%template (createFieldDoubleConvertNoInterlace) createTypedFieldConvertNoInterlace<double>; + +%template (createFieldIntConvertNoInterlace) createTypedFieldConvertNoInterlace<int>; + +%newobject createFieldDoubleConvertFullInterlace ; +%newobject createFieldIntConvertFullInterlace ; + +%newobject createFieldDoubleConvertNoInterlace ; +%newobject createFieldIntConvertNoInterlace ; + GRID * createGridFromMesh( MESH * aMesh ); %{ diff --git a/src/MEDMEM_SWIG/med_test3.py b/src/MEDMEM_SWIG/med_test3.py index 26c74f3c3..620d5df35 100644 --- a/src/MEDMEM_SWIG/med_test3.py +++ b/src/MEDMEM_SWIG/med_test3.py @@ -1,12 +1,7 @@ -# -# This script does not work at the moment !!! -# - - ################################################################################### # # This Python script is parsing a MED file using MED Memory from SALOME platform: -# It tests the setValue(I) function on MED fields +# It tests the setValue, setRow and setColum functions on MED fields # ################################################################################### @@ -202,57 +197,37 @@ if (nbMeshes>0): for k in range(nbOf*nbOfComp): print " Set/Get Entry * ",value[k]," / ",valueverif[k] print "" - print " Randomly set (via setValueI) and get (via getValueI) to check with the same mode ..!" + print " Randomly set (via setRow/setColumn) and get (via getRow/getColumn) to check with the same mode ..!" value = [] for k in range(nbOf*nbOfComp): value.append(randint(0,100)) - print " the mode is full interlace" mode = MED_FULL_INTERLACE + print " the mode is full interlace ", mode + print " the field interlacing mode ",fieldFamilyIntg.getInterlacingType() for k in range(nbOf): - fieldFamilyIntg.setRow((k+1),value[k*nbOfComp:(k+1)*nbOfComp]) + valInd = numberFamily[k] + fieldFamilyIntg.setRow(valInd,value[k*nbOfComp:(k+1)*nbOfComp]) valueverif = [] for k in range(nbOf): - valueverif.extend(fieldFamilyIntg.getRow((k+1))) + valInd = numberFamily[k] + valueverif.extend(fieldFamilyIntg.getRow(valInd)) for k in range(nbOf*nbOfComp): print " Set/Get Entry * ",value[k]," / ",valueverif[k] print "" value = [] for k in range(nbOf*nbOfComp): value.append(randint(0,100)) - print " the mode is no interlace" mode = MED_NO_INTERLACE - for k in range(nbOfComp): - fieldFamilyIntg.setColumn((k+1),value[k*nbOf:(k+1)*nbOf]) - valueverif = [] - for k in range(nbOfComp): - valueverif.extend(fieldFamilyIntg.getColumn((k+1))) - for k in range(nbOf*nbOfComp): - print " Set/Get Entry * ",value[k]," / ",valueverif[k] - print "" - print " Randomly set (via setValueI) and get (via getValueI) to check with different mode ..!" - value = [] - for k in range(nbOf*nbOfComp): - value.append(randint(0,100)) - print " the mode for set is full interlace and no interlace for get" - mode_full = MED_FULL_INTERLACE - mode_no = MED_NO_INTERLACE + print " the mode is no interlace ", mode + print " the field interlacing mode ",fieldFamilyIntg.getInterlacingType() for k in range(nbOf): - fieldFamilyIntg.setRow((k+1),value[k*nbOfComp:(k+1)*nbOfComp]) + valInd = numberFamily[k] + fieldFamilyIntg.setRow(valInd,value[k*nbOfComp:(k+1)*nbOfComp]) + fieldFamilyIntgOtherMode = createFieldIntConvertNoInterlace(fieldFamilyIntg) valueverif = [] for k in range(nbOfComp): - valueverif.extend(fieldFamilyIntg.getColumn((k+1))) - for k in range(nbOf*nbOfComp): - print " Set/Get Entry * ",value[k]," / ",valueverif[k] - print "" - value = [] - for k in range(nbOf*nbOfComp): - value.append(randint(0,100)) - print " the mode for set is no interlace and full interlace for get" - for k in range(nbOfComp): - fieldFamilyIntg.setColumn((k+1),value[k*nbOf:(k+1)*nbOf]) - valueverif = [] - for k in range(nbOf): - valueverif.extend(fieldFamilyIntg.getRow((k+1))) + valueverif.extend(fieldFamilyIntgOtherMode.getColumn(k+1)) for k in range(nbOf*nbOfComp): print " Set/Get Entry * ",value[k]," / ",valueverif[k] print "" +print "END of the Pyhton script ..... Ctrl D to exit" diff --git a/src/MEDMEM_SWIG/my_typemap.i b/src/MEDMEM_SWIG/my_typemap.i index 5eecb9c63..98e316886 100644 --- a/src/MEDMEM_SWIG/my_typemap.i +++ b/src/MEDMEM_SWIG/my_typemap.i @@ -21,8 +21,8 @@ #include <stdio.h> %} -%typemap(python,in) string * { - /* typemap in for string * */ +%typemap(python,in) string * , const string * , const string * const { + /* typemap in for string * , const string * , const string * const */ /* Check if is a list */ if (PyList_Check($input)) { int size = PyList_Size($input); @@ -46,9 +46,9 @@ } } -%typemap(python,in) double * +%typemap(python,in) double * , const double * , const double * const { - /* typemap in for double * */ + /* typemap in for double * , const double * , const double * const */ /* Check if is a list */ if (PyList_Check($input)) { int size = PyList_Size($input); @@ -72,9 +72,9 @@ } } -%typemap(python,in) int * +%typemap(python,in) int * , const int * , const int * const { - /* typemap in for int * */ + /* typemap in for int * , const int * , const int * const */ /* Check if is a list */ if (PyList_Check($input)) { int size = PyList_Size($input); @@ -99,9 +99,9 @@ } -%typemap(python,in) medGeometryElement * +%typemap(python,in) medGeometryElement * , const medGeometryElement * , const medGeometryElement * const { - /* typemap in for medGeometryElement * */ + /* typemap in for medGeometryElement * , const medGeometryElement * , const medGeometryElement * const */ /* Check if is a list */ if (PyList_Check($input)) { int size = PyList_Size($input); @@ -134,18 +134,17 @@ PyList_SetItem($result,i,PyString_FromString((*iL).c_str())); } -%typemap(freearg) int * { - /* free the memory allocated in the typemap in for int * */ +%typemap(freearg) int * , const int * , const int * const { + /* free the memory allocated in the typemap in for int * , const int * , const int * const */ free($1); } -%typemap(freearg) double * { - /* free the memory allocated in the typemap in for double * */ +%typemap(freearg) double * , const double * , const double * const { + /* free the memory allocated in the typemap in for double * , const double * , const double * const */ free($1); } -%typemap(freearg) medGeometryElement * { - /* free the memory allocated in the typemap in for medGeometryElement * */ +%typemap(freearg) medGeometryElement * , const medGeometryElement * , const medGeometryElement * const { + /* free the memory allocated in the typemap in for medGeometryElement * , const medGeometryElement * , const medGeometryElement * const */ free($1); } - diff --git a/src/MEDMEM_SWIG/testGaussLocalization.py b/src/MEDMEM_SWIG/testGaussLocalization.py new file mode 100644 index 000000000..ffc2959e2 --- /dev/null +++ b/src/MEDMEM_SWIG/testGaussLocalization.py @@ -0,0 +1,116 @@ +################################################################################### +# +# This Python script is to test the API of the C++ GAUSS_LOCALIZATION class +# defined in MEDMEM_GaussLocalization.hxx. This test is the Python equivalent +# of the test_GaussLocalization.cxx program. +# +################################################################################### + +from libMEDMEM_Swig import * + +a = 0.446948490915965 +b = 0.091576213509771 +p1 = 0.11169079483905 +p2 = 0.0549758718227661 + +typeGeo = MED_TRIA6 + +ngauss = 6 + +gaussLocName = "Model n1" + +refCoo = [-1.0,1.0, + -1.0,-1.0, + 1.0,-1.0, + -1.0,0.0, + 0.0,-1.0, + 0.0,0.0] + +gsCoo = [2*b-1, 1-4*b, + 2*b-1, 2*b-1, + 1-4*b, 2*b-1, + 1-4*a, 2*a-1, + 2*a-1, 1-4*a, + 2*a-1, 2*a-1] + +weight = [4*p2, 4*p2, 4*p2, 4*p1, 4*p1, 4*p1] + +interlacingType = MED_FULL_INTERLACE + +gaussLoc = GAUSS_LOCALIZATION_FULL(gaussLocName, typeGeo, ngauss, refCoo, + gsCoo, weight) + +print "Gauss Localization via the str operator: ", gaussLoc + +print "Gauss Localization via the get methods from the class API" + +typeGeoVerif = gaussLoc.getType() + +ngaussVerif = gaussLoc.getNbGauss() + +gaussLocNameVerif = gaussLoc.getName() + +refCooVerif = gaussLoc.getRefCoo() + +gsCooVerif = gaussLoc.getGsCoo() + +weightVerif = gaussLoc.getWeight() + +interlacingTypeVerif = gaussLoc.getInterlacingType() + +lenrefCoo = len(refCoo) +lenrefCooVerif = len(refCooVerif) + +lengsCoo = len(gsCoo) +lengsCooVerif = len(gsCooVerif) + +lenweight = len(weight) +lenweightVerif = len(weightVerif) + +if (typeGeo != typeGeoVerif): + print "the geometric type does not match" + print typeGeo, " verif ", typeGeo + pass + +if (ngauss != ngaussVerif): + print "the number of Gauss points does not match" + print ngauss, " verif ", ngaussVerif + pass + +if (interlacingType != interlacingTypeVerif): + print "the interlacing type does not match" + print interlacingType, " verif ", interlacingTypeVerif + pass + +if (gaussLocName != gaussLocNameVerif): + print "the Gauss Location name does not match" + print gaussLocName, " verif ", gaussLocNameVerif + pass + +if (lenrefCoo == lenrefCooVerif): + print "refCoo verification -- length ",lenrefCoo + for i in range(lenrefCoo): + if (refCoo[i] != refCooVerif[i]): + print " * ",i," ",refCoo[i], " --- ",refCooVerif[i] +else: + print "the array of referrence element coordinates does not match" + +if (lengsCoo == lengsCooVerif): + print "gsCoo verification -- length ",lengsCoo + for i in range(lengsCoo): + if (gsCoo[i] != gsCooVerif[i]): + print " * ",i," ",gsCoo[i], " --- ",gsCooVerif[i] +else: + print "the array of gauss points coordinates does not match" + +if (lenweight == lenweightVerif): + print "weight verification -- length ",lenweight + for i in range(lenweight): + if (weight[i] != weightVerif[i]): + print " * ",i," ",weight[i], " --- ",weightVerif[i] +else: + print "the array of gauss points weight does not match" + +print "seems to be OK" +print "" +print "END of the Pyhton script ..... Ctrl D to exit" diff --git a/src/MEDMEM_SWIG/testMedObj.py b/src/MEDMEM_SWIG/testMedObj.py new file mode 100755 index 000000000..a85882d17 --- /dev/null +++ b/src/MEDMEM_SWIG/testMedObj.py @@ -0,0 +1,114 @@ +################################################################################### +# +# This Python script is testing the mounting in memory of a med file, +# via the object MED and the writing of this object MED in Med file format +# V2.1 V2.2 +# +# Then from the 2 file produced before, a mounting and a writing of those files in +# different Med file format is tested +# +################################################################################### + +from libMEDMEM_Swig import * +import string +import os +# +#befor running this script, please be sure about the path the files +# +filePath=os.environ["MED_ROOT_DIR"] +filePath=filePath+"/share/salome/resources/" + +medFile = "pointe.med" + +medFile = filePath + medFile +rootFile = string.split(medFile,".")[0] +medFileOut21 = rootFile + "_Out21.med" +medFileOut22 = rootFile + "_Out22.med" + +print "Mounting in memory of the MED object from the file ",medFile +medObj = MED(MED_DRIVER,medFile) + +print "" +print "Reading the object" +medObj.read() + +medFileVersion = getMedFileVersionForWriting() + +if (medFileVersion == V22): + setMedFileVersionForWriting(V21) + pass + +print "" +print "Adding a med file V2.1 format driver to the MED object with the file ",medFileOut21 +idMedV21 = medObj.addDriver(MED_DRIVER,medFileOut21) + +print "" +print "Writing the MED object in the med file V2.1 format file" +medObj.write(idMedV21) + +medFileVersion = getMedFileVersionForWriting() +if (medFileVersion == V21): + setMedFileVersionForWriting(V22) + pass + +print "" +print "Adding a med file V2.2 format driver to the MED object with the file ",medFileOut22 +idMedV22 = medObj.addDriver(MED_DRIVER,medFileOut22) + +print "" +print "Writing the MED object in med file V2.2 format file" +medObj.write(idMedV22) + +print "" +print "Mounting in memory of the two files produced and writing them again" + +medFiles = [] +medFiles.append(medFileOut21) +medFiles.append(medFileOut22) +nbOfFiles = len(medFiles) + +for i in range(nbOfFiles): + medFile = medFiles[i] + + rootFile = string.split(medFile,".")[0] + medFileOut21 = rootFile + "_Out21.med" + medFileOut22 = rootFile + "_Out22.med" + + print "" + print " Mounting in memory of the MED object from the file ",medFile + medObj = MED(MED_DRIVER,medFile) + + print "" + print " Reading the object" + medObj.read() + + medFileVersion = getMedFileVersionForWriting() + + if (medFileVersion == V22): + setMedFileVersionForWriting(V21) + pass + + print "" + print " Adding a med file V2.1 format driver to the MED object with the file ",medFileOut21 + idMedV21 = medObj.addDriver(MED_DRIVER,medFileOut21) + + print "" + print " Writing the MED object in the med file V2.1 format file" + medObj.write(idMedV21) + + medFileVersion = getMedFileVersionForWriting() + if (medFileVersion == V21): + setMedFileVersionForWriting(V22) + pass + + print "" + print " Adding a med file V2.2 format driver to the MED object with the file ",medFileOut22 + idMedV22 = medObj.addDriver(MED_DRIVER,medFileOut22) + + print "" + print " Writing the MED object in med file V2.2 format file" + medObj.write(idMedV22) + pass + +print "" +print "END of the Pyhton script ..... Ctrl D to exit" diff --git a/src/MEDMEM_SWIG/testWriteAndFam.py b/src/MEDMEM_SWIG/testWriteAndFam.py new file mode 100755 index 000000000..2ee8d2f95 --- /dev/null +++ b/src/MEDMEM_SWIG/testWriteAndFam.py @@ -0,0 +1,160 @@ +################################################################################### +# +# This Python script is testing the writing in Med format V2.1 V2.2 +# +# You can check if the analysis of the families is OK. +# +################################################################################### + +from libMEDMEM_Swig import * +import string +import os +# +#befor running this script, please be sure about the path the files +# +filePath=os.environ["MED_ROOT_DIR"] +filePath=filePath+"/share/salome/resources/" + +medFiles = [] +medFiles.append("geomMesh21.med") +medFiles.append("geomMesh22.med") +nbOfFiles = len(medFiles) + +for i in range(nbOfFiles): + medFile = medFiles[i] + medFile = filePath + medFile + medFiles[i] = medFile + pass + +meshName = "GeomMesh" + +for i in range(nbOfFiles): + medFile = medFiles[i] + + rootFile = string.split(medFile,".")[0] + medFileOut21 = rootFile + "Out21.med" + medFileOut22 = rootFile + "Out22.med" + + print "Mounting in memory of the mesh ",meshName," from the file ",medFile + mesh = MESH(MED_DRIVER,medFile,meshName) + + print "" + print "Families analysis of the mesh ",meshName," from the file ",medFile + print "" + + for entity in [MED_NODE,MED_CELL,MED_FACE,MED_EDGE]: + nbFam = mesh.getNumberOfFamilies(entity) + if (entity == MED_NODE) & (nbFam > 0): + print "This mesh has",nbFam,"Node Family(ies)" + pass + elif (entity == MED_CELL) & (nbFam > 0): + print "This mesh has",nbFam,"Cell Family(ies)" + pass + elif (entity == MED_FACE) & (nbFam > 0): + print "This mesh has",nbFam,"Face Family(ies)" + pass + elif (entity == MED_EDGE) & (nbFam > 0): + print "This mesh has",nbFam,"Edge Family(ies)" + pass + + if nbFam > 0: + for j in range(nbFam): + print "" + family = mesh.getFamily(entity,j+1) + familyName = family.getName() + familyBool = family.isOnAllElements() + if (familyBool): + print " -this famyly named ",familyName," is on all entities" + pass + else: + familyNumber = family.getNumber(MED_ALL_ELEMENTS) + print " -this famyly named ",familyName," has ",len(familyNumber)," entities" + pass + pass + pass + pass + + medFileVersion = getMedFileVersionForWriting() + + if (medFileVersion == V22): + setMedFileVersionForWriting(V21) + pass + + print "" + print " adding a Med file V2.1 format driver to the mesh with the file ",medFileOut21 + idMedV21 = mesh.addDriver(MED_DRIVER,medFileOut21,mesh.getName()) + + print "" + print " writing the mesh in Med file V2.1 format" + mesh.write(idMedV21) + + medFileVersion = getMedFileVersionForWriting() + if (medFileVersion == V21): + setMedFileVersionForWriting(V22) + pass + + print "" + print " adding a Med file V2.2 format driver to the mesh with the file ",medFileOut22 + idMedV22 = mesh.addDriver(MED_DRIVER,medFileOut22,mesh.getName()) + + print "" + print " writing the mesh in Med file V2.2 format" + mesh.write(idMedV22) + print "" + pass + +medFiles2 = [] + +for i in range(nbOfFiles): + medFile = medFiles[i] + rootFile = string.split(medFile,".")[0] + medFileOut21 = rootFile + "Out21.med" + medFileOut22 = rootFile + "Out22.med" + + medFiles2.append(medFileOut21) + medFiles2.append(medFileOut22) + pass + +nbOfFiles = len(medFiles2) + +for i in range(nbOfFiles): + medFile = medFiles2[i] + mesh = MESH(MED_DRIVER,medFile,meshName) + + print "Families analysis of the mesh ",meshName," from the file ",medFile + print "" + for entity in [MED_NODE,MED_CELL,MED_FACE,MED_EDGE]: + nbFam = mesh.getNumberOfFamilies(entity) + if (entity == MED_NODE) & (nbFam > 0): + print "This mesh has",nbFam,"Node Family(ies)" + pass + elif (entity == MED_CELL) & (nbFam > 0): + print "This mesh has",nbFam,"Cell Family(ies)" + pass + elif (entity == MED_FACE) & (nbFam > 0): + print "This mesh has",nbFam,"Face Family(ies)" + pass + elif (entity == MED_EDGE) & (nbFam > 0): + print "This mesh has",nbFam,"Edge Family(ies)" + pass + + if nbFam > 0: + for j in range(nbFam): + print "" + family = mesh.getFamily(entity,j+1) + familyName = family.getName() + familyBool = family.isOnAllElements() + if (familyBool): + print " -this famyly named ",familyName," is on all entities" + pass + else: + familyNumber = family.getNumber(MED_ALL_ELEMENTS) + print " -this famyly named ",familyName," has ",len(familyNumber)," entities" + pass + pass + pass + pass + pass + +print "" +print "END of the Pyhton script ..... Ctrl D to exit" diff --git a/src/MEDMEM_SWIG/test_profil_MedFieldDriver.py b/src/MEDMEM_SWIG/test_profil_MedFieldDriver.py new file mode 100644 index 000000000..37cd5065b --- /dev/null +++ b/src/MEDMEM_SWIG/test_profil_MedFieldDriver.py @@ -0,0 +1,93 @@ +############################################################################ +# +# this Python script is testing the profil functionality using the FIELD +# constructor via a MED driver. +# +############################################################################ + +from libMEDMEM_Swig import * + +# users inputs +#test 1 --- zzzz121b_without_tr6.med RESUZERODEPL____________________ 1 1 +#test 2 --- zzzz121b_without_tr6.med RESUZEROERRE_ELGA_NORE__________ 1 1 +#test 3 --- maill.00.med Indicateur_d_erreur_00 2 2 + +medFile = "zzzz121b_without_tr6.med" +#medFile = "maill.00.med" + +fieldName = "RESUZERODEPL____________________" +#fieldName = "RESUZEROERRE_ELGA_NORE__________" +#fieldName = "Indicateur_d_erreur_00" + +# default value, may be changed according to what field is stored in medFile +##iterationNumber = -1 +##orderNumber = -1 +iterationNumber = 1 +orderNumber = 1 +#iterationNumber = 2 +#orderNumber = 2 + +import os +# +#befor running this script, please be sure about the path the file fileName +# +filePath=os.environ["MED_ROOT_DIR"] +filePath=filePath+"/share/salome/resources/" + +medFile = filePath + medFile + +def analyseField(field): + fieldName = field.getName() + fieldType = field.getValueType() + fieldDesc = field.getDescription() + fieldIterationNumber = field.getIterationNumber() + fieldOrderNumber = field.getOrderNumber() + fieldTime = field.getTime() + fieldNbOfComp = field.getNumberOfComponents() + print "The field ",fieldName," with the description ",fieldDesc," typed ",fieldType + print "Iteration number ",fieldIterationNumber," OrderNumber ",fieldOrderNumber," Time ",fieldTime + print "It has ",fieldNbOfComp,"components" + for k in range(fieldNbOfComp): + kp1 = k+1 + fieldCompName = field.getComponentName(kp1) + fieldCompDesc = field.getComponentDescription(kp1) + fieldCompUnit = field.getMEDComponentUnit(kp1) + print " * Component:",kp1 + print " Name:",fieldCompName + print " Description:",fieldCompDesc + print " Unit:",fieldCompUnit + pass + fieldSupport = field.getSupport() + fieldMeshName = fieldSupport.getMeshName() + fieldSupportOnAll = fieldSupport.isOnAllElements() + fieldNbEntities = fieldSupport.getNumberOfElements(MED_ALL_ELEMENTS) + fieldEntityType = fieldSupport.getEntity() + fieldSupportNumber = range(1,fieldNbEntities+1) + if (not fieldSupportOnAll): + fieldSupportNumber = fieldSupport.getNumber(MED_ALL_ELEMENTS) + pass + print " fieldSupportNumber ", fieldSupportNumber + fieldInterlacingType = field.getInterlacingType() + print "It relies on the mesh named ",fieldMeshName + print "its interlacing type ",fieldInterlacingType + print "and it is on ",fieldNbEntities," entities of the type ",fieldEntityType + if (fieldInterlacingType == MED_FULL_INTERLACE): + for i in range(fieldNbEntities): + value = field.getRow(fieldSupportNumber[i]) + print " * ",fieldSupportNumber[i]," --- ",value + pass + pass + elif (fieldInterlacingType == MED_FULL_INTERLACE): + for i in range(fieldNbOfComp): + value = field.getColumn(fieldSupportNumber[i]) + print " * ",fieldSupportNumber[i]," --- ",value + pass + pass + pass + +field = FIELDDOUBLE(MED_DRIVER, medFile, fieldName, + iterationNumber, orderNumber) + +analyseField(field) + +print "END of the Pyhton script ..... Ctrl D to exit" diff --git a/src/MEDWrapper/Base/MED_Algorithm.cxx b/src/MEDWrapper/Base/MED_Algorithm.cxx index 6f523efec..b9b215532 100644 --- a/src/MEDWrapper/Base/MED_Algorithm.cxx +++ b/src/MEDWrapper/Base/MED_Algorithm.cxx @@ -50,32 +50,22 @@ namespace MED MSG(MYDEBUG,"GetElemsByEntity(...)"); TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo; MED::TEntityInfo::const_iterator anIter = theEntityInfo.begin(); + PElemInfo anElemInfo; + TErr anErr; for(; anIter != theEntityInfo.end(); anIter++){ const EEntiteMaillage& anEntity = anIter->first; const TGeom2Size& aGeom2Size = anIter->second; TGeom2ElemInfo& aGeom2ElemInfo = anEntity2TGeom2ElemInfo[anEntity]; if(anEntity == eNOEUD){ - aGeom2ElemInfo[ePOINT1] = theWrapper->GetPNodeInfo(theMeshInfo); + aGeom2ElemInfo[ePOINT1] = theWrapper->GetPElemInfo(theMeshInfo); continue; } TGeom2Size::const_iterator anIter2 = aGeom2Size.begin(); for(; anIter2 != aGeom2Size.end(); anIter2++){ const EGeometrieElement& aGeom = anIter2->first; - switch(aGeom){ - case ePOLYGONE: { - aGeom2ElemInfo[ePOLYGONE] = theWrapper->GetPPolygoneInfo(theMeshInfo,anEntity,aGeom); - break; - } - case ePOLYEDRE: { - aGeom2ElemInfo[ePOLYEDRE] = theWrapper->GetPPolyedreInfo(theMeshInfo,anEntity,aGeom); - break; - } - default: { - aGeom2ElemInfo[aGeom] = theWrapper->GetPCellInfo(theMeshInfo,anEntity,aGeom); - }} - + aGeom2ElemInfo[aGeom] = theWrapper->GetPElemInfo(theMeshInfo,anEntity,aGeom,MED::eNOD,&anErr); } } ADDMSG(MYDEBUG,"\n"); diff --git a/src/MEDWrapper/Base/MED_Common.hxx b/src/MEDWrapper/Base/MED_Common.hxx index f659a8fc2..7775b16ce 100644 --- a/src/MEDWrapper/Base/MED_Common.hxx +++ b/src/MEDWrapper/Base/MED_Common.hxx @@ -81,6 +81,10 @@ namespace MED{ typedef enum {eNO_PFLMOD, eGLOBAL, eCOMPACT} EModeProfil; + typedef enum {eGRILLE_CARTESIENNE,eGRILLE_POLAIRE,eGRILLE_STANDARD} EGrilleType; + + typedef enum {eCOOR, eCONN, eNOM, eNUM, eFAM,eCOOR_IND1,eCOOR_IND2,eCOOR_IND3} ETable; + typedef TVector<TFloat> TFloatVector; typedef TVector<std::string> TStringVector; typedef TVector<TInt> TIntVector; @@ -160,6 +164,9 @@ namespace MED{ struct TGaussInfo; typedef SharedPtr<TGaussInfo> PGaussInfo; + class TGrilleInfo; + typedef SharedPtr<TGrilleInfo> PGrilleInfo; + struct TTimeStampVal; typedef SharedPtr<TTimeStampVal> PTimeStampVal; diff --git a/src/MEDWrapper/Base/MED_CoordUtils.cxx b/src/MEDWrapper/Base/MED_CoordUtils.cxx index 74225911b..2b9e0956c 100644 --- a/src/MEDWrapper/Base/MED_CoordUtils.cxx +++ b/src/MEDWrapper/Base/MED_CoordUtils.cxx @@ -125,6 +125,8 @@ namespace MED bool anIsDimPresent[3] = {false, false, false}; for(int iDim = 0; iDim < aMeshDimension; iDim++){ std::string aName = theNodeInfo->GetCoordName(iDim); + if ( aName.size() > 1 ) // PAL12148, aName has size 8 or 16 + aName = aName.substr(0,1); if(aName == "x" || aName == "X") anIsDimPresent[eX] = true; else if(aName == "y" || aName == "Y") diff --git a/src/MEDWrapper/Base/MED_GaussUtils.cxx b/src/MEDWrapper/Base/MED_GaussUtils.cxx index ad532ba42..8ca5447d2 100644 --- a/src/MEDWrapper/Base/MED_GaussUtils.cxx +++ b/src/MEDWrapper/Base/MED_GaussUtils.cxx @@ -216,10 +216,6 @@ namespace MED "- aNbRef("<<aNbRef<<")"<< "; aNbRef2("<<aNbRef2<<")\n"); bool anIsSatisfy = (aNbRef == aNbRef2); -#ifndef _DEBUG_REF_COORDS_ - static TInt NB_REF_TO_CHECK = 2; - aNbRef = NB_REF_TO_CHECK; -#endif if(anIsSatisfy){ for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ const TCCoordSlice& aCoord2 = theRefCoord[aRefId]; @@ -234,11 +230,15 @@ namespace MED } } if(!anIsEqual){ - const TCCoordSlice& aCoord = theRefCoord[aRefId]; - INITMSG(MYDEBUG,aRefId + 1<<":{"); + TCCoordSlice aCoord = GetCoord(aRefId); + INITMSG(MYDEBUG,aRefId + 1<<": aCoord = {"); TInt aDim = aCoord.size(); for(TInt anId = 0; anId < aDim; anId++) ADDMSG(MYDEBUG,"\t"<<aCoord[anId]); + const TCCoordSlice& aCoord2 = theRefCoord[aRefId]; + ADDMSG(MYDEBUG,"}\t!=\taCoord2 = {"); + for(TInt anId = 0; anId < aDim; anId++) + ADDMSG(MYDEBUG,"\t"<<aCoord2[anId]); ADDMSG(MYDEBUG,"}\n"); #ifndef _DEBUG_ return anIsSatisfy; @@ -622,6 +622,146 @@ namespace MED }; + //--------------------------------------------------------------- + struct TQuad8a: TShapeFun + { + TQuad8a(): + TShapeFun(2,8) + { + TInt aNbRef = GetNbRef(); + for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + TCoordSlice aCoord = GetCoord(aRefId); + switch(aRefId){ + case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; break; + case 1: aCoord[0] = -1.0; aCoord[1] = -1.0; break; + case 2: aCoord[0] = 1.0; aCoord[1] = -1.0; break; + case 3: aCoord[0] = 1.0; aCoord[1] = 1.0; break; + + case 4: aCoord[0] = -1.0; aCoord[1] = 0.0; break; + case 5: aCoord[0] = 0.0; aCoord[1] = -1.0; break; + case 6: aCoord[0] = 1.0; aCoord[1] = 0.0; break; + case 7: aCoord[0] = 0.0; aCoord[1] = 1.0; break; + } + } + } + + virtual + void + InitFun(const TShapeFun::TCCoordSliceArr& theRef, + const TShapeFun::TCCoordSliceArr& theGauss, + TFun& theFun) const + { + GetFun(theRef,theGauss,theFun); + + TInt aNbGauss = theGauss.size(); + for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){ + const TCCoordSlice& aCoord = theGauss[aGaussId]; + TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId); + + aSlice[0] = 0.25*(1.0 + aCoord[1])*(1.0 - aCoord[0])*(aCoord[1] - aCoord[0] - 1.0); + aSlice[1] = 0.25*(1.0 - aCoord[1])*(1.0 - aCoord[0])*(-aCoord[1] - aCoord[0] - 1.0); + aSlice[2] = 0.25*(1.0 - aCoord[1])*(1.0 + aCoord[0])*(-aCoord[1] + aCoord[0] - 1.0); + aSlice[3] = 0.25*(1.0 + aCoord[1])*(1.0 + aCoord[0])*(aCoord[1] + aCoord[0] - 1.0); + + aSlice[4] = 0.5*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[1]); + aSlice[5] = 0.5*(1.0 - aCoord[1])*(1.0 - aCoord[0])*(1.0 + aCoord[0]); + aSlice[6] = 0.5*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[1]); + aSlice[7] = 0.5*(1.0 + aCoord[1])*(1.0 - aCoord[0])*(1.0 + aCoord[0]); + } + } + }; + + + //--------------------------------------------------------------- + struct TQuad4b: TShapeFun + { + TQuad4b(): + TShapeFun(2,4) + { + TInt aNbRef = GetNbRef(); + for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + TCoordSlice aCoord = GetCoord(aRefId); + switch(aRefId){ + case 0: aCoord[0] = -1.0; aCoord[1] = -1.0; break; + case 1: aCoord[0] = 1.0; aCoord[1] = -1.0; break; + case 2: aCoord[0] = 1.0; aCoord[1] = 1.0; break; + case 3: aCoord[0] = -1.0; aCoord[1] = 1.0; break; + } + } + } + + virtual + void + InitFun(const TShapeFun::TCCoordSliceArr& theRef, + const TShapeFun::TCCoordSliceArr& theGauss, + TFun& theFun) const + { + GetFun(theRef,theGauss,theFun); + + TInt aNbGauss = theGauss.size(); + for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){ + const TCCoordSlice& aCoord = theGauss[aGaussId]; + TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId); + + aSlice[0] = 0.25*(1.0 - aCoord[0])*(1.0 - aCoord[1]); + aSlice[1] = 0.25*(1.0 + aCoord[0])*(1.0 - aCoord[1]); + aSlice[2] = 0.25*(1.0 + aCoord[0])*(1.0 + aCoord[1]); + aSlice[3] = 0.25*(1.0 - aCoord[0])*(1.0 + aCoord[1]); + } + } + }; + + + //--------------------------------------------------------------- + struct TQuad8b: TShapeFun + { + TQuad8b(): + TShapeFun(2,8) + { + TInt aNbRef = GetNbRef(); + for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + TCoordSlice aCoord = GetCoord(aRefId); + switch(aRefId){ + case 0: aCoord[0] = -1.0; aCoord[1] = -1.0; break; + case 1: aCoord[0] = 1.0; aCoord[1] = -1.0; break; + case 2: aCoord[0] = 1.0; aCoord[1] = 1.0; break; + case 3: aCoord[0] = -1.0; aCoord[1] = 1.0; break; + + case 4: aCoord[0] = 0.0; aCoord[1] = -1.0; break; + case 5: aCoord[0] = 1.0; aCoord[1] = 0.0; break; + case 6: aCoord[0] = 0.0; aCoord[1] = 1.0; break; + case 7: aCoord[0] = -1.0; aCoord[1] = 0.0; break; + } + } + } + + virtual + void + InitFun(const TShapeFun::TCCoordSliceArr& theRef, + const TShapeFun::TCCoordSliceArr& theGauss, + TFun& theFun) const + { + GetFun(theRef,theGauss,theFun); + + TInt aNbGauss = theGauss.size(); + for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){ + const TCCoordSlice& aCoord = theGauss[aGaussId]; + TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId); + + aSlice[0] = 0.25*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(-1.0 - aCoord[0] - aCoord[1]); + aSlice[1] = 0.25*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(-1.0 + aCoord[0] - aCoord[1]); + aSlice[2] = 0.25*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(-1.0 + aCoord[0] + aCoord[1]); + aSlice[3] = 0.25*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(-1.0 - aCoord[0] + aCoord[1]); + + aSlice[4] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1]); + aSlice[5] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 + aCoord[0]); + aSlice[6] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 + aCoord[1]); + aSlice[7] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 - aCoord[0]); + } + } + }; + + //--------------------------------------------------------------- struct TTetra4a: TShapeFun { @@ -718,6 +858,104 @@ namespace MED }; + //--------------------------------------------------------------- + + + struct TTetra4b: TShapeFun + { + TTetra4b(): + TShapeFun(3,4) + { + TInt aNbRef = GetNbRef(); + for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + TCoordSlice aCoord = GetCoord(aRefId); + switch(aRefId){ + case 0: aCoord[0] = 0.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; + case 2: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break; + case 1: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + case 3: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + } + } + } + + virtual + void + InitFun(const TShapeFun::TCCoordSliceArr& theRef, + const TShapeFun::TCCoordSliceArr& theGauss, + TFun& theFun) const + { + GetFun(theRef,theGauss,theFun); + + TInt aNbGauss = theGauss.size(); + for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){ + const TCCoordSlice& aCoord = theGauss[aGaussId]; + TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId); + + aSlice[0] = aCoord[1]; + aSlice[2] = aCoord[2]; + aSlice[1] = 1.0 - aCoord[0] - aCoord[1] - aCoord[2]; + aSlice[3] = aCoord[0]; + } + } + }; + + + //--------------------------------------------------------------- + struct TTetra10b: TShapeFun + { + TTetra10b(): + TShapeFun(3,10) + { + TInt aNbRef = GetNbRef(); + for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + TCoordSlice aCoord = GetCoord(aRefId); + switch(aRefId){ + case 0: aCoord[0] = 0.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; + case 2: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break; + case 1: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + case 3: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + + case 6: aCoord[0] = 0.0; aCoord[1] = 0.5; aCoord[2] = 0.5; break; + case 5: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 0.5; break; + case 4: aCoord[0] = 0.0; aCoord[1] = 0.5; aCoord[2] = 0.0; break; + + case 7: aCoord[0] = 0.5; aCoord[1] = 0.5; aCoord[2] = 0.0; break; + case 9: aCoord[0] = 0.5; aCoord[1] = 0.0; aCoord[2] = 0.5; break; + case 8: aCoord[0] = 0.5; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + } + } + } + + virtual + void + InitFun(const TShapeFun::TCCoordSliceArr& theRef, + const TShapeFun::TCCoordSliceArr& theGauss, + TFun& theFun) const + { + GetFun(theRef,theGauss,theFun); + + TInt aNbGauss = theGauss.size(); + for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){ + const TCCoordSlice& aCoord = theGauss[aGaussId]; + TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId); + + aSlice[0] = aCoord[1]*(2.0*aCoord[1] - 1.0); + aSlice[2] = aCoord[2]*(2.0*aCoord[2] - 1.0); + aSlice[1] = (1.0 - aCoord[0] - aCoord[1] - aCoord[2])*(1.0 - 2.0*aCoord[0] - 2.0*aCoord[1] - 2.0*aCoord[2]); + aSlice[3] = aCoord[0]*(2.0*aCoord[0] - 1.0); + + aSlice[6] = 4.0*aCoord[1]*aCoord[2]; + aSlice[5] = 4.0*aCoord[2]*(1.0 - aCoord[0] - aCoord[1] - aCoord[2]); + aSlice[4] = 4.0*aCoord[1]*(1.0 - aCoord[0] - aCoord[1] - aCoord[2]); + + aSlice[7] = 4.0*aCoord[0]*aCoord[1]; + aSlice[9] = 4.0*aCoord[0]*aCoord[2]; + aSlice[8] = 4.0*aCoord[0]*(1.0 - aCoord[0] - aCoord[1] - aCoord[2]); + } + } + }; + + //--------------------------------------------------------------- struct THexa8a: TShapeFun { @@ -766,7 +1004,7 @@ namespace MED } }; - + //--------------------------------------------------------------- struct THexa20a: TShapeFun { THexa20a(TInt theDim = 3, TInt theNbRef = 20): @@ -915,6 +1153,137 @@ namespace MED }; + //--------------------------------------------------------------- + struct THexa8b: TShapeFun + { + THexa8b(): + TShapeFun(3,8) + { + TInt aNbRef = GetNbRef(); + for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + TCoordSlice aCoord = GetCoord(aRefId); + switch(aRefId){ + case 0: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break; + case 3: aCoord[0] = 1.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break; + case 2: aCoord[0] = 1.0; aCoord[1] = 1.0; aCoord[2] = -1.0; break; + case 1: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = -1.0; break; + case 4: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = 1.0; break; + case 7: aCoord[0] = 1.0; aCoord[1] = -1.0; aCoord[2] = 1.0; break; + case 6: aCoord[0] = 1.0; aCoord[1] = 1.0; aCoord[2] = 1.0; break; + case 5: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 1.0; break; + } + } + } + + virtual + void + InitFun(const TShapeFun::TCCoordSliceArr& theRef, + const TShapeFun::TCCoordSliceArr& theGauss, + TFun& theFun) const + { + GetFun(theRef,theGauss,theFun); + + TInt aNbGauss = theGauss.size(); + for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){ + const TCCoordSlice& aCoord = theGauss[aGaussId]; + TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId); + + aSlice[0] = 0.125*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2]); + aSlice[3] = 0.125*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2]); + aSlice[2] = 0.125*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2]); + aSlice[1] = 0.125*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2]); + + aSlice[4] = 0.125*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2]); + aSlice[7] = 0.125*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2]); + aSlice[6] = 0.125*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2]); + aSlice[5] = 0.125*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2]); + } + } + }; + + + //--------------------------------------------------------------- + struct THexa20b: TShapeFun + { + THexa20b(TInt theDim = 3, TInt theNbRef = 20): + TShapeFun(theDim,theNbRef) + { + TInt aNbRef = myRefCoord.size(); + for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + TCoordSlice aCoord = GetCoord(aRefId); + switch(aRefId){ + case 0: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break; + case 3: aCoord[0] = 1.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break; + case 2: aCoord[0] = 1.0; aCoord[1] = 1.0; aCoord[2] = -1.0; break; + case 1: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = -1.0; break; + case 4: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = 1.0; break; + case 7: aCoord[0] = 1.0; aCoord[1] = -1.0; aCoord[2] = 1.0; break; + case 6: aCoord[0] = 1.0; aCoord[1] = 1.0; aCoord[2] = 1.0; break; + case 5: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 1.0; break; + + case 11: aCoord[0] = 0.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break; + case 10: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = -1.0; break; + case 9: aCoord[0] = 0.0; aCoord[1] = 1.0; aCoord[2] = -1.0; break; + case 8: aCoord[0] = -1.0; aCoord[1] = 0.0; aCoord[2] = -1.0; break; + case 16: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = 0.0; break; + case 19: aCoord[0] = 1.0; aCoord[1] = -1.0; aCoord[2] = 0.0; break; + case 18: aCoord[0] = 1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; + case 17: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; + case 15: aCoord[0] = 0.0; aCoord[1] = -1.0; aCoord[2] = 1.0; break; + case 14: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break; + case 13: aCoord[0] = 0.0; aCoord[1] = 1.0; aCoord[2] = 1.0; break; + case 12: aCoord[0] = -1.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break; + } + } + } + + virtual + void + InitFun(const TShapeFun::TCCoordSliceArr& theRef, + const TShapeFun::TCCoordSliceArr& theGauss, + TFun& theFun) const + { + GetFun(theRef,theGauss,theFun); + + TInt aNbGauss = theGauss.size(); + for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){ + const TCCoordSlice& aCoord = theGauss[aGaussId]; + TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId); + + aSlice[0] = 0.125*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2])* + (-2.0 - aCoord[0] - aCoord[1] - aCoord[2]); + aSlice[3] = 0.125*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2])* + (-2.0 + aCoord[0] - aCoord[1] - aCoord[2]); + aSlice[2] = 0.125*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2])* + (-2.0 + aCoord[0] + aCoord[1] - aCoord[2]); + aSlice[1] = 0.125*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2])* + (-2.0 - aCoord[0] + aCoord[1] - aCoord[2]); + aSlice[4] = 0.125*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2])* + (-2.0 - aCoord[0] - aCoord[1] + aCoord[2]); + aSlice[7] = 0.125*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2])* + (-2.0 + aCoord[0] - aCoord[1] + aCoord[2]); + aSlice[6] = 0.125*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2])* + (-2.0 + aCoord[0] + aCoord[1] + aCoord[2]); + aSlice[5] = 0.125*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2])* + (-2.0 - aCoord[0] + aCoord[1] + aCoord[2]); + + aSlice[11] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2]); + aSlice[10] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 + aCoord[0])*(1.0 - aCoord[2]); + aSlice[9] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2]); + aSlice[8] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 - aCoord[0])*(1.0 - aCoord[2]); + aSlice[16] = 0.25*(1.0 - aCoord[2]*aCoord[2])*(1.0 - aCoord[0])*(1.0 - aCoord[1]); + aSlice[19] = 0.25*(1.0 - aCoord[2]*aCoord[2])*(1.0 + aCoord[0])*(1.0 - aCoord[1]); + aSlice[18] = 0.25*(1.0 - aCoord[2]*aCoord[2])*(1.0 + aCoord[0])*(1.0 + aCoord[1]); + aSlice[17] = 0.25*(1.0 - aCoord[2]*aCoord[2])*(1.0 - aCoord[0])*(1.0 + aCoord[1]); + aSlice[15] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2]); + aSlice[14] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 + aCoord[0])*(1.0 + aCoord[2]); + aSlice[13] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2]); + aSlice[12] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 - aCoord[0])*(1.0 + aCoord[2]); + } + } + }; + + //--------------------------------------------------------------- struct TPenta6a: TShapeFun { @@ -960,6 +1329,51 @@ namespace MED }; + //--------------------------------------------------------------- + struct TPenta6b: TShapeFun + { + TPenta6b(): + TShapeFun(3,6) + { + TInt aNbRef = myRefCoord.size(); + for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + TCoordSlice aCoord = GetCoord(aRefId); + switch(aRefId){ + case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; + case 2: aCoord[0] = -1.0; aCoord[1] = -0.0; aCoord[2] = 1.0; break; + case 1: aCoord[0] = -1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + case 3: aCoord[0] = 1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; + case 5: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break; + case 4: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + } + } + } + + virtual + void + InitFun(const TShapeFun::TCCoordSliceArr& theRef, + const TShapeFun::TCCoordSliceArr& theGauss, + TFun& theFun) const + { + GetFun(theRef,theGauss,theFun); + + TInt aNbGauss = theGauss.size(); + for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){ + const TCCoordSlice& aCoord = theGauss[aGaussId]; + TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId); + + aSlice[0] = 0.5*aCoord[1]*(1.0 - aCoord[0]); + aSlice[2] = 0.5*aCoord[2]*(1.0 - aCoord[0]); + aSlice[1] = 0.5*(1.0 - aCoord[1] - aCoord[2])*(1.0 - aCoord[0]); + + aSlice[3] = 0.5*aCoord[1]*(aCoord[0] + 1.0); + aSlice[5] = 0.5*aCoord[2]*(aCoord[0] + 1.0); + aSlice[4] = 0.5*(1.0 - aCoord[1] - aCoord[2])*(1.0 + aCoord[0]); + } + } + }; + + //--------------------------------------------------------------- struct TPenta15a: TShapeFun { @@ -1027,6 +1441,305 @@ namespace MED }; + //--------------------------------------------------------------- + struct TPenta15b: TShapeFun + { + TPenta15b(): + TShapeFun(3,15) + { + TInt aNbRef = myRefCoord.size(); + for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + TCoordSlice aCoord = GetCoord(aRefId); + switch(aRefId){ + case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; + case 2: aCoord[0] = -1.0; aCoord[1] = -0.0; aCoord[2] = 1.0; break; + case 1: aCoord[0] = -1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + case 3: aCoord[0] = 1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; + case 5: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break; + case 4: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + + case 8: aCoord[0] = -1.0; aCoord[1] = 0.5; aCoord[2] = 0.5; break; + case 7: aCoord[0] = -1.0; aCoord[1] = 0.0; aCoord[2] = 0.5; break; + case 6: aCoord[0] = -1.0; aCoord[1] = 0.5; aCoord[2] = 0.0; break; + case 12: aCoord[0] = 0.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; + case 14: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break; + case 13: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + case 11: aCoord[0] = 1.0; aCoord[1] = 0.5; aCoord[2] = 0.5; break; + case 10: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.5; break; + case 9: aCoord[0] = 1.0; aCoord[1] = 0.5; aCoord[2] = 0.0; break; + } + } + } + + virtual + void + InitFun(const TShapeFun::TCCoordSliceArr& theRef, + const TShapeFun::TCCoordSliceArr& theGauss, + TFun& theFun) const + { + GetFun(theRef,theGauss,theFun); + + TInt aNbGauss = theGauss.size(); + for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){ + const TCCoordSlice& aCoord = theGauss[aGaussId]; + TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId); + + aSlice[0] = 0.5*aCoord[1]*(1.0 - aCoord[0])*(2.0*aCoord[1] - 2.0 - aCoord[0]); + aSlice[2] = 0.5*aCoord[2]*(1.0 - aCoord[0])*(2.0*aCoord[2] - 2.0 - aCoord[0]); + aSlice[1] = 0.5*(aCoord[0] - 1.0)*(1.0 - aCoord[1] - aCoord[2])*(aCoord[0] + 2.0*aCoord[1] + 2.0*aCoord[2]); + + aSlice[3] = 0.5*aCoord[1]*(1.0 + aCoord[0])*(2.0*aCoord[1] - 2.0 - aCoord[0]); + aSlice[5] = 0.5*aCoord[2]*(1.0 + aCoord[0])*(2.0*aCoord[2] - 2.0 - aCoord[0]); + aSlice[4] = -0.5*(aCoord[0] + 1.0)*(1.0 - aCoord[1] - aCoord[2])*(-aCoord[0] + 2.0*aCoord[1] + 2.0*aCoord[2]); + + aSlice[8] = 2.0*aCoord[1]*aCoord[2]*(1.0 - aCoord[0]); + aSlice[7] = 2.0*aCoord[2]*(1.0 - aCoord[1] - aCoord[2])*(1.0 - aCoord[0]); + aSlice[6] = 2.0*aCoord[1]*(1.0 - aCoord[1] - aCoord[2])*(1.0 - aCoord[0]); + + aSlice[12] = aCoord[1]*(1.0 - aCoord[0]*aCoord[0]); + aSlice[14] = aCoord[2]*(1.0 - aCoord[0]*aCoord[0]); + aSlice[13] = (1.0 - aCoord[1] - aCoord[2])*(1.0 - aCoord[0]*aCoord[0]); + + aSlice[11] = 2.0*aCoord[1]*aCoord[2]*(1.0 + aCoord[0]); + aSlice[10] = 2.0*aCoord[2]*(1.0 - aCoord[1] - aCoord[2])*(1.0 + aCoord[0]); + aSlice[9] = 2.0*aCoord[1]*(1.0 - aCoord[1] - aCoord[2])*(1.0 + aCoord[0]); + } + } + }; + + + //--------------------------------------------------------------- + struct TPyra5a: TShapeFun + { + TPyra5a(): + TShapeFun(3,5) + { + TInt aNbRef = myRefCoord.size(); + for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + TCoordSlice aCoord = GetCoord(aRefId); + switch(aRefId){ + case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + case 1: aCoord[0] = 0.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; + case 2: aCoord[0] = -1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + case 3: aCoord[0] = 0.0; aCoord[1] = -1.0; aCoord[2] = 0.0; break; + case 4: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break; + } + } + } + + virtual + void + InitFun(const TShapeFun::TCCoordSliceArr& theRef, + const TShapeFun::TCCoordSliceArr& theGauss, + TFun& theFun) const + { + GetFun(theRef,theGauss,theFun); + + TInt aNbGauss = theGauss.size(); + for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){ + const TCCoordSlice& aCoord = theGauss[aGaussId]; + TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId); + + aSlice[0] = 0.25*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]); + aSlice[1] = 0.25*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(+aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]); + aSlice[2] = 0.25*(+aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(+aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]); + aSlice[3] = 0.25*(+aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]); + aSlice[4] = 1.0 - aCoord[2]; + } + } + }; + + + //--------------------------------------------------------------- + struct TPyra5b: TShapeFun + { + TPyra5b(): + TShapeFun(3,5) + { + TInt aNbRef = myRefCoord.size(); + for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + TCoordSlice aCoord = GetCoord(aRefId); + switch(aRefId){ + case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + case 3: aCoord[0] = 0.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; + case 2: aCoord[0] = -1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + case 1: aCoord[0] = 0.0; aCoord[1] = -1.0; aCoord[2] = 0.0; break; + case 4: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break; + } + } + } + + virtual + void + InitFun(const TShapeFun::TCCoordSliceArr& theRef, + const TShapeFun::TCCoordSliceArr& theGauss, + TFun& theFun) const + { + GetFun(theRef,theGauss,theFun); + + TInt aNbGauss = theGauss.size(); + for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){ + const TCCoordSlice& aCoord = theGauss[aGaussId]; + TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId); + + aSlice[0] = 0.25*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]); + aSlice[3] = 0.25*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(+aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]); + aSlice[2] = 0.25*(+aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(+aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]); + aSlice[1] = 0.25*(+aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]); + aSlice[4] = 1.0 - aCoord[2]; + } + } + }; + + + //--------------------------------------------------------------- + struct TPyra13a: TShapeFun + { + TPyra13a(): + TShapeFun(3,13) + { + TInt aNbRef = myRefCoord.size(); + for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + TCoordSlice aCoord = GetCoord(aRefId); + switch(aRefId){ + case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + case 1: aCoord[0] = 0.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; + case 2: aCoord[0] = -1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + case 3: aCoord[0] = 0.0; aCoord[1] = -1.0; aCoord[2] = 0.0; break; + case 4: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break; + + case 5: aCoord[0] = 0.5; aCoord[1] = 0.5; aCoord[2] = 0.0; break; + case 6: aCoord[0] = -0.5; aCoord[1] = 0.5; aCoord[2] = 0.0; break; + case 7: aCoord[0] = -0.5; aCoord[1] = -0.5; aCoord[2] = 0.0; break; + case 8: aCoord[0] = 0.5; aCoord[1] = -0.5; aCoord[2] = 0.0; break; + case 9: aCoord[0] = 0.5; aCoord[1] = 0.0; aCoord[2] = 0.5; break; + case 10: aCoord[0] = 0.0; aCoord[1] = 0.5; aCoord[2] = 0.5; break; + case 11: aCoord[0] = -0.5; aCoord[1] = 0.0; aCoord[2] = 0.5; break; + case 12: aCoord[0] = 0.0; aCoord[1] = -0.5; aCoord[2] = 0.5; break; + } + } + } + + virtual + void + InitFun(const TShapeFun::TCCoordSliceArr& theRef, + const TShapeFun::TCCoordSliceArr& theGauss, + TFun& theFun) const + { + GetFun(theRef,theGauss,theFun); + + TInt aNbGauss = theGauss.size(); + for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){ + const TCCoordSlice& aCoord = theGauss[aGaussId]; + TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId); + + aSlice[0] = 0.5*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)* + (aCoord[0] - 0.5)/(1.0 - aCoord[2]); + aSlice[1] = 0.5*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(+aCoord[0] - aCoord[1] + aCoord[2] - 1.0)* + (aCoord[1] - 0.5)/(1.0 - aCoord[2]); + aSlice[2] = 0.5*(+aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(+aCoord[0] + aCoord[1] + aCoord[2] - 1.0)* + (-aCoord[0] - 0.5)/(1.0 - aCoord[2]); + aSlice[3] = 0.5*(+aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)* + (-aCoord[1] - 0.5)/(1.0 - aCoord[2]); + + aSlice[4] = 2.0*aCoord[2]*(aCoord[2] - 0.5); + + aSlice[5] = 0.5*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)* + (aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]); + aSlice[6] = 0.5*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(aCoord[0] - aCoord[1] + aCoord[2] - 1.0)* + (aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]); + aSlice[7] = 0.5*(aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(aCoord[0] + aCoord[1] + aCoord[2] - 1.0)* + (-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]); + aSlice[8] = 0.5*(aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)* + (-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]); + + aSlice[9] = 0.5*aCoord[2]*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/ + (1.0 - aCoord[2]); + aSlice[10] = 0.5*aCoord[2]*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/ + (1.0 - aCoord[2]); + aSlice[11] = 0.5*aCoord[2]*(aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/ + (1.0 - aCoord[2]); + aSlice[12] = 0.5*aCoord[2]*(aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/ + (1.0 - aCoord[2]); + } + } + }; + + + //--------------------------------------------------------------- + struct TPyra13b: TShapeFun + { + TPyra13b(): + TShapeFun(3,13) + { + TInt aNbRef = myRefCoord.size(); + for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){ + TCoordSlice aCoord = GetCoord(aRefId); + switch(aRefId){ + case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + case 3: aCoord[0] = 0.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break; + case 2: aCoord[0] = -1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break; + case 1: aCoord[0] = 0.0; aCoord[1] = -1.0; aCoord[2] = 0.0; break; + case 4: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break; + + case 8: aCoord[0] = 0.5; aCoord[1] = 0.5; aCoord[2] = 0.0; break; + case 7: aCoord[0] = -0.5; aCoord[1] = 0.5; aCoord[2] = 0.0; break; + case 6: aCoord[0] = -0.5; aCoord[1] = -0.5; aCoord[2] = 0.0; break; + case 5: aCoord[0] = 0.5; aCoord[1] = -0.5; aCoord[2] = 0.0; break; + case 9: aCoord[0] = 0.5; aCoord[1] = 0.0; aCoord[2] = 0.5; break; + case 12: aCoord[0] = 0.0; aCoord[1] = 0.5; aCoord[2] = 0.5; break; + case 11: aCoord[0] = -0.5; aCoord[1] = 0.0; aCoord[2] = 0.5; break; + case 10: aCoord[0] = 0.0; aCoord[1] = -0.5; aCoord[2] = 0.5; break; + } + } + } + + virtual + void + InitFun(const TShapeFun::TCCoordSliceArr& theRef, + const TShapeFun::TCCoordSliceArr& theGauss, + TFun& theFun) const + { + GetFun(theRef,theGauss,theFun); + + TInt aNbGauss = theGauss.size(); + for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){ + const TCCoordSlice& aCoord = theGauss[aGaussId]; + TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId); + + aSlice[0] = 0.5*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)* + (aCoord[0] - 0.5)/(1.0 - aCoord[2]); + aSlice[3] = 0.5*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(+aCoord[0] - aCoord[1] + aCoord[2] - 1.0)* + (aCoord[1] - 0.5)/(1.0 - aCoord[2]); + aSlice[2] = 0.5*(+aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(+aCoord[0] + aCoord[1] + aCoord[2] - 1.0)* + (-aCoord[0] - 0.5)/(1.0 - aCoord[2]); + aSlice[1] = 0.5*(+aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)* + (-aCoord[1] - 0.5)/(1.0 - aCoord[2]); + + aSlice[4] = 2.0*aCoord[2]*(aCoord[2] - 0.5); + + aSlice[8] = 0.5*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)* + (aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]); + aSlice[7] = 0.5*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(aCoord[0] - aCoord[1] + aCoord[2] - 1.0)* + (aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]); + aSlice[6] = 0.5*(aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(aCoord[0] + aCoord[1] + aCoord[2] - 1.0)* + (-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]); + aSlice[5] = 0.5*(aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)* + (-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/(1.0 - aCoord[2]); + + aSlice[9] = 0.5*aCoord[2]*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/ + (1.0 - aCoord[2]); + aSlice[12] = 0.5*aCoord[2]*(-aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(aCoord[0] - aCoord[1] + aCoord[2] - 1.0)/ + (1.0 - aCoord[2]); + aSlice[11] = 0.5*aCoord[2]*(aCoord[0] - aCoord[1] + aCoord[2] - 1.0)*(aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/ + (1.0 - aCoord[2]); + aSlice[10] = 0.5*aCoord[2]*(aCoord[0] + aCoord[1] + aCoord[2] - 1.0)*(-aCoord[0] + aCoord[1] + aCoord[2] - 1.0)/ + (1.0 - aCoord[2]); + } + } + }; + + //--------------------------------------------------------------- bool GetGaussCoord3D(const TGaussInfo& theGaussInfo, @@ -1096,10 +1809,20 @@ namespace MED if(TQuad4a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) return true; + if(TQuad4b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) + return true; + break; } case eQUAD8: { INITMSG(MYDEBUG,"eQUAD8"<<endl); + + if(TQuad8a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) + return true; + + if(TQuad8b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) + return true; + break; } case eTETRA4: { @@ -1108,10 +1831,20 @@ namespace MED if(TTetra4a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) return true; + if(TTetra4b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) + return true; + break; } case ePYRA5: { INITMSG(MYDEBUG,"ePYRA5"<<endl); + + if(TPyra5a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) + return true; + + if(TPyra5b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) + return true; + break; } case ePENTA6: { @@ -1120,6 +1853,9 @@ namespace MED if(TPenta6a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) return true; + if(TPenta6b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) + return true; + break; } case eHEXA8: { @@ -1128,6 +1864,9 @@ namespace MED if(THexa8a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) return true; + if(THexa8b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) + return true; + break; } case eTETRA10: { @@ -1136,10 +1875,20 @@ namespace MED if(TTetra10a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) return true; + if(TTetra10b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) + return true; + break; } case ePYRA13: { INITMSG(MYDEBUG,"ePYRA13"<<endl); + + if(TPyra13a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) + return true; + + if(TPyra13b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) + return true; + break; } case ePENTA15: { @@ -1148,6 +1897,9 @@ namespace MED if(TPenta15a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) return true; + if(TPenta15b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) + return true; + break; } case eHEXA20: { @@ -1156,6 +1908,9 @@ namespace MED if(THexa20a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) return true; + if(THexa20b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode)) + return true; + break; } default: @@ -1189,6 +1944,8 @@ namespace MED theGaussCoord.Init(aNbElem,aNbGauss,aDim,theMode); + TInt aConnDim = theCellInfo.GetConnDim(); + INITMSGA(MYDEBUG,0, "- aDim = "<<aDim<< "; aNbGauss = "<<aNbGauss<< @@ -1201,8 +1958,6 @@ namespace MED TCConnSlice aConnSlice = theCellInfo.GetConnSlice(aCellId); TCoordSliceArr aCoordSliceArr = theGaussCoord.GetCoordSliceArr(anElemId); - TInt aConnDim = aConnSlice.size(); - for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){ TCoordSlice& aGaussCoordSlice = aCoordSliceArr[aGaussId]; diff --git a/src/MEDWrapper/Base/MED_Structures.cxx b/src/MEDWrapper/Base/MED_Structures.cxx index 0c1346e46..c87203616 100644 --- a/src/MEDWrapper/Base/MED_Structures.cxx +++ b/src/MEDWrapper/Base/MED_Structures.cxx @@ -454,3 +454,323 @@ TTimeStampVal { return myGeom2Value[theGeom]; } + +//--------------------------------------------------------------- +// TGrilleInfo structure methods +//--------------------------------------------------------------- +const EGrilleType& +TGrilleInfo +::GetGrilleType() const +{ + return myGrilleType; +} + +EGrilleType +TGrilleInfo +::GetGrilleType() +{ + return myGrilleType; +} + +void +TGrilleInfo +::SetGrilleType(EGrilleType theGrilleType) +{ + myGrilleType = theGrilleType; +} + +const +TIndexes& +TGrilleInfo +::GetMapOfIndexes() const +{ + return myIndixes; +} + +TIndexes +TGrilleInfo +::GetMapOfIndexes() +{ + return myIndixes; +} + +const +TFloatVector& +TGrilleInfo +::GetIndexes(TInt theAxisNumber) const +{ + TIndexes::const_iterator aIter=myIndixes.find(theAxisNumber); + if(aIter==myIndixes.end()) + EXCEPTION(runtime_error,"const TGrilleInfo::GetIndexes - myIndixes.find(theAxisNumber); fails"); + return aIter->second; +} + +TFloatVector +TGrilleInfo +::GetIndexes(TInt theAxisNumber) +{ + TIndexes::iterator aIter=myIndixes.find(theAxisNumber); + if(aIter==myIndixes.end()) + EXCEPTION(runtime_error,"TGrilleInfo::GetIndexes - myIndixes.find(theAxisNumber); fails"); + return aIter->second; +} + +TInt +TGrilleInfo +::GetNbIndexes(TInt theAxisNumber) +{ + const TFloatVector& aVector=GetIndexes(theAxisNumber); + return aVector.size(); +} + +TInt +TGrilleInfo +::GetNbNodes() +{ + TInt nbNodes=0; + TInt aDim = myMeshInfo->GetDim(); + if(myGrilleType == eGRILLE_STANDARD) + for(int i=0;i<aDim;i++) + if(nbNodes == 0) + nbNodes = myGrilleStructure[i]; + else + nbNodes = nbNodes*myGrilleStructure[i]; + else + for(int i=0;i<aDim;i++) + if(nbNodes == 0) + nbNodes = GetNbIndexes(i); + else + nbNodes = nbNodes*GetNbIndexes(i); + + return nbNodes; +} + +TInt +TGrilleInfo +::GetNbCells() +{ + TInt nbCells=0; + TInt aDim = myMeshInfo->GetDim(); + if(myGrilleType == eGRILLE_STANDARD) + for(int i=0;i<aDim;i++) + if(nbCells == 0) + nbCells = myGrilleStructure[i]-1; + else + nbCells = nbCells*(myGrilleStructure[i]-1); + else + for(int i=0;i<aDim;i++) + if(nbCells == 0) + nbCells = GetNbIndexes(i)-1; + else + nbCells = nbCells*(GetNbIndexes(i)-1); + return nbCells; +} + +EGeometrieElement +TGrilleInfo +::GetGeom() +{ + TInt aDim = myMeshInfo->GetDim(); + switch(aDim){ + case 1: + return eSEG2; + case 2: + return eQUAD4; + case 3: + return eHEXA8; + default: + return eNONE; + } +} + +EEntiteMaillage +TGrilleInfo +::GetEntity() +{ + return eMAILLE; +} + +const +TIntVector& +TGrilleInfo +::GetGrilleStructure() const +{ + return myGrilleStructure; +} + +TIntVector +TGrilleInfo +::GetGrilleStructure() +{ + return myGrilleStructure; +} + +void +TGrilleInfo +::SetGrilleStructure(TInt theAxis,TInt theNb) +{ + if(theAxis >= 0 && theAxis <=2 && theNb >= 0) + myGrilleStructure[theAxis]=theNb; +} + +const +TNodeCoord& +TGrilleInfo +::GetNodeCoord() const +{ + return myCoord; +} + +TNodeCoord +TGrilleInfo +::GetNodeCoord() +{ + return myCoord; +} + +TNodeCoord +TGrilleInfo +::GetCoord(TInt theId) +{ + TNodeCoord aCoord; + TInt aDim = myMeshInfo->GetDim(); + TInt aNbNodes = this->GetNbNodes(); + aCoord.resize(aDim); + + if(theId >= aNbNodes) + EXCEPTION(runtime_error,"TGrilleInfo::GetCoord - theId out of range"); + + if(myGrilleType == eGRILLE_STANDARD){ + switch(aDim){ + case 3: + aCoord[2] = myCoord[aDim*theId+2]; + case 2: + aCoord[1] = myCoord[aDim*theId+1]; + case 1:{ + aCoord[0] = myCoord[aDim*theId]; + break; + } + } + } else { + + TFloatVector aVecX = this->GetIndexes(0); + TInt nbIndxX = this->GetNbIndexes(0); + + switch(aDim){ + case 1:{ + aCoord[0] = aVecX[theId]; + break; + } + case 2:{ + TFloatVector aVecY = this->GetIndexes(1); + TInt i,j,k; + i = j = k = 0; + i = theId % nbIndxX; + j = theId / nbIndxX; + if(myGrilleType == eGRILLE_CARTESIENNE){ + aCoord[0] = aVecX[i]; + aCoord[1] = aVecY[j]; + } else { // eGRILLE_POLAIRE (cylindrical) + aCoord[0] = aVecX[i] * cos(aVecY[j]); + aCoord[1] = aVecX[i] * sin(aVecY[j]); + } + break; + } + case 3:{ + TFloatVector aVecY = this->GetIndexes(1); + TInt nbIndxY = this->GetNbIndexes(1); + TFloatVector aVecZ = this->GetIndexes(2); + TInt i,j,k; + i = j = k = 0; + + i = theId % nbIndxX; + j = (theId / nbIndxX) % nbIndxY; + k = theId / (nbIndxX*nbIndxY); + + if(myGrilleType == eGRILLE_CARTESIENNE){ + aCoord[0] = aVecX[i]; + aCoord[1] = aVecY[j]; + aCoord[2] = aVecZ[k]; + } else { // eGRILLE_POLAIRE (cylindrical) + aCoord[0] = aVecX[i] * cos(aVecY[j]); + aCoord[1] = aVecX[i] * sin(aVecY[j]); + aCoord[2] = aVecZ[k]; + } + + break; + } + } + } + + return aCoord; +} + +TIntVector +TGrilleInfo +::GetConn(TInt theId) +{ + TIntVector anIndexes; + TInt aDim = myMeshInfo->GetDim(); + TInt aArrSize = 2; + for(int i=1;i<aDim;i++) aArrSize = aArrSize*2; + + TInt idx; + TInt iMin, iMax, jMin, jMax, kMin, kMax; + TInt loc[3]; + + loc[0] = loc[1] = loc[2] = 0; + iMin = iMax = jMin = jMax = kMin = kMax = 0; + + TInt nbX,nbY; + if (myGrilleType == eGRILLE_STANDARD) + { + nbX = this->GetGrilleStructure()[0]; + nbY = this->GetGrilleStructure()[1]; + } + else + { + nbX = this->GetNbIndexes(0); + nbY = this->GetNbIndexes(1); + } + + TInt d01 = nbX*nbY; + + switch(aDim){ + case 3:{ + iMin = theId % (nbX - 1); + iMax = iMin + 1; + jMin = (theId / (nbX - 1)) % (nbY - 1); + jMax = jMin + 1; + kMin = theId / ((nbX - 1) * (nbY - 1)); + kMax = kMin + 1; + break; + } + case 2:{ + iMin = theId % (nbX-1); + iMax = iMin + 1; + jMin = theId / (nbX-1); + jMax = jMin + 1; + break; + } + case 1:{ + iMin = theId; + iMax = theId + 1; + break; + } + } + + + for (loc[2]=kMin; loc[2]<=kMax; loc[2]++) + { + for (loc[1]=jMin; loc[1]<=jMax; loc[1]++) + { + for (loc[0]=iMin; loc[0]<=iMax; loc[0]++) + { + idx = loc[0] + loc[1]*nbX + loc[2]*d01; + anIndexes.push_back(idx); + } + } + } + + return anIndexes; +} diff --git a/src/MEDWrapper/Base/MED_Structures.hxx b/src/MEDWrapper/Base/MED_Structures.hxx index f22f4b977..a4160a738 100644 --- a/src/MEDWrapper/Base/MED_Structures.hxx +++ b/src/MEDWrapper/Base/MED_Structures.hxx @@ -594,6 +594,93 @@ namespace MED TMeshValue& GetMeshValue(EGeometrieElement theGeom); }; + + typedef std::map<TInt,TFloatVector> TIndexes; + typedef std::map<TInt,TString> TNames; + + //! Define a base class which represents MED Grille + struct TGrilleInfo: + virtual TModeSwitchInfo + { + + PMeshInfo myMeshInfo; + const PMeshInfo& GetMeshInfo() const { return myMeshInfo;} + + TNodeCoord myCoord; //!< Contains all nodal coordinates, now used only for eGRILLE_STANDARD + //! Gives coordinates for mesh nodes (const version) + const TNodeCoord& GetNodeCoord() const; + TNodeCoord GetNodeCoord(); + //! Gives coordinates for mesh node by its number, array index from 0 + TNodeCoord GetCoord(TInt theId); + //! Gives ids of nodes for mesh cell by its number, array index from 0 + TIntVector GetConn(TInt theId); + + EGrilleType myGrilleType; //!< Defines grille type (eGRILLE_CARTESIENNE,eGRILLE_POLAIRE,eGRILLE_STANDARD) + //!Gets grille type (const version) + const EGrilleType& GetGrilleType() const; + //!Gets grille type + EGrilleType GetGrilleType(); + //!Sets grille type + void SetGrilleType(EGrilleType theGrilleType); + + + + TString myCoordNames; //!< Contains names for the coordinate dimensions + //! Get name of the coordinate dimension by its order number + virtual std::string GetCoordName(TInt theId) const = 0 ; + //! Set name of the coordinate dimension by its order number + virtual void SetCoordName(TInt theId, const std::string& theValue) = 0; + + TString myCoordUnits; //!< Contains units for the coordinate dimensions + //! Get name of unit for the coordinate dimension by its order number + virtual std::string GetCoordUnit(TInt theId) const = 0; + //! Set name of unit for the coordinate dimension by its order number + virtual void SetCoordUnit(TInt theId, const std::string& theValue) = 0; + + + //! Map of index of axes and Table of indexes for certain axe, now used for eGRILLE_CARTESIENNE and eGRILLE_POLAIRE + TIndexes myIndixes; + //!Gets a map of Tables (const version) + const TIndexes& GetMapOfIndexes() const ; + //!Gets a map of Tables + TIndexes GetMapOfIndexes(); + //!Gets a Table of indexes for certain axe(const version) + const TFloatVector& GetIndexes(TInt theAxisNumber) const; + //!Gets a Table of indexes for certain axe + TFloatVector GetIndexes(TInt theAxisNumber); + //!Gets a number of indices per axe + TInt GetNbIndexes(TInt theAxisNumber); + + TInt GetNbNodes();//! Return count of all points + TInt GetNbCells();//! Return count of all cells + EGeometrieElement GetGeom();//! Return geometry of cells (calculated from mesh dimension) + EEntiteMaillage GetEntity();//! Return entity (eMAILLE) + + /*! + *Vector of grille structure (Example: {3,4,5}, 3 nodes in X axe, 4 nodes in Y axe, ...) + *Used only for eGRILLE_STANDARD + */ + TIntVector myGrilleStructure; + //!Gets grille structure(const version) + const TIntVector& GetGrilleStructure() const; + //!Gets grille structure + TIntVector GetGrilleStructure(); + //!Sets the grille structure of theAxis axe to theNb. + void SetGrilleStructure(TInt theAxis,TInt theNb); + + /*! + *Defines sequence MED Family indexes for corresponding mesh entites + *Not used now. + */ + TElemNum myFamNum; + //! Get number of a MED FAMILY by order number of the mesh element + TInt GetFamNum(TInt theId) const; + //! Set number of a MED FAMILY for the mesh element with the order number + void SetFamNum(TInt theId, TInt theVal); + + }; + + } #endif diff --git a/src/MEDWrapper/Base/MED_TStructures.hxx b/src/MEDWrapper/Base/MED_TStructures.hxx index 71be52285..109f4c5bc 100644 --- a/src/MEDWrapper/Base/MED_TStructures.hxx +++ b/src/MEDWrapper/Base/MED_TStructures.hxx @@ -910,6 +910,118 @@ namespace MED } }; + //--------------------------------------------------------------- + template<EVersion eVersion> + struct TTGrilleInfo: + virtual TGrilleInfo + { + TTGrilleInfo(const PMeshInfo& theMeshInfo, + const PGrilleInfo& theInfo) + { + myMeshInfo = theMeshInfo; + + myCoord = theInfo->GetNodeCoord(); + + myGrilleType = theInfo->GetGrilleType(); + + myCoordNames = theInfo->myCoordNames; + + myCoordUnits = theInfo->myCoordUnits; + + myIndixes = theInfo->GetMapOfIndexes(); + + myGrilleStructure = theInfo->GetGrilleStructure(); + + myGrilleType = theInfo->GetGrilleType(); + + } + + TTGrilleInfo(const PMeshInfo& theMeshInfo, + const EGrilleType& type, + const TInt nnoeuds) + { + myMeshInfo = theMeshInfo; + TInt aDim = theMeshInfo->GetDim(); + if(type == eGRILLE_STANDARD){ + myCoord.resize(aDim*nnoeuds); + myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1); + myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+1); + } else { //if(type == eGRILLE_CARTESIENNE){ + myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+aDim); + myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+aDim); + } + + myGrilleStructure.resize(theMeshInfo->myDim); + + } + + TTGrilleInfo(const PMeshInfo& theMeshInfo, + const EGrilleType& type) + { + myMeshInfo = theMeshInfo; + TInt aDim = theMeshInfo->GetDim(); + if(type == eGRILLE_STANDARD){ + myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1); + myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+1); + } else {// if(type == eGRILLE_CARTESIENNE){ + myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+aDim); + myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+aDim); + } + TTGrilleInfo(theMeshInfo,type,0); + } + + TTGrilleInfo(const PMeshInfo& theMeshInfo, + const EGrilleType& type, + const MED::TIntVector& nbNodeVec) + { + myMeshInfo = theMeshInfo; + + TInt aDim = theMeshInfo->GetDim(); + if(type == eGRILLE_STANDARD){ + myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1); + myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+1); + } else {// if(type == eGRILLE_CARTESIENNE){ + myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+aDim); + myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+aDim); + } + + if(type != eGRILLE_STANDARD) + for(int aAxe=0;aAxe<nbNodeVec.size();aAxe++){ + myIndixes[aAxe].resize(nbNodeVec[aAxe]); + } + + TTGrilleInfo(theMeshInfo,type,0); + } + + virtual + std::string + GetCoordName(TInt theId) const + { + return GetString(theId,GetPNOMLength<eVersion>(),myCoordNames); + } + + virtual + void + SetCoordName(TInt theId, const std::string& theValue) + { + SetString(theId,GetPNOMLength<eVersion>(),myCoordNames,theValue); + } + + virtual + std::string + GetCoordUnit(TInt theId) const + { + return GetString(theId,GetPNOMLength<eVersion>(),myCoordUnits); + } + + virtual + void + SetCoordUnit(TInt theId, const std::string& theValue) + { + SetString(theId,GetPNOMLength<eVersion>(),myCoordUnits,theValue); + } + + }; } #endif diff --git a/src/MEDWrapper/Base/MED_TWrapper.hxx b/src/MEDWrapper/Base/MED_TWrapper.hxx index 3faa314c7..fe36efa87 100644 --- a/src/MEDWrapper/Base/MED_TWrapper.hxx +++ b/src/MEDWrapper/Base/MED_TWrapper.hxx @@ -109,6 +109,36 @@ namespace MED theInfo)); } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + virtual + PElemInfo + CrElemInfo(const PMeshInfo& theMeshInfo, + TInt theNbElem, + EBooleen theIsElemNum = eVRAI, + EBooleen theIsElemNames = eVRAI) + { + return PElemInfo(new TTElemInfo<eVersion> + (theMeshInfo, + theNbElem, + theIsElemNum, + theIsElemNames)); + } + + virtual + PElemInfo + CrElemInfo(const PMeshInfo& theMeshInfo, + TInt theNbElem, + const TIntVector& theFamNum, + const TIntVector& aElemNum, + const TStringVector& aElemNames) + { + return PElemInfo(new TTElemInfo<eVersion> + (theMeshInfo, + theNbElem, + theFamNum, + aElemNum, + aElemNames)); + } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ virtual @@ -452,6 +482,50 @@ namespace MED theInfo)); } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + virtual + PGrilleInfo + CrGrilleInfo(const PMeshInfo& theMeshInfo, + const PGrilleInfo& theInfo) + { + return PGrilleInfo(new TTGrilleInfo<eVersion> + (theMeshInfo, + theInfo)); + } + virtual + PGrilleInfo + CrGrilleInfo(const PMeshInfo& theMeshInfo, + const EGrilleType& type) + { + return PGrilleInfo(new TTGrilleInfo<eVersion> + (theMeshInfo, + type)); + } + + virtual + PGrilleInfo + CrGrilleInfo(const PMeshInfo& theMeshInfo, + const EGrilleType& type, + const TInt& nbNodes) + { + return PGrilleInfo(new TTGrilleInfo<eVersion> + (theMeshInfo, + type, + nbNodes)); + } + + virtual + PGrilleInfo + CrGrilleInfo(const PMeshInfo& theMeshInfo, + const EGrilleType& type, + const MED::TIntVector& nbNodeVec) + { + return PGrilleInfo(new TTGrilleInfo<eVersion> + (theMeshInfo, + type, + nbNodeVec)); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }; } diff --git a/src/MEDWrapper/Base/MED_Wrapper.cxx b/src/MEDWrapper/Base/MED_Wrapper.cxx index 763bdacba..3775c6e9d 100644 --- a/src/MEDWrapper/Base/MED_Wrapper.cxx +++ b/src/MEDWrapper/Base/MED_Wrapper.cxx @@ -60,6 +60,10 @@ namespace MED TInt theId, TErr* theErr) { + // must be reimplemented in connection with mesh type eSTRUCTURE + // if(theMeshInfo->GetType() != eNON_STRUCTURE) + // return PFamilyInfo(); + TInt aNbAttr = GetNbFamAttr(theId,*theMeshInfo); TInt aNbGroup = GetNbFamGroup(theId,*theMeshInfo); PFamilyInfo anInfo = CrFamilyInfo(theMeshInfo,aNbGroup,aNbAttr); @@ -88,6 +92,10 @@ namespace MED TErr* theErr) { TInt aNbElems = GetNbNodes(*theMeshInfo); + if(aNbElems == 0){ + return PNodeInfo(); + } + PNodeInfo anInfo = CrNodeInfo(theMeshInfo,aNbElems); GetNodeInfo(*anInfo,theErr); @@ -134,6 +142,9 @@ namespace MED EGeometrieElement theGeom, EConnectivite theConnMode) { + if(theMeshInfo->GetType() != eNON_STRUCTURE) + return PPolygoneInfo(); + TInt aNbElem = GetNbPolygones(theMeshInfo,theEntity,theGeom,theConnMode); TInt aConnSize = GetPolygoneConnSize(theMeshInfo,theEntity,theGeom,theConnMode); PPolygoneInfo anInfo = CrPolygoneInfo(theMeshInfo,theEntity,theGeom,aNbElem,aConnSize,theConnMode); @@ -165,6 +176,8 @@ namespace MED EGeometrieElement theGeom, EConnectivite theConnMode) { + if(theMeshInfo->GetType() != eNON_STRUCTURE) + return PPolyedreInfo(); TInt aNbElem = GetNbPolyedres(theMeshInfo,theEntity,theGeom,theConnMode); TInt aNbFaces, aConnSize; GetPolyedreConnSize(theMeshInfo,aNbFaces,aConnSize,theConnMode); @@ -196,6 +209,94 @@ namespace MED return anInfo; } + PElemInfo + TWrapper + ::GetPElemInfo(const PMeshInfo& theMeshInfo, + EEntiteMaillage theEntity, + EGeometrieElement theGeom, + EConnectivite theConnMode, + TErr* theErr) + { + EMaillage aType = theMeshInfo->GetType(); + if(aType == eNON_STRUCTURE){ + switch(theGeom){ + case ePOINT1: + return GetPNodeInfo(theMeshInfo,theErr); + break; + case ePOLYGONE: + return GetPPolygoneInfo(theMeshInfo,theEntity,theGeom,theConnMode); + break; + case ePOLYEDRE: + return GetPPolyedreInfo(theMeshInfo,theEntity,theGeom,theConnMode); + break; + default: + return GetPCellInfo(theMeshInfo,theEntity,theGeom,theConnMode,theErr); + } + } else { + PGrilleInfo aGrille = GetPGrilleInfo(theMeshInfo); + + TInt nbElems; + EBooleen theIsElemNum = eFAUX; + // nodes + switch(theGeom){ + case ePOINT1: + nbElems = aGrille->GetNbNodes(); + theIsElemNum = eVRAI; + break; + case eSEG2: + case eQUAD4: + case eHEXA8: + nbElems = aGrille->GetNbCells(); + break; + default: + nbElems = 0; + } + + TIntVector aFamNum; + TIntVector aElemNum; + TStringVector aElemNames; + + PElemInfo aElemInfo; + + if(theGeom == ePOINT1){ + aElemInfo = CrElemInfo(theMeshInfo, + nbElems, + theIsElemNum); + MED::TElemInfo &aTElemInfo = *aElemInfo; + + // must be reimplemente in connection with mesh type eSTRUCTURE +// GetNumeration(aTElemInfo, +// nbElems, +// theEntity, +// theGeom, +// theErr); + + GetFamilies(aTElemInfo, + nbElems, + theEntity, + theGeom, + theErr); + + // must be reimplemente in connection with mesh type eSTRUCTURE +// GetNames(aTElemInfo, +// nbElems, +// theEntity, +// theGeom, +// theErr); + } else { + aElemInfo = CrElemInfo(theMeshInfo, + nbElems, + aFamNum, + aElemNum, + aElemNames); + } + + return aElemInfo; + } + return PElemInfo(); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PCellInfo TWrapper @@ -205,6 +306,8 @@ namespace MED EConnectivite theConnMode, TErr* theErr) { + if(theMeshInfo->GetType() != eNON_STRUCTURE) + return PCellInfo(); TInt aNbElem = GetNbCells(theMeshInfo,theEntity,theGeom,theConnMode); PCellInfo anInfo = CrCellInfo(theMeshInfo,theEntity,theGeom,aNbElem,theConnMode); GetCellInfo(anInfo,theErr); @@ -348,4 +451,53 @@ namespace MED return anInfo; } + + PGrilleInfo + TWrapper + ::GetPGrilleInfo(const PMeshInfo& theMeshInfo) + { + if(theMeshInfo->GetType() != eSTRUCTURE) + return PGrilleInfo(); + + EGrilleType type; + GetGrilleType(*theMeshInfo,type); + PGrilleInfo anInfo; + if(type == eGRILLE_STANDARD){ + const TInt nnoeuds = GetNbNodes(*theMeshInfo); + anInfo = CrGrilleInfo(theMeshInfo,type,nnoeuds); + } + else { + TIntVector aVec; + aVec.resize(theMeshInfo->GetDim()); + for(int aAxe=0;aAxe<theMeshInfo->GetDim();aAxe++){ + ETable aATable; + switch(aAxe){ + case 0: + aATable = eCOOR_IND1; + break; + case 1: + aATable = eCOOR_IND2; + break; + case 2: + aATable = eCOOR_IND3; + break; + } + aVec[aAxe] = GetNbNodes(*theMeshInfo,aATable); + } + anInfo = CrGrilleInfo(theMeshInfo,type,aVec); + } + + GetGrilleInfo(anInfo); + anInfo->SetGrilleType(type); + return anInfo; + } + + PGrilleInfo + TWrapper + ::GetPGrilleInfo(const PMeshInfo& theMeshInfo, + const PGrilleInfo& theInfo) + { + PGrilleInfo anInfo = CrGrilleInfo(theMeshInfo,theInfo); + return anInfo; + } } diff --git a/src/MEDWrapper/Base/MED_Wrapper.hxx b/src/MEDWrapper/Base/MED_Wrapper.hxx index 23c4a08a6..db861b118 100644 --- a/src/MEDWrapper/Base/MED_Wrapper.hxx +++ b/src/MEDWrapper/Base/MED_Wrapper.hxx @@ -208,6 +208,14 @@ namespace MED TErr* theErr = NULL) {} + //! Read a MEDWrapper MED Element representation from defined MED file + PElemInfo + GetPElemInfo(const PMeshInfo& theMeshInfo, + EEntiteMaillage theEntity = eNOEUD, + EGeometrieElement theGeom = ePOINT1, + EConnectivite theConnMode = eNOD, + TErr* theErr = NULL); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //! Read number of nodes in defined MED Mesh virtual @@ -215,6 +223,15 @@ namespace MED GetNbNodes(const TMeshInfo& theMeshInfo, TErr* theErr = NULL) = 0; + virtual + TInt + GetNbNodes(const TMeshInfo& theMeshInfo, + ETable theTable, + TErr* theErr = NULL) + { + return 0; + } + //! Read a MEDWrapper MED Nodes representation from defined MED file virtual void @@ -229,6 +246,29 @@ namespace MED //! Creates a MEDWrapper MED Nodes representation virtual + PElemInfo + CrElemInfo(const PMeshInfo& theMeshInfo, + TInt theNbElem, + EBooleen theIsElemNum = eVRAI, + EBooleen theIsElemNames = eVRAI) + { + return PElemInfo(); + } + + //! Creates a MEDWrapper MED Nodes representation + virtual + PElemInfo + CrElemInfo(const PMeshInfo& theMeshInfo, + TInt theNbElem, + const TIntVector& theFamNum, + const TIntVector& aElemNum, + const TStringVector& aElemNames) + { + return PElemInfo(); + } + + //! Creates a MEDWrapper MED Nodes representation + virtual PNodeInfo CrNodeInfo(const PMeshInfo& theMeshInfo, TInt theNbElem, @@ -719,6 +759,88 @@ namespace MED const TKey2Gauss& theKey2Gauss, TErr* theErr = NULL); + //! Read a MEDWrapper MED Grille representation from defined MED file + /*! This feature is support only for version of 2.2 and higher */ + PGrilleInfo + GetPGrilleInfo(const PMeshInfo& theMeshInfo); + + //! Read a MEDWrapper MED Grille representation from defined MED file + /*! This feature is support only for version of 2.2 and higher */ + PGrilleInfo + GetPGrilleInfo(const PMeshInfo& theMeshInfo, + const PGrilleInfo& theInfo); + + //! Read a MEDWrapper MED Grille representation from defined MED file + /*! This feature is support only for version of 2.2 and higher */ + virtual + void + GetGrilleInfo(TGrilleInfo& theInfo, + TErr* theErr = NULL) + {} + + //! Write the MEDWrapper MED Grille representation into defined MED file + /*! This feature is support only for version of 2.2 and higher */ + virtual + void + SetGrilleInfo(const TGrilleInfo& theInfo, + TErr* theErr = NULL) + {} + + /*! This feature is support only for version of 2.2 and higher */ + virtual + PGrilleInfo + CrGrilleInfo(const PMeshInfo& theMeshInfo, + const PGrilleInfo& theGrilleInfo) + { + return PGrilleInfo(); + } + + /*! This feature is support only for version of 2.2 and higher */ + virtual + PGrilleInfo + CrGrilleInfo(const PMeshInfo& theMeshInfo) + { + return PGrilleInfo(); + } + + /*! This feature is support only for version of 2.2 and higher */ + virtual + PGrilleInfo + CrGrilleInfo(const PMeshInfo& theMeshInfo, + const EGrilleType& type) + { + return PGrilleInfo(); + } + + /*! This feature is support only for version of 2.2 and higher */ + virtual + PGrilleInfo + CrGrilleInfo(const PMeshInfo& theMeshInfo, + const EGrilleType& type, + const TInt& nbNodes) + { + return PGrilleInfo(); + } + + /*! This feature is support only for version of 2.2 and higher */ + virtual + PGrilleInfo + CrGrilleInfo(const PMeshInfo& theMeshInfo, + const EGrilleType& type, + const MED::TIntVector& nbNodeVec) + { + return PGrilleInfo(); + } + + /*! This feature is support only for version of 2.2 and higher */ + virtual + void + GetGrilleType(const TMeshInfo& theMeshInfo, + EGrilleType& type, + TErr* theErr = NULL) + { + } + }; diff --git a/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx b/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx index 853d61208..34c626acc 100644 --- a/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx +++ b/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx @@ -417,12 +417,7 @@ namespace MED med_entite_maillage(theEntity), med_geometrie_element(theGeom)); - theInfo.myIsElemNames = (theInfo.myElemNames).empty()? eFAUX : eVRAI ; - - if(theErr) - *theErr = aRet; - else if(aRet < 0) - EXCEPTION(runtime_error,"GetNames - MEDnomLire(...)"); + theInfo.myIsElemNames = aRet != 0? eFAUX : eVRAI ; } void @@ -450,12 +445,7 @@ namespace MED anEntity, aGeom); - theInfo.myIsElemNum = (theInfo.myElemNum).empty()? eFAUX : eVRAI ; - - if(theErr) - *theErr = aRet; - else if(aRet < 0) - EXCEPTION(runtime_error,"GetNumeration - MEDnumLire(...)"); + theInfo.myIsElemNum = aRet != 0? eFAUX : eVRAI; } void @@ -611,6 +601,7 @@ namespace MED TInt TVWrapper ::GetNbNodes(const MED::TMeshInfo& theMeshInfo, + ETable theTable, TErr* theErr) { TFileWrapper aFileWrapper(myFile,eLECTURE,theErr); @@ -622,7 +613,7 @@ namespace MED return MEDnEntMaa(myFile->Id(), &aMeshInfo.myName[0], - MED_COOR, + (med_table)theTable, MED_NOEUD, med_geometrie_element(0), med_connectivite(0)); @@ -1027,7 +1018,9 @@ namespace MED if(theErr && *theErr < 0) return anInfo; - + + if(theMeshInfo.GetType() == eNON_STRUCTURE) { + TInt aNbElem = GetNbNodes(theMeshInfo); if(aNbElem > 0){ anInfo[eNOEUD][ePOINT1] = aNbElem; @@ -1047,6 +1040,61 @@ namespace MED } } } + } else { // eSTRUCTURE + EGrilleType aGrilleType; + TInt aNbNodes = 1; + TInt aNbElem = 1; + TInt aDim = theMeshInfo.GetDim(); + EGeometrieElement aGeom; + EEntiteMaillage anEntity = eMAILLE; + switch(aDim){ + case 1: + aGeom = eSEG2; + break; + case 2: + aGeom = eQUAD4; + break; + case 3: + aGeom = eHEXA8; + break; + } + + GetGrilleType(theMeshInfo,aGrilleType); + + if (aGrilleType == eGRILLE_STANDARD){ + TIntVector theStruct; + theStruct.resize(aDim); + GetGrilleStruct(theMeshInfo,theStruct,theErr); + for(med_int i=0;i<aDim;i++){ + aNbNodes = aNbNodes * theStruct[i]; + aNbElem = aNbElem * (theStruct[i]-1); + } + anInfo[eNOEUD][ePOINT1] = aNbNodes; + anInfo[anEntity][aGeom] = aNbElem; + + } else { // eGRILLE_CARTESIENNE and eGRILLE_POLAIRE + med_table quoi; + for(int aAxe=1;aAxe<=aDim;aAxe++) + { + switch(aAxe) { + case 1 : + quoi = MED_COOR_IND1; + break; + case 2 : + quoi = MED_COOR_IND2; + break; + case 3 : + quoi = MED_COOR_IND3; + break; + } + TInt nbn = GetNbNodes(theMeshInfo,(ETable)quoi); + aNbNodes = aNbNodes * nbn; + aNbElem = aNbElem * (nbn-1); + } + anInfo[eNOEUD][ePOINT1] = aNbNodes; + anInfo[anEntity][aGeom] = aNbElem; + } + } return anInfo; } @@ -1889,5 +1937,230 @@ namespace MED SetTimeStamp(theVal,eLECTURE_AJOUT,theErr); } + void + TVWrapper + ::SetGrilleInfo(const MED::TGrilleInfo& theInfo, + TErr* theErr) + { + SetGrilleInfo(theInfo,eLECTURE_ECRITURE,theErr); + } + + void + TVWrapper + ::SetGrilleInfo(const MED::TGrilleInfo& theInfo, + EModeAcces theMode, + TErr* theErr) + { + if(theInfo.myMeshInfo->myType != eSTRUCTURE) + return; + TFileWrapper aFileWrapper(myFile,theMode,theErr); + + if(theErr) + if(!*theErr) + return; + + MED::TGrilleInfo& anInfo = const_cast<MED::TGrilleInfo&>(theInfo); + MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo; + + TErr aRet = 0; + aRet = MEDnatureGrilleEcr(myFile->Id(), + &aMeshInfo.myName[0], + (med_type_grille)anInfo.myGrilleType); + if(theErr) + *theErr = aRet; + else if(aRet < 0) + EXCEPTION(runtime_error,"SetGrilleInfo - MEDnatureGrilleEcr(...)"); + + if(anInfo.myGrilleType == eGRILLE_STANDARD){ + med_int nnoeuds = (med_int)(anInfo.myCoord.size()/aMeshInfo.myDim); + aRet = MEDcoordEcr(myFile->Id(), + &aMeshInfo.myName[0], + aMeshInfo.myDim, + &anInfo.myCoord[0], + med_mode_switch(anInfo.myModeSwitch), + nnoeuds, + (med_repere)theInfo.myGrilleType, + &anInfo.myCoordNames[0], + &anInfo.myCoordUnits[0]); + + if(aRet < 0) + EXCEPTION(runtime_error,"SetGrilleInfo - MEDcoordEcr(...)"); + + aRet = MEDstructureCoordEcr(myFile->Id(), + &aMeshInfo.myName[0], + aMeshInfo.myDim, + &anInfo.myGrilleStructure[0]); + if(aRet < 0) + EXCEPTION(runtime_error,"SetGrilleInfo - MEDstructureCoordEcr(...)"); + + } else { + for(int aAxe=0;aAxe<aMeshInfo.myDim;aAxe++){ + aRet = MEDindicesCoordEcr(myFile->Id(), + &aMeshInfo.myName[0], + aMeshInfo.myDim, + &anInfo.GetIndexes(aAxe)[0], + anInfo.GetIndexes(aAxe).size(), + aAxe+1, + &anInfo.GetCoordName(aAxe)[0], + &anInfo.GetCoordUnit(aAxe)[0]); + if(aRet < 0) + EXCEPTION(runtime_error,"SetGrilleInfo - MEDindicesCoordEcr(...)"); + } + + } + + return; + } + + void + TVWrapper + ::GetGrilleInfo(TGrilleInfo& theInfo, + TErr* theErr) + { + TFileWrapper aFileWrapper(myFile,eLECTURE,theErr); + + if(theErr) + if(!*theErr) + return; + + MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo; + + EMaillage type_maillage = aMeshInfo.myType; + + GetGrilleType(aMeshInfo,theInfo.myGrilleType,theErr); + EGrilleType type = theInfo.myGrilleType; + + TErr aRet; + if(type_maillage == eSTRUCTURE && type == eGRILLE_STANDARD){ + + GetGrilleStruct(aMeshInfo,theInfo.myGrilleStructure,theErr); + + aRet = MEDcoordLire(myFile->Id(), + &aMeshInfo.myName[0], + aMeshInfo.myDim, + &theInfo.myCoord[0], + med_mode_switch(theInfo.myModeSwitch), + MED_ALL, // all coordinates must be return + NULL, + 0, + (med_repere*)&theInfo.myGrilleType, + &theInfo.myCoordNames[0], + &theInfo.myCoordUnits[0]); + + if(theErr) + *theErr = aRet; + else if(aRet < 0) + EXCEPTION(runtime_error,"GetGrilleInfo - MEDcoordLire(...)"); + //============================ + } + + if(type_maillage == eSTRUCTURE && type != eGRILLE_STANDARD){ + med_table quoi; + for(int aAxe=1;aAxe<=aMeshInfo.myDim;aAxe++) + { + switch(aAxe) { + case 1 : + quoi = MED_COOR_IND1; + break; + case 2 : + quoi = MED_COOR_IND2; + break; + case 3 : + quoi = MED_COOR_IND3; + break; + + default : + aRet = -1; + } + + if(theErr) + *theErr = aRet; + else if(aRet < 0) + EXCEPTION(runtime_error,"GetGrilleInfo - Axe number out of range(...)"); + + TInt nind = GetNbNodes(aMeshInfo,(ETable)quoi); + if(nind < 0) + EXCEPTION(runtime_error,"GetGrilleInfo - Erreur a la lecture de la taille de l'indice"); + + med_float* indices = (med_float*)&theInfo.myIndixes[aAxe-1][0]; + + char comp[MED_TAILLE_PNOM+1]; + char unit[MED_TAILLE_PNOM+1]; + + aRet = MEDindicesCoordLire(myFile->Id(), + &aMeshInfo.myName[0], + aMeshInfo.myDim, + indices, + (med_int)nind, + (med_int)aAxe, + comp, + unit); + theInfo.SetCoordName(aAxe-1,comp); + theInfo.SetCoordUnit(aAxe-1,unit); + if(theErr) + *theErr = aRet; + else if(aRet < 0) + EXCEPTION(runtime_error,"GetGrilleInfo - MEDindicesCoordLire(...)"); + } + } + } + + void + TVWrapper + ::GetGrilleType(const MED::TMeshInfo& theMeshInfo, + EGrilleType& type, + TErr* theErr) + { + TFileWrapper aFileWrapper(myFile,eLECTURE,theErr); + + if(theErr) + if(!*theErr) + EXCEPTION(runtime_error," GetGrilleType - aFileWrapper (...)"); + + MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo); + + EMaillage type_maillage = aMeshInfo.myType; + + TErr aRet; + if(type_maillage == eSTRUCTURE){ + med_type_grille Mtype; + aRet = MEDnatureGrilleLire(myFile->Id(), + &aMeshInfo.myName[0], + &Mtype); + if(aRet < 0) + EXCEPTION(runtime_error,"GetGrilleInfo - MEDnatureGrilleLire(...)"); + + type = (EGrilleType)Mtype; + + } + } + + void + TVWrapper + ::GetGrilleStruct(const MED::TMeshInfo& theMeshInfo, + TIntVector& theStruct, + TErr* theErr) + { + TFileWrapper aFileWrapper(myFile,eLECTURE,theErr); + + if(theErr) + if(!*theErr) + return; + + TErr aRet; + MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo); + + med_int* anGrilleStruct = aMeshInfo.myDim > 0? (med_int*)&theStruct[0]: NULL; + + aRet = MEDstructureCoordLire(myFile->Id(), + &aMeshInfo.myName[0], + aMeshInfo.myDim, + anGrilleStruct); + if(theErr) + *theErr = aRet; + else if(aRet < 0) + EXCEPTION(runtime_error,"GetGrilleInfo - MEDstructureCoordLire(...)"); + } + } } diff --git a/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.hxx b/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.hxx index f8398b758..dcd1e5f1a 100644 --- a/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.hxx +++ b/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.hxx @@ -77,6 +77,8 @@ namespace MED typedef MED::TTTimeStampVal<eV2_2> TVTimeStampVal; + typedef MED::TTGrilleInfo<eV2_2> TVGrilleInfo; + //--------------------------------------------------------------- class TFile; typedef boost::shared_ptr<TFile> PFile; @@ -217,6 +219,14 @@ namespace MED virtual TInt GetNbNodes(const MED::TMeshInfo& theMeshInfo, + TErr* theErr = NULL) + { + return GetNbNodes(theMeshInfo,eCOOR,theErr); + } + + TInt + GetNbNodes(const MED::TMeshInfo& theMeshInfo, + ETable theTable, TErr* theErr = NULL); virtual @@ -420,6 +430,32 @@ namespace MED EModeAcces theMode, TErr* theErr = NULL); + virtual + void + GetGrilleInfo(TGrilleInfo& theGrilleInfo, + TErr* theErr = NULL); + + virtual + void + SetGrilleInfo(const MED::TGrilleInfo& theGrilleInfo, + TErr* theErr = NULL); + + void + SetGrilleInfo(const MED::TGrilleInfo& theGrilleInfo, + EModeAcces theMode, + TErr* theErr = NULL); + + virtual + void + GetGrilleType(const MED::TMeshInfo& theMeshInfo, + EGrilleType& type, + TErr* theErr = NULL); + + void + GetGrilleStruct(const MED::TMeshInfo& theMeshInfo, + TIntVector& theStruct, + TErr* theErr = NULL); + protected: PFile myFile; }; diff --git a/src/Makefile.in b/src/Makefile.in index 2c1e36e7b..34505d711 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -43,7 +43,7 @@ ifeq (@WITHIHM@,yes) SUBDIRS+= MEDGUI endif -LDFLAGS= -L$(top_builddir)/lib/salome -LDFLAGSFORBIN= -L$(top_builddir)/lib/salome +LDFLAGS= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome +LDFLAGSFORBIN= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome @MODULE@ diff --git a/src/MedClient/src/CONNECTIVITYClient.cxx b/src/MedClient/src/CONNECTIVITYClient.cxx index e01355124..a47ba8225 100644 --- a/src/MedClient/src/CONNECTIVITYClient.cxx +++ b/src/MedClient/src/CONNECTIVITYClient.cxx @@ -115,6 +115,12 @@ void CONNECTIVITYClient::blankCopy() _polyType_client = MED_EN::MED_NONE; } + // create a constituent (PAL10556) + if ( Entity == MED_CELL ) { + Entity = ( IOR_Mesh->getMeshDimension() == 3 ? MED_FACE : MED_EDGE ); + _constituent = new CONNECTIVITYClient( IOR_Mesh, Entity ); + } + _complete = false; END_OF("CONNECTIVITYClient::blankCopy()"); @@ -349,11 +355,11 @@ const int * CONNECTIVITYClient::getGlobalNumberingIndex if (!_complete) (const_cast<CONNECTIVITYClient *>(this))->fillCopy(); - const int * c = CONNECTIVITY::getGlobalNumberingIndex(Entity); + const int * index = CONNECTIVITY::getGlobalNumberingIndex(Entity); END_OF("void CONNECTIVITYClient::getGlobalNumberingIndex()"); - return c; + return index; } //============================================================================= diff --git a/src/MedClient/src/Makefile.in b/src/MedClient/src/Makefile.in index 082cd052c..b639773d5 100644 --- a/src/MedClient/src/Makefile.in +++ b/src/MedClient/src/Makefile.in @@ -92,12 +92,12 @@ BIN_SRC = BIN_SERVER_IDL = BIN_CLIENT_IDL = -LDFLAGS= -L$(top_builddir)/lib/salome -LDFLAGSFORBIN= -L$(top_builddir)/lib/salome +LDFLAGS= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome +LDFLAGSFORBIN= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome -CPPFLAGS+= $(MED2_INCLUDES) $(HDF5_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I$(srcdir)/../../MEDMEM_I -CXXFLAGS+=-I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS+=-L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lMedCorba_Swigcmodule -lmedmem +CPPFLAGS+= $(MED2_INCLUDES) $(HDF5_INCLUDES) $(PYTHON_INCLUDES) ${KERNEL_CXXFLAGS} -I$(srcdir)/../../MEDMEM_I +CXXFLAGS+=${KERNEL_CXXFLAGS} +LDFLAGS+=${KERNEL_LDFLAGS} -lOpUtil -lMedCorba_Swigcmodule -lmedmem MED.hh MEDSK.cc: MED.idl omniidl -bcxx -Wbtp -I$(top_builddir)/idl -I${KERNEL_ROOT_DIR}/idl/salome $^ diff --git a/src/MedClient/src/libMEDClient.i b/src/MedClient/src/libMEDClient.i index e5a017b27..40e70d688 100644 --- a/src/MedClient/src/libMEDClient.i +++ b/src/MedClient/src/libMEDClient.i @@ -53,6 +53,14 @@ class MESHClient : public MESH { } }; +MESH * getMeshPointer(MESHClient * input); +%{ + MESH * getMeshPointer(MESHClient * input) + { + return (MESH *) input; + } +%} + class SUPPORTClient : public SUPPORT { public: diff --git a/src/MedClient/test/environ/csh/init1.in b/src/MedClient/test/environ/csh/init1.in index d5f917612..bd0bbeca9 100644 --- a/src/MedClient/test/environ/csh/init1.in +++ b/src/MedClient/test/environ/csh/init1.in @@ -1,4 +1,4 @@ -cd ${KERNEL_ROOT_DIR}/bin +cd ${KERNEL_ROOT_DIR}/bin/salome pwd ./allkill || true ./killall python || true diff --git a/src/MedClient/test/environ/csh/init3.in b/src/MedClient/test/environ/csh/init3.in index 8bf9383d2..fc7b3a531 100644 --- a/src/MedClient/test/environ/csh/init3.in +++ b/src/MedClient/test/environ/csh/init3.in @@ -1,2 +1,2 @@ -cd ${KERNEL_ROOT_DIR}/bin +cd ${KERNEL_ROOT_DIR}/bin/salome csh diff --git a/src/MedClient/test/environ/csh/runContainer.in b/src/MedClient/test/environ/csh/runContainer.in index 2d61eb8e8..2fd3ddb61 100644 --- a/src/MedClient/test/environ/csh/runContainer.in +++ b/src/MedClient/test/environ/csh/runContainer.in @@ -9,15 +9,15 @@ set PYTHON_VERSION=python@PYTHON_VERSION@ setenv KERNEL_ROOT_DIR @prefix@ if ( ${?KERNEL_ROOT_DIR} ) then - setenv PATH ${KERNEL_ROOT_DIR}/bin:${KERNEL_ROOT_DIR}/Tests:${PATH} - setenv LD_LIBRARY_PATH ${KERNEL_ROOT_DIR}/lib:${LD_LIBRARY_PATH} - setenv PYTHONPATH ${KERNEL_ROOT_DIR}/lib:${KERNEL_ROOT_DIR}/lib/${PYTHON_VERSION}/site-packages/salome:${PYTHONPATH} + setenv PATH ${KERNEL_ROOT_DIR}/bin/salome:${KERNEL_ROOT_DIR}/Tests:${PATH} + setenv LD_LIBRARY_PATH ${KERNEL_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome:${LD_LIBRARY_PATH} + setenv PYTHONPATH ${KERNEL_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome:${KERNEL_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/${PYTHON_VERSION}/site-packages/salome:${PYTHONPATH} endif if ( ${?MED_ROOT_DIR} ) then - setenv PATH ${MED_ROOT_DIR}/bin:${PATH} - setenv LD_LIBRARY_PATH ${MED_ROOT_DIR}/lib:${LD_LIBRARY_PATH} - setenv PYTHONPATH ${MED_ROOT_DIR}/lib:${MED_ROOT_DIR}/lib/${PYTHON_VERSION}/site-packages/salome:${PYTHONPATH} + setenv PATH ${MED_ROOT_DIR}/bin/salome:${PATH} + setenv LD_LIBRARY_PATH ${MED_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome:${LD_LIBRARY_PATH} + setenv PYTHONPATH ${MED_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome:${MED_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/${PYTHON_VERSION}/site-packages/salome:${PYTHONPATH} endif if ( -d ${HOME}/.salome/bin ) then @@ -50,8 +50,8 @@ set CONTAINER_TYPE = `echo ${CONTAINER_NAME} | grep 'Py$'` echo ${?CONTAINER_TYPE} if ( ${?CONTAINER_TYPE} ) then - ( ${KERNEL_ROOT_DIR}/bin/SALOME_ContainerPy.py ${CONTAINER_NAME} &) + ( ${KERNEL_ROOT_DIR}/bin/salome/SALOME_ContainerPy.py ${CONTAINER_NAME} &) else - ( ${KERNEL_ROOT_DIR}/bin/SALOME_Container ${CONTAINER_NAME} & ) + ( ${KERNEL_ROOT_DIR}/bin/salome/SALOME_Container ${CONTAINER_NAME} & ) endif diff --git a/src/MedClient/test/environ/csh/stopContainer.in b/src/MedClient/test/environ/csh/stopContainer.in index 95cfa69e4..3cbbee5e7 100644 --- a/src/MedClient/test/environ/csh/stopContainer.in +++ b/src/MedClient/test/environ/csh/stopContainer.in @@ -38,15 +38,15 @@ PYTHON_VERSION=python2.2 if test -n ${KERNEL_ROOT_DIR} then - export PATH=${KERNEL_ROOT_DIR}/bin:${PATH} - export LD_LIBRARY_PATH=${KERNEL_ROOT_DIR}/lib:${LD_LIBRARY_PATH} - export PYTHONPATH=${KERNEL_ROOT_DIR}/lib:${KERNEL_ROOT_DIR}/lib/${PYTHON_VERSION}/site-packages/salome:${PYTHONPATH} + export PATH=${KERNEL_ROOT_DIR}/bin/salome:${PATH} + export LD_LIBRARY_PATH=${KERNEL_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome:${LD_LIBRARY_PATH} + export PYTHONPATH=${KERNEL_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome:${KERNEL_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/${PYTHON_VERSION}/site-packages/salome:${PYTHONPATH} fi if test -n ${MED_ROOT_DIR} then - export PATH=${MED_ROOT_DIR}/bin:${PATH} - export LD_LIBRARY_PATH=${MED_ROOT_DIR}/lib:${LD_LIBRARY_PATH} - export PYTHONPATH=${MED_ROOT_DIR}/lib:${MED_ROOT_DIR}/lib/${PYTHON_VERSION}/site-packages/salome:${PYTHONPATH} + export PATH=${MED_ROOT_DIR}/bin/salome:${PATH} + export LD_LIBRARY_PATH=${MED_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome:${LD_LIBRARY_PATH} + export PYTHONPATH=${MED_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome:${MED_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/${PYTHON_VERSION}/site-packages/salome:${PYTHONPATH} fi if test -d ${HOME}/.salome/bin diff --git a/src/MedClient/test/environ/runTestMedCorba.in b/src/MedClient/test/environ/runTestMedCorba.in index c152b3c71..c83158c0f 100644 --- a/src/MedClient/test/environ/runTestMedCorba.in +++ b/src/MedClient/test/environ/runTestMedCorba.in @@ -4,17 +4,17 @@ PYTHON_VERSION=python@PYTHON_VERSION@ if test -n $MED_ROOT_DIR then - export PATH=$MED_ROOT_DIR/bin:${PATH} - export LD_LIBRARY_PATH=$MED_ROOT_DIR/lib:${LD_LIBRARY_PATH} - export PYTHONPATH=${MED_ROOT_DIR}/lib:${MED_ROOT_DIR}/lib/$PYTHON_VERSION/site-packages/salome:${MED_ROOT_DIR}/share/salome/resources:${PYTHONPATH} + export PATH=$MED_ROOT_DIR/bin/salome:${PATH} + export LD_LIBRARY_PATH=$MED_ROOT_DIR/lib@LIB_LOCATION_SUFFIX@/salome:${LD_LIBRARY_PATH} + export PYTHONPATH=${MED_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome:${MED_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/$PYTHON_VERSION/site-packages/salome:${MED_ROOT_DIR}/share/salome/resources:${PYTHONPATH} # add bin, because some script are in (SALOME_SWIG) !!!! - export PYTHONPATH=${MED_ROOT_DIR}/bin:${PYTHONPATH} + export PYTHONPATH=${MED_ROOT_DIR}/bin/salome:${PYTHONPATH} fi if test -n $MED_ROOT_DIR then - export PATH=$MED_ROOT_DIR/bin:${PATH} - export LD_LIBRARY_PATH=$MED_ROOT_DIR/lib:${LD_LIBRARY_PATH} - export PYTHONPATH=${MED_ROOT_DIR}/lib:${MED_ROOT_DIR}/lib/$PYTHON_VERSION/site-packages/salome:${MED_ROOT_DIR}/share/salome/resources:${PYTHONPATH} + export PATH=$MED_ROOT_DIR/bin/salome:${PATH} + export LD_LIBRARY_PATH=$MED_ROOT_DIR/lib@LIB_LOCATION_SUFFIX@/salome:${LD_LIBRARY_PATH} + export PYTHONPATH=${MED_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome:${MED_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/$PYTHON_VERSION/site-packages/salome:${MED_ROOT_DIR}/share/salome/resources:${PYTHONPATH} fi mkdir -p resultats diff --git a/src/MedClient/test/test1/Compo1Py.py b/src/MedClient/test/test1/Compo1Py.py index 50dac23a7..cb075bcad 100644 --- a/src/MedClient/test/test1/Compo1Py.py +++ b/src/MedClient/test/test1/Compo1Py.py @@ -1,13 +1,13 @@ import sys from omniORB import CORBA, PortableServer import CosNaming -import Engines, Engines__POA +import Compo1Py_ORB, Compo1Py_ORB__POA from SALOME_ComponentPy import * from libMedCorba_Swig import * import Compo1 -class Compo1Py( Engines__POA.Compo1Py, SALOME_ComponentPy_i): +class Compo1Py( Compo1Py_ORB__POA.Compo1Py, SALOME_ComponentPy_i): def __init__(self, orb, poa, contID, \ containerName, instanceName, interfaceName): diff --git a/src/MedClient/test/test2/Makefile.in b/src/MedClient/test/test2/Makefile.in index 490b3204b..aa2bb3adc 100644 --- a/src/MedClient/test/test2/Makefile.in +++ b/src/MedClient/test/test2/Makefile.in @@ -42,11 +42,11 @@ LIB = libCompo2cmodule.la LIB_SRC = Compo2.cxx LIB_CLIENT_IDL= SALOME_Component.idl SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl SALOME_Comm.idl MED.idl SALOME_GenericObj.idl -LDFLAGS= -L$(top_builddir)/lib/salome -LDFLAGSFORBIN= -L$(top_builddir)/lib/salome +LDFLAGS= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome +LDFLAGSFORBIN= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome -CPPFLAGS += ${MED2_INCLUDES} ${HDF5_INCLUDES} ${PYTHON_INCLUDES} -I${KERNEL_ROOT_DIR}/include/salome -LIBS = -L${KERNEL_ROOT_DIR}/lib/salome -lMEDClientcmodule -lMEDMEM_Swigcmodule -lmedmem -lMEDMEMImpl ${MED2_LIBS} ${HDF5_LIBS} +CPPFLAGS += ${MED2_INCLUDES} ${HDF5_INCLUDES} ${PYTHON_INCLUDES} ${KERNEL_CXXFLAGS} +LIBS = ${KERNEL_LDFLAGS} -lMEDClientcmodule -lMEDMEM_Swigcmodule -lmedmem -lMEDMEMImpl ${MED2_LIBS} ${HDF5_LIBS} # Executables targets diff --git a/src/MedCorba_Swig/Makefile.in b/src/MedCorba_Swig/Makefile.in index c8bb812f7..71be6d496 100644 --- a/src/MedCorba_Swig/Makefile.in +++ b/src/MedCorba_Swig/Makefile.in @@ -65,15 +65,15 @@ EXPORT_HEADERS = libMedCorba_Swig.i ############################################################################# -LDFLAGS= -L$(top_builddir)/lib/salome -LDFLAGSFORBIN= -L$(top_builddir)/lib/salome +LDFLAGS= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome +LDFLAGSFORBIN= -L$(top_builddir)/lib@LIB_LOCATION_SUFFIX@/salome -CPPFLAGS+= $(PYTHON_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS+=-ftemplate-depth-42 -I${KERNEL_ROOT_DIR}/include/salome +CPPFLAGS+= $(PYTHON_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) ${KERNEL_CXXFLAGS} +CXXFLAGS+=-ftemplate-depth-42 ${KERNEL_CXXFLAGS} LIBS= $(PYTHON_LIBS) -#LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lMEDMEMImpl -lmedmem -lMEDMEM_Swigcmodule -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeLoggerServer -L${KERNEL_ROOT_DIR}/lib/salome +#LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lMEDMEMImpl -lmedmem -lMEDMEM_Swigcmodule ${KERNEL_LDFLAGS} -lSalomeLoggerServer ${KERNEL_LDFLAGS} # change motivated by the bug KERNEL4778. -LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lMEDMEMImpl -lmedmem -lMEDMEM_Swigcmodule -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace +LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lMEDMEMImpl -lmedmem -lMEDMEM_Swigcmodule ${KERNEL_LDFLAGS} -lSALOMELocalTrace #############################################################################