SUBDIRS+= doc
endif
+SUBDIRS+= adm_local
+
RESOURCES_FILES = \
MEDCatalog.xml \
MED_en.xml \
--- /dev/null
+# 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:
+
# BOOST Library
BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_LIBSUFFIX = @BOOST_LIBSUFFIX@
BOOST_LIBS = @BOOST_LIBS@
# JAVA
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
+
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
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
########################################################################
case $1 in
*/CVS) return ;;
+ */adm_local/*) return ;;
*) ;;
esac
# _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
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"
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
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);
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)
{
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;
}
_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];
_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;
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:
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);
// 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);
//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;
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;
}
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);
MESSAGE("Field information 2 : NumberOfTimeStep :"<<
numberOfTimeSteps);
-
+/*
if ( numberOfTimeSteps > MED_VALID )
break ;
// There are value for some med_geometrie_element of this
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);
*
*************************************************************************/
#include "MEDMEM_medimport_src.hxx"
+#include "hdf5_version2api.hxx"
using namespace med_2_2;
using namespace MEDMEM;
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;
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 :
}
}
- 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 :
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;
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 */
}
}
+#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;
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*/
}
}
+#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;
#include <valarray>
#include <stdexcept>
+//#if defined(_DEBUG_)
+# define MED_TCSLICE_CHECK_RANGE
+//#endif
+
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;
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
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
#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
{
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()):
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
CPPFLAGS+= $(BOOST_CPPFLAGS) $(HDF5_INCLUDES) -D@MACHINE@
-LDFLAGS+= $(BOOST_LIBS) -lboost_thread-mt
+LDFLAGS+= $(BOOST_LIBS) -lboost_thread${BOOST_LIBSUFFIX}
@CONCLUDE@
#include "MED_V2_1_Wrapper.hxx"
#include <stdio.h>
+#include <strstream>
-extern "C"{
+extern "C"
+{
#include <med.h>
}
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;
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;
}
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);
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@
--- /dev/null
+// 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);
+}
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();
&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;
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,
}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();
&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;
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,