Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
authorjfa <jfa@opencascade.com>
Mon, 13 Mar 2006 14:44:14 +0000 (14:44 +0000)
committerjfa <jfa@opencascade.com>
Mon, 13 Mar 2006 14:44:14 +0000 (14:44 +0000)
21 files changed:
Makefile.in
adm_local/Makefile.in [new file with mode: 0644]
adm_local/unix/make_commence.in
adm_local_without_kernel/unix/config_files/check_boost.m4
build_configure
configure.in.base
src/INTERPOLATION/MEDMEM_Mapping.hxx
src/INTERPOLATION/MEDMEM_MappingTools.hxx
src/MEDMEM/MEDMEM_Connectivity.cxx
src/MEDMEM/MEDMEM_Field.hxx
src/MEDMEM/MEDMEM_MedMedDriver22.cxx
src/MEDMEM/MEDMEM_medimport_src.cxx
src/MEDWrapper/Base/MED_SliceArray.hxx
src/MEDWrapper/Base/MED_Vector.hxx
src/MEDWrapper/Base/Makefile.in
src/MEDWrapper/Factory/MED_Factory.cxx
src/MEDWrapper/Factory/MED_Factory.hxx
src/MEDWrapper/Factory/Makefile.in
src/MEDWrapper/Factory/mprint_version.cxx [new file with mode: 0644]
src/MEDWrapper/V2_1/Wrapper/MED_V2_1_Wrapper.cxx
src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx

index 7ddc521bf6727977cfd035f4be83b2b9945107fa..9e82a931233599dbf4317618b7930782fa2a3d4e 100644 (file)
@@ -24,6 +24,8 @@ ifeq (@WITHIHM@,yes)
       SUBDIRS+= doc
 endif
 
+SUBDIRS+= adm_local
+
 RESOURCES_FILES = \
 MEDCatalog.xml \
 MED_en.xml \
diff --git a/adm_local/Makefile.in b/adm_local/Makefile.in
new file mode 100644 (file)
index 0000000..9b5e810
--- /dev/null
@@ -0,0 +1,41 @@
+# source path
+top_srcdir=@top_srcdir@
+top_builddir=..
+srcdir=@srcdir@
+VPATH=.:$(srcdir)/adm_local
+
+
+all: resources
+
+install:
+       cp -rf @top_srcdir@/adm_local @prefix@
+
+bin:
+
+resources :
+       cp -rf @top_srcdir@/adm_local $(top_builddir)
+
+inc:
+
+lib:
+
+depend:
+
+depend_idl:
+
+install-end:
+
+install-include:
+
+install-bin:
+
+uninstall:
+
+uninstall-idl:
+
+distclean:
+
+clean:
+
+distclean-other:
+
index 2926336573f843fb9d1c8818f1158044ef01c63d..9f3ba60b54b0507aaf391245c612da821c5946cf 100644 (file)
@@ -41,6 +41,7 @@ CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@
 # BOOST Library
 
 BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_LIBSUFFIX = @BOOST_LIBSUFFIX@
 BOOST_LIBS = @BOOST_LIBS@
 
 # JAVA
@@ -265,14 +266,21 @@ $(top_srcdir)/configure.in: $(top_srcdir)/configure.in.base
 
 ifeq ($(MED_WITH_KERNEL),yes)
 ACLOCAL_SRC = \
-ac_cxx_bool.m4                    check_corba.m4     check_vtk.m4      \
+ac_cxx_bool.m4                    check_corba.m4                        \
 ac_cxx_depend_flag.m4             check_hdf5.m4      enable_pthreads.m4        \
 ac_cxx_mutable.m4                 check_mico.m4      libtool.m4                \
 ac_cxx_namespaces.m4              check_omniorb.m4   pyembed.m4                \
-ac_cxx_partial_specialization.m4  check_opengl.m4    python.m4         \
+ac_cxx_partial_specialization.m4  python.m4                             \
 ac_cxx_typename.m4                check_pthreads.m4  check_cas.m4      \
-ac_cc_warnings.m4                 check_qt.m4        check_swig.m4 
+ac_cc_warnings.m4                 check_swig.m4 
 endif
 
-$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%)
-       cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files
+ACLOCAL_GUI = \
+check_vtk.m4                     check_opengl.m4    check_qt.m4        \
+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 \
+                                                                      -I @GUI_ROOT_DIR@/adm_local/unix/config_files
+
index c77edba5d14faec79d9d4288ece7b480efd56b67..12cd2a864e58fa7f9723e147ab1682fb72fc470a 100644 (file)
@@ -23,49 +23,117 @@ AC_DEFUN([CHECK_BOOST],[
 
 AC_CHECKING(for BOOST Library)
 
+AC_REQUIRE([ENABLE_PTHREADS])dnl
+
 AC_LANG_SAVE
 AC_LANG_CPLUSPLUS
 
-AC_SUBST(BOOST_CPPFLAGS)
 BOOST_CPPFLAGS=""
-
-AC_SUBST(BOOST_LIBS)
+BOOST_LIBSUFFIX="-mt"
 BOOST_LIBS=""
 
-boost_ok=no
+AC_CHECKING(for BOOST location)
+AC_ARG_WITH(boost,
+            [  --with-boost=DIR      root directory path to BOOST library installation ],
+            [BOOSTDIR="$withval"
+             AC_MSG_RESULT("select $withval as path to BOOST library")
+            ])
 
-if test -z ${BOOSTDIR}; then
-  AC_CHECK_HEADER(boost/shared_ptr.hpp,boost_ok=yes,boost_ok=no)
-  if test boost_ok = no ; then
-    AC_MSG_WARN(You must provide BOOSTDIR variable)
-  fi
-else
-  AC_MSG_RESULT(\$BOOSTDIR = ${BOOSTDIR})
+AC_MSG_RESULT(\$BOOSTDIR = ${BOOSTDIR})
+
+CPPFLAGS_old="${CPPFLAGS}"
+LIBS_old=$LIBS
 
-  dnl BOOST headers
-  AC_CHECKING(for boost/shared_ptr.hpp header file)
-  CPPFLAGS_old="${CPPFLAGS}"
+if test "x${BOOSTDIR}" != "x" ; then
   BOOST_CPPFLAGS="-I${BOOSTDIR}/include"
-  CPPFLAGS="${CPPFLAGS} ${BOOST_CPPFLAGS}"
+  BOOST_LIBS="-L${BOOSTDIR}/lib"
+fi
+
+boost_ok=no
+boost_headers_ok=no
+boost_binaries_ok=no
 
-  AC_CHECK_HEADER(boost/shared_ptr.hpp,boost_ok=yes,boost_ok=no)
+dnl BOOST headers
+AC_CHECKING(for BOOST headers)
+CPPFLAGS="${CPPFLAGS_old} ${BOOST_CPPFLAGS}"
 
-  CPPFLAGS="${CPPFLAGS_old}"
+boost_include_dir_ok=yes
+if test "x${BOOSTDIR}" != "x" ; then
+  AC_CHECK_FILE(${BOOSTDIR}/include/boost/shared_ptr.hpp,
+                boost_include_dir_ok=yes,
+                boost_include_dir_ok=no)
+fi
 
-  if test "x${boost_ok}" = "xyes" ; then
-    AC_MSG_RESULT(\$BOOST_CPPFLAGS = ${BOOST_CPPFLAGS})
-    dnl BOOST libs
-    AC_CHECKING(for libboost_thread-mt.so library file)
-    AC_CHECK_FILE(${BOOSTDIR}/lib/libboost_thread-mt.so,boost_ok=yes,boost_ok=no)
-    if test "x${boost_ok}" = "xyes" ; then
-      BOOST_LIBS="-L${BOOSTDIR}/lib"
-      AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS})
+if test "x${boost_include_dir_ok}" = "xyes" ; then
+  AC_TRY_COMPILE([#include <boost/shared_ptr.hpp>],
+                 [boost::shared_ptr<int>(new int)],
+                 boost_headers_ok=yes,
+                 boost_headers_ok=no)
+fi
+
+if test "x${boost_headers_ok}" = "xno" ; then
+  BOOST_CPPFLAGS="BOOST_CPPFLAGS_NOT_DEFINED"
+else
+  AC_MSG_RESULT(\$BOOST_CPPFLAGS = ${BOOST_CPPFLAGS})
+fi
+AC_MSG_RESULT(for boost headers: $boost_headers_ok)
+
+if test "x${boost_headers_ok}" = "xyes" ; then
+  dnl BOOST binaries
+  AC_CHECKING(for BOOST binaries)
+  boost_lib_dir_ok=yes
+  if test "x${BOOSTDIR}" != "x" ; then
+    AC_CHECK_FILE(${BOOSTDIR}/lib/libboost_thread${BOOST_LIBSUFFIX}.so,
+                  boost_lib_dir_ok=yes,
+                  boost_lib_dir_ok=no)
+    if test "x${boost_lib_dir_ok}" = "xno" ; then
+      BOOST_LIBSUFFIX=""
+      AC_CHECK_FILE(${BOOSTDIR}/lib/libboost_thread${BOOST_LIBSUFFIX}.so,
+                    boost_lib_dir_ok=yes,
+                    boost_lib_dir_ok=no)
+    fi
+  fi
+  if test "x${boost_lib_dir_ok}" = "xyes" ; then
+    LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}"
+    AC_TRY_LINK([#include <boost/thread/thread.hpp>],
+                [struct TBody{ void operator()(){} }; boost::thread(TBody())],
+                boost_binaries_ok=yes,
+                boost_binaries_ok=no)
+    if test "x${boost_binaries_ok}" = "xno" ; then
+      BOOST_LIBSUFFIX=""
+      LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}"
+      AC_TRY_LINK([#include <boost/thread/thread.hpp>],
+                  [struct TBody{ void operator()(){} }; boost::thread(TBody())],
+                  boost_binaries_ok=yes,
+                  boost_binaries_ok=no)
     fi
   fi
 fi
 
+if test "x${boost_binaries_ok}" = "xno" ; then
+  BOOST_LIBS="BOOST_LIBS_NOT_FOUND"
+  BOOST_LIBSUFFIX="-not-defined"
+else
+  AC_MSG_RESULT(\$BOOST_LIBSUFFIX = ${BOOST_LIBSUFFIX})
+  AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS})
+fi
+AC_MSG_RESULT(for boost binaries: $boost_binaries_ok)
+
+CPPFLAGS="${CPPFLAGS_old}"
+LIBS="${LIBS_old}"
+
+if test "x${boost_headers_ok}" = "xyes" ; then
+  if test "x${boost_binaries_ok}" = "xyes" ; then
+    boost_ok=yes
+  fi
+fi
+
 AC_MSG_RESULT(for boost: $boost_ok)
 
+AC_SUBST(BOOST_CPPFLAGS)
+AC_SUBST(BOOST_LIBSUFFIX)
+AC_SUBST(BOOST_LIBS)
+
 AC_LANG_RESTORE
 
 ])dnl
index 060da7451d9f3a229c85da02772df374afecfc61..8a0bacbd2b5c0652e24becefe15dc87be415ed43 100755 (executable)
@@ -32,14 +32,13 @@ do
   esac
 done
 
+
 ########################################################################
-# Test if the KERNEL_ROOT_DIR is set correctly if KERNEL required
+# Test if the GUI_ROOT_DIR is set correctly if GUI required
 
-if test "x${MED_WITH_KERNEL}" != "xno"; then
-    if test ! -d "${KERNEL_ROOT_DIR}"; then
-        echo "failed : KERNEL_ROOT_DIR variable is not correct !"
-        exit
-    fi
+if test ! -d "${GUI_ROOT_DIR}"; then
+    echo "failed : GUI_ROOT_DIR variable is not correct !"
+    exit
 fi
 
 ########################################################################
@@ -71,6 +70,7 @@ find_in()
 
   case $1 in
     */CVS) return ;;
+    */adm_local/*) return ;;
     *) ;;
   esac
 
@@ -206,9 +206,8 @@ find_in . configure.in_tmp2
 
 # _CS_gbo_100204 Mise à jour du filtre pour prise en compte des
 # restrictions imposées par les versions récente de autoconf.
-    sed -e '/^ \.\/salome_adm/d' \
+    sed -e '/^...salome_adm/d' \
        -e '/configure.in/d'      \
-       -e '/^  \.\/adm_local/d'  \
        -e 's/.in / /' configure.in_tmp2     >> configure.in_tmp1
 
 echo  " ])"                                  >> configure.in_tmp1
@@ -279,7 +278,7 @@ else
    AUX_CONFIG_DIR=adm_local_without_kernel/unix/config_files
 fi
 
-aclocal --acdir=adm_local/unix/config_files -I ${AUX_CONFIG_DIR}
+aclocal -I adm_local/unix/config_files -I ${AUX_CONFIG_DIR} -I ${GUI_ROOT_DIR}/adm_local/unix/config_files
 if autoconf
 then
        echo "done"
index 632529721fe5d960f0a46e6b1899d0c40022cb91..4780640eba625e36e0b736887f0de4a91eb24bae 100644 (file)
@@ -93,6 +93,26 @@ dnl Export the AR macro so that it will be placed in the libtool file
 dnl correctly.
 export AR
 
+echo
+echo ---------------------------------------------
+echo Testing GUI
+echo ---------------------------------------------
+echo
+
+CHECK_SALOME_GUI
+
+echo
+echo ---------------------------------------------
+echo Testing full GUI
+echo ---------------------------------------------
+echo
+
+CHECK_CORBA_IN_GUI
+if test "x${CORBA_IN_GUI}" != "xyes"; then
+  echo "failed : For configure MED module necessary full GUI !"
+  exit
+fi
+
 echo
 echo ---------------------------------------------
 echo testing make
index 664a67822d08dbb4792646f9b4680fcdae3ad0af..99710f931679ddcf7204cd9a1ef6f84079eef1c0 100644 (file)
@@ -60,11 +60,11 @@ protected :
        vector<int> point_le_plus_proche;
        
 public :
-       
        Mapping():maillage_back(NULL),mailles_back(NULL),noeuds_back(NULL),noeuds_front(NULL),CB(NULL),my_dTree(NULL) {}
        Mapping(MAILLAGE * mb,NUAGENOEUD * nb,NUAGENOEUD * nf); // le dTree est crée à l'initialisation, par contre, le mapping lui meme doit etre invoqué
        ~Mapping() {if (CB) delete CB;if (my_dTree) delete my_dTree;}
         dTree<NOEUD,NUAGENOEUD,DIMENSION> * Donne_dTree() {return my_dTree;}
+       enum { INTERIEUR = 1, EXTERIEUR_AU_MILIEU = -1, EXTERIEUR_AU_BORD = -2 };
        int Donne_Directions(int num_maille,const NOEUD &n,int etat_face[NBR_FACES_MAX]);
        // Méthode interne de localisation
        int Trouve_Maille_Contenant_Point_Mth_Co(const NOEUD &n,int num_maille,int num_maille_interdit,int max_loop,int &nbr_mailles_examinees,int flag_convexe);
@@ -189,21 +189,21 @@ _TEMPLATE_ int _MAPPING_::Donne_Directions(int num_maille,const NOEUD &n,int eta
                tf=(ef[i]<0);
                tv=(maillage_back->DONNE_VOISIN_DE_MAILLE(num_maille,i)==UNDEFINED);
                tb=(maillage_back->EST_AU_BORD_FACE_DE_MAILLE(num_maille,i));
-               if (tf) 
+               if (tf) // extérieur
                        {
                        etat_int=FAUX;
                        if (tb) etat_ext_bord=VRAI;
                        }
-               if (tv) etat_face[i]=-1;
+               if (tv) etat_face[i]=-1; // ya pas de voisin
                else
                        {
                        if (tf) etat_face[i]=1;
                        else etat_face[i]=0;
                        }
                }
-       if (etat_int) return 1;
-       if (etat_ext_bord) return -2;
-       return -1;
+       if (etat_int) return INTERIEUR;
+       if (etat_ext_bord) return EXTERIEUR_AU_BORD;
+       return EXTERIEUR_AU_MILIEU;
        }
 _TEMPLATE_ int _MAPPING_::Trouve_Maille_Contenant_Point_Mth_Co(const NOEUD &n,int num_maille,int num_maille_interdit,int max_loop,int &nbr_mailles_examinees,int flag_convexe)
        {
@@ -219,17 +219,27 @@ _TEMPLATE_ int _MAPPING_::Trouve_Maille_Contenant_Point_Mth_Co(const NOEUD &n,in
        
        int nbr_faces=maillage_back->DONNE_NBR_FACES_MAILLE(num_maille);
        
-       for (i=0;i<nbr_faces;i++) indirection[i]=i;
+       if ( test != INTERIEUR ) { // EAP, for PAL11458
+          // check neighbors
+          int etat_face_for_check[NBR_FACES_MAX];
+          for (i=0;i<nbr_faces;i++) {
+            int num_neighbor=maillage_back->DONNE_VOISIN_DE_MAILLE(num_maille,i);
+            if ( num_neighbor != UNDEFINED &&
+                 Donne_Directions(num_neighbor,n,etat_face_for_check) == INTERIEUR )
+              return num_neighbor;
+            indirection[i]=i;
+          }
+       }
        
        nbr_mailles_examinees=0;
        
        while (nbr_mailles_examinees<max_loop)
                {
-               if (test==1
+               if (test==INTERIEUR
                        {
                        return num_maille;
                        }
-               if ((test==-2)&&(flag_convexe)) 
+               if ((test==EXTERIEUR_AU_BORD)&&(flag_convexe)) 
                        {
                        return 2*UNDEFINED;
                        }
index 3f74b6e916af5548f39c65f3dffa53fc1595f330..eb31fe16b9faf98829f8fc9428ca28573ba39a96 100644 (file)
@@ -161,8 +161,11 @@ _TEMPLATE_SPE_ vector<double> _COORDBARY_2D_::Calcule_Base_Coord_Baryc(const vec
 _TEMPLATE_SPE_ vector<double> _COORDBARY_2D_::Calcule_Coord_Baryc(int num_maille, const NOEUD & M)
        {
        int i,j;
-       vector<double> coord_baryc_M(3,0);
-       for (i=0;i<3;i++) 
+        // for PAL11458
+       //vector<double> coord_baryc_M(3,0);
+       int nbr_faces=coord_baryc[num_maille].size();
+       vector<double> coord_baryc_M(nbr_faces,0);
+       for (i=0;i</*3*/nbr_faces;i++) 
                {
                for (j=0;j<2;j++) coord_baryc_M[i]+=coord_baryc[num_maille][i][j]*M[j];
                coord_baryc_M[i]+=coord_baryc[num_maille][i][2];
index 031b3535e541bfe3873614bdb9f1d078b8ce4236..efe56741e062abf0136a7836d23c898a5341444b 100644 (file)
@@ -1427,8 +1427,12 @@ void CONNECTIVITY::calculateDescendingConnectivity()
        _constituent->_count[2]=NumberOfConstituent+1;
        // we correct _descending to adjust face number
        for(int j=0;j<DescendingSize;j++)
-         if (descend_connectivity[j]>tmp_NumberOfConstituentsForeachType[0])
-           descend_connectivity[j]-=offset;
+         if (abs(descend_connectivity[j])>tmp_NumberOfConstituentsForeachType[0]) {
+            if ( descend_connectivity[j] > 0 )
+              descend_connectivity[j]-=offset;
+            else 
+              descend_connectivity[j]+=offset;
+          }
       }
 
       delete [] ConstituentNodalConnectivityIndex;
index 758310753cfa3421cd650a9815348dfbf1e208b7..7fa8bf9b7a68e9a08b085714f7bd76b62b4f9593 100644 (file)
@@ -61,7 +61,7 @@ namespace MEDMEM {
   template < > struct SET_VALUE_TYPE<int> {
     static const MED_EN::med_type_champ _valueType = MED_EN::MED_INT32; };
 
-class FIELD_    // GENERIC POINTER TO a template <class T, class INTERLACING_TAG> class FIELD
+class MEDMEM_EXPORT FIELD_    // GENERIC POINTER TO a template <class T, class INTERLACING_TAG> class FIELD
 {
 protected:
 
@@ -841,7 +841,7 @@ FIELD<T, INTERLACING_TAG>::FIELD():FIELD_()
 template <class T, class INTERLACING_TAG>
 FIELD<T, INTERLACING_TAG>::FIELD(const SUPPORT * Support,
                                    const int NumberOfComponents) throw (MEDEXCEPTION) :
-  FIELD_(Support, NumberOfComponents),_value()
+  FIELD_(Support, NumberOfComponents),_value(NULL)
 {
   BEGIN_OF("FIELD<T>::FIELD(const SUPPORT * Support, const int NumberOfComponents)");
   SCRUTE(this);
@@ -858,7 +858,11 @@ FIELD<T, INTERLACING_TAG>::FIELD(const SUPPORT * Support,
     // becarefull about the numbre of gauss point
     _numberOfValues = Support->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS);
   }
+#ifdef _DEBUG_
   catch (MEDEXCEPTION &ex) {
+#else
+  catch (MEDEXCEPTION ) {
+#endif
     MESSAGE("No value defined ! ("<<ex.what()<<")");
   }
   MESSAGE("FIELD : constructeur : "<< _numberOfValues <<" et "<< NumberOfComponents);
@@ -1927,7 +1931,12 @@ FIELD<T, INTERLACING_TAG>::FIELD(const SUPPORT * Support,
   //A.G. Addings for RC
   if(_support)
     _support->addReference();
-  _value = (MEDMEM_Array<T, INTERLACING_TAG> *) NULL;
+  // OCC 10/03/2006 -- According to the rules defined with help of 
+  // MEDMEM_IntrelacingTraits class, it is not allowed to instantiate
+  // MEDMEM_Array<> template using INTERLACING_TAG parameter of 
+  // FIELD template - MSVC++ 2003 compiler generated an error here.
+  // _value = (MEDMEM_Array<T, INTERLACING_TAG> *) NULL;
+  _value = NULL;
 
   _iterationNumber = iterationNumber;
   _time = 0.0;
@@ -1971,7 +1980,12 @@ FIELD<T,INTERLACING_TAG>::FIELD(driverTypes driverType,
   FIELD_::_interlacingType=SET_INTERLACING_TYPE<INTERLACING_TAG>::_interlacingType;
 
   _support = (SUPPORT *) NULL;
-  _value = (MEDMEM_Array<T,INTERLACING_TAG> *)NULL;
+  // OCC 10/03/2006 -- According to the rules defined with help of 
+  // MEDMEM_IntrelacingTraits class, it is not allowed to instantiate
+  // MEDMEM_Array<> template using INTERLACING_TAG parameter of 
+  // FIELD template - MSVC++ 2003 compiler generated an error here.
+  // _value = (MEDMEM_Array<T, INTERLACING_TAG> *) NULL;
+  _value = NULL;
 
   _iterationNumber = iterationNumber;
   _time = 0.0;
@@ -2037,7 +2051,12 @@ void FIELD<T, INTERLACING_TAG>::allocValue(const int NumberOfComponents)
   }
   catch (MEDEXCEPTION &ex) {
     MESSAGE("No value defined, problem with NumberOfComponents (and may be _support) size of MEDARRAY<T>::_value !");
-    _value = (MEDMEM_Array<T, INTERLACING_TAG> *)NULL ;
+    // OCC 10/03/2006 -- According to the rules defined with help of 
+    // MEDMEM_IntrelacingTraits class, it is not allowed to instantiate
+    // MEDMEM_Array<> template using INTERLACING_TAG parameter of 
+    // FIELD template - MSVC++ 2003 compiler generated an error here.
+    // _value = (MEDMEM_Array<T, INTERLACING_TAG> *) NULL;
+    _value = NULL;
   }
 
   SCRUTE(_value);
index 23c60b8fbe2ad243b831166309a97898b7a386ae..428ba8cddf82ab0af1a22ff97bcaa63eb086b0ae 100644 (file)
@@ -451,7 +451,7 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
 
                MESSAGE("Field information 2 : NumberOfTimeStep :"<<
                        numberOfTimeSteps);
-
+/*
          if ( numberOfTimeSteps > MED_VALID ) 
                  break ;
                // There are value for some med_geometrie_element of this
@@ -462,10 +462,10 @@ void MED_MED_RDONLY_DRIVER22::readFileStruct( void )
              for (currentGeometry = (*currentEntity).second.begin();
                   currentGeometry != (*currentEntity).second.end();
                   currentGeometry++)
-               {
-           MESSAGE("Field information 3 : Geom : "<<(*currentGeometry));
+               {*/
+                MESSAGE("Field information 3 : Geom : "<<(*currentGeometry));
              
-                 for (j=1;j <= numberOfTimeSteps; j++)
+                for (j=1;j <= numberOfTimeSteps; j++)
                    {
                      MESSAGE("Field information 4 : time step j = "<<j);
                
index 1f1ae3db520769768a54ea2e30c81834fcd6e1a9..22027d59d7ee5474fa677c7228ca1a7e8304faaa 100644 (file)
@@ -35,6 +35,7 @@
 *
 *************************************************************************/
 #include "MEDMEM_medimport_src.hxx"
+#include "hdf5_version2api.hxx"
 
 using namespace med_2_2;
 using namespace MEDMEM;
@@ -110,7 +111,13 @@ med_err med_2_2::OLD_MEDdatasetNumLire(med_idt pere, char *nom,
                                       unsigned char *val,hid_t hdf_file)
 {
   med_idt    dataset, dataspace = 0, memspace = 0;
+
+#ifdef HDF_NEW_API
+  med_size  start_mem[1],start_data[1],*pflmem=0,*pfldsk=0;
+#else 
   med_ssize  start_mem[1],start_data[1],*pflmem=0,*pfldsk=0;
+#endif
+
   med_size   stride[1],count[1],pcount[1],size[1],pflsize[1];
   med_err    ret;
   int        i,j,index,type_hdf;
@@ -223,9 +230,15 @@ med_err med_2_2::OLD_MEDdatasetNumLire(med_idt pere, char *nom,
 
        pflsize [0] = psize*ngauss*nbdim;
        pcount  [0] = psize*ngauss*dimutil;
+
+#ifdef HDF_NEW_API
+        pflmem     = (med_size *) malloc (sizeof(med_size)*pcount[0]);
+       pfldsk     = (med_size *) malloc (sizeof(med_size)*pcount[0]);
+#else
        pflmem     = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
        pfldsk     = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
-       
+#endif
+
        switch(pflmod)
          { /* switch pflmod pour FULL_INTERLACE*/
          case MED_GLOBAL :
@@ -244,12 +257,19 @@ med_err med_2_2::OLD_MEDdatasetNumLire(med_idt pere, char *nom,
                }
            }
            
-           if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0) 
+#ifdef HDF_NEW_API
+           if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hsize_t **) pflmem ) ) <0) 
              return -1; 
            
-           if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pfldsk ) ) <0) 
+           if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hsize_t **) pfldsk ) ) <0) 
+             return -1; 
+#else
+           if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0) 
              return -1; 
            
+           if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pfldsk ) ) <0) 
+             return -1;
+#endif
            break;
        
          case MED_COMPACT :
@@ -270,12 +290,20 @@ med_err med_2_2::OLD_MEDdatasetNumLire(med_idt pere, char *nom,
                  pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;             
                }             
            }
+
+#ifdef HDF_NEW_API         
+           if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hsize_t **) pflmem ) ) <0) 
+             return -1; 
            
+           if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hsize_t **) pfldsk ) ) <0) 
+             return -1; 
+#else
            if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0) 
              return -1; 
            
            if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pfldsk ) ) <0) 
-             return -1; 
+             return -1;
+#endif
            
            break;
 
@@ -330,7 +358,11 @@ med_err med_2_2::OLD_MEDdatasetNumLire(med_idt pere, char *nom,
 
        pflsize [0] = psize*ngauss*nbdim;       
        pcount  [0] = psize*ngauss*dimutil; /* nom pas très coherent avec count !!! A revoir */ 
+#ifdef HDF_NEW_API
+       pfldsk      = (med_size *) malloc(sizeof(med_size)*pcount[0]);
+#else
        pfldsk      = (med_ssize *) malloc(sizeof(med_ssize)*pcount[0]);
+#endif
        
        switch(pflmod)
          { /*switch plfmod pour NO_INTERLACE */
@@ -345,8 +377,13 @@ med_err med_2_2::OLD_MEDdatasetNumLire(med_idt pere, char *nom,
                }
            }
            
+#ifdef HDF_NEW_API
+           if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hsize_t **) pfldsk ) ) <0) 
+             return -1;
+#else
            if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hssize_t **) pfldsk ) ) <0) 
              return -1;
+#endif
            
            if ((ret = H5Dread(dataset,type_hdf,dataspace,dataspace,H5P_DEFAULT, val)) < 0)
              return -1;
@@ -362,7 +399,11 @@ med_err med_2_2::OLD_MEDdatasetNumLire(med_idt pere, char *nom,
            if ( (memspace = H5Screate_simple (1, pflsize, NULL)) <0)
              return -1;
 
+#ifdef HDF_NEW_API
+           pflmem     = (med_size *) malloc (sizeof(med_size)*pcount[0]);
+#else
            pflmem     = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
+#endif
            
            /* Le profil COMPACT est contigüe, mais il est possible que l'on selectionne uniquemenent une dimension*/
 
@@ -376,11 +417,19 @@ med_err med_2_2::OLD_MEDdatasetNumLire(med_idt pere, char *nom,
                }
            }
            
+#ifdef HDF_NEW_API
+           if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hsize_t **) pflmem ) ) <0) 
+             return -1; 
+           
+           if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hsize_t **) pfldsk ) ) <0) 
+             return -1;          
+#else
            if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0) 
              return -1; 
            
            if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hssize_t **) pfldsk ) ) <0) 
-             return -1;          
+             return -1;
+#endif
            
            if ((ret = H5Dread(dataset,type_hdf,memspace,dataspace,H5P_DEFAULT, val)) < 0)
              return -1;
index d0b8923d9d3f5dce2897a1b4ac96f067b2903869..550ad4fdd07c28152a61053a7a547464c384be2e 100644 (file)
 #include <valarray>
 #include <stdexcept>
 
+//#if defined(_DEBUG_)
+#  define MED_TCSLICE_CHECK_RANGE
+//#endif
+
 namespace MED
 {
   //---------------------------------------------------------------
@@ -48,24 +52,41 @@ namespace MED
     PCContainer myCContainer; //!< Reference to source multy-dimension data
     std::slice mySlice; //!< Defines algorithm of index calculation
   protected:
-    //! Calculate internal index to get proper element from the source multy-dimension data
-    size_t
-    GetID(size_t theId) const
+    void
+    check_id(size_t theId) const
     {
-#ifdef _DEBUG_
-      size_t anId = -1;
+      long int anId = -1;
       if(theId < mySlice.size()){
        anId = mySlice.start() + theId*mySlice.stride();
        if(anId < myCContainer->size())
-         return anId;
+         return;
       }
-      throw std::out_of_range(std::string("TCSlice::GetID"));
-      return anId;
-#else
+      throw std::out_of_range("TCSlice::check_id");
+    }
+
+    //! Calculate internal index to get proper element from the source multy-dimension data
+    size_t
+    calculate_id(size_t theId) const
+    {
       return mySlice.start() + theId*mySlice.stride();
+    }
+    
+    size_t
+    get_id(size_t theId) const
+    {
+#ifdef MED_TCSLICE_CHECK_RANGE
+      check_id(theId);
 #endif
+      return calculate_id(theId);
     }
     
+    size_t
+    get_id_at(size_t theId) const
+    {
+      check_id(theId);
+      return calculate_id(theId);
+    }
+
   public:
     typedef typename TContainer::value_type value_type;
 
@@ -85,7 +106,13 @@ namespace MED
     const value_type& 
     operator[](size_t theId) const
     {
-      return (*myCContainer)[GetID(theId)];
+      return (*myCContainer)[get_id(theId)];
+    }
+    
+    const value_type& 
+    at(size_t theId) const
+    {
+      return (*myCContainer)[get_id_at(theId)];
     }
     
     //! Get range of the order numbers
@@ -126,11 +153,18 @@ namespace MED
     value_type& 
     operator[](size_t theId)
     {
-      return (*myContainer)[this->GetID(theId)];
+      return (*myContainer)[this->get_id(theId)];
+    }
+
+    value_type& 
+    at(size_t theId)
+    {
+      return (*myContainer)[this->get_id_at(theId)];
     }
   };
 
 }
 
+#undef MED_TCSLICE_CHECK_RANGE
 
 #endif
index b048d4faeb1f63cca161d4659d6483974a2392f7..a2c64758f8de7c692f471be16fb18e575c55d4c9 100644 (file)
 #define MED_Vector_HeaderFile
 
 #include <vector>
+#include <stdexcept>
 
-#if !defined(__GNUC_2__) && defined(__GNUC__) && (__GNUC__ == 2)
-  #define __GNUC_2__
-#endif
+//#if defined(_DEBUG_)
+#  define MED_TVECTOR_CHECK_RANGE
+//#endif
 
 namespace MED
 {
@@ -52,6 +53,26 @@ namespace MED
     typedef value_type& reference;
     typedef const value_type& const_reference;
 
+  protected:
+    void
+    check_range(size_type __n) const
+    {
+      if (__n >= this->size())
+       throw std::out_of_range("TVector [] access out of range");
+    }
+
+    const_reference
+    get_value(size_type __n) const
+    {
+      return superclass::operator[](__n);
+    }
+
+    reference
+    get_value(size_type __n)
+    {
+      return superclass::operator[](__n);
+    }
+
   public:
     explicit
     TVector(const allocator_type& __a = allocator_type()): 
@@ -101,25 +122,38 @@ namespace MED
     reference
     operator[](size_type __n)
     {
-#if defined(__GNUC_2__)
-      return superclass::operator[](__n);
-#else
-      return this->at(__n);
+#if defined(MED_TVECTOR_CHECK_RANGE)
+      check_range(__n);
 #endif
+      return get_value(__n);
     }
 
     const_reference
     operator[](size_type __n) const
     {
-#if defined(__GNUC_2__)
-      return superclass::operator[](__n);
-#else
-      return this->at(__n);
+#if defined(MED_TVECTOR_CHECK_RANGE)
+      check_range(__n);
 #endif
+      return get_value(__n);
+    }
+
+    reference
+    at(size_type __n)
+    {
+      check_range(__n);
+      return get_value(__n);
+    }
+
+    const_reference
+    at(size_type __n) const
+    {
+      check_range(__n);
+      return get_value(__n);
     }
   };
 
 }
 
+#undef MED_TVECTOR_CHECK_RANGE
 
 #endif
index 5512b30e03ca9eef35743850f93edb30fadcbb04..83917e122414b55148c70fb546bc1556c6c5bc52 100644 (file)
@@ -65,6 +65,6 @@ BIN_SRC =
 
 CPPFLAGS+= $(BOOST_CPPFLAGS) $(HDF5_INCLUDES) -D@MACHINE@ 
 
-LDFLAGS+= $(BOOST_LIBS) -lboost_thread-mt
+LDFLAGS+= $(BOOST_LIBS) -lboost_thread${BOOST_LIBSUFFIX}
 
 @CONCLUDE@
index cec158999365938bc02eb993e7972346923babe0..6f605b1c6eda6359ee2e0aef26b27d7d831eac51 100644 (file)
 #include "MED_V2_1_Wrapper.hxx"
 
 #include <stdio.h>
+#include <strstream>
 
-extern "C"{
+extern "C"
+{
 #include <med.h>
 }
 
@@ -43,13 +45,34 @@ static int MYDEBUG = 0;
 static int MYDEBUG = 0;
 #endif
 
-namespace MED{
+namespace MED
+{
   
-  EVersion GetVersionId(const std::string& theFileName)
+  EVersion GetVersionId(const std::string& theFileName,
+                       bool theDoPreCheckInSeparateProcess)
   {
-    EVersion aVersion = eVUnknown;
+    INITMSG(MYDEBUG,"GetVersionId - theFileName = '"<<theFileName<<"'"<<std::endl);
+    EVersion aVersion = eVUnknown;    
+
+    if(theDoPreCheckInSeparateProcess){
+      // First check, is it possible to deal with the file
+      std::ostringstream aStr;
+      aStr<<"bash -c \""<<getenv("MED_ROOT_DIR")<<"/bin/salome/mprint_version "<<theFileName<<"\"";
+      if(!MYDEBUG)
+       aStr<<" 2>&1 > /dev/null";
+      
+      std::string aCommand = aStr.str();
+      int aStatus = system(aCommand.c_str());
+      
+      BEGMSG(MYDEBUG,"aCommand = '"<<aCommand<<"'; aStatus = "<<aStatus<<std::endl);
+      if(aStatus != 0)
+       return aVersion;
+    }
+
+    // Next, try to open the file trough the MED API
     char* aFileName = const_cast<char*>(theFileName.c_str());
     med_idt aFid = MEDouvrir(aFileName,MED_LECTURE);
+
     MSG(MYDEBUG,"GetVersionId - theFileName = '"<<theFileName<<"'; aFid = "<<aFid<<endl);
     if(aFid >= 0){
       med_int aMajor, aMinor, aRelease;
@@ -62,21 +85,26 @@ namespace MED{
          aVersion = eV2_1;
       }
     }
-    INITMSG(MYDEBUG,"GetVersionId - theFileName = '"<<theFileName<<"'; aVersion = "<<aVersion<<endl);
+    MEDfermer(aFid);
+
+    BEGMSG(MYDEBUG,"GetVersionId - theFileName = '"<<theFileName<<"'; aVersion = "<<aVersion<<std::endl);
     return aVersion;
   }
 
-  PWrapper CrWrapper(const std::string& theFileName)
+  PWrapper CrWrapper(const std::string& theFileName,
+                    bool theDoPreCheckInSeparateProcess)
   {
     PWrapper aWrapper;
-    EVersion aVersion = GetVersionId(theFileName);
+    EVersion aVersion = GetVersionId(theFileName,theDoPreCheckInSeparateProcess);
     switch(aVersion){
     case eV2_2:
       aWrapper.reset(new MED::V2_2::TVWrapper(theFileName));
       break;
     case eV2_1:
-    default:
       aWrapper.reset(new MED::V2_1::TVWrapper(theFileName));
+      break;
+    default:
+      EXCEPTION(runtime_error,"MED::CrWrapper - theFileName = '"<<theFileName<<"'");
     }
     return aWrapper;
   }
index ba2116894ff4b47d204227fb92afc284b9c0c1db..6e31fa502151c07fa458f6ddfebecc8cef19ff1a 100644 (file)
 
 namespace MED{
 
-  EVersion GetVersionId(const std::string& theFileName);
+  EVersion GetVersionId(const std::string& theFileName,
+                       bool theDoPreCheckInSeparateProcess = false);
 
-  PWrapper CrWrapper(const std::string& theFileName);
+  PWrapper CrWrapper(const std::string& theFileName,
+                    bool theDoPreCheckInSeparateProcess = false);
 
   PWrapper CrWrapper(const std::string& theFileName, EVersion theId);
 
index 273a3641f27b8c9cf8d071a6107026a585efb05d..bcbbccf42ac60ad65be449ea219f78ee179e8ac2 100644 (file)
@@ -44,13 +44,13 @@ EXPORT_HEADERS = \
        MED_Factory.hxx
 
 # Executables targets
-BIN = MED_Test
+BIN = MED_Test mprint_version
 BIN_SRC = 
 
 CPPFLAGS+= $(BOOST_CPPFLAGS) $(MED2_INCLUDES)
 
 LDFLAGS+= -lMEDWrapper_V2_2 -lMEDWrapper_V2_1
 
-LDFLAGSFORBIN=$(LDFLAGS) -lMEDWrapperBase $(BOOST_LIBS) -lboost_thread-mt -lmed_V2_1
+LDFLAGSFORBIN=$(LDFLAGS) -lMEDWrapperBase $(BOOST_LIBS) -lboost_thread${BOOST_LIBSUFFIX} -lmed_V2_1
 
 @CONCLUDE@
diff --git a/src/MEDWrapper/Factory/mprint_version.cxx b/src/MEDWrapper/Factory/mprint_version.cxx
new file mode 100644 (file)
index 0000000..242e63a
--- /dev/null
@@ -0,0 +1,41 @@
+// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either 
+// version 2.1 of the License.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/
+//
+
+extern "C"{
+#include <med.h>
+}
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int main (int argc, char **argv)
+{
+  med_idt aFid = MEDouvrir(argv[1],MED_LECTURE);
+  if(aFid < 0)
+    exit(1);
+
+  med_int aMajor, aMinor, aRelease;
+  med_err aRet = MEDversionLire(aFid,&aMajor,&aMinor,&aRelease);
+  MEDfermer(aFid);
+  if(aRet < 0)
+    exit(2);
+
+  printf("%d.%d.%d\n",aMajor,aMinor,aRelease);
+}
index 0b95e764677e69300e1d6d51c7fd7f02e2083818..a83eb6ca9a02b2aeea1e7cb8c41733bad92a0de3 100644 (file)
@@ -840,7 +840,14 @@ namespace MED
          return -1;
       }else if(theEntityInfo.empty()) 
        EXCEPTION(runtime_error,"GetNbTimeStamps - There is no any Entity on the Mesh");
-      
+
+      bool anIsPerformAdditionalCheck = GetNbMeshes() > 1;
+#ifdef _DEBUG_
+      static bool anIsCheckOnlyFirstTimeStamp = false;
+#else
+      static bool anIsCheckOnlyFirstTimeStamp = true;
+#endif
+
       theGeom2Size.clear();
       TInt aNbTimeStamps = 0;
       TIdt anId = myFile->Id();
@@ -859,39 +866,47 @@ namespace MED
                                          &anInfo.myName[0],
                                          anEntity,
                                          aGeom);
-         if(aNbStamps > 0){
+         bool anIsSatisfied = aNbStamps > 0;
+         if(anIsSatisfied){
            INITMSG(MYDEBUG,
                    "GetNbTimeStamps aNbTimeStamps = "<<aNbStamps<<
-                       "; aGeom = "<<aGeom<<"; anEntity = "<<anEntity<<"\n");
-           for(TInt iTimeStamp = 1; iTimeStamp <= aNbStamps; iTimeStamp++){
-             char aMaillageChamp[GetNOMLength<eV2_1>()+1];
-             char aDtUnit[GetPNOMLength<eV2_1>()+1];
-             med_int aNbGauss;
-             med_int aNumDt;
-             med_int aNumOrd;
-             med_float aDt;
-             TErr aRet = MEDpasdetempsInfo(anId,
-                                           &anInfo.myName[0],
-                                           anEntity,
-                                           aGeom,
-                                           iTimeStamp, 
-                                           aMaillageChamp,
-                                           &aNbGauss,
-                                           &aNumDt,  
-                                           aDtUnit, 
-                                           &aDt, 
-                                           &aNumOrd);
-
-             INITMSG(MYDEBUG,
-                     "GetNbTimeStamps aMaillageChamp = '"<<aMaillageChamp<<"'"<<
-                     "; aMeshName = '"<<&aMeshInfo.myName[0]<<"'\n");
-             if(aRet == 0 && (! strcmp(aMaillageChamp,&aMeshInfo.myName[0]))){
-               theGeom2Size[EGeometrieElement(aGeom)] = anGeomIter->second;
-               theEntity = EEntiteMaillage(anEntity);
-               aNbTimeStamps = aNbStamps;
+                   "; aGeom = "<<aGeom<<"; anEntity = "<<anEntity<<"\n");
+           if(anIsPerformAdditionalCheck){
+             TInt iTimeStampEnd = anIsCheckOnlyFirstTimeStamp? 1: aNbStamps;
+             for(TInt iTimeStamp = 1; iTimeStamp <= iTimeStampEnd; iTimeStamp++){
+               TVector<char> aMeshName(GetNOMLength<eV2_1>()+1);
+               TVector<char> aDtUnit(GetPNOMLength<eV2_1>()+1);
+               med_int aNbGauss;
+               med_int aNumDt;
+               med_int aNumOrd;
+               med_float aDt;
+               TErr aRet = MEDpasdetempsInfo(anId,
+                                             &anInfo.myName[0],
+                                             anEntity,
+                                             aGeom,
+                                             iTimeStamp, 
+                                             &aMeshName[0],
+                                             &aNbGauss,
+                                             &aNumDt,  
+                                             &aDtUnit[0],
+                                             &aDt, 
+                                             &aNumOrd);
+               
+               anIsSatisfied = (aRet == 0 && (!strcmp(&aMeshName[0],&aMeshInfo.myName[0])));
+               if(!anIsSatisfied){
+                 INITMSG(MYDEBUG,
+                         "GetNbTimeStamps aMeshName = '"<<&aMeshName[0]<<"' != "<<
+                         "; aMeshInfo.myName = '"<<&aMeshInfo.myName[0]<<"'\n");
+                 break;
+               }
              }
            }
          }
+         if(anIsSatisfied){
+           theGeom2Size[EGeometrieElement(aGeom)] = anGeomIter->second;
+           theEntity = EEntiteMaillage(anEntity);
+           aNbTimeStamps = aNbStamps;
+         }
        }
        if(!theGeom2Size.empty()) 
          break;
@@ -932,7 +947,7 @@ namespace MED
        aRet = MEDpasdetempsInfo(myFile->Id(),
                                 &aFieldInfo.myName[0],
                                 med_entite_maillage(theInfo.myEntity),
-                                med_geometrie_element(anIter->first),
+                                med_geometrie_element(aGeom),
                                 theTimeStampId,
                                 &aMeshInfo.myName[0],
                                 &aNbGauss,
index d01a450ae555785d8e4cd490119a64fe05332d31..853d612080b8d7a7ec2523480c580e4b046e7099 100644 (file)
@@ -1410,6 +1410,13 @@ namespace MED
       }else if(theEntityInfo.empty()) 
        EXCEPTION(runtime_error,"GetNbTimeStamps - There is no any Entity on the Mesh");
       
+      bool anIsPerformAdditionalCheck = GetNbMeshes() > 1;
+#ifdef _DEBUG_
+      static bool anIsCheckOnlyFirstTimeStamp = false;
+#else
+      static bool anIsCheckOnlyFirstTimeStamp = true;
+#endif
+
       theGeom2Size.clear();
       TInt aNbTimeStamps = 0;
       TIdt anId = myFile->Id();
@@ -1428,42 +1435,51 @@ namespace MED
                                          &anInfo.myName[0],
                                          anEntity,
                                          aGeom);
-         if(aNbStamps > 0){
+         bool anIsSatisfied = aNbStamps > 0;
+         if(anIsSatisfied){
            INITMSG(MYDEBUG,
                    "GetNbTimeStamps aNbTimeStamps = "<<aNbStamps<<
-                       "; aGeom = "<<aGeom<<"; anEntity = "<<anEntity<<"\n");
-           for(TInt iTimeStamp = 1; iTimeStamp <= aNbStamps; iTimeStamp++){
-             char aMaillageChamp[GetNOMLength<eV2_2>()+1];
-             char aDtUnit[GetPNOMLength<eV2_2>()+1];
-             med_int aNbGauss;
-             med_int aNumDt;
-             med_int aNumOrd;
-             med_float aDt;
-             med_booleen anIsLocal;
-             med_int aNbRef;
-             TErr aRet = MEDpasdetempsInfo(anId,
-                                           &anInfo.myName[0],
-                                           anEntity,
-                                           aGeom,
-                                           iTimeStamp, 
-                                           &aNbGauss,
-                                           &aNumDt,  
-                                           &aNumOrd,
-                                           aDtUnit, 
-                                           &aDt, 
-                                           aMaillageChamp,
-                                           &anIsLocal,
-                                           &aNbRef);
-             INITMSG(MYDEBUG,
-                     "GetNbTimeStamps aMaillageChamp = '"<<aMaillageChamp<<"'"<<
-                     "; aMeshName = '"<<&aMeshInfo.myName[0]<<"'\n");
-             if(aRet == 0 && (! strcmp(aMaillageChamp,&aMeshInfo.myName[0]))){
-               theGeom2Size[EGeometrieElement(aGeom)] = anGeomIter->second;
-               theEntity = EEntiteMaillage(anEntity);
-               aNbTimeStamps = aNbStamps;
+                   "; aGeom = "<<aGeom<<"; anEntity = "<<anEntity<<"\n");
+           if(anIsPerformAdditionalCheck){
+             TInt iTimeStampEnd = anIsCheckOnlyFirstTimeStamp? 1: aNbStamps;
+             for(TInt iTimeStamp = 1; iTimeStamp <= iTimeStampEnd; iTimeStamp++){
+               TVector<char> aMeshName(GetNOMLength<eV2_2>()+1);
+               TVector<char> aDtUnit(GetPNOMLength<eV2_2>()+1);
+               med_int aNbGauss;
+               med_int aNumDt;
+               med_int aNumOrd;
+               med_float aDt;
+               med_booleen anIsLocal;
+               med_int aNbRef;
+               TErr aRet = MEDpasdetempsInfo(anId,
+                                             &anInfo.myName[0],
+                                             anEntity,
+                                             aGeom,
+                                             iTimeStamp, 
+                                             &aNbGauss,
+                                             &aNumDt,  
+                                             &aNumOrd,
+                                             &aDtUnit[0],
+                                             &aDt, 
+                                             &aMeshName[0],
+                                             &anIsLocal,
+                                             &aNbRef);
+
+               anIsSatisfied = (aRet == 0 && (!strcmp(&aMeshName[0],&aMeshInfo.myName[0])));
+               if(!anIsSatisfied){
+                 INITMSG(MYDEBUG,
+                         "GetNbTimeStamps aMeshName = '"<<&aMeshName[0]<<"' != "<<
+                         "; aMeshInfo.myName = '"<<&aMeshInfo.myName[0]<<"'\n");
+                 break;
+               }
              }
            }
          }
+         if(anIsSatisfied){
+           theGeom2Size[EGeometrieElement(aGeom)] = anGeomIter->second;
+           theEntity = EEntiteMaillage(anEntity);
+           aNbTimeStamps = aNbStamps;
+         }
        }
        if(!theGeom2Size.empty()) 
          break;
@@ -1504,7 +1520,7 @@ namespace MED
        aRet = MEDpasdetempsInfo(myFile->Id(),
                                 &aFieldInfo.myName[0],
                                 med_entite_maillage(theInfo.myEntity),
-                                med_geometrie_element(anIter->first),
+                                med_geometrie_element(aGeom),
                                 theTimeStampId,
                                 &aNbGauss,
                                 (med_int*)&theInfo.myNumDt,