From c0b04821ce5af5b468e6db1f9cbf4dc3d912b725 Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 13 Mar 2006 14:44:14 +0000 Subject: [PATCH] Join modifications from branch OCC_development_for_3_2_0a2 --- Makefile.in | 2 + adm_local/Makefile.in | 41 ++++++ adm_local/unix/make_commence.in | 18 ++- .../unix/config_files/check_boost.m4 | 118 ++++++++++++++---- build_configure | 17 ++- configure.in.base | 20 +++ src/INTERPOLATION/MEDMEM_Mapping.hxx | 28 +++-- src/INTERPOLATION/MEDMEM_MappingTools.hxx | 7 +- src/MEDMEM/MEDMEM_Connectivity.cxx | 8 +- src/MEDMEM/MEDMEM_Field.hxx | 29 ++++- src/MEDMEM/MEDMEM_MedMedDriver22.cxx | 8 +- src/MEDMEM/MEDMEM_medimport_src.cxx | 59 ++++++++- src/MEDWrapper/Base/MED_SliceArray.hxx | 56 +++++++-- src/MEDWrapper/Base/MED_Vector.hxx | 56 +++++++-- src/MEDWrapper/Base/Makefile.in | 2 +- src/MEDWrapper/Factory/MED_Factory.cxx | 44 +++++-- src/MEDWrapper/Factory/MED_Factory.hxx | 6 +- src/MEDWrapper/Factory/Makefile.in | 4 +- src/MEDWrapper/Factory/mprint_version.cxx | 41 ++++++ .../V2_1/Wrapper/MED_V2_1_Wrapper.cxx | 75 ++++++----- src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx | 80 +++++++----- 21 files changed, 556 insertions(+), 163 deletions(-) create mode 100644 adm_local/Makefile.in create mode 100644 src/MEDWrapper/Factory/mprint_version.cxx diff --git a/Makefile.in b/Makefile.in index 7ddc521bf..9e82a9312 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 index 000000000..9b5e810db --- /dev/null +++ b/adm_local/Makefile.in @@ -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: + diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in index 292633657..9f3ba60b5 100644 --- a/adm_local/unix/make_commence.in +++ b/adm_local/unix/make_commence.in @@ -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 + diff --git a/adm_local_without_kernel/unix/config_files/check_boost.m4 b/adm_local_without_kernel/unix/config_files/check_boost.m4 index c77edba5d..12cd2a864 100644 --- a/adm_local_without_kernel/unix/config_files/check_boost.m4 +++ b/adm_local_without_kernel/unix/config_files/check_boost.m4 @@ -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(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 ], + [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 ], + [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 diff --git a/build_configure b/build_configure index 060da7451..8a0bacbd2 100755 --- a/build_configure +++ b/build_configure @@ -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" diff --git a/configure.in.base b/configure.in.base index 632529721..4780640eb 100644 --- a/configure.in.base +++ b/configure.in.base @@ -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 diff --git a/src/INTERPOLATION/MEDMEM_Mapping.hxx b/src/INTERPOLATION/MEDMEM_Mapping.hxx index 664a67822..99710f931 100644 --- a/src/INTERPOLATION/MEDMEM_Mapping.hxx +++ b/src/INTERPOLATION/MEDMEM_Mapping.hxx @@ -60,11 +60,11 @@ protected : vector 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 * 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;iDONNE_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 _COORDBARY_2D_::Calcule_Base_Coord_Baryc(const vec _TEMPLATE_SPE_ vector _COORDBARY_2D_::Calcule_Coord_Baryc(int num_maille, const NOEUD & M) { int i,j; - vector coord_baryc_M(3,0); - for (i=0;i<3;i++) + // for PAL11458 + //vector coord_baryc_M(3,0); + int nbr_faces=coord_baryc[num_maille].size(); + vector coord_baryc_M(nbr_faces,0); + for (i=0;i_count[2]=NumberOfConstituent+1; // we correct _descending to adjust face number for(int j=0;jtmp_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; diff --git a/src/MEDMEM/MEDMEM_Field.hxx b/src/MEDMEM/MEDMEM_Field.hxx index 758310753..7fa8bf9b7 100644 --- a/src/MEDMEM/MEDMEM_Field.hxx +++ b/src/MEDMEM/MEDMEM_Field.hxx @@ -61,7 +61,7 @@ namespace MEDMEM { template < > struct SET_VALUE_TYPE { static const MED_EN::med_type_champ _valueType = MED_EN::MED_INT32; }; -class FIELD_ // GENERIC POINTER TO a template class FIELD +class MEDMEM_EXPORT FIELD_ // GENERIC POINTER TO a template class FIELD { protected: @@ -841,7 +841,7 @@ FIELD::FIELD():FIELD_() template FIELD::FIELD(const SUPPORT * Support, const int NumberOfComponents) throw (MEDEXCEPTION) : - FIELD_(Support, NumberOfComponents),_value() + FIELD_(Support, NumberOfComponents),_value(NULL) { BEGIN_OF("FIELD::FIELD(const SUPPORT * Support, const int NumberOfComponents)"); SCRUTE(this); @@ -858,7 +858,11 @@ FIELD::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 ! ("<::FIELD(const SUPPORT * Support, //A.G. Addings for RC if(_support) _support->addReference(); - _value = (MEDMEM_Array *) 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 *) NULL; + _value = NULL; _iterationNumber = iterationNumber; _time = 0.0; @@ -1971,7 +1980,12 @@ FIELD::FIELD(driverTypes driverType, FIELD_::_interlacingType=SET_INTERLACING_TYPE::_interlacingType; _support = (SUPPORT *) NULL; - _value = (MEDMEM_Array *)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 *) NULL; + _value = NULL; _iterationNumber = iterationNumber; _time = 0.0; @@ -2037,7 +2051,12 @@ void FIELD::allocValue(const int NumberOfComponents) } catch (MEDEXCEPTION &ex) { MESSAGE("No value defined, problem with NumberOfComponents (and may be _support) size of MEDARRAY::_value !"); - _value = (MEDMEM_Array *)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 *) NULL; + _value = NULL; } SCRUTE(_value); diff --git a/src/MEDMEM/MEDMEM_MedMedDriver22.cxx b/src/MEDMEM/MEDMEM_MedMedDriver22.cxx index 23c60b8fb..428ba8cdd 100644 --- a/src/MEDMEM/MEDMEM_MedMedDriver22.cxx +++ b/src/MEDMEM/MEDMEM_MedMedDriver22.cxx @@ -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 = "< #include +//#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 diff --git a/src/MEDWrapper/Base/MED_Vector.hxx b/src/MEDWrapper/Base/MED_Vector.hxx index b048d4fae..a2c64758f 100644 --- a/src/MEDWrapper/Base/MED_Vector.hxx +++ b/src/MEDWrapper/Base/MED_Vector.hxx @@ -30,10 +30,11 @@ #define MED_Vector_HeaderFile #include +#include -#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 diff --git a/src/MEDWrapper/Base/Makefile.in b/src/MEDWrapper/Base/Makefile.in index 5512b30e0..83917e122 100644 --- a/src/MEDWrapper/Base/Makefile.in +++ b/src/MEDWrapper/Base/Makefile.in @@ -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@ diff --git a/src/MEDWrapper/Factory/MED_Factory.cxx b/src/MEDWrapper/Factory/MED_Factory.cxx index cec158999..6f605b1c6 100644 --- a/src/MEDWrapper/Factory/MED_Factory.cxx +++ b/src/MEDWrapper/Factory/MED_Factory.cxx @@ -32,8 +32,10 @@ #include "MED_V2_1_Wrapper.hxx" #include +#include -extern "C"{ +extern "C" +{ #include } @@ -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 = '"<&1 > /dev/null"; + + std::string aCommand = aStr.str(); + int aStatus = system(aCommand.c_str()); + + BEGMSG(MYDEBUG,"aCommand = '"< +} + +#include +#include + +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); +} diff --git a/src/MEDWrapper/V2_1/Wrapper/MED_V2_1_Wrapper.cxx b/src/MEDWrapper/V2_1/Wrapper/MED_V2_1_Wrapper.cxx index 0b95e7646..a83eb6ca9 100644 --- a/src/MEDWrapper/V2_1/Wrapper/MED_V2_1_Wrapper.cxx +++ b/src/MEDWrapper/V2_1/Wrapper/MED_V2_1_Wrapper.cxx @@ -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 = "<()+1]; - char aDtUnit[GetPNOMLength()+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 = '"<second; - theEntity = EEntiteMaillage(anEntity); - aNbTimeStamps = aNbStamps; + "; aGeom = "< aMeshName(GetNOMLength()+1); + TVector aDtUnit(GetPNOMLength()+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, diff --git a/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx b/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx index d01a450ae..853d61208 100644 --- a/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx +++ b/src/MEDWrapper/V2_2/MED_V2_2_Wrapper.cxx @@ -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 = "<()+1]; - char aDtUnit[GetPNOMLength()+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 = '"<second; - theEntity = EEntiteMaillage(anEntity); - aNbTimeStamps = aNbStamps; + "; aGeom = "< aMeshName(GetNOMLength()+1); + TVector aDtUnit(GetPNOMLength()+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, -- 2.39.2