From: nadir Date: Fri, 4 Feb 2005 16:34:29 +0000 (+0000) Subject: Final version of the V2_2_0 in the main trunk of the CVS tree. X-Git-Tag: V2_2_0b2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bde6f0f312feacdf571dab7a332937eb8d5b8f24;p=modules%2Fmed.git Final version of the V2_2_0 in the main trunk of the CVS tree. --- diff --git a/Makefile.in b/Makefile.in index 269e8a520..f5530ea70 100644 --- a/Makefile.in +++ b/Makefile.in @@ -14,7 +14,12 @@ VPATH=.:@srcdir@:@top_srcdir@/bin:@top_srcdir@/resources:./bin:@top_srcdir@/idl: @COMMENCE@ -SUBDIRS = idl src doc +ifeq (@WITHIHM@,no) + SUBDIRS = idl src +endif +ifeq (@WITHIHM@,yes) + SUBDIRS = idl src doc +endif RESOURCES_FILES = \ MEDCatalog.xml \ @@ -34,6 +39,8 @@ mesh.med \ pointe.med \ test19.med \ zzzz121b.med \ +Mistrat.med \ +TimeStamps.med \ Darcy3_3D_H_10x10x10.sauve \ dx200_dy1_avec_2couches.sauve \ elle_2D_QT_10x10.sauve \ @@ -81,6 +88,8 @@ titi.xyz BIN_SCRIPT= \ VERSION +LDFLAGS= -L$(top_builddir)/lib/salome +LDFLAGSFORBIN= -L$(top_builddir)/lib/salome # copy header files in common directory ifeq ($(HAVE_SSTREAM),yes) @@ -123,18 +132,20 @@ install-end: install-include: $(include_list) $(INSTALL) -d $(includedir) - @for f in X $(include_list); do \ - if test $$f != X; then \ - ($(INSTALL_DATA) -p $$f $(includedir)/. || exit 1); \ - fi; \ +# @for f in X $(include_list); do \ +# if test $$f != X; then \ +# (cp -p $$f $(includedir) || exit 1); \ +# fi; \ done # install script in $(bindir) : install-bin: $(BIN_SCRIPT) $(INSTALL) -d $(bindir) - if test $(BIN_SCRIPT)X != X; then \ - $(INSTALL_PROGRAM) $^ $(bindir); \ - fi + for f in X $(BIN_SCRIPT); do \ + if test $$f != X; then \ + (cp -p ./bin/salome/$$f $(bindir) || exit 1); \ + fi; \ + done uninstall: uninstall-idl diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in index 094bb4f36..7ba97d68f 100644 --- a/adm_local/unix/make_commence.in +++ b/adm_local/unix/make_commence.in @@ -2,7 +2,7 @@ inc_builddir=$(top_builddir)/include/salome @SET_MAKE@ -SHELL=/bin/sh +SHELL=@SHELL@ # header missing @@ -11,11 +11,11 @@ HAVE_SSTREAM=@HAVE_SSTREAM@ LIBS=@LIBS@ LIBSFORBIN=@LIBS@ -LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker -L$(top_builddir)/lib/salome -LDFLAGSFORBIN=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker -L$(top_builddir)/lib/salome +LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome +LDFLAGSFORBIN=@LDFLAGS@ -L$(top_builddir)/lib/salome # add libstdc++ to link c++ library with libtool ! -LDFLAGS+= -lstdc++ -LDFLAGSFORBIN+= -lstdc++ +LDFLAGS+= @STDLIB@ +LDFLAGSFORBIN+= @STDLIB@ CP=@CP@ diff --git a/adm_local/unix/make_conclude.in b/adm_local/unix/make_conclude.in index 9eac1df82..cce2f06a4 100644 --- a/adm_local/unix/make_conclude.in +++ b/adm_local/unix/make_conclude.in @@ -58,7 +58,7 @@ $(LIB_BUILD): $(top_builddir)/lib/salome/%.la: %.la ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<).0 \ $(patsubst %.la, %.so, $@).0 || true - if ! test -z $(LIB_SWIG) ; then \ + if test "X$(LIB_SWIG)" != X; then \ ln -sf $(patsubst %.la,%.so, $(CURDIR)/.libs/$<) $(top_builddir)/lib/salome/_$(LIB_SWIG) || true;\ fi; @@ -144,7 +144,7 @@ install: $(LIB) $(BIN) $(TEST_PROGS) $(libdir) $(includedir) $(bindir) $(datadir ($(LT_INSTALL_LIB) $$f $(libdir)/. || exit 1); \ fi; \ done - @if ! test -z $(LIB_SWIG) ; then \ + @if test "X$(LIB_SWIG)" != X ; then \ (cd $(libdir); ln -sf $(patsubst %.so, %cmodule.so, $(LIB_SWIG)) _$(LIB_SWIG) || true); \ fi; @for f in X $(BIN); do \ diff --git a/build_configure b/build_configure index 6ae0a342f..f2fc04136 100755 --- a/build_configure +++ b/build_configure @@ -42,8 +42,8 @@ fi find_in() { - local i - local f=$2 + i=0 + f=$2 # if the first argument is not a directory, returns @@ -93,9 +93,11 @@ ABS_CONF_DIR=`pwd` # Common part of the configure.in file # chmod u+w configure.in.base -if ! \cp -f configure.in.base configure.in_tmp1 +if \cp -f configure.in.base configure.in_tmp1 then echo +else + echo echo "error : can't create files in" ${CONF_DIR} echo "aborting ..." chmod u-w configure.in.base @@ -178,9 +180,11 @@ then fi else echo -n "Updating 'configure.in' file ... " - if ! \cp configure.in configure.in_old >& /dev/null + if \cp configure.in configure.in_old >& /dev/null then echo + else + echo echo echo "Can't backup previous configure.in" echo -n "Continue (you will not be able to revert) - (Y/N) ? " diff --git a/configure.in.base b/configure.in.base index 73e9b8cc7..b61554a42 100644 --- a/configure.in.base +++ b/configure.in.base @@ -44,6 +44,10 @@ echo Build root directory : $ROOT_BUILDDIR echo echo +dnl Modification B. Secher portage sur osf CCRT +AC_CHECK_PROG(SHELL,sh,,) +AC_SUBST(SHELL) + if test -z "$AR"; then AC_CHECK_PROGS(AR,ar xar,:,$PATH) fi @@ -82,7 +86,7 @@ dnl Fix up the INSTALL macro if it s a relative path. We want the dnl full-path to the binary instead. case "$INSTALL" in *install-sh*) - INSTALL='\${KERNEL_ROOT_DIR}'/salome_adm/unix/config_files/install-sh + INSTALL="\${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/install-sh -c" ;; esac @@ -96,6 +100,8 @@ cc_ok=no dnl inutil car libtool dnl AC_PROG_CC AC_PROG_CXX +AC_CXX_WARNINGS +AC_CXX_TEMPLATE_OPTIONS AC_DEPEND_FLAG # AC_CC_WARNINGS([ansi]) cc_ok=yes @@ -106,6 +112,16 @@ AC_CHECK_LIB(dl,dlopen) dnl add library libm : AC_CHECK_LIB(m,ceil) +dnl Library librt : for alpha/osf +AC_CHECK_LIB(rt,nanosleep) + +dnl +dnl Check if we use std iostream by default or if we must add +dnl a compiler directive for that +dnl + +AC_CXX_USE_STD_IOSTREAM + dnl dnl Well we use sstream which is not in gcc pre-2.95.3 dnl We must test if it exists. If not, add it in include ! @@ -113,14 +129,31 @@ dnl AC_CXX_HAVE_SSTREAM +dnl +dnl --------------------------------------------- +dnl testing linker +dnl --------------------------------------------- +dnl + +AC_LINKER_OPTIONS + dnl dnl --------------------------------------------- dnl testing MPICH dnl --------------------------------------------- dnl +CHECK_MPI CHECK_MPICH +dnl +dnl --------------------------------------------- +dnl testing WITHIHM +dnl --------------------------------------------- +dnl + +CHECK_WITHIHM + echo echo --------------------------------------------- echo testing LEX \& YACC @@ -299,7 +332,8 @@ do # if test ! -d $rep ; then # eval mkdir $rep # fi - $INSTALL -d $rep +# $INSTALL -d $rep + mkdir -p $rep done echo @@ -336,7 +370,7 @@ do case "$local_bin" in *.in | *~) ;; ./bin/CVS | ./bin/salome) ;; - *) /usr/bin/install -C $i .; echo $local_bin ;; + *) ln -fs $i .; echo $local_bin ;; esac done cd $ROOT_BUILDDIR diff --git a/resources/Mistrat.med b/resources/Mistrat.med new file mode 100644 index 000000000..a72c0999f Binary files /dev/null and b/resources/Mistrat.med differ diff --git a/resources/TimeStamps.med b/resources/TimeStamps.med new file mode 100644 index 000000000..3df2aebcb Binary files /dev/null and b/resources/TimeStamps.med differ diff --git a/src/INTERPOLATION/MEDMEM_Interpolation.hxx b/src/INTERPOLATION/MEDMEM_Interpolation.hxx index d9aea1d85..473bc4e90 100644 --- a/src/INTERPOLATION/MEDMEM_Interpolation.hxx +++ b/src/INTERPOLATION/MEDMEM_Interpolation.hxx @@ -166,14 +166,14 @@ template INTERPOLATION::INTERPOLATION(const FIELD(_fromMesh->getNumberOfNodes(), - const_cast (_fromMesh->getCoordinates(MED_FULL_INTERLACE)), - const_cast (_fromMesh->getConnectivityptr()), - const_cast *>(_fromField) + const_cast (_fromMesh->getCoordinates(MED_EN::MED_FULL_INTERLACE)), + const_cast (_fromMesh->getConnectivityptr()), + const_cast *>(_fromField) ); _toWrapper = new Meta_Wrapper(_toMesh->getNumberOfNodes(), - const_cast (_toMesh->getCoordinates(MED_FULL_INTERLACE)) + const_cast (_toMesh->getCoordinates(MED_EN::MED_FULL_INTERLACE)) ); @@ -302,12 +302,12 @@ template FIELD * INTERPOLATION::interpolate(i _toField->setOrderNumber ( _fromField->getOrderNumber() ); _toField->setValueType ( MED_EN::MED_REEL64 ); - SUPPORT * mySupport(new SUPPORT(_toMesh,"support",MED_NODE)); + SUPPORT * mySupport(new SUPPORT(_toMesh,"support",MED_EN::MED_NODE)); _toField->setSupport(mySupport); _toField->allocValue(_toField->getNumberOfComponents(),_toField->getNumberOfValues()); - _toField->setValue(MED_FULL_INTERLACE,resultat.Get_Valeurs()); + _toField->setValue( MED_EN::MED_FULL_INTERLACE,resultat.Get_Valeurs()); _toWrapper->Construit_Wrapper_Champ(_toField); @@ -349,9 +349,9 @@ template FIELD * INTERPOLATION::interpolateNe _fromMesh = _fromField->getSupport()->getMesh(); _fromWrapper = new Meta_Wrapper(_fromMesh->getNumberOfNodes(), - const_cast (_fromMesh->getCoordinates(MED_FULL_INTERLACE)), - const_cast (_fromMesh->getConnectivityptr()), - const_cast *>(_fromField) + const_cast (_fromMesh->getCoordinates(MED_EN::MED_FULL_INTERLACE)), + const_cast (_fromMesh->getConnectivityptr()), + const_cast *>(_fromField) ); _mapping = new Meta_Mapping (_fromWrapper); @@ -363,8 +363,8 @@ template FIELD * INTERPOLATION::interpolateNe flagNewMapping=0; - _fromField = const_cast *>(&nextFromField); - _fromWrapper->Change_Champ(const_cast *>(_fromField)); + _fromField = const_cast *>(&nextFromField); + _fromWrapper->Change_Champ(const_cast *>(_fromField)); } return interpolate(_iType,_isConvexFromMesh); diff --git a/src/INTERPOLATION/MEDMEM_InterpolationHighLevelObjects.hxx b/src/INTERPOLATION/MEDMEM_InterpolationHighLevelObjects.hxx index 6a50ea4fc..92655d64c 100644 --- a/src/INTERPOLATION/MEDMEM_InterpolationHighLevelObjects.hxx +++ b/src/INTERPOLATION/MEDMEM_InterpolationHighLevelObjects.hxx @@ -53,7 +53,7 @@ class Meta_Nuage_Maille : public Wrapper_Nuage_Maille protected : Wrapper_Med_Connectivity * connectivite_med; public : - Meta_Nuage_Maille(CONNECTIVITY * connmed); + Meta_Nuage_Maille(MEDMEM::CONNECTIVITY * connmed); Meta_Nuage_Maille():connectivite_med(NULL) {} ~Meta_Nuage_Maille() {if (connectivite_med) delete connectivite_med;} }; @@ -106,20 +106,20 @@ public : Meta_Wrapper():noeuds(NULL),mailles(NULL),maillage(NULL),champ(NULL){} ~Meta_Wrapper(); inline void Construit_Wrapper_Nuage_Noeud ( int nn, double * nodes ); - inline void Construit_Wrapper_Nuage_Maille ( CONNECTIVITY * connmed ); + inline void Construit_Wrapper_Nuage_Maille ( MEDMEM::CONNECTIVITY * connmed ); inline void Construit_Wrapper_Maillage ( void ); - inline void Construit_Wrapper_Champ ( const FIELD * medfield ); - Meta_Wrapper(int nn,double *nodes,CONNECTIVITY *connmed, int flag_maillage=1); + inline void Construit_Wrapper_Champ ( const MEDMEM::FIELD * medfield ); + Meta_Wrapper(int nn,double *nodes,MEDMEM::CONNECTIVITY *connmed, int flag_maillage=1); Meta_Wrapper(int nn,double *nodes); // defaultly, the connectivity (neighbouhood and so like) is built, // Set flag_mesh to 0 if you don't want these informations to be built - Meta_Wrapper(int nn,double *nodes,CONNECTIVITY *connmed, const FIELD * c,int flag_mesh=1); + Meta_Wrapper(int nn,double *nodes,MEDMEM::CONNECTIVITY *connmed, const MEDMEM::FIELD * c,int flag_mesh=1); // fonctions d'acces sures inline Wrapper_Nuage_Noeud * Get_Nuage_Noeuds ( void ); inline Meta_Nuage_Maille * Get_Nuage_Mailles ( void ); inline Meta_Maillage * Get_Maillage ( void ); inline Wrapper_MED_Field * Get_Champ ( void ); - inline void Change_Champ ( const FIELD * medfield ); + inline void Change_Champ ( const MEDMEM::FIELD * medfield ); }; /*********************************************************/ @@ -159,18 +159,18 @@ public : mailles=nm; - fonctions[MED_TRIA3 ]=new Calcul_Interpolation_Tria3 ,Wrapper_Nuage_Noeud,Wrapper_Noeud,Meta_Nuage_Maille>(nn,nm,c); - fonctions[MED_QUAD4 ]=new Calcul_Interpolation_Quad4 ,Wrapper_Nuage_Noeud,Wrapper_Noeud,Meta_Nuage_Maille>(nn,nm,c); - fonctions[MED_TETRA4 ]=new Calcul_Interpolation_Tetra4 ,Wrapper_Nuage_Noeud,Wrapper_Noeud,Meta_Nuage_Maille>(nn,nm,c); - fonctions[MED_HEXA8 ]=new Calcul_Interpolation_Hexa8 ,Wrapper_Nuage_Noeud,Wrapper_Noeud,Meta_Nuage_Maille>(nn,nm,c); - fonctions[MED_PENTA6 ]=new Calcul_Interpolation_Penta6 ,Wrapper_Nuage_Noeud,Wrapper_Noeud,Meta_Nuage_Maille>(nn,nm,c); - fonctions[MED_PYRA5 ]=new Calcul_Interpolation_Pyra5 ,Wrapper_Nuage_Noeud,Wrapper_Noeud,Meta_Nuage_Maille>(nn,nm,c); - fonctions[MED_TRIA6 ]=fonctions[MED_TRIA3 ]; - fonctions[MED_QUAD8 ]=fonctions[MED_QUAD4 ]; - fonctions[MED_TETRA10]=fonctions[MED_TETRA4 ]; - fonctions[MED_HEXA20 ]=fonctions[MED_HEXA8 ]; - fonctions[MED_PENTA15]=fonctions[MED_PENTA6 ]; - fonctions[MED_PYRA13 ]=fonctions[MED_PYRA5 ]; + fonctions[ MED_EN::MED_TRIA3 ]=new Calcul_Interpolation_Tria3 ,Wrapper_Nuage_Noeud,Wrapper_Noeud,Meta_Nuage_Maille>(nn,nm,c); + fonctions[ MED_EN::MED_QUAD4 ]=new Calcul_Interpolation_Quad4 ,Wrapper_Nuage_Noeud,Wrapper_Noeud,Meta_Nuage_Maille>(nn,nm,c); + fonctions[ MED_EN::MED_TETRA4 ]=new Calcul_Interpolation_Tetra4 ,Wrapper_Nuage_Noeud,Wrapper_Noeud,Meta_Nuage_Maille>(nn,nm,c); + fonctions[ MED_EN::MED_HEXA8 ]=new Calcul_Interpolation_Hexa8 ,Wrapper_Nuage_Noeud,Wrapper_Noeud,Meta_Nuage_Maille>(nn,nm,c); + fonctions[ MED_EN::MED_PENTA6 ]=new Calcul_Interpolation_Penta6 ,Wrapper_Nuage_Noeud,Wrapper_Noeud,Meta_Nuage_Maille>(nn,nm,c); + fonctions[ MED_EN::MED_PYRA5 ]=new Calcul_Interpolation_Pyra5 ,Wrapper_Nuage_Noeud,Wrapper_Noeud,Meta_Nuage_Maille>(nn,nm,c); + fonctions[ MED_EN::MED_TRIA6 ]=fonctions[ MED_EN::MED_TRIA3 ]; + fonctions[ MED_EN::MED_QUAD8 ]=fonctions[ MED_EN::MED_QUAD4 ]; + fonctions[ MED_EN::MED_TETRA10]=fonctions[ MED_EN::MED_TETRA4 ]; + fonctions[ MED_EN::MED_HEXA20 ]=fonctions[ MED_EN::MED_HEXA8 ]; + fonctions[ MED_EN::MED_PENTA15]=fonctions[ MED_EN::MED_PENTA6 ]; + fonctions[ MED_EN::MED_PYRA13 ]=fonctions[ MED_EN::MED_PYRA5 ]; } Valeur operator() (Wrapper_Noeud & node, int num_maille){return Calcul_Hybride,Wrapper_Nuage_Noeud,Wrapper_Noeud,Meta_Nuage_Maille>::operator()(node,num_maille);} Valeur operator() (double * node, int num_maille) @@ -305,7 +305,7 @@ template inline int Meta_dTree::trouve_plus_proche_po /* */ /*********************************************************/ -inline Meta_Nuage_Maille::Meta_Nuage_Maille(CONNECTIVITY * conmed):Wrapper_Nuage_Maille(connectivite_med=new Wrapper_Med_Connectivity(conmed)) +inline Meta_Nuage_Maille::Meta_Nuage_Maille(MEDMEM::CONNECTIVITY * conmed):Wrapper_Nuage_Maille(connectivite_med=new Wrapper_Med_Connectivity(conmed)) { } @@ -347,7 +347,7 @@ template inline void Meta_Wrapper::Construit_Wrapper exit(-1); } } -template inline void Meta_Wrapper::Construit_Wrapper_Nuage_Maille ( CONNECTIVITY * connmed ) +template inline void Meta_Wrapper::Construit_Wrapper_Nuage_Maille ( MEDMEM::CONNECTIVITY * connmed ) { if (connmed) mailles=new Meta_Nuage_Maille(connmed); else @@ -370,7 +370,7 @@ template inline void Meta_Wrapper::Construit_Wrapper } maillage=new Meta_Maillage(mailles,noeuds->SIZE()); } -template inline void Meta_Wrapper::Construit_Wrapper_Champ ( const FIELD * medfield ) +template inline void Meta_Wrapper::Construit_Wrapper_Champ ( const MEDMEM::FIELD * medfield ) { if (medfield) champ=new Wrapper_MED_Field(medfield); else @@ -379,7 +379,7 @@ template inline void Meta_Wrapper::Construit_Wrapper exit(-1); } } -template inline void Meta_Wrapper::Change_Champ ( const FIELD * medfield ) +template inline void Meta_Wrapper::Change_Champ ( const MEDMEM::FIELD * medfield ) { if (medfield) { @@ -392,14 +392,14 @@ template inline void Meta_Wrapper::Change_Champ exit(-1); } } -template Meta_Wrapper::Meta_Wrapper(int nn,double *nodes,CONNECTIVITY *connmed, int flag_maillage) +template Meta_Wrapper::Meta_Wrapper(int nn,double *nodes,MEDMEM::CONNECTIVITY *connmed, int flag_maillage) { init(); Construit_Wrapper_Nuage_Noeud(nn,nodes); Construit_Wrapper_Nuage_Maille(connmed); if (flag_maillage) Construit_Wrapper_Maillage(); } -template Meta_Wrapper::Meta_Wrapper(int nn,double *nodes,CONNECTIVITY *connmed, const FIELD * c,int flag_maillage) +template Meta_Wrapper::Meta_Wrapper(int nn,double *nodes,MEDMEM::CONNECTIVITY *connmed, const MEDMEM::FIELD * c,int flag_maillage) { init(); Construit_Wrapper_Nuage_Noeud(nn,nodes); diff --git a/src/INTERPOLATION/MEDMEM_InterpolationTools.hxx b/src/INTERPOLATION/MEDMEM_InterpolationTools.hxx index c30875534..ecce21bce 100644 --- a/src/INTERPOLATION/MEDMEM_InterpolationTools.hxx +++ b/src/INTERPOLATION/MEDMEM_InterpolationTools.hxx @@ -63,18 +63,18 @@ public : _TEMPLATE_ Calcul_Hybride<_PARAM_>::Calcul_Hybride(NUAGENOEUD * nn,NUAGEMAILLE * nm,CHAMP * c):mailles(nm) { - fonctions[MED_TRIA3 ]=new Calcul_Interpolation_Tria3 <_PARAM_>(nn,nm,c); - fonctions[MED_TRIA6 ]=new Calcul_Interpolation_Tria6 <_PARAM_>(nn,nm,c); - fonctions[MED_QUAD4 ]=new Calcul_Interpolation_Quad4 <_PARAM_>(nn,nm,c); - fonctions[MED_QUAD8 ]=new Calcul_Interpolation_Quad8 <_PARAM_>(nn,nm,c); - fonctions[MED_TETRA4 ]=new Calcul_Interpolation_Tetra4 <_PARAM_>(nn,nm,c); - fonctions[MED_TETRA10]=new Calcul_Interpolation_Tetra10<_PARAM_>(nn,nm,c); - fonctions[MED_HEXA8 ]=new Calcul_Interpolation_Hexa8 <_PARAM_>(nn,nm,c); - fonctions[MED_HEXA20 ]=new Calcul_Interpolation_Hexa20 <_PARAM_>(nn,nm,c); - fonctions[MED_PENTA6 ]=new Calcul_Interpolation_Penta6 <_PARAM_>(nn,nm,c); - fonctions[MED_PENTA15]=new Calcul_Interpolation_Penta15<_PARAM_>(nn,nm,c); - fonctions[MED_PYRA5 ]=new Calcul_Interpolation_Pyra5 <_PARAM_>(nn,nm,c); - fonctions[MED_PYRA13 ]=new Calcul_Interpolation_Pyra13 <_PARAM_>(nn,nm,c); + fonctions[ MED_EN::MED_TRIA3 ]=new Calcul_Interpolation_Tria3 <_PARAM_>(nn,nm,c); + fonctions[ MED_EN::MED_TRIA6 ]=new Calcul_Interpolation_Tria6 <_PARAM_>(nn,nm,c); + fonctions[ MED_EN::MED_QUAD4 ]=new Calcul_Interpolation_Quad4 <_PARAM_>(nn,nm,c); + fonctions[ MED_EN::MED_QUAD8 ]=new Calcul_Interpolation_Quad8 <_PARAM_>(nn,nm,c); + fonctions[ MED_EN::MED_TETRA4 ]=new Calcul_Interpolation_Tetra4 <_PARAM_>(nn,nm,c); + fonctions[ MED_EN::MED_TETRA10]=new Calcul_Interpolation_Tetra10<_PARAM_>(nn,nm,c); + fonctions[ MED_EN::MED_HEXA8 ]=new Calcul_Interpolation_Hexa8 <_PARAM_>(nn,nm,c); + fonctions[ MED_EN::MED_HEXA20 ]=new Calcul_Interpolation_Hexa20 <_PARAM_>(nn,nm,c); + fonctions[ MED_EN::MED_PENTA6 ]=new Calcul_Interpolation_Penta6 <_PARAM_>(nn,nm,c); + fonctions[ MED_EN::MED_PENTA15]=new Calcul_Interpolation_Penta15<_PARAM_>(nn,nm,c); + fonctions[ MED_EN::MED_PYRA5 ]=new Calcul_Interpolation_Pyra5 <_PARAM_>(nn,nm,c); + fonctions[ MED_EN::MED_PYRA13 ]=new Calcul_Interpolation_Pyra13 <_PARAM_>(nn,nm,c); } _TEMPLATE_ VALEURCHAMP Calcul_Hybride<_PARAM_>::operator() (const NOEUD & n, int num_maille) @@ -218,7 +218,7 @@ public : VALEURCHAMP operator() (const NOEUD & n, int num_maille) cout<<" ### Mu1 = "< #include -#define MED_NOPG 1 /* -> pas de point de Gauss */ -#define MED_NOPFL "" /* -> pas de profils utilisateur */ -#define MED_NOPFLi " " /* Variable Interne */ -#define MED_NOPF 0 /* -> pas de profils pour _MEDdataseNnumEcrire */ -#define MED_NOPDT -1 /* rem: pas de pas de temps negatifs */ -#define MED_NONOR -1 /* rem: pas de n°ordre negatif */ -#define MED_DIM1 1 /* PAS */ - -#define MED_ALL 0 /*****************************************************************************************************/ @@ -232,6 +223,9 @@ int main (int argc, char **argv) med_idt tofid; char frommaa[MED_TAILLE_NOM+1] = "fromMesh"; char tomaa[MED_TAILLE_NOM+1] = "toMesh"; + char frommaadesc[MED_TAILLE_DESC+1] = "Initial Mesh description"; + char tomaadesc[MED_TAILLE_DESC+1] = "Target Mesh description"; + med_maillage type = MED_NON_STRUCTURE; const med_int mdim = 3; med_int fromnnoe; med_int tonnoe; @@ -355,7 +349,7 @@ int main (int argc, char **argv) /*****************************************************************************************************/ - fromfid = MEDouvrir("fromMesh.med",MED_REMP); + fromfid = MEDouvrir("fromMesh.med",MED_LECTURE_AJOUT); if (fromfid < 0) ret = -1; else @@ -363,7 +357,7 @@ int main (int argc, char **argv) printf("MEDouvrir : %d\n",ret); /*****************************************************************************************************/ - tofid = MEDouvrir("toMesh.med",MED_REMP); + tofid = MEDouvrir("toMesh.med",MED_LECTURE_AJOUT); if (tofid < 0) ret = -1; else @@ -371,13 +365,13 @@ int main (int argc, char **argv) printf("MEDouvrir : %d\n",ret); /*****************************************************************************************************/ if (ret == 0) - ret = MEDmaaCr(fromfid,frommaa,mdim); + ret = MEDmaaCr(fromfid,frommaa,mdim,type,frommaadesc); printf("MEDmaaCr : %d\n",ret); /*****************************************************************************************************/ if (ret == 0) - ret = MEDmaaCr(tofid,tomaa,mdim); + ret = MEDmaaCr(tofid,tomaa,mdim,type,tomaadesc); printf("MEDmaaCr : %d\n",ret); /*****************************************************************************************************/ @@ -385,7 +379,7 @@ int main (int argc, char **argv) ret = MEDnoeudsEcr(fromfid,frommaa,mdim,fromcoo,MED_FULL_INTERLACE,MED_CART, // nomcoo,unicoo,nomnoe,MED_FAUX,fromnumnoe,MED_VRAI, nomcoo,unicoo,nomnoe,MED_FAUX,fromnumnoe,MED_FAUX, - fromnufano,fromnnoe,MED_ECRI); + fromnufano,fromnnoe); printf("MEDnoeudsEcr : %d\n",ret); /*****************************************************************************************************/ @@ -393,7 +387,7 @@ int main (int argc, char **argv) ret = MEDnoeudsEcr(tofid,tomaa,mdim,tocoo,MED_FULL_INTERLACE,MED_CART, //nomcoo,unicoo,nomnoe,MED_FAUX,tonumnoe,MED_VRAI, nomcoo,unicoo,nomnoe,MED_FAUX,tonumnoe,MED_FAUX, - tonufano,tonnoe,MED_ECRI); + tonufano,tonnoe); printf("MEDnoeudsEcr : %d\n",ret); @@ -406,7 +400,7 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDelementsEcr(fromfid,frommaa,mdim,fromhexa8,MED_FULL_INTERLACE, fromnomhexa8,MED_FAUX,fromnumhexa8,MED_VRAI,fromnufahexa8,fromnhexa8, - MED_MAILLE,MED_HEXA8,MED_NOD,MED_ECRI); + MED_MAILLE,MED_HEXA8,MED_NOD); printf("MEDelementsEcr : %d \n",ret); /*****************************************************************************************************/ @@ -419,7 +413,7 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDelementsEcr(tofid,tomaa,mdim,tohexa8,MED_FULL_INTERLACE, tonomhexa8,MED_FAUX,tonumhexa8,MED_VRAI,tonufahexa8,tonhexa8, - MED_MAILLE,MED_HEXA8,MED_NOD,MED_ECRI); + MED_MAILLE,MED_HEXA8,MED_NOD); printf("MEDelementsEcr : %d \n",ret); /*****************************************************************************************************/ @@ -456,13 +450,13 @@ int main (int argc, char **argv) if (ret == 0) { - ret = MEDchampCr(fromfid,champnode,MED_REEL64,champnode_comp,champnode_unit,1); + ret = MEDchampCr(fromfid,champnode,MED_FLOAT64,champnode_comp,champnode_unit,1); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fromfid, frommaa, champnode, (unsigned char *)fieldnodedouble, MED_FULL_INTERLACE, fromnnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, + MED_NOGAUSS, MED_ALL, MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, MED_NOPDT," ", 0. , MED_NONOR); printf("MEDchampEcr : %d \n",ret); } @@ -470,13 +464,13 @@ int main (int argc, char **argv) if (ret == 0) { - ret = MEDchampCr(fromfid,champcell,MED_REEL64,champcell_comp,champcell_unit,3); + ret = MEDchampCr(fromfid,champcell,MED_FLOAT64,champcell_comp,champcell_unit,3); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fromfid, frommaa, champcell, (unsigned char *)fieldcelldoublevector, MED_FULL_INTERLACE, fromnhexa8, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_MAILLE, + MED_NOGAUSS, MED_ALL, MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, MED_HEXA8, MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } @@ -484,13 +478,13 @@ int main (int argc, char **argv) if (ret == 0) { - ret = MEDchampCr(fromfid,champcellscalar,MED_REEL64,champcellscalar_comp,champcellscalar_unit,1); + ret = MEDchampCr(fromfid,champcellscalar,MED_FLOAT64,champcellscalar_comp,champcellscalar_unit,1); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fromfid, frommaa, champcellscalar, (unsigned char *)fieldcelldouble, MED_FULL_INTERLACE, fromnhexa8, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_MAILLE, + MED_NOGAUSS, MED_ALL, MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, MED_HEXA8, MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } @@ -498,13 +492,13 @@ int main (int argc, char **argv) if (ret == 0) { - ret = MEDchampCr(fromfid,champnodevector,MED_REEL64,champnodevector_comp,champnodevector_unit,3); + ret = MEDchampCr(fromfid,champnodevector,MED_FLOAT64,champnodevector_comp,champnodevector_unit,3); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fromfid, frommaa, champnodevector, (unsigned char *)fieldnodedoublevector, MED_FULL_INTERLACE, fromnnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, + MED_NOGAUSS, MED_ALL, MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, MED_NOPDT," ", 0. , MED_NONOR); printf("MEDchampEcr : %d \n",ret); } @@ -520,4 +514,3 @@ printf("MEDfermer : %d\n",ret); return 0; } - diff --git a/src/INTERPOLATION/test_MEDMEM_InterpolationFromMesh_toMesh.cxx b/src/INTERPOLATION/test_MEDMEM_InterpolationFromMesh_toMesh.cxx index 5d8112d8e..e7d160346 100644 --- a/src/INTERPOLATION/test_MEDMEM_InterpolationFromMesh_toMesh.cxx +++ b/src/INTERPOLATION/test_MEDMEM_InterpolationFromMesh_toMesh.cxx @@ -7,6 +7,9 @@ #include "stdio.h" +using namespace MEDMEM; +using namespace MED_EN; + main () { const char * fromFileName = "fromMesh.med"; diff --git a/src/INTERPOLATION/test_MEDMEM_InterpolationRecopieMaillage.cxx b/src/INTERPOLATION/test_MEDMEM_InterpolationRecopieMaillage.cxx index ead49418b..4d586a5d7 100644 --- a/src/INTERPOLATION/test_MEDMEM_InterpolationRecopieMaillage.cxx +++ b/src/INTERPOLATION/test_MEDMEM_InterpolationRecopieMaillage.cxx @@ -10,7 +10,8 @@ #include "stdio.h" - +using namespace MEDMEM; +using namespace MED_EN; // pour gestion timings #include "time.h" diff --git a/src/INTERPOLATION/test_MEDMEM_InterpolationSansRecopieMaillage.cxx b/src/INTERPOLATION/test_MEDMEM_InterpolationSansRecopieMaillage.cxx index 7b467783c..147bc3d68 100644 --- a/src/INTERPOLATION/test_MEDMEM_InterpolationSansRecopieMaillage.cxx +++ b/src/INTERPOLATION/test_MEDMEM_InterpolationSansRecopieMaillage.cxx @@ -10,6 +10,9 @@ #include "stdio.h" +using namespace MEDMEM; +using namespace MED_EN; + main () { const char * fromFileName = "ResultatSyrthes.med"; diff --git a/src/INTERPOLATION/test_MEDMEM_InterpolationTimeStep.cxx b/src/INTERPOLATION/test_MEDMEM_InterpolationTimeStep.cxx index d3db97050..b66e4c86e 100644 --- a/src/INTERPOLATION/test_MEDMEM_InterpolationTimeStep.cxx +++ b/src/INTERPOLATION/test_MEDMEM_InterpolationTimeStep.cxx @@ -10,6 +10,9 @@ #include "stdio.h" +using namespace MEDMEM; +using namespace MED_EN; + main () { const char * fromFileName = "ResultatSyrthes.med"; diff --git a/src/MED/Makefile.in b/src/MED/Makefile.in index 5b46a8c8b..947eb1719 100644 --- a/src/MED/Makefile.in +++ b/src/MED/Makefile.in @@ -49,6 +49,9 @@ LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_ModuleCatalog.idl S BIN = BIN_SRC = +LDFLAGS= -L$(top_builddir)/lib/salome +LDFLAGSFORBIN= -L$(top_builddir)/lib/salome + # additionnal information to compil and link file CPPFLAGS += $(OCC_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome diff --git a/src/MED/Med_Gen_i.cxx b/src/MED/Med_Gen_i.cxx index 9622592ad..db4192d87 100755 --- a/src/MED/Med_Gen_i.cxx +++ b/src/MED/Med_Gen_i.cxx @@ -26,7 +26,6 @@ // Module : MED // $Header$ -using namespace std; #include "Med_Gen_i.hxx" #include "MEDMEM_Mesh_i.hxx" @@ -59,6 +58,7 @@ using namespace std; #include #include "SALOMEDS_Tool.hxx" +using namespace std; using namespace MEDMEM; // Initialisation des variables statiques @@ -284,7 +284,7 @@ throw (SALOME::SALOME_Exception) myMeshDriver.setMeshName(meshName); myMeshDriver.open(); } - catch (const exception & ex) + catch (const std::exception & ex) { MESSAGE("Exception Interceptee : "); SCRUTE(ex.what()); @@ -296,7 +296,7 @@ throw (SALOME::SALOME_Exception) MESSAGE("apres read"); myMeshDriver.close(); } - catch (const exception & ex) + catch (const std::exception & ex) { MESSAGE("Exception Interceptee : "); SCRUTE(ex.what()); @@ -377,7 +377,7 @@ throw (SALOME::SALOME_Exception) } else - MESSAGE("MED dejà dans l étude"); + MESSAGE("MED dejà dans l étude"); MESSAGE("Lecture du fichier ") SCRUTE(fileName); @@ -410,7 +410,7 @@ throw (SALOME::SALOME_Exception) */ myField = mymed->getField(fieldName,iter,ordre); } - catch (const exception & ex) + catch (const std::exception & ex) { MESSAGE("Exception Interceptee : "); SCRUTE(ex.what()); @@ -428,7 +428,7 @@ throw (SALOME::SALOME_Exception) SCRUTE(myMesh->getName()); fieldSupport->update(); } - catch (const exception & ex) + catch (const std::exception & ex) { MESSAGE("Exception Interceptee : "); SCRUTE(ex.what()); @@ -438,7 +438,7 @@ throw (SALOME::SALOME_Exception) med_type_champ type = myField->getValueType() ; switch (type) { - case MED_FR::MED_INT32: + case MED_EN::MED_INT32: { try { @@ -450,7 +450,7 @@ throw (SALOME::SALOME_Exception) return myFieldIOR; } catch (const SALOMEDS::StudyBuilder::LockProtection & lp) {} - catch (const exception & ex) + catch (const std::exception & ex) { MESSAGE("Exception Interceptee : "); SCRUTE(ex.what()); @@ -458,7 +458,7 @@ throw (SALOME::SALOME_Exception) }; break; } - case MED_FR::MED_REEL64: + case MED_EN::MED_REEL64: { try { @@ -470,7 +470,7 @@ throw (SALOME::SALOME_Exception) return myFieldIOR; } catch (const SALOMEDS::StudyBuilder::LockProtection & lp) {} - catch (const exception & ex) + catch (const std::exception & ex) { MESSAGE("Exception Interceptee : "); SCRUTE(ex.what()); @@ -668,8 +668,6 @@ SALOMEDS::TMPFile* Med_Gen_i::SaveASCII(SALOMEDS::SComponent_ptr theComponent, if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.ToCString(), aSeq.in(), true); // Return the created byte stream return aStreamFile._retn(); - - END_OF(LOC); } //============================================================================= @@ -692,8 +690,6 @@ CORBA::Boolean Med_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, SALOMEDS::ListOfFileNames_var aSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir.ToCString(), isMultiFile); return true; - - END_OF(LOC); } CORBA::Boolean Med_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, @@ -754,7 +750,7 @@ char* Med_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, SCRUTE(IORString); - if (string(IORString).size()==0) return "_MED"; + if (string(IORString).size()==0) return CORBA::string_dup("_MED"); // Well, we know where put object (_saveFilename) and we know object (IORString) // cast object : CORBA::Object_var myIOR = _orb->string_to_object(IORString); @@ -812,9 +808,7 @@ char* Med_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, } //THROW_SALOME_CORBA_EXCEPTION("Unable to save IOR",SALOME::BAD_PARAM); - return "_MED"; - - END_OF(LOC) ; + return CORBA::string_dup("_MED"); } //============================================================================= @@ -859,7 +853,7 @@ char* Med_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, myMeshDriver.setMeshName(aMeshName); myMeshDriver.open(); } - catch (const exception & ex) + catch (const std::exception & ex) { MESSAGE("Exception Interceptee : "); SCRUTE(ex.what()); @@ -871,7 +865,7 @@ char* Med_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, MESSAGE("apres read"); myMeshDriver.close(); } - catch (const exception & ex) + catch (const std::exception & ex) { MESSAGE("Exception Interceptee : "); SCRUTE(ex.what()); @@ -897,8 +891,6 @@ char* Med_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, } return CORBA::string_dup(""); - - END_OF(LOC) ; } //============================================================================= @@ -1008,10 +1000,13 @@ SALOMEDS::TMPFile* Med_Gen_i::CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::L strcpy(aFullName+strlen(aTmpDir), aSeq[0]); long driverId = aMesh->addDriver(SALOME_MED::MED_DRIVER,aFullName , aMesh->getName()); aMesh->write(driverId,""); - delete(aFullName); - aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir, aSeq.in(), false); - SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir, aSeq.in(), true); + // aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.c_str(), aSeq.in(), false); + char* aFullName1 = new char[strlen(aTmpDir)+1]; + strcpy(aFullName1, aTmpDir); + aStreamFile = SALOMEDS_Tool::PutFilesToStream(aFullName1, aSeq.in(), false); + // SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true); + SALOMEDS_Tool::RemoveTemporaryFiles(aFullName1, aSeq.in(), true); // Assign an ID = 1 the the type SALOME_MED::MESH theObjectID = 1; @@ -1045,32 +1040,36 @@ SALOMEDS::SObject_ptr Med_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream, SALOMEDS::Study_var aStudy = theObject->GetStudy(); CORBA::String_var aTmpDir = CORBA::string_dup(SALOMEDS_Tool::GetTmpDir().c_str()); - SALOMEDS::ListOfFileNames_var aSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir, false); + char* aFullName2 = new char[strlen(aTmpDir)+1]; + strcpy(aFullName2,aTmpDir); + // SALOMEDS::ListOfFileNames_var aSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, aTmpDir, false); + SALOMEDS::ListOfFileNames_var aSeq = SALOMEDS_Tool::PutStreamToFiles(theStream, aFullName2, false); CORBA::String_var aMeshName = CORBA::string_dup(aSeq[0]); char* aFullName = new char[strlen(aTmpDir)+strlen(aMeshName)+1]; strcpy(aFullName, aTmpDir); strcpy(aFullName+strlen(aTmpDir), aMeshName); MESH * myMesh= new MESH() ; - myMesh->setName((char*)aMeshName); + // myMesh->setName(aMeshName.c_str()); + char* aFullMeshName = new char[strlen(aMeshName)+1]; + strcpy(aFullMeshName,aMeshName); + myMesh->setName(aFullMeshName); MED_MESH_RDONLY_DRIVER myMeshDriver(aFullName, myMesh); try { - myMeshDriver.setMeshName((char*)aMeshName); + myMeshDriver.setMeshName(aFullMeshName); myMeshDriver.open(); - } catch (const exception & ex) { + } catch (const std::exception & ex) { MESSAGE("Exception Interceptee : "); SCRUTE(ex.what()); - delete(aFullName); return aResultSO._retn(); }; try { myMeshDriver.read(); ("apres read"); myMeshDriver.close(); - } catch (const exception & ex) { + } catch (const std::exception & ex) { MESSAGE("Exception Interceptee : "); SCRUTE(ex.what()); - delete(aFullName); return aResultSO._retn(); }; // set new mesh name, becouse now there are no possibility to operate meshes with the same names @@ -1087,8 +1086,10 @@ SALOMEDS::SObject_ptr Med_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream, CORBA::String_var anIORString = _orb->object_to_string(mesh); aResultSO = aStudy->FindObjectIOR(anIORString); - SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir, aSeq.in(), true); - delete(aFullName); + char * aFullName1 = new char[strlen(aTmpDir)+1]; + strcpy(aFullName1,aTmpDir); + // SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true); + SALOMEDS_Tool::RemoveTemporaryFiles(aFullName1, aSeq.in(), true); return aResultSO._retn(); } diff --git a/src/MED/Med_Gen_i.hxx b/src/MED/Med_Gen_i.hxx index 630cb8f87..d656bc888 100644 --- a/src/MED/Med_Gen_i.hxx +++ b/src/MED/Med_Gen_i.hxx @@ -128,14 +128,14 @@ public: SALOMEDS::SObject_ptr theObject); private : - static map _MedCorbaObj; - static string _myFileName; - static string _saveFileName; + static std::map _MedCorbaObj; + static std::string _myFileName; + static std::string _saveFileName; private: bool _duringLoad; int _myStudyID; - string _myStudyName; + std::string _myStudyName; int myCounter; SALOME_NamingService *_NS; diff --git a/src/MEDMEM/MEDMEM_Array.hxx b/src/MEDMEM/MEDMEM_Array.hxx index e0d55c4a8..69d379cdb 100644 --- a/src/MEDMEM/MEDMEM_Array.hxx +++ b/src/MEDMEM/MEDMEM_Array.hxx @@ -6,8 +6,6 @@ #include "MEDMEM_PointerOf.hxx" #include "utilities.h" -using namespace MED_EN; - /*! A template class to generate an array of any particular type (int, long, float, double) for our purpose in the MED++ library.\n\n @@ -45,13 +43,13 @@ template class MEDARRAY private : /*! leading dimension of value (example : space dimension for coordinates) */ - med_int _ldValues; + int _ldValues; /*! length of values (example : number of nodes for coordinates) */ - med_int _lengthValues; + int _lengthValues; /*! data access mode. possible values are :\n - MED_FULL_INTERLACE (default mode) \n - MED_NO_INTERLACE */ - medModeSwitch _mode; + MED_EN::medModeSwitch _mode; /*! Pointer to representation in mode MED_FULL_INTERLACE */ PointerOf _valuesFull; /*! Pointer to representation in mode MED_NO_INTERLACE */ @@ -66,40 +64,39 @@ public : inline MEDARRAY(); inline ~MEDARRAY(); - MEDARRAY (const med_int ld_values, const med_int length_values, - const medModeSwitch mode=MED_FULL_INTERLACE); - MEDARRAY (T* values, const med_int ld_values, - const med_int length_values, const medModeSwitch mode=MED_FULL_INTERLACE,bool shallowCopy=false, bool ownershipOfValues=false); + MEDARRAY (const int ld_values, const int length_values, + const MED_EN::medModeSwitch mode=MED_EN::MED_FULL_INTERLACE); + MEDARRAY (T* values, const int ld_values, + const int length_values, const MED_EN::medModeSwitch mode=MED_EN::MED_FULL_INTERLACE,bool shallowCopy=false, bool ownershipOfValues=false); MEDARRAY (MEDARRAY const &m); MEDARRAY (MEDARRAY const &m, bool copyOther); MEDARRAY & operator = (const MEDARRAY & m); MEDARRAY & shallowCopy(const MEDARRAY & m); - inline med_int getLeadingValue() const; - inline med_int getLengthValue() const; + inline int getLeadingValue() const; + inline int getLengthValue() const; - const T * get (const medModeSwitch mode) ; - const T * getRow (const med_int i) ; - const T * getColumn (const med_int j) ; - const T getIJ (const med_int i, const med_int j) const; -// T * const get (const medModeSwitch mode) const; -// T * const getRow (const med_int i) const; -// T * const getColumn (const med_int j) const; -// T const getIJ (const med_int i, const med_int j) const; + const T * get (const MED_EN::medModeSwitch mode) ; + const T * getRow (const int i) ; + const T * getColumn (const int j) ; + const T getIJ (const int i, const int j) const; +// T * const get (const MED_EN::medModeSwitch mode) const; +// T * const getRow (const int i) const; +// T * const getColumn (const int j) const; +// T const getIJ (const int i, const int j) const; - inline medModeSwitch getMode() const; + inline MED_EN::medModeSwitch getMode() const; - void set (const medModeSwitch mode,const T* value); - void setI (const med_int i, const T* value); - void setJ (const med_int j, const T* value); - void setIJ (const med_int i, const med_int j, const T value); + void set (const MED_EN::medModeSwitch mode,const T* value); + void setI (const int i, const T* value); + void setJ (const int j, const T* value); + void setIJ (const int i, const int j, const T value); void calculateOther(); bool isOtherCalculated() const {return (const T*)_valuesOther != NULL;} void clearOtherMode(); }; -} //-------------------------------------------------// // // @@ -132,9 +129,9 @@ template inline MEDARRAY::~MEDARRAY() The desallocation of T array is not your responsability. \n\n Throws MEDEXCEPTION if T array length is < 1*/ -template MEDARRAY::MEDARRAY(const med_int ld_values, - const med_int length_values, - const medModeSwitch mode): +template MEDARRAY::MEDARRAY(const int ld_values, + const int length_values, + const MED_EN::medModeSwitch mode): _ldValues(ld_values), _lengthValues(length_values), @@ -142,7 +139,7 @@ template MEDARRAY::MEDARRAY(const med_int ld_values, _valuesFull(), _valuesNo(), _valuesDefault(),_valuesOther() { - BEGIN_OF("constructor MEDARRAY::MEDARRAY(const med_int, const med_int, const medModeSwitch)"); + BEGIN_OF("constructor MEDARRAY::MEDARRAY(const int, const int, const medModeSwitch)"); // if ld_values < 1 or length_values < 1 // throws an exception @@ -150,17 +147,17 @@ template MEDARRAY::MEDARRAY(const med_int ld_values, if ((ld_values<1)|(length_values<1)) { - throw MEDEXCEPTION(LOCALIZED("MEDARRAY::MEDARRAY(const med_int, const med_int, const medModeSwitch) : dimension < 1 !")); + throw MEDEXCEPTION(LOCALIZED("MEDARRAY::MEDARRAY(const int, const int, const medModeSwitch) : dimension < 1 !")); } - if ( _mode == MED_FULL_INTERLACE) + if ( _mode == MED_EN::MED_FULL_INTERLACE) { _valuesFull.set(length_values*ld_values); _valuesDefault.set((T*) _valuesFull); } else { - ASSERT (_mode == MED_NO_INTERLACE); + ASSERT (_mode == MED_EN::MED_NO_INTERLACE); _valuesNo.set(length_values*ld_values); _valuesDefault.set((T*)_valuesNo); } @@ -171,7 +168,7 @@ template MEDARRAY::MEDARRAY(const med_int ld_values, SCRUTE((T*)_valuesNo); SCRUTE((T*)_valuesFull); - END_OF("constructor MEDARRAY::MEDARRAY(const med_int, const med_int, const medModeSwitch ()"); + END_OF("constructor MEDARRAY::MEDARRAY(const int, const int, const medModeSwitch ()"); } // ------------------ @@ -180,9 +177,9 @@ template MEDARRAY::MEDARRAY(const med_int ld_values, Throws MEDEXCEPTION if the lenght of T is < 1*/ template MEDARRAY::MEDARRAY( T*values, - const med_int ld_values, - const med_int length_values, - const medModeSwitch mode, + const int ld_values, + const int length_values, + const MED_EN::medModeSwitch mode, bool shallowCopy, bool ownershipOfValues): _ldValues(ld_values), @@ -191,16 +188,16 @@ template MEDARRAY::MEDARRAY( T*values, _valuesFull(),_valuesNo(), _valuesDefault(),_valuesOther() { - BEGIN_OF("constructor MEDARRAY::MEDARRAY(T* values, const med_int, const med_int, const medModeSwitch)"); + BEGIN_OF("constructor MEDARRAY::MEDARRAY(T* values, const int, const int, const medModeSwitch)"); // if ld_values < 1 or length_values < 1, we could not allocate // throws an exception if ( (ld_values<1) | (length_values<1) ) { - throw MEDEXCEPTION(LOCALIZED("MEDARRAY::MEDARRAY(T* values, const med_int, const medModeSwitch) : dimension < 1 !")); + throw MEDEXCEPTION(LOCALIZED("MEDARRAY::MEDARRAY(T* values, const int, const medModeSwitch) : dimension < 1 !")); } - if ( _mode == MED_FULL_INTERLACE) + if ( _mode == MED_EN::MED_FULL_INTERLACE) { if(shallowCopy) { @@ -221,7 +218,7 @@ template MEDARRAY::MEDARRAY( T*values, } else { - ASSERT (_mode == MED_NO_INTERLACE); + ASSERT (_mode == MED_EN::MED_NO_INTERLACE); if(shallowCopy) { if(ownershipOfValues) @@ -243,7 +240,7 @@ template MEDARRAY::MEDARRAY( T*values, SCRUTE((T*)_valuesNo); SCRUTE((T*)_valuesFull); - END_OF("constructor MEDARRAY::MEDARRAY(T* values, const med_int, const med_int, const medModeSwitch)"); + END_OF("constructor MEDARRAY::MEDARRAY(T* values, const int, const int, const medModeSwitch)"); } // ------------------ @@ -294,7 +291,7 @@ template MEDARRAY::MEDARRAY(MEDARRAY const & p,bool copyOther ): // throw MEDEXCEPTION("MEDARRAY MEDARRAY const &m,bool copyOther : No Other values defined and bool = true !"); // } - if ( _mode == MED_FULL_INTERLACE) + if ( _mode == MED_EN::MED_FULL_INTERLACE) { _valuesFull.set(p._ldValues*p._lengthValues,(const T*)p._valuesFull); _valuesDefault.set((T*)_valuesFull); @@ -307,7 +304,7 @@ template MEDARRAY::MEDARRAY(MEDARRAY const & p,bool copyOther ): } else { - ASSERT (_mode == MED_NO_INTERLACE); + ASSERT (_mode == MED_EN::MED_NO_INTERLACE); _valuesNo.set(p._ldValues*p._lengthValues,(const T*)p._valuesNo); _valuesDefault.set((T*)_valuesNo); if (copyOther) @@ -342,14 +339,14 @@ template MEDARRAY & MEDARRAY::operator = (const MEDARRAY & m) if ((const T*) m._valuesNo !=NULL) _valuesNo.set(_ldValues*_lengthValues,(const T*) m._valuesNo); - if (_mode == MED_FULL_INTERLACE) { + if (_mode == MED_EN::MED_FULL_INTERLACE) { //PN : pour enlever les warning compilateur //_valuesDefault.set((const T*) _valuesFull); //_valuesOther.set((const T*) _valuesNo); _valuesDefault.set((T*) _valuesFull); _valuesOther.set((T*) _valuesNo); } else { - ASSERT (_mode == MED_NO_INTERLACE); + ASSERT (_mode == MED_EN::MED_NO_INTERLACE); //PN : pour enlever les warning compilateur //_valuesDefault.set((const T*) _valuesNo); //_valuesOther.set((const T*) _valuesFull); @@ -378,7 +375,7 @@ template MEDARRAY & MEDARRAY::shallowCopy(const MEDARRAY & m) _valuesFull.setShallowAndOwnership((const T*) m._valuesFull); if ((const T*) m._valuesNo !=NULL) _valuesNo.setShallowAndOwnership((const T*) m._valuesNo); - if (_mode == MED_FULL_INTERLACE) { + if (_mode == MED_EN::MED_FULL_INTERLACE) { _valuesDefault.set((T*) _valuesFull); _valuesOther.set((T*) _valuesNo); } else { @@ -391,7 +388,7 @@ template MEDARRAY & MEDARRAY::shallowCopy(const MEDARRAY & m) // ------------------ /*! returns _ldValues. (for example, space dimension for coordinates array)*/ -template inline med_int MEDARRAY::getLeadingValue() const +template inline int MEDARRAY::getLeadingValue() const { return _ldValues; }; @@ -399,7 +396,7 @@ template inline med_int MEDARRAY::getLeadingValue() const // ------------------ /*! returns _ldValues. (for example, number of nodes for coordinates array)*/ -template inline med_int MEDARRAY::getLengthValue() const +template inline int MEDARRAY::getLengthValue() const { return _lengthValues; }; @@ -410,7 +407,7 @@ template inline med_int MEDARRAY::getLengthValue() const mode value : if mode is the same as _mode, _valuesDefault is returned. else, if _valuesOther is calculated (if necessary) and then returned. The pointer can be used to set values */ -template const T* MEDARRAY::get(const medModeSwitch mode) +template const T* MEDARRAY::get(const MED_EN::medModeSwitch mode) { BEGIN_OF("MEDARRAY::get(const medModeSwitch mode)"); if ((T*)_valuesDefault == NULL) @@ -433,7 +430,6 @@ template const T* MEDARRAY::get(const medModeSwitch mode) //return (const T*)_valuesDefault; return (T*) _valuesOther; } - END_OF("MEDARRAY::get(const medModeSwitch mode)"); } // ------------------ @@ -443,10 +439,10 @@ template const T* MEDARRAY::get(const medModeSwitch mode) Be aware : if _mode is MED_NO_INTERLACE, the entire array will be recalculate in MED_FULL_INTERLACE representation.\n*/ -template const T* MEDARRAY::getRow(const med_int i) +template const T* MEDARRAY::getRow(const int i) { - BEGIN_OF("MEDARRAY::getRow(const med_int i)"); + BEGIN_OF("MEDARRAY::getRow(const int i)"); if ((T*)_valuesDefault == NULL) { @@ -472,7 +468,7 @@ template const T* MEDARRAY::getRow(const med_int i) //const T* ptr = (const T*)_valuesFull + (i-1)*_ldValues; const T* ptr = (T*) _valuesFull + (i-1)*_ldValues; - END_OF("MEDARRAY::getRow(const med_int i )"); + END_OF("MEDARRAY::getRow(const int i )"); return ptr; } // ------------------ @@ -483,9 +479,9 @@ template const T* MEDARRAY::getRow(const med_int i) Be aware : if _mode is MED_FULL_INTERLACE, the entire array will be recalculate in MED_NO_INTERLACE representation.\n*/ -template const T* MEDARRAY::getColumn(const med_int j) +template const T* MEDARRAY::getColumn(const int j) { - BEGIN_OF("MEDARRAY::getColumn(const med_int j)"); + BEGIN_OF("MEDARRAY::getColumn(const int j)"); if ((T*)_valuesDefault == NULL) { throw MEDEXCEPTION("MEDARRAY::getColumn(j) : No values defined !"); @@ -515,7 +511,7 @@ template const T* MEDARRAY::getColumn(const med_int j) /*! returns Jth value of Ith element .\n don't forget first element is element 1 (and not element 0). */ -template const T MEDARRAY::getIJ(const med_int i,const med_int j) const +template const T MEDARRAY::getIJ(const int i,const int j) const { if (i<1) @@ -540,7 +536,7 @@ template const T MEDARRAY::getIJ(const med_int i,const med_int j) throw MEDEXCEPTION("MEDARRAY::getIJ(i,j) : No value in array !"); } - if (_mode == MED_FULL_INTERLACE) + if (_mode == MED_EN::MED_FULL_INTERLACE) { return _valuesDefault[(i-1)*_ldValues+j-1]; } @@ -555,7 +551,7 @@ template const T MEDARRAY::getIJ(const med_int i,const med_int j) /*! returns the default mode (_mode)\n (internal use : needed by write method) */ -template inline medModeSwitch MEDARRAY::getMode() const +template inline MED_EN::medModeSwitch MEDARRAY::getMode() const { BEGIN_OF("MEDARRAY::getMode()"); END_OF("MEDARRAY::getMode()"); @@ -593,12 +589,12 @@ template inline medModeSwitch MEDARRAY::getMode() const // set with duplication because we don't know were value come and // MEDARRAY must have properties on it !!!! -template void MEDARRAY::set(const medModeSwitch mode, const T* value) +template void MEDARRAY::set(const MED_EN::medModeSwitch mode, const T* value) { BEGIN_OF("MEDARRAY::set(mode,value)"); _mode = mode; - if ( _mode == MED_FULL_INTERLACE) + if ( _mode == MED_EN::MED_FULL_INTERLACE) { _valuesFull.set(_ldValues*_lengthValues,value); _valuesDefault.set((T*)_valuesFull); @@ -606,7 +602,7 @@ template void MEDARRAY::set(const medModeSwitch mode, const T* valu } else { - ASSERT (_mode == MED_NO_INTERLACE); + ASSERT (_mode == MED_EN::MED_NO_INTERLACE); _valuesNo.set(_ldValues*_lengthValues,value); _valuesDefault.set((T*)_valuesNo); _valuesFull.set(0); @@ -624,7 +620,7 @@ template void MEDARRAY::clearOtherMode() { if(isOtherCalculated()) { - if ( _mode == MED_FULL_INTERLACE) + if ( _mode == MED_EN::MED_FULL_INTERLACE) _valuesNo.set(0); else _valuesFull.set(0); @@ -638,7 +634,7 @@ template void MEDARRAY::clearOtherMode() /*! Sets ith element to T* values\n if they both exist, both _valuesFull and _valuesNo arrays will be updated.\n Throws exception if i < 1 or i > _lengthValues */ -template void MEDARRAY::setI(const med_int i, const T* value) +template void MEDARRAY::setI(const int i, const T* value) { BEGIN_OF("MEDARRAY::setI(i,value)"); @@ -678,7 +674,7 @@ template void MEDARRAY::setI(const med_int i, const T* value) /*! Sets ith element to T* values\n if they both exist, both _valuesFull and _valuesNo arrays will be updated.\n Throws exception if i < 1 or i > _lengthValues */ -template void MEDARRAY::setJ(const med_int j, const T* value) +template void MEDARRAY::setJ(const int j, const T* value) { BEGIN_OF("MEDARRAY::setJ(j,value)"); if (( T*)_valuesDefault == NULL) @@ -717,7 +713,7 @@ template void MEDARRAY::setJ(const med_int j, const T* value) Maintains coherency.\n Throws exception if we don't have 1<=i<=_lengthValues and 1<=j<=_ldValues */ -template void MEDARRAY::setIJ(const med_int i, const med_int j, const T value) +template void MEDARRAY::setIJ(const int i, const int j, const T value) { // 1<=i<=_lengthValues and 1<=j<=_ldValues @@ -761,13 +757,13 @@ template void MEDARRAY::calculateOther() { _valuesOther.set(_ldValues*_lengthValues); } - if (_mode == MED_NO_INTERLACE) + if (_mode == MED_EN::MED_NO_INTERLACE) { _valuesFull.set((T*)_valuesOther); } else { - ASSERT( _mode==MED_FULL_INTERLACE); + ASSERT( _mode==MED_EN::MED_FULL_INTERLACE); _valuesNo.set((T*)_valuesOther); } @@ -775,7 +771,7 @@ template void MEDARRAY::calculateOther() { for (int j=0; j<_ldValues; j++) { - if (_mode == MED_NO_INTERLACE) + if (_mode == MED_EN::MED_NO_INTERLACE) { _valuesFull[i*_ldValues+j] = _valuesNo[j*_lengthValues+i]; } @@ -788,4 +784,6 @@ template void MEDARRAY::calculateOther() END_OF("MEDARRAY::calculateOther()"); } +} //End of namespace MEDMEM + # endif /* # ifndef __MEDARRAY_H__ */ diff --git a/src/MEDMEM/MEDMEM_CellModel.cxx b/src/MEDMEM/MEDMEM_CellModel.cxx index ab00a7051..686e4e8d8 100644 --- a/src/MEDMEM/MEDMEM_CellModel.cxx +++ b/src/MEDMEM/MEDMEM_CellModel.cxx @@ -1,12 +1,13 @@ -using namespace std; /* File MEDMEM_CellModel.cxx $Header$ */ -#include "utilities.h" #include "MEDMEM_CellModel.hxx" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; CELLMODEL::CELLMODEL(medGeometryElement t) { diff --git a/src/MEDMEM/MEDMEM_CellModel.hxx b/src/MEDMEM/MEDMEM_CellModel.hxx index 0dc98d33c..7b8222d66 100644 --- a/src/MEDMEM/MEDMEM_CellModel.hxx +++ b/src/MEDMEM/MEDMEM_CellModel.hxx @@ -14,7 +14,6 @@ #include "MEDMEM_define.hxx" using namespace std ; -using namespace MED_EN; /*! This class is an internal class and should not be used by the end-user. @@ -41,7 +40,7 @@ private: /*! explicit name (as MED_POINT1) */ string _name; /*! type of cell (cf define.h) */ - medGeometryElement _type; + MED_EN::medGeometryElement _type; /*! Cell dimension (not space dimension) */ int _dimension; /*! number of nodes forming this type of a cell */ @@ -64,14 +63,14 @@ private: this dimension\n - third vector : list of local nodes */ int*** _constituents ; - medGeometryElement** _constituentsType ; + MED_EN::medGeometryElement** _constituentsType ; public : /*! Constructor. */ inline CELLMODEL(); /*! Constructor. */ - CELLMODEL(medGeometryElement t); + CELLMODEL(MED_EN::medGeometryElement t); /*! Copy constructor. */ inline CELLMODEL(const CELLMODEL &m); /*! Destructor. */ @@ -99,7 +98,7 @@ public : /*! returns the geometric type of the cell. \n see med.h (in med/include) */ - inline medGeometryElement getType() const; + inline MED_EN::medGeometryElement getType() const; /*! returns all constituents which dimension is _dimension-dim.*/ int** getConstituents(int dim) const; @@ -117,11 +116,11 @@ public : /*! returns types of each constituents which dimension is _dimension-dim.*/ - medGeometryElement* getConstituentsType(int dim) const; + MED_EN::medGeometryElement* getConstituentsType(int dim) const; /*! returns type of num-th constituent which dimension is _dimension-dim.*/ - medGeometryElement getConstituentType(int dim,int num) const; + MED_EN::medGeometryElement getConstituentType(int dim,int num) const; /*! returns number of constituents type (which dimension is _dimension-1).*/ @@ -129,23 +128,21 @@ public : /*! returns all types of constituents which dimension is (_dimension-1).*/ - set getAllConstituentsType() const; + set getAllConstituentsType() const; /*! returns number of constituents foreach type (which dimension is _dimension-1).*/ - map getNumberOfConstituentsForeachType() const; + map getNumberOfConstituentsForeachType() const; -}; }; // ------------------------------------------ // Methodes Inline // ------------------------------------------ -using namespace MEDMEM; inline CELLMODEL::CELLMODEL(): - _type(MED_NONE), + _type(MED_EN::MED_NONE), _dimension(0), _numberOfNodes(0), _numberOfVertexes(0), @@ -153,7 +150,7 @@ inline CELLMODEL::CELLMODEL(): _numberOfConstituents((int*)NULL), _numberOfNodeOfEachConstituent((int**)NULL), _constituents((int***)NULL), - _constituentsType((medGeometryElement**)NULL) + _constituentsType((MED_EN::medGeometryElement**)NULL) { } inline CELLMODEL::CELLMODEL(const CELLMODEL &m) @@ -187,7 +184,7 @@ inline int CELLMODEL::getDimension() const { return _dimension; } -inline medGeometryElement CELLMODEL::getType() const +inline MED_EN::medGeometryElement CELLMODEL::getType() const { return _type; } @@ -207,13 +204,15 @@ inline int CELLMODEL::getNodeConstituent(int dim,int num,int nodesNumber) const { return _constituents[dim-1][num-1][nodesNumber-1] ; } -inline medGeometryElement* CELLMODEL::getConstituentsType(int dim) const +inline MED_EN::medGeometryElement* CELLMODEL::getConstituentsType(int dim) const { return _constituentsType[dim-1]; } -inline medGeometryElement CELLMODEL::getConstituentType(int dim,int num) const +inline MED_EN::medGeometryElement CELLMODEL::getConstituentType(int dim,int num) const { return _constituentsType[dim-1][num-1]; } +}//End of namespace MEDMEM + #endif /* CELLMODEL_HXX */ diff --git a/src/MEDMEM/MEDMEM_Connectivity.cxx b/src/MEDMEM/MEDMEM_Connectivity.cxx index fe4bbe3d6..2df8f784a 100644 --- a/src/MEDMEM/MEDMEM_Connectivity.cxx +++ b/src/MEDMEM/MEDMEM_Connectivity.cxx @@ -1,4 +1,3 @@ -using namespace std; #include "MEDMEM_Connectivity.hxx" #include "MEDMEM_Family.hxx" #include "MEDMEM_Group.hxx" @@ -10,7 +9,9 @@ using namespace std; #include "MEDMEM_STRING.hxx" #include +using namespace std; using namespace MEDMEM; +using namespace MED_EN; /*! Default Constructor. \n Default for Entity is MED_CELL and type of Connectivity is MED_NODAL */ @@ -88,11 +89,11 @@ CONNECTIVITY::CONNECTIVITY (const CONNECTIVITY & m): if (m._count != NULL) { - _count = new med_int[_numberOfTypes+1]; - memcpy(_count,m._count,(_numberOfTypes+1)*sizeof(med_int)); + _count = new int[_numberOfTypes+1]; + memcpy(_count,m._count,(_numberOfTypes+1)*sizeof(int)); } else - _count = (med_int *) NULL; + _count = (int *) NULL; if (m._nodal != NULL) _nodal = new MEDSKYLINEARRAY(* m._nodal); @@ -845,7 +846,7 @@ void CONNECTIVITY::updateGroup(vector myFamilies) } //------------------------------------------------------------------------------------------------------------------// -const med_int * CONNECTIVITY::getConnectivity(medConnectivity ConnectivityType, medEntityMesh Entity, medGeometryElement Type) +const int * CONNECTIVITY::getConnectivity(medConnectivity ConnectivityType, medEntityMesh Entity, medGeometryElement Type) //------------------------------------------------------------------------------------------------------------------// { const char * LOC = "CONNECTIVITY::getConnectivity"; @@ -869,7 +870,7 @@ const med_int * CONNECTIVITY::getConnectivity(medConnectivity ConnectivityType, if (Type==MED_ALL_ELEMENTS) return Connectivity->getValue(); else { - for (med_int i=0; i<_numberOfTypes; i++) + for (int i=0; i<_numberOfTypes; i++) if (_geometricTypes[i]==Type) //return Connectivity->getI(i+1); return Connectivity->getI(_count[i]); @@ -893,7 +894,7 @@ const med_int * CONNECTIVITY::getConnectivity(medConnectivity ConnectivityType, - In C mode : Connectivity[ConnectivityIndex[i]-1+j-1] - In fortran mode : Connectivity[ConnectivityIndex[i]+j] */ //-----------------------------------------------------------------------------------------------// -const med_int * CONNECTIVITY::getConnectivityIndex(medConnectivity ConnectivityType, medEntityMesh Entity) +const int * CONNECTIVITY::getConnectivityIndex(medConnectivity ConnectivityType, medEntityMesh Entity) //----0000000--------------------------------------------------------------------------------------------// { const char * LOC = "CONNECTIVITY::getConnectivityIndex"; @@ -929,7 +930,7 @@ const CELLMODEL & CONNECTIVITY::getType(medGeometryElement Type) const if ((Type==MED_ALL_ELEMENTS) || (Type==MED_NONE)) throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<" : medGeometryElement must be different of MED_ALL_ELEMENTS and MED_NONE !")); - for (med_int i=0; i<_numberOfTypes; i++) + for (int i=0; i<_numberOfTypes; i++) if (_geometricTypes[i]==Type) return _type[i]; throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<" : medGeometryElement not found !")); @@ -938,7 +939,7 @@ const CELLMODEL & CONNECTIVITY::getType(medGeometryElement Type) const /*! Returns the number of elements of type %medGeometryElement. Note : not implemented for MED_ALL_ELEMENTS nor for MED_NONE */ //------------------------------------------------------------------------// -med_int CONNECTIVITY::getNumberOfNodesInType(medGeometryElement Type) const +int CONNECTIVITY::getNumberOfNodesInType(medGeometryElement Type) const //------------------------------------------------------------------------// { const char * LOC = "CONNECTIVITY::getNumberOfNodesInType"; @@ -946,7 +947,7 @@ med_int CONNECTIVITY::getNumberOfNodesInType(medGeometryElement Type) const if ((Type==MED_ALL_ELEMENTS) || (Type==MED_NONE)) throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<" : medGeometryElement must be different of MED_ALL_ELEMENTS and MED_NONE!")); - for (med_int i=0; i<_numberOfTypes; i++) + for (int i=0; i<_numberOfTypes; i++) if (_geometricTypes[i]==Type) return _type[i].getNumberOfNodes(); throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<" : medGeometryElement not found !")); @@ -955,12 +956,12 @@ med_int CONNECTIVITY::getNumberOfNodesInType(medGeometryElement Type) const /*! Returns the number of geometric sub cells of %medGeometryElement type. not implemented for MED_ALL_ELEMENTS nor for MED_NONE */ //------------------------------------------------------------------------// -med_int CONNECTIVITY::getNumberOfSubCellInType(medGeometryElement Type) const +int CONNECTIVITY::getNumberOfSubCellInType(medGeometryElement Type) const //------------------------------------------------------------------------// { if ((Type==MED_ALL_ELEMENTS) || (Type==MED_NONE)) throw MEDEXCEPTION("CONNECTIVITY::getNumberOfSubCell : medGeometryElement must be different of MED_ALL_ELEMENTS and MED_NONE!"); - for (med_int i=0; i<_numberOfTypes; i++) + for (int i=0; i<_numberOfTypes; i++) if (_geometricTypes[i]==Type) return _type[i].getNumberOfConstituents(1); throw MEDEXCEPTION("CONNECTIVITY::getNumberOfSubCell : medGeometryElement not found !"); @@ -973,7 +974,7 @@ med_int CONNECTIVITY::getNumberOfSubCellInType(medGeometryElement Type) const - Not implemented for MED_ALL_ENTITIES (A VERIFIER) - Not implemented for MED_NONE */ //-----------------------------------------------------------------------------------// -med_int CONNECTIVITY::getNumberOf(medEntityMesh Entity, medGeometryElement Type) const +int CONNECTIVITY::getNumberOf(medEntityMesh Entity, medGeometryElement Type) const //-----------------------------------------------------------------------------------// { const char * LOC = "CONNECTIVITY::getNumberOf"; @@ -987,7 +988,7 @@ med_int CONNECTIVITY::getNumberOf(medEntityMesh Entity, medGeometryElement Type) //throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<" : medGeometryElement must be different of MED_NONE")); if (Type==MED_ALL_ELEMENTS) return _count[_numberOfTypes]-1; - for (med_int i=0; i<_numberOfTypes; i++) + for (int i=0; i<_numberOfTypes; i++) if (_geometricTypes[i]==Type) return (_count[i+1] - _count[i]); //throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<" : medGeometryElement not found !")); @@ -1001,7 +1002,7 @@ med_int CONNECTIVITY::getNumberOf(medEntityMesh Entity, medGeometryElement Type) /*! A DOCUMENTER */ //--------------------------------------------------------------// -const med_int* CONNECTIVITY::getValue(medConnectivity TypeConnectivity, +const int* CONNECTIVITY::getValue(medConnectivity TypeConnectivity, medGeometryElement Type) //--------------------------------------------------------------// { @@ -1010,7 +1011,7 @@ const med_int* CONNECTIVITY::getValue(medConnectivity TypeConnectivity, calculateNodalConnectivity(); if (Type==MED_ALL_ELEMENTS) return _nodal->getValue(); - for (med_int i=0; i<_numberOfTypes; i++) + for (int i=0; i<_numberOfTypes; i++) if (_geometricTypes[i]==Type) return _nodal->getI(_count[i]); } @@ -1019,7 +1020,7 @@ const med_int* CONNECTIVITY::getValue(medConnectivity TypeConnectivity, calculateDescendingConnectivity(); if (Type==MED_ALL_ELEMENTS) return _descending->getValue(); - for (med_int i=0; i<_numberOfTypes; i++) + for (int i=0; i<_numberOfTypes; i++) if (_geometricTypes[i]==Type) return _descending->getI(Type); } @@ -1028,7 +1029,7 @@ const med_int* CONNECTIVITY::getValue(medConnectivity TypeConnectivity, /*! A DOCUMENTER */ //---------------------------------------------------------------------// -const med_int* CONNECTIVITY:: getValueIndex(medConnectivity TypeConnectivity) +const int* CONNECTIVITY:: getValueIndex(medConnectivity TypeConnectivity) //---------------------------------------------------------------------// { if (TypeConnectivity == MED_NODAL) @@ -1045,7 +1046,7 @@ const med_int* CONNECTIVITY:: getValueIndex(medConnectivity TypeConnectivity) /*! Not yet implemented */ //----------------------------------------------// -const med_int* CONNECTIVITY:: getNeighbourhood() const +const int* CONNECTIVITY:: getNeighbourhood() const //----------------------------------------------// { throw MEDEXCEPTION("CONNECTIVITY::getNeighbourhood : Not implemented"); @@ -1054,7 +1055,7 @@ const med_int* CONNECTIVITY:: getNeighbourhood() const /*! Returns an array which contains, for each node, all cells arround it. */ //-------------------------------------------------// -const med_int* CONNECTIVITY::getReverseNodalConnectivity() +const int* CONNECTIVITY::getReverseNodalConnectivity() //-------------------------------------------------// { calculateReverseNodalConnectivity(); @@ -1064,7 +1065,7 @@ const med_int* CONNECTIVITY::getReverseNodalConnectivity() /*! Give index array to use with getReverseConnectivity(MED_NODAL). It is unusefull with MED_DESCENDING mode, because we have allways two cells. */ //-------------------------------------------------------// -const med_int* CONNECTIVITY::getReverseNodalConnectivityIndex() +const int* CONNECTIVITY::getReverseNodalConnectivityIndex() //-------------------------------------------------------// { calculateReverseNodalConnectivity(); @@ -1075,7 +1076,7 @@ const med_int* CONNECTIVITY::getReverseNodalConnectivityIndex() the 2 cells of each side. First is cell which face normal is outgoing. arround it. */ //------------------------------------------------------// -const med_int* CONNECTIVITY::getReverseDescendingConnectivity() +const int* CONNECTIVITY::getReverseDescendingConnectivity() //------------------------------------------------------// { // it is in _constituent connectivity only if we are in MED_CELL @@ -1091,7 +1092,7 @@ const med_int* CONNECTIVITY::getReverseDescendingConnectivity() /*! calculate the reverse descending Connectivity and returns the index ( A DOCUMENTER MIEUX)*/ //-----------------------------------------------------------// -const med_int* CONNECTIVITY::getReverseDescendingConnectivityIndex() +const int* CONNECTIVITY::getReverseDescendingConnectivityIndex() //-----------------------------------------------------------// { // it is in _constituent connectivity only if we are in MED_CELL @@ -1134,24 +1135,24 @@ void CONNECTIVITY::calculateReverseNodalConnectivity() if(_reverseNodalConnectivity==NULL) { - med_int node_number = 0; - vector > reverse_connectivity; + int node_number = 0; + vector > reverse_connectivity; reverse_connectivity.resize(_numberOfNodes+1); // Treat all cells types - for (med_int j = 0; j < _numberOfTypes; j++) + for (int j = 0; j < _numberOfTypes; j++) { // node number of the cell type node_number = _type[j].getNumberOfNodes(); // treat all cells of a particular type - for (med_int k = _count[j]; k < _count[j+1]; k++) + for (int k = _count[j]; k < _count[j+1]; k++) // treat all nodes of the cell type - for (med_int local_node_number = 1; + for (int local_node_number = 1; local_node_number < node_number+1; local_node_number++) { - med_int global_node = _nodal->getIJ(k,local_node_number); + int global_node = _nodal->getIJ(k,local_node_number); reverse_connectivity[global_node].push_back(k); } } @@ -1159,23 +1160,23 @@ void CONNECTIVITY::calculateReverseNodalConnectivity() // Full reverse_nodal_connectivity and reverse_nodal_connectivity_index //calculate size of reverse_nodal_connectivity array - med_int size_reverse_nodal_connectivity = 0; - for (med_int i = 1; i < _numberOfNodes+1; i++) + int size_reverse_nodal_connectivity = 0; + for (int i = 1; i < _numberOfNodes+1; i++) size_reverse_nodal_connectivity += reverse_connectivity[i].size(); //MEDSKYLINEARRAY * ReverseConnectivity = new MEDSKYLINEARRAY(_numberOfNodes,size_reverse_nodal_connectivity); - med_int * reverse_nodal_connectivity_index = new med_int[_numberOfNodes+1]; - med_int * reverse_nodal_connectivity = new med_int[size_reverse_nodal_connectivity]; - //const med_int * reverse_nodal_connectivity = ReverseConnectivity->getValue(); - //const med_int * reverse_nodal_connectivity_index = ReverseConnectivity->getIndex(); + int * reverse_nodal_connectivity_index = new int[_numberOfNodes+1]; + int * reverse_nodal_connectivity = new int[size_reverse_nodal_connectivity]; + //const int * reverse_nodal_connectivity = ReverseConnectivity->getValue(); + //const int * reverse_nodal_connectivity_index = ReverseConnectivity->getIndex(); reverse_nodal_connectivity_index[0] = 1; - for (med_int i = 1; i < _numberOfNodes+1; i++) + for (int i = 1; i < _numberOfNodes+1; i++) { - med_int size = reverse_connectivity[i].size(); + int size = reverse_connectivity[i].size(); reverse_nodal_connectivity_index[i] = reverse_nodal_connectivity_index[i-1] + size; - for (med_int j = 0; j < size; j++) + for (int j = 0; j < size; j++) reverse_nodal_connectivity[reverse_nodal_connectivity_index[i-1]-1+j]= reverse_connectivity[i][j]; } @@ -1290,9 +1291,9 @@ void CONNECTIVITY::calculateDescendingConnectivity() _constituent->_numberOfTypes = 2; _constituent->_geometricTypes = new medGeometryElement[_constituent->_numberOfTypes]; _constituent->_type = new CELLMODEL[_constituent->_numberOfTypes]; - _constituent->_count = new med_int[_constituent->_numberOfTypes+1]; + _constituent->_count = new int[_constituent->_numberOfTypes+1]; _constituent->_count[0]=1; - int* tmp_NumberOfConstituentsForeachType = new med_int[_constituent->_numberOfTypes+1]; + int* tmp_NumberOfConstituentsForeachType = new int[_constituent->_numberOfTypes+1]; tmp_NumberOfConstituentsForeachType[0]=0; // to count constituent of each type for (int i=0; i<_constituent->_numberOfTypes;i++) { _constituent->_geometricTypes[i]=ConstituentsTypes[i]; @@ -1690,7 +1691,7 @@ ostream & MEDMEM::operator<<(ostream &os, CONNECTIVITY &co) { os << endl << co._type[i].getName() << " : " << endl; int numberofelements = co._count[i+1]-co._count[i]; - const med_int * connectivity = co.getConnectivity(co._typeConnectivity, co._entity, co._geometricTypes[i]); + const int * connectivity = co.getConnectivity(co._typeConnectivity, co._entity, co._geometricTypes[i]); int numberofnodespercell = co._geometricTypes[i]%100; for (int j=0;j myFamilies); virtual void updateGroup (vector myFamilies); - inline medEntityMesh getEntity () const; - inline med_int getNumberOfTypes (medEntityMesh Entity) const; - inline const medGeometryElement * getGeometricTypes (medEntityMesh Entity) const + inline MED_EN::medEntityMesh getEntity () const; + inline int getNumberOfTypes (MED_EN::medEntityMesh Entity) const; + inline const MED_EN::medGeometryElement * getGeometricTypes (MED_EN::medEntityMesh Entity) const throw (MEDEXCEPTION); - medGeometryElement getElementType (medEntityMesh Entity, + MED_EN::medGeometryElement getElementType (MED_EN::medEntityMesh Entity, int Number) const; - virtual inline const int * getGlobalNumberingIndex (medEntityMesh Entity) const + virtual inline const int * getGlobalNumberingIndex (MED_EN::medEntityMesh Entity) const throw (MEDEXCEPTION); - virtual const med_int * getConnectivity (medConnectivity ConnectivityType, - medEntityMesh Entity, - medGeometryElement Type); - virtual const med_int * getConnectivityIndex (medConnectivity ConnectivityType, - medEntityMesh Entity); + virtual const int * getConnectivity (MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity, + MED_EN::medGeometryElement Type); + virtual const int * getConnectivityIndex (MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity); - const CELLMODEL & getType (medGeometryElement Type) const; - const CELLMODEL * getCellsTypes (medEntityMesh Entity) const + const CELLMODEL & getType (MED_EN::medGeometryElement Type) const; + const CELLMODEL * getCellsTypes (MED_EN::medEntityMesh Entity) const throw (MEDEXCEPTION); - med_int getNumberOfNodesInType (medGeometryElement Type) const; - med_int getNumberOfSubCellInType (medGeometryElement Type) const; - virtual med_int getNumberOf (medEntityMesh Entity, - medGeometryElement Type) const; - virtual const med_int* getValue (medConnectivity TypeConnectivity, - medGeometryElement Type); - virtual const med_int* getValueIndex (medConnectivity TypeConnectivity); - - virtual inline const med_int* getReverseConnectivity (medConnectivity ConnectivityType, - medEntityMesh Entity=MED_CELL) + int getNumberOfNodesInType (MED_EN::medGeometryElement Type) const; + int getNumberOfSubCellInType (MED_EN::medGeometryElement Type) const; + virtual int getNumberOf (MED_EN::medEntityMesh Entity, + MED_EN::medGeometryElement Type) const; + virtual const int* getValue (MED_EN::medConnectivity TypeConnectivity, + MED_EN::medGeometryElement Type); + virtual const int* getValueIndex (MED_EN::medConnectivity TypeConnectivity); + + virtual inline const int* getReverseConnectivity (MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity=MED_EN::MED_CELL) throw (MEDEXCEPTION); - virtual inline const med_int* getReverseConnectivityIndex (medConnectivity ConnectivityType, - medEntityMesh Entity=MED_CELL) + virtual inline const int* getReverseConnectivityIndex (MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity=MED_EN::MED_CELL) throw (MEDEXCEPTION); - const med_int* getNeighbourhood() const; + const int* getNeighbourhood() const; -}; }; /*----------------------*/ /* Methodes Inline */ /*----------------------*/ -using namespace MEDMEM; /*! Returns the medEntityMesh */ //--------------------------------------------------// -inline medEntityMesh CONNECTIVITY::getEntity() const +inline MED_EN::medEntityMesh CONNECTIVITY::getEntity() const //--------------------------------------------------// { return _entity; @@ -211,14 +207,14 @@ inline medEntityMesh CONNECTIVITY::getEntity() const existing in the specified entity. \n Note : Not implemented for MED_ALL_ENTITIES. */ //-----------------------------------------------------------------------// -inline med_int CONNECTIVITY::getNumberOfTypes(medEntityMesh Entity) const +inline int CONNECTIVITY::getNumberOfTypes(MED_EN::medEntityMesh Entity) const //-----------------------------------------------------------------------// { MESSAGE("CONNECTIVITY::getNumberOfTypes : Entity = "<getNumberOfTypes(Entity); // } else - return 0; // because it is the right information (no exception needed)! + return 0; // because it is the right information (no exception needed)! } /*! Returns an array of all %medGeometryElement types existing in the mesh @@ -255,7 +251,7 @@ inline med_int CONNECTIVITY::getNumberOfTypes(medEntityMesh Entity) const Note : Not implemented for MED_ALL_ENTITIES. Throws an exception if Entity is unknown */ //------------------------------------------------------------------------------------------// -inline const medGeometryElement* CONNECTIVITY::getGeometricTypes(medEntityMesh Entity) const +inline const MED_EN::medGeometryElement* CONNECTIVITY::getGeometricTypes(MED_EN::medEntityMesh Entity) const throw (MEDEXCEPTION) //------------------------------------------------------------------------------------------// { @@ -282,7 +278,7 @@ inline const medGeometryElement* CONNECTIVITY::getGeometricTypes(medEntityMesh E */ //----------------------------------------------------------------------------------// -inline const int * CONNECTIVITY::getGlobalNumberingIndex(medEntityMesh Entity) const +inline const int * CONNECTIVITY::getGlobalNumberingIndex(MED_EN::medEntityMesh Entity) const throw (MEDEXCEPTION) //----------------------------------------------------------------------------------// { @@ -296,15 +292,15 @@ inline const int * CONNECTIVITY::getGlobalNumberingIndex(medEntityMesh Entity) c /*! Returns true if a connectivity exists on elements of type "Entity" */ //-----------------------------------------------------------------------------// -inline bool CONNECTIVITY::existConnectivity( medConnectivity ConnectivityType, - medEntityMesh Entity) const +inline bool CONNECTIVITY::existConnectivity( MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity) const //-----------------------------------------------------------------------------// { if (_entity==Entity) { MESSAGE("existConnectivity : _entity==Entity="<existConnectivity(ConnectivityType,Entity); @@ -317,7 +313,7 @@ in connectivity for given medEntityMesh (similar as getGeometricTypes).\n Throw an execption if the given entity is not defined or if the array is not defined. */ //-----------------------------------------------------------------------------// -inline const CELLMODEL * CONNECTIVITY::getCellsTypes(medEntityMesh Entity) const +inline const CELLMODEL * CONNECTIVITY::getCellsTypes(MED_EN::medEntityMesh Entity) const throw (MEDEXCEPTION) //-----------------------------------------------------------------------------// { @@ -336,15 +332,15 @@ inline const CELLMODEL * CONNECTIVITY::getCellsTypes(medEntityMesh Entity) const /*! A DOCUMENTER */ //------------------------------------------------------------------------------------------// -inline const med_int* CONNECTIVITY::getReverseConnectivity( medConnectivity ConnectivityType, - medEntityMesh Entity) +inline const int* CONNECTIVITY::getReverseConnectivity( MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity) throw (MEDEXCEPTION) //------------------------------------------------------------------------------------------// { if(_entity==Entity) - if (ConnectivityType==MED_NODAL) + if (ConnectivityType==MED_EN::MED_NODAL) return getReverseNodalConnectivity(); - else if (ConnectivityType==MED_DESCENDING) + else if (ConnectivityType==MED_EN::MED_DESCENDING) return getReverseDescendingConnectivity(); else throw MEDEXCEPTION("MESH::getReverseConnectivity : connectivity mode not supported !"); @@ -357,15 +353,15 @@ inline const med_int* CONNECTIVITY::getReverseConnectivity( medConnectivity Conn /*! A DOCUMENTER */ //-----------------------------------------------------------------------------------------------// -inline const med_int* CONNECTIVITY::getReverseConnectivityIndex(medConnectivity ConnectivityType, - medEntityMesh Entity) +inline const int* CONNECTIVITY::getReverseConnectivityIndex(MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity) throw (MEDEXCEPTION) //-----------------------------------------------------------------------------------------------// { if(_entity==Entity) - if (ConnectivityType==MED_NODAL) + if (ConnectivityType==MED_EN::MED_NODAL) return getReverseNodalConnectivityIndex(); - else if (ConnectivityType==MED_DESCENDING) + else if (ConnectivityType==MED_EN::MED_DESCENDING) return getReverseDescendingConnectivityIndex(); else throw MEDEXCEPTION("MESH::getReverseConnectivityIndex : connectivity mode not supported !"); @@ -377,20 +373,22 @@ inline const med_int* CONNECTIVITY::getReverseConnectivityIndex(medConnectivity } -inline void CONNECTIVITY::setNumberOfNodes(med_int NumberOfNodes) +inline void CONNECTIVITY::setNumberOfNodes(int NumberOfNodes) { _numberOfNodes=NumberOfNodes; } -inline void CONNECTIVITY::setEntityDimension(med_int EntityDimension) +inline void CONNECTIVITY::setEntityDimension(int EntityDimension) { _entityDimension=EntityDimension; } -med_int CONNECTIVITY::getEntityDimension() const +int CONNECTIVITY::getEntityDimension() const { return _entityDimension; } +}//End namespace MEDMEM + #endif /* CONNECTIVITY_HXX */ diff --git a/src/MEDMEM/MEDMEM_Coordinate.cxx b/src/MEDMEM/MEDMEM_Coordinate.cxx index 04451dcae..6b0ab18af 100644 --- a/src/MEDMEM/MEDMEM_Coordinate.cxx +++ b/src/MEDMEM/MEDMEM_Coordinate.cxx @@ -1,10 +1,12 @@ -using namespace std; #include "MEDMEM_Coordinate.hxx" #include "MEDMEM_Exception.hxx" #include "MEDMEM_STRING.hxx" #include "utilities.h" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; /*! Default Constructor : should not be used */ //----------------------------------------------------------// @@ -33,6 +35,25 @@ COORDINATE::COORDINATE(int SpaceDimension, int NumberOfNodes, medModeSwitch Mode BEGIN_OF("Constructor COORDINATE"); } +/*! This constructor is specialy designed for use in class GRID.\n + * The purpose is to create a COORDINATE without allocating memory for nodes (in the MEDARRAY). + * The allocation (call to setCoordinates) is performed afterward by GRID, if necessary. + * We set _coordinateName & _coordinateUnit in the constructor, because calls to setCoordinateName + * and setCoordinateUnit are not possible before allocation of MEDARRAY. + */ +//------------------------------------------------------------------------------// +COORDINATE::COORDINATE(int SpaceDimension,const string * CoordinateName, const string * CoordinateUnit): + _coordinateSystem(""), _coordinate(MEDARRAY()), _coordinateName(SpaceDimension), + _coordinateUnit(SpaceDimension), _nodeNumber() +{ + for (int i=0; i *Coordinate,bool shallowCopy=false); - void setCoordinates(const medModeSwitch Mode, const double *Coordinate); + void setCoordinates(const MED_EN::medModeSwitch Mode, const double *Coordinate); void setCoordinatesNames(const string * CoordinateName); void setCoordinateName(const string CoordinateName, const int i); void setCoordinatesUnits(const string * CoordinateUnit); @@ -80,7 +81,7 @@ public : //const int* getNodesNumbers() ; string getCoordinatesSystem() const; - virtual const double * getCoordinates(medModeSwitch Mode); + virtual const double * getCoordinates(MED_EN::medModeSwitch Mode); virtual double getCoordinate(int Number,int Axis); virtual const double * getCoordinateAxis(int Axis); diff --git a/src/MEDMEM/MEDMEM_DriverFactory.hxx b/src/MEDMEM/MEDMEM_DriverFactory.hxx index a233b3cb4..4ca108492 100644 --- a/src/MEDMEM/MEDMEM_DriverFactory.hxx +++ b/src/MEDMEM/MEDMEM_DriverFactory.hxx @@ -2,6 +2,8 @@ #define DRIVERFACTORY_HXX #include "MEDMEM_GenDriver.hxx" +#include "MEDMEM_VtkFieldDriver.hxx" +#include "MEDMEM_MedFieldDriver.hxx" #include namespace MEDMEM { @@ -16,13 +18,6 @@ namespace MEDMEM { GENDRIVER *buildDriverForField(driverTypes driverType, const std::string & fileName, FIELD *field); GENDRIVER *buildDriverForMed(driverTypes driverType, const std::string & fileName, MED *med); } - -} - -#include "MEDMEM_VtkFieldDriver.hxx" -#include "MEDMEM_MedFieldDriver.hxx" - -using namespace MEDMEM; template GENDRIVER *DRIVERFACTORY::buildDriverForField(driverTypes driverType, const std::string & fileName, FIELD *field) @@ -60,4 +55,6 @@ GENDRIVER *DRIVERFACTORY::buildDriverForField(driverTypes driverType, const std: return ret; } +} + #endif diff --git a/src/MEDMEM/MEDMEM_DriverTools.cxx b/src/MEDMEM/MEDMEM_DriverTools.cxx index ba616891f..2a6ed3cbd 100644 --- a/src/MEDMEM/MEDMEM_DriverTools.cxx +++ b/src/MEDMEM/MEDMEM_DriverTools.cxx @@ -1,4 +1,3 @@ -using namespace std; #include "MEDMEM_DriverTools.hxx" #include "MEDMEM_STRING.hxx" #include "MEDMEM_Exception.hxx" @@ -6,8 +5,10 @@ using namespace std; #include "MEDMEM_Group.hxx" #include #include -using namespace MEDMEM; +using namespace std; +using namespace MEDMEM; +using namespace MED_EN; // Cet opérateur permet d'ordonner les mailles dans un set suivant l'ordre requis par MED bool _maille::operator < (const _maille& ma) const @@ -86,7 +87,12 @@ std::ostream& MEDMEM::operator << (std::ostream& os, const _groupe& gr) for( std::vector::const_iterator i=gr.groupes.begin(); i!=gr.groupes.end(); ++i) os << *i << " "; os << std::endl << " -> liste des mailles : " << std::endl; - for( _groupe::mailleIter i=gr.mailles.begin(); i!=gr.mailles.end(); i++) + std::set< std::set< _maille, std::less< _maille >, + std::allocator< _maille > >::iterator, + _mailleIteratorCompare, + std::allocator< std::set< _maille, std::less< _maille >, + std::allocator< _maille > >::iterator > >::const_iterator i ; + for( i=gr.mailles.begin(); i!=gr.mailles.end(); i++) os << " " << *(*i) << std::endl; return os; } @@ -279,7 +285,7 @@ _intermediateMED::getConnectivity() { for ( unsigned n=0; n != j->sommets.size(); ++n) connectivity[nbSommetsParMaille*l+n] = j->sommets[n]->second.number; - maillage.erase(j); ; // dangereux, mais optimise la mémoire consommée! + //CCRT maillage.erase(j); ; // dangereux, mais optimise la mémoire consommée! } Connectivity->setNodal (connectivity, entity, vtype[k]); @@ -331,7 +337,12 @@ _intermediateMED::getGroups(std::vector & _groupCell, std::vector, + std::allocator< _maille > >::iterator, + _mailleIteratorCompare, + std::allocator< std::set< _maille, std::less<_maille >, + std::allocator< _maille > >::iterator > >::iterator j ; + j=groupes[i].mailles.begin(); // initialise groupe_entity a l'entite de la premiere maille du groupe medEntityMesh groupe_entity = (**j).getEntity(dimension_maillage); medGeometryElement geometrictype=(**j).geometricType; diff --git a/src/MEDMEM/MEDMEM_DriversDef.cxx b/src/MEDMEM/MEDMEM_DriversDef.cxx index 2d38da5e8..46aa2e095 100644 --- a/src/MEDMEM/MEDMEM_DriversDef.cxx +++ b/src/MEDMEM/MEDMEM_DriversDef.cxx @@ -1,8 +1,8 @@ -using namespace std; #include "MEDMEM_DriversDef.hxx" -namespace MED_FR -{ +using namespace std; + +namespace MED_EN { // Returns the (string) name of the geometry of // an element given by a med_geometrie_element value @@ -35,7 +35,7 @@ GEO_NAME::~GEO_NAME() // MESSAGE(" end of destructor GEO_NAME::~GEO_NAME() "<< size() ); } -string & GEO_NAME::operator[]( const med_geometrie_element &c ) const +string & GEO_NAME::operator[]( const MED_EN::medGeometryElement &c ) const { map &table = (map&)*this ; assert( table.find( (int)c ) != table.end() ) ; @@ -49,10 +49,10 @@ string & GEO_NAME::operator[]( const med_geometrie_element &c ) const ENT_NAME::ENT_NAME() : map() { map &table = (map&)*this ; - table[(int)MED_MAILLE ] = "MED_MAILLE"; + table[(int)MED_CELL ] = "MED_MAILLE"; table[(int)MED_FACE ] = "MED_FACE"; - table[(int)MED_ARETE ] = "MED_ARETE"; - table[(int)MED_NOEUD ] = "MED_NOEUD"; + table[(int)MED_EDGE ] = "MED_ARETE"; + table[(int)MED_NODE ] = "MED_NOEUD"; } ENT_NAME::~ENT_NAME() @@ -62,21 +62,21 @@ ENT_NAME::~ENT_NAME() // MESSAGE(" end of destructor ENT_NAME::~ENT_NAME() "<< size() ); } -string & ENT_NAME::operator[]( const med_entite_maillage &c ) const +string & ENT_NAME::operator[]( const MED_EN::medEntityMesh &c ) const { map &table = (map&)*this ; assert( table.find( (int)c ) != table.end() ) ; return table[ (int)c ] ; } -MESH_ENTITIES::MESH_ENTITIES () : map >() +MESH_ENTITIES::MESH_ENTITIES () : map >() { // Override the const declaration in order to used the find method below // map > &table = (map >&)*this ; unused local variable // Initialize the value associated with the ROUGE_ key ( use the private operator = ) { - const med_geometrie_element T[] = { + const MED_EN::medGeometryElement T[] = { MED_POINT1, MED_SEG2, MED_SEG3, @@ -93,35 +93,35 @@ MESH_ENTITIES::MESH_ENTITIES () : map >() MED_PENTA15, MED_HEXA20}; - static const list geomList(T,T+sizeof(T)/sizeof(med_geometrie_element)); - (*this)[MED_MAILLE] = geomList; + static const list geomList(T,T+sizeof(T)/sizeof(MED_EN::medGeometryElement)); + (*this)[MED_CELL] = geomList; } { - const med_geometrie_element T[] = { + const MED_EN::medGeometryElement T[] = { MED_TRIA3, MED_QUAD4, MED_TRIA6, MED_QUAD8}; - static const list geomList(T,T+sizeof(T)/sizeof(med_geometrie_element)); + static const list geomList(T,T+sizeof(T)/sizeof(MED_EN::medGeometryElement)); (*this)[MED_FACE] = geomList; } { - const med_geometrie_element T[] = { + const MED_EN::medGeometryElement T[] = { MED_SEG2, MED_SEG3 }; - static const list geomList(T,T+sizeof(T)/sizeof(med_geometrie_element)); - (*this)[MED_ARETE] = geomList; + static const list geomList(T,T+sizeof(T)/sizeof(MED_EN::medGeometryElement)); + (*this)[MED_EDGE] = geomList; } { // const med_geometrie_element T[] = { MED_NONE }; - const med_geometrie_element T[] = { (med_geometrie_element)0 }; - static const list geomList(T,T+sizeof(T)/sizeof(med_geometrie_element)); - (*this)[MED_NOEUD] = geomList; + const MED_EN::medGeometryElement T[] = { (MED_EN::medGeometryElement)0 }; + static const list geomList(T,T+sizeof(T)/sizeof(MED_EN::medGeometryElement)); + (*this)[MED_NODE] = geomList; } } @@ -133,18 +133,19 @@ MESH_ENTITIES::~MESH_ENTITIES() // MESSAGE(" end of destructor MESH_ENTITIES::~MESH_ENTITIES() "<< size() ); } -const list & MESH_ENTITIES::operator[]( const med_entite_maillage &c ) const +const list & MESH_ENTITIES::operator[]( const MED_EN::medEntityMesh &c ) const { - map > &table = (map >&)*this ; + map > &table = (map >&)*this ; // Verify the object already exists in the map assert( table.find( (int)c ) != table.end() ) ; return table[ (int)c ] ; } // This operator is used to initialize class objects of type const list -list & MESH_ENTITIES::operator[]( const med_entite_maillage &c ) +list & MESH_ENTITIES::operator[]( const MED_EN::medEntityMesh &c ) { - return (list &) this->map >::operator[]( (int)c) ; + return (list &) this->map >::operator[]( (int)c) ; } -} // End Of NameSpace MED_FR +} // End Of NampeSpace MED_EN + diff --git a/src/MEDMEM/MEDMEM_DriversDef.hxx b/src/MEDMEM/MEDMEM_DriversDef.hxx index 7bf078274..e0ac440ba 100644 --- a/src/MEDMEM/MEDMEM_DriversDef.hxx +++ b/src/MEDMEM/MEDMEM_DriversDef.hxx @@ -10,8 +10,8 @@ using namespace std ; #include "MEDMEM_define.hxx" #include "utilities.h" -namespace MED_FR { +namespace MED_EN { /*! This Class inherits from map. \n It is a constant map association int (which is a med_geometrie_element) and string. \n Operator [] returns the (string) name of the geometry of an element @@ -28,7 +28,7 @@ public : GEO_NAME(); ~GEO_NAME(); - string & operator[]( const MED_FR::med_geometrie_element &c ) const; + string & operator[]( const MED_EN::medGeometryElement &c ) const; } ; static const GEO_NAME geoNames ; @@ -52,7 +52,7 @@ public : ENT_NAME (); ~ENT_NAME(); - string & operator[]( const MED_FR::med_entite_maillage &c ) const; + string & operator[]( const MED_EN::medEntityMesh &c ) const; } ; static const ENT_NAME entNames ; @@ -69,7 +69,7 @@ static const ENT_NAME entNames ; //-------------------------------------------------------------------------------- -class MESH_ENTITIES : public map > +class MESH_ENTITIES : public map > //-------------------------------------------------------------------------------- { @@ -77,18 +77,18 @@ public : MESH_ENTITIES (); ~MESH_ENTITIES(); - const list & operator[]( const MED_FR::med_entite_maillage &c ) const; + const list & operator[]( const MED_EN::medEntityMesh &c ) const; private: /*! This operator is used to initialize class objects of type const list */ - list & operator[]( const MED_FR::med_entite_maillage &c ); + list & operator[]( const MED_EN::medEntityMesh &c ); } ; static const MESH_ENTITIES meshEntities ; -} // End Of NameSpace MED_FR +} // End Of NameSpace MED_EN #endif diff --git a/src/MEDMEM/MEDMEM_Exception.cxx b/src/MEDMEM/MEDMEM_Exception.cxx index cfe4281c8..f6969932b 100644 --- a/src/MEDMEM/MEDMEM_Exception.cxx +++ b/src/MEDMEM/MEDMEM_Exception.cxx @@ -1,13 +1,12 @@ -using namespace std; /* File MedException.cxx $Header$ */ -using namespace std; - #include "utilities.h" #include "MEDMEM_Exception.hxx" + +using namespace std; using namespace MEDMEM; extern "C" @@ -17,7 +16,6 @@ extern "C" #include } - /*! \internal Function used to duplicate char * diff --git a/src/MEDMEM/MEDMEM_Exception.hxx b/src/MEDMEM/MEDMEM_Exception.hxx index 3ea508ce0..156b7d607 100644 --- a/src/MEDMEM/MEDMEM_Exception.hxx +++ b/src/MEDMEM/MEDMEM_Exception.hxx @@ -23,7 +23,7 @@ using namespace std; */ namespace MEDMEM { //--------------------------------------// - class MEDEXCEPTION : public exception + class MEDEXCEPTION : public std::exception //--------------------------------------// { private : diff --git a/src/MEDMEM/MEDMEM_Family.cxx b/src/MEDMEM/MEDMEM_Family.cxx index ebb818c09..5a8f99fb4 100644 --- a/src/MEDMEM/MEDMEM_Family.cxx +++ b/src/MEDMEM/MEDMEM_Family.cxx @@ -1,4 +1,3 @@ -using namespace std; /* File MEDMEM_Family.cxx $Header$ @@ -6,7 +5,10 @@ using namespace std; #include "MEDMEM_Mesh.hxx" #include "MEDMEM_Family.hxx" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; FAMILY::FAMILY():_identifier(0), _numberOfAttribute(0), _attributeIdentifier((int*)NULL),_attributeValue((int*)NULL), _attributeDescription((string*)NULL), diff --git a/src/MEDMEM/MEDMEM_Family.hxx b/src/MEDMEM/MEDMEM_Family.hxx index ea8a45edf..468dbeeb2 100644 --- a/src/MEDMEM/MEDMEM_Family.hxx +++ b/src/MEDMEM/MEDMEM_Family.hxx @@ -97,7 +97,7 @@ public: friend ostream & operator<<(ostream &os, const FAMILY &my) ; - bool build(medEntityMesh Entity,int **FamilyNumber); + bool build(MED_EN::medEntityMesh Entity,int **FamilyNumber); inline void setIdentifier (int Identifier); inline void setNumberOfAttributes (int NumberOfAttribute); @@ -121,9 +121,7 @@ public: inline string getAttributeDescription(int i) const; inline string getGroupName(int i) const; }; -}; -using namespace MEDMEM; // inline methods : /*! Sets the attribute _identifier to Identifier. */ //---------------------------------------------- @@ -264,4 +262,6 @@ inline string FAMILY::getGroupName(int i) const { return _groupName[i-1] ; } + +}//End namespace MEDMEM #endif /* FAMILY_HXX */ diff --git a/src/MEDMEM/MEDMEM_Field.cxx b/src/MEDMEM/MEDMEM_Field.cxx index 9b7fc3294..9ad9c436e 100644 --- a/src/MEDMEM/MEDMEM_Field.cxx +++ b/src/MEDMEM/MEDMEM_Field.cxx @@ -1,7 +1,9 @@ -using namespace std; #include "MEDMEM_Field.hxx" #include "MEDMEM_Mesh.hxx" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; // --------------------------------- // FIELD_ : Constructors diff --git a/src/MEDMEM/MEDMEM_Field.hxx b/src/MEDMEM/MEDMEM_Field.hxx index cb71ce4f4..0f1f6903c 100644 --- a/src/MEDMEM/MEDMEM_Field.hxx +++ b/src/MEDMEM/MEDMEM_Field.hxx @@ -20,8 +20,6 @@ #include "MEDMEM_GenDriver.hxx" #include "MEDMEM_DriverFactory.hxx" -using namespace MED_EN; - /*! This class contains all the informations related with a template class FIELD : @@ -126,7 +124,7 @@ protected: // template < > struct SET_VALUE_TYPE { static const med_type_champ _valueType = MED_EN::MED_REEL64; } // template < > struct SET_VALUE_TYPE { static const med_type_champ _valueType = MED_EN::MED_INT32; } // static const med_type_champ _valueType = SET_VALUE_TYPE ::_valueType; - med_type_champ _valueType ; + MED_EN::med_type_champ _valueType ; vector _drivers; // Storage of the drivers currently in use static void _checkFieldCompatibility(const FIELD_& m, const FIELD_& n ) throw (MEDEXCEPTION); @@ -215,16 +213,14 @@ public: inline void setOrderNumber(int OrderNumber); inline int getOrderNumber() const; - inline void setValueType (const med_type_champ ValueType) ; - inline med_type_champ getValueType () const; + inline void setValueType (const MED_EN::med_type_champ ValueType) ; + inline MED_EN::med_type_champ getValueType () const; }; -}; // --------------------------------- // Implemented Methods : constructor // --------------------------------- -using namespace MEDMEM; // ----------------- // Methodes Inline @@ -260,7 +256,7 @@ inline string FIELD_::getDescription() const /*! Set FIELD number of components. */ -inline void FIELD_::setNumberOfComponents(int NumberOfComponents) +inline void FIELD_::setNumberOfComponents(const int NumberOfComponents) { _numberOfComponents=NumberOfComponents; } @@ -276,7 +272,7 @@ inline int FIELD_::getNumberOfComponents() const It must be the same than in the associated SUPPORT object. */ -inline void FIELD_::setNumberOfValues(int NumberOfValues) +inline void FIELD_::setNumberOfValues(const int NumberOfValues) { _numberOfValues=NumberOfValues; } @@ -513,18 +509,20 @@ inline void FIELD_::setSupport(const SUPPORT * support) /*! Get the FIELD med value type (MED_INT32 or MED_REEL64). */ -inline med_type_champ FIELD_::getValueType () const +inline MED_EN::med_type_champ FIELD_::getValueType () const { return _valueType ; } /*! Set the FIELD med value type (MED_INT32 or MED_REEL64). */ -inline void FIELD_::setValueType (const med_type_champ ValueType) +inline void FIELD_::setValueType (const MED_EN::med_type_champ ValueType) { _valueType = ValueType ; } +}//End namespace MEDMEM + ///////////////////////// // END OF CLASS FIELD_ // ///////////////////////// @@ -551,19 +549,19 @@ protected: MEDARRAY *_value ; private: - void _operation(const FIELD& m,const FIELD& n, const medModeSwitch mode, char* Op); + void _operation(const FIELD& m,const FIELD& n, const MED_EN::medModeSwitch mode, char* Op); void _operationInitialize(const FIELD& m,const FIELD& n, char* Op); - void _add_in_place(const FIELD& m,const FIELD& n, const medModeSwitch mode); - void _sub_in_place(const FIELD& m,const FIELD& n, const medModeSwitch mode); - void _mul_in_place(const FIELD& m,const FIELD& n, const medModeSwitch mode); - void _div_in_place(const FIELD& m,const FIELD& n, const medModeSwitch mode); + void _add_in_place(const FIELD& m,const FIELD& n, const MED_EN::medModeSwitch mode); + void _sub_in_place(const FIELD& m,const FIELD& n, const MED_EN::medModeSwitch mode); + void _mul_in_place(const FIELD& m,const FIELD& n, const MED_EN::medModeSwitch mode); + void _div_in_place(const FIELD& m,const FIELD& n, const MED_EN::medModeSwitch mode) throw (MEDEXCEPTION); //setValueType() ; FIELD & operator=(const FIELD &m); // A FAIRE public: FIELD(); FIELD(const FIELD &m); - FIELD(const SUPPORT * Support, const int NumberOfComponents, const medModeSwitch Mode=MED_FULL_INTERLACE) throw (MEDEXCEPTION) ; // Ajout NB Constructeur FIELD avec allocation de memoire de tous ses attribut + FIELD(const SUPPORT * Support, const int NumberOfComponents, const MED_EN::medModeSwitch Mode=MED_EN::MED_FULL_INTERLACE) throw (MEDEXCEPTION) ; // Ajout NB Constructeur FIELD avec allocation de memoire de tous ses attribut FIELD(const SUPPORT * Support, driverTypes driverType, const string & fileName="", const string & fieldName="", const int iterationNumber = -1, const int orderNumber = -1) @@ -621,13 +619,13 @@ public: inline void setValue(MEDARRAY *Value); inline MEDARRAY* getvalue() const; - inline int getValueLength(medModeSwitch Mode) const; - inline const T* getValue(medModeSwitch Mode) const; - inline const T* getValueI(medModeSwitch Mode,int i) const; + inline int getValueLength(MED_EN::medModeSwitch Mode) const; + inline const T* getValue(MED_EN::medModeSwitch Mode) const; + inline const T* getValueI(MED_EN::medModeSwitch Mode,int i) const; inline T getValueIJ(int i,int j) const; - inline void setValue(medModeSwitch mode, T* value); - inline void setValueI(medModeSwitch mode, int i, T* value); + inline void setValue(MED_EN::medModeSwitch mode, T* value); + inline void setValueI(MED_EN::medModeSwitch mode, int i, T* value); inline void setValueIJ(int i, int j, T value); /*! @@ -682,12 +680,10 @@ public: */ void getBarycenter() const throw (MEDEXCEPTION) ; }; -}; // -------------------- // Implemented Methods // -------------------- -using namespace MEDMEM; /*! Constructor with no parameter, most of the attribut members are set to NULL. @@ -703,7 +699,7 @@ template FIELD::FIELD(): attribut is allocated but not set. */ template FIELD::FIELD(const SUPPORT * Support, - const int NumberOfComponents, const medModeSwitch Mode) throw (MEDEXCEPTION) : + const int NumberOfComponents, const MED_EN::medModeSwitch Mode) throw (MEDEXCEPTION) : FIELD_(Support, NumberOfComponents) { BEGIN_OF("FIELD::FIELD(const SUPPORT * Support, const int NumberOfComponents, const medModeSwitch Mode)"); @@ -791,7 +787,7 @@ const FIELD FIELD::operator+(const FIELD & m) const FIELD_::_checkFieldCompatibility(*this, m); // may throw exception // Select mode : avoid if possible any calculation of other mode for fields m or *this - medModeSwitch mode; + MED_EN::medModeSwitch mode; if(this->getvalue()->getMode()==m.getvalue()->getMode() || this->getvalue()->isOtherCalculated()) mode=m.getvalue()->getMode(); else @@ -818,7 +814,7 @@ FIELD& FIELD::operator+=(const FIELD & m) FIELD_::_checkFieldCompatibility(*this, m); // may throw exception // We choose to keep *this mode, even if it may cost a re-calculation for m - medModeSwitch mode=this->getvalue()->getMode(); + MED_EN::medModeSwitch mode=this->getvalue()->getMode(); const T* value1=m.getValue(mode); // get pointers to the values we are adding // get a non const pointer to the inside array of values and perform operation @@ -846,7 +842,7 @@ FIELD* FIELD::add(const FIELD& m, const FIELD& n) FIELD_::_checkFieldCompatibility(m, n); // may throw exception // Select mode : avoid if possible any calculation of other mode for fields m or *this - medModeSwitch mode; + MED_EN::medModeSwitch mode; if(m.getvalue()->getMode()==n.getvalue()->getMode() || n.getvalue()->isOtherCalculated()) mode=m.getvalue()->getMode(); else @@ -887,8 +883,7 @@ const FIELD FIELD::operator-(const FIELD & m) const BEGIN_OF("FIELD::operator-(const FIELD & m)"); FIELD_::_checkFieldCompatibility(*this, m); // may throw exception - // Select mode : avoid if possible any calculation of other mode for fields m or *this - medModeSwitch mode; + MED_EN::medModeSwitch mode; if(this->getvalue()->getMode()==m.getvalue()->getMode() || this->getvalue()->isOtherCalculated()) mode=m.getvalue()->getMode(); else @@ -909,7 +904,7 @@ const FIELD FIELD::operator-() const { BEGIN_OF("FIELD::operator-()"); - medModeSwitch mode=this->getvalue()->getMode(); + MED_EN::medModeSwitch mode=this->getvalue()->getMode(); // Creation of the result - memory is allocated by FIELD constructor FIELD result(this->getSupport(),this->getNumberOfComponents(),mode); // Atribute's initialization @@ -947,7 +942,7 @@ FIELD& FIELD::operator-=(const FIELD & m) FIELD_::_checkFieldCompatibility(*this, m); // may throw exception // We choose to keep *this mode, even if it may cost a re-calculation for m - medModeSwitch mode=this->getvalue()->getMode(); + MED_EN::medModeSwitch mode=this->getvalue()->getMode(); const T* value1=m.getValue(mode); // get pointers to the values we are adding // get a non const pointer to the inside array of values and perform operation @@ -976,7 +971,7 @@ FIELD* FIELD::sub(const FIELD& m, const FIELD& n) FIELD_::_checkFieldCompatibility(m, n); // may throw exception // Select mode : avoid if possible any calculation of other mode for fields m or *this - medModeSwitch mode; + MED_EN::medModeSwitch mode; if(m.getvalue()->getMode()==n.getvalue()->getMode() || n.getvalue()->isOtherCalculated()) mode=m.getvalue()->getMode(); else @@ -1018,7 +1013,7 @@ const FIELD FIELD::operator*(const FIELD & m) const FIELD_::_checkFieldCompatibility(*this, m); // may throw exception // Select mode : avoid if possible any calculation of other mode for fields m or *this - medModeSwitch mode; + MED_EN::medModeSwitch mode; if(this->getvalue()->getMode()==m.getvalue()->getMode() || this->getvalue()->isOtherCalculated()) mode=m.getvalue()->getMode(); else @@ -1045,7 +1040,7 @@ FIELD& FIELD::operator*=(const FIELD & m) FIELD_::_checkFieldCompatibility(*this, m); // may throw exception // We choose to keep *this mode, even if it may cost a re-calculation for m - medModeSwitch mode=this->getvalue()->getMode(); + MED_EN::medModeSwitch mode=this->getvalue()->getMode(); const T* value1=m.getValue(mode); // get pointers to the values we are adding // get a non const pointer to the inside array of values and perform operation @@ -1074,7 +1069,7 @@ FIELD* FIELD::mul(const FIELD& m, const FIELD& n) FIELD_::_checkFieldCompatibility(m, n); // may throw exception // Select mode : avoid if possible any calculation of other mode for fields m or *this - medModeSwitch mode; + MED_EN::medModeSwitch mode; if(m.getvalue()->getMode()==n.getvalue()->getMode() || n.getvalue()->isOtherCalculated()) mode=m.getvalue()->getMode(); else @@ -1117,7 +1112,7 @@ const FIELD FIELD::operator/(const FIELD & m) const FIELD_::_checkFieldCompatibility(*this, m); // may throw exception // Select mode : avoid if possible any calculation of other mode for fields m or *this - medModeSwitch mode; + MED_EN::medModeSwitch mode; if(this->getvalue()->getMode()==m.getvalue()->getMode() || this->getvalue()->isOtherCalculated()) mode=m.getvalue()->getMode(); else @@ -1145,7 +1140,7 @@ FIELD& FIELD::operator/=(const FIELD & m) FIELD_::_checkFieldCompatibility(*this, m); // may throw exception // We choose to keep *this mode, even if it may cost a re-calculation for m - medModeSwitch mode=this->getvalue()->getMode(); + MED_EN::medModeSwitch mode=this->getvalue()->getMode(); const T* value1=m.getValue(mode); // get pointers to the values we are adding // get a non const pointer to the inside array of values and perform operation @@ -1174,7 +1169,7 @@ FIELD* FIELD::div(const FIELD& m, const FIELD& n) FIELD_::_checkFieldCompatibility(m, n); // may throw exception // Select mode : avoid if possible any calculation of other mode for fields m or *this - medModeSwitch mode; + MED_EN::medModeSwitch mode; if(m.getvalue()->getMode()==n.getvalue()->getMode() || n.getvalue()->isOtherCalculated()) mode=m.getvalue()->getMode(); else @@ -1229,7 +1224,7 @@ void FIELD::_operationInitialize(const FIELD& m,const FIELD& n, char* Op) \endif */ template -void FIELD::_add_in_place(const FIELD& m,const FIELD& n, const medModeSwitch mode) +void FIELD::_add_in_place(const FIELD& m,const FIELD& n, const MED_EN::medModeSwitch mode) { // get pointers to the values we are adding const T* value1=m.getValue(mode); @@ -1253,7 +1248,7 @@ void FIELD::_add_in_place(const FIELD& m,const FIELD& n, const medModeSwitch \endif */ template -void FIELD::_sub_in_place(const FIELD& m,const FIELD& n, const medModeSwitch mode) +void FIELD::_sub_in_place(const FIELD& m,const FIELD& n, const MED_EN::medModeSwitch mode) { // get pointers to the values we are adding const T* value1=m.getValue(mode); @@ -1277,7 +1272,7 @@ void FIELD::_sub_in_place(const FIELD& m,const FIELD& n, const medModeSwitch \endif */ template -void FIELD::_mul_in_place(const FIELD& m,const FIELD& n, const medModeSwitch mode) +void FIELD::_mul_in_place(const FIELD& m,const FIELD& n, const MED_EN::medModeSwitch mode) { // get pointers to the values we are adding const T* value1=m.getValue(mode); @@ -1301,7 +1296,7 @@ void FIELD::_mul_in_place(const FIELD& m,const FIELD& n, const medModeSwitch \endif */ template -void FIELD::_div_in_place(const FIELD& m,const FIELD& n, const medModeSwitch mode) +void FIELD::_div_in_place(const FIELD& m,const FIELD& n, const MED_EN::medModeSwitch mode) throw (MEDEXCEPTION) { // get pointers to the values we are adding const T* value1=m.getValue(mode); @@ -1312,8 +1307,14 @@ void FIELD::_div_in_place(const FIELD& m,const FIELD& n, const medModeSwitch const int size=getNumberOfValues()*getNumberOfComponents(); SCRUTE(size); const T* endV1=value1+size; - for(;value1!=endV1; value1++,value2++,value++) + for(;value1!=endV1; value1++,value2++,value++){ + if ( *value2 == 0 ) { + string diagnosis; + diagnosis="FIELD::_div_in_place(...) : Divide by zero !"; + throw MEDEXCEPTION(diagnosis.c_str()); + } *value=(*value1)/(*value2); + } } /*! Return Max Norm @@ -1383,7 +1384,7 @@ template double FIELD::norm2() const throw (MEDEXCEPTION) template template void FIELD::applyFunc() { - medModeSwitch mode=getvalue()->getMode(); + MED_EN::medModeSwitch mode=getvalue()->getMode(); // get a non const pointer to the inside array of values and perform operation T * value=const_cast (getValue(mode)); @@ -1405,7 +1406,7 @@ void FIELD::applyFunc() */ template void FIELD::applyLin(T a, T b) { - medModeSwitch mode=getvalue()->getMode(); + MED_EN::medModeSwitch mode=getvalue()->getMode(); // get a non const pointer to the inside array of values and perform operation in place T * value=const_cast (getValue(mode)); @@ -1440,7 +1441,7 @@ template FIELD* FIELD::scalarProduct(const FIELD & m, const FIEL { FIELD_::_checkFieldCompatibility( m, n); // may throw exception // we need a MED_FULL_INTERLACE representation of m & n to compute the scalar product - const medModeSwitch mode=MED_FULL_INTERLACE; + const MED_EN::medModeSwitch mode=MED_EN::MED_FULL_INTERLACE; const int numberOfElements=m.getNumberOfValues(); // strictly positive const int NumberOfComponents=m.getNumberOfComponents(); // strictly positive @@ -2013,14 +2014,14 @@ template inline MEDARRAY* FIELD::getvalue() const /*! Return the actual length of the reference to values array returned by getValue. */ -template inline int FIELD::getValueLength(medModeSwitch Mode) const{ +template inline int FIELD::getValueLength(MED_EN::medModeSwitch Mode) const{ return _numberOfComponents*_numberOfValues; } /*! Return a reference to values array to read them. */ -template inline const T* FIELD::getValue(medModeSwitch Mode) const +template inline const T* FIELD::getValue(MED_EN::medModeSwitch Mode) const { return _value->get(Mode) ; } @@ -2029,13 +2030,13 @@ template inline const T* FIELD::getValue(medModeSwitch Mode) const Return a reference to i^{th} row or column - component - (depend on Mode value) of FIELD values array. */ -template inline const T* FIELD::getValueI(medModeSwitch Mode,int i) const +template inline const T* FIELD::getValueI(MED_EN::medModeSwitch Mode,int i) const { - if ( Mode == MED_FULL_INTERLACE ) + if ( Mode == MED_EN::MED_FULL_INTERLACE ) { return _value->getRow(i) ; } - ASSERT ( Mode == MED_NO_INTERLACE); + ASSERT ( Mode == MED_EN::MED_NO_INTERLACE); return _value->getColumn(i); } @@ -2052,7 +2053,7 @@ template inline T FIELD::getValueIJ(int i,int j) const Array must have right size. If not results are unpredicable. */ -template inline void FIELD::setValue(medModeSwitch mode, T* value) +template inline void FIELD::setValue(MED_EN::medModeSwitch mode, T* value) { _value->set(mode,value); } @@ -2060,12 +2061,12 @@ template inline void FIELD::setValue(medModeSwitch mode, T* value) /*! Update values array in FIELD with the given ones according to specified mode. */ -template inline void FIELD::setValueI(medModeSwitch mode, int i, T* value) +template inline void FIELD::setValueI(MED_EN::medModeSwitch mode, int i, T* value) { // PROVISOIRE : - if (MED_FULL_INTERLACE == mode) + if (MED_EN::MED_FULL_INTERLACE == mode) _value->setI(i,value); - else if (MED_NO_INTERLACE == mode) + else if (MED_EN::MED_NO_INTERLACE == mode) _value->setJ(i,value); else throw MEDEXCEPTION(LOCALIZED("FIELD::setValueI : bad medModeSwitch")) ; @@ -2183,4 +2184,6 @@ template void FIELD::getBarycenter() const throw (MEDEXCEPTION) END_OF(LOC); } +}//End namespace MEDMEM + #endif /* FIELD_HXX */ diff --git a/src/MEDMEM/MEDMEM_GenDriver.cxx b/src/MEDMEM/MEDMEM_GenDriver.cxx index e99ec8af4..a10a24e57 100644 --- a/src/MEDMEM/MEDMEM_GenDriver.cxx +++ b/src/MEDMEM/MEDMEM_GenDriver.cxx @@ -1,8 +1,10 @@ -using namespace std; #include "MEDMEM_GenDriver.hxx" #include "MEDMEM_STRING.hxx" #include "MEDMEM_Exception.hxx" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; GENDRIVER::GENDRIVER(): _id(MED_INVALID), _fileName(""), @@ -39,8 +41,6 @@ GENDRIVER & MEDMEM::GENDRIVER::operator=(const GENDRIVER & genDriver) _status = genDriver._status; _id = genDriver._id; return *this; - - END_OF(LOC); } void GENDRIVER::writeFrom ( void ) {}; @@ -68,8 +68,6 @@ int GENDRIVER::getId ( void) const { BEGIN_OF(LOC); return _id ; - - END_OF(LOC); }; string GENDRIVER::getFileName() const { @@ -78,8 +76,6 @@ string GENDRIVER::getFileName() const { BEGIN_OF(LOC); return _fileName; - - END_OF(LOC); } @@ -106,8 +102,6 @@ med_mode_acces GENDRIVER::getAccessMode() const { BEGIN_OF(LOC); return _accessMode; - - END_OF(LOC); } ostream & MEDMEM::operator<<(ostream &os,const GENDRIVER & drv) diff --git a/src/MEDMEM/MEDMEM_GenDriver.hxx b/src/MEDMEM/MEDMEM_GenDriver.hxx index ccc2ab6eb..c7a31b977 100644 --- a/src/MEDMEM/MEDMEM_GenDriver.hxx +++ b/src/MEDMEM/MEDMEM_GenDriver.hxx @@ -8,8 +8,6 @@ /* Generic Read/Write Driver Class for Meshes & Fields */ - -using namespace MED_EN; using namespace std; /*! @@ -29,7 +27,7 @@ protected : // the MedMedDriver index of the driver vector in the MED object where it has been created /*File related part*/ string _fileName; // The name of the file currently in use. - med_mode_acces _accessMode; // The file access mode set by the adequate construtor. + MED_EN::med_mode_acces _accessMode; // The file access mode set by the adequate construtor. int _status; // The file status {MED_INVALID, MED_OPENED, MED_CLOSED } driverTypes _driverType; // A FAIRE LE POSITIONNER DS TOUTES LES SS CLASSES !! @@ -42,7 +40,7 @@ public: /*! Constructor. */ - GENDRIVER(const string & fileName,med_mode_acces accessMode); + GENDRIVER(const string & fileName,MED_EN::med_mode_acces accessMode); /*! Copy constructor. */ @@ -106,7 +104,7 @@ public: int getId ( void ) const ; string getFileName () const; void setFileName ( const string & fileName); - med_mode_acces getAccessMode() const; + MED_EN::med_mode_acces getAccessMode() const; }; }; diff --git a/src/MEDMEM/MEDMEM_GibiMeshDriver.cxx b/src/MEDMEM/MEDMEM_GibiMeshDriver.cxx index fa7fb1875..1b683759b 100644 --- a/src/MEDMEM/MEDMEM_GibiMeshDriver.cxx +++ b/src/MEDMEM/MEDMEM_GibiMeshDriver.cxx @@ -1,5 +1,3 @@ -using namespace std; - #include #include "MEDMEM_GibiMeshDriver.hxx" @@ -16,6 +14,7 @@ using namespace std; #include "MEDMEM_DriverTools.hxx" ///// +using namespace std; using namespace MED_EN; using namespace MEDMEM; ///// @@ -157,9 +156,9 @@ void GIBI_MESH_RDONLY_DRIVER::read(void) throw (MEDEXCEPTION) while ( getline(_gibi, buf_ligne) ) // boucle externe de recherche de "ENREGISTREMENT DE TYPE" { string::size_type pos = buf_ligne.find(enregistrement_type); - if ( pos==string::npos ) + if ( pos==string::npos ){ continue; // "ENREGISTREMENT DE TYPE" non trouvé -> on lit la ligne suivante - + } // lecture du numéro d'enregistrement int numero_enregistrement; istringstream buf(buf_ligne.c_str()+strlen(enregistrement_type)+1); @@ -290,7 +289,11 @@ void GIBI_MESH_RDONLY_DRIVER::read(void) throw (MEDEXCEPTION) { // pour chacun des sous-maillages j, on recupere les iterateurs *k sur les maille // contenues et on les insere dans le groupe i - std::set< std::set<_maille>::iterator >::const_iterator k=medi.groupes[*j-1].mailles.begin(); + std::set< std::set<_maille, std::less<_maille>, + std::allocator<_maille> >::iterator, + _mailleIteratorCompare, + std::allocator< std::set<_maille, std::less<_maille>, + std::allocator<_maille> >::iterator> >::iterator k=medi.groupes[*j-1].mailles.begin(); for( ; k!=medi.groupes[*j-1].mailles.end(); ++k) i->mailles.insert(*k); } diff --git a/src/MEDMEM/MEDMEM_GibiMeshDriver.hxx b/src/MEDMEM/MEDMEM_GibiMeshDriver.hxx index 93782b88a..d3c098f97 100644 --- a/src/MEDMEM/MEDMEM_GibiMeshDriver.hxx +++ b/src/MEDMEM/MEDMEM_GibiMeshDriver.hxx @@ -42,7 +42,7 @@ protected: // tableau de correspondance des types géométriques de CASTEM -> MED static const size_t nb_geometrie_gibi=47; - static const medGeometryElement geomGIBItoMED[nb_geometrie_gibi]; + static const MED_EN::medGeometryElement geomGIBItoMED[nb_geometrie_gibi]; ///// public : @@ -56,7 +56,7 @@ public : */ GIBI_MESH_DRIVER(const string & fileName, MESH * ptrMesh, - med_mode_acces accessMode) ; + MED_EN::med_mode_acces accessMode) ; /*! Copy constructor. */ diff --git a/src/MEDMEM/MEDMEM_Grid.cxx b/src/MEDMEM/MEDMEM_Grid.cxx index 40fcc0709..44d503c00 100644 --- a/src/MEDMEM/MEDMEM_Grid.cxx +++ b/src/MEDMEM/MEDMEM_Grid.cxx @@ -1,4 +1,3 @@ -using namespace std; // File : MEDMEM_Grid.hxx // Created : Wed Dec 18 08:35:26 2002 // Descr : class containing structured mesh data @@ -13,7 +12,10 @@ using namespace std; #include "MEDMEM_Grid.hxx" #include "MEDMEM_CellModel.hxx" #include "MEDMEM_SkyLineArray.hxx" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; //======================================================================= //function : GRID @@ -24,6 +26,55 @@ GRID::GRID() { init(); MESSAGE("A GRID CREATED"); } +// +//======================================================================= +////function : GRID +////purpose : array constructor +////======================================================================= +GRID::GRID(const std::vector >& xyz_array,const std::vector& coord_name, + const std::vector& coord_unit, const med_grid_type type) : _gridType(type) +{ + _spaceDimension = xyz_array.size(); + + // compute & set _numberOfNodes + int NumberOfNodes=1 ; + for(int i=0;i!=xyz_array.size();++i) + NumberOfNodes*=xyz_array[i].size(); + _numberOfNodes = NumberOfNodes ; + + // create a non allocated COORDINATE + _coordinate = new COORDINATE(_spaceDimension, &coord_name[0], &coord_unit[0]); + string coordinateSystem = "UNDEFINED"; + if( _gridType == MED_CARTESIAN) + coordinateSystem = "CARTESIAN"; + else if ( _gridType == MED_POLAR) + coordinateSystem = "CYLINDRICAL"; + _coordinate->setCoordinatesSystem(coordinateSystem); + + // set the GRID part + if (_spaceDimension>=1) + { + _iArrayLength=xyz_array[0].size(); + _iArray=new double[_iArrayLength]; + std::copy(xyz_array[0].begin(),xyz_array[0].end(),_iArray); + } + if (_spaceDimension>=2) + { + _jArrayLength=xyz_array[1].size(); + _jArray=new double[_jArrayLength]; + std::copy(xyz_array[1].begin(),xyz_array[1].end(),_jArray); + } + if (_spaceDimension>=3) + { + _kArrayLength=xyz_array[2].size(); + _kArray=new double[_kArrayLength]; + std::copy(xyz_array[2].begin(),xyz_array[2].end(),_kArray); + } + + _is_coordinates_filled = false; + _is_connectivity_filled = false; + _isAGrid = true; +} //======================================================================= //function : GRID @@ -130,6 +181,28 @@ GRID::GRID(driverTypes driverType, const string & fileName, END_OF(LOC); }; +/*! + return the GRID Geometric type, without computing all connectivity +*/ +const medGeometryElement * GRID::getTypes(medEntityMesh entity) const +{ + static const medGeometryElement _gridGeometry[4]={MED_HEXA8,MED_QUAD4,MED_SEG2,MED_POINT1}; + int i=0; + if(entity==MED_CELL) + { + i=3-_spaceDimension; + } + else if(entity==MED_FACE && _spaceDimension>2 ) + i=1; + else if(entity==MED_EDGE && _spaceDimension>1 ) + i=2; + else if(entity==MED_NODE && _spaceDimension>0) + i=3; + else + throw MEDEXCEPTION(LOCALIZED("CONNECTIVITY::getGeometricTypes : Entity not defined !")); + return &_gridGeometry[i]; +} + //======================================================================= //function : fillMeshAfterRead //purpose : @@ -187,16 +260,16 @@ void GRID::fillMeshAfterRead() void GRID::fillCoordinates() const { if (_is_coordinates_filled) - { - MESSAGE("GRID::fillCoordinates(): Already filled"); return; - } const char * LOC ="GRID::fillCoordinates()"; BEGIN_OF(LOC); - double* myCoord = - const_cast ( _coordinate->getCoordinates(MED_FULL_INTERLACE) ); + // if coordonate has not been allocated, perform shalow copy, transfer ownership of matrix + if(_coordinate->getSpaceDimension()*_coordinate->getNumberOfNodes() == 0) + _coordinate->setCoordinates(new MEDARRAY(_spaceDimension,_numberOfNodes,MED_FULL_INTERLACE),true); + + double* myCoord = const_cast ( _coordinate->getCoordinates(MED_FULL_INTERLACE) ); bool hasJ = _jArrayLength, hasK = _kArrayLength; int J = hasJ ? _jArrayLength : 1; @@ -217,7 +290,7 @@ void GRID::fillCoordinates() const if (hasK) { - * myCoord = _jArray[ k ]; + * myCoord = _kArray[ k ]; ++ myCoord; } } @@ -234,15 +307,16 @@ void GRID::fillCoordinates() const //purpose : //======================================================================= -CONNECTIVITY * GRID::makeConnectivity (const medEntityMesh Entity, - const medGeometryElement Geometry, - const int NbEntities, - const int NbNodes, - int * NodeNumbers) +CONNECTIVITY * GRID::makeConnectivity (medEntityMesh Entity, + medGeometryElement Geometry, + int NbEntities, + int NbNodes, + int nbMeshNodes, + const int * NodeNumbers) const { CONNECTIVITY * Connectivity = new CONNECTIVITY(Entity) ; - Connectivity->_numberOfNodes = NbNodes ; + Connectivity->_numberOfNodes = nbMeshNodes ; Connectivity->_entityDimension = Geometry/100 ; int numberOfGeometricType = 1; @@ -305,7 +379,7 @@ void GRID::fillConnectivity() const BEGIN_OF(LOC); int nbCells, nbFaces, nbEdges; - int nbCNodes, nbFNodes, nbENodes; + int nbCNodes, nbFNodes, nbENodes, nbMeshNodes; int indexC, indexF, indexE; int * nodeCNumbers, * nodeFNumbers, * nodeENumbers; // about descending connectivity @@ -321,6 +395,7 @@ void GRID::fillConnectivity() const // nb of cells and of their connectivity nodes nbCells = iLenMin1 * jLenMin1 * kLenMin1; + nbMeshNodes = _iArrayLength * (_jArrayLength ? _jArrayLength : 1) * (_kArrayLength ? _kArrayLength : 1); nbCNodes = nbCells * 2 * (hasEdges ? 2 : 1) * (hasFaces ? 2 : 1); nodeCNumbers = new int [ nbCNodes ]; @@ -580,7 +655,7 @@ void GRID::fillConnectivity() const else aCellGeometry = MED_SEG2; // nodal - CellCNCT = makeConnectivity (MED_CELL, aCellGeometry, nbCells, nbCNodes, nodeCNumbers); + CellCNCT = makeConnectivity (MED_CELL, aCellGeometry, nbCells, nbCNodes, nbMeshNodes, nodeCNumbers); delete [] nodeCNumbers; @@ -620,14 +695,14 @@ void GRID::fillConnectivity() const // make connectivity for FACE and/or EDGE if (hasFaces) { - FaceCNCT = makeConnectivity (MED_FACE, MED_QUAD4, nbFaces, nbFNodes, nodeFNumbers); + FaceCNCT = makeConnectivity (MED_FACE, MED_QUAD4, nbFaces, nbFNodes, nbMeshNodes, nodeFNumbers); delete [] nodeFNumbers; CellCNCT->_constituent = FaceCNCT; } if (hasEdges) { - EdgeCNCT = makeConnectivity (MED_EDGE, MED_SEG2, nbEdges, nbENodes, nodeENumbers); + EdgeCNCT = makeConnectivity (MED_EDGE, MED_SEG2, nbEdges, nbENodes, nbMeshNodes, nodeENumbers); delete [] nodeENumbers; diff --git a/src/MEDMEM/MEDMEM_Grid.hxx b/src/MEDMEM/MEDMEM_Grid.hxx index d39659b9b..0fc9a1a4f 100644 --- a/src/MEDMEM/MEDMEM_Grid.hxx +++ b/src/MEDMEM/MEDMEM_Grid.hxx @@ -24,7 +24,7 @@ class GRID: public MESH //-----------------------// // 1. grid type: MED_CARTESIAN, MED_POLAR, MED_BODY_FITTED - med_grid_type _gridType; + MED_EN::med_grid_type _gridType; // 2. node coordinates // For MED_BODY_FITTED MESH::_coordinate is used @@ -47,10 +47,9 @@ class GRID: public MESH // Protected Methods //-----------------------// - CONNECTIVITY * makeConnectivity (const medEntityMesh Entity, - const medGeometryElement Geometry, - const int NbEntities, const int NbNodes, - int * NodeNumbers) const ; + CONNECTIVITY * makeConnectivity (const MED_EN::medEntityMesh Entity, const MED_EN::medGeometryElement Geometry, + const int NbEntities, int NbNodes, int nbMeshNodes, + const int * NodeNumbers) const ; // creates nodal connectivity @@ -76,9 +75,11 @@ class GRID: public MESH //-----------------------// GRID(); - GRID(const med_grid_type type); + GRID(const MED_EN::med_grid_type type); GRID(const GRID &m); GRID( driverTypes driverType, const string & fileName="",const string & meshName=""); + GRID(const std::vector >& xyz_array,const std::vector& coord_name, + const std::vector& coord_unit, const MED_EN::med_grid_type type=MED_EN::MED_CARTESIAN); GRID & operator=(const GRID &m); virtual ~GRID(); virtual void init(); @@ -187,7 +188,7 @@ class GRID: public MESH // Access to fields - inline med_grid_type getGridType() const; + inline MED_EN::med_grid_type getGridType() const; // return MED_CARTESIAN, MED_POLAR or MED_BODY_FITTED int getArrayLength( const int Axis ) const throw (MEDEXCEPTION); @@ -201,64 +202,62 @@ class GRID: public MESH inline const COORDINATE * getCoordinateptr() const; - inline const double * getCoordinates(medModeSwitch Mode) const; + inline const double * getCoordinates(MED_EN::medModeSwitch Mode) const; inline const double getCoordinate(int Number,int Axis) const; - inline int getNumberOfTypes(medEntityMesh Entity) const; + inline int getNumberOfTypes(MED_EN::medEntityMesh Entity) const; - inline const medGeometryElement * getTypes(medEntityMesh Entity) const; + inline const MED_EN::medGeometryElement * getTypes(MED_EN::medEntityMesh Entity) const; - inline const CELLMODEL * getCellsTypes(medEntityMesh Entity) const; + inline const CELLMODEL * getCellsTypes(MED_EN::medEntityMesh Entity) const; - const int * getGlobalNumberingIndex(medEntityMesh Entity) const; + const int * getGlobalNumberingIndex(MED_EN::medEntityMesh Entity) const; - inline int getNumberOfElements(medEntityMesh Entity, - medGeometryElement Type) const; + inline int getNumberOfElements(MED_EN::medEntityMesh Entity, + MED_EN::medGeometryElement Type) const; - inline bool existConnectivity(medConnectivity ConnectivityType, - medEntityMesh Entity) const; + inline bool existConnectivity(MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity) const; - inline medGeometryElement getElementType(medEntityMesh Entity, + inline MED_EN::medGeometryElement getElementType(MED_EN::medEntityMesh Entity, int Number) const; - inline void calculateConnectivity(medModeSwitch Mode, - medConnectivity ConnectivityType, - medEntityMesh Entity) const ; + inline void calculateConnectivity(MED_EN::medModeSwitch Mode, + MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity) const ; inline const CONNECTIVITY* getConnectivityptr() const; - inline const int * getConnectivity(medModeSwitch Mode, - medConnectivity ConnectivityType, - medEntityMesh Entity, - medGeometryElement Type) const; + inline const int * getConnectivity(MED_EN::medModeSwitch Mode, + MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity, + MED_EN::medGeometryElement Type) const; - inline const int * getConnectivityIndex(medConnectivity ConnectivityType, - medEntityMesh Entity) const; + inline const int * getConnectivityIndex(MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity) const; - inline const int * getReverseConnectivity(medConnectivity ConnectivityType, - medEntityMesh Entity=MED_CELL) const; + inline const int * getReverseConnectivity(MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity=MED_EN::MED_CELL) const; - inline const int * getReverseConnectivityIndex(medConnectivity ConnectivityType, - medEntityMesh Entity=MED_CELL) const; + inline const int * getReverseConnectivityIndex(MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity=MED_EN::MED_CELL) const; // Setting fields - inline void setGridType(med_grid_type gridType); + inline void setGridType(MED_EN::med_grid_type gridType); friend class MED_MESH_RDONLY_DRIVER; friend class MED_MESH_WRONLY_DRIVER; }; -}; -using namespace MEDMEM; //----------------------------------// // Inline Methods Implementation //----------------------------------// -inline med_grid_type GRID::getGridType() const +inline MED_EN::med_grid_type GRID::getGridType() const { return _gridType; } @@ -298,7 +297,7 @@ inline void GRID::makeUnstructured() //purpose : set the _gridType field od the class GRID //======================================================================= -inline void GRID::setGridType(med_grid_type gridType) +inline void GRID::setGridType(MED_EN::med_grid_type gridType) { _gridType = gridType; } @@ -314,7 +313,7 @@ inline const COORDINATE * GRID::getCoordinateptr() const - MED_NO_INTERLACE : X1 X2 Y1 Y2 Z1 Z2 - MED_FULL_INTERLACE : X1 Y1 Z1 X2 Y2 Z2 */ -inline const double * GRID::getCoordinates(medModeSwitch Mode) const +inline const double * GRID::getCoordinates(MED_EN::medModeSwitch Mode) const { fillCoordinates(); return _coordinate->getCoordinates(Mode); @@ -332,42 +331,11 @@ inline const double GRID::getCoordinate(int number, int axis) const medEntityMesh entity : MED_CELL, MED_FACE, MED_EDGE, MED_NODE, MED_ALL_ENTITIES - If entity is not defined, return 0. - - If there is no connectivity, return an exception. */ -inline int GRID::getNumberOfTypes(medEntityMesh entity) const +inline int GRID::getNumberOfTypes(MED_EN::medEntityMesh entity) const { MESSAGE("GRID::getNumberOfTypes(medEntityMesh entity) : "<getNumberOfTypes(entity); - throw MEDEXCEPTION(LOCALIZED("GRID::getNumberOfTypes( medEntityMesh ) : Connectivity not defined !")); -} - -/*! - Get the list of geometric types used by a given entity. - medEntityMesh entity : MED_CELL, MED_FACE, MED_EDGE, MED_ALL_ENTITIES - - REM : Don't use MED_NODE - - If entity is not defined, return an exception. -*/ -inline const medGeometryElement * GRID::getTypes(medEntityMesh entity) const -{ - if (entity == MED_NODE) - throw MEDEXCEPTION(LOCALIZED("GRID::getTypes( medEntityMesh ) : No medGeometryElement with MED_NODE entity !")); - // return un tableau de taille 1 contenant MED_NONE, comme les supports pour etre coherent avec getNumberOfTypes ???? PG - - fillConnectivity(); - - if (_connectivity != NULL) - return _connectivity->getGeometricTypes(entity); - throw MEDEXCEPTION(LOCALIZED("GRID::getTypes( medEntityMesh ) : Connectivity not defined !")); + return 1; // a grid has one type } /*! @@ -375,7 +343,7 @@ inline const medGeometryElement * GRID::getTypes(medEntityMesh entity) const REMARK : Don't use MED_NODE as medEntityMesh */ -inline const CELLMODEL * GRID::getCellsTypes(medEntityMesh Entity) const +inline const CELLMODEL * GRID::getCellsTypes(MED_EN::medEntityMesh Entity) const { fillConnectivity(); @@ -394,7 +362,7 @@ inline const CELLMODEL * GRID::getCellsTypes(medEntityMesh Entity) const - GlobalNumberingIndex[1]=6 (the second type) - GlobalNumberingIndex[2]=10 */ -inline const int * GRID::getGlobalNumberingIndex(medEntityMesh entity) const +inline const int * GRID::getGlobalNumberingIndex(MED_EN::medEntityMesh entity) const { fillConnectivity(); @@ -405,41 +373,42 @@ inline const int * GRID::getGlobalNumberingIndex(medEntityMesh entity) const /*! Return the number of element of given geometric type of given entity. Return 0 if query is not defined. - - Example : - - getNumberOfElements(MED_NODE,MED_NONE) : number of node - - getNumberOfElements(MED_NODE,MED_TRIA3) : return 0 (not defined) - - getNumberOfElements(MED_FACE,MED_TRIA3) : return number of triangles - elements defined in face entity (0 if not defined) - - getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS) : return total number - of elements defined in cell entity */ -inline int GRID::getNumberOfElements(medEntityMesh entity, medGeometryElement Type) const +inline int GRID::getNumberOfElements(MED_EN::medEntityMesh entity, MED_EN::medGeometryElement Type) const { - // const char * LOC = "MESH::getNumberOfElements(medEntityMesh,medGeometryElement) : "; - if (entity==MED_NODE) - if ((Type==MED_NONE)|(Type==MED_ALL_ELEMENTS)) - return _numberOfNodes; - else - return 0; - //throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"wrong medGeometryElement with MED_NODE")); - else - { - fillConnectivity(); - - if (_connectivity != (CONNECTIVITY*)NULL) - return _connectivity->getNumberOf(entity,Type); - else - return 0; - //throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"connectivity not defined !")); - } + int numberOfElements=0; + + // Cas où le nombre d'éléments n'est pas nul + if (entity==MED_EN::MED_FACE && (Type==MED_EN::MED_QUAD4 || Type==MED_EN::MED_ALL_ELEMENTS) && _spaceDimension>2) + numberOfElements=(_iArrayLength-1)*(_jArrayLength-1); + + else if (entity==MED_EN::MED_EDGE && (Type==MED_EN::MED_SEG2 || Type==MED_EN::MED_ALL_ELEMENTS) && _spaceDimension>1) + numberOfElements=_iArrayLength-1; + + else if (entity==MED_EN::MED_NODE && (Type==MED_EN::MED_NONE || Type==MED_EN::MED_ALL_ELEMENTS) && _spaceDimension>0) + numberOfElements=_numberOfNodes; + + else if (entity==MED_EN::MED_CELL && _spaceDimension==3 && (Type==MED_EN::MED_HEXA8 || Type==MED_EN::MED_ALL_ELEMENTS) ) + numberOfElements=(_iArrayLength-1)*(_jArrayLength-1)*(_kArrayLength-1); + + else if (entity==MED_EN::MED_CELL && _spaceDimension==2 && (Type==MED_EN::MED_QUAD4 || Type==MED_EN::MED_ALL_ELEMENTS)) + numberOfElements=(_iArrayLength-1)*(_jArrayLength-1); + + else if (entity==MED_EN::MED_CELL && _spaceDimension==1 && (Type==MED_EN::MED_SEG2 || Type==MED_EN::MED_ALL_ELEMENTS) ) + numberOfElements=_iArrayLength-1; + + MESSAGE("GRID::getNumberOfElements - entity=" << entity << " Type=" << Type); + MESSAGE("_spaceDimension=" << _spaceDimension << " numberOfElements=" << numberOfElements); + + return numberOfElements; } + /*! Return true if the wanted connectivity exist, else return false (to use before a getSomething method). */ -inline bool GRID::existConnectivity(medConnectivity connectivityType, medEntityMesh entity) const +inline bool GRID::existConnectivity(MED_EN::medConnectivity connectivityType, MED_EN::medEntityMesh entity) const { fillConnectivity(); @@ -453,7 +422,7 @@ inline bool GRID::existConnectivity(medConnectivity connectivityType, medEntityM Throw an exception if Entity is not defined or Number are wrong (too big). */ -inline medGeometryElement GRID::getElementType(medEntityMesh Entity,int Number) const +inline MED_EN::medGeometryElement GRID::getElementType(MED_EN::medEntityMesh Entity,int Number) const { fillConnectivity(); @@ -467,11 +436,11 @@ inline medGeometryElement GRID::getElementType(medEntityMesh Entity,int Number) done. Do nothing if connectivity already exist. */ -inline void GRID::calculateConnectivity(medModeSwitch Mode,medConnectivity ConnectivityType,medEntityMesh entity) const +inline void GRID::calculateConnectivity(MED_EN::medModeSwitch Mode,MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh entity) const { fillConnectivity(); - if (Mode==MED_FULL_INTERLACE) + if (Mode==MED_EN::MED_FULL_INTERLACE) _connectivity->calculateConnectivity(ConnectivityType,entity); else throw MEDEXCEPTION(LOCALIZED("GRID::calculateConnectivity : only for MED_FULL_INTERLACE mode")); @@ -492,11 +461,11 @@ inline const CONNECTIVITY* GRID::getConnectivityptr() const and Type=MED_ALL_ELEMENTS. You must also get the corresponding index array. */ -inline const int * GRID::getConnectivity(medModeSwitch Mode,medConnectivity ConnectivityType,medEntityMesh entity, medGeometryElement Type) const +inline const int * GRID::getConnectivity(MED_EN::medModeSwitch Mode,MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh entity, MED_EN::medGeometryElement Type) const { fillConnectivity(); - if (Mode==MED_FULL_INTERLACE) + if (Mode==MED_EN::MED_FULL_INTERLACE) return _connectivity->getConnectivity(ConnectivityType,entity,Type); throw MEDEXCEPTION(LOCALIZED("GRID::getConnectivity : only for MED_FULL_INTERLACE mode")); } @@ -512,7 +481,7 @@ inline const int * GRID::getConnectivity(medModeSwitch Mode,medConnectivity Conn in Connectivity array (Connectivity[ConnectivityIndex[i-1]-1] is the first value) */ -inline const int * GRID::getConnectivityIndex(medConnectivity ConnectivityType,medEntityMesh entity) const +inline const int * GRID::getConnectivityIndex(MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh entity) const { fillConnectivity(); @@ -526,7 +495,7 @@ inline const int * GRID::getConnectivityIndex(medConnectivity ConnectivityType,m You must get ReverseConnectivityIndex array to use it. */ -inline const int * GRID::getReverseConnectivity(medConnectivity ConnectivityType,medEntityMesh Entity/*=MED_CELL*/) const +inline const int * GRID::getReverseConnectivity(MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh Entity/*=MED_CELL*/) const { fillConnectivity(); @@ -548,7 +517,7 @@ inline const int * GRID::getReverseConnectivity(medConnectivity ConnectivityType ReverseConnectivity[ReverseConnectivityIndex[i-1]-1] is the first value) */ -inline const int * GRID::getReverseConnectivityIndex(medConnectivity ConnectivityType,medEntityMesh Entity/*=MED_CELL*/) const +inline const int * GRID::getReverseConnectivityIndex(MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh Entity/*=MED_CELL*/) const { fillConnectivity(); @@ -558,4 +527,6 @@ inline const int * GRID::getReverseConnectivityIndex(medConnectivity Connectivit return _connectivity->getReverseConnectivityIndex(ConnectivityType,Entity); } +} + #endif diff --git a/src/MEDMEM/MEDMEM_Group.cxx b/src/MEDMEM/MEDMEM_Group.cxx index 85dfb2490..7e06b2df0 100644 --- a/src/MEDMEM/MEDMEM_Group.cxx +++ b/src/MEDMEM/MEDMEM_Group.cxx @@ -1,4 +1,3 @@ -using namespace std; /* File Group.cxx $Header$ @@ -7,7 +6,10 @@ using namespace std; #include "MEDMEM_Group.hxx" #include "MEDMEM_Family.hxx" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; GROUP::GROUP():_numberOfFamilies(0),_family() { @@ -61,7 +63,7 @@ GROUP::GROUP(const string & name, const list & families) throw (MEDEXCE SCRUTE(numberOfFamilies); - if ((numberOfFamilies==1) || (isOnAllElts)) + if ((numberOfFamilies==1) && (isOnAllElts)) { _numberOfFamilies = numberOfFamilies; _isOnAllElts = isOnAllElts ; @@ -70,7 +72,7 @@ GROUP::GROUP(const string & name, const list & families) throw (MEDEXCE update(); return; } - else if ((!(numberOfFamilies==1))&(isOnAllElts)) + else if ((!(numberOfFamilies==1)) && (isOnAllElts)) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "building of a GROUP object from several FAMILY, and one of them is on all entities" )) ; _numberOfGeometricType = myFamily->getNumberOfTypes() ; diff --git a/src/MEDMEM/MEDMEM_Group.hxx b/src/MEDMEM/MEDMEM_Group.hxx index d5c5a8b1a..7407841dd 100644 --- a/src/MEDMEM/MEDMEM_Group.hxx +++ b/src/MEDMEM/MEDMEM_Group.hxx @@ -63,10 +63,8 @@ public: inline FAMILY * getFamily(int i) const ; }; -}; // inline method : -using namespace MEDMEM; /*! set the attribut _numberOfFamilies to numberOfFamilies */ //---------------------------------------------------------- @@ -108,6 +106,6 @@ FAMILY * GROUP::getFamily(int i) const { return _family[i-1]; }; - +}//End namespace MEDMEM #endif /* GROUP_HXX */ diff --git a/src/MEDMEM/MEDMEM_Med.cxx b/src/MEDMEM/MEDMEM_Med.cxx index 4169c4464..1ae52600e 100644 --- a/src/MEDMEM/MEDMEM_Med.cxx +++ b/src/MEDMEM/MEDMEM_Med.cxx @@ -1,4 +1,3 @@ -using namespace std; # include # include "MEDMEM_Med.hxx" @@ -11,7 +10,10 @@ using namespace std; # include "MEDMEM_Exception.hxx" # include "utilities.h" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; /*! Constructor. @@ -62,10 +64,10 @@ MED::~MED() if ( (*currentField).first != NULL) MESSAGE(" " << ((*currentField).first)->getName().c_str()); } - map >::iterator itSupportOnMesh ; + map >::iterator itSupportOnMesh ; index = 0; for ( itSupportOnMesh=_support.begin();itSupportOnMesh != _support.end(); itSupportOnMesh++ ) { - map::iterator itSupport ; + map::iterator itSupport ; for ( itSupport=(*itSupportOnMesh).second.begin();itSupport!=(*itSupportOnMesh).second.end();itSupport++) index++; } @@ -109,9 +111,9 @@ MED::~MED() } } } - // map >::iterator itSupportOnMesh ; + // map >::iterator itSupportOnMesh ; for ( itSupportOnMesh=_support.begin();itSupportOnMesh != _support.end(); itSupportOnMesh++ ) { - map::iterator itSupport ; + map::iterator itSupport ; for ( itSupport=(*itSupportOnMesh).second.begin();itSupport!=(*itSupportOnMesh).second.end();itSupport++) delete (*itSupport).second ; } @@ -288,7 +290,6 @@ void MED::readFileStruct (int index/*=0*/) << _drivers.size() ) ); - END_OF(LOC); } /*! @@ -330,8 +331,6 @@ int MED::getNumberOfMeshes ( void ) const { BEGIN_OF(LOC); return _meshes.size(); - - END_OF(LOC); }; /*! @@ -343,8 +342,6 @@ int MED::getNumberOfFields ( void ) const { BEGIN_OF(LOC); return _fields.size(); // we get number of field with different name - - END_OF(LOC); }; /*! @@ -636,16 +633,16 @@ FIELD_ * MED::getField ( const string & fieldName, const int dt=MED_NO // }; /*! - Return a map which contain + Return a map which contain foreach entity, a reference to the SUPPORT on all elements. */ -const map & MED::getSupports(const string & meshName) const +const map & MED::getSupports(const string & meshName) const throw (MED_EXCEPTION) { const char * LOC = "MED::getSupports ( const string ) const : "; BEGIN_OF(LOC); - map >::const_iterator itSupportOnMesh = _support.find(meshName) ; + map >::const_iterator itSupportOnMesh = _support.find(meshName) ; if ( itSupportOnMesh == _support.end() ) throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) @@ -661,26 +658,26 @@ const map & MED::getSupports(const string Return a reference to the SUPPORT object on all elements of entity for the MESH named meshName. */ -SUPPORT * MED::getSupport (const string & meshName,MED_FR::med_entite_maillage entity) const +SUPPORT * MED::getSupport (const string & meshName,MED_EN::medEntityMesh entity) const throw (MED_EXCEPTION) { - const char * LOC = "MED::getSupport ( const string, MED_FR::med_entite_maillage ) const : "; + const char * LOC = "MED::getSupport ( const string, MED_EN::medEntityMesh ) const : "; BEGIN_OF(LOC); int index = 0; - for (map >::const_iterator const_itSupportOnMesh=_support.begin(); const_itSupportOnMesh != _support.end(); + for (map >::const_iterator const_itSupportOnMesh=_support.begin(); const_itSupportOnMesh != _support.end(); const_itSupportOnMesh++ ) { - map::const_iterator const_itSupport ; + map::const_iterator const_itSupport ; for (const_itSupport=(*const_itSupportOnMesh).second.begin(); const_itSupport!=(*const_itSupportOnMesh).second.end();const_itSupport++) index++; } MESSAGE(LOC << "In this MED object there is(are) " << index << " support(s):"); - for (map >::const_iterator const_itSupportOnMesh=_support.begin();const_itSupportOnMesh != _support.end(); const_itSupportOnMesh++ ) + for (map >::const_iterator const_itSupportOnMesh=_support.begin();const_itSupportOnMesh != _support.end(); const_itSupportOnMesh++ ) { - map::const_iterator const_itSupport ; + map::const_iterator const_itSupport ; for (const_itSupport=(*const_itSupportOnMesh).second.begin(); const_itSupport!=(*const_itSupportOnMesh).second.end();const_itSupport++) { @@ -689,7 +686,7 @@ SUPPORT * MED::getSupport (const string & meshName,MED_FR::med_entite_maillage } - map >::const_iterator const_itSupportOnMesh = _support.find(meshName) ; + map >::const_iterator const_itSupportOnMesh = _support.find(meshName) ; if ( const_itSupportOnMesh == _support.end() ) throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) @@ -698,8 +695,8 @@ SUPPORT * MED::getSupport (const string & meshName,MED_FR::med_entite_maillage ) ); -// map & SupportOnMesh = (map&) ((*itSupportOnMesh).second) ; -// map::const_iterator itSupport = SupportOnMesh.find(entity) ; +// map & SupportOnMesh = (map&) ((*itSupportOnMesh).second) ; +// map::const_iterator itSupport = SupportOnMesh.find(entity) ; // if (itSupport == SupportOnMesh.end() ) // throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) @@ -710,9 +707,9 @@ SUPPORT * MED::getSupport (const string & meshName,MED_FR::med_entite_maillage // ); - map SupportOnMesh = ((*const_itSupportOnMesh).second); + map SupportOnMesh = ((*const_itSupportOnMesh).second); - map::const_iterator itSupport = SupportOnMesh.find(entity) ; + map::const_iterator itSupport = SupportOnMesh.find(entity) ; if (itSupport == SupportOnMesh.end() ) throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) @@ -735,9 +732,9 @@ void MED::updateSupport () const char * LOC = "MED::updateSupport () : "; BEGIN_OF(LOC); - map >::iterator itSupportOnMesh ; + map >::iterator itSupportOnMesh ; for ( itSupportOnMesh=_support.begin();itSupportOnMesh != _support.end(); itSupportOnMesh++ ) { - map::iterator itSupport ; + map::iterator itSupport ; for ( itSupport=(*itSupportOnMesh).second.begin();itSupport!=(*itSupportOnMesh).second.end();itSupport++) try { (*itSupport).second->update() ; @@ -822,7 +819,7 @@ void MED::addField( FIELD_ * const ptrField) _meshes [meshName] = ptrMesh; // if it already exists it is replaced // int numberOfTypes = ptrSupport->getNumberOfTypes(); !! UNUSED VARIABLE !! - _support [meshName][ (MED_FR::med_entite_maillage) ptrSupport->getEntity()] = ptrSupport;// if it already exists it is replaced + _support [meshName][ptrSupport->getEntity()] = ptrSupport;// if it already exists it is replaced END_OF(LOC); diff --git a/src/MEDMEM/MEDMEM_Med.hxx b/src/MEDMEM/MEDMEM_Med.hxx index 1cba1d33d..cd83deba7 100644 --- a/src/MEDMEM/MEDMEM_Med.hxx +++ b/src/MEDMEM/MEDMEM_Med.hxx @@ -12,8 +12,6 @@ # include "MEDMEM_Exception.hxx" # include "MEDMEM_GenDriver.hxx" -using namespace MED_EN; - namespace MEDMEM { class MESH; @@ -66,7 +64,7 @@ private: // in order to get the MESH* from _meshes // POURQUOI MED_FR::med_entite_maillage ? devrait être MED_EN ! - map < MESH_NAME_, map > _support ; + map < MESH_NAME_, map < MED_EN::medEntityMesh, SUPPORT * > > _support ; // For each MESH, we list support for each entity on all elements. vector _drivers; // Storage of the MED_MED drivers currently in use @@ -106,9 +104,9 @@ public: FIELD_ * getField ( const string & fieldName, const int dt, const int it) const throw (MEDEXCEPTION) ; - const map & getSupports(const string & meshName) const throw (MEDEXCEPTION) ; + const map & getSupports(const string & meshName) const throw (MEDEXCEPTION) ; - SUPPORT * getSupport (const string & meshName,MED_FR::med_entite_maillage entity) const throw (MEDEXCEPTION) ; + SUPPORT * getSupport (const string & meshName,MED_EN::medEntityMesh entity) const throw (MEDEXCEPTION) ; void updateSupport () ; diff --git a/src/MEDMEM/MEDMEM_MedFieldDriver.hxx b/src/MEDMEM/MEDMEM_MedFieldDriver.hxx index 6ffab10ed..6bf171c13 100644 --- a/src/MEDMEM/MEDMEM_MedFieldDriver.hxx +++ b/src/MEDMEM/MEDMEM_MedFieldDriver.hxx @@ -16,8 +16,6 @@ //#include "MEDMEM_Field.hxx" #include "MEDMEM_Mesh.hxx" -//using namespace MED_FR ; - namespace MEDMEM { template class FIELD; @@ -36,7 +34,7 @@ template class MED_FIELD_DRIVER : public GENDRIVER protected: FIELD * _ptrField; - MED_FR::med_idt _medIdt; + med_2_1::med_idt _medIdt; string _fieldName; int _fieldNum; @@ -59,7 +57,7 @@ public : Constructor. */ MED_FIELD_DRIVER(const string & fileName, FIELD * ptrField, - med_mode_acces accessMode) + MED_EN::med_mode_acces accessMode) : GENDRIVER(fileName,accessMode), _ptrField((FIELD *) ptrField),_medIdt(MED_INVALID), _fieldName(fileName),_fieldNum(MED_INVALID) @@ -97,7 +95,7 @@ public : ); MESSAGE(LOC<<"_fileName.c_str : "<< _fileName.c_str()<<",mode : "<< _accessMode); - _medIdt = MED_FR::MEDouvrir( (const_cast (_fileName.c_str())),(MED_FR::med_mode_acces) _accessMode); + _medIdt = med_2_1::MEDouvrir( (const_cast (_fileName.c_str())),(med_2_1::med_mode_acces) _accessMode); MESSAGE(LOC<<"_medIdt : "<< _medIdt ); if (_medIdt > 0) _status=MED_OPENED; @@ -116,9 +114,9 @@ public : void close() { BEGIN_OF("MED_FIELD_DRIVER::close()"); - MED_FR::med_int err = 0; + med_2_1::med_int err = 0; if (_status == MED_OPENED) { - err=MED_FR::MEDfermer(_medIdt); + err=med_2_1::MEDfermer(_medIdt); //H5close(); // If we call H5close() all the files are closed. _status = MED_CLOSED; _medIdt = MED_INVALID; @@ -275,7 +273,7 @@ public : Constructor. */ MED_FIELD_RDWR_DRIVER(const string & fileName, FIELD * ptrField): - MED_FIELD_DRIVER(fileName,ptrField,MED_RDWR) + MED_FIELD_DRIVER(fileName,ptrField,MED_EN::MED_RDWR) { BEGIN_OF("MED_FIELD_RDWR_DRIVER::MED_FIELD_RDWR_DRIVER(const string & fileName, const FIELD * ptrField)"); //_accessMode = MED_RDWR ; @@ -306,14 +304,11 @@ private: GENDRIVER * copy( void ) const ; }; -} /*-------------------------*/ /* template implementation */ /*-------------------------*/ - -using namespace MEDMEM; /*--------------------- DRIVER PART -------------------------------*/ template void MED_FIELD_DRIVER::setFieldName(const string & fieldName) @@ -339,13 +334,13 @@ template string MED_FIELD_DRIVER::getFieldName() const // int numberOfComponents = 0; // char * componentName = (char *) MED_NULL; // char * unitName = (char *) MED_NULL; -// MED_FR::med_type_champ type ; -// numberOfFields = MED_FR::MEDnChamp(_medIdt,0) ; +// med_2_1::med_type_champ type ; +// numberOfFields = med_2_1::MEDnChamp(_medIdt,0) ; // if ( numberOfFields <= 0 ) // throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<": No Field found !")); // for (int i=1;i<=numberOfFields;i++) { -// numberOfComponents = MED_FR::MEDnChamp(_medIdt,i) ; +// numberOfComponents = med_2_1::MEDnChamp(_medIdt,i) ; // if ( numberOfComponents <= 0 ) // throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) // << "Be careful there is no compound for field n°" @@ -354,7 +349,7 @@ template string MED_FIELD_DRIVER::getFieldName() const // componentName = new char[numberOfComponents*MED_TAILLE_PNOM+1] ; // unitName = new char[numberOfComponents*MED_TAILLE_PNOM+1] ; -// err = MED_FR::MEDchampInfo(_medIdt, i, fieldName, &type, componentName, +// err = med_2_1::MEDchampInfo(_medIdt, i, fieldName, &type, componentName, // unitName, numberOfComponents) ; // delete[] componentName ; @@ -404,17 +399,17 @@ template void MED_FIELD_RDONLY_DRIVER::read(void) int numberOfComponents = 0; char * componentName = (char *) MED_NULL; char * unitName = (char *) MED_NULL; - MED_FR::med_type_champ type ; + med_2_1::med_type_champ type ; // we search the field number !!!! if (MED_FIELD_DRIVER::_fieldNum==MED_INVALID) { int numberOfFields = 0; //MED_INVALID - numberOfFields = MED_FR::MEDnChamp(MED_FIELD_DRIVER::_medIdt,0) ; + numberOfFields = med_2_1::MEDnChamp(MED_FIELD_DRIVER::_medIdt,0) ; if ( numberOfFields <= 0 ) throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<": No Field found !")); for (int i=1;i<=numberOfFields;i++) { - numberOfComponents = MED_FR::MEDnChamp(MED_FIELD_DRIVER::_medIdt,i) ; + numberOfComponents = med_2_1::MEDnChamp(MED_FIELD_DRIVER::_medIdt,i) ; if ( numberOfComponents <= 0 ) // throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) // << "Be careful there is no compound for field n°" @@ -424,7 +419,7 @@ template void MED_FIELD_RDONLY_DRIVER::read(void) componentName = new char[numberOfComponents*MED_TAILLE_PNOM+1] ; unitName = new char[numberOfComponents*MED_TAILLE_PNOM+1] ; - err = MED_FR::MEDchampInfo(MED_FIELD_DRIVER::_medIdt, i, fieldName, &type, componentName, + err = med_2_1::MEDchampInfo(MED_FIELD_DRIVER::_medIdt, i, fieldName, &type, componentName, unitName, numberOfComponents) ; MESSAGE("Champ "<::_fieldName.c_str()<<"#"); @@ -446,7 +441,7 @@ template void MED_FIELD_RDONLY_DRIVER::read(void) MESSAGE ("FieldNum : "<::_fieldNum); // int err ; - // int NumberOfComponents = MED_FR::MEDnChamp(MED_FIELD_DRIVER::_medIdt,MED_FIELD_DRIVER::_fieldNum) ; + // int NumberOfComponents = med_2_1::MEDnChamp(MED_FIELD_DRIVER::_medIdt,MED_FIELD_DRIVER::_fieldNum) ; if (numberOfComponents < 1) throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"no component")) ; // use iostring ! // test type to check if it is rigth !!!??? @@ -470,7 +465,7 @@ template void MED_FIELD_RDONLY_DRIVER::read(void) // read values for each geometric type in _support int NumberOfTypes = MED_FIELD_DRIVER::_ptrField->_support->getNumberOfTypes() ; - const medGeometryElement *Types = MED_FIELD_DRIVER::_ptrField->_support->getTypes() ; + const MED_EN::medGeometryElement *Types = MED_FIELD_DRIVER::_ptrField->_support->getTypes() ; T ** myValues = new T*[NumberOfTypes] ; int * NumberOfValues = new int[NumberOfTypes] ; int TotalNumberOfValues = 0 ; @@ -482,8 +477,8 @@ template void MED_FIELD_RDONLY_DRIVER::read(void) NumberOfValues[i] = MEDnVal(MED_FIELD_DRIVER::_medIdt, const_cast (MED_FIELD_DRIVER::_fieldName.c_str()), - (MED_FR::med_entite_maillage)MED_FIELD_DRIVER::_ptrField->_support->getEntity(), - (MED_FR::med_geometrie_element)Types[i], + (med_2_1::med_entite_maillage)MED_FIELD_DRIVER::_ptrField->_support->getEntity(), + (med_2_1::med_geometrie_element)Types[i], MED_FIELD_DRIVER::_ptrField->_iterationNumber, MED_FIELD_DRIVER::_ptrField->_orderNumber) ; // no time step ! prend en compte le nbre de pt de gauss // test if NumberOfValues is the same in _support !!! TODO that !! @@ -496,21 +491,44 @@ template void MED_FIELD_RDONLY_DRIVER::read(void) MESSAGE ("NumberOfComponents :"<< numberOfComponents); MESSAGE ("MESH_NAME :"<< MeshName.c_str()); MESSAGE ("FIELD_NAME :"<< MED_FIELD_DRIVER::_fieldName.c_str()); - MESSAGE ("MED_ENTITE :"<< (MED_FR::med_entite_maillage) MED_FIELD_DRIVER::_ptrField->_support->getEntity()); - MESSAGE("MED_GEOM :"<<(MED_FR::med_geometrie_element)Types[i]); + MESSAGE ("MED_ENTITE :"<< (med_2_1::med_entite_maillage) MED_FIELD_DRIVER::_ptrField->_support->getEntity()); + MESSAGE("MED_GEOM :"<<(med_2_1::med_geometrie_element)Types[i]); MESSAGE("Iteration :"<::_ptrField->getIterationNumber()); MESSAGE("Order :"<::_ptrField->getOrderNumber()); MED_FIELD_DRIVER::_ptrField->_numberOfValues+=NumberOfValues[i]; // problem with gauss point : _numberOfValues != TotalNumberOfValues !!!!!!! - if ( MED_FR::MEDchampLire(MED_FIELD_DRIVER::_medIdt,const_cast (MeshName.c_str()), + med_2_1::med_err ret; +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + int lgth2=NumberOfValues[i]*numberOfComponents; + if(_ptrField->getValueType()==MED_EN::MED_INT32) + { + med_2_1::med_int *temp=new med_2_1::med_int[lgth2]; + ret=med_2_1::MEDchampLire(MED_FIELD_DRIVER::_medIdt,const_cast (MeshName.c_str()), + const_cast (MED_FIELD_DRIVER::_fieldName.c_str()), + (unsigned char*) temp, + med_2_1::MED_NO_INTERLACE, + MED_ALL, + ProfilName, + (med_2_1::med_entite_maillage) MED_FIELD_DRIVER::_ptrField->_support->getEntity(),(med_2_1::med_geometrie_element)Types[i], + MED_FIELD_DRIVER::_ptrField->getIterationNumber(), + MED_FIELD_DRIVER::_ptrField->getOrderNumber() + ); + for(int i2=0;i2::_medIdt,const_cast (MeshName.c_str()), const_cast (MED_FIELD_DRIVER::_fieldName.c_str()), (unsigned char*) myValues[i], - MED_FR::MED_NO_INTERLACE, + med_2_1::MED_NO_INTERLACE, MED_ALL, ProfilName, - (MED_FR::med_entite_maillage) MED_FIELD_DRIVER::_ptrField->_support->getEntity(),(MED_FR::med_geometrie_element)Types[i], + (med_2_1::med_entite_maillage) MED_FIELD_DRIVER::_ptrField->_support->getEntity(),(med_2_1::med_geometrie_element)Types[i], MED_FIELD_DRIVER::_ptrField->getIterationNumber(), MED_FIELD_DRIVER::_ptrField->getOrderNumber() - ) < 0) { + ); + if (ret < 0) { // we must do some delete !!! for(int j=0; j<=i;j++) delete[] myValues[j]; @@ -631,17 +649,17 @@ template void MED_FIELD_WRONLY_DRIVER::write(void) const // le champ existe deja ??? char * champName = new char[MED_TAILLE_NOM+1] ; - MED_FR::med_type_champ type ; + med_2_1::med_type_champ type ; char * compName ; char * compUnit ; bool Find = false ; - int n = MED_FR::MEDnChamp(MED_FIELD_DRIVER::_medIdt,0); + int n = med_2_1::MEDnChamp(MED_FIELD_DRIVER::_medIdt,0); int nbComp ; for (int i=1; i<=n; i++) { - nbComp = MED_FR::MEDnChamp(MED_FIELD_DRIVER::_medIdt,i); + nbComp = med_2_1::MEDnChamp(MED_FIELD_DRIVER::_medIdt,i); compName = new char[MED_TAILLE_PNOM*nbComp+1]; compUnit = new char[MED_TAILLE_PNOM*nbComp+1]; - err = MED_FR::MEDchampInfo(MED_FIELD_DRIVER::_medIdt,i,champName,&type,compName,compUnit,nbComp); + err = med_2_1::MEDchampInfo(MED_FIELD_DRIVER::_medIdt,i,champName,&type,compName,compUnit,nbComp); if (err == 0) if (strcmp(champName,MED_FIELD_DRIVER::_ptrField->getName().c_str())==0) { // Found ! Find = true ; @@ -672,13 +690,13 @@ template void MED_FIELD_WRONLY_DRIVER::write(void) const string dataGroupName = "/CHA/"; dataGroupName += MED_FIELD_DRIVER::_ptrField->getName(); MESSAGE(LOC << "|" << dataGroupName << "|" ); - med_idt gid = H5Gopen(MED_FIELD_DRIVER::_medIdt, dataGroupName.c_str() ); + MED_EN::med_idt gid = H5Gopen(MED_FIELD_DRIVER::_medIdt, dataGroupName.c_str() ); if ( gid < 0 ) { // create field : - err=MED_FR::MEDchampCr(MED_FIELD_DRIVER::_medIdt, + err=med_2_1::MEDchampCr(MED_FIELD_DRIVER::_medIdt, const_cast ((MED_FIELD_DRIVER::_ptrField->getName()).c_str()), - (MED_FR::med_type_champ) ValueType, + (med_2_1::med_type_champ) ValueType, const_cast ( component_name.c_str() ), const_cast ( component_unit.c_str() ), component_count); @@ -705,7 +723,7 @@ template void MED_FIELD_WRONLY_DRIVER::write(void) const // on boucle sur tout les types pour ecrire les tableaux de valeur int NumberOfType = mySupport->getNumberOfTypes() ; int Index = 1 ; - const medGeometryElement * Types = mySupport->getTypes() ; + const MED_EN::medGeometryElement * Types = mySupport->getTypes() ; const int * NumberOfGaussPoint = mySupport->getNumberOfGaussPoint() ; for (int i=0;igetNumberOfElements(Types[i]) ; @@ -727,10 +745,10 @@ template void MED_FIELD_WRONLY_DRIVER::write(void) const /* char chanom[MED_TAILLE_NOM+1]; char chacomp[MED_TAILLE_NOM+1]; char chaunit[MED_TAILLE_NOM+1]; - MED_FR::med_type_champ chatype; + med_2_1::med_type_champ chatype; med_int chancomp=1; - err=MED_FR::MEDchampInfo(MED_FIELD_DRIVER::_medIdt,1,chanom,&chatype,chacomp,chaunit,chancomp); + err=med_2_1::MEDchampInfo(MED_FIELD_DRIVER::_medIdt,1,chanom,&chatype,chacomp,chaunit,chancomp); if (err<0) { @@ -741,21 +759,48 @@ template void MED_FIELD_WRONLY_DRIVER::write(void) const cout<<"==================> type lu = "< nom composante lu = "< nom unit lu = "< valeur de MED_FR::MED_REEL64 = "< valeur de med_2_1::MED_REEL64 = "<::_medIdt, +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + if(_ptrField->getValueType()==MED_EN::MED_INT32) + { + int lgth2=_ptrField->getNumberOfValues(); + med_2_1::med_int *temp=new med_2_1::med_int[lgth2]; + for(int i2=0;i2::_medIdt, + const_cast ( MeshName.c_str()) , //( string(mesh_name).resize(MED_TAILLE_NOM).c_str()) + const_cast ( (MED_FIELD_DRIVER::_ptrField->getName()).c_str()), + (unsigned char*)temp, + med_2_1::MED_FULL_INTERLACE, + NumberOfElements, + NumberOfGaussPoint[i], + MED_ALL, + MED_NOPFL, + med_2_1::MED_REMP, // PROFIL NON GERE, mode de remplacement non géré + (med_2_1::med_entite_maillage)mySupport->getEntity(), + (med_2_1::med_geometrie_element)Types[i], + MED_FIELD_DRIVER::_ptrField->getIterationNumber(), + " ", + MED_FIELD_DRIVER::_ptrField->getTime(), + MED_FIELD_DRIVER::_ptrField->getOrderNumber() + ); + delete [] temp; + } + else +#endif + err=med_2_1::MEDchampEcr(MED_FIELD_DRIVER::_medIdt, const_cast ( MeshName.c_str()) , //( string(mesh_name).resize(MED_TAILLE_NOM).c_str()) const_cast ( (MED_FIELD_DRIVER::_ptrField->getName()).c_str()), (unsigned char*)value, - MED_FR::MED_FULL_INTERLACE, + med_2_1::MED_FULL_INTERLACE, NumberOfElements, NumberOfGaussPoint[i], MED_ALL, MED_NOPFL, - MED_FR::MED_REMP, // PROFIL NON GERE, mode de remplacement non géré - (MED_FR::med_entite_maillage)mySupport->getEntity(), - (MED_FR::med_geometrie_element)Types[i], + med_2_1::MED_REMP, // PROFIL NON GERE, mode de remplacement non géré + (med_2_1::med_entite_maillage)mySupport->getEntity(), + (med_2_1::med_geometrie_element)Types[i], MED_FIELD_DRIVER::_ptrField->getIterationNumber(), " ", MED_FIELD_DRIVER::_ptrField->getTime(), @@ -799,6 +844,7 @@ template void MED_FIELD_RDWR_DRIVER::read (void) MED_FIELD_RDONLY_DRIVER::read(); END_OF("MED_FIELD_RDWR_DRIVER::read(void)"); } +}//End namespace MEDMEM /*-----------------------------------------------------------------*/ #endif /* MED_FIELD_DRIVER_HXX */ diff --git a/src/MEDMEM/MEDMEM_MedMedDriver.cxx b/src/MEDMEM/MEDMEM_MedMedDriver.cxx index 405351cbf..f64914479 100644 --- a/src/MEDMEM/MEDMEM_MedMedDriver.cxx +++ b/src/MEDMEM/MEDMEM_MedMedDriver.cxx @@ -1,4 +1,3 @@ -using namespace std; # include # include "MEDMEM_MedMedDriver.hxx" @@ -14,7 +13,8 @@ using namespace std; # include "MEDMEM_define.hxx" -using namespace MED_FR; +using namespace std; +using namespace MED_EN; using namespace MEDMEM; MED_MED_DRIVER::MED_MED_DRIVER(): GENDRIVER(), @@ -24,7 +24,7 @@ MED_MED_DRIVER::MED_MED_DRIVER(): GENDRIVER(), MED_MED_DRIVER::MED_MED_DRIVER(const string & fileName, MED * const ptrMed): GENDRIVER(fileName,MED_EN::MED_RDWR), _ptrMed(ptrMed), _medIdt(MED_INVALID) { - _ptrMed->addDriver(*this); // The specific MED driver id is set within the addDriver method. + //_ptrMed->addDriver(*this); // The specific MED driver id is set within the addDriver method. } MED_MED_DRIVER::MED_MED_DRIVER(const string & fileName, @@ -99,7 +99,7 @@ void MED_MED_DRIVER::open() ); MESSAGE(LOC<<"_fileName.c_str : "<< _fileName.c_str()<<",mode : "<< _accessMode); - _medIdt = MEDouvrir( (const_cast (_fileName.c_str())), (MED_FR::med_mode_acces) _accessMode); + _medIdt = MEDouvrir( (const_cast (_fileName.c_str())), (med_2_1::med_mode_acces) _accessMode); MESSAGE(LOC<<" _medIdt = "<<_medIdt); if (_medIdt > 0) @@ -120,7 +120,7 @@ void MED_MED_DRIVER::open() void MED_MED_DRIVER::close() { - MED_FR::med_int err = 0; + med_2_1::med_int err = 0; const char * LOC = "MED_MED_DRIVER::close() : "; @@ -137,7 +137,7 @@ void MED_MED_DRIVER::close() // ); if ( _medIdt != MED_INVALID ) - err=MEDfermer(_medIdt); + err=med_2_1::MEDfermer(_medIdt); // if (err != MED_VALID) // throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) << "the file |" @@ -197,11 +197,11 @@ void MED_MED_RDONLY_DRIVER::readFileStruct( void ) { int numberOfMeshes; char meshName[MED_TAILLE_NOM+1]=""; - int meshDim; + med_2_1::med_int meshDim; MESH * ptrMesh; // MED_MESH_RDWR_DRIVER * ptrDriver; !! UNUSED VARIABLE !! - numberOfMeshes = MEDnMaa(_medIdt) ; + numberOfMeshes = med_2_1::MEDnMaa(_medIdt) ; if ( numberOfMeshes <= 0 ) MESSAGE(LOC << "Be careful there is no mesh in file |"<<_fileName<<"| !"); @@ -210,14 +210,14 @@ void MED_MED_RDONLY_DRIVER::readFileStruct( void ) // find out if the mesh is a Grid - int isAGrid = false; - MED_FR::med_grid_type type; + med_2_1::med_int isAGrid = false; + med_2_1::med_grid_type type; err = MEDgridInfo (_medIdt, i, &isAGrid, &type); if (err != MED_VALID) throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) << "error in MEDgridInfo()") ); - err = MEDmaaInfo(_medIdt, i ,meshName, &meshDim) ; + err = med_2_1::MEDmaaInfo(_medIdt, i ,meshName, &meshDim) ; if (err != MED_VALID) throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) << ": can't get information about the mesh n°" << i <<" of the file |" << _fileName << "| !" @@ -266,21 +266,21 @@ void MED_MED_RDONLY_DRIVER::readFileStruct( void ) int index = 0; for (currentEntity=meshEntities.begin();currentEntity != meshEntities.end(); currentEntity++) { string supportName="SupportOnAll_" ; - supportName+=entNames[(MED_FR::med_entite_maillage)(*currentEntity).first] ; - //(_ptrMed->_support)[meshName][(MED_FR::med_entite_maillage)(*currentEntity).first]=new SUPPORT(ptrMesh,supportName,(MED_EN::medEntityMesh) (*currentEntity).first) ; + supportName+=entNames[(*currentEntity).first] ; + //(_ptrMed->_support)[meshName][(MED_EN::medEntityMesh)(*currentEntity).first]=new SUPPORT(ptrMesh,supportName,(MED_EN::medEntityMesh) (*currentEntity).first) ; SUPPORT* mySupport = new SUPPORT() ; mySupport->setName(supportName); mySupport->setMesh(ptrMesh); mySupport->setEntity((MED_EN::medEntityMesh) (*currentEntity).first); mySupport->setAll(true); - (_ptrMed->_support)[meshName][(MED_FR::med_entite_maillage)(*currentEntity).first] = mySupport ; + (_ptrMed->_support)[meshName][(MED_EN::medEntityMesh)(*currentEntity).first] = mySupport ; MESSAGE(LOC<< "The support " << supportName.c_str() << " on entity " << (*currentEntity).first << " is built"); index++; } MESSAGE(LOC <<"The mesh " <getName() << " has " << index << " support(s)"); } - map >::const_iterator const_itSupportOnMesh ; + map >::const_iterator const_itSupportOnMesh ; int index = 0; @@ -288,7 +288,7 @@ void MED_MED_RDONLY_DRIVER::readFileStruct( void ) for (const_itSupportOnMesh=_ptrMed->_support.begin(); const_itSupportOnMesh != _ptrMed->_support.end(); const_itSupportOnMesh++ ) { - map::const_iterator const_itSupport ; + map::const_iterator const_itSupport ; for (const_itSupport=(*const_itSupportOnMesh).second.begin(); const_itSupport!=(*const_itSupportOnMesh).second.end();const_itSupport++) index++; } @@ -301,7 +301,7 @@ void MED_MED_RDONLY_DRIVER::readFileStruct( void ) for (const_itSupportOnMesh=_ptrMed->_support.begin(); const_itSupportOnMesh != _ptrMed->_support.end(); const_itSupportOnMesh++ ) { - map::const_iterator const_itSupport ; + map::const_iterator const_itSupport ; for (const_itSupport=(*const_itSupportOnMesh).second.begin(); const_itSupport!=(*const_itSupportOnMesh).second.end();const_itSupport++) { @@ -325,34 +325,34 @@ void MED_MED_RDONLY_DRIVER::readFileStruct( void ) char * unitName = (char *) MED_NULL; // char meshName[MED_TAILLE_NOM+1] = ""; char meshName[MED_TAILLE_NOM+1] ; - MED_FR::med_type_champ type; + med_2_1::med_type_champ type; MESH * ptrMesh = (MESH *) MED_NULL; FIELD_ * ptrField = (FIELD_ *) MED_NULL; //MED_FIELD_RDWR_DRIVER * ptrDriver = (MED_FIELD_RDWR_DRIVER * ) MED_NULL; GENDRIVER * ptrDriver = (GENDRIVER * ) MED_NULL; SUPPORT * ptrSupport = (SUPPORT * ) MED_NULL; MESH_ENTITIES::const_iterator currentEntity; - list::const_iterator currentGeometry; - int NbOfGaussPts = 0; + list::const_iterator currentGeometry; + med_2_1::med_int NbOfGaussPts = 0; int numberOfTimeSteps = -1; - int timeStepNumber = -1; + med_2_1::med_int timeStepNumber = -1; // char timeStepUnit[MED_TAILLE_PNOM]= ""; char timeStepUnit[MED_TAILLE_PNOM+1] ; double timeStep = 0.0; - int orderNumber = -1; //???init????? + med_2_1::med_int orderNumber = -1; //???init????? map & _meshes = _ptrMed->_meshes; map & _fields = _ptrMed->_fields; map & _meshName = _ptrMed->_meshName; - map > & _support = _ptrMed->_support; + map > & _support = _ptrMed->_support; - numberOfFields = MEDnChamp(_medIdt,0) ; + numberOfFields = med_2_1::MEDnChamp(_medIdt,0) ; if ( numberOfFields <= 0 ) MESSAGE(LOC << "Be careful there is no field in file |"<<_fileName<<"| !"); for (i=1;i<=numberOfFields;i++) { - numberOfComponents = MEDnChamp(_medIdt,i) ; + numberOfComponents = med_2_1::MEDnChamp(_medIdt,i) ; if ( numberOfComponents <= 0 ) if (err != MED_VALID) throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) << "Be careful there is no compound for field n°" @@ -383,8 +383,8 @@ void MED_MED_RDONLY_DRIVER::readFileStruct( void ) for (currentGeometry = (*currentEntity).second.begin();currentGeometry != (*currentEntity).second.end(); currentGeometry++) { MESSAGE("Field information with Entity,Geom = "<<(*currentEntity).first<<","<<(*currentGeometry)); numberOfTimeSteps = MEDnPasdetemps(_medIdt, fieldName, - (MED_FR::med_entite_maillage)(*currentEntity).first, - (MED_FR::med_geometrie_element) (*currentGeometry) ); + (med_2_1::med_entite_maillage)(*currentEntity).first, + (med_2_1::med_geometrie_element) (*currentGeometry) ); MESSAGE("Field information 2 : NumberOfTimeStep :"< MED_VALID ) break ; // There are value for some med_geometrie_element of this med_entite_maillage. @@ -398,8 +398,8 @@ void MED_MED_RDONLY_DRIVER::readFileStruct( void ) MESSAGE("Field information 4 : time step j = "< ( ptrSupport,numberOfComponents ); // Les valeurs du champ ne doivent pas être lue pour l'instant + // ptrField = new FIELD ( ptrSupport,numberOfComponents ); // Les valeurs du champ ne doivent pas être lue pour l'instant - ptrField = new FIELD ( ); // Les valeurs du champ ne doivent pas être lue pour l'instant - ((FIELD*) ptrField)->setSupport(ptrSupport); - ((FIELD*) ptrField)->setNumberOfComponents(numberOfComponents); - ((FIELD*) ptrField)->setName(fieldName) ; //provisoire, pour debug + ptrField = new FIELD ( ); // Les valeurs du champ ne doivent pas être lue pour l'instant + ((FIELD*) ptrField)->setSupport(ptrSupport); + ((FIELD*) ptrField)->setNumberOfComponents(numberOfComponents); + ((FIELD*) ptrField)->setName(fieldName) ; //provisoire, pour debug MESSAGE("#### SET NAME in FIELD : "<(_fileName, (FIELD *)ptrField); + ptrDriver = new MED_FIELD_RDONLY_DRIVER(_fileName, (FIELD *)ptrField); break ; case MED_EN::MED_REMP: - ptrDriver = new MED_FIELD_RDWR_DRIVER(_fileName, (FIELD *)ptrField); + ptrDriver = new MED_FIELD_RDWR_DRIVER(_fileName, (FIELD *)ptrField); break ; case MED_EN::MED_ECRI: // should never append !! - ptrDriver = new MED_FIELD_RDONLY_DRIVER(_fileName, (FIELD *)ptrField); + ptrDriver = new MED_FIELD_RDONLY_DRIVER(_fileName, (FIELD *)ptrField); break; default: throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Bad file mode access !")); } break; } - case MED_FR::MED_REEL64 : { - // ptrField = new FIELD ( ptrSupport,numberOfComponents ); // Les valeurs du champ ne doivent pas être lue pour l'instant - ptrField = new FIELD ( ); // Les valeurs du champ ne doivent pas être lue pour l'instant - ((FIELD*) ptrField)->setSupport(ptrSupport); - ((FIELD*) ptrField)->setNumberOfComponents(numberOfComponents); - ((FIELD*) ptrField)->setName(fieldName) ; //provisoire, pour debug + case med_2_1::MED_REEL64 : { + // ptrField = new FIELD ( ptrSupport,numberOfComponents ); // Les valeurs du champ ne doivent pas être lue pour l'instant + ptrField = new FIELD ( ); // Les valeurs du champ ne doivent pas être lue pour l'instant + ((FIELD*) ptrField)->setSupport(ptrSupport); + ((FIELD*) ptrField)->setNumberOfComponents(numberOfComponents); + ((FIELD*) ptrField)->setName(fieldName) ; //provisoire, pour debug MESSAGE("#### SET NAME in FIELD : "<(_fileName, (FIELD *)ptrField); + ptrDriver = new MED_FIELD_RDONLY_DRIVER(_fileName, (FIELD *)ptrField); break ; case MED_EN::MED_REMP: - ptrDriver = new MED_FIELD_RDWR_DRIVER(_fileName, (FIELD *)ptrField); + ptrDriver = new MED_FIELD_RDWR_DRIVER(_fileName, (FIELD *)ptrField); break ; case MED_EN::MED_ECRI: // should never append !! - ptrDriver = new MED_FIELD_RDONLY_DRIVER(_fileName, (FIELD *)ptrField); + ptrDriver = new MED_FIELD_RDONLY_DRIVER(_fileName, (FIELD *)ptrField); break; default: throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Bad file mode access !")); @@ -516,9 +516,9 @@ void MED_MED_RDONLY_DRIVER::readFileStruct( void ) throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) << " The Field type of |" << fieldName <<"|, entity : |" - << entNames [(MED_FR::med_entite_maillage) (*currentEntity).first] + << entNames [(*currentEntity).first] <<"|, geometric element of type |" - << geoNames [(MED_FR::med_geometrie_element) (*currentGeometry)] + << geoNames [(*currentGeometry)] <<"| is neither MED_INT, MED_INT32, MED_INT64 nor MED_REEL64 !" ) ); diff --git a/src/MEDMEM/MEDMEM_MedMedDriver.hxx b/src/MEDMEM/MEDMEM_MedMedDriver.hxx index 579e36330..7e948b1b4 100644 --- a/src/MEDMEM/MEDMEM_MedMedDriver.hxx +++ b/src/MEDMEM/MEDMEM_MedMedDriver.hxx @@ -27,7 +27,7 @@ class MED_MED_DRIVER : public GENDRIVER protected: MED * const _ptrMed; // Store 'MED_DRIVER (0..n)----(1) MED' associations - med_idt _medIdt; // The _medIdt used to write/read Meshes to ::_filename + MED_EN::med_idt _medIdt; // The _medIdt used to write/read Meshes to ::_filename //private: // MED_MED_DRIVER(); diff --git a/src/MEDMEM/MEDMEM_MedMeshDriver.cxx b/src/MEDMEM/MEDMEM_MedMeshDriver.cxx index 6f09f5cd2..beb5373db 100644 --- a/src/MEDMEM/MEDMEM_MedMeshDriver.cxx +++ b/src/MEDMEM/MEDMEM_MedMeshDriver.cxx @@ -1,4 +1,3 @@ -using namespace std; #include "MEDMEM_MedMeshDriver.hxx" #include "MEDMEM_DriversDef.hxx" @@ -11,7 +10,11 @@ using namespace std; #include "MEDMEM_CellModel.hxx" #include "MEDMEM_Grid.hxx" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; + extern "C" { extern med_idt _MEDdatagroupOuvrir(med_idt pid, char *nom); extern med_err _MEDdatagroupFermer(med_idt id); @@ -57,7 +60,7 @@ void MED_MESH_DRIVER::open() const char * LOC = "MED_MESH_DRIVER::open()" ; BEGIN_OF(LOC); MESSAGE(LOC<<" : _fileName.c_str : "<< _fileName.c_str()<<",mode : "<< _accessMode); - _medIdt = MED_FR::MEDouvrir( (const_cast (_fileName.c_str())),(MED_FR::med_mode_acces) _accessMode); + _medIdt = med_2_1::MEDouvrir( (const_cast (_fileName.c_str())),(med_2_1::med_mode_acces) _accessMode); MESSAGE(LOC<<" _medIdt : "<< _medIdt ); if (_medIdt > 0) _status = MED_OPENED; @@ -76,7 +79,7 @@ void MED_MESH_DRIVER::close() BEGIN_OF(LOC); int err = 0; if ( _status == MED_OPENED) { - err=MED_FR::MEDfermer(_medIdt); + err=med_2_1::MEDfermer(_medIdt); // san -- MED5873 : Calling H5close() here leads to failure of SALOMEDS::StudyManager_i::_SaveAs() // method during study saving process. MEDfermer() seems sufficient for closing a file. //H5close(); // If we call H5close() all the files are closed. @@ -97,10 +100,10 @@ void MED_MESH_DRIVER::setMeshName(const string & meshName) { _meshName = mesh string MED_MESH_DRIVER::getMeshName() const { return _meshName; }; //A FAIRE UTILISER LES MAPS... -const MED_FR::med_geometrie_element MED_MESH_DRIVER::all_cell_type[MED_NBR_GEOMETRIE_MAILLE]= - { MED_FR::MED_POINT1,MED_FR::MED_SEG2,MED_FR::MED_SEG3,MED_FR::MED_TRIA3,MED_FR::MED_QUAD4,MED_FR::MED_TRIA6,MED_FR::MED_QUAD8, - MED_FR::MED_TETRA4,MED_FR::MED_PYRA5,MED_FR::MED_PENTA6,MED_FR::MED_HEXA8,MED_FR::MED_TETRA10,MED_FR::MED_PYRA13, - MED_FR::MED_PENTA15, MED_FR::MED_HEXA20}; +const med_2_1::med_geometrie_element MED_MESH_DRIVER::all_cell_type[MED_NBR_GEOMETRIE_MAILLE]= + { med_2_1::MED_POINT1,med_2_1::MED_SEG2,med_2_1::MED_SEG3,med_2_1::MED_TRIA3,med_2_1::MED_QUAD4,med_2_1::MED_TRIA6,med_2_1::MED_QUAD8, + med_2_1::MED_TETRA4,med_2_1::MED_PYRA5,med_2_1::MED_PENTA6,med_2_1::MED_HEXA8,med_2_1::MED_TETRA10,med_2_1::MED_PYRA13, + med_2_1::MED_PENTA15, med_2_1::MED_HEXA20}; const char * const MED_MESH_DRIVER::all_cell_type_tab [MED_NBR_GEOMETRIE_MAILLE]= { "MED_POINT1","MED_SEG2","MED_SEG3","MED_TRIA3","MED_QUAD4","MED_TRIA6","MED_QUAD8", @@ -156,7 +159,7 @@ void MED_MESH_RDONLY_DRIVER::read(void) // int nbFam = MEDnFam(_medIdt, // const_cast (_meshName.c_str()), // 0, -// MED_FR::MED_FAMILLE); +// med_2_1::MED_FAMILLE); // if (nbFam > 0) { // getFAMILY(); @@ -221,7 +224,7 @@ void MED_MESH_RDONLY_DRIVER::getGRID() int err, i; // Read the dimension of the space for the mesh <_meshName> - int SpaceDimension = MED_FR::MEDdimLire(_medIdt,const_cast (_meshName.c_str())) ; + int SpaceDimension = med_2_1::MEDdimLire(_medIdt,const_cast (_meshName.c_str())) ; if ( SpaceDimension <= MED_VALID ) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"The space dimension |" << SpaceDimension << "| seems to be incorrect " << "for the mesh : |" << @@ -235,9 +238,9 @@ void MED_MESH_RDONLY_DRIVER::getGRID() int idim; for (idim = 0; idim < _ptrMesh->_spaceDimension; ++idim) { - int lenght = MED_FR::MEDnGrid(_medIdt, + int lenght = med_2_1::MEDnGrid(_medIdt, const_cast (_ptrMesh->_name.c_str()), - (MED_FR::med_grid) + (med_2_1::med_grid) idim ); if ( lenght <= MED_VALID ) @@ -248,7 +251,7 @@ void MED_MESH_RDONLY_DRIVER::getGRID() ArrayLen [idim][0] = lenght; } - MED_FR::med_repere rep ; + med_2_1::med_repere rep ; string tmp_nom_coord (MED_TAILLE_PNOM*(_ptrMesh->_spaceDimension)+1,' '); string tmp_unit_coord(MED_TAILLE_PNOM*(_ptrMesh->_spaceDimension)+1,' '); char * tmp_nom = (const_cast ( tmp_nom_coord.c_str()) ) ; @@ -261,9 +264,9 @@ void MED_MESH_RDONLY_DRIVER::getGRID() if (ptrGrid->getGridType() == MED_EN::MED_BODY_FITTED) { // Read nb of nodes - int NumberOfNodes = MED_FR::MEDnGrid(_medIdt, + int NumberOfNodes = med_2_1::MEDnGrid(_medIdt, const_cast (_meshName.c_str()), - MED_FR::MED_GRID_NOEUD); + med_2_1::MED_GRID_NOEUD); if ( NumberOfNodes <= MED_VALID ) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"The number of nodes |" << NumberOfNodes << "| seems to be incorrect " @@ -271,7 +274,8 @@ void MED_MESH_RDONLY_DRIVER::getGRID() _ptrMesh->_numberOfNodes = NumberOfNodes ; // this array is useless because families numbers are read in getFAMILY - int * MEDArrayNodeFamily = new int[ NumberOfNodes ]; + //CCRT as it is useless replace int by med_int + med_2_1::med_int * MEDArrayNodeFamily = new med_2_1::med_int[ NumberOfNodes ]; // create coordinates _ptrMesh->_coordinate = new COORDINATE(SpaceDimension,NumberOfNodes, MED_EN::MED_FULL_INTERLACE); @@ -280,22 +284,22 @@ void MED_MESH_RDONLY_DRIVER::getGRID() // double * coo = const_cast // (_ptrMesh->_coordinate->getCoordinates(MED_EN::MED_FULL_INTERLACE)); -// err = MED_FR::MEDbodyFittedLire (_medIdt, +// err = med_2_1::MEDbodyFittedLire (_medIdt, // const_cast (_ptrMesh->_name.c_str()), // _ptrMesh->_spaceDimension, // coo, -// MED_FR::MED_FULL_INTERLACE, +// med_2_1::MED_FULL_INTERLACE, // & rep, // tmp_nom, // tmp_unit, // MEDArrayNodeFamily, // NumberOfNodes); - err = MED_FR::MEDbodyFittedLire (_medIdt, + err = med_2_1::MEDbodyFittedLire (_medIdt, const_cast (_ptrMesh->_name.c_str()), _ptrMesh->_spaceDimension, const_cast ( _ptrMesh->_coordinate->_coordinate.get(MED_EN::MED_FULL_INTERLACE) ), - MED_FR::MED_FULL_INTERLACE, + med_2_1::MED_FULL_INTERLACE, & rep, tmp_nom, tmp_unit, @@ -328,12 +332,12 @@ void MED_MESH_RDONLY_DRIVER::getGRID() int nbNodesDim = * ArrayLen [idim]; nbNodes *= nbNodesDim; Array [idim] = new double [ nbNodesDim ]; - err = MED_FR::MEDgridLire (_medIdt, + err = med_2_1::MEDgridLire (_medIdt, const_cast (_ptrMesh->_name.c_str()), _ptrMesh->_spaceDimension, Array [idim], idim, - MED_FR::MED_FULL_INTERLACE, + med_2_1::MED_FULL_INTERLACE, & rep, tmp_nom, tmp_unit); @@ -351,9 +355,9 @@ void MED_MESH_RDONLY_DRIVER::getGRID() _ptrMesh->_coordinate = new COORDINATE(SpaceDimension,nbNodes, MED_EN::MED_FULL_INTERLACE); // Read node families -// int nbFamNodes = MED_FR::MEDnGrid(_medIdt, +// int nbFamNodes = med_2_1::MEDnGrid(_medIdt, // const_cast (_ptrMesh->_name.c_str()), -// MED_FR::MED_FAM_NOEUD); +// med_2_1::MED_FAM_NOEUD); // if (nbFamNodes > 0) // { // // int * fam = new int[ nbFamNodes ]; @@ -362,11 +366,11 @@ void MED_MESH_RDONLY_DRIVER::getGRID() // // this array is useless because families numbers are read in getFAMILY // int * MEDArrayNodeFamily = new int[ nbFamNodes ]; -// err = MED_FR::MEDfamGridLire (_medIdt, +// err = med_2_1::MEDfamGridLire (_medIdt, // const_cast (_ptrMesh->_name.c_str()), // MEDArrayNodeFamily, // nbFamNodes, -// MED_FR::MED_NOEUD); +// med_2_1::MED_NOEUD); // if (err != MED_VALID) // throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Can't read grid nodes families for " @@ -394,9 +398,9 @@ void MED_MESH_RDONLY_DRIVER::getGRID() string coordinateSystem = "UNDEFINED"; - if( rep == MED_FR::MED_CART) coordinateSystem = "CARTESIAN"; - else if ( rep == MED_FR::MED_CYL) coordinateSystem = "CYLINDRICAL"; - else if ( rep == MED_FR::MED_SPHER) coordinateSystem = "SPHERICAL"; + if( rep == med_2_1::MED_CART) coordinateSystem = "CARTESIAN"; + else if ( rep == med_2_1::MED_CYL) coordinateSystem = "CYLINDRICAL"; + else if ( rep == med_2_1::MED_SPHER) coordinateSystem = "SPHERICAL"; _ptrMesh->_coordinate->setCoordinatesSystem(coordinateSystem); @@ -419,7 +423,7 @@ int MED_MESH_RDONLY_DRIVER::getCOORDINATE() // Read the dimension of the space for the mesh <_meshName> // to be able to create a COORDINATE object - int SpaceDimension = MED_FR::MEDdimLire(_medIdt,const_cast (_meshName.c_str())) ; + int SpaceDimension = med_2_1::MEDdimLire(_medIdt,const_cast (_meshName.c_str())) ; if ( SpaceDimension <= MED_VALID ) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"The space dimension |" << SpaceDimension << "| seems to be incorrect " << "for the mesh : |" << _meshName << "|")) ; @@ -431,10 +435,10 @@ int MED_MESH_RDONLY_DRIVER::getCOORDINATE() // to be able to create a COORDINATE object int NumberOfNodes=MEDnEntMaa(_medIdt, const_cast (_meshName.c_str()), - MED_FR::MED_COOR, - MED_FR::MED_NOEUD, - (MED_FR::med_geometrie_element) MED_NONE, - (MED_FR::med_connectivite) MED_NONE); + med_2_1::MED_COOR, + med_2_1::MED_NOEUD, + (med_2_1::med_geometrie_element) MED_NONE, + (med_2_1::med_connectivite) MED_NONE); if ( NumberOfNodes <= MED_VALID ) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"The number of nodes |" << NumberOfNodes << "| seems to be incorrect " << "for the mesh : |" << _meshName << "|" )) ; @@ -445,7 +449,7 @@ int MED_MESH_RDONLY_DRIVER::getCOORDINATE() // create a COORDINATE object _ptrMesh->_coordinate = new COORDINATE(SpaceDimension, NumberOfNodes, MED_EN::MED_FULL_INTERLACE); - MED_FR::med_repere rep ; // ATTENTION ---> DOIT ETRE INTEGRE DS MESH EF: FAIT NON? + med_2_1::med_repere rep ; // ATTENTION ---> DOIT ETRE INTEGRE DS MESH EF: FAIT NON? string tmp_nom_coord (MED_TAILLE_PNOM*(_ptrMesh->_spaceDimension)+1,'\0'); string tmp_unit_coord(MED_TAILLE_PNOM*(_ptrMesh->_spaceDimension)+1,'\0'); char * tmp_nom = (const_cast ( tmp_nom_coord.c_str()) ) ; @@ -456,7 +460,7 @@ int MED_MESH_RDONLY_DRIVER::getCOORDINATE() _ptrMesh->_spaceDimension, //const_cast ( _ptrMesh->_coordinate->_coordinate->get(MED_EN::MED_FULL_INTERLACE) ), const_cast ( _ptrMesh->_coordinate->_coordinate.get(MED_EN::MED_FULL_INTERLACE) ), - MED_FR::MED_FULL_INTERLACE, + med_2_1::MED_FULL_INTERLACE, MED_ALL, // we read all the coordinates NULL, // we don't use a profile 0, // so the profile's size is 0 @@ -486,17 +490,17 @@ int MED_MESH_RDONLY_DRIVER::getCOORDINATE() // Pourquoi le stocker sous forme de chaîne ? switch (rep) { - case MED_FR::MED_CART : + case med_2_1::MED_CART : { _ptrMesh->_coordinate->_coordinateSystem = "CARTESIAN"; break ; } - case MED_FR::MED_CYL : + case med_2_1::MED_CYL : { _ptrMesh->_coordinate->_coordinateSystem = "CYLINDRICAL"; break ; } - case MED_FR::MED_SPHER : + case med_2_1::MED_SPHER : { _ptrMesh->_coordinate->_coordinateSystem = "SPHERICAL"; break ; @@ -512,24 +516,29 @@ int MED_MESH_RDONLY_DRIVER::getCOORDINATE() char * tmp_node_name = new char[NumberOfNodes*MED_TAILLE_PNOM+1]; tmp_node_name[NumberOfNodes]='\0' ; err=MEDnomLire(_medIdt,const_cast (_ptrMesh->_name.c_str()), - tmp_node_name,NumberOfNodes*MED_TAILLE_PNOM,MED_FR::MED_NOEUD, - (MED_FR::med_geometrie_element) MED_NONE); + tmp_node_name,NumberOfNodes*MED_TAILLE_PNOM,med_2_1::MED_NOEUD, + (med_2_1::med_geometrie_element) MED_NONE); if (err == MED_VALID) MESSAGE(LOC<<"MED_MESH_RDONLY_DRIVER::getNoeuds() : WARNING : Nodes have names but we do not read them !"); delete[] tmp_node_name ; // ??? Read the unused optional node Numbers ??? - int * tmp_node_number = new int[NumberOfNodes] ; + med_2_1::med_int * tmp_node_number = new med_2_1::med_int[NumberOfNodes] ; err=MEDnumLire(_medIdt,const_cast (_ptrMesh->_name.c_str()), - tmp_node_number,NumberOfNodes,MED_FR::MED_NOEUD,(MED_FR::med_geometrie_element)0); + tmp_node_number,NumberOfNodes,med_2_1::MED_NOEUD,(med_2_1::med_geometrie_element)0); if (err == MED_VALID) { // INFOS(LOC<<"WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING"); // INFOS(LOC<<"MED_MESH_RDONLY_DRIVER::getNoeuds() : WARNING : Nodes have numbers but we do not take care of them !"); // INFOS(LOC<<"WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING - WARNING"); MESSAGE(LOC<<"MED_MESH_RDONLY_DRIVER::getNoeuds() : Nodes have numbers, we DO TAKE care of them !"); _ptrMesh->_coordinate->_nodeNumber.set(NumberOfNodes) ; +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + for(med_2_1::med_int i2=0;i2_coordinate->_nodeNumber[i2]=(int)(tmp_node_number[i2]); +#else memcpy((int*)_ptrMesh->_coordinate->_nodeNumber,tmp_node_number,sizeof(int)*NumberOfNodes) ; +#endif ////////////////////////////////////////////////////////////////////////////////////// /// Modification pour prise en compte de la numérotation optionnelle des noeuds /// @@ -728,7 +737,7 @@ int MED_MESH_RDONLY_DRIVER::getNodalConnectivity(CONNECTIVITY * Connectivity) if (_status==MED_OPENED) { // Get the type of entity to work on (previously set in the Connectivity Object) - MED_FR::med_entite_maillage Entity = (MED_FR::med_entite_maillage) Connectivity->getEntity(); + med_2_1::med_entite_maillage Entity = (med_2_1::med_entite_maillage) Connectivity->getEntity(); // Get the number of cells of each type & store it in . int * tmp_cells_count = new int[MED_NBR_GEOMETRIE_MAILLE] ; @@ -737,8 +746,8 @@ int MED_MESH_RDONLY_DRIVER::getNodalConnectivity(CONNECTIVITY * Connectivity) { // EF :ON SCANNE DES GEOMETRIES INUTILES, UTILISER LES MAPS tmp_cells_count[i]=MEDnEntMaa(_medIdt,(const_cast (_ptrMesh->_name.c_str())), - MED_FR::MED_CONN,(MED_FR::med_entite_maillage) Entity, - all_cell_type[i],MED_FR::MED_NOD); + med_2_1::MED_CONN,(med_2_1::med_entite_maillage) Entity, + all_cell_type[i],med_2_1::MED_NOD); // Get the greatest dimension of the cells : Connectivity->_entityDimension // We suppose there is no cells used as faces in MED 2.2.x , this is forbidden !!! @@ -761,7 +770,7 @@ int MED_MESH_RDONLY_DRIVER::getNodalConnectivity(CONNECTIVITY * Connectivity) // if MED version < 2.2.x, we read only entity with dimention = Connectivity->_entityDimension. Lesser dimension are face or edge ! char version_med[10] ; - if ( MEDfichEntete(_medIdt,MED_FR::MED_VERSION,version_med) != 0 ) + if ( MEDfichEntete(_medIdt,med_2_1::MED_VERSION,version_med) != 0 ) { // error : we suppose we have not a good med file ! delete[] tmp_cells_count ; @@ -782,7 +791,7 @@ int MED_MESH_RDONLY_DRIVER::getNodalConnectivity(CONNECTIVITY * Connectivity) tmpFaceCount[0] = 0 ; int numberOfFacesTypes = 0; -// if ((version_med != "2.2")&(Entity==MED_FR::MED_MAILLE)) +// if ((version_med != "2.2")&(Entity==med_2_1::MED_MAILLE)) // { // Connectivity->_numberOfTypes=0; @@ -814,7 +823,7 @@ int MED_MESH_RDONLY_DRIVER::getNodalConnectivity(CONNECTIVITY * Connectivity) // } // } - if (Entity==MED_FR::MED_MAILLE) + if (Entity==med_2_1::MED_MAILLE) { Connectivity->_numberOfTypes=0; @@ -899,7 +908,7 @@ int MED_MESH_RDONLY_DRIVER::getNodalConnectivity(CONNECTIVITY * Connectivity) for ( i=0;i_numberOfTypes;i++) { int multi = 0 ; - MED_FR::med_geometrie_element med_type = (MED_FR::med_geometrie_element) Connectivity->_type[i].getType() ; + med_2_1::med_geometrie_element med_type = (med_2_1::med_geometrie_element) Connectivity->_type[i].getType() ; //if ( Connectivity->_type[i].getDimension() < Connectivity->_entityDimension) if (Connectivity->_entity == MED_CELL) if ( Connectivity->_type[i].getDimension() < _ptrMesh->_spaceDimension) @@ -913,16 +922,16 @@ int MED_MESH_RDONLY_DRIVER::getNodalConnectivity(CONNECTIVITY * Connectivity) NodalIndex[j]=NodalIndex[j-1]+NumberOfNodeByCell ; int tmp_numberOfCells = Connectivity->_count[i+1]-Connectivity->_count[i] ; - int * tmp_ConnectivityArray = new int[(NumberOfNodeByCell+multi)*tmp_numberOfCells]; + med_2_1::med_int * tmp_ConnectivityArray = new med_2_1::med_int[(NumberOfNodeByCell+multi)*tmp_numberOfCells]; //int err=MEDconnLire(_medIdt,const_cast (_ptrMesh->_name.c_str()), // Connectivity->_entityDimension,tmp_ConnectivityArray, - //MED_FR::MED_FULL_INTERLACE,NULL,0,Entity,med_type,MED_FR::MED_NOD); + //med_2_1::MED_FULL_INTERLACE,NULL,0,Entity,med_type,med_2_1::MED_NOD); int err=MEDconnLire(_medIdt,const_cast (_ptrMesh->_name.c_str()), _ptrMesh->_spaceDimension,tmp_ConnectivityArray, - MED_FR::MED_FULL_INTERLACE,NULL,0,Entity,med_type, - MED_FR::MED_NOD); + med_2_1::MED_FULL_INTERLACE,NULL,0,Entity,med_type, + med_2_1::MED_NOD); if ( err != MED_VALID) { @@ -939,7 +948,7 @@ int MED_MESH_RDONLY_DRIVER::getNodalConnectivity(CONNECTIVITY * Connectivity) // version originale sans prise en compte des numéros optionnels // for ( j=0; j_numberOfTypes; i++) { - MED_FR::med_geometrie_element med_type = (MED_FR::med_geometrie_element) constituent->_type[i].getType() ; + med_2_1::med_geometrie_element med_type = (med_2_1::med_geometrie_element) constituent->_type[i].getType() ; int NumberOfNodeByFace = constituent->_type[i].getNumberOfNodes() ; @@ -1034,17 +1043,17 @@ int MED_MESH_RDONLY_DRIVER::getNodalConnectivity(CONNECTIVITY * Connectivity) int tmp_numberOfFaces = constituent->_count[i+1]-constituent->_count[i] ; // Il faut ajouter 1 pour le zero a la lecture !!! // ATTENTION UNIQUEMENT POUR MED < 2.2.x - int * tmp_constituentArray = NULL; + med_2_1::med_int * tmp_constituentArray = NULL; if (version_med != "2.2") - tmp_constituentArray = new int[(NumberOfNodeByFace+1)*tmp_numberOfFaces] ; + tmp_constituentArray = new med_2_1::med_int[(NumberOfNodeByFace+1)*tmp_numberOfFaces] ; else { - tmp_constituentArray = new int[NumberOfNodeByFace*tmp_numberOfFaces] ; + tmp_constituentArray = new med_2_1::med_int[NumberOfNodeByFace*tmp_numberOfFaces] ; MESSAGE(LOC<<": WE ARE USING MED2.2 so there is no +1 for calculating the size of tmp_constituentArray !") ; } int err=MEDconnLire(_medIdt,const_cast (_ptrMesh->_name.c_str()), Connectivity->_entityDimension,tmp_constituentArray, - MED_FR::MED_FULL_INTERLACE,NULL,0,MED_FR::MED_MAILLE,med_type,MED_FR::MED_NOD); + med_2_1::MED_FULL_INTERLACE,NULL,0,med_2_1::MED_MAILLE,med_type,med_2_1::MED_NOD); if ( err != MED_VALID) { MESSAGE(LOC<<": MEDconnLire returns "<_numberOfTypes; i++) { - MED_FR::med_geometrie_element med_type = (MED_FR::med_geometrie_element) constituent->_type[i].getType() ; + med_2_1::med_geometrie_element med_type = (med_2_1::med_geometrie_element) constituent->_type[i].getType() ; int NumberOfNodeByEdge = constituent->_type[i].getNumberOfNodes() ; @@ -1147,17 +1156,17 @@ int MED_MESH_RDONLY_DRIVER::getNodalConnectivity(CONNECTIVITY * Connectivity) // Il faut ajouter 1 pour le zero a la lecture !!! // ATTENTION UNIQUEMENT POUR MED < 2.2.x - int * tmp_constituentArray = NULL; + med_2_1::med_int * tmp_constituentArray = NULL; if (version_med != "2.2") - tmp_constituentArray = new int[(NumberOfNodeByEdge+1)*tmp_numberOfEdges] ; + tmp_constituentArray = new med_2_1::med_int[(NumberOfNodeByEdge+1)*tmp_numberOfEdges] ; else { - tmp_constituentArray = new int[NumberOfNodeByEdge*tmp_numberOfEdges] ; + tmp_constituentArray = new med_2_1::med_int[NumberOfNodeByEdge*tmp_numberOfEdges] ; MESSAGE(LOC<<": WE ARE USING MED2.2 so there is no +1 for calculating the size of tmp_constituentArray !") ; } int err=MEDconnLire(_medIdt,const_cast (_ptrMesh->_name.c_str()), _ptrMesh->_spaceDimension,tmp_constituentArray, - MED_FR::MED_FULL_INTERLACE,NULL,0,MED_FR::MED_MAILLE,med_type,MED_FR::MED_NOD); + med_2_1::MED_FULL_INTERLACE,NULL,0,med_2_1::MED_MAILLE,med_type,med_2_1::MED_NOD); if ( err != MED_VALID) { MESSAGE(LOC<<": MEDconnLire returns "<getNumberOfTypes(MED_CELL);i++) MEDArrayCellFamily[i] = new int[_ptrMesh->getNumberOfElements(MED_CELL,myTypes[i])] ; - err = getCellsFamiliesNumber(MEDArrayCellFamily,_ptrMesh->_connectivity) ; + err = getCellsFamiliesNumber(MEDArrayCellFamily,_ptrMesh->_connectivity,MED_CELL) ; MESSAGE(LOC << "error returned from getCellsFamiliesNumber for Cells " << err); @@ -1307,7 +1316,7 @@ int MED_MESH_RDONLY_DRIVER::getFAMILY() for (int i=0;i<_ptrMesh->getNumberOfTypes(MED_FACE);i++) MEDArrayFaceFamily[i] = new int[_ptrMesh->getNumberOfElements(MED_FACE,myTypes[i])] ; - err = getCellsFamiliesNumber(MEDArrayFaceFamily,_ptrMesh->_connectivity->_constituent) ; + err = getCellsFamiliesNumber(MEDArrayFaceFamily,_ptrMesh->_connectivity->_constituent,MED_FACE) ; MESSAGE(LOC << "error returned from getCellsFamiliesNumber for Faces " << err); @@ -1317,7 +1326,7 @@ int MED_MESH_RDONLY_DRIVER::getFAMILY() myTypes = _ptrMesh->getTypes(MED_EDGE); for (int i=0;i<_ptrMesh->getNumberOfTypes(MED_EDGE);i++) MEDArrayEdgeFamily[i] = new int[_ptrMesh->getNumberOfElements(MED_EDGE,myTypes[i])] ; - err = getCellsFamiliesNumber(MEDArrayEdgeFamily,_ptrMesh->_connectivity->_constituent) ; + err = getCellsFamiliesNumber(MEDArrayEdgeFamily,_ptrMesh->_connectivity->_constituent,MED_EDGE) ; MESSAGE(LOC << "error returned from getCellsFamiliesNumber for Edges in 2D " << err); @@ -1328,7 +1337,7 @@ int MED_MESH_RDONLY_DRIVER::getFAMILY() myTypes = _ptrMesh->getTypes(MED_EDGE); for (int i=0;i<_ptrMesh->getNumberOfTypes(MED_EDGE);i++) MEDArrayEdgeFamily[i] = new int[_ptrMesh->getNumberOfElements(MED_EDGE,myTypes[i])] ; - err = getCellsFamiliesNumber(MEDArrayEdgeFamily,_ptrMesh->_connectivity->_constituent->_constituent) ; // we are in 3D ! + err = getCellsFamiliesNumber(MEDArrayEdgeFamily,_ptrMesh->_connectivity->_constituent->_constituent,MED_EDGE) ; // we are in 3D ! MESSAGE(LOC << "error returned from getCellsFamiliesNumber for Edges in 3D " << err); @@ -1340,17 +1349,28 @@ int MED_MESH_RDONLY_DRIVER::getFAMILY() // node int NumberOfNodes = _ptrMesh->getNumberOfNodes() ; MEDArrayNodeFamily = new int[ NumberOfNodes ]; - err = MED_FR::MEDfamGridLire (_medIdt, +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + med_2_1::med_int* MEDArrayNodeFamily2 = new med_2_1::med_int[ NumberOfNodes ]; + err = med_2_1::MEDfamGridLire (_medIdt, + const_cast (_ptrMesh->_name.c_str()), + MEDArrayNodeFamily2, + NumberOfNodes, + med_2_1::MED_NOEUD); + for(int i=0;i (_ptrMesh->_name.c_str()), MEDArrayNodeFamily, NumberOfNodes, - MED_FR::MED_NOEUD); - + med_2_1::MED_NOEUD); +#endif // what about cell face and edge ? } // Creation of the families - int NumberOfFamilies = MEDnFam(_medIdt,const_cast (_meshName.c_str()),0,MED_FR::MED_FAMILLE) ; + int NumberOfFamilies = MEDnFam(_medIdt,const_cast (_meshName.c_str()),0,med_2_1::MED_FAMILLE) ; if ( NumberOfFamilies < 1 ) // at least family 0 must exist throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"There is no FAMILY, FAMILY 0 must exists" )); @@ -1368,28 +1388,47 @@ int MED_MESH_RDONLY_DRIVER::getFAMILY() for (int i=0;i (_meshName.c_str()),i+1,MED_FR::MED_ATTR) ; + med_2_1::med_int NumberOfAttributes = MEDnFam(_medIdt,const_cast (_meshName.c_str()),i+1,med_2_1::MED_ATTR) ; if (NumberOfAttributes < 0) throw MEDEXCEPTION("MED_MESH_RDONLY_DRIVER::getFAMILY() : NumberOfAttributes" ); - int NumberOfGroups = MEDnFam(_medIdt,const_cast (_meshName.c_str()),i+1,MED_FR::MED_GROUPE) ; + med_2_1::med_int NumberOfGroups = MEDnFam(_medIdt,const_cast (_meshName.c_str()),i+1,med_2_1::MED_GROUPE) ; if (NumberOfGroups < 0) throw MEDEXCEPTION("MED_MESH_RDONLY_DRIVER::getFAMILY() : NumberOfGroups" ); - int FamilyIdentifier ; + med_2_1::med_int FamilyIdentifier ; string FamilyName(MED_TAILLE_NOM,'\0'); int * AttributesIdentifier = new int[NumberOfAttributes] ; int * AttributesValues = new int[NumberOfAttributes] ; string AttributesDescription(MED_TAILLE_DESC*NumberOfAttributes,' ') ; string GroupsNames(MED_TAILLE_LNOM*NumberOfGroups+1,'\0') ; - err = MED_FR::MEDfamInfo(_medIdt,const_cast (_meshName.c_str()), +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + med_2_1::med_int tmp_NumberOfAttributes=NumberOfAttributes; + med_2_1::med_int * AttributesIdentifier2 = new med_2_1::med_int[NumberOfAttributes] ; + med_2_1::med_int * AttributesValues2 = new med_2_1::med_int[NumberOfAttributes] ; + err = med_2_1::MEDfamInfo(_medIdt,const_cast (_meshName.c_str()), + i+1,const_cast (FamilyName.c_str()), + &FamilyIdentifier,AttributesIdentifier2,AttributesValues2, + const_cast (AttributesDescription.c_str()), + &NumberOfAttributes, + const_cast (GroupsNames.c_str()),&NumberOfGroups + ); + for(med_2_1::med_int i2=0;i2 (_meshName.c_str()), i+1,const_cast (FamilyName.c_str()), &FamilyIdentifier,AttributesIdentifier,AttributesValues, const_cast (AttributesDescription.c_str()), &NumberOfAttributes, const_cast (GroupsNames.c_str()),&NumberOfGroups ); - +#endif SCRUTE(GroupsNames); SCRUTE(FamilyName); @@ -1399,10 +1438,10 @@ int MED_MESH_RDONLY_DRIVER::getFAMILY() if (err != MED_VALID) throw MEDEXCEPTION("MED_MESH_RDONLY_DRIVER::getFAMILY() : ERROR when get FAMILY informations" ); if (FamilyIdentifier != 0 ) { - FAMILY * Family = new FAMILY(_ptrMesh,FamilyIdentifier,FamilyName, - NumberOfAttributes,AttributesIdentifier, + FAMILY * Family = new FAMILY(_ptrMesh,(int)FamilyIdentifier,FamilyName, + (int)NumberOfAttributes,AttributesIdentifier, AttributesValues,AttributesDescription, - NumberOfGroups,GroupsNames, + (int)NumberOfGroups,GroupsNames, MEDArrayNodeFamily, MEDArrayCellFamily, MEDArrayFaceFamily, @@ -1480,10 +1519,22 @@ int MED_MESH_RDONLY_DRIVER::getNodesFamiliesNumber(int * MEDArrayNodeFamily) BEGIN_OF(LOC); if (_status==MED_OPENED) { int err = 0 ; +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + int lgth=_ptrMesh->getNumberOfNodes(); + med_2_1::med_int *temp=new med_2_1::med_int[lgth]; + err = MEDfamLire(_medIdt,(const_cast (_ptrMesh->_name.c_str())), + temp, + _ptrMesh->getNumberOfNodes(), + med_2_1::MED_NOEUD,(med_2_1::med_geometrie_element) MED_NONE); + for(int i2=0;i2 (_ptrMesh->_name.c_str())), MEDArrayNodeFamily, _ptrMesh->getNumberOfNodes(), - MED_FR::MED_NOEUD,(MED_FR::med_geometrie_element) MED_NONE); + med_2_1::MED_NOEUD,(med_2_1::med_geometrie_element) MED_NONE); +#endif if ( err != MED_VALID) { throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "There is no family for the |"<< _ptrMesh->getNumberOfNodes() << "| nodes in mesh |" @@ -1495,7 +1546,7 @@ int MED_MESH_RDONLY_DRIVER::getNodesFamiliesNumber(int * MEDArrayNodeFamily) return MED_ERROR; } -int MED_MESH_RDONLY_DRIVER::getCellsFamiliesNumber(int **MEDArrayFamily,CONNECTIVITY *Connectivity) +int MED_MESH_RDONLY_DRIVER::getCellsFamiliesNumber(int **MEDArrayFamily,CONNECTIVITY *Connectivity, MED_EN::medEntityMesh entity) { const char * LOC = "MED_MESH_RDONLY_DRIVER::getCellsFamiliesNumber " ; BEGIN_OF(LOC); @@ -1504,18 +1555,43 @@ int MED_MESH_RDONLY_DRIVER::getCellsFamiliesNumber(int **MEDArrayFamily,CONNECT int i, err = 0 ; for (i=0;i_numberOfTypes;i++) { int NumberOfCell = Connectivity->_count[i+1]-Connectivity->_count[i] ; +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + const medGeometryElement * myTypes = _ptrMesh->getTypes(entity); + int lgthI=_ptrMesh->getNumberOfElements(entity,myTypes[i]); + med_2_1::med_int *temp=new med_2_1::med_int[lgthI]; + err=MEDfamLire(_medIdt,const_cast (_ptrMesh->_name.c_str()), + temp,NumberOfCell, + (med_2_1::med_entite_maillage) Connectivity->_entity, + (med_2_1::med_geometrie_element) Connectivity->_geometricTypes[i]); + for(int i2=0;i2 (_ptrMesh->_name.c_str()), MEDArrayFamily[i],NumberOfCell, - (MED_FR::med_entite_maillage) Connectivity->_entity, - (MED_FR::med_geometrie_element) Connectivity->_geometricTypes[i]); + (med_2_1::med_entite_maillage) Connectivity->_entity, + (med_2_1::med_geometrie_element) Connectivity->_geometricTypes[i]); +#endif // provisoire : si les faces ou les aretes sont des mailles !!! if (err != MED_VALID) { MESSAGE(LOC<<"search face/edge family on cell !!!"); +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + int lgthI=_ptrMesh->getNumberOfElements(entity,myTypes[i]); + med_2_1::med_int *temp=new med_2_1::med_int[lgthI]; + err=MEDfamLire(_medIdt,const_cast (_ptrMesh->_name.c_str()), + temp,NumberOfCell, + med_2_1::MED_MAILLE, + (med_2_1::med_geometrie_element) Connectivity->_geometricTypes[i]); + for(int i2=0;i2 (_ptrMesh->_name.c_str()), MEDArrayFamily[i],NumberOfCell, - MED_FR::MED_MAILLE, - (MED_FR::med_geometrie_element) Connectivity->_geometricTypes[i]); + med_2_1::MED_MAILLE, + (med_2_1::med_geometrie_element) Connectivity->_geometricTypes[i]); +#endif } if (err != MED_VALID) @@ -1662,10 +1738,10 @@ void MED_MESH_WRONLY_DRIVER::write(void) const if ( err < MED_VALID ) { SCRUTE(err); - err = MED_FR::MEDfamCr( _medIdt, + err = med_2_1::MEDfamCr( _medIdt, const_cast ( _meshName.c_str() ), "FAMILLE_0", 0, - (int*)NULL, (int*)NULL, (char*)NULL, 0, + (med_2_1::med_int*)NULL, (med_2_1::med_int*)NULL, (char*)NULL, 0, (char*)NULL, 0); if ( err != MED_VALID) @@ -1712,8 +1788,8 @@ int MED_MESH_WRONLY_DRIVER::writeGRID() const } GRID * ptrGrid = (GRID*) _ptrMesh; - MED_FR::med_err err = MED_ERROR; - MED_FR::med_repere rep; + med_2_1::med_err err = MED_ERROR; + med_2_1::med_repere rep; string tmp_name(_ptrMesh->_spaceDimension*MED_TAILLE_PNOM,' '); string tmp_unit(_ptrMesh->_spaceDimension*MED_TAILLE_PNOM,' '); @@ -1721,13 +1797,13 @@ int MED_MESH_WRONLY_DRIVER::writeGRID() const // If it doesn't exists create it // If it already exists verify if its dimension is the same as <_ptrMesh->_spaceDimension> // rem : <_meshName> is the driver meshName not _meshName> - int dim = MED_FR::MEDdimLire(_medIdt, const_cast (_meshName.c_str()) ); + int dim = med_2_1::MEDdimLire(_medIdt, const_cast (_meshName.c_str()) ); if (dim < MED_VALID) { - err = MEDgridCr(_medIdt, + err = med_2_1::MEDgridCr(_medIdt, const_cast (_meshName.c_str()), _ptrMesh->_spaceDimension, - (MED_FR::med_grid_type) ptrGrid->getGridType()); + (med_2_1::med_grid_type) ptrGrid->getGridType()); if (err != MED_VALID) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Unable to create Grid")); else @@ -1756,20 +1832,20 @@ int MED_MESH_WRONLY_DRIVER::writeGRID() const // Pourquoi le stocker sous forme de chaîne ? const string & coordinateSystem = _ptrMesh->_coordinate->_coordinateSystem; if (coordinateSystem == "CARTESIAN") - rep = MED_FR::MED_CART; + rep = med_2_1::MED_CART; else if ( coordinateSystem == "CYLINDRICAL") - rep = MED_FR::MED_CYL; + rep = med_2_1::MED_CYL; else if ( coordinateSystem == "SPHERICAL" ) - rep = MED_FR::MED_SPHER; + rep = med_2_1::MED_SPHER; else throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Grid |" << _meshName.c_str() << "| doesn't have a valid coordinate system : |" << _ptrMesh->_coordinate->_coordinateSystem << "|" )) ; - int ArrayLen[] = { ptrGrid->_iArrayLength, - ptrGrid->_jArrayLength, - ptrGrid->_kArrayLength }; + med_2_1::med_int ArrayLen[] = { (med_2_1::med_int) ptrGrid->_iArrayLength, + (med_2_1::med_int) ptrGrid->_jArrayLength, + (med_2_1::med_int) ptrGrid->_kArrayLength }; // Write node coordinates for MED_BODY_FITTED grid if (ptrGrid->getGridType() == MED_EN::MED_BODY_FITTED) @@ -1780,20 +1856,21 @@ int MED_MESH_WRONLY_DRIVER::writeGRID() const (_ptrMesh->_coordinate->getCoordinates(MED_EN::MED_FULL_INTERLACE)); // Write unused families - int * MEDArrayNodeFamily = new int[_ptrMesh->_numberOfNodes] ; + //CCRT unused => med_2_1::med_int + med_2_1::med_int * MEDArrayNodeFamily = new med_2_1::med_int[_ptrMesh->_numberOfNodes] ; err = MEDbodyFittedEcr (_medIdt, const_cast (_ptrMesh->_name.c_str()), _ptrMesh->_spaceDimension, coo, ArrayLen, - MED_FR::MED_FULL_INTERLACE, + med_2_1::MED_FULL_INTERLACE, rep, const_cast (tmp_name.c_str()), const_cast (tmp_unit.c_str()), MEDArrayNodeFamily, _ptrMesh->_numberOfNodes, - MED_FR::MED_REMP); + med_2_1::MED_REMP); delete[] MEDArrayNodeFamily; if (err != MED_VALID) @@ -1810,17 +1887,17 @@ int MED_MESH_WRONLY_DRIVER::writeGRID() const int idim; for (idim = 0; idim < _ptrMesh->_spaceDimension; ++idim) { - err = MEDgridEcr (_medIdt, + err = med_2_1::MEDgridEcr (_medIdt, const_cast (_ptrMesh->_name.c_str()), _ptrMesh->_spaceDimension, Array [idim], ArrayLen [idim], idim, - MED_FR::MED_FULL_INTERLACE, + med_2_1::MED_FULL_INTERLACE, rep, const_cast (tmp_name.c_str()), const_cast (tmp_unit.c_str()), - MED_FR::MED_REMP); + med_2_1::MED_REMP); if (err != MED_VALID) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Can't read grid coordinates for " << idim << "-th dimention")); @@ -1830,8 +1907,8 @@ int MED_MESH_WRONLY_DRIVER::writeGRID() const // const_cast (_ptrMesh->_name.c_str()), // _ptrMesh->_MEDArrayNodeFamily, // _ptrMesh->_numberOfNodes, -// MED_FR::MED_REMP, -// MED_FR::MED_NOEUD); +// med_2_1::MED_REMP, +// med_2_1::MED_NOEUD); if (err != MED_VALID) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"error in MEDfamGridEcr()")); @@ -1851,8 +1928,8 @@ int MED_MESH_WRONLY_DRIVER::writeCoordinates() const { const char * LOC = "int MED_MESH_WRONLY_DRIVER::writeCoordinates() const : "; BEGIN_OF(LOC); - MED_FR::med_err err = MED_ERROR; - MED_FR::med_repere rep; + med_2_1::med_err err = MED_ERROR; + med_2_1::med_repere rep; string tmp_name(_ptrMesh->_spaceDimension*MED_TAILLE_PNOM,' '); string tmp_unit(_ptrMesh->_spaceDimension*MED_TAILLE_PNOM,' '); @@ -1872,9 +1949,9 @@ int MED_MESH_WRONLY_DRIVER::writeCoordinates() const { // If it doesn't exists create it // If it already exists verify if its dimension is the same as <_ptrMesh->_spaceDimension> // rem : <_meshName> is the driver meshName not _meshName> - int dim = MED_FR::MEDdimLire(_medIdt, const_cast (_meshName.c_str()) ); + int dim = med_2_1::MEDdimLire(_medIdt, const_cast (_meshName.c_str()) ); if (dim < MED_VALID) - if (MED_FR::MEDmaaCr(_medIdt,const_cast (_meshName.c_str()),_ptrMesh->_spaceDimension) != 0 ) + if (med_2_1::MEDmaaCr(_medIdt,const_cast (_meshName.c_str()),_ptrMesh->_spaceDimension) != 0 ) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Unable to create Mesh : |" << _meshName << "|")); else { @@ -1888,11 +1965,11 @@ int MED_MESH_WRONLY_DRIVER::writeCoordinates() const { // Pourquoi le stocker sous forme de chaîne ? const string & coordinateSystem = _ptrMesh->_coordinate->_coordinateSystem; if (coordinateSystem == "CARTESIAN") - rep = MED_FR::MED_CART; + rep = med_2_1::MED_CART; else if ( coordinateSystem == "CYLINDRICAL") - rep = MED_FR::MED_CYL; + rep = med_2_1::MED_CYL; else if ( coordinateSystem == "SPHERICAL" ) - rep = MED_FR::MED_SPHER; + rep = med_2_1::MED_SPHER; else throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Mesh |" << _meshName.c_str() << "| doesn't have a valid coordinate system : |" << _ptrMesh->_coordinate->_coordinateSystem @@ -1902,9 +1979,9 @@ int MED_MESH_WRONLY_DRIVER::writeCoordinates() const { _ptrMesh->_spaceDimension, //const_cast ( _ptrMesh->_coordinate->_coordinate->get(MED_EN::MED_FULL_INTERLACE) ), const_cast ( _ptrMesh->_coordinate->_coordinate.get(MED_EN::MED_FULL_INTERLACE) ), - MED_FR::MED_FULL_INTERLACE, + med_2_1::MED_FULL_INTERLACE, _ptrMesh->_numberOfNodes, // _ptrMesh->_coordinate->_numberOfNodes - MED_FR::MED_REMP, + med_2_1::MED_REMP, rep, const_cast (tmp_name.c_str()), const_cast (tmp_unit.c_str()) @@ -1927,12 +2004,22 @@ int MED_MESH_WRONLY_DRIVER::writeCoordinates() const { if (_ptrMesh->_arePresentOptionnalNodesNumbers==1) { - +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + int lgth=_ptrMesh->_coordinate->getNumberOfNodes(); + med_2_1::med_int *temp=new med_2_1::med_int[lgth]; + for(int i2=0;i2_coordinate->getNodesNumbers()[i2]); + err = MEDnumEcr(_medIdt,const_cast (_meshName.c_str()), + temp, + _ptrMesh->_numberOfNodes, med_2_1::MED_REMP, + med_2_1::MED_NOEUD, med_2_1::med_geometrie_element(0) ); + delete [] temp; +#else err = MEDnumEcr(_medIdt,const_cast (_meshName.c_str()), - const_cast (_ptrMesh->_coordinate->getNodesNumbers() ), - _ptrMesh->_numberOfNodes, MED_FR::MED_REMP, - MED_FR::MED_NOEUD, MED_FR::med_geometrie_element(0) ); - + const_cast (_ptrMesh->_coordinate->getNodesNumbers() ), + _ptrMesh->_numberOfNodes, med_2_1::MED_REMP, + med_2_1::MED_NOEUD, med_2_1::med_geometrie_element(0) ); +#endif if (err<0) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Can't write optionnal numbers of mesh |" << _meshName.c_str() @@ -1953,7 +2040,7 @@ int MED_MESH_WRONLY_DRIVER::writeConnectivities(medEntityMesh entity) const { const char * LOC="int MED_MESH_WRONLY_DRIVER::writeConnectivities() const : "; BEGIN_OF(LOC); - MED_FR::med_err err; + med_2_1::med_err err; // REM SI LA METHODE EST APPELEE DIRECTEMENT ET QUE LE MAILLAGE N'EST PAS CREE IL Y A PB ! // PG : IMPOSSIBLE : LA METHODE EST PRIVEE ! @@ -2018,14 +2105,25 @@ int MED_MESH_WRONLY_DRIVER::writeConnectivities(medEntityMesh entity) const { // } ////////////////////////////////////////////////////////////////////////////////////// - +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + int lgth=numberOfElements*(numberOfNodes+multi); + med_2_1::med_int *temp=new med_2_1::med_int[lgth]; + for(int i2=0;i2 ( _meshName.c_str()), _ptrMesh->_spaceDimension, + temp, med_2_1::MED_FULL_INTERLACE , numberOfElements, + med_2_1::MED_REMP, + (med_2_1::med_entite_maillage ) entity, + (med_2_1::med_geometrie_element) types[i], med_2_1::MED_NOD ); + delete [] temp; +#else err = MEDconnEcr( _medIdt, const_cast ( _meshName.c_str()), _ptrMesh->_spaceDimension, - connectivityArray, MED_FR::MED_FULL_INTERLACE , numberOfElements, - MED_FR::MED_REMP, - (MED_FR::med_entite_maillage ) entity, - (MED_FR::med_geometrie_element) types[i], MED_FR::MED_NOD ); + connectivityArray, med_2_1::MED_FULL_INTERLACE , numberOfElements, + med_2_1::MED_REMP, + (med_2_1::med_entite_maillage ) entity, + (med_2_1::med_geometrie_element) types[i], med_2_1::MED_NOD ); +#endif delete[] connectivityArray ; - if (err<0) // ETENDRE LES EXPLICATIONS throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Can't write connectivities of mesh |" << _meshName.c_str() << "| in file |" << _fileName << "| with dimension |" << _ptrMesh->_spaceDimension <<"| and" @@ -2044,16 +2142,34 @@ int MED_MESH_WRONLY_DRIVER::writeConnectivities(medEntityMesh entity) const { const int * connectivity = _ptrMesh->getConnectivity(MED_EN::MED_FULL_INTERLACE, MED_DESCENDING, entity, types[i]); // Pour l'instant la class utilise le multi..... - err = MED_FR::MEDconnEcr( _medIdt, +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + int lgth=_ptrMesh->getConnectivityLength(MED_EN::MED_FULL_INTERLACE, MED_DESCENDING, entity, types[i]); + med_2_1::med_int *temp=new med_2_1::med_int[lgth]; + for(int i2=0;i2 ( _meshName.c_str()), + _ptrMesh->_spaceDimension, + temp, + med_2_1::MED_FULL_INTERLACE, + numberOfElements, + med_2_1::MED_REMP, + (med_2_1::med_entite_maillage ) entity, + (med_2_1::med_geometrie_element) types[i], + med_2_1::MED_DESC ); + delete [] temp; +#else + err = med_2_1::MEDconnEcr( _medIdt, const_cast ( _meshName.c_str()), _ptrMesh->_spaceDimension, const_cast (connectivity), - MED_FR::MED_FULL_INTERLACE, + med_2_1::MED_FULL_INTERLACE, numberOfElements, - MED_FR::MED_REMP, - (MED_FR::med_entite_maillage ) entity, - (MED_FR::med_geometrie_element) types[i], - MED_FR::MED_DESC ); + med_2_1::MED_REMP, + (med_2_1::med_entite_maillage ) entity, + (med_2_1::med_geometrie_element) types[i], + med_2_1::MED_DESC ); +#endif if (err<0) // ETENDRE LES EXPLICATIONS throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Can't write connectivities of mesh |" << _meshName.c_str() << "| in file |" << _fileName @@ -2071,7 +2187,7 @@ int MED_MESH_WRONLY_DRIVER::writeFamilyNumbers() const { const char * LOC="int MED_MESH_WRONLY_DRIVER::writeFamilyNumbers() const : "; BEGIN_OF(LOC); - MED_FR::med_err err; + med_2_1::med_err err; // SOLUTION TEMPORAIRE CAR _ptrMesh->_MEDArrayNodeFamily DOIT ETRE ENLEVER DE LA CLASSE MESH @@ -2117,18 +2233,44 @@ int MED_MESH_WRONLY_DRIVER::writeFamilyNumbers() const { for(int j=0; jgetIsAGrid() ) + if ( !_ptrMesh->getIsAGrid() ){ +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + int lgth=NumberOfNodes; + med_2_1::med_int *temp=new med_2_1::med_int[lgth]; + for(int i2=0;i2 ( _meshName.c_str() ), - MEDArrayNodeFamily, NumberOfNodes,MED_FR::MED_REMP , - MED_FR::MED_NOEUD, - (MED_FR::med_geometrie_element) MED_NONE); - else + temp, NumberOfNodes,med_2_1::MED_REMP , + med_2_1::MED_NOEUD, + (med_2_1::med_geometrie_element) MED_NONE); + delete [] temp; +#else + err = MEDfamEcr(_medIdt, const_cast ( _meshName.c_str() ), + MEDArrayNodeFamily, NumberOfNodes,med_2_1::MED_REMP , + med_2_1::MED_NOEUD, + (med_2_1::med_geometrie_element) MED_NONE); +#endif + } + else{ +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + int lgth=NumberOfNodes; + med_2_1::med_int *temp=new med_2_1::med_int[lgth]; + for(int i2=0;i2 ( _meshName.c_str() ), + temp, NumberOfNodes,med_2_1::MED_REMP , + med_2_1::MED_NOEUD, + (med_2_1::med_geometrie_element) MED_NONE); + delete [] temp; +#else err = MEDfamGridEcr(_medIdt, const_cast (_ptrMesh->_name.c_str()), MEDArrayNodeFamily, NumberOfNodes, - MED_FR::MED_REMP, - MED_FR::MED_NOEUD); + med_2_1::MED_REMP, + med_2_1::MED_NOEUD); +#endif + } if ( err != MED_VALID) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Can't write node family for the |"<< NumberOfNodes @@ -2186,21 +2328,37 @@ int MED_MESH_WRONLY_DRIVER::writeFamilyNumbers() const { } const int * typeCount = _ptrMesh->getGlobalNumberingIndex(entity) ; - +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + int lgth=NumberOfElements; + med_2_1::med_int *temp=new med_2_1::med_int[lgth]; + for(int i2=0;i2 ( _meshName.c_str() ), + temp+typeCount[i]-1,typeCount[i+1]-typeCount[i], + med_2_1::MED_REMP , + (med_2_1::med_entite_maillage) entity, + (med_2_1::med_geometrie_element) types[i] +); +#else err = MEDfamEcr(_medIdt, const_cast ( _meshName.c_str() ), MEDArrayFamily+typeCount[i]-1,typeCount[i+1]-typeCount[i], - MED_FR::MED_REMP , - (MED_FR::med_entite_maillage) entity, - (MED_FR::med_geometrie_element) types[i] + med_2_1::MED_REMP , + (med_2_1::med_entite_maillage) entity, + (med_2_1::med_geometrie_element) types[i] ); +#endif MESSAGE("OK "<getNumberOfElements(entity, types[i]) - << "| cells of geometric type |" << MED_FR::geoNames[ (MED_FR::med_geometrie_element) types[i]] <<"|in mesh |" + << "| cells of geometric type |" << geoNames[ types[i]] <<"|in mesh |" << _ptrMesh->_name.c_str() << "|" )); } +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + delete [] temp; +#endif delete[] MEDArrayFamily ; //if (true == ToDestroy) { // int NumberOfFamilies = myFamilies->size(); @@ -2256,21 +2414,36 @@ int MED_MESH_WRONLY_DRIVER::writeFamilyNumbers() const { } const int * typeCount = _ptrMesh->getGlobalNumberingIndex(entity) ; - +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + int lgth=numberOfElements; + med_2_1::med_int *temp=new med_2_1::med_int[lgth]; + for(int i2=0;i2 ( _meshName.c_str() ), + temp+typeCount[i]-1, typeNumberOfElements, + med_2_1::MED_REMP , + (med_2_1::med_entite_maillage) entity, + (med_2_1::med_geometrie_element) types[i]); +#else err = MEDfamEcr(_medIdt, const_cast ( _meshName.c_str() ), familyArray+typeCount[i]-1, typeNumberOfElements, - MED_FR::MED_REMP , - (MED_FR::med_entite_maillage) entity, - (MED_FR::med_geometrie_element) types[i]); - + med_2_1::MED_REMP , + (med_2_1::med_entite_maillage) entity, + (med_2_1::med_geometrie_element) types[i]); +#endif if ( err != MED_VALID) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Can't write family for the |"<< _ptrMesh->getNumberOfElements(entity, types[i]) - << "| faces of geometric type |" << MED_FR::geoNames[ (MED_FR::med_geometrie_element) types[i]] <<"|in mesh |" + << "| faces of geometric type |" << geoNames[types[i]] <<"|in mesh |" << _ptrMesh->_name.c_str() << "|" )); } +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + delete [] temp; +#endif delete[] familyArray ; //if (true == ToDestroy) { // int NumberOfFamilies = myFamilies->size(); @@ -2326,21 +2499,36 @@ int MED_MESH_WRONLY_DRIVER::writeFamilyNumbers() const { } const int * typeCount = _ptrMesh->getGlobalNumberingIndex(entity) ; - +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + int lgth=numberOfElements; + med_2_1::med_int *temp=new med_2_1::med_int[lgth]; + for(int i2=0;i2 ( _meshName.c_str() ), + temp+typeCount[i]-1, typeNumberOfElements, + med_2_1::MED_REMP , + (med_2_1::med_entite_maillage) entity, + (med_2_1::med_geometrie_element) types[i]); +#else err = MEDfamEcr(_medIdt, const_cast ( _meshName.c_str() ), familyArray+typeCount[i]-1, typeNumberOfElements, - MED_FR::MED_REMP , - (MED_FR::med_entite_maillage) entity, - (MED_FR::med_geometrie_element) types[i]); - + med_2_1::MED_REMP , + (med_2_1::med_entite_maillage) entity, + (med_2_1::med_geometrie_element) types[i]); +#endif if ( err != MED_VALID) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Can't write family for the |"<< _ptrMesh->getNumberOfElements(entity, types[i]) - << "| edges of geometric type |" << MED_FR::geoNames[ (MED_FR::med_geometrie_element) types[i]] <<"|in mesh |" + << "| edges of geometric type |" << geoNames[types[i]] <<"|in mesh |" << _ptrMesh->_name.c_str() << "|" )); } +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) + delete [] temp; +#endif delete[] familyArray ; //if (true == ToDestroy) { // int NumberOfFamilies = myFamilies->size(); @@ -2359,7 +2547,7 @@ int MED_MESH_WRONLY_DRIVER::writeFamilies(vector & families ) const { const char * LOC="int MED_MESH_WRONLY_DRIVER::writeFamilies(vector families) const : "; BEGIN_OF(LOC); - MED_FR::med_err err; + med_2_1::med_err err; MESSAGE(LOC<<" families.size() :"< & families ) const { MESSAGE(LOC<<"attributesDescriptions.c_str() : "<getNumberOfAttributes(); + med_2_1::med_int * AttributesIdentifier2 = new med_2_1::med_int[lgth] ; + med_2_1::med_int * AttributesValues2 = new med_2_1::med_int[lgth] ; + for(med_2_1::med_int i2=0;i2getAttributesIdentifiers()[i2]); + AttributesValues2[i2]=(med_2_1::med_int)(families[i]->getAttributesValues()[i2]); + } + err = med_2_1::MEDfamCr( _medIdt, + const_cast ( _meshName.c_str() ), + const_cast ( families[i]->getName().c_str() ), + families[i]->getIdentifier(), + AttributesIdentifier2, + AttributesValues2, + const_cast (attributesDescriptions.c_str()), + numberOfAttributes, + const_cast (groupsNames.c_str()), + numberOfGroups); + delete [] AttributesIdentifier2; + delete [] AttributesValues2; +#else + err = med_2_1::MEDfamCr( _medIdt, const_cast ( _meshName.c_str() ), const_cast ( families[i]->getName().c_str() ), families[i]->getIdentifier(), @@ -2428,6 +2637,7 @@ int MED_MESH_WRONLY_DRIVER::writeFamilies(vector & families ) const { numberOfAttributes, const_cast (groupsNames.c_str()), numberOfGroups); +#endif SCRUTE(err); if ( err != MED_VALID) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Can't create family |" << families[i]->getName() diff --git a/src/MEDMEM/MEDMEM_MedMeshDriver.hxx b/src/MEDMEM/MEDMEM_MedMeshDriver.hxx index 94c1b5906..b00313db7 100644 --- a/src/MEDMEM/MEDMEM_MedMeshDriver.hxx +++ b/src/MEDMEM/MEDMEM_MedMeshDriver.hxx @@ -28,14 +28,14 @@ class MED_MESH_DRIVER : public GENDRIVER protected: MESH * _ptrMesh; - MED_FR::med_idt _medIdt; + med_2_1::med_idt _medIdt; string _meshName; // const ? int _meshNum; // INUTILE ? public : // all MED cell type - static const MED_FR::med_geometrie_element all_cell_type[MED_NBR_GEOMETRIE_MAILLE]; + static const med_2_1::med_geometrie_element all_cell_type[MED_NBR_GEOMETRIE_MAILLE]; static const char * const all_cell_type_tab [MED_NBR_GEOMETRIE_MAILLE]; @@ -48,7 +48,7 @@ public : */ MED_MESH_DRIVER(const string & fileName, MESH * ptrMesh, - med_mode_acces accessMode) ; + MED_EN::med_mode_acces accessMode) ; /*! Copy constructor. */ @@ -130,7 +130,7 @@ private: int getNodalConnectivity(CONNECTIVITY * Connectivity) ; int getDescendingConnectivity(CONNECTIVITY * Connectivity) ; int getNodesFamiliesNumber(int * MEDArrayNodeFamily) ; - int getCellsFamiliesNumber(int** Arrays, CONNECTIVITY* Connectivity) ; + int getCellsFamiliesNumber(int** Arrays, CONNECTIVITY* Connectivity, MED_EN::medEntityMesh entity) ; void updateFamily() ; void buildAllGroups(vector & Groups, vector & Families) ; void getGRID (); @@ -180,7 +180,7 @@ public : private: int writeCoordinates () const; - int writeConnectivities (medEntityMesh entity) const; + int writeConnectivities (MED_EN::medEntityMesh entity) const; int writeFamilyNumbers () const; int writeFamilies (vector & families) const; int writeGRID() const; diff --git a/src/MEDMEM/MEDMEM_Mesh.cxx b/src/MEDMEM/MEDMEM_Mesh.cxx index 2ba5a7b23..03e283202 100644 --- a/src/MEDMEM/MEDMEM_Mesh.cxx +++ b/src/MEDMEM/MEDMEM_Mesh.cxx @@ -1,4 +1,3 @@ -using namespace std; /* File Mesh.cxx $Header$ @@ -23,7 +22,10 @@ using namespace std; #include "MEDMEM_DriverFactory.hxx" +using namespace std; using namespace MEDMEM; +using namespace MED_EN; + //#include "MEDMEM_Grid.hxx" this inclision should have never be here !!! //update Families with content list @@ -101,7 +103,7 @@ void MESH::init() { BEGIN_OF(LOC); - string _name = "NOT DEFINED"; // A POSITIONNER EN FCT DES IOS ? + _name = "NOT DEFINED"; // A POSITIONNER EN FCT DES IOS ? _coordinate = (COORDINATE *) NULL; _connectivity = (CONNECTIVITY *) NULL; @@ -361,8 +363,7 @@ ostream & MEDMEM::operator<<(ostream &os, const MESH &myMesh) if (k==3) entity = MED_FACE; if (k==4) entity = MED_EDGE; int numberoffamilies = myMesh.getNumberOfFamilies(entity); - using namespace MED_FR; - os << "NumberOfFamilies on "<< entNames[(MED_FR::med_entite_maillage) entity] <<" : "<* MESH::getVolume(const SUPPORT * Support) const throw (MEDEXCEPTIO } int index; - FIELD* Volume = new FIELD::FIELD(Support,1); + FIELD* Volume = new FIELD(Support,1); // double *volume = new double [length_values]; Volume->setName("VOLUME"); Volume->setDescription("cells volume"); @@ -1035,7 +1035,7 @@ FIELD* MESH::getArea(const SUPPORT * Support) const throw (MEDEXCEPTION) int index; FIELD* Area; - Area = new FIELD::FIELD(Support,1); + Area = new FIELD(Support,1); Area->setName("AREA"); Area->setDescription("cells or faces area"); @@ -1243,7 +1243,7 @@ FIELD* MESH::getLength(const SUPPORT * Support) const throw (MEDEXCEPTIO int index; FIELD* Length; - Length = new FIELD::FIELD(Support,1); + Length = new FIELD(Support,1); // double *length = new double [length_values]; Length->setValueType(MED_REEL64); @@ -1359,7 +1359,7 @@ FIELD* MESH::getNormal(const SUPPORT * Support) const throw (MEDEXCEPTIO int index; - FIELD* Normal = new FIELD::FIELD(Support,dim_space); + FIELD* Normal = new FIELD(Support,dim_space); Normal->setName("NORMAL"); Normal->setDescription("cells or faces normal"); for (int k=1;k<=dim_space;k++) { @@ -1605,7 +1605,7 @@ FIELD* MESH::getBarycenter(const SUPPORT * Support) const throw (MEDEXCE int index; FIELD* Barycenter; - Barycenter = new FIELD::FIELD(Support,dim_space); + Barycenter = new FIELD(Support,dim_space); Barycenter->setName("BARYCENTER"); Barycenter->setDescription("cells or faces barycenter"); @@ -2003,7 +2003,7 @@ FIELD* MESH::getBarycenter(const SUPPORT * Support) const throw (MEDEXCE bool MESH::isEmpty() const { - bool notempty = _name != "" || _coordinate != NULL || _connectivity != NULL || + bool notempty = _name != "NOT DEFINED" || _coordinate != NULL || _connectivity != NULL || _spaceDimension !=MED_INVALID || _meshDimension !=MED_INVALID || _numberOfNodes !=MED_INVALID || _groupNode.size() != 0 || _familyNode.size() != 0 || _groupCell.size() != 0 || @@ -2517,7 +2517,7 @@ void MESH::createFamilies() for (unsigned g=0; g!=myGroups.size(); ++g) { // scan cells that belongs to the group - const med_int* groupCells=myGroups[g]->getnumber()->getValue(); + const int* groupCells=myGroups[g]->getnumber()->getValue(); int nbCells=myGroups[g]->getnumber()->getLength(); for(int c=0; c!=nbCells; ++c) tab_cell[groupCells[c]-1].groups.push_back(g); diff --git a/src/MEDMEM/MEDMEM_Mesh.hxx b/src/MEDMEM/MEDMEM_Mesh.hxx index 2b9d6a0f7..590b4d26f 100644 --- a/src/MEDMEM/MEDMEM_Mesh.hxx +++ b/src/MEDMEM/MEDMEM_Mesh.hxx @@ -15,8 +15,6 @@ #include "MEDMEM_Connectivity.hxx" #include "MEDMEM_GenDriver.hxx" -using namespace MED_EN; - /*! This class contains all the informations related with a MESH : - COORDINATES - CONNECTIVITIES @@ -150,57 +148,57 @@ public : inline int getNumberOfNodes() const; virtual inline const COORDINATE * getCoordinateptr() const; inline string getCoordinatesSystem() const; - virtual inline const double * getCoordinates(medModeSwitch Mode) const; + virtual inline const double * getCoordinates(MED_EN::medModeSwitch Mode) const; virtual inline const double getCoordinate(int Number,int Axis) const; inline const string * getCoordinatesNames() const; inline const string * getCoordinatesUnits() const; //inline int * getNodesNumbers(); - virtual inline int getNumberOfTypes(medEntityMesh Entity) const; - virtual inline const medGeometryElement * getTypes(medEntityMesh Entity) const; - virtual inline const CELLMODEL * getCellsTypes(medEntityMesh Entity) const; - virtual const int * getGlobalNumberingIndex(medEntityMesh Entity) const; - virtual inline int getNumberOfElements(medEntityMesh Entity, - medGeometryElement Type) const; - virtual inline bool existConnectivity(medConnectivity ConnectivityType, - medEntityMesh Entity) const; + virtual inline int getNumberOfTypes(MED_EN::medEntityMesh Entity) const; + virtual inline const MED_EN::medGeometryElement * getTypes(MED_EN::medEntityMesh Entity) const; + virtual inline const CELLMODEL * getCellsTypes(MED_EN::medEntityMesh Entity) const; + virtual const int * getGlobalNumberingIndex(MED_EN::medEntityMesh Entity) const; + virtual inline int getNumberOfElements(MED_EN::medEntityMesh Entity, + MED_EN::medGeometryElement Type) const; + virtual inline bool existConnectivity(MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity) const; - virtual inline medGeometryElement getElementType(medEntityMesh Entity, + virtual inline MED_EN::medGeometryElement getElementType(MED_EN::medEntityMesh Entity, int Number) const; - virtual inline void calculateConnectivity(medModeSwitch Mode, - medConnectivity ConnectivityType, - medEntityMesh Entity) const ; - virtual inline int getConnectivityLength(medModeSwitch Mode, - medConnectivity ConnectivityType, - medEntityMesh Entity, - medGeometryElement Type) const; - virtual inline const int * getConnectivity(medModeSwitch Mode, - medConnectivity ConnectivityType, - medEntityMesh Entity, - medGeometryElement Type) const; - virtual inline const int * getConnectivityIndex(medConnectivity ConnectivityType, - medEntityMesh Entity) const; - virtual int getElementNumber(medConnectivity ConnectivityType, - medEntityMesh Entity, - medGeometryElement Type, + virtual inline void calculateConnectivity(MED_EN::medModeSwitch Mode, + MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity) const ; + virtual inline int getConnectivityLength(MED_EN::medModeSwitch Mode, + MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity, + MED_EN::medGeometryElement Type) const; + virtual inline const int * getConnectivity(MED_EN::medModeSwitch Mode, + MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity, + MED_EN::medGeometryElement Type) const; + virtual inline const int * getConnectivityIndex(MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity) const; + virtual int getElementNumber(MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity, + MED_EN::medGeometryElement Type, int * connectivity) const; - virtual inline int getReverseConnectivityLength(medConnectivity ConnectivityType, - medEntityMesh Entity=MED_CELL) const; - virtual inline const int * getReverseConnectivity(medConnectivity ConnectivityType, - medEntityMesh Entity=MED_CELL) const; - virtual inline int getReverseConnectivityIndexLength(medConnectivity ConnectivityType, - medEntityMesh Entity=MED_CELL) const; - virtual inline const int * getReverseConnectivityIndex(medConnectivity ConnectivityType, - medEntityMesh Entity=MED_CELL) const; - - virtual int getNumberOfFamilies(medEntityMesh Entity) const; - virtual inline const vector getFamilies(medEntityMesh Entity) const; - virtual inline const FAMILY* getFamily(medEntityMesh Entity,int i) const; - virtual int getNumberOfGroups(medEntityMesh Entity) const; - virtual inline const vector getGroups(medEntityMesh Entity) const; - virtual inline const GROUP* getGroup(medEntityMesh Entity,int i) const; + virtual inline int getReverseConnectivityLength(MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity=MED_EN::MED_CELL) const; + virtual inline const int * getReverseConnectivity(MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity=MED_EN::MED_CELL) const; + virtual inline int getReverseConnectivityIndexLength(MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity=MED_EN::MED_CELL) const; + virtual inline const int * getReverseConnectivityIndex(MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity=MED_EN::MED_CELL) const; + + virtual int getNumberOfFamilies(MED_EN::medEntityMesh Entity) const; + virtual inline const vector getFamilies(MED_EN::medEntityMesh Entity) const; + virtual inline const FAMILY* getFamily(MED_EN::medEntityMesh Entity,int i) const; + virtual int getNumberOfGroups(MED_EN::medEntityMesh Entity) const; + virtual inline const vector getGroups(MED_EN::medEntityMesh Entity) const; + virtual inline const GROUP* getGroup(MED_EN::medEntityMesh Entity,int i) const; virtual inline const CONNECTIVITY* getConnectivityptr() const; - virtual SUPPORT * getBoundaryElements(medEntityMesh Entity) + virtual SUPPORT * getBoundaryElements(MED_EN::medEntityMesh Entity) throw (MEDEXCEPTION); // problème avec le maillage dans le support : // le pointeur n'est pas const, mais sa valeur oui. A voir !!! PG @@ -248,9 +246,7 @@ public : */ void createFamilies(); }; -}; -using namespace MEDMEM; // --------------------------------------- // Methodes Inline // --------------------------------------- @@ -386,7 +382,7 @@ inline string MESH::getCoordinatesSystem() const - MED_NO_INTERLACE : X1 X2 Y1 Y2 Z1 Z2 - MED_FULL_INTERLACE : X1 Y1 Z1 X2 Y2 Z2 */ -inline const double * MESH::getCoordinates(medModeSwitch Mode) const +inline const double * MESH::getCoordinates(MED_EN::medModeSwitch Mode) const { // checkGridFillCoords(); return _coordinate->getCoordinates(Mode); @@ -430,10 +426,10 @@ inline const string * MESH::getCoordinatesUnits() const If there is no connectivity, return an exception. */ -inline int MESH::getNumberOfTypes(medEntityMesh entity) const +inline int MESH::getNumberOfTypes(MED_EN::medEntityMesh entity) const { MESSAGE("MESH::getNumberOfTypes(medEntityMesh entity) : "<calculateConnectivity(ConnectivityType,entity); else throw MEDEXCEPTION(LOCALIZED("MESH::calculateConnectivity : only for MED_FULL_INTERLACE mode")); @@ -561,12 +557,12 @@ inline void MESH::calculateConnectivity(medModeSwitch Mode,medConnectivity Conne Return the corresponding length of the array returned by MESH::getConnectivity with exactly the same arguments. Used particulary for wrapping CORBA and python. */ -inline int MESH::getConnectivityLength(medModeSwitch Mode,medConnectivity ConnectivityType,medEntityMesh entity, medGeometryElement Type) const +inline int MESH::getConnectivityLength(MED_EN::medModeSwitch Mode,MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh entity, MED_EN::medGeometryElement Type) const { int nbOfElm = getNumberOfElements(entity,Type); int size; - if (Type == MED_ALL_ELEMENTS) + if (Type == MED_EN::MED_ALL_ELEMENTS) { size = getConnectivityIndex(ConnectivityType,entity)[nbOfElm]-1; } @@ -584,10 +580,10 @@ inline int MESH::getConnectivityLength(medModeSwitch Mode,medConnectivity Connec and Type=MED_ALL_ELEMENTS. You must also get the corresponding index array. */ -inline const int * MESH::getConnectivity(medModeSwitch Mode,medConnectivity ConnectivityType,medEntityMesh entity, medGeometryElement Type) const +inline const int * MESH::getConnectivity(MED_EN::medModeSwitch Mode,MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh entity, MED_EN::medGeometryElement Type) const { // checkGridFillConnectivity(); - if (Mode==MED_FULL_INTERLACE) + if (Mode==MED_EN::MED_FULL_INTERLACE) return _connectivity->getConnectivity(ConnectivityType,entity,Type); throw MEDEXCEPTION(LOCALIZED("MESH::getConnectivity : only for MED_FULL_INTERLACE mode")); } @@ -602,7 +598,7 @@ inline const int * MESH::getConnectivity(medModeSwitch Mode,medConnectivity Conn in Connectivity array (Connectivity[ConnectivityIndex[i-1]-1] is the first value) */ -inline const int * MESH::getConnectivityIndex(medConnectivity ConnectivityType,medEntityMesh entity) const +inline const int * MESH::getConnectivityIndex(MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh entity) const { // checkGridFillConnectivity(); return _connectivity->getConnectivityIndex(ConnectivityType, entity); @@ -612,24 +608,24 @@ inline const int * MESH::getConnectivityIndex(medConnectivity ConnectivityType,m Used particulary for wrapping CORBA and python. */ -inline int MESH::getReverseConnectivityLength(medConnectivity ConnectivityType, - medEntityMesh Entity) const +inline int MESH::getReverseConnectivityLength(MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity) const { int spaceDim = getSpaceDimension(); int nb; - if (ConnectivityType == MED_NODAL) + if (ConnectivityType == MED_EN::MED_NODAL) { nb = getNumberOfNodes(); } else { if (spaceDim == 2) - nb = getNumberOfElements(MED_EDGE, - MED_ALL_ELEMENTS); + nb = getNumberOfElements(MED_EN::MED_EDGE, + MED_EN::MED_ALL_ELEMENTS); else if (spaceDim == 3) - nb = getNumberOfElements(MED_FACE, - MED_ALL_ELEMENTS); + nb = getNumberOfElements(MED_EN::MED_FACE, + MED_EN::MED_ALL_ELEMENTS); } return getReverseConnectivityIndex(ConnectivityType)[nb]-1; } @@ -641,7 +637,7 @@ inline int MESH::getReverseConnectivityLength(medConnectivity ConnectivityType, You must get ReverseConnectivityIndex array to use it. */ -inline const int * MESH::getReverseConnectivity(medConnectivity ConnectivityType,medEntityMesh Entity/*=MED_CELL*/) const +inline const int * MESH::getReverseConnectivity(MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh Entity/*=MED_CELL*/) const { // checkGridFillConnectivity(); if (NULL==_connectivity) @@ -653,21 +649,21 @@ inline const int * MESH::getReverseConnectivity(medConnectivity ConnectivityType Return the corresponding length of the array returned by MESH::getReverseConnectivityIndex with exactly the same arguments. Used particulary for wrapping CORBA and python. */ -inline int MESH::getReverseConnectivityIndexLength(medConnectivity ConnectivityType, - medEntityMesh Entity) const +inline int MESH::getReverseConnectivityIndexLength(MED_EN::medConnectivity ConnectivityType, + MED_EN::medEntityMesh Entity) const { int spaceDim = getSpaceDimension(); - if (ConnectivityType == MED_NODAL) + if (ConnectivityType == MED_EN::MED_NODAL) { return getNumberOfNodes()+1; } else { if (spaceDim == 2) - return getNumberOfElements(MED_EDGE,MED_ALL_ELEMENTS)+1; + return getNumberOfElements(MED_EN::MED_EDGE,MED_EN::MED_ALL_ELEMENTS)+1; else if (spaceDim == 3) - return getNumberOfElements(MED_FACE,MED_ALL_ELEMENTS)+1; + return getNumberOfElements(MED_EN::MED_FACE,MED_EN::MED_ALL_ELEMENTS)+1; else throw MEDEXCEPTION("Invalid dimension"); } @@ -684,7 +680,7 @@ inline int MESH::getReverseConnectivityIndexLength(medConnectivity ConnectivityT ReverseConnectivity[ReverseConnectivityIndex[i-1]-1] is the first value) */ -inline const int * MESH::getReverseConnectivityIndex(medConnectivity ConnectivityType,medEntityMesh Entity/*=MED_CELL*/) const +inline const int * MESH::getReverseConnectivityIndex(MED_EN::medConnectivity ConnectivityType,MED_EN::medEntityMesh Entity/*=MED_CELL*/) const { // checkGridFillConnectivity(); if (NULL==_connectivity) @@ -694,87 +690,87 @@ inline const int * MESH::getReverseConnectivityIndex(medConnectivity Connectivit } -inline int MESH::getNumberOfFamilies (medEntityMesh entity) const +inline int MESH::getNumberOfFamilies (MED_EN::medEntityMesh entity) const { switch (entity) { - case MED_NODE : + case MED_EN::MED_NODE : return _familyNode.size(); - case MED_CELL : + case MED_EN::MED_CELL : return _familyCell.size(); - case MED_FACE : + case MED_EN::MED_FACE : return _familyFace.size(); - case MED_EDGE : + case MED_EN::MED_EDGE : return _familyEdge.size(); default : throw MEDEXCEPTION("MESH::getNumberOfFamilies : Unknown entity"); } } -inline int MESH::getNumberOfGroups (medEntityMesh entity) const +inline int MESH::getNumberOfGroups (MED_EN::medEntityMesh entity) const { switch (entity) { - case MED_NODE : + case MED_EN::MED_NODE : return _groupNode.size(); - case MED_CELL : + case MED_EN::MED_CELL : return _groupCell.size(); - case MED_FACE : + case MED_EN::MED_FACE : return _groupFace.size(); - case MED_EDGE : + case MED_EN::MED_EDGE : return _groupEdge.size(); default : throw MEDEXCEPTION("MESH::getNumberOfGroups : Unknown entity"); } } -const vector MESH::getFamilies(medEntityMesh entity) const +const vector MESH::getFamilies(MED_EN::medEntityMesh entity) const { switch (entity) { - case MED_NODE : + case MED_EN::MED_NODE : return _familyNode; - case MED_CELL : + case MED_EN::MED_CELL : return _familyCell; - case MED_FACE : + case MED_EN::MED_FACE : return _familyFace; - case MED_EDGE : + case MED_EN::MED_EDGE : return _familyEdge; default : throw MEDEXCEPTION("MESH::getFamilies : Unknown entity"); } } -const vector MESH::getGroups(medEntityMesh entity) const +const vector MESH::getGroups(MED_EN::medEntityMesh entity) const { switch (entity) { - case MED_NODE : + case MED_EN::MED_NODE : return _groupNode; - case MED_CELL : + case MED_EN::MED_CELL : return _groupCell; - case MED_FACE : + case MED_EN::MED_FACE : return _groupFace; - case MED_EDGE : + case MED_EN::MED_EDGE : return _groupEdge; default : throw MEDEXCEPTION("MESH::getGroups : Unknown entity"); } } -const MEDMEM::FAMILY* MESH::getFamily(medEntityMesh entity, int i) const +const MEDMEM::FAMILY* MESH::getFamily(MED_EN::medEntityMesh entity, int i) const { if (i<=0) throw MEDEXCEPTION("MESH::getFamily(i) : argument i must be > 0"); vector Family; switch (entity) { - case MED_NODE : { + case MED_EN::MED_NODE : { Family = _familyNode; break; } - case MED_CELL : { + case MED_EN::MED_CELL : { Family = _familyCell; break; } - case MED_FACE : { + case MED_EN::MED_FACE : { Family = _familyFace; break; } - case MED_EDGE : { + case MED_EN::MED_EDGE : { Family = _familyEdge; break; } @@ -786,26 +782,26 @@ const MEDMEM::FAMILY* MESH::getFamily(medEntityMesh entity, int i) const return Family[i-1]; } -const GROUP* MESH::getGroup(medEntityMesh entity, int i) const +const GROUP* MESH::getGroup(MED_EN::medEntityMesh entity, int i) const { const char * LOC = "MESH::getGroup(medEntityMesh entity, int i) : "; if (i<=0) throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"argument i must be > 0")); vector Group; switch (entity) { - case MED_NODE : { + case MED_EN::MED_NODE : { Group = _groupNode; break; } - case MED_CELL : { + case MED_EN::MED_CELL : { Group = _groupCell; break; } - case MED_FACE : { + case MED_EN::MED_FACE : { Group = _groupFace; break; } - case MED_EDGE : { + case MED_EN::MED_EDGE : { Group = _groupEdge; break; } @@ -833,4 +829,6 @@ inline bool MESH::getIsAGrid() return _isAGrid; } +} + #endif /* MESH_HXX */ diff --git a/src/MEDMEM/MEDMEM_Meshing.cxx b/src/MEDMEM/MEDMEM_Meshing.cxx index e04c642c3..31d6a61bb 100644 --- a/src/MEDMEM/MEDMEM_Meshing.cxx +++ b/src/MEDMEM/MEDMEM_Meshing.cxx @@ -1,4 +1,3 @@ -using namespace std; /* File MEDMEM_Meshing.cxx $Header$ @@ -13,7 +12,10 @@ using namespace std; #include "MEDMEM_Meshing.hxx" #include "MEDMEM_Group.hxx" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; /*! Create an empty MESH. */ MESHING::MESHING(): MESH() @@ -202,7 +204,7 @@ void MESHING::setTypes(const medGeometryElement * Types, we set 12 triangles and 23 quadrangles. */ void MESHING::setNumberOfElements(const int * NumberOfElements, - medEntityMesh Entity) + const medEntityMesh Entity) throw (MEDEXCEPTION) { const char * LOC = "MESHING::setNumberOfElements(const int *, medEntityMesh) : " ; diff --git a/src/MEDMEM/MEDMEM_Meshing.hxx b/src/MEDMEM/MEDMEM_Meshing.hxx index 164ed112c..06cd0d395 100644 --- a/src/MEDMEM/MEDMEM_Meshing.hxx +++ b/src/MEDMEM/MEDMEM_Meshing.hxx @@ -8,8 +8,6 @@ #include "MEDMEM_Mesh.hxx" -using namespace MED_EN; - /*! This class MESHING is a special class to set a MESH object. */ @@ -28,7 +26,7 @@ public : const int NumberOfNodes, const double * Coordinates, const string System, - const medModeSwitch Mode) ; + const MED_EN::medModeSwitch Mode) ; void setCoordinatesSystem(const string System) throw (MEDEXCEPTION) ; void setCoordinatesNames (const string * names) ; @@ -37,23 +35,23 @@ public : void setCoordinateUnit (const string unit, const int i) ; void setNumberOfTypes (const int NumberOfTypes, - const medEntityMesh Entity) + const MED_EN::medEntityMesh Entity) throw (MEDEXCEPTION) ; - void setTypes (const medGeometryElement * Types, - const medEntityMesh Entity) + void setTypes (const MED_EN::medGeometryElement * Types, + const MED_EN::medEntityMesh Entity) throw (MEDEXCEPTION) ; void setNumberOfElements (const int * NumberOfElements, - const medEntityMesh Entity) + const MED_EN::medEntityMesh Entity) throw (MEDEXCEPTION) ; void setConnectivity (const int * Connectivity, - const medEntityMesh Entity, - const medGeometryElement Type) + const MED_EN::medEntityMesh Entity, + const MED_EN::medGeometryElement Type) throw (MEDEXCEPTION) ; void setConnectivities (const int * ConnectivityIndex, const int * ConnectivityValue, - const medConnectivity ConnectivityType, - const medEntityMesh Entity) + const MED_EN::medConnectivity ConnectivityType, + const MED_EN::medEntityMesh Entity) throw (MEDEXCEPTION) ; // void setGroup (const string name, diff --git a/src/MEDMEM/MEDMEM_ModulusArray.hxx b/src/MEDMEM/MEDMEM_ModulusArray.hxx index 706324b60..0ff182dcb 100644 --- a/src/MEDMEM/MEDMEM_ModulusArray.hxx +++ b/src/MEDMEM/MEDMEM_ModulusArray.hxx @@ -26,8 +26,6 @@ public: int compare(const MEDMODULUSARRAY &modulusArray) const; }; -}; -using namespace MEDMEM; MEDMODULUSARRAY::MEDMODULUSARRAY(int length, const int * array) : _length(length), _array(array) @@ -100,6 +98,7 @@ int MEDMODULUSARRAY::compare(const MEDMODULUSARRAY &modulusArray) const } return ret ; } +} # endif /* # ifndef __MEDMODULUSARRAY_H__ */ diff --git a/src/MEDMEM/MEDMEM_PointerOf.hxx b/src/MEDMEM/MEDMEM_PointerOf.hxx index 96f3684f4..33ce95da2 100644 --- a/src/MEDMEM/MEDMEM_PointerOf.hxx +++ b/src/MEDMEM/MEDMEM_PointerOf.hxx @@ -39,7 +39,6 @@ public : void setShallowAndOwnership( const T *pointer ); PointerOf& operator=( const PointerOf &pointer ) ; } ; -} ; // ------------------------------------------------------------ // // // @@ -47,8 +46,6 @@ public : // // // ------------------------------------------------------------ // -using namespace MEDMEM; - /*! Creates a null T* pointer and sets the boolean (for desallocation) to false. */ template PointerOf::PointerOf() : _pointer(0), _done(false) { @@ -240,4 +237,6 @@ template void PointerOf::setShallowAndOwnership( const T *pointe _done=true; } +}//End namespace MEDMEM + # endif /* # if ! defined( __PointerOf_HXX__ ) */ diff --git a/src/MEDMEM/MEDMEM_PorflowMeshDriver.cxx b/src/MEDMEM/MEDMEM_PorflowMeshDriver.cxx index e0407d8d8..c1122974f 100644 --- a/src/MEDMEM/MEDMEM_PorflowMeshDriver.cxx +++ b/src/MEDMEM/MEDMEM_PorflowMeshDriver.cxx @@ -1,5 +1,3 @@ -using namespace std; - #include "MEDMEM_PorflowMeshDriver.hxx" #include "MEDMEM_DriversDef.hxx" #include "MEDMEM_DriverTools.hxx" @@ -17,6 +15,7 @@ using namespace std; #include #include +using namespace std; using namespace MED_EN; using namespace MEDMEM; diff --git a/src/MEDMEM/MEDMEM_PorflowMeshDriver.hxx b/src/MEDMEM/MEDMEM_PorflowMeshDriver.hxx index d608bfc6a..2f6cfbef2 100644 --- a/src/MEDMEM/MEDMEM_PorflowMeshDriver.hxx +++ b/src/MEDMEM/MEDMEM_PorflowMeshDriver.hxx @@ -12,8 +12,6 @@ #include "MEDMEM_Exception.hxx" #include "utilities.h" -using namespace MEDMEM; - /*! Driver PORFLOW for MESH. @@ -39,14 +37,14 @@ protected: // tableau de correspondance des types géométriques de PORFLOW -> MED static const size_t nb_geometrie_porflow = 6; - static const medGeometryElement geomPORFLOWtoMED[nb_geometrie_porflow]; + static const MED_EN::medGeometryElement geomPORFLOWtoMED[nb_geometrie_porflow]; // indirection table from PORFLOW order to MED one for nodes numerotation in all PORFLOW geometries static const size_t nb_nodes_max = 8; // maximal number of nodes for a porflow geometrie static const size_t nb_nodes2_max = 4; // maximal number of nodes for a 2D porflow geometrie static const size_t nb_faces_max = 6; // maximal number of faces for a porflow geometrie static const int numPORFLOWtoMED[nb_geometrie_porflow] [nb_nodes_max]; static const int connectivityPORFLOW[nb_geometrie_porflow][nb_faces_max][nb_nodes2_max]; - inline static int geomMEDtoPorflow(medGeometryElement medGeo); + inline static int geomMEDtoPorflow(MED_EN::medGeometryElement medGeo); public : @@ -60,7 +58,7 @@ public : */ PORFLOW_MESH_DRIVER(const string & fileName, MESH * ptrMesh, - med_mode_acces accessMode) ; + MED_EN::med_mode_acces accessMode) ; /*! Copy constructor. */ diff --git a/src/MEDMEM/MEDMEM_STRING.hxx b/src/MEDMEM/MEDMEM_STRING.hxx index 3965a6527..c235c5cbe 100644 --- a/src/MEDMEM/MEDMEM_STRING.hxx +++ b/src/MEDMEM/MEDMEM_STRING.hxx @@ -23,21 +23,21 @@ private : public : - STRING::STRING() :string(), _s() + STRING() :string(), _s() { } - STRING::~STRING() + ~STRING() { _s.freeze(false); } - STRING::operator const char * () const + operator const char * () const { return const_cast (this->c_str()) ; } - template STRING::STRING( const T &valeur ) : string(), _s() + template STRING( const T &valeur ) : string(), _s() { _s.freeze(false); @@ -47,7 +47,7 @@ public : this->string::operator =( _s.str()); // freeze is true by now } - template STRING & STRING::operator<<( const T &valeur ) + template STRING & operator<<( const T &valeur ) { if ( _s.pcount() ) diff --git a/src/MEDMEM/MEDMEM_SkyLineArray.cxx b/src/MEDMEM/MEDMEM_SkyLineArray.cxx index 27688e1d1..9a6a0bda7 100644 --- a/src/MEDMEM/MEDMEM_SkyLineArray.cxx +++ b/src/MEDMEM/MEDMEM_SkyLineArray.cxx @@ -1,10 +1,11 @@ -using namespace std; #include "MEDMEM_SkyLineArray.hxx" #include "utilities.h" + +using namespace std; using namespace MEDMEM; MEDSKYLINEARRAY::MEDSKYLINEARRAY(): _count(0), _length(0), - _index((med_int*)NULL),_value((med_int*)NULL) + _index((int*)NULL),_value((int*)NULL) { MESSAGE("Constructeur MEDSKYLINEARRAY sans parametre"); } @@ -14,8 +15,8 @@ MEDSKYLINEARRAY::MEDSKYLINEARRAY(const MEDSKYLINEARRAY &myArray): _index(_count+1),_value(_length) { BEGIN_OF("MEDSKYLINEARRAY(const MEDSKYLINEARRAY &)"); - memcpy(_index,myArray._index,sizeof(med_int)*(_count+1)); - memcpy(_value,myArray._value,sizeof(med_int)*_length); + memcpy(_index,myArray._index,sizeof(int)*(_count+1)); + memcpy(_value,myArray._value,sizeof(int)*_length); END_OF("MEDSKYLINEARRAY(const MEDSKYLINEARRAY &)"); } @@ -27,18 +28,18 @@ MEDSKYLINEARRAY::~MEDSKYLINEARRAY() //if (_value != NULL) delete [] _value; } -MEDSKYLINEARRAY::MEDSKYLINEARRAY(const med_int count, const med_int length): +MEDSKYLINEARRAY::MEDSKYLINEARRAY(const int count, const int length): _count(count), _length(length), _index(_count+1),_value(_length) { MESSAGE("Constructeur MEDSKYLINEARRAY(count="< _index ; // array of size _count+1 : _index[0]=1 and + int _count ; + int _length ; + PointerOf _index ; // array of size _count+1 : _index[0]=1 and // _index[_count]=length+1 - PointerOf _value ; // array of size _length + PointerOf _value ; // array of size _length public : MEDSKYLINEARRAY(); ~MEDSKYLINEARRAY(); MEDSKYLINEARRAY( const MEDSKYLINEARRAY &myArray ); - MEDSKYLINEARRAY( const med_int count, const med_int length ); - MEDSKYLINEARRAY( const med_int count, const med_int length, - const med_int* index, const med_int* value, bool shallowCopy=false ); - - //void setMEDSKYLINEARRAY( const med_int count, const med_int length, med_int* index , med_int* value ) ; - - inline med_int getNumberOf() const; - inline med_int getLength() const; - inline const med_int* getIndex() const; - inline const med_int* getValue() const; - inline med_int getNumberOfI(int i) const throw (MEDEXCEPTION) ; - inline const med_int* getI(int i) const throw (MEDEXCEPTION) ; - inline med_int getIJ(int i, int j) const throw (MEDEXCEPTION) ; - inline med_int getIndexValue(int i) const throw (MEDEXCEPTION) ; - - inline void setIndex(const med_int* index) ; - inline void setI(const med_int i, const med_int* values) throw (MEDEXCEPTION) ; - inline void setIJ(med_int i, med_int j, med_int value) throw (MEDEXCEPTION) ; - inline void setIndexValue(med_int i, med_int value) throw (MEDEXCEPTION) ; + MEDSKYLINEARRAY( const int count, const int length ); + MEDSKYLINEARRAY( const int count, const int length, + const int* index, const int* value, bool shallowCopy=false ); + + //void setMEDSKYLINEARRAY( const int count, const int length, int* index , int* value ) ; + + inline int getNumberOf() const; + inline int getLength() const; + inline const int* getIndex() const; + inline const int* getValue() const; + inline int getNumberOfI(int i) const throw (MEDEXCEPTION) ; + inline const int* getI(int i) const throw (MEDEXCEPTION) ; + inline int getIJ(int i, int j) const throw (MEDEXCEPTION) ; + inline int getIndexValue(int i) const throw (MEDEXCEPTION) ; + + inline void setIndex(const int* index) ; + inline void setI(const int i, const int* values) throw (MEDEXCEPTION) ; + inline void setIJ(int i, int j, int value) throw (MEDEXCEPTION) ; + inline void setIndexValue(int i, int value) throw (MEDEXCEPTION) ; }; -} -using namespace MEDMEM; + // --------------------------------------- // Methodes Inline // --------------------------------------- -inline med_int MEDSKYLINEARRAY::getNumberOf() const +inline int MEDSKYLINEARRAY::getNumberOf() const { return _count ; }; -inline med_int MEDSKYLINEARRAY::getLength() const +inline int MEDSKYLINEARRAY::getLength() const { return _length ; }; -inline const med_int* MEDSKYLINEARRAY::getIndex() const +inline const int* MEDSKYLINEARRAY::getIndex() const { - return (const med_int*)_index ; + return (const int*)_index ; } ; -inline const med_int* MEDSKYLINEARRAY::getValue() const +inline const int* MEDSKYLINEARRAY::getValue() const { - return (const med_int*)_value ; + return (const int*)_value ; } ; -inline med_int MEDSKYLINEARRAY::getNumberOfI(int i) const throw (MEDEXCEPTION) +inline int MEDSKYLINEARRAY::getNumberOfI(int i) const throw (MEDEXCEPTION) { if (i<1) throw MEDEXCEPTION("MEDSKYLINEARRAY::getNumberOfI : argument must be >= 1"); @@ -72,7 +69,7 @@ inline med_int MEDSKYLINEARRAY::getNumberOfI(int i) const throw (MEDEXCEPTION) throw MEDEXCEPTION("MEDSKYLINEARRAY::getNumberOfI : argument is out of range"); return _index[i]-_index[i-1] ; } ; -inline const med_int* MEDSKYLINEARRAY::getI(int i) const throw (MEDEXCEPTION) +inline const int* MEDSKYLINEARRAY::getI(int i) const throw (MEDEXCEPTION) { if (i<1) throw MEDEXCEPTION("MEDSKYLINEARRAY::getI : argument must be >= 1"); @@ -80,7 +77,7 @@ inline const med_int* MEDSKYLINEARRAY::getI(int i) const throw (MEDEXCEPTION) throw MEDEXCEPTION("MEDSKYLINEARRAY::getI : argument is out of range"); return _value+_index[i-1]-1 ; } -inline med_int MEDSKYLINEARRAY::getIJ(int i, int j) const throw (MEDEXCEPTION) +inline int MEDSKYLINEARRAY::getIJ(int i, int j) const throw (MEDEXCEPTION) { if (i<1) throw MEDEXCEPTION("MEDSKYLINEARRAY::getIJ : first argument must be >= 1"); @@ -93,7 +90,7 @@ inline med_int MEDSKYLINEARRAY::getIJ(int i, int j) const throw (MEDEXCEPTION) return _value[_index[i-1]+j-2] ; } -inline med_int MEDSKYLINEARRAY::getIndexValue(int i) const throw (MEDEXCEPTION) +inline int MEDSKYLINEARRAY::getIndexValue(int i) const throw (MEDEXCEPTION) { if (i<1) throw MEDEXCEPTION("MEDSKYLINEARRAY::getIndexValue : argument must be >= 1"); @@ -102,13 +99,13 @@ inline med_int MEDSKYLINEARRAY::getIndexValue(int i) const throw (MEDEXCEPTION) return _value[i-1] ; } -inline void MEDSKYLINEARRAY::setIndex(const med_int* index) +inline void MEDSKYLINEARRAY::setIndex(const int* index) { - memcpy((med_int*)_index,index,(_count+1)*sizeof(med_int)); + memcpy((int*)_index,index,(_count+1)*sizeof(int)); } -inline void MEDSKYLINEARRAY::setIJ(med_int i, med_int j, med_int value) throw (MEDEXCEPTION) +inline void MEDSKYLINEARRAY::setIJ(int i, int j, int value) throw (MEDEXCEPTION) { if (i<1) throw MEDEXCEPTION("MEDSKYLINEARRAY::setIJ : first argument must be >= 1"); @@ -123,7 +120,7 @@ inline void MEDSKYLINEARRAY::setIJ(med_int i, med_int j, med_int value) throw (M } -inline void MEDSKYLINEARRAY::setI(const med_int i, const med_int * values) throw (MEDEXCEPTION) +inline void MEDSKYLINEARRAY::setI(const int i, const int * values) throw (MEDEXCEPTION) { if (i<1) throw MEDEXCEPTION("MEDSKYLINEARRAY::setI : index must be >= 1"); @@ -131,10 +128,10 @@ inline void MEDSKYLINEARRAY::setI(const med_int i, const med_int * values) throw if (i>_count) throw MEDEXCEPTION("MEDSKYLINEARRAY::setI : index is out of range") ; - memcpy(_value+_index[i-1]-1,values,(_index[i]-_index[i-1])*sizeof(med_int)) ; + memcpy(_value+_index[i-1]-1,values,(_index[i]-_index[i-1])*sizeof(int)) ; } -inline void MEDSKYLINEARRAY::setIndexValue(med_int i, med_int value) throw (MEDEXCEPTION) +inline void MEDSKYLINEARRAY::setIndexValue(int i, int value) throw (MEDEXCEPTION) { if (i<1) throw MEDEXCEPTION("MEDSKYLINEARRAY::setIndexValue : argument must be >= 1"); @@ -142,4 +139,5 @@ inline void MEDSKYLINEARRAY::setIndexValue(med_int i, med_int value) throw (MEDE throw MEDEXCEPTION("MEDSKYLINEARRAY::setIndexValue : argument is out of range") ; _value[i-1]=value ; } +} # endif diff --git a/src/MEDMEM/MEDMEM_Support.cxx b/src/MEDMEM/MEDMEM_Support.cxx index f0f82d62c..cc1f6401d 100644 --- a/src/MEDMEM/MEDMEM_Support.cxx +++ b/src/MEDMEM/MEDMEM_Support.cxx @@ -1,4 +1,3 @@ -using namespace std; /* File Support.cxx $Header$ @@ -16,6 +15,7 @@ using namespace std; //#include "MEDMEM_Group.hxx" #include "MEDMEM_Mesh.hxx" +using namespace std; using namespace MED_EN; using namespace MEDMEM; @@ -233,9 +233,9 @@ void SUPPORT::blending(SUPPORT * mySupport) throw (MEDEXCEPTION) medGeometryElement * myType = new medGeometryElement[MED_NBR_GEOMETRIE_MAILLE]; int * whereIsType = new int[MED_NBR_GEOMETRIE_MAILLE]; //MESH_ENTITIES myMeshEntities() ; - list::const_iterator listIt ; + list::const_iterator listIt ; int it=0 ; - for(listIt=(MED_FR::meshEntities[(MED_FR::med_entite_maillage)_entity]).begin();listIt!=(MED_FR::meshEntities[(MED_FR::med_entite_maillage)_entity]).end();listIt++) { + for(listIt=(meshEntities[_entity]).begin();listIt!=(meshEntities[_entity]).end();listIt++) { tmp_NumberOfElementsInType[it]=0; whereIsType[it]=0 ; try { @@ -588,9 +588,9 @@ void SUPPORT::intersecting(SUPPORT * mySupport) throw (MEDEXCEPTION) medGeometryElement * myType = new medGeometryElement[MED_NBR_GEOMETRIE_MAILLE]; int * whereIsType = new int[MED_NBR_GEOMETRIE_MAILLE]; //MESH_ENTITIES myMeshEntities() ; - list::const_iterator listIt ; + list::const_iterator listIt ; int it=0 ; - for(listIt=(MED_FR::meshEntities[(MED_FR::med_entite_maillage)_entity]).begin();listIt!=(MED_FR::meshEntities[(MED_FR::med_entite_maillage)_entity]).end();listIt++) { + for(listIt=(meshEntities[_entity]).begin();listIt!=(meshEntities[_entity]).end();listIt++) { tmp_NumberOfElementsInType[it]=0; whereIsType[it]=0 ; myType[it]= MED_NONE; diff --git a/src/MEDMEM/MEDMEM_Support.hxx b/src/MEDMEM/MEDMEM_Support.hxx index 6704eee57..4c8b46305 100644 --- a/src/MEDMEM/MEDMEM_Support.hxx +++ b/src/MEDMEM/MEDMEM_Support.hxx @@ -15,10 +15,6 @@ #include "MEDMEM_define.hxx" #include "MEDMEM_SkyLineArray.hxx" -using namespace MED_EN; -using namespace MEDMEM; - - /*! This class describe a support of elements on an entity of the mesh. @@ -60,7 +56,7 @@ protected: (only one for each support). \endif */ - medEntityMesh _entity ; + MED_EN::medEntityMesh _entity ; /*! \if developper @@ -74,7 +70,7 @@ protected: Array of all geometric type defined in the support. \endif */ - medGeometryElement * _geometricType; + MED_EN::medGeometryElement * _geometricType; /*! \if developper @@ -145,7 +141,7 @@ protected: public: SUPPORT(); - SUPPORT(MESH* Mesh, string Name="", medEntityMesh Entity=MED_CELL); + SUPPORT(MESH* Mesh, string Name="", MED_EN::medEntityMesh Entity=MED_EN::MED_CELL); SUPPORT(const SUPPORT & m); virtual ~SUPPORT(); friend ostream & operator<<(ostream &os,const SUPPORT &my); @@ -159,9 +155,9 @@ public: inline void setDescription(string Description); inline void setMesh(MESH *Mesh); inline void setAll(bool All); - inline void setEntity(medEntityMesh Entity); + inline void setEntity(MED_EN::medEntityMesh Entity); inline void setNumberOfGeometricType(int NumberOfGeometricType); - inline void setGeometricType(const medGeometryElement *GeometricType); + inline void setGeometricType(const MED_EN::medGeometryElement *GeometricType); inline void setNumberOfGaussPoint(const int *NumberOfGaussPoint); // inline void setGeometricTypeNumber(int *GeometricTypeNumber); inline void setNumberOfElements(const int *NumberOfElements); @@ -172,36 +168,35 @@ public: inline string getName() const; inline string getDescription() const; virtual inline MESH * getMesh() const; - inline medEntityMesh getEntity() const; + inline MED_EN::medEntityMesh getEntity() const; inline bool isOnAllElements() const; inline int getNumberOfTypes() const; - inline const medGeometryElement* getTypes() const ; + inline const MED_EN::medGeometryElement* getTypes() const ; inline const int * getNumberOfGaussPoint() const throw (MEDEXCEPTION); - inline int getNumberOfGaussPoint(medGeometryElement geomElement) const throw (MEDEXCEPTION); + inline int getNumberOfGaussPoint(MED_EN::medGeometryElement geomElement) const throw (MEDEXCEPTION); //inline int * getGeometricTypeNumber() const; //inline int getTotalNumberOfElement() const; - inline int getNumberOfElements(medGeometryElement GeometricType) const throw (MEDEXCEPTION); + inline int getNumberOfElements(MED_EN::medGeometryElement GeometricType) const throw (MEDEXCEPTION); virtual inline MEDSKYLINEARRAY * getnumber() const throw (MEDEXCEPTION); - virtual inline const int * getNumber(medGeometryElement GeometricType) const throw (MEDEXCEPTION); + virtual inline const int * getNumber(MED_EN::medGeometryElement GeometricType) const throw (MEDEXCEPTION); virtual inline const int * getNumberIndex() const throw (MEDEXCEPTION); void blending(SUPPORT * mySupport) throw (MEDEXCEPTION) ; void setpartial(string Description, int NumberOfGeometricType, - int TotalNumberOfEntity, medGeometryElement *GeometricType, + int TotalNumberOfEntity, MED_EN::medGeometryElement *GeometricType, int *NumberOfEntity, int *NumberValue); void getBoundaryElements() throw (MEDEXCEPTION); void intersecting(SUPPORT * mySupport) throw (MEDEXCEPTION) ; }; -}; + // _____________________ // Methodes Inline // _____________________ -using namespace MEDMEM; /*! This method returns the number of all elements of the type GeometricType. @@ -216,11 +211,11 @@ using namespace MEDMEM; of nodes in the support (or in the whole mesh). */ //----------------------------------------------------------------------------- -inline int SUPPORT::getNumberOfElements(medGeometryElement GeometricType) const +inline int SUPPORT::getNumberOfElements(MED_EN::medGeometryElement GeometricType) const throw (MEDEXCEPTION) //----------------------------------------------------------------------------- { - if (GeometricType==MED_ALL_ELEMENTS) + if (GeometricType==MED_EN::MED_ALL_ELEMENTS) return _totalNumberOfElements; for (int i=0;i<_numberOfGeometricType;i++) if (_geometricType[i]==GeometricType) @@ -250,14 +245,14 @@ inline MEDSKYLINEARRAY * SUPPORT::getnumber() const medGeometryElement type. */ //--------------------------------------------------------------------- -inline const int * SUPPORT::getNumber(medGeometryElement GeometricType) const +inline const int * SUPPORT::getNumber(MED_EN::medGeometryElement GeometricType) const throw (MEDEXCEPTION) //--------------------------------------------------------------------- { const char * LOC = "Support::getNumber : " ; if (_isOnAllElts) throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"Not defined, support is on all entity !")) ; - if (GeometricType==MED_ALL_ELEMENTS) + if (GeometricType==MED_EN::MED_ALL_ELEMENTS) return _number->getValue() ; for (int i=0;i<_numberOfGeometricType;i++) if (_geometricType[i]==GeometricType) @@ -301,7 +296,7 @@ inline const int * SUPPORT::getNumberOfGaussPoint() const - Not defined for MED_ALL_ELEMENTS medGeometryElement type. */ //----------------------------------------------------------------------------- -inline int SUPPORT::getNumberOfGaussPoint(medGeometryElement geomElement) const +inline int SUPPORT::getNumberOfGaussPoint(MED_EN::medGeometryElement geomElement) const throw (MEDEXCEPTION) //----------------------------------------------------------------------------- { @@ -355,7 +350,7 @@ inline void SUPPORT::setAll(bool All) /*! set the attribute _entity to Entity */ //------------------------------------------ -inline void SUPPORT::setEntity(medEntityMesh Entity) +inline void SUPPORT::setEntity(MED_EN::medEntityMesh Entity) { _entity=Entity; // if ( Entity == MED_NODE) { @@ -394,11 +389,11 @@ inline void SUPPORT::setNumberOfGeometricType(int NumberOfGeometricType) /*! set the attribute _geometricType to geometricType */ //--------------------------------------------------------------------- -inline void SUPPORT::setGeometricType(const medGeometryElement *GeometricType) +inline void SUPPORT::setGeometricType(const MED_EN::medGeometryElement *GeometricType) //--------------------------------------------------------------------- { if (NULL == _geometricType) - _geometricType=new medGeometryElement[_numberOfGeometricType]; + _geometricType=new MED_EN::medGeometryElement[_numberOfGeometricType]; for (int i=0;i<_numberOfGeometricType;i++) _geometricType[i] = GeometricType[i]; // _geometricType=GeometricType; @@ -523,7 +518,7 @@ inline int SUPPORT::getNumberOfTypes() const (for example : MED_FACE or MED_NODE) */ //--------------------------------------------- -inline medEntityMesh SUPPORT::getEntity() const +inline MED_EN::medEntityMesh SUPPORT::getEntity() const //--------------------------------------------- { return _entity; @@ -534,7 +529,7 @@ inline medEntityMesh SUPPORT::getEntity() const types used by the support. */ //--------------------------------------------------- -inline const medGeometryElement * SUPPORT::getTypes() const +inline const MED_EN::medGeometryElement * SUPPORT::getTypes() const //--------------------------------------------------- { // if ((_isOnAllElts)&(_entity != MED_NODE)) @@ -555,5 +550,7 @@ inline const medGeometryElement * SUPPORT::getTypes() const // return _geometricTypeNumber; // } +}//End namespace MEDMEM + #endif /* SUPPORT_HXX */ diff --git a/src/MEDMEM/MEDMEM_TypeMeshDriver.cxx b/src/MEDMEM/MEDMEM_TypeMeshDriver.cxx index d290d76f9..f3fa14fd8 100644 --- a/src/MEDMEM/MEDMEM_TypeMeshDriver.cxx +++ b/src/MEDMEM/MEDMEM_TypeMeshDriver.cxx @@ -1,5 +1,3 @@ -using namespace std; - #include "MEDMEM_TypeMeshDriver.hxx" #include "MEDMEM_DriversDef.hxx" @@ -9,6 +7,8 @@ using namespace std; #include "MEDMEM_Connectivity.hxx" #include "MEDMEM_Mesh.hxx" #include "MEDMEM_CellModel.hxx" + +using namespace std; using namespace MEDMEM; // Every memory allocation made in the MedDriver members function are desallocated in the Mesh destructor diff --git a/src/MEDMEM/MEDMEM_TypeMeshDriver.hxx b/src/MEDMEM/MEDMEM_TypeMeshDriver.hxx index 4bdad3a07..11f1b40c6 100644 --- a/src/MEDMEM/MEDMEM_TypeMeshDriver.hxx +++ b/src/MEDMEM/MEDMEM_TypeMeshDriver.hxx @@ -11,8 +11,6 @@ #include "MEDMEM_Exception.hxx" #include "utilities.h" -using namespace MEDMEM; - /*! Driver TYPE for MESH. diff --git a/src/MEDMEM/MEDMEM_Unit.cxx b/src/MEDMEM/MEDMEM_Unit.cxx index accea0a21..a8fa8d01a 100644 --- a/src/MEDMEM/MEDMEM_Unit.cxx +++ b/src/MEDMEM/MEDMEM_Unit.cxx @@ -1,10 +1,11 @@ -using namespace std; /* File MEDMEM_Unit.cxx $Header$ */ #include "MEDMEM_Unit.hxx" + +using namespace std; using namespace MEDMEM; UNIT::UNIT():_name(""),_description(""),_masse(0),_length(0),_time(0),_temperature(0),_matterQuantity(0),_currentStrength(0),_lightIntensity(0) { diff --git a/src/MEDMEM/MEDMEM_Unit.hxx b/src/MEDMEM/MEDMEM_Unit.hxx index 924273da1..fe20be08d 100644 --- a/src/MEDMEM/MEDMEM_Unit.hxx +++ b/src/MEDMEM/MEDMEM_Unit.hxx @@ -11,7 +11,6 @@ #include "utilities.h" #include "MEDMEM_Exception.hxx" #include "MEDMEM_define.hxx" -//using namespace MED_EN; namespace MEDMEM { class UNIT { @@ -59,11 +58,9 @@ public: inline int getLightIntensity() const ; } ; -} ; // inline method : -using namespace MEDMEM; inline void UNIT::setName(string Name) { _name = Name ; }; @@ -101,5 +98,6 @@ inline int UNIT::getTemperature() const { return _temperature ; } ; inline int UNIT::getMatterQuantity() const { return _matterQuantity ; } ; inline int UNIT::getCurrentStrength() const { return _currentStrength ; } ; inline int UNIT::getLightIntensity() const { return _lightIntensity ; } ; +}//End namespace MEDMEM #endif /* UNIT_HXX */ diff --git a/src/MEDMEM/MEDMEM_VtkFieldDriver.hxx b/src/MEDMEM/MEDMEM_VtkFieldDriver.hxx index cc71f5703..2de4f0454 100644 --- a/src/MEDMEM/MEDMEM_VtkFieldDriver.hxx +++ b/src/MEDMEM/MEDMEM_VtkFieldDriver.hxx @@ -19,8 +19,6 @@ #include "MEDMEM_Mesh.hxx" #include "MEDMEM_CellModel.hxx" -using namespace MEDMEM ; - /*! @@ -66,7 +64,7 @@ public : Constructor. */ VTK_FIELD_DRIVER(const string & fileName, FIELD * ptrField) - : GENDRIVER(fileName,MED_WRONLY), + : GENDRIVER(fileName,MED_EN::MED_WRONLY), _ptrField((FIELD *) ptrField), _fieldName(fileName),_fieldNum(MED_INVALID) { @@ -265,7 +263,6 @@ private: GENDRIVER * copy ( void ) const ; }; -}; /*-------------------------*/ /* template implementation */ @@ -273,7 +270,6 @@ private: /*--------------------- DRIVER PART -------------------------------*/ -using namespace MEDMEM; template void VTK_FIELD_DRIVER::setFieldName(const string & fieldName) { _fieldName = fieldName; @@ -323,7 +319,7 @@ template void VTK_FIELD_DRIVER::write(void) const int SpaceDimension = meshField->getSpaceDimension() ; int NumberOfNodes = meshField->getNumberOfNodes() ; (*_vtkFile) << "POINTS " << NumberOfNodes << " float" << endl ; - const double *coordinate = meshField->getCoordinates(MED_FULL_INTERLACE) ; + const double *coordinate = meshField->getCoordinates(MED_EN::MED_FULL_INTERLACE) ; for (int i=0;i void VTK_FIELD_DRIVER::write(void) const // we put connectivity // how many cells and how many value in connectivity : - int cells_types_count = meshField->getNumberOfTypes(MED_CELL) ; + int cells_types_count = meshField->getNumberOfTypes(MED_EN::MED_CELL) ; // int * cells_count = meshField->get_cells_count() ; // int cells_sum = cells_count[cells_types_count] ; - int cells_sum = meshField->getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS) ; - const CELLMODEL * cells_type = meshField->getCellsTypes(MED_CELL) ; + int cells_sum = meshField->getNumberOfElements(MED_EN::MED_CELL,MED_EN::MED_ALL_ELEMENTS) ; + const CELLMODEL * cells_type = meshField->getCellsTypes(MED_EN::MED_CELL) ; // int connectivity_sum = 0 ; //const int * connectivity = meshField->getConnectivity(MED_FULL_INTERLACE,MED_NODAL,MED_CELL,MED_ALL_ELEMENTS) ; !! UNUSED VARIABLE !! - const int * connectivityIndex = meshField->getConnectivityIndex(MED_NODAL,MED_CELL) ; + const int * connectivityIndex = meshField->getConnectivityIndex(MED_EN::MED_NODAL,MED_EN::MED_CELL) ; int connectivity_sum = connectivityIndex[cells_sum]-1 ; @@ -354,28 +350,28 @@ template void VTK_FIELD_DRIVER::write(void) const int *filter = (int*) NULL ; // index in vtk connectivity switch (cells_type[i].getType()) { - case MED_POINT1 : { + case MED_EN::MED_POINT1 : { filter = new int[1] ; filter[0] = 0 ; break ; } - case MED_SEG2 : { + case MED_EN::MED_SEG2 : { filter = new int[2] ; filter[0] = 0 ; filter[1] = 1 ; break ; } - case MED_SEG3 : { + case MED_EN::MED_SEG3 : { break ; } - case MED_TRIA3 : { + case MED_EN::MED_TRIA3 : { filter = new int[3] ; filter[0] = 0 ; filter[1] = 1 ; filter[2] = 2 ; break ; } - case MED_QUAD4 : { + case MED_EN::MED_QUAD4 : { filter = new int[4] ; filter[0] = 0 ; filter[1] = 1 ; @@ -383,13 +379,13 @@ template void VTK_FIELD_DRIVER::write(void) const filter[3] = 3 ; break ; } - case MED_TRIA6 : { + case MED_EN::MED_TRIA6 : { break ; } - case MED_QUAD8 : { + case MED_EN::MED_QUAD8 : { break ; } - case MED_TETRA4 : { + case MED_EN::MED_TETRA4 : { filter = new int[4] ; filter[0] = 0 ; filter[1] = 1 ; @@ -397,7 +393,7 @@ template void VTK_FIELD_DRIVER::write(void) const filter[3] = 2 ; // 4th element in med are 3rd in vtk (array begin at 0 !) break ; } - case MED_PYRA5 : { + case MED_EN::MED_PYRA5 : { filter = new int[5] ; filter[0] = 0 ; filter[1] = 3 ; // 2nd element in med are 4th in vtk (array begin at 0 !) @@ -406,7 +402,7 @@ template void VTK_FIELD_DRIVER::write(void) const filter[4] = 4 ; break ; } - case MED_PENTA6 : { + case MED_EN::MED_PENTA6 : { filter = new int[6] ; filter[0] = 0 ; filter[1] = 1 ; @@ -416,7 +412,7 @@ template void VTK_FIELD_DRIVER::write(void) const filter[5] = 5 ; break ; } - case MED_HEXA8 : { + case MED_EN::MED_HEXA8 : { filter = new int[8] ; filter[0] = 0 ; filter[1] = 3 ; @@ -428,16 +424,16 @@ template void VTK_FIELD_DRIVER::write(void) const filter[7] = 5 ; break ; } - case MED_TETRA10 : { + case MED_EN::MED_TETRA10 : { break ; } - case MED_PYRA13 : { + case MED_EN::MED_PYRA13 : { break ; } - case MED_PENTA15 : { + case MED_EN::MED_PENTA15 : { break ; } - case MED_HEXA20 : { + case MED_EN::MED_HEXA20 : { break ; } default : { @@ -447,8 +443,8 @@ template void VTK_FIELD_DRIVER::write(void) const if (filter==NULL) throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<": MED element type not supported yet : " << cells_type[i].getName() ) ) ; int nodes_cell = cells_type[i].getNumberOfNodes(); - int numberOfCell = meshField->getNumberOfElements(MED_CELL,cells_type[i].getType()) ; - const int * connectivityArray = meshField->getConnectivity(MED_FULL_INTERLACE,MED_NODAL,MED_CELL,cells_type[i].getType()); + int numberOfCell = meshField->getNumberOfElements(MED_EN::MED_CELL,cells_type[i].getType()) ; + const int * connectivityArray = meshField->getConnectivity(MED_EN::MED_FULL_INTERLACE,MED_EN::MED_NODAL,MED_EN::MED_CELL,cells_type[i].getType()); for (int j=0;j void VTK_FIELD_DRIVER::write(void) const int vtkType = 0 ; switch (cells_type[i].getType()) { - case MED_POINT1 : { + case MED_EN::MED_POINT1 : { vtkType = 1 ; break ; } - case MED_SEG2 : { + case MED_EN::MED_SEG2 : { vtkType = 3 ; break ; } - case MED_SEG3 : { + case MED_EN::MED_SEG3 : { vtkType = 0 ; break ; } - case MED_TRIA3 : { + case MED_EN::MED_TRIA3 : { vtkType = 5 ; break ; } - case MED_QUAD4 : { + case MED_EN::MED_QUAD4 : { vtkType = 9 ; break ; } - case MED_TRIA6 : { + case MED_EN::MED_TRIA6 : { vtkType = 0 ; break ; } - case MED_QUAD8 : { + case MED_EN::MED_QUAD8 : { vtkType = 0 ; break ; } - case MED_TETRA4 : { + case MED_EN::MED_TETRA4 : { vtkType = 10 ; break ; } - case MED_PYRA5 : { + case MED_EN::MED_PYRA5 : { vtkType = 14 ; break ; } - case MED_PENTA6 : { + case MED_EN::MED_PENTA6 : { vtkType = 13 ; break ; } - case MED_HEXA8 : { + case MED_EN::MED_HEXA8 : { vtkType = 12 ; break ; } - case MED_TETRA10 : { + case MED_EN::MED_TETRA10 : { vtkType = 0 ; break ; } - case MED_PYRA13 : { + case MED_EN::MED_PYRA13 : { vtkType = 0 ; break ; } - case MED_PENTA15 : { + case MED_EN::MED_PENTA15 : { vtkType = 0 ; break ; } - case MED_HEXA20 : { + case MED_EN::MED_HEXA20 : { vtkType = 0 ; break ; } @@ -532,7 +528,7 @@ template void VTK_FIELD_DRIVER::write(void) const } if (vtkType == 0) throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<": MED element type not supported yet : " << cells_type[i].getType() ) ) ; - int numberOfCell = meshField->getNumberOfElements(MED_CELL,cells_type[i].getType()) ; + int numberOfCell = meshField->getNumberOfElements(MED_EN::MED_CELL,cells_type[i].getType()) ; for (int j=0;j void VTK_FIELD_DRIVER::write(void) const ostringstream name ; string nameField = _ptrField->getName(); - medEntityMesh entitySupport = supportField->getEntity(); + MED_EN::medEntityMesh entitySupport = supportField->getEntity(); name << nameField << "_" << dt << "_" << it ; if (!(supportField->isOnAllElements())) throw MED_EXCEPTION(LOCALIZED(STRING(LOC) << "Could not write field "<<_ptrField->getName()<<" which is not on all entities of the mesh !" << entitySupport)); - if (entitySupport == MED_NODE) + if (entitySupport == MED_EN::MED_NODE) (*_vtkFile) << "POINT_DATA " << meshField->getNumberOfNodes() << endl ; - else if (entitySupport == MED_CELL) - (*_vtkFile) << "CELL_DATA " << meshField->getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS) << endl ; + else if (entitySupport == MED_EN::MED_CELL) + (*_vtkFile) << "CELL_DATA " << meshField->getNumberOfElements(MED_EN::MED_CELL,MED_EN::MED_ALL_ELEMENTS) << endl ; else throw MED_EXCEPTION(LOCALIZED(STRING(LOC) << "Could not write field "<<_ptrField->getName()<<" which is not on all nodes or cells but it's on !" << entitySupport)); - int NomberOfValue = supportField->getNumberOfElements(MED_ALL_ELEMENTS) ; + int NomberOfValue = supportField->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS) ; int NomberOfComponents = _ptrField->getNumberOfComponents() ; - med_type_champ fieldType = _ptrField->getValueType() ; + MED_EN::med_type_champ fieldType = _ptrField->getValueType() ; SCRUTE(name.str()); SCRUTE(fieldType); switch (fieldType) { - case MED_INT32 : + case MED_EN::MED_INT32 : { break ; } - case MED_REEL64 : + case MED_EN::MED_REEL64 : { break ; } @@ -595,7 +591,7 @@ template void VTK_FIELD_DRIVER::write(void) const else throw MED_EXCEPTION(LOCALIZED(STRING(LOC) << "Could not write field "<<_ptrField->getName()<<" there are more than 4 components !")); - const T * value = _ptrField->getValue(MED_NO_INTERLACE) ; + const T * value = _ptrField->getValue(MED_EN::MED_NO_INTERLACE) ; for (int i=0; i void VTK_FIELD_DRIVER::writeAppend(void) const ostringstream name ; string nameField = _ptrField->getName(); - medEntityMesh entitySupport = supportField->getEntity(); + MED_EN::medEntityMesh entitySupport = supportField->getEntity(); name << nameField << "_" << dt << "_" << it ; if (!(supportField->isOnAllElements())) throw MED_EXCEPTION(LOCALIZED(STRING(LOC) << "Could not write field "<<_ptrField->getName()<<" which is not on all entities of the mesh !" << entitySupport)); - if (entitySupport == MED_NODE) + if (entitySupport == MED_EN::MED_NODE) (*_vtkFile) << "POINT_DATA " << meshField->getNumberOfNodes() << endl ; - else if (entitySupport == MED_CELL) - (*_vtkFile) << "CELL_DATA " << meshField->getNumberOfElements(MED_CELL,MED_ALL_ELEMENTS) << endl ; + else if (entitySupport == MED_EN::MED_CELL) + (*_vtkFile) << "CELL_DATA " << meshField->getNumberOfElements(MED_EN::MED_CELL,MED_EN::MED_ALL_ELEMENTS) << endl ; else throw MED_EXCEPTION(LOCALIZED(STRING(LOC) << "Could not write field "<<_ptrField->getName()<<" which is not on all nodes or cells but it's on !" << entitySupport)); - int NomberOfValue = supportField->getNumberOfElements(MED_ALL_ELEMENTS) ; + int NomberOfValue = supportField->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS) ; int NomberOfComponents = _ptrField->getNumberOfComponents() ; - med_type_champ fieldType = _ptrField->getValueType() ; + MED_EN::med_type_champ fieldType = _ptrField->getValueType() ; SCRUTE(name.str()); SCRUTE(fieldType); switch (fieldType) { - case MED_INT32 : + case MED_EN::MED_INT32 : { break ; } - case MED_REEL64 : + case MED_EN::MED_REEL64 : { break ; } @@ -678,7 +674,7 @@ template void VTK_FIELD_DRIVER::writeAppend(void) const else throw MED_EXCEPTION(LOCALIZED(STRING(LOC) << "Could not write field "<<_ptrField->getName()<<" there are more than 4 components !")); - const T * value = _ptrField->getValue(MED_NO_INTERLACE) ; + const T * value = _ptrField->getValue(MED_EN::MED_NO_INTERLACE) ; for (int i=0; i void VTK_FIELD_DRIVER::writeAppend(void) const } END_OF(LOC); } +}//End namespace MEDMEM #endif /* VTK_FIELD_DRIVER_HXX */ diff --git a/src/MEDMEM/MEDMEM_VtkMedDriver.cxx b/src/MEDMEM/MEDMEM_VtkMedDriver.cxx index 4fa27bae7..9d4d61348 100644 --- a/src/MEDMEM/MEDMEM_VtkMedDriver.cxx +++ b/src/MEDMEM/MEDMEM_VtkMedDriver.cxx @@ -1,4 +1,3 @@ -using namespace std; #include "MEDMEM_VtkMedDriver.hxx" #include @@ -9,7 +8,10 @@ using namespace std; #include "MEDMEM_Support.hxx" #include "MEDMEM_Mesh.hxx" #include "MEDMEM_CellModel.hxx" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; VTK_MED_DRIVER::VTK_MED_DRIVER(): GENDRIVER(), _ptrMed((MED * const)MED_NULL) diff --git a/src/MEDMEM/MEDMEM_VtkMeshDriver.cxx b/src/MEDMEM/MEDMEM_VtkMeshDriver.cxx index 258aac37c..797fe8db4 100644 --- a/src/MEDMEM/MEDMEM_VtkMeshDriver.cxx +++ b/src/MEDMEM/MEDMEM_VtkMeshDriver.cxx @@ -1,4 +1,3 @@ -using namespace std; #include "MEDMEM_VtkMeshDriver.hxx" #include "MEDMEM_DriversDef.hxx" @@ -12,7 +11,10 @@ using namespace std; #include "MEDMEM_Grid.hxx" #include + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; VTK_MESH_DRIVER::VTK_MESH_DRIVER(): GENDRIVER(), _ptrMesh((MESH * const)MED_NULL) diff --git a/src/MEDMEM/MEDMEM_define.hxx b/src/MEDMEM/MEDMEM_define.hxx index bbc2be345..8bbb23ee4 100644 --- a/src/MEDMEM/MEDMEM_define.hxx +++ b/src/MEDMEM/MEDMEM_define.hxx @@ -9,13 +9,15 @@ // UTILE AUX DEUX NAMESPACES #include -namespace MED_FR { - extern "C" { -# include -# include - } -} +# include +# include +// namespace MED_FR { +// extern "C" { +// # include +// # include +// } +// } namespace MED_EN { extern "C" { @@ -96,7 +98,7 @@ typedef enum {MED_HDF_VERSION, MED_VERSION, MED_FICH_DES} med_fich_info; //#define MED_ALL 0 !!!!! NB: WARNING MED_ALL deja utilise dans l'enum medGeometryElement !!!!!!!! #define MED_ALL 0 -#if defined(SUN4SOL2) || defined(PCLINUX) || defined(OSF1) || defined(IRIX64_32) || defined(RS6000) +#if defined(SUN4SOL2) || defined(PCLINUX) || defined(OSF1_32) || defined(IRIX64_32) || defined(RS6000) /* interface C/FORTRAN */ /* this true only with g77 and gcc : we must change it to use directly NOMF_... and INT32 or INT64 - it will be more simple to understand and to use ! */ #define NOMF_POST_UNDERSCORE @@ -124,7 +126,7 @@ typedef int med_int; typedef double med_float; #endif -#if defined(IRIX64) +#if defined(IRIX64) || defined(OSF1) || defined(VPP5000) #define NOMF_POST_UNDERSCORE /* correspondance des types avec HDF 5 */ diff --git a/src/MEDMEM/Makefile.in b/src/MEDMEM/Makefile.in index b7aff5e21..905d7eafc 100644 --- a/src/MEDMEM/Makefile.in +++ b/src/MEDMEM/Makefile.in @@ -108,25 +108,26 @@ BIN_SRC = BIN_SERVER_IDL = BIN_CLIENT_IDL = -TEST_PROGS = test_MEDMEM_ModulusArray test_MEDMEM_Array test_MEDMEM_SkyLineArray test_MEDMEM_CellModel testUPointerOf testUCoordinate testUUnit testUGeoNameMeshEntities testUMedException testUModulusArray testUSkyLineArray testUArray testUCellModel readEntete readCoordinate test_copie_field_ test_copie_fieldT test_copie_coordinate test_copie_medarray test_copie_connectivity test_copie_support test_copie_family test_copie_group test_copie_mesh test_affect_medarray test_MEDMEM_Meshing test_operation_fielddouble test_operation_fieldint test_gibi_driver test_porflow_driver +TEST_PROGS = test_MEDMEM_ModulusArray test_MEDMEM_Array test_MEDMEM_SkyLineArray test_MEDMEM_CellModel testUPointerOf testUCoordinate testUUnit testUGeoNameMeshEntities testUMedException testUModulusArray testUSkyLineArray testUArray testUCellModel readEntete readCoordinate test_copie_field_ test_copie_fieldT test_copie_coordinate test_copie_medarray test_copie_connectivity test_copie_support test_copie_family test_copie_group test_copie_mesh test_affect_medarray test_MEDMEM_Meshing test_operation_fielddouble test_operation_fieldint test_gibi_driver test_porflow_driver test_grid # testUCellModel -> a revoir car l'API a changee (plus de vector) +LDFLAGS+= -L$(top_builddir)/lib/salome +LDFLAGSFORBIN+= -L$(top_builddir)/lib/salome + CPPFLAGS+=$(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS+=-ftemplate-depth-42 -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS+=@CXXTMPDPTHFLAGS@ -I${KERNEL_ROOT_DIR}/include/salome #LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lSalomeLoggerServer -L${KERNEL_ROOT_DIR}/lib/salome # change motivated by the bug KERNEL4778. -LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace +LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace -lMEDWrapper_V2_1 $(STDLIB) #LDFLAGSFORBIN+=$(MED2_LIBS) $(HDF5_LIBS) -lSalomeLoggerServer -L${KERNEL_ROOT_DIR}/lib/salome # change motivated by the bug KERNEL4778. -LDFLAGSFORBIN+=$(MED2_LIBS) $(HDF5_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace +LDFLAGSFORBIN+=-lm $(MED2_LIBS) $(HDF5_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace -lMEDWrapper_V2_1 -lMEDWrapperBase LIBSFORBIN= -LDFLAGS= - LIBS= # build create_mesh : diff --git a/src/MEDMEM/create_grid.c b/src/MEDMEM/create_grid.c index dd2cc7291..ea274cf05 100644 --- a/src/MEDMEM/create_grid.c +++ b/src/MEDMEM/create_grid.c @@ -1,12 +1,12 @@ /*---------------------------------------------------------------------------- -MED MEDMEM : MED files in memory + MED MEDMEM : MED files in memory - Copyright (C) 2003 CEA/DEN, EDF R&D + Copyright (C) 2003 CEA/DEN, EDF R&D File : create_grid.c -Module : MED + Module : MED ----------------------------------------------------------------------------*/ /****************************************************************************** @@ -32,8 +32,8 @@ Module : MED int main (int argc, char **argv) { -/* Ecriture d'un premier maillage non structure (test14 + test8) - ************************************************************* */ + /* Ecriture d'un premier maillage non structure (test14 + test8) + ************************************************************** */ med_err ret; med_idt fid; @@ -41,6 +41,8 @@ int main (int argc, char **argv) med_int mdim = 2; /* nom du maillage de longueur maxi MED_TAILLE_NOM */ char maa[MED_TAILLE_NOM+1] = "maa1"; + /* description du maillage de longueur maxi MED_TAIIL_DESC */ + char maadesc[MED_TAILLE_DESC+1] = "Example de maillage structure 2D"; /* le nombre de noeuds */ med_int nnoe = 4; /* table des coordonnees @@ -49,12 +51,15 @@ int main (int argc, char **argv) med_int nbr[2] = {2, 2}; /* tables des noms et des unites des coordonnees profil : (dimension*MED_TAILLE_PNOM+1) */ - char nomcoo[2*MED_TAILLE_PNOM+1] = "x y "; - char unicoo[2*MED_TAILLE_PNOM+1] = "cm cm "; + char nomcoo[2*MED_TAILLE_PNOM+1] = "x y "; + char unicoo[2*MED_TAILLE_PNOM+1] = "cm cm "; + + char nomcooi[MED_TAILLE_PNOM+1] = "x "; + char unicooi[MED_TAILLE_PNOM+1] = "cm "; /* tables des noms, numeros, numeros de familles des noeuds autant d'elements que de noeuds - les noms ont pout longueur MED_TAILLE_PNOM */ - char nomnoe[4*MED_TAILLE_PNOM+1] = "nom1 nom2 nom3 nom4 "; + char nomnoe[4*MED_TAILLE_PNOM+1] = "nom1 nom2 nom3 nom4 "; med_int numnoe[4] = {1,2,3,4}; med_int nufano[4] = {0,1,2,2}; char nomfam[MED_TAILLE_NOM+1]; @@ -65,10 +70,15 @@ int main (int argc, char **argv) med_int attval; med_int ngro; char gro[MED_TAILLE_LNOM+1]; - int i; + int i, ip1; int nfame = 1; int nfamn = 2; - med_int fam[16]; + med_int famNodeStd[4]; + med_int famElmtStd[1]; + med_int famFaceStd[4]; + med_int famNodeCart[16]; + med_int famElmtCart[9]; + med_int famFaceCart[24]; /* les elements: */ @@ -76,33 +86,33 @@ int main (int argc, char **argv) med_int quad4[4] = { 1, 2, 4, 3 }; - char nomquad4[MED_TAILLE_PNOM*1+1] = "quad1 "; + char nomquad4[MED_TAILLE_PNOM*1+1] = "quad1 "; med_int numquad4[1] = {1}; med_int nufaquad4[1] = {-1}; - fid = MEDouvrir("test19.med",MED_REMP); + fid = MEDouvrir("test19.med",MED_LECTURE_ECRITURE); if (fid < 0) ret = -1; else ret = 0; - printf("%d\n",ret); + printf("MEDouvrir : %d\n",ret); /* creation du maillage maa de dimension 2 */ if (ret == 0) - ret = MEDmaaCr(fid,maa,mdim); - printf("%d\n",ret); + ret = MEDmaaCr(fid,maa,mdim,MED_NON_STRUCTURE,maadesc); + printf("MEDmaaCr : %d\n",ret); /* ecriture des noeuds d'un maillage MED : - des coo en mode MED_FULL_INTERLACE : (X1,Y1,X2,Y2,X3,Y3,...) - dans un repere cartesien + dans un repere cartesien - des noms (optionnel dans un fichier MED) - des numeros (optionnel dans un fichier MED) - des numeros de familles des noeuds */ if (ret == 0) ret = MEDnoeudsEcr(fid,maa,mdim,coo,MED_FULL_INTERLACE,MED_CART, nomcoo,unicoo,nomnoe,MED_VRAI,numnoe,MED_VRAI, - nufano,nnoe,MED_ECRI); - printf("%d\n",ret); + nufano,nnoe); + printf("MEDnoeudsEcr : %d\n",ret); /* ecriture des mailles MED_QUAD4 : - connectivite @@ -112,18 +122,18 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDelementsEcr(fid,maa,mdim,quad4,MED_FULL_INTERLACE, nomquad4,MED_FAUX,numquad4,MED_VRAI,nufaquad4,nquad4, - MED_MAILLE,MED_QUAD4,MED_NOD,MED_ECRI); - printf("%d \n",ret); + MED_MAILLE,MED_QUAD4,MED_NOD); + printf("MEDelementsEcr : %d\n",ret); /* ecriture des familles */ /* Conventions : - toujours creer une famille de numero 0 ne comportant aucun attribut - ni groupe (famille de reference pour les noeuds ou les elements - qui ne sont rattaches a aucun groupe ni attribut) + ni groupe (famille de reference pour les noeuds ou les elements + qui ne sont rattaches a aucun groupe ni attribut) - les numeros de familles de noeuds sont > 0 - les numeros de familles des elements sont < 0 - rien d'imposer sur les noms de familles - */ + */ /* la famille 0 */ if (ret == 0) @@ -133,7 +143,7 @@ int main (int argc, char **argv) ret = MEDfamCr(fid,maa,nomfam,numfam,&attide,&attval,attdes,0, gro,0); } - printf("%d \n",ret); + printf("MEDfamCr : %d \n",ret); /* on cree pour correspondre aux cas tests precedents, 3 familles d'elements (-1,-2,-3) et deux familles de noeuds (1,2) */ @@ -162,7 +172,7 @@ int main (int argc, char **argv) } } - if (ret == 0) + if (ret == 0) { nfamn = 2; for (i=0;i #include -#define MED_NOPG 1 /* -> pas de point de Gauss */ -#define MED_NOPFL "" /* -> pas de profils utilisateur */ -#define MED_NOPFLi " " /* Variable Interne */ -#define MED_NOPF 0 /* -> pas de profils pour _MEDdataseNnumEcrire */ -#define MED_NOPDT -1 /* rem: pas de pas de temps negatifs */ -#define MED_NONOR -1 /* rem: pas de n°ordre negatif */ -#define MED_DIM1 1 /* PAS */ - -#define MED_ALL 0 - int main (int argc, char **argv) { med_err ret; med_idt fid; char maa[MED_TAILLE_NOM+1] = "maa1"; + char maadesc[MED_TAILLE_DESC+1] = "Example de maillage non structure 3D"; med_int mdim = 3; med_int nnoe = 19; med_float coo[57] = { @@ -39,8 +30,8 @@ int main (int argc, char **argv) 1.0, -1.0, 4.0, 0.0, 0.0, 5.0 }; - char nomcoo[3*MED_TAILLE_PNOM+1] = "x y z "; - char unicoo[3*MED_TAILLE_PNOM+1] = "cm cm cm "; + char nomcoo[3*MED_TAILLE_PNOM+1] = "x y z "; + char unicoo[3*MED_TAILLE_PNOM+1] = "cm cm cm "; /* char nomnoe[19*MED_TAILLE_PNOM+1] = "nom1 nom2 nom3 nom4";*/ char *nomnoe ; med_int numnoe[19] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}; @@ -70,7 +61,7 @@ int main (int argc, char **argv) 7,8,9,10,2, 15,18,17,16,19 }; - char nompyra5[MED_TAILLE_PNOM*2+1] = "pyra1 pyra2 "; + char nompyra5[MED_TAILLE_PNOM*2+1] = "pyra1 pyra2 "; med_int numpyra5[2] = {13,16}; med_int nufapyra5[2] = {0,-3}; @@ -79,7 +70,7 @@ int main (int argc, char **argv) 11,12,13,14,7,8,9,10, 15,16,17,18,11,12,13,14 }; - char nomhexa8[MED_TAILLE_PNOM*2+1] = "hexa1 hexa2 "; + char nomhexa8[MED_TAILLE_PNOM*2+1] = "hexa1 hexa2 "; med_int numhexa8[2] = {14,15}; med_int nufahexa8[2] = {0,0}; @@ -102,32 +93,32 @@ int main (int argc, char **argv) Some fields : 2 on nodes : one int and one double , one on cells : double */ char champ1[MED_TAILLE_NOM+1]="fieldnodeint" ; - char champ1_comp[MED_TAILLE_PNOM+1]="comp1 " ; - char champ1_unit[MED_TAILLE_PNOM+1]="M " ; + char champ1_comp[MED_TAILLE_PNOM+1]="comp1 " ; + char champ1_unit[MED_TAILLE_PNOM+1]="M " ; med_int fieldnodeint[19] = {1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7}; char champ2[MED_TAILLE_NOM+1]="fieldnodedouble" ; - char champ2_comp[MED_TAILLE_PNOM+1]="comp1 " ; - char champ2_unit[MED_TAILLE_PNOM+1]="J " ; + char champ2_comp[MED_TAILLE_PNOM+1]="comp1 " ; + char champ2_unit[MED_TAILLE_PNOM+1]="J " ; med_float fieldnodedouble1[19] = {1.,1.,1.,2.,2.,2.,3.,3.,3.,4.,4.,4.,5.,5.,5.,6.,6.,6.,7.}; med_float fieldnodedouble2[19] = {1.,2.,2.,2.,3.,3.,3.,4.,4.,4.,5.,5.,5.,6.,6.,6.,7.,7.,7.}; char champ3[MED_TAILLE_NOM+1]="fieldcelldoublevector" ; - char champ3_comp[MED_TAILLE_PNOM*3+1]="comp1 comp2 comp3 " ; - char champ3_unit[MED_TAILLE_PNOM*3+1]="m/s m/s m/s " ; + char champ3_comp[MED_TAILLE_PNOM*3+1]="comp1 comp2 comp3 " ; + char champ3_unit[MED_TAILLE_PNOM*3+1]="m/s m/s m/s " ; med_float fieldcelldouble1[12*3] = {1.,1.,1.,2.,2.,2.,3.,3.,3.,4.,4.,4.,0.,0.,0.,1.,1.,1.,0.,0.,0.,1.,1.,1.,1.,1.,1.,0.,0.,0.,1.,1.,1.,0.,0.,0.}; med_float fieldcelldouble2[2*3] = {5.,5.,0.,1.,0.,1.}; med_float fieldcelldouble3[2*3] = {6.,6.,1.,0.,1.,0.}; char champ4[MED_TAILLE_NOM+1]="fieldcelldoublescalar" ; - char champ4_comp[MED_TAILLE_PNOM+1]="comp1 " ; - char champ4_unit[MED_TAILLE_PNOM+1]="m/s " ; + char champ4_comp[MED_TAILLE_PNOM+1]="comp1 " ; + char champ4_unit[MED_TAILLE_PNOM+1]="m/s " ; med_float fieldcelldouble4[12] = {1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.}; med_float fieldcelldouble5[2] = {2.,2.}; med_float fieldcelldouble6[2] = {3.,3.}; /***************************************************************************/ - fid = MEDouvrir("pointe.med",MED_REMP); + fid = MEDouvrir("pointe.med",MED_LECTURE_ECRITURE); if (fid < 0) ret = -1; else @@ -136,7 +127,7 @@ int main (int argc, char **argv) /***************************************************************************/ if (ret == 0) - ret = MEDmaaCr(fid,maa,mdim); + ret = MEDmaaCr(fid,maa,mdim,MED_NON_STRUCTURE,maadesc); printf("MEDmaaCr : %d\n",ret); if (ret == 0) ret = MEDunvCr(fid,maa); @@ -146,7 +137,7 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDnoeudsEcr(fid,maa,mdim,coo,MED_FULL_INTERLACE,MED_CART, nomcoo,unicoo,nomnoe,MED_FAUX,numnoe,MED_VRAI, - nufano,nnoe,MED_ECRI); + nufano,nnoe); printf("MEDnoeudsEcr : %d\n",ret); @@ -159,7 +150,7 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDelementsEcr(fid,maa,mdim,tet4,MED_FULL_INTERLACE, nomtet4,MED_FAUX,numtet4,MED_VRAI,nufatet4,ntet4, - MED_MAILLE,MED_TETRA4,MED_NOD,MED_ECRI); + MED_MAILLE,MED_TETRA4,MED_NOD); printf("MEDelementsEcr : %d \n",ret); /* ecriture des mailles MED_PYRA5 : @@ -170,7 +161,7 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDelementsEcr(fid,maa,mdim,pyra5,MED_FULL_INTERLACE, nompyra5,MED_VRAI,numpyra5,MED_VRAI,nufapyra5,npyra5, - MED_MAILLE,MED_PYRA5,MED_NOD,MED_ECRI); + MED_MAILLE,MED_PYRA5,MED_NOD); printf("MEDelementsEcr : %d \n",ret); /* ecriture des mailles MED_HEXA8 : @@ -181,7 +172,7 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDelementsEcr(fid,maa,mdim,hexa8,MED_FULL_INTERLACE, nomhexa8,MED_FAUX,numhexa8,MED_VRAI,nufahexa8,nhexa8, - MED_MAILLE,MED_HEXA8,MED_NOD,MED_ECRI); + MED_MAILLE,MED_HEXA8,MED_NOD); printf("MEDelementsEcr : %d \n",ret); /***************************************************************************/ @@ -303,9 +294,9 @@ int main (int argc, char **argv) printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ1, (unsigned char *)fieldnodeint, - MED_NO_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, MED_NOPDT," ", 0., MED_NONOR); + MED_NO_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } @@ -313,18 +304,18 @@ int main (int argc, char **argv) if (ret == 0) { - ret = MEDchampCr(fid,champ2,MED_REEL64,champ2_comp,champ2_unit,1); + ret = MEDchampCr(fid,champ2,MED_FLOAT64,champ2_comp,champ2_unit,1); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble1, - MED_NO_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, 1,"S ", 1.1 , MED_NONOR); + MED_NO_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + 1,"S ", 1.1 , MED_NONOR); printf("MEDchampEcr1 : %d \n",ret); ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble2, - MED_NO_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, 2,"S ", 1.2 , MED_NONOR); + MED_NO_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + 2,"S ", 1.2 , MED_NONOR); printf("MEDchampEcr2 : %d \n",ret); } } @@ -336,55 +327,55 @@ int main (int argc, char **argv) /* printf("MEDchampCr : %d \n",ret); */ if (ret == 0) { ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble1, - MED_NO_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, MED_NOPDT," ", 0. , MED_NONOR); + MED_NO_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + MED_NOPDT," ", 0. , MED_NONOR); printf("MEDchampEcr : %d \n",ret); } } if (ret == 0) { - ret = MEDchampCr(fid,champ3,MED_REEL64,champ3_comp,champ3_unit,3); + ret = MEDchampCr(fid,champ3,MED_FLOAT64,champ3_comp,champ3_unit,3); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ3, (unsigned char *)fieldcelldouble1, - MED_NO_INTERLACE, ntet4, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_MAILLE, - MED_TETRA4, MED_NOPDT," ", 0., MED_NONOR); + MED_NO_INTERLACE, ntet4, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, MED_TETRA4, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); ret = MEDchampEcr(fid, maa, champ3, (unsigned char *)fieldcelldouble3, - MED_NO_INTERLACE, nhexa8, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_MAILLE, - MED_HEXA8, MED_NOPDT," ", 0., MED_NONOR); + MED_NO_INTERLACE, nhexa8, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, MED_HEXA8, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); ret = MEDchampEcr(fid, maa, champ3, (unsigned char *)fieldcelldouble2, - MED_NO_INTERLACE, npyra5, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_MAILLE, - MED_PYRA5, MED_NOPDT," ", 0., MED_NONOR); + MED_NO_INTERLACE, npyra5, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, MED_PYRA5, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } } if (ret == 0) { - ret = MEDchampCr(fid,champ4,MED_REEL64,champ4_comp,champ4_unit,1); + ret = MEDchampCr(fid,champ4,MED_FLOAT64,champ4_comp,champ4_unit,1); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ4, (unsigned char *)fieldcelldouble4, - MED_NO_INTERLACE, ntet4, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_MAILLE, - MED_TETRA4, MED_NOPDT," ", 0., MED_NONOR); + MED_NO_INTERLACE, ntet4, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, MED_TETRA4, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); ret = MEDchampEcr(fid, maa, champ4, (unsigned char *)fieldcelldouble6, - MED_NO_INTERLACE, nhexa8, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_MAILLE, - MED_HEXA8, MED_NOPDT," ", 0., MED_NONOR); + MED_NO_INTERLACE, nhexa8, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, MED_HEXA8, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); ret = MEDchampEcr(fid, maa, champ4, (unsigned char *)fieldcelldouble5, - MED_NO_INTERLACE, npyra5, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_MAILLE, - MED_PYRA5, MED_NOPDT," ", 0., MED_NONOR); + MED_NO_INTERLACE, npyra5, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, MED_PYRA5, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } } diff --git a/src/MEDMEM/create_mesh_c2q4.c b/src/MEDMEM/create_mesh_c2q4.c index 5639bfe08..8d6941914 100644 --- a/src/MEDMEM/create_mesh_c2q4.c +++ b/src/MEDMEM/create_mesh_c2q4.c @@ -14,6 +14,7 @@ int main (int argc, char **argv) med_err ret; med_idt fid; char maa[MED_TAILLE_NOM+1] = "carre_en_quad4"; + char maadesc[MED_TAILLE_DESC+1] = "Example de maillage non structure 2D"; med_int mdim = 2; med_int nnoe = 9; /* @@ -30,8 +31,8 @@ int main (int argc, char **argv) 0.5, 1.0, 1.0, 1.0 }; - char nomcoo[2*MED_TAILLE_PNOM+1] = "x y "; - char unicoo[2*MED_TAILLE_PNOM+1] = "cm cm "; + char nomcoo[2*MED_TAILLE_PNOM+1] = "x y "; + char unicoo[2*MED_TAILLE_PNOM+1] = "cm cm "; /* char nomnoe[19*MED_TAILLE_PNOM+1] = "nom1 nom2 nom3 nom4";*/ char *nomnoe ; med_int numnoe[9] = {1,2,3,4,5,6,7,8,9}; @@ -46,7 +47,7 @@ int main (int argc, char **argv) 7, 8, 5, 4, 8, 9, 6, 5 }; - char nomquad4[MED_TAILLE_PNOM*4+1] = "quad1 quad2 quad3 quad4 "; + char nomquad4[MED_TAILLE_PNOM*4+1] = "quad1 quad2 quad3 quad4 "; med_int numquad4[4] = {1,2,3,4}; med_int nufaquad4[4] = {-1,-1,0,0}; @@ -66,43 +67,43 @@ int main (int argc, char **argv) Some fields : 2 on nodes : one int and one double , one on cells : double */ char champ1[MED_TAILLE_NOM+1]="fieldnodeint" ; - char champ1_comp[MED_TAILLE_PNOM+1]="comp1 " ; - char champ1_unit[MED_TAILLE_PNOM+1]="M " ; + char champ1_comp[MED_TAILLE_PNOM+1]="comp1 " ; + char champ1_unit[MED_TAILLE_PNOM+1]="M " ; med_int fieldnodeint[9] = {1,1,3,2,2,3,4,4,5}; char champ2[MED_TAILLE_NOM+1]="fieldnodedouble" ; - char champ2_comp[MED_TAILLE_PNOM+1]="comp1 " ; - char champ2_unit[MED_TAILLE_PNOM+1]="J " ; + char champ2_comp[MED_TAILLE_PNOM+1]="comp1 " ; + char champ2_unit[MED_TAILLE_PNOM+1]="J " ; med_float fieldnodedouble1[9] = {1.,3.,4.,1.,3.,4.,3.,2.,5.}; med_float fieldnodedouble2[9] = {1.,2.,2.,3.,3.,3.,4.,4.,5.}; char champ3[MED_TAILLE_NOM+1]="fieldcelldouble" ; - char champ3_comp[MED_TAILLE_PNOM*2+1]="comp1 comp2 " ; - char champ3_unit[MED_TAILLE_PNOM*2+1]="M/S m/s " ; + char champ3_comp[MED_TAILLE_PNOM*2+1]="comp1 comp2 " ; + char champ3_unit[MED_TAILLE_PNOM*2+1]="M/S m/s " ; med_float fieldcelldouble[4*2] = {0.,1.,1.,1.,1.,2.,2.,3.}; /***************************************************************************/ - fid = MEDouvrir("carre_en_quad4.med",MED_REMP); + fid = MEDouvrir("carre_en_quad4.med",MED_LECTURE_ECRITURE); if (fid < 0) ret = -1; else ret = 0; - printf("%d\n",ret); + printf("MEDouvrir : %d\n",ret); /***************************************************************************/ if (ret == 0) - ret = MEDmaaCr(fid,maa,mdim); - printf("%d\n",ret); + ret = MEDmaaCr(fid,maa,mdim,MED_NON_STRUCTURE,maadesc); + printf("MEDmaaCr : %d\n",ret); if (ret == 0) ret = MEDunvCr(fid,maa); - printf("%d\n",ret); + printf("MEDunvCr : %d\n",ret); /***************************************************************************/ if (ret == 0) ret = MEDnoeudsEcr(fid,maa,mdim,coo,MED_FULL_INTERLACE,MED_CART, nomcoo,unicoo,nomnoe,MED_FAUX,numnoe,MED_VRAI, - nufano,nnoe,MED_ECRI); - printf("%d\n",ret); + nufano,nnoe); + printf("MEDnoeudsEcr : %d\n",ret); /* ecriture des mailles MED_QUAD4 : - connectivite @@ -112,8 +113,8 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDelementsEcr(fid,maa,mdim,quad4,MED_FULL_INTERLACE, nomquad4,MED_FAUX,numquad4,MED_VRAI,nufaquad4,nquad4, - MED_MAILLE,MED_QUAD4,MED_NOD,MED_ECRI); - printf("%d \n",ret); + MED_MAILLE,MED_QUAD4,MED_NOD); + printf("MEDelementsEcr : %d \n",ret); /***************************************************************************/ /* ecriture des familles */ @@ -134,7 +135,7 @@ int main (int argc, char **argv) ret = MEDfamCr(fid,maa,nomfam,numfam,&attide,&attval,attdes,0, gro,0); } - printf("%d \n",ret); + printf("MEDfamCr : %d \n",ret); /* on cree : - 1 familles d'elements de dimension (d) @@ -167,9 +168,9 @@ int main (int argc, char **argv) printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ1, (unsigned char *)fieldnodeint, - MED_NO_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, MED_NOPDT," ", 0., MED_NONOR); + MED_NO_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } @@ -177,18 +178,18 @@ int main (int argc, char **argv) if (ret == 0) { - ret = MEDchampCr(fid,champ2,MED_REEL64,champ2_comp,champ2_unit,1); + ret = MEDchampCr(fid,champ2,MED_FLOAT64,champ2_comp,champ2_unit,1); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble1, - MED_NO_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, 1,"S ", 1.1 , MED_NONOR); + MED_NO_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + 1,"S ", 1.1 , MED_NONOR); printf("MEDchampEcr1 : %d \n",ret); ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble2, - MED_NO_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, 2,"S ", 1.2 , MED_NONOR); + MED_NO_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + 2,"S ", 1.2 , MED_NONOR); printf("MEDchampEcr2 : %d \n",ret); } } @@ -197,21 +198,21 @@ int main (int argc, char **argv) if (ret == 0) { ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble1, - MED_NO_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, MED_NOPDT," ", 0. , MED_NONOR); + MED_NO_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + MED_NOPDT," ", 0. , MED_NONOR); printf("MEDchampEcr : %d \n",ret); } if (ret == 0) { - ret = MEDchampCr(fid,champ3,MED_REEL64,champ3_comp,champ3_unit,2); + ret = MEDchampCr(fid,champ3,MED_FLOAT64,champ3_comp,champ3_unit,2); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ3, (unsigned char *)fieldcelldouble, - MED_NO_INTERLACE, nquad4, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_MAILLE, - MED_QUAD4, MED_NOPDT," ", 0., MED_NONOR); + MED_NO_INTERLACE, nquad4, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, MED_QUAD4, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } } @@ -219,8 +220,7 @@ int main (int argc, char **argv) /***************************************************************************/ ret = MEDfermer(fid); - printf("%d\n",ret); + printf("MEDfermer : %d\n",ret); return 0; } - diff --git a/src/MEDMEM/create_mesh_c2q4s2.c b/src/MEDMEM/create_mesh_c2q4s2.c index 8014b44d0..42859dd40 100644 --- a/src/MEDMEM/create_mesh_c2q4s2.c +++ b/src/MEDMEM/create_mesh_c2q4s2.c @@ -1,6 +1,6 @@ /* creation d'une geometrie 2d : un cube [0,1]^2 - maillé uniformement en quadrangle reguliers; + maillé uniformement en quadrangle reguliers; avec en plus une partie des aretes (une partie des arretes de la frontiere) du maillage. ATTENTION : 3 noeuds dans chaque direction @@ -14,6 +14,7 @@ int main (int argc, char **argv) med_err ret; med_idt fid; char maa[MED_TAILLE_NOM+1] = "carre_en_quad4_seg2"; + char maadesc[MED_TAILLE_DESC+1] = "Example de maillage non structure 2D"; med_int mdim = 2; med_int nnoe = 9; /* @@ -30,8 +31,8 @@ int main (int argc, char **argv) 0.5, 1.0, 1.0, 1.0 }; - char nomcoo[2*MED_TAILLE_PNOM+1] = "x y "; - char unicoo[2*MED_TAILLE_PNOM+1] = "cm cm "; + char nomcoo[2*MED_TAILLE_PNOM+1] = "x y "; + char unicoo[2*MED_TAILLE_PNOM+1] = "cm cm "; /* char nomnoe[19*MED_TAILLE_PNOM+1] = "nom1 nom2 nom3 nom4";*/ char *nomnoe ; med_int numnoe[9] = {1,2,3,4,5,6,7,8,9}; @@ -46,7 +47,7 @@ int main (int argc, char **argv) 7, 8, 5, 4, 8, 9, 6, 5 }; - char nomquad4[MED_TAILLE_PNOM*4+1] = "quad1 quad2 quad3 quad4 "; + char nomquad4[MED_TAILLE_PNOM*4+1] = "quad1 quad2 quad3 quad4 "; med_int numquad4[4] = {1,2,3,4}; med_int nufaquad4[4] = {-10,-10,0,0}; @@ -63,7 +64,7 @@ int main (int argc, char **argv) 2, 5, 0, 5, 8, 0 }; - char nomseg2[MED_TAILLE_PNOM*6+1] = "seg1 seg2 seg3 seg4 seg5 seg6 "; + char nomseg2[MED_TAILLE_PNOM*6+1] = "seg1 seg2 seg3 seg4 seg5 seg6 "; med_int numseg2[6] = {1,2,3,4,5,6}; med_int nufaseg2[6] = {-1,-2,-1,-1,-2,-2}; @@ -83,43 +84,43 @@ int main (int argc, char **argv) Some fields : 2 on nodes : one int and one double , one on cells : double */ char champ1[MED_TAILLE_NOM+1]="fieldnodeint" ; - char champ1_comp[MED_TAILLE_PNOM+1]="comp1 " ; - char champ1_unit[MED_TAILLE_PNOM+1]="M " ; + char champ1_comp[MED_TAILLE_PNOM+1]="comp1 " ; + char champ1_unit[MED_TAILLE_PNOM+1]="M " ; med_int fieldnodeint[9] = {1,1,3,2,2,3,4,4,5}; char champ2[MED_TAILLE_NOM+1]="fieldnodedouble" ; - char champ2_comp[MED_TAILLE_PNOM+1]="comp1 " ; - char champ2_unit[MED_TAILLE_PNOM+1]="J " ; + char champ2_comp[MED_TAILLE_PNOM+1]="comp1 " ; + char champ2_unit[MED_TAILLE_PNOM+1]="J " ; med_float fieldnodedouble1[9] = {1.,3.,4.,1.,3.,4.,3.,2.,5.}; med_float fieldnodedouble2[9] = {1.,2.,2.,3.,3.,3.,4.,4.,5.}; char champ3[MED_TAILLE_NOM+1]="fieldcelldouble" ; - char champ3_comp[MED_TAILLE_PNOM*2+1]="comp1 comp2 " ; - char champ3_unit[MED_TAILLE_PNOM*2+1]="M/S m/s " ; + char champ3_comp[MED_TAILLE_PNOM*2+1]="comp1 comp2 " ; + char champ3_unit[MED_TAILLE_PNOM*2+1]="M/S m/s " ; med_float fieldcelldouble[4*2] = {0.,1.,1.,1.,1.,2.,2.,3.}; /***************************************************************************/ - fid = MEDouvrir("carre_en_quad4_seg2.med",MED_REMP); + fid = MEDouvrir("carre_en_quad4_seg2.med",MED_LECTURE_ECRITURE); if (fid < 0) ret = -1; else ret = 0; - printf("%d\n",ret); + printf("MEDouvrir : %d\n",ret); /***************************************************************************/ if (ret == 0) - ret = MEDmaaCr(fid,maa,mdim); - printf("%d\n",ret); + ret = MEDmaaCr(fid,maa,mdim,MED_NON_STRUCTURE,maadesc); + printf("MEDmaaCr : %d\n",ret); if (ret == 0) ret = MEDunvCr(fid,maa); - printf("%d\n",ret); + printf("MEDunvCr : %d\n",ret); /***************************************************************************/ if (ret == 0) ret = MEDnoeudsEcr(fid,maa,mdim,coo,MED_FULL_INTERLACE,MED_CART, nomcoo,unicoo,nomnoe,MED_FAUX,numnoe,MED_VRAI, - nufano,nnoe,MED_ECRI); - printf("%d\n",ret); + nufano,nnoe); + printf("MEDnoeudsEcr : %d\n",ret); /* ecriture des mailles MED_QUAD4 : - connectivite @@ -129,8 +130,8 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDelementsEcr(fid,maa,mdim,quad4,MED_FULL_INTERLACE, nomquad4,MED_FAUX,numquad4,MED_VRAI,nufaquad4,nquad4, - MED_MAILLE,MED_QUAD4,MED_NOD,MED_ECRI); - printf("%d \n",ret); + MED_MAILLE,MED_QUAD4,MED_NOD); + printf("MEDelementsEcr : %d \n",ret); /* ecriture des mailles MED_SEG2 : - connectivite @@ -140,7 +141,7 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDelementsEcr(fid,maa,mdim,seg2,MED_FULL_INTERLACE, nomseg2,MED_FAUX,numseg2,MED_VRAI,nufaseg2,nseg2, - MED_MAILLE,MED_SEG2,MED_NOD,MED_ECRI); + MED_MAILLE,MED_SEG2,MED_NOD); printf("%d \n",ret); /***************************************************************************/ @@ -231,9 +232,9 @@ int main (int argc, char **argv) printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ1, (unsigned char *)fieldnodeint, - MED_NO_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, MED_NOPDT," ", 0., MED_NONOR); + MED_NO_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } @@ -241,18 +242,18 @@ int main (int argc, char **argv) if (ret == 0) { - ret = MEDchampCr(fid,champ2,MED_REEL64,champ2_comp,champ2_unit,1); + ret = MEDchampCr(fid,champ2,MED_FLOAT64,champ2_comp,champ2_unit,1); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble1, - MED_NO_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, 1,"S ", 1.1 , MED_NONOR); + MED_NO_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + 1,"S ", 1.1 , MED_NONOR); printf("MEDchampEcr1 : %d \n",ret); ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble2, - MED_NO_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, 2,"S ", 1.2 , MED_NONOR); + MED_NO_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + 2,"S ", 1.2 , MED_NONOR); printf("MEDchampEcr2 : %d \n",ret); } } @@ -261,21 +262,21 @@ int main (int argc, char **argv) if (ret == 0) { ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble1, - MED_NO_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, MED_NOPDT," ", 0. , MED_NONOR); + MED_NO_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + MED_NOPDT," ", 0. , MED_NONOR); printf("MEDchampEcr : %d \n",ret); } if (ret == 0) { - ret = MEDchampCr(fid,champ3,MED_REEL64,champ3_comp,champ3_unit,2); + ret = MEDchampCr(fid,champ3,MED_FLOAT64,champ3_comp,champ3_unit,2); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ3, (unsigned char *)fieldcelldouble, - MED_NO_INTERLACE, nquad4, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_MAILLE, - MED_QUAD4, MED_NOPDT," ", 0., MED_NONOR); + MED_NO_INTERLACE, nquad4, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, MED_QUAD4, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } } @@ -287,4 +288,3 @@ int main (int argc, char **argv) return 0; } - diff --git a/src/MEDMEM/create_mesh_c2q4s2_wrong.c b/src/MEDMEM/create_mesh_c2q4s2_wrong.c index b25fd727e..bf077746e 100644 --- a/src/MEDMEM/create_mesh_c2q4s2_wrong.c +++ b/src/MEDMEM/create_mesh_c2q4s2_wrong.c @@ -14,6 +14,7 @@ int main (int argc, char **argv) med_err ret; med_idt fid; char maa[MED_TAILLE_NOM+1] = "carre_en_quad4_seg2_wrong"; + char maadesc[MED_TAILLE_DESC+1] = "Example de maillage non structure 2D"; med_int mdim = 2; med_int nnoe = 9; /* @@ -30,8 +31,8 @@ int main (int argc, char **argv) 0.5, 1.0, 1.0, 1.0 }; - char nomcoo[2*MED_TAILLE_PNOM+1] = "x y "; - char unicoo[2*MED_TAILLE_PNOM+1] = "cm cm "; + char nomcoo[2*MED_TAILLE_PNOM+1] = "x y "; + char unicoo[2*MED_TAILLE_PNOM+1] = "cm cm "; /* char nomnoe[19*MED_TAILLE_PNOM+1] = "nom1 nom2 nom3 nom4";*/ char *nomnoe ; med_int numnoe[9] = {1,2,3,4,5,6,7,8,9}; @@ -46,7 +47,7 @@ int main (int argc, char **argv) 7, 8, 5, 4, 8, 9, 6, 5 }; - char nomquad4[MED_TAILLE_PNOM*4+1] = "quad1 quad2 quad3 quad4 "; + char nomquad4[MED_TAILLE_PNOM*4+1] = "quad1 quad2 quad3 quad4 "; med_int numquad4[4] = {1,2,3,4}; med_int nufaquad4[4] = {-10,-10,0,0}; @@ -67,7 +68,7 @@ int main (int argc, char **argv) 2, 5, 5, 8 }; - char nomseg2[MED_TAILLE_PNOM*6+1] = "seg1 seg2 seg3 seg4 seg5 seg6 "; + char nomseg2[MED_TAILLE_PNOM*6+1] = "seg1 seg2 seg3 seg4 seg5 seg6 "; med_int numseg2[6] = {1,2,3,4,5,6}; med_int nufaseg2[6] = {-1,-2,-1,-1,-2,-2}; @@ -87,43 +88,43 @@ int main (int argc, char **argv) Some fields : 2 on nodes : one int and one double , one on cells : double */ char champ1[MED_TAILLE_NOM+1]="fieldnodeint" ; - char champ1_comp[MED_TAILLE_PNOM+1]="comp1 " ; - char champ1_unit[MED_TAILLE_PNOM+1]="M " ; + char champ1_comp[MED_TAILLE_PNOM+1]="comp1 " ; + char champ1_unit[MED_TAILLE_PNOM+1]="M " ; med_int fieldnodeint[9] = {1,1,3,2,2,3,4,4,5}; char champ2[MED_TAILLE_NOM+1]="fieldnodedouble" ; - char champ2_comp[MED_TAILLE_PNOM+1]="comp1 " ; - char champ2_unit[MED_TAILLE_PNOM+1]="J " ; + char champ2_comp[MED_TAILLE_PNOM+1]="comp1 " ; + char champ2_unit[MED_TAILLE_PNOM+1]="J " ; med_float fieldnodedouble1[9] = {1.,3.,4.,1.,3.,4.,3.,2.,5.}; med_float fieldnodedouble2[9] = {1.,2.,2.,3.,3.,3.,4.,4.,5.}; char champ3[MED_TAILLE_NOM+1]="fieldcelldouble" ; - char champ3_comp[MED_TAILLE_PNOM*2+1]="comp1 comp2 " ; - char champ3_unit[MED_TAILLE_PNOM*2+1]="M/S m/s " ; + char champ3_comp[MED_TAILLE_PNOM*2+1]="comp1 comp2 " ; + char champ3_unit[MED_TAILLE_PNOM*2+1]="M/S m/s " ; med_float fieldcelldouble[4*2] = {0.,1.,1.,1.,1.,2.,2.,3.}; /***************************************************************************/ - fid = MEDouvrir("carre_en_quad4_seg2_wrong.med",MED_REMP); + fid = MEDouvrir("carre_en_quad4_seg2_wrong.med",MED_LECTURE_ECRITURE); if (fid < 0) ret = -1; else ret = 0; - printf("%d\n",ret); + printf("MEDouvrir : %d\n",ret); /***************************************************************************/ if (ret == 0) - ret = MEDmaaCr(fid,maa,mdim); - printf("%d\n",ret); + ret = MEDmaaCr(fid,maa,mdim,MED_NON_STRUCTURE,maadesc); + printf("MEDmaaCr : %d\n",ret); if (ret == 0) ret = MEDunvCr(fid,maa); - printf("%d\n",ret); + printf("MEDunvCr : %d\n",ret); /***************************************************************************/ if (ret == 0) ret = MEDnoeudsEcr(fid,maa,mdim,coo,MED_FULL_INTERLACE,MED_CART, nomcoo,unicoo,nomnoe,MED_FAUX,numnoe,MED_VRAI, - nufano,nnoe,MED_ECRI); - printf("%d\n",ret); + nufano,nnoe); + printf("MEDnoeudsEcr : %d\n",ret); /* ecriture des mailles MED_QUAD4 : - connectivite @@ -133,8 +134,8 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDelementsEcr(fid,maa,mdim,quad4,MED_FULL_INTERLACE, nomquad4,MED_FAUX,numquad4,MED_VRAI,nufaquad4,nquad4, - MED_MAILLE,MED_QUAD4,MED_NOD,MED_ECRI); - printf("%d \n",ret); + MED_MAILLE,MED_QUAD4,MED_NOD); + printf("MEDelementsEcr : %d \n",ret); /* ecriture des mailles MED_SEG2 : - connectivite @@ -144,8 +145,8 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDelementsEcr(fid,maa,mdim,seg2,MED_FULL_INTERLACE, nomseg2,MED_FAUX,numseg2,MED_VRAI,nufaseg2,nseg2, - MED_ARETE,MED_SEG2,MED_NOD,MED_ECRI); - printf("%d \n",ret); + MED_ARETE,MED_SEG2,MED_NOD); + printf("MEDelementsEcr : %d \n",ret); /***************************************************************************/ /* ecriture des familles */ @@ -235,9 +236,9 @@ int main (int argc, char **argv) printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ1, (unsigned char *)fieldnodeint, - MED_NO_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, MED_NOPDT," ", 0., MED_NONOR); + MED_NO_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } @@ -245,18 +246,18 @@ int main (int argc, char **argv) if (ret == 0) { - ret = MEDchampCr(fid,champ2,MED_REEL64,champ2_comp,champ2_unit,1); + ret = MEDchampCr(fid,champ2,MED_FLOAT64,champ2_comp,champ2_unit,1); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble1, - MED_NO_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, 1,"S ", 1.1 , MED_NONOR); + MED_NO_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + 1,"S ", 1.1 , MED_NONOR); printf("MEDchampEcr1 : %d \n",ret); ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble2, - MED_NO_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, 2,"S ", 1.2 , MED_NONOR); + MED_NO_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + 2,"S ", 1.2 , MED_NONOR); printf("MEDchampEcr2 : %d \n",ret); } } @@ -265,21 +266,21 @@ int main (int argc, char **argv) if (ret == 0) { ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble1, - MED_NO_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, MED_NOPDT," ", 0. , MED_NONOR); + MED_NO_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + MED_NOPDT," ", 0. , MED_NONOR); printf("MEDchampEcr : %d \n",ret); } if (ret == 0) { - ret = MEDchampCr(fid,champ3,MED_REEL64,champ3_comp,champ3_unit,2); + ret = MEDchampCr(fid,champ3,MED_FLOAT64,champ3_comp,champ3_unit,2); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ3, (unsigned char *)fieldcelldouble, - MED_NO_INTERLACE, nquad4, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_MAILLE, - MED_QUAD4, MED_NOPDT," ", 0., MED_NONOR); + MED_NO_INTERLACE, nquad4, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, MED_QUAD4, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } } @@ -291,4 +292,3 @@ int main (int argc, char **argv) return 0; } - diff --git a/src/MEDMEM/create_mesh_c3h8.c b/src/MEDMEM/create_mesh_c3h8.c index c172f97a1..93d2612d9 100644 --- a/src/MEDMEM/create_mesh_c3h8.c +++ b/src/MEDMEM/create_mesh_c3h8.c @@ -14,6 +14,7 @@ int main (int argc, char **argv) med_err ret; med_idt fid; char maa[MED_TAILLE_NOM+1] = "CUBE_EN_HEXA8"; + char maadesc[MED_TAILLE_DESC+1] = "Example de maillage non structure 3D"; med_int mdim = 3; med_int nnoe = 27; /* @@ -48,8 +49,8 @@ int main (int argc, char **argv) 0.5, 1.0, 1.0, 1.0, 1.0, 1.0 }; - char nomcoo[3*MED_TAILLE_PNOM+1] = "x y z "; - char unicoo[3*MED_TAILLE_PNOM+1] = "cm cm cm "; + char nomcoo[3*MED_TAILLE_PNOM+1] = "x y z "; + char unicoo[3*MED_TAILLE_PNOM+1] = "cm cm cm "; /* char nomnoe[19*MED_TAILLE_PNOM+1] = "nom1 nom2 nom3 nom4";*/ char *nomnoe ; med_int numnoe[27] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27}; @@ -68,7 +69,7 @@ int main (int argc, char **argv) 16, 25, 26, 17, 13, 22, 23, 14, 17, 26, 27, 18, 14, 23, 24, 15 }; - char nomhexa8[MED_TAILLE_PNOM*8+1] = "hexa1 hexa2 hexa3 hexa4 hexa5 hexa6 hexa7 hexa8 "; + char nomhexa8[MED_TAILLE_PNOM*8+1] = "hexa1 hexa2 hexa3 hexa4 hexa5 hexa6 hexa7 hexa8 "; med_int numhexa8[8] = {1,2,3,4,5,6,7,8}; med_int nufahexa8[8] = {-1,-1,-1,-1,-2,-2,-2,-2}; @@ -90,43 +91,43 @@ int main (int argc, char **argv) */ char champ1[MED_TAILLE_NOM+1]="fieldnodeint" ; - char champ1_comp[MED_TAILLE_PNOM+1]="comp1 " ; - char champ1_unit[MED_TAILLE_PNOM+1]="M " ; + char champ1_comp[MED_TAILLE_PNOM+1]="comp1 " ; + char champ1_unit[MED_TAILLE_PNOM+1]="M " ; med_int fieldnodeint[27] = {1,1,3,2,2,3,4,4,5,1,1,3,2,2,3,4,4,5,1,1,3,2,2,3,4,4,5}; char champ2[MED_TAILLE_NOM+1]="fieldnodedouble" ; - char champ2_comp[MED_TAILLE_PNOM+1]="comp1 " ; - char champ2_unit[MED_TAILLE_PNOM+1]="J " ; + char champ2_comp[MED_TAILLE_PNOM+1]="comp1 " ; + char champ2_unit[MED_TAILLE_PNOM+1]="J " ; med_float fieldnodedouble1[27] = {1.,3.,4.,1.,3.,4.,3.,2.,5.,1.,3.,4.,1.,3.,4.,3.,2.,5.,1.,3.,4.,1.,3.,4.,3.,2.,5.}; med_float fieldnodedouble2[27] = {1.,2.,2.,3.,3.,3.,4.,4.,5.,1.,2.,2.,3.,3.,3.,4.,4.,5.,1.,2.,2.,3.,3.,3.,4.,4.,5.}; char champ3[MED_TAILLE_NOM+1]="fieldcelldouble" ; - char champ3_comp[MED_TAILLE_PNOM*3+1]="comp1 comp2 comp3 " ; - char champ3_unit[MED_TAILLE_PNOM*3+1]="M/S m/s m/s " ; + char champ3_comp[MED_TAILLE_PNOM*3+1]="comp1 comp2 comp3 " ; + char champ3_unit[MED_TAILLE_PNOM*3+1]="M/S m/s m/s " ; med_float fieldcelldouble[8*3] = {0.,1.,1.,1.,1.,2.,2.,3.,0.,1.,1.,1.,1.,2.,2.,3.,0.,1.,1.,1.,1.,2.,2.,3.}; /***************************************************************************/ - fid = MEDouvrir("cube_hexa8.med",MED_REMP); + fid = MEDouvrir("cube_hexa8.med",MED_LECTURE_ECRITURE); if (fid < 0) ret = -1; else ret = 0; - printf("%d\n",ret); + printf("MEDouvrir : %d\n",ret); /***************************************************************************/ if (ret == 0) - ret = MEDmaaCr(fid,maa,mdim); - printf("%d\n",ret); + ret = MEDmaaCr(fid,maa,mdim,MED_NON_STRUCTURE,maadesc); + printf("MEDmaaCr : %d\n",ret); if (ret == 0) ret = MEDunvCr(fid,maa); - printf("%d\n",ret); + printf("MEDunvCr : %d\n",ret); /***************************************************************************/ if (ret == 0) ret = MEDnoeudsEcr(fid,maa,mdim,coo,MED_FULL_INTERLACE,MED_CART, nomcoo,unicoo,nomnoe,MED_FAUX,numnoe,MED_VRAI, - nufano,nnoe,MED_ECRI); - printf("%d\n",ret); + nufano,nnoe); + printf("MEDnoeudsEcr : %d\n",ret); /* ecriture des mailles MED_HEXA8 : - connectivite @@ -136,8 +137,8 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDelementsEcr(fid,maa,mdim,hexa8,MED_FULL_INTERLACE, nomhexa8,MED_FAUX,numhexa8,MED_VRAI,nufahexa8,nhexa8, - MED_MAILLE,MED_HEXA8,MED_NOD,MED_ECRI); - printf("%d \n",ret); + MED_MAILLE,MED_HEXA8,MED_NOD); + printf("MEDelementsEcr : %d \n",ret); /***************************************************************************/ /* ecriture des familles */ @@ -224,9 +225,9 @@ int main (int argc, char **argv) printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ1, (unsigned char *)fieldnodeint, - MED_FULL_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, MED_NOPDT," ", 0., MED_NONOR); + MED_FULL_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } @@ -234,18 +235,18 @@ int main (int argc, char **argv) if (ret == 0) { - ret = MEDchampCr(fid,champ2,MED_REEL64,champ2_comp,champ2_unit,1); + ret = MEDchampCr(fid,champ2,MED_FLOAT64,champ2_comp,champ2_unit,1); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble1, - MED_FULL_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, 1,"S ", 1.1 , MED_NONOR); + MED_FULL_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + 1,"S ", 1.1 , MED_NONOR); printf("MEDchampEcr1 : %d \n",ret); ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble2, - MED_FULL_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, 2,"S ", 1.2 , MED_NONOR); + MED_FULL_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + 2,"S ", 1.2 , MED_NONOR); printf("MEDchampEcr2 : %d \n",ret); } } @@ -254,21 +255,21 @@ int main (int argc, char **argv) if (ret == 0) { ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble1, - MED_FULL_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, MED_NOPDT," ", 0. , MED_NONOR); + MED_FULL_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + MED_NOPDT," ", 0. , MED_NONOR); printf("MEDchampEcr : %d \n",ret); } if (ret == 0) { - ret = MEDchampCr(fid,champ3,MED_REEL64,champ3_comp,champ3_unit,3); + ret = MEDchampCr(fid,champ3,MED_FLOAT64,champ3_comp,champ3_unit,3); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ3, (unsigned char *)fieldcelldouble, - MED_FULL_INTERLACE, nhexa8, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_MAILLE, - MED_HEXA8, MED_NOPDT," ", 0., MED_NONOR); + MED_FULL_INTERLACE, nhexa8, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, MED_HEXA8, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } } @@ -280,4 +281,3 @@ int main (int argc, char **argv) return 0; } - diff --git a/src/MEDMEM/create_mesh_c3h8q4.c b/src/MEDMEM/create_mesh_c3h8q4.c index 35c961f94..a92a97743 100644 --- a/src/MEDMEM/create_mesh_c3h8q4.c +++ b/src/MEDMEM/create_mesh_c3h8q4.c @@ -1,6 +1,6 @@ /* creation d'une geometrie 3d : un cube [0,1]^3 - maillé uniformement en hexahedres reguliers; + maillé uniformement en hexahedres reguliers; avec en plus une partie des faces (une partie des faces de la frontiere) du maillage. ATTENTION : 3 noeuds dans chaque direction @@ -14,6 +14,7 @@ int main (int argc, char **argv) med_err ret; med_idt fid; char maa[MED_TAILLE_NOM+1] = "CUBE_EN_HEXA8_QUAD4"; + char maadesc[MED_TAILLE_DESC+1] = "Example de maillage non structure 3D"; med_int mdim = 3; med_int nnoe = 27; /* @@ -48,8 +49,8 @@ int main (int argc, char **argv) 0.5, 1.0, 1.0, 1.0, 1.0, 1.0 }; - char nomcoo[3*MED_TAILLE_PNOM+1] = "x y z "; - char unicoo[3*MED_TAILLE_PNOM+1] = "cm cm cm "; + char nomcoo[3*MED_TAILLE_PNOM+1] = "x y z "; + char unicoo[3*MED_TAILLE_PNOM+1] = "cm cm cm "; /* char nomnoe[19*MED_TAILLE_PNOM+1] = "nom1 nom2 nom3 nom4";*/ char *nomnoe ; med_int numnoe[27] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27}; @@ -68,7 +69,7 @@ int main (int argc, char **argv) 16, 25, 26, 17, 13, 22, 23, 14, 17, 26, 27, 18, 14, 23, 24, 15 }; - char nomhexa8[MED_TAILLE_PNOM*8+1] = "hexa1 hexa2 hexa3 hexa4 hexa5 hexa6 hexa7 hexa8 "; + char nomhexa8[MED_TAILLE_PNOM*8+1] = "hexa1 hexa2 hexa3 hexa4 hexa5 hexa6 hexa7 hexa8 "; med_int numhexa8[8] = {1,2,3,4,5,6,7,8}; med_int nufahexa8[8] = {-1,-1,-1,-1,-2,-2,-2,-2}; @@ -88,7 +89,7 @@ int main (int argc, char **argv) 7, 8, 5, 4, 0 }; - char nomquad4[MED_TAILLE_PNOM*8+1] = "quad1 quad2 quad3 quad4 quad5 quad6 quad7 quad8 "; + char nomquad4[MED_TAILLE_PNOM*8+1] = "quad1 quad2 quad3 quad4 quad5 quad6 quad7 quad8 "; med_int numquad4[8] = {1,2,3,4,5,6,7,8}; med_int nufaquad4[8] = {-3,-3,-3,-3,-4, -4, -4 , -4}; @@ -110,43 +111,43 @@ int main (int argc, char **argv) */ char champ1[MED_TAILLE_NOM+1]="fieldnodeint" ; - char champ1_comp[MED_TAILLE_PNOM+1]="comp1 " ; - char champ1_unit[MED_TAILLE_PNOM+1]="M " ; + char champ1_comp[MED_TAILLE_PNOM+1]="comp1 " ; + char champ1_unit[MED_TAILLE_PNOM+1]="M " ; med_int fieldnodeint[27] = {1,1,3,2,2,3,4,4,5,1,1,3,2,2,3,4,4,5,1,1,3,2,2,3,4,4,5}; char champ2[MED_TAILLE_NOM+1]="fieldnodedouble" ; - char champ2_comp[MED_TAILLE_PNOM+1]="comp1 " ; - char champ2_unit[MED_TAILLE_PNOM+1]="J " ; + char champ2_comp[MED_TAILLE_PNOM+1]="comp1 " ; + char champ2_unit[MED_TAILLE_PNOM+1]="J " ; med_float fieldnodedouble1[27] = {1.,3.,4.,1.,3.,4.,3.,2.,5.,1.,3.,4.,1.,3.,4.,3.,2.,5.,1.,3.,4.,1.,3.,4.,3.,2.,5.}; med_float fieldnodedouble2[27] = {1.,2.,2.,3.,3.,3.,4.,4.,5.,1.,2.,2.,3.,3.,3.,4.,4.,5.,1.,2.,2.,3.,3.,3.,4.,4.,5.}; char champ3[MED_TAILLE_NOM+1]="fieldcelldouble" ; - char champ3_comp[MED_TAILLE_PNOM*3+1]="comp1 comp2 comp3 " ; - char champ3_unit[MED_TAILLE_PNOM*3+1]="M/S m/s m/s " ; + char champ3_comp[MED_TAILLE_PNOM*3+1]="comp1 comp2 comp3 " ; + char champ3_unit[MED_TAILLE_PNOM*3+1]="M/S m/s m/s " ; med_float fieldcelldouble[8*3] = {0.,1.,1.,1.,1.,2.,2.,3.,0.,1.,1.,1.,1.,2.,2.,3.,0.,1.,1.,1.,1.,2.,2.,3.}; /***************************************************************************/ - fid = MEDouvrir("cube_hexa8_quad4.med",MED_REMP); + fid = MEDouvrir("cube_hexa8_quad4.med",MED_LECTURE_ECRITURE); if (fid < 0) ret = -1; else ret = 0; - printf("%d\n",ret); + printf("MEDouvrir : %d\n",ret); /***************************************************************************/ if (ret == 0) - ret = MEDmaaCr(fid,maa,mdim); - printf("%d\n",ret); + ret = MEDmaaCr(fid,maa,mdim,MED_NON_STRUCTURE,maadesc); + printf("MEDmaaCr : %d\n",ret); if (ret == 0) ret = MEDunvCr(fid,maa); - printf("%d\n",ret); + printf("MEDunvCr : %d\n",ret); /***************************************************************************/ if (ret == 0) ret = MEDnoeudsEcr(fid,maa,mdim,coo,MED_FULL_INTERLACE,MED_CART, nomcoo,unicoo,nomnoe,MED_FAUX,numnoe,MED_VRAI, - nufano,nnoe,MED_ECRI); - printf("%d\n",ret); + nufano,nnoe); + printf("MEDnoeudsEcr : %d\n",ret); /* ecriture des mailles MED_HEXA8 : - connectivite @@ -156,8 +157,8 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDelementsEcr(fid,maa,mdim,hexa8,MED_FULL_INTERLACE, nomhexa8,MED_FAUX,numhexa8,MED_VRAI,nufahexa8,nhexa8, - MED_MAILLE,MED_HEXA8,MED_NOD,MED_ECRI); - printf("%d \n",ret); + MED_MAILLE,MED_HEXA8,MED_NOD); + printf("MEDelementsEcr : %d \n",ret); /* ecriture des mailles MED_QUAD4 : - connectivite @@ -167,7 +168,7 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDelementsEcr(fid,maa,mdim,quad4,MED_FULL_INTERLACE, nomquad4,MED_FAUX,numquad4,MED_VRAI,nufaquad4,nquad4, - MED_MAILLE,MED_QUAD4,MED_NOD,MED_ECRI); + MED_MAILLE,MED_QUAD4,MED_NOD); printf("%d \n",ret); /***************************************************************************/ @@ -281,9 +282,9 @@ int main (int argc, char **argv) printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ1, (unsigned char *)fieldnodeint, - MED_FULL_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, MED_NOPDT," ", 0., MED_NONOR); + MED_FULL_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } @@ -291,18 +292,18 @@ int main (int argc, char **argv) if (ret == 0) { - ret = MEDchampCr(fid,champ2,MED_REEL64,champ2_comp,champ2_unit,1); + ret = MEDchampCr(fid,champ2,MED_FLOAT64,champ2_comp,champ2_unit,1); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble1, - MED_FULL_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, 1,"S ", 1.1 , MED_NONOR); + MED_FULL_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + 1,"S ", 1.1 , MED_NONOR); printf("MEDchampEcr1 : %d \n",ret); ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble2, - MED_FULL_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, 2,"S ", 1.2 , MED_NONOR); + MED_FULL_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + 2,"S ", 1.2 , MED_NONOR); printf("MEDchampEcr2 : %d \n",ret); } } @@ -311,21 +312,21 @@ int main (int argc, char **argv) if (ret == 0) { ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble1, - MED_FULL_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, MED_NOPDT," ", 0. , MED_NONOR); + MED_FULL_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + MED_NOPDT," ", 0. , MED_NONOR); printf("MEDchampEcr : %d \n",ret); } if (ret == 0) { - ret = MEDchampCr(fid,champ3,MED_REEL64,champ3_comp,champ3_unit,3); + ret = MEDchampCr(fid,champ3,MED_FLOAT64,champ3_comp,champ3_unit,3); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ3, (unsigned char *)fieldcelldouble, - MED_FULL_INTERLACE, nhexa8, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_MAILLE, - MED_HEXA8, MED_NOPDT," ", 0., MED_NONOR); + MED_FULL_INTERLACE, nhexa8, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, MED_HEXA8, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } } @@ -337,4 +338,3 @@ int main (int argc, char **argv) return 0; } - diff --git a/src/MEDMEM/create_mesh_c3h8q4_wrong.c b/src/MEDMEM/create_mesh_c3h8q4_wrong.c index a5f6caca0..1e4f2f812 100644 --- a/src/MEDMEM/create_mesh_c3h8q4_wrong.c +++ b/src/MEDMEM/create_mesh_c3h8q4_wrong.c @@ -14,6 +14,7 @@ int main (int argc, char **argv) med_err ret; med_idt fid; char maa[MED_TAILLE_NOM+1] = "CUBE_EN_HEXA8_QUAD4_WRONG"; + char maadesc[MED_TAILLE_DESC+1] = "Example de maillage non structure 3D"; med_int mdim = 3; med_int nnoe = 27; /* @@ -48,8 +49,8 @@ int main (int argc, char **argv) 0.5, 1.0, 1.0, 1.0, 1.0, 1.0 }; - char nomcoo[3*MED_TAILLE_PNOM+1] = "x y z "; - char unicoo[3*MED_TAILLE_PNOM+1] = "cm cm cm "; + char nomcoo[3*MED_TAILLE_PNOM+1] = "x y z "; + char unicoo[3*MED_TAILLE_PNOM+1] = "cm cm cm "; /* char nomnoe[19*MED_TAILLE_PNOM+1] = "nom1 nom2 nom3 nom4";*/ char *nomnoe ; med_int numnoe[27] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27}; @@ -68,7 +69,7 @@ int main (int argc, char **argv) 16, 25, 26, 17, 13, 22, 23, 14, 17, 26, 27, 18, 14, 23, 24, 15 }; - char nomhexa8[MED_TAILLE_PNOM*8+1] = "hexa1 hexa2 hexa3 hexa4 hexa5 hexa6 hexa7 hexa8 "; + char nomhexa8[MED_TAILLE_PNOM*8+1] = "hexa1 hexa2 hexa3 hexa4 hexa5 hexa6 hexa7 hexa8 "; med_int numhexa8[8] = {1,2,3,4,5,6,7,8}; med_int nufahexa8[8] = {-1,-1,-1,-1,-2,-2,-2,-2}; @@ -92,7 +93,7 @@ int main (int argc, char **argv) 7, 8, 5, 4 }; - char nomquad4[MED_TAILLE_PNOM*8+1] = "quad1 quad2 quad3 quad4 quad5 quad6 quad7 quad8 "; + char nomquad4[MED_TAILLE_PNOM*8+1] = "quad1 quad2 quad3 quad4 quad5 quad6 quad7 quad8 "; med_int numquad4[8] = {1,2,3,4,5,6,7,8}; med_int nufaquad4[8] = {-3,-3,-3,-3,-4, -4, -4 , -4}; @@ -114,43 +115,43 @@ int main (int argc, char **argv) */ char champ1[MED_TAILLE_NOM+1]="fieldnodeint" ; - char champ1_comp[MED_TAILLE_PNOM+1]="comp1 " ; - char champ1_unit[MED_TAILLE_PNOM+1]="M " ; + char champ1_comp[MED_TAILLE_PNOM+1]="comp1 " ; + char champ1_unit[MED_TAILLE_PNOM+1]="M " ; med_int fieldnodeint[27] = {1,1,3,2,2,3,4,4,5,1,1,3,2,2,3,4,4,5,1,1,3,2,2,3,4,4,5}; char champ2[MED_TAILLE_NOM+1]="fieldnodedouble" ; - char champ2_comp[MED_TAILLE_PNOM+1]="comp1 " ; - char champ2_unit[MED_TAILLE_PNOM+1]="J " ; + char champ2_comp[MED_TAILLE_PNOM+1]="comp1 " ; + char champ2_unit[MED_TAILLE_PNOM+1]="J " ; med_float fieldnodedouble1[27] = {1.,3.,4.,1.,3.,4.,3.,2.,5.,1.,3.,4.,1.,3.,4.,3.,2.,5.,1.,3.,4.,1.,3.,4.,3.,2.,5.}; med_float fieldnodedouble2[27] = {1.,2.,2.,3.,3.,3.,4.,4.,5.,1.,2.,2.,3.,3.,3.,4.,4.,5.,1.,2.,2.,3.,3.,3.,4.,4.,5.}; char champ3[MED_TAILLE_NOM+1]="fieldcelldouble" ; - char champ3_comp[MED_TAILLE_PNOM*3+1]="comp1 comp2 comp3 " ; - char champ3_unit[MED_TAILLE_PNOM*3+1]="M/S m/s m/s " ; + char champ3_comp[MED_TAILLE_PNOM*3+1]="comp1 comp2 comp3 " ; + char champ3_unit[MED_TAILLE_PNOM*3+1]="M/S m/s m/s " ; med_float fieldcelldouble[8*3] = {0.,1.,1.,1.,1.,2.,2.,3.,0.,1.,1.,1.,1.,2.,2.,3.,0.,1.,1.,1.,1.,2.,2.,3.}; /***************************************************************************/ - fid = MEDouvrir("cube_hexa8_quad4_wrong.med",MED_REMP); + fid = MEDouvrir("cube_hexa8_quad4_wrong.med",MED_LECTURE_ECRITURE); if (fid < 0) ret = -1; else ret = 0; - printf("%d\n",ret); + printf("MEDouvrir : %d\n",ret); /***************************************************************************/ if (ret == 0) - ret = MEDmaaCr(fid,maa,mdim); - printf("%d\n",ret); + ret = MEDmaaCr(fid,maa,mdim,MED_NON_STRUCTURE,maadesc); + printf("MEDmaaCr : %d\n",ret); if (ret == 0) ret = MEDunvCr(fid,maa); - printf("%d\n",ret); + printf("MEDunvCr : %d\n",ret); /***************************************************************************/ if (ret == 0) ret = MEDnoeudsEcr(fid,maa,mdim,coo,MED_FULL_INTERLACE,MED_CART, nomcoo,unicoo,nomnoe,MED_FAUX,numnoe,MED_VRAI, - nufano,nnoe,MED_ECRI); - printf("%d\n",ret); + nufano,nnoe); + printf("MEDnoeudsEcr : %d\n",ret); /* ecriture des mailles MED_HEXA8 : - connectivite @@ -160,8 +161,8 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDelementsEcr(fid,maa,mdim,hexa8,MED_FULL_INTERLACE, nomhexa8,MED_FAUX,numhexa8,MED_VRAI,nufahexa8,nhexa8, - MED_MAILLE,MED_HEXA8,MED_NOD,MED_ECRI); - printf("%d \n",ret); + MED_MAILLE,MED_HEXA8,MED_NOD); + printf("MEDelementsEcr : %d \n",ret); /* ecriture des mailles MED_QUAD4 : - connectivite @@ -171,8 +172,8 @@ int main (int argc, char **argv) if (ret == 0) ret = MEDelementsEcr(fid,maa,mdim,quad4,MED_FULL_INTERLACE, nomquad4,MED_FAUX,numquad4,MED_VRAI,nufaquad4,nquad4, - MED_FACE,MED_QUAD4,MED_NOD,MED_ECRI); - printf("%d \n",ret); + MED_FACE,MED_QUAD4,MED_NOD); + printf("MEDelementsEcr : %d \n",ret); /***************************************************************************/ /* ecriture des familles */ @@ -285,9 +286,9 @@ int main (int argc, char **argv) printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ1, (unsigned char *)fieldnodeint, - MED_FULL_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, MED_NOPDT," ", 0., MED_NONOR); + MED_FULL_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } @@ -295,18 +296,18 @@ int main (int argc, char **argv) if (ret == 0) { - ret = MEDchampCr(fid,champ2,MED_REEL64,champ2_comp,champ2_unit,1); + ret = MEDchampCr(fid,champ2,MED_FLOAT64,champ2_comp,champ2_unit,1); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble1, - MED_FULL_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, 1,"S ", 1.1 , MED_NONOR); + MED_FULL_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + 1,"S ", 1.1 , MED_NONOR); printf("MEDchampEcr1 : %d \n",ret); ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble2, - MED_FULL_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, 2,"S ", 1.2 , MED_NONOR); + MED_FULL_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + 2,"S ", 1.2 , MED_NONOR); printf("MEDchampEcr2 : %d \n",ret); } } @@ -315,21 +316,21 @@ int main (int argc, char **argv) if (ret == 0) { ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble1, - MED_FULL_INTERLACE, nnoe, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, - 0, MED_NOPDT," ", 0. , MED_NONOR); + MED_FULL_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + MED_NOPDT," ", 0. , MED_NONOR); printf("MEDchampEcr : %d \n",ret); } if (ret == 0) { - ret = MEDchampCr(fid,champ3,MED_REEL64,champ3_comp,champ3_unit,3); + ret = MEDchampCr(fid,champ3,MED_FLOAT64,champ3_comp,champ3_unit,3); printf("MEDchampCr : %d \n",ret); if (ret == 0) { ret = MEDchampEcr(fid, maa, champ3, (unsigned char *)fieldcelldouble, - MED_FULL_INTERLACE, nhexa8, - MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_MAILLE, - MED_HEXA8, MED_NOPDT," ", 0., MED_NONOR); + MED_FULL_INTERLACE, nhexa8, MED_NOGAUSS, MED_ALL, + MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, MED_HEXA8, + MED_NOPDT," ", 0., MED_NONOR); printf("MEDchampEcr : %d \n",ret); } } @@ -341,4 +342,3 @@ int main (int argc, char **argv) return 0; } - diff --git a/src/MEDMEM/duplicateMED.cxx b/src/MEDMEM/duplicateMED.cxx index 4bfe99192..f666f547d 100644 --- a/src/MEDMEM/duplicateMED.cxx +++ b/src/MEDMEM/duplicateMED.cxx @@ -1,9 +1,9 @@ -using namespace std; #include #include "MEDMEM_Exception.hxx" #include "MEDMEM_Med.hxx" +using namespace std; using namespace MEDMEM; void usage(char * name) { diff --git a/src/MEDMEM/duplicateMEDMESH.cxx b/src/MEDMEM/duplicateMEDMESH.cxx index 7e1cc480f..c3e389c72 100644 --- a/src/MEDMEM/duplicateMEDMESH.cxx +++ b/src/MEDMEM/duplicateMEDMESH.cxx @@ -1,4 +1,3 @@ -using namespace std; #include #include @@ -14,6 +13,7 @@ using namespace std; #include "MEDMEM_MedMedDriver.hxx" #include "MEDMEM_MedMeshDriver.hxx" +using namespace std; using namespace MEDMEM; int main (int argc, char ** argv) { diff --git a/src/MEDMEM/med2vtk.cxx b/src/MEDMEM/med2vtk.cxx index 1126b0aa2..7f9f53842 100644 --- a/src/MEDMEM/med2vtk.cxx +++ b/src/MEDMEM/med2vtk.cxx @@ -1,4 +1,3 @@ -using namespace std; #include #include @@ -12,6 +11,7 @@ using namespace std; #include "MEDMEM_Field.hxx" #include "MEDMEM_VtkMedDriver.hxx" +using namespace std; using namespace MEDMEM; void usage(char * name) { diff --git a/src/MEDMEM/med_test.cxx b/src/MEDMEM/med_test.cxx index bfb8d3f2a..73696db52 100644 --- a/src/MEDMEM/med_test.cxx +++ b/src/MEDMEM/med_test.cxx @@ -1,4 +1,3 @@ -using namespace std; #include #include @@ -15,7 +14,9 @@ using namespace std; #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" +using namespace std; using namespace MEDMEM; +using namespace MED_EN; double dmax(double x, double y) { return (x>y)?x:y;} diff --git a/src/MEDMEM/test_MEDMEM_Array.cxx b/src/MEDMEM/test_MEDMEM_Array.cxx index e030a8623..6b03fa969 100644 --- a/src/MEDMEM/test_MEDMEM_Array.cxx +++ b/src/MEDMEM/test_MEDMEM_Array.cxx @@ -1,13 +1,13 @@ -using namespace std; #include "utilities.h" #include "MEDMEM_Array.hxx" +using namespace std; using namespace MEDMEM; int main (int argc, char ** argv) { int SpaceDimension = 3 ; int NumberOfNodes = 4 ; - MEDARRAY * myArray = new MEDARRAY(SpaceDimension,NumberOfNodes,MED_FULL_INTERLACE) ; + MEDARRAY * myArray = new MEDARRAY(SpaceDimension,NumberOfNodes,MED_EN::MED_FULL_INTERLACE) ; //const int * value = myArray->get(MED_FULL_INTERLACE) ; for (int i=1; i<=NumberOfNodes; i++) @@ -47,7 +47,7 @@ int main (int argc, char ** argv) { MESSAGE("Show all 0 :"); numberof = myArray->getLeadingValue() ; int length = myArray->getLengthValue() ; - const int * NoInterlaceArray = myArray->get(MED_NO_INTERLACE) ; + const int * NoInterlaceArray = myArray->get(MED_EN::MED_NO_INTERLACE) ; for (int i=0; i geomList = MED_FR::meshEntities[MED_FR::MED_MAILLE] ; - list::iterator itGeomList ; + list geomList = meshEntities[MED_CELL] ; + list::iterator itGeomList ; for(itGeomList=geomList.begin();itGeomList!=geomList.end();itGeomList++) { CELLMODEL myCellModel((MED_EN::medGeometryElement)(*itGeomList)) ; diff --git a/src/MEDMEM/test_MEDMEM_Meshing.cxx b/src/MEDMEM/test_MEDMEM_Meshing.cxx index df7346404..5326e8723 100644 --- a/src/MEDMEM/test_MEDMEM_Meshing.cxx +++ b/src/MEDMEM/test_MEDMEM_Meshing.cxx @@ -4,6 +4,7 @@ using namespace std; using namespace MEDMEM; +using namespace MED_EN; int main (int argc, char ** argv) { diff --git a/src/MEDMEM/test_MEDMEM_ModulusArray.cxx b/src/MEDMEM/test_MEDMEM_ModulusArray.cxx index d7103e87c..c35aaf1b0 100644 --- a/src/MEDMEM/test_MEDMEM_ModulusArray.cxx +++ b/src/MEDMEM/test_MEDMEM_ModulusArray.cxx @@ -1,7 +1,8 @@ -using namespace std; #include "utilities.h" #include "MEDMEM_ModulusArray.hxx" + +using namespace std; using namespace MEDMEM; int main (int argc, char ** argv) { diff --git a/src/MEDMEM/test_MEDMEM_SkyLineArray.cxx b/src/MEDMEM/test_MEDMEM_SkyLineArray.cxx index a03100fd1..1157fb020 100644 --- a/src/MEDMEM/test_MEDMEM_SkyLineArray.cxx +++ b/src/MEDMEM/test_MEDMEM_SkyLineArray.cxx @@ -1,6 +1,7 @@ -using namespace std; #include "utilities.h" #include "MEDMEM_SkyLineArray.hxx" + +using namespace std; using namespace MEDMEM; int main (int argc, char ** argv) { diff --git a/src/MEDMEM/test_affect_medarray.cxx b/src/MEDMEM/test_affect_medarray.cxx index 055fff524..4bd9744eb 100644 --- a/src/MEDMEM/test_affect_medarray.cxx +++ b/src/MEDMEM/test_affect_medarray.cxx @@ -1,4 +1,3 @@ -using namespace std; /* Programme de test du constructeur de copies de la classe MEDARRAY de MEDMEM jroy - 16/12/2002 */ @@ -17,8 +16,10 @@ using namespace std; #include "MEDMEM_Support.hxx" #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" -using namespace MEDMEM; +using namespace std; +using namespace MEDMEM; +using namespace MED_EN; void affiche_medarray(MEDARRAY & myMedArray) { diff --git a/src/MEDMEM/test_copie_connectivity.cxx b/src/MEDMEM/test_copie_connectivity.cxx index e27c3e2a3..0b1d70182 100644 --- a/src/MEDMEM/test_copie_connectivity.cxx +++ b/src/MEDMEM/test_copie_connectivity.cxx @@ -1,4 +1,3 @@ -using namespace std; /* Programme de test du constructeur de copies de la classe CONNECTIVITY de MEDMEM jroy - 19/12/2002 */ @@ -17,7 +16,10 @@ using namespace std; #include "MEDMEM_Support.hxx" #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; void affiche_connectivity(const CONNECTIVITY * myConnectivity, MESH * myMesh) { diff --git a/src/MEDMEM/test_copie_coordinate.cxx b/src/MEDMEM/test_copie_coordinate.cxx index 612b023bd..f62542093 100644 --- a/src/MEDMEM/test_copie_coordinate.cxx +++ b/src/MEDMEM/test_copie_coordinate.cxx @@ -1,4 +1,3 @@ -using namespace std; /* Programme de test du constructeur de copies de la classe COORDINATE de MEDMEM jroy - 17/12/2002 */ @@ -17,8 +16,10 @@ using namespace std; #include "MEDMEM_Support.hxx" #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" -using namespace MEDMEM; +using namespace std; +using namespace MEDMEM; +using namespace MED_EN; void affiche_tableau(const double * myArray, int nb_lignes, int nb_colonnes) { diff --git a/src/MEDMEM/test_copie_family.cxx b/src/MEDMEM/test_copie_family.cxx index 4c825af0e..b5549f828 100644 --- a/src/MEDMEM/test_copie_family.cxx +++ b/src/MEDMEM/test_copie_family.cxx @@ -1,4 +1,3 @@ -using namespace std; #include #include @@ -15,7 +14,9 @@ using namespace std; #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" +using namespace std; using namespace MEDMEM; +using namespace MED_EN; void affiche_support(const SUPPORT * mySupport) { diff --git a/src/MEDMEM/test_copie_fieldT.cxx b/src/MEDMEM/test_copie_fieldT.cxx index 21faeeede..4418147d7 100644 --- a/src/MEDMEM/test_copie_fieldT.cxx +++ b/src/MEDMEM/test_copie_fieldT.cxx @@ -1,4 +1,3 @@ -using namespace std; /* Programme de test du constructeur de copies de la classe FIELD_ de MEDMEM jroy - 12/12/2002 */ @@ -17,7 +16,10 @@ using namespace std; #include "MEDMEM_Support.hxx" #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; void affiche_field_(FIELD_ * myField, const SUPPORT * mySupport) diff --git a/src/MEDMEM/test_copie_field_.cxx b/src/MEDMEM/test_copie_field_.cxx index 13f3054f9..8452e743f 100644 --- a/src/MEDMEM/test_copie_field_.cxx +++ b/src/MEDMEM/test_copie_field_.cxx @@ -17,6 +17,7 @@ #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" using namespace MEDMEM; +using namespace MED_EN; void affiche_field(FIELD_ * myField, const SUPPORT * mySupport) @@ -90,9 +91,9 @@ int main (int argc, char ** argv) { // SUPPORT * mySupport = new SUPPORT(myMesh,"On_all_node",MED_NODE); - SUPPORT * mySupport = new SUPPORT(myMesh,"On_all_cell",MED_CELL); + SUPPORT * mySupport = new SUPPORT(myMesh,"On_all_cell",MED_EN::MED_CELL); FIELD * myField = new FIELD() ; - myField->setValueType(MED_REEL64); + myField->setValueType(MED_EN::MED_REEL64); myField->setName(fieldname); myField->setSupport(mySupport); @@ -104,7 +105,7 @@ int main (int argc, char ** argv) { myFieldDriver.read() ; } catch (...) { delete mySupport ; - mySupport = new SUPPORT(myMesh,"On_all_node",MED_NODE); + mySupport = new SUPPORT(myMesh,"On_all_node",MED_EN::MED_NODE); myField->setSupport(mySupport); try { myFieldDriver.read() ; diff --git a/src/MEDMEM/test_copie_group.cxx b/src/MEDMEM/test_copie_group.cxx index d45c9c2ca..96103825d 100644 --- a/src/MEDMEM/test_copie_group.cxx +++ b/src/MEDMEM/test_copie_group.cxx @@ -1,4 +1,3 @@ -using namespace std; #include #include @@ -15,7 +14,9 @@ using namespace std; #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" +using namespace std; using namespace MEDMEM; +using namespace MED_EN; void affiche_support(const SUPPORT * mySupport) { diff --git a/src/MEDMEM/test_copie_medarray.cxx b/src/MEDMEM/test_copie_medarray.cxx index bbb6561e6..c3ec5109b 100644 --- a/src/MEDMEM/test_copie_medarray.cxx +++ b/src/MEDMEM/test_copie_medarray.cxx @@ -1,4 +1,3 @@ -using namespace std; /* Programme de test du constructeur de copies de la classe MEDARRAY de MEDMEM jroy - 16/12/2002 */ @@ -18,7 +17,9 @@ using namespace std; #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" +using namespace std; using namespace MEDMEM; +using namespace MED_EN; void affiche_medarray(MEDARRAY & myMedArray) { diff --git a/src/MEDMEM/test_copie_mesh.cxx b/src/MEDMEM/test_copie_mesh.cxx index 4fd1ebdad..655d37220 100644 --- a/src/MEDMEM/test_copie_mesh.cxx +++ b/src/MEDMEM/test_copie_mesh.cxx @@ -1,4 +1,3 @@ -using namespace std; #include #include @@ -14,6 +13,8 @@ using namespace std; #include "MEDMEM_Support.hxx" #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" + +using namespace std; using namespace MEDMEM; diff --git a/src/MEDMEM/test_copie_support.cxx b/src/MEDMEM/test_copie_support.cxx index 6a7367ddb..21cefbdf4 100644 --- a/src/MEDMEM/test_copie_support.cxx +++ b/src/MEDMEM/test_copie_support.cxx @@ -1,4 +1,3 @@ -using namespace std; #include #include @@ -14,8 +13,10 @@ using namespace std; #include "MEDMEM_Support.hxx" #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" -using namespace MEDMEM; +using namespace std; +using namespace MEDMEM; +using namespace MED_EN; void affiche_support(const SUPPORT * mySupport) { diff --git a/src/MEDMEM/test_gibi_driver.cxx b/src/MEDMEM/test_gibi_driver.cxx index ea7dd2ab1..ad7b3f4ea 100644 --- a/src/MEDMEM/test_gibi_driver.cxx +++ b/src/MEDMEM/test_gibi_driver.cxx @@ -1,7 +1,7 @@ -using namespace std; - #include "MEDMEM_GibiMeshDriver.hxx" #include "MEDMEM_Mesh.hxx" + +using namespace std; using namespace MEDMEM; int main (int argc, char ** argv) { diff --git a/src/MEDMEM/test_grid.cxx b/src/MEDMEM/test_grid.cxx new file mode 100644 index 000000000..4825b9acb --- /dev/null +++ b/src/MEDMEM/test_grid.cxx @@ -0,0 +1,49 @@ +#include "MEDMEM_Grid.hxx" + +using namespace MEDMEM; +using namespace MED_EN; + +static void usage(const char * test) +{ + cerr << "Usage : " << test + << " SpaceDimension nbMaille" << endl << endl + << "-> Crée une grille cartesienne en dimension SpaceDimension avec nbMaille suivant chaque direction" << endl; + exit(-1); +} + +int main (int argc, char ** argv) { + + /* process the arguments */ + if (argc != 3) + usage(argv[0]); + + const int SpaceDimension=atoi(argv[1]); + const int nbMaille=atoi(argv[2]); + if(SpaceDimension>3 || SpaceDimension<1 || nbMaille<1) + usage(argv[0]); + + // Creation des tableaux necessaires à la construction de GRID + std::vector nMaille(SpaceDimension,nbMaille); + std::vector Origine(SpaceDimension,0.0); + std::vector pas(SpaceDimension,10.0); + std::vector > XYZ_Array(SpaceDimension); + for(int i=0;i!=SpaceDimension;++i) + { + XYZ_Array[i].resize(nMaille[i]+1); // nbre de noeuds = nbre de mailles +1 + XYZ_Array[i][0]=Origine[i]; + for(int j=1;j!=XYZ_Array[i].size();++j) + XYZ_Array[i][j]=XYZ_Array[i][j-1] + pas[j-1]; + } + + std::vector coord_name(SpaceDimension,"X"); + if(SpaceDimension>=2) + coord_name[1]="Y"; + if(SpaceDimension>=3) + coord_name[2]="Z"; + std::vector coord_unit(SpaceDimension,"cm"); + + // creation du pointeur MESH à partir d'un GRID, test affichage + std::auto_ptr Mesh (new MEDMEM::GRID( XYZ_Array, coord_name, coord_unit, MED_CARTESIAN) ); + const MEDMEM::CONNECTIVITY* conn = Mesh->getConnectivityptr(); + std::cout << "Affichage du maillage : " << endl << *Mesh << endl; +} diff --git a/src/MEDMEM/test_operation_fielddouble.cxx b/src/MEDMEM/test_operation_fielddouble.cxx index 5dfa91737..4d0711166 100644 --- a/src/MEDMEM/test_operation_fielddouble.cxx +++ b/src/MEDMEM/test_operation_fielddouble.cxx @@ -24,6 +24,8 @@ double myfunction1(double x) using namespace std; using namespace MEDMEM; +using namespace MED_EN; + void affiche_field_(FIELD_ * myField, const SUPPORT * mySupport) { cout << "Field "<< myField->getName() << " : " <getDescription() << endl ; diff --git a/src/MEDMEM/test_operation_fieldint.cxx b/src/MEDMEM/test_operation_fieldint.cxx index e0389cfbd..d9098fcce 100644 --- a/src/MEDMEM/test_operation_fieldint.cxx +++ b/src/MEDMEM/test_operation_fieldint.cxx @@ -17,6 +17,8 @@ #include "MEDMEM_define.hxx" using namespace MEDMEM; +using namespace MED_EN; + int myfunction1(int x) { return 2*x; diff --git a/src/MEDMEM/test_porflow_driver.cxx b/src/MEDMEM/test_porflow_driver.cxx index 4df48527d..2edf13edf 100644 --- a/src/MEDMEM/test_porflow_driver.cxx +++ b/src/MEDMEM/test_porflow_driver.cxx @@ -1,8 +1,10 @@ -using namespace std; - #include "MEDMEM_PorflowMeshDriver.hxx" #include "MEDMEM_Mesh.hxx" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; + int main (int argc, char ** argv) { /* process the arguments */ diff --git a/src/MEDMEM/tests/readCoordinate.cxx b/src/MEDMEM/tests/readCoordinate.cxx index f0680544d..f861e3683 100755 --- a/src/MEDMEM/tests/readCoordinate.cxx +++ b/src/MEDMEM/tests/readCoordinate.cxx @@ -22,12 +22,13 @@ // File : readCoordinate.cxx // Module : MED -using namespace std; #include #include "MEDMEM_Exception.hxx" #include "MEDMEM_define.hxx" #include "MEDMEM_Mesh.hxx" #include "MEDMEM_MedMeshDriver.hxx" + +using namespace std; using namespace MEDMEM; void usage(char * name) @@ -49,11 +50,11 @@ int main (int argc, char ** argv) { string fileName = argv[1]; string meshName = argv[2]; - medModeSwitch Mode = MED_FULL_INTERLACE; + MED_EN::medModeSwitch Mode = MED_EN::MED_FULL_INTERLACE; if (argc==4) { string comp=argv[3]; - if ( comp == "MED_NO_INTERLACE" ) Mode = MED_NO_INTERLACE; + if ( comp == "MED_NO_INTERLACE" ) Mode = MED_EN::MED_NO_INTERLACE; else if ( comp != "MED_FULL_INTERLACE") usage(argv[0]); } diff --git a/src/MEDMEM/tests/readEntete.cxx b/src/MEDMEM/tests/readEntete.cxx index 5d21b118e..6b5d7d133 100755 --- a/src/MEDMEM/tests/readEntete.cxx +++ b/src/MEDMEM/tests/readEntete.cxx @@ -22,14 +22,16 @@ // File : readEntete.cxx // Module : MED -using namespace std; #include #include "MEDMEM_Exception.hxx" #include "MEDMEM_define.hxx" #include "MEDMEM_Mesh.hxx" #include "MEDMEM_MedMeshDriver.hxx" #include "MEDMEM_DriversDef.hxx" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; void usage(char * name) { @@ -101,74 +103,83 @@ int main (int argc, char ** argv) { cout << "- Nombre de noeuds : " << NumberOfNodes << " " << endl; int NumberOfTypes = myMesh->getNumberOfTypes(MED_CELL); - const medGeometryElement * Types = myMesh->getTypes(MED_CELL); - + const medGeometryElement * Types; + cout << "- Nombre de Type de mailles : " << NumberOfTypes << endl; if (NumberOfTypes > 0) { + Types = myMesh->getTypes(MED_CELL); + cout << " Types : "; for (int itype=0; itype currentEntity = MED_FR::meshEntities[(MED_FR::med_entite_maillage)MED_CELL]; - list::const_iterator currentGeometry; - for (currentGeometry = currentEntity.begin(); - currentGeometry != currentEntity.end(); - currentGeometry++) - { - cout << "- Nombre de mailles de type "; - cout << MED_FR::geoNames[(MED_FR::med_geometrie_element)(*currentGeometry)] << " : "; - cout << myMesh->getNumberOfElements(MED_CELL,(MED_EN::medGeometryElement)(*currentGeometry)); - cout << " " << endl; - } + const list currentEntity = meshEntities[MED_CELL]; + list::const_iterator currentGeometry; + + for (currentGeometry = currentEntity.begin(); + currentGeometry != currentEntity.end(); + currentGeometry++) + { + cout << "- Nombre de mailles de type "; + cout << geoNames[(*currentGeometry)] << " : "; + cout << myMesh->getNumberOfElements(MED_CELL,(MED_EN::medGeometryElement)(*currentGeometry)); + cout << " " << endl; + } + } NumberOfTypes = myMesh->getNumberOfTypes(MED_FACE); - Types = myMesh->getTypes(MED_FACE); cout << "- Nombre de Type de faces : " << NumberOfTypes << endl; if (NumberOfTypes > 0) { + Types = myMesh->getTypes(MED_FACE); + cout << " Types : "; for (int itype=0; itype currentEntity2 = MED_FR::meshEntities[(MED_FR::med_entite_maillage)MED_FACE]; - for (currentGeometry = currentEntity2.begin(); - currentGeometry != currentEntity2.end(); - currentGeometry++) - { - cout << "- Nombre de faces de type "; - cout << MED_FR::geoNames[(MED_FR::med_geometrie_element)(*currentGeometry)] << " : "; - cout << myMesh->getNumberOfElements(MED_FACE,(MED_EN::medGeometryElement)(*currentGeometry)); - cout << " " << endl; - } + const list currentEntity2 = meshEntities[MED_FACE]; + list::const_iterator currentGeometry; + + for (currentGeometry = currentEntity2.begin(); + currentGeometry != currentEntity2.end(); + currentGeometry++) + { + cout << "- Nombre de faces de type "; + cout << geoNames[(*currentGeometry)] << " : "; + cout << myMesh->getNumberOfElements(MED_FACE,(*currentGeometry)); + cout << " " << endl; + } + } NumberOfTypes = myMesh->getNumberOfTypes(MED_EDGE); - Types = myMesh->getTypes(MED_EDGE); cout << "- Nombre de Type de aretes : " << NumberOfTypes << endl; if (NumberOfTypes > 0) { + Types = myMesh->getTypes(MED_EDGE); + cout << " Types : "; for (int itype=0; itype currentEntity3 = MED_FR::meshEntities[(MED_FR::med_entite_maillage)MED_EDGE]; - for (currentGeometry = currentEntity3.begin(); - currentGeometry != currentEntity3.end(); - currentGeometry++) - { - cout << "- Nombre d'aretes de type "; - cout << MED_FR::geoNames[(MED_FR::med_geometrie_element)(*currentGeometry)] << " : "; - cout << myMesh->getNumberOfElements(MED_EDGE,(MED_EN::medGeometryElement)(*currentGeometry)); - cout << " " << endl; - } + const list currentEntity3 = meshEntities[MED_EDGE]; + list::const_iterator currentGeometry; + + for (currentGeometry = currentEntity3.begin(); + currentGeometry != currentEntity3.end(); + currentGeometry++) + { + cout << "- Nombre d'aretes de type "; + cout << geoNames[(*currentGeometry)] << " : "; + cout << myMesh->getNumberOfElements(MED_EDGE,(*currentGeometry)); + cout << " " << endl; + } + } delete myMesh; } diff --git a/src/MEDMEM/tests/testUArray.cxx b/src/MEDMEM/tests/testUArray.cxx index 405de1350..8ab70831c 100755 --- a/src/MEDMEM/tests/testUArray.cxx +++ b/src/MEDMEM/tests/testUArray.cxx @@ -22,10 +22,11 @@ // File : testUArray.cxx // Module : MED -using namespace std; #include // pour l'acces à EXIT_SUCCESS et EXIT_FAILURE #include "utilities.h" #include "MEDMEM_Array.hxx" + +using namespace std; using namespace MEDMEM; void imprime(string titre,const int * myValues,const int * myOthers, int lignes, int colonnes) @@ -88,10 +89,10 @@ int main (int argc, char ** argv) - MEDARRAY * myArrayfull= new MEDARRAY(SpaceDimension,NumberOfNodes,MED_FULL_INTERLACE); + MEDARRAY * myArrayfull= new MEDARRAY(SpaceDimension,NumberOfNodes,MED_EN::MED_FULL_INTERLACE); ASSERT(myArrayfull != NULL); - const int * myValues = myArrayfull->get(MED_FULL_INTERLACE); + const int * myValues = myArrayfull->get(MED_EN::MED_FULL_INTERLACE); ASSERT(myValues!= NULL); for (int i=0; iget(MED_NO_INTERLACE) ; + const int * myOthers = myArrayfull->get(MED_EN::MED_NO_INTERLACE) ; ASSERT(myOthers != NULL); imprime("Initialisation full interlace (xi=yi=zi=i+1)",myValues,myOthers,NumberOfNodes,SpaceDimension); - MEDARRAY * myArrayno= new MEDARRAY(SpaceDimension,NumberOfNodes,MED_NO_INTERLACE); + MEDARRAY * myArrayno= new MEDARRAY(SpaceDimension,NumberOfNodes,MED_EN::MED_NO_INTERLACE); ASSERT(myArrayno != NULL); - const int * myValuesno = myArrayno->get(MED_NO_INTERLACE); + const int * myValuesno = myArrayno->get(MED_EN::MED_NO_INTERLACE); ASSERT(myValuesno!= NULL); for (int k=0; kget(MED_FULL_INTERLACE) ; + const int * myOthersno = myArrayno->get(MED_EN::MED_FULL_INTERLACE) ; ASSERT(myOthersno != NULL); imprime("Initialisation no interlace (xi=yi=zi=i+1)",myOthersno,myValuesno,NumberOfNodes,SpaceDimension); @@ -239,9 +240,9 @@ int main (int argc, char ** argv) } try { - myArrayfull->set(MED_FULL_INTERLACE,mynewvalues); - myValues = myArrayfull->get(MED_FULL_INTERLACE); - myOthers = myArrayfull->get(MED_NO_INTERLACE); + myArrayfull->set(MED_EN::MED_FULL_INTERLACE,mynewvalues); + myValues = myArrayfull->get(MED_EN::MED_FULL_INTERLACE); + myOthers = myArrayfull->get(MED_EN::MED_NO_INTERLACE); } catch ( const std::exception &e ) { @@ -261,8 +262,8 @@ int main (int argc, char ** argv) try { - myArrayno->set(MED_FULL_INTERLACE,mynewvalues); - myValuesno = myArrayfull->get(MED_FULL_INTERLACE); + myArrayno->set(MED_EN::MED_FULL_INTERLACE,mynewvalues); + myValuesno = myArrayfull->get(MED_EN::MED_FULL_INTERLACE); myOthersno = NULL; } catch ( const std::exception &e ) @@ -290,8 +291,8 @@ int main (int argc, char ** argv) /* ---------------------------------------------------------- */ MEDARRAY * myArrayShare = new MEDARRAY( *myArrayfull); - const int * sharevalues = myArrayShare->get(MED_FULL_INTERLACE); - const int * shareno = myArrayShare->get(MED_NO_INTERLACE); + const int * sharevalues = myArrayShare->get(MED_EN::MED_FULL_INTERLACE ); + const int * shareno = myArrayShare->get(MED_EN::MED_NO_INTERLACE); imprime("test contructeur par recopie non profonde",sharevalues,shareno,NumberOfNodes,SpaceDimension); myArrayfull->setIJ(1,2,1992); @@ -306,8 +307,8 @@ int main (int argc, char ** argv) imprime("tableau cible apres destruction tableau source",myValues,myOthers,NumberOfNodes,SpaceDimension); MEDARRAY * myArrayShare2 = new MEDARRAY( *myArrayfull,true); - sharevalues = myArrayShare2->get(MED_FULL_INTERLACE); - shareno = myArrayShare2->get(MED_NO_INTERLACE); + sharevalues = myArrayShare2->get(MED_EN::MED_FULL_INTERLACE ); + shareno = myArrayShare2->get(MED_EN::MED_NO_INTERLACE ); imprime("test contructeur par recopie profonde",sharevalues,shareno,NumberOfNodes,SpaceDimension); myArrayfull->setIJ(1,2,18); @@ -316,15 +317,15 @@ int main (int argc, char ** argv) myArrayShare2->setIJ(1,2,19); imprime("change valeur tableau cible, impression tableau source",myValues,myOthers,NumberOfNodes,SpaceDimension); - myArrayno->set(MED_NO_INTERLACE,mynewvalues); + myArrayno->set(MED_EN::MED_NO_INTERLACE,mynewvalues); myArrayno->setIJ(2,1,1); - myValuesno = myArrayno->get(MED_NO_INTERLACE); - myOthersno = myArrayno->get(MED_FULL_INTERLACE); + myValuesno = myArrayno->get(MED_EN::MED_NO_INTERLACE); + myOthersno = myArrayno->get(MED_EN::MED_FULL_INTERLACE); imprime("Initialisation no interlace (0...11)",myOthersno,myValuesno,NumberOfNodes,SpaceDimension); MEDARRAY * myArrayShare3 = new MEDARRAY( *myArrayno); - sharevalues = myArrayShare3->get(MED_FULL_INTERLACE); - shareno = myArrayShare3->get(MED_NO_INTERLACE); + sharevalues = myArrayShare3->get(MED_EN::MED_FULL_INTERLACE); + shareno = myArrayShare3->get(MED_EN::MED_NO_INTERLACE); imprime("test contructeur par recopie non profonde",sharevalues,shareno,NumberOfNodes,SpaceDimension); myArrayno->setIJ(1,2,1992); diff --git a/src/MEDMEM/tests/testUCellModel.cxx b/src/MEDMEM/tests/testUCellModel.cxx index 96f6e3d01..8b3e3a9a6 100755 --- a/src/MEDMEM/tests/testUCellModel.cxx +++ b/src/MEDMEM/tests/testUCellModel.cxx @@ -22,7 +22,6 @@ // File : testUCellModel.cxx // Module : MED -using namespace std; #include #include #include "utilities.h" @@ -30,7 +29,10 @@ using namespace std; #include "MEDMEM_CellModel.hxx" #include "MEDMEM_define.hxx" #include "MEDMEM_DriversDef.hxx" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; void usage(char * name) { @@ -71,7 +73,7 @@ int main (int argc, char ** argv) for (int i=0; i::iterator iter_s; for (iter_s=setGeomElt.begin() ;iter_s!=setGeomElt.end();iter_s++) { - cout << MED_FR::geoNames[(MED_FR::med_geometrie_element)(*iter_s)] << endl; + cout << geoNames[(*iter_s)] << endl; } cout << "Impression des coordonnées du 1er Element de ce type" << endl; @@ -334,7 +336,7 @@ int main (int argc, char ** argv) for (iter_s=tous[i].getAllConstituentsType().begin() ; iter_s!=tous[i].getAllConstituentsType().end();iter_s++) { - cout << MED_FR::geoNames[(MED_FR::med_geometrie_element)(*iter_s)] << endl; + cout << geoNames[*iter_s] << endl; } } catch ( const std::exception &e ) diff --git a/src/MEDMEM/tests/testUCoordinate.cxx b/src/MEDMEM/tests/testUCoordinate.cxx index 53841bdbc..29ac9b998 100755 --- a/src/MEDMEM/tests/testUCoordinate.cxx +++ b/src/MEDMEM/tests/testUCoordinate.cxx @@ -22,7 +22,6 @@ // File : testUCoordinate.cxx // Module : MED -using namespace std; #include #include #include "utilities.h" @@ -31,6 +30,8 @@ using namespace std; #include "MEDMEM_Array.hxx" #include "MEDMEM_Coordinate.hxx" #include + +using namespace std; using namespace MEDMEM; void usage(char * name) diff --git a/src/MEDMEM/tests/testUGeoNameMeshEntities.cxx b/src/MEDMEM/tests/testUGeoNameMeshEntities.cxx index 5fe253ffb..4f4ba4a27 100755 --- a/src/MEDMEM/tests/testUGeoNameMeshEntities.cxx +++ b/src/MEDMEM/tests/testUGeoNameMeshEntities.cxx @@ -22,9 +22,9 @@ // File : testUGeoNameMeshEntities.cxx // Module : MED -using namespace std; #include "MEDMEM_DriversDef.hxx" +using namespace std; void usage(char * name) { cout << " " << name << endl; @@ -43,30 +43,30 @@ int main (int argc, char ** argv) cout << "GEO_NAME Test" << endl ; cout << "-------------" << endl << endl; - MED_FR::GEO_NAME::const_iterator currentGeom; - for (currentGeom = MED_FR::geoNames.begin(); - currentGeom != MED_FR::geoNames.end(); + MED_EN::GEO_NAME::const_iterator currentGeom; + for (currentGeom = MED_EN::geoNames.begin(); + currentGeom != MED_EN::geoNames.end(); currentGeom++) { cout << (*currentGeom).second << endl; }; - MED_FR::MESH_ENTITIES::const_iterator currentEntity; - list::const_iterator currentGeometry; + MED_EN::MESH_ENTITIES::const_iterator currentEntity; + list::const_iterator currentGeometry; cout << endl; cout << "MESH_ENTITIES Test" << endl ; cout << "------------------" << endl << endl; - for (currentEntity = MED_FR::meshEntities.begin(); - currentEntity != MED_FR::meshEntities.end(); + for (currentEntity = MED_EN::meshEntities.begin(); + currentEntity != MED_EN::meshEntities.end(); currentEntity++) { - cout << (*((MED_FR::entNames).find((*currentEntity).first))).second < #include "MEDMEM_STRING.hxx" #include "MEDMEM_Exception.hxx" + +using namespace std; using namespace MEDMEM; int main (int argc, char ** argv) diff --git a/src/MEDMEM/tests/testUModulusArray.cxx b/src/MEDMEM/tests/testUModulusArray.cxx index 663197935..53c1a73a8 100644 --- a/src/MEDMEM/tests/testUModulusArray.cxx +++ b/src/MEDMEM/tests/testUModulusArray.cxx @@ -22,11 +22,11 @@ // File : testUModulusArray.cxx // Module : MED -using namespace std; #include #include #include "utilities.h" #include "MEDMEM_ModulusArray.hxx" +using namespace std; using namespace MEDMEM; int main (int argc, char ** argv) diff --git a/src/MEDMEM/tests/testUPointerOf.cxx b/src/MEDMEM/tests/testUPointerOf.cxx index ce6c48d5d..3a8be44c4 100644 --- a/src/MEDMEM/tests/testUPointerOf.cxx +++ b/src/MEDMEM/tests/testUPointerOf.cxx @@ -5,10 +5,11 @@ // File : testUPointerOf.cxx // Module : MED -using namespace std; #include "utilities.h" #include "MEDMEM_PointerOf.hxx" #include "MEDMEM_Exception.hxx" + +using namespace std; using namespace MEDMEM; diff --git a/src/MEDMEM/tests/testUSkyLineArray.cxx b/src/MEDMEM/tests/testUSkyLineArray.cxx index b3d6f3dcb..da382f52c 100644 --- a/src/MEDMEM/tests/testUSkyLineArray.cxx +++ b/src/MEDMEM/tests/testUSkyLineArray.cxx @@ -22,10 +22,11 @@ // File : testUSkyLineArray.cxx // Module : MED -using namespace std; #include #include "utilities.h" #include "MEDMEM_SkyLineArray.hxx" + +using namespace std; using namespace MEDMEM; int main (int argc, char ** argv) diff --git a/src/MEDMEM/tests/testUUnit.cxx b/src/MEDMEM/tests/testUUnit.cxx index a4fbe348c..058032ea1 100755 --- a/src/MEDMEM/tests/testUUnit.cxx +++ b/src/MEDMEM/tests/testUUnit.cxx @@ -22,11 +22,11 @@ // File : testUUnit.cxx // Module : MED -using namespace std; #include #include #include "MEDMEM_Unit.hxx" +using namespace std; using namespace MEDMEM; int main (int argc, char ** argv) diff --git a/src/MEDMEM_I/MEDMEM_FieldDouble_i.hxx b/src/MEDMEM_I/MEDMEM_FieldDouble_i.hxx index 746e5f950..2f11c39cb 100644 --- a/src/MEDMEM_I/MEDMEM_FieldDouble_i.hxx +++ b/src/MEDMEM_I/MEDMEM_FieldDouble_i.hxx @@ -27,7 +27,7 @@ private: public: FIELDDOUBLE_i(); ~FIELDDOUBLE_i(); - FIELDDOUBLE_i(::FIELD * const f, bool ownCppPtr=false); + FIELDDOUBLE_i(MEDMEM::FIELD * const f, bool ownCppPtr=false); FIELDDOUBLE_i(FIELDDOUBLE_i & f); SALOME_MED::double_array * getValue (SALOME_MED::medModeSwitch mode ) diff --git a/src/MEDMEM_I/MEDMEM_FieldInt_i.hxx b/src/MEDMEM_I/MEDMEM_FieldInt_i.hxx index c831d26c7..cb428c3c3 100644 --- a/src/MEDMEM_I/MEDMEM_FieldInt_i.hxx +++ b/src/MEDMEM_I/MEDMEM_FieldInt_i.hxx @@ -27,7 +27,7 @@ private: public: ~FIELDINT_i(); - FIELDINT_i(::FIELD * const f, bool ownCppPtr=false); + FIELDINT_i(MEDMEM::FIELD * const f, bool ownCppPtr=false); FIELDINT_i(FIELDINT_i & f); SALOME_MED::long_array * getValue (SALOME_MED::medModeSwitch mode ) throw (SALOME::SALOME_Exception); diff --git a/src/MEDMEM_I/MEDMEM_Field_i.cxx b/src/MEDMEM_I/MEDMEM_Field_i.cxx index ff7a44c42..3014d67f8 100644 --- a/src/MEDMEM_I/MEDMEM_Field_i.cxx +++ b/src/MEDMEM_I/MEDMEM_Field_i.cxx @@ -8,6 +8,9 @@ //============================================================================= #include "MEDMEM_Field_i.hxx" +using namespace MEDMEM; +using namespace MED_EN; + map < int, ::FIELD_ * > FIELD_i::fieldMap ; int FIELD_i::fieldIndex = 0; //============================================================================= @@ -17,7 +20,7 @@ int FIELD_i::fieldIndex = 0; //============================================================================= //FIELD_i::FIELD_i():_fieldTptr(FIELD_i::constructConstField()) -FIELD_i::FIELD_i():_fieldTptr(constructConstField()) +FIELD_i::FIELD_i():_fieldTptr(constructConstField()),_corbaIndex(FIELD_i::fieldIndex++) { BEGIN_OF("Default Constructor Field_i"); END_OF(" Default Constructor Field_i"); diff --git a/src/MEDMEM_I/MEDMEM_Field_i.hxx b/src/MEDMEM_I/MEDMEM_Field_i.hxx index 11cfd0f91..327170904 100644 --- a/src/MEDMEM_I/MEDMEM_Field_i.hxx +++ b/src/MEDMEM_I/MEDMEM_Field_i.hxx @@ -48,7 +48,7 @@ protected : const int _corbaIndex; string _FieldId; FIELD_i(); - FIELD_i(::FIELD_ * const field, bool ownCppPtr); + FIELD_i(MEDMEM::FIELD_ * const field, bool ownCppPtr); FIELD_i(FIELD_i & f); public : @@ -89,7 +89,7 @@ public : throw (SALOME::SALOME_Exception); void release(); // Cuisine Interne - ::FIELD_ * constructConstField() const; + MEDMEM::FIELD_ * constructConstField() const; }; } diff --git a/src/MEDMEM_I/MEDMEM_Med_i.cxx b/src/MEDMEM_I/MEDMEM_Med_i.cxx index ef2503c35..896917c0b 100644 --- a/src/MEDMEM_I/MEDMEM_Med_i.cxx +++ b/src/MEDMEM_I/MEDMEM_Med_i.cxx @@ -1,4 +1,3 @@ -using namespace std; //============================================================================= // File : MEDMEM_Med_i.cxx // Project : SALOME @@ -23,6 +22,8 @@ using namespace std; #include "MEDMEM_DriversDef.hxx" #include "utilities.h" #include "Utils_CorbaException.hxx" + +using namespace std; using namespace MEDMEM; //============================================================================= @@ -73,12 +74,12 @@ void MED_i::init(SALOMEDS::Study_ptr myStudy,driverTypes driverType, const strin vector groupVector; vector::iterator groupVectorIt; - MED_FR::MESH_ENTITIES::const_iterator currentEntity; + MED_EN::MESH_ENTITIES::const_iterator currentEntity; for (int i=0; igetMesh(meshesNames[i]); - for (currentEntity = MED_FR::meshEntities.begin(); - currentEntity != MED_FR::meshEntities.end(); + for (currentEntity = MED_EN::meshEntities.begin(); + currentEntity != MED_EN::meshEntities.end(); currentEntity++) { // MESSAGE(LOC << ": for entity " << (*currentEntity).first); @@ -112,9 +113,9 @@ void MED_i::init(SALOMEDS::Study_ptr myStudy,driverTypes driverType, const strin for (int i=0; i mySupports = _med->getSupports(meshesNames[i]); - map::const_iterator itSupport; - map & mySupportsIOR + map mySupports = _med->getSupports(meshesNames[i]); + map::const_iterator itSupport; + map & mySupportsIOR = _supports[meshesNames[i]]; for ( itSupport = mySupports.begin(); itSupport != mySupports.end(); itSupport++ ) { @@ -137,16 +138,16 @@ void MED_i::init(SALOMEDS::Study_ptr myStudy,driverTypes driverType, const strin ::FIELD_ * myField = _med->getField(fieldsNames[i], myIteration[j].dt, myIteration[j].it); string meshName = myField->getSupport()->getMesh()->getName(); medEntityMesh myEntity = myField->getSupport()->getEntity(); - map >::const_iterator + map >::const_iterator itSupportOnMesh = _supports.find(meshName); if ( itSupportOnMesh == _supports.end() ) throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) << "There is no support on mesh named |" << meshName << "|" )); - const map & SupportOnMesh + const map & SupportOnMesh = (*itSupportOnMesh).second; - map::const_iterator itSupport - = SupportOnMesh.find((MED_FR::med_entite_maillage)myEntity); + map::const_iterator itSupport + = SupportOnMesh.find(myEntity); if (itSupport == SupportOnMesh.end()) throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) << "There is no support on entity " @@ -157,7 +158,7 @@ void MED_i::init(SALOMEDS::Study_ptr myStudy,driverTypes driverType, const strin SALOME_MED::FIELD_ptr myFieldIOR; switch (type) { - case MED_FR::MED_INT32 : + case MED_EN::MED_INT32 : { ((FIELD*)myField)->read(); FIELDINT_i * myFieldIntI = new FIELDINT_i((FIELD*)myField); @@ -166,7 +167,7 @@ void MED_i::init(SALOMEDS::Study_ptr myStudy,driverTypes driverType, const strin break; } - case MED_FR::MED_REEL64: + case MED_EN::MED_REEL64: { ((FIELD*)myField)->read(); FIELDDOUBLE_i * myFieldDoubleI = new FIELDDOUBLE_i((FIELD*)myField); @@ -246,15 +247,15 @@ void MED_i::initWithFieldType(SALOMEDS::Study_ptr myStudy,driverTypes driverType SCRUTE(numberOfMeshes); - MED_FR::MESH_ENTITIES::const_iterator currentEntity; + MED_EN::MESH_ENTITIES::const_iterator currentEntity; for (int i=0; igetMesh(meshesNames[i]); SCRUTE(ptrMesh); - for (currentEntity = MED_FR::meshEntities.begin(); - currentEntity != MED_FR::meshEntities.end(); + for (currentEntity = MED_EN::meshEntities.begin(); + currentEntity != MED_EN::meshEntities.end(); currentEntity++) { MESSAGE(LOC << ": for entity " << (*currentEntity).first); @@ -288,9 +289,9 @@ void MED_i::initWithFieldType(SALOMEDS::Study_ptr myStudy,driverTypes driverType for (int i=0; i mySupports = _med->getSupports(meshesNames[i]); - map::const_iterator itSupport; - map & + map mySupports = _med->getSupports(meshesNames[i]); + map::const_iterator itSupport; + map & mySupportsIOR = _supports[meshesNames[i]]; for (itSupport=mySupports.begin(); itSupport!=mySupports.end(); itSupport++ ) { @@ -456,16 +457,16 @@ void MED_i::initWithFieldType(SALOMEDS::Study_ptr myStudy,driverTypes driverType string meshName = myField->getSupport()->getMesh()->getName(); medEntityMesh myEntity = myField->getSupport()->getEntity(); - map >::const_iterator + map >::const_iterator itSupportOnMesh = _supports.find(meshName); if (itSupportOnMesh == _supports.end() ) throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) << "There is no support on mesh named |" << meshName << "|")); - const map & SupportOnMesh + const map & SupportOnMesh = (*itSupportOnMesh).second; - map::const_iterator itSupport - = SupportOnMesh.find((MED_FR::med_entite_maillage)myEntity); + map::const_iterator itSupport + = SupportOnMesh.find(myEntity); if (itSupport == SupportOnMesh.end() ) throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) << "There is no support on entity " @@ -480,7 +481,7 @@ void MED_i::initWithFieldType(SALOMEDS::Study_ptr myStudy,driverTypes driverType switch (type) { - case MED_FR::MED_INT32: + case MED_EN::MED_INT32: { ((FIELD*)myField)->read(); FIELDINT_i * myFieldIntI = new FIELDINT_i((FIELD*)myField); @@ -494,7 +495,7 @@ void MED_i::initWithFieldType(SALOMEDS::Study_ptr myStudy,driverTypes driverType break; } - case MED_FR::MED_REEL64: + case MED_EN::MED_REEL64: { ((FIELD*)myField)->read(); FIELDDOUBLE_i * myFieldDoubleI = new FIELDDOUBLE_i((FIELD*)myField); diff --git a/src/MEDMEM_I/MEDMEM_Med_i.hxx b/src/MEDMEM_I/MEDMEM_Med_i.hxx index 0368dbf20..0dbeb12de 100644 --- a/src/MEDMEM_I/MEDMEM_Med_i.hxx +++ b/src/MEDMEM_I/MEDMEM_Med_i.hxx @@ -35,7 +35,7 @@ protected: map _meshes; // We can't have two MESHes with the same name. - map > _supports; + map > _supports; map _fields; // We can't have two FIELDs with the same name. diff --git a/src/MEDMEM_I/MEDMEM_Mesh_i.hxx b/src/MEDMEM_I/MEDMEM_Mesh_i.hxx index 616027bba..807b02ec0 100644 --- a/src/MEDMEM_I/MEDMEM_Mesh_i.hxx +++ b/src/MEDMEM_I/MEDMEM_Mesh_i.hxx @@ -25,7 +25,7 @@ class MESH_i: public POA_SALOME_MED::MESH, public SALOMEMultiComm { public : - static map < int,::MEDMEM::MESH *> meshMap; + static std::map < int,::MEDMEM::MESH *> meshMap; private : static int meshIndex; @@ -35,7 +35,7 @@ protected: // C++ object containing values ::MEDMEM::MESH * const _mesh; const int _corbaIndex; - string _meshId; + std::string _meshId; public: @@ -168,7 +168,7 @@ public: throw (SALOME::SALOME_Exception, SALOMEDS::StudyBuilder::LockProtection); void addInStudy (SALOMEDS::Study_ptr myStudy, SALOME_MED::MESH_ptr myIor, - const string & fileName) + const std::string & fileName) throw (SALOME::SALOME_Exception, SALOMEDS::StudyBuilder::LockProtection); CORBA::Long addDriver (SALOME_MED::medDriverTypes driverType, const char* fileName, const char* meshName) diff --git a/src/MEDMEM_I/MEDMEM_Support_i.cxx b/src/MEDMEM_I/MEDMEM_Support_i.cxx index 0bcd75b69..070561b44 100644 --- a/src/MEDMEM_I/MEDMEM_Support_i.cxx +++ b/src/MEDMEM_I/MEDMEM_Support_i.cxx @@ -36,7 +36,7 @@ int SUPPORT_i::supportIndex = 0 ; * Default constructor */ //============================================================================= -SUPPORT_i::SUPPORT_i() :_support((::SUPPORT *)NULL) +SUPPORT_i::SUPPORT_i() :_support((::SUPPORT *)NULL),_corbaIndex(SUPPORT_i::supportIndex++) { BEGIN_OF("Default Constructor SUPPORT_i"); END_OF("Default Constructor SUPPORT_i"); diff --git a/src/MEDMEM_I/MEDMEM_Support_i.hxx b/src/MEDMEM_I/MEDMEM_Support_i.hxx index d06a62d79..5a3f7bc7d 100644 --- a/src/MEDMEM_I/MEDMEM_Support_i.hxx +++ b/src/MEDMEM_I/MEDMEM_Support_i.hxx @@ -20,7 +20,6 @@ namespace MEDMEM { class SUPPORT; -class SALOME_MED::MESH; class SUPPORT_i: public POA_SALOME_MED::SUPPORT, public PortableServer::RefCountServantBase, diff --git a/src/MEDMEM_I/Makefile.in b/src/MEDMEM_I/Makefile.in index b27d8931b..7d65b0978 100644 --- a/src/MEDMEM_I/Makefile.in +++ b/src/MEDMEM_I/Makefile.in @@ -61,10 +61,12 @@ BIN_SRC = BIN_SERVER_IDL = BIN_CLIENT_IDL = +LDFLAGS= -L$(top_builddir)/lib/salome +LDFLAGSFORBIN= -L$(top_builddir)/lib/salome CPPFLAGS+= $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS+= -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lmedmem -lOpUtil -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace -lSalomeCommunication +LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lmedmem -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace -lSalomeCommunication #LDFLAGS+=-lmedmem -L. -lSalomeContainer -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification # does we put only -lSalomeContainer and compiler retrieves -lSalomeNS -lRegistry -lOpUtil ???? diff --git a/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldDouble.cxx b/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldDouble.cxx index ca035fdb1..d54e01c55 100644 --- a/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldDouble.cxx +++ b/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldDouble.cxx @@ -1,6 +1,8 @@ -using namespace std; #include "MEDMEM_SWIG_FieldDouble.hxx" + +using namespace std; using namespace MEDMEM; +using namespace MED_EN; //============================================================================= /*! diff --git a/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldDouble.hxx b/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldDouble.hxx index 408f100a1..655cb6539 100644 --- a/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldDouble.hxx +++ b/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldDouble.hxx @@ -3,16 +3,16 @@ #include "MEDMEM_Field.hxx" -class FIELDDOUBLE : public FIELD +class FIELDDOUBLE : public MEDMEM::FIELD { public: FIELDDOUBLE(); - FIELDDOUBLE(const SUPPORT * Support, const int NumberOfComponents); - FIELDDOUBLE(const SUPPORT * Support, driverTypes driverType, + FIELDDOUBLE(const MEDMEM::SUPPORT * Support, const int NumberOfComponents); + FIELDDOUBLE(const MEDMEM::SUPPORT * Support, MEDMEM::driverTypes driverType, const string & fileName="", const string & fieldName="", const int iterationNumber=-1, const int orderNumber=-1); FIELDDOUBLE(const FIELDDOUBLE & m); - FIELDDOUBLE(const FIELD & m); + FIELDDOUBLE(const MEDMEM::FIELD & m); ~FIELDDOUBLE(); }; diff --git a/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldInt.cxx b/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldInt.cxx index f2f002af1..354e9adbc 100644 --- a/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldInt.cxx +++ b/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldInt.cxx @@ -1,6 +1,9 @@ -using namespace std; #include "MEDMEM_SWIG_FieldInt.hxx" +using namespace std; +using namespace MED_EN; +using namespace MEDMEM; + //============================================================================= /*! * Default constructor diff --git a/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldInt.hxx b/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldInt.hxx index 557066196..27b37809f 100644 --- a/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldInt.hxx +++ b/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldInt.hxx @@ -3,16 +3,16 @@ #include "MEDMEM_Field.hxx" -class FIELDINT : public FIELD +class FIELDINT : public MEDMEM::FIELD { public: FIELDINT(); - FIELDINT(const SUPPORT * Support, const int NumberOfComponents); - FIELDINT(const SUPPORT * Support, driverTypes driverType, + FIELDINT(const MEDMEM::SUPPORT * Support, const int NumberOfComponents); + FIELDINT(const MEDMEM::SUPPORT * Support, MEDMEM::driverTypes driverType, const string & fileName="", const string & fieldName="", const int iterationNumber=-1, const int orderNumber=-1); FIELDINT(const FIELDINT & m); - FIELDINT(const FIELD & m); + FIELDINT(const MEDMEM::FIELD & m); ~FIELDINT(); }; diff --git a/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldDoubleDriver.cxx b/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldDoubleDriver.cxx index 8b662aee8..5192843b4 100644 --- a/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldDoubleDriver.cxx +++ b/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldDoubleDriver.cxx @@ -1,6 +1,9 @@ -using namespace std; #include "MEDMEM_SWIG_MedFieldDoubleDriver.hxx" +using namespace std; +using namespace MEDMEM; +using namespace MED_EN; + //============================================================================= /*! * Default constructor diff --git a/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldDoubleDriver.hxx b/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldDoubleDriver.hxx index 65e5d6573..9a60d2cb0 100644 --- a/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldDoubleDriver.hxx +++ b/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldDoubleDriver.hxx @@ -4,18 +4,18 @@ #include "MEDMEM_MedFieldDriver.hxx" #include "MEDMEM_SWIG_FieldDouble.hxx" -class MED_FIELDDOUBLE_DRIVER : public MED_FIELD_DRIVER +class MED_FIELDDOUBLE_DRIVER : public MEDMEM::MED_FIELD_DRIVER { public: MED_FIELDDOUBLE_DRIVER(); MED_FIELDDOUBLE_DRIVER(const string & fileName, FIELDDOUBLE * ptrField, - med_mode_acces accessMode); + MED_EN::med_mode_acces accessMode); ~MED_FIELDDOUBLE_DRIVER(); }; -class MED_FIELDDOUBLE_RDONLY_DRIVER : public MED_FIELD_RDONLY_DRIVER +class MED_FIELDDOUBLE_RDONLY_DRIVER : public MEDMEM::MED_FIELD_RDONLY_DRIVER { public: MED_FIELDDOUBLE_RDONLY_DRIVER(); @@ -26,7 +26,7 @@ public: ~MED_FIELDDOUBLE_RDONLY_DRIVER(); }; -class MED_FIELDDOUBLE_WRONLY_DRIVER : public MED_FIELD_WRONLY_DRIVER +class MED_FIELDDOUBLE_WRONLY_DRIVER : public MEDMEM::MED_FIELD_WRONLY_DRIVER { public: MED_FIELDDOUBLE_WRONLY_DRIVER(); @@ -37,7 +37,7 @@ public: ~MED_FIELDDOUBLE_WRONLY_DRIVER(); }; -class MED_FIELDDOUBLE_RDWR_DRIVER : public MED_FIELD_RDWR_DRIVER +class MED_FIELDDOUBLE_RDWR_DRIVER : public MEDMEM::MED_FIELD_RDWR_DRIVER { public: MED_FIELDDOUBLE_RDWR_DRIVER(); diff --git a/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldIntDriver.cxx b/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldIntDriver.cxx index 87b25165d..7e48fffb9 100644 --- a/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldIntDriver.cxx +++ b/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldIntDriver.cxx @@ -1,6 +1,9 @@ -using namespace std; #include "MEDMEM_SWIG_MedFieldIntDriver.hxx" +using namespace std; +using namespace MEDMEM; +using namespace MED_EN; + //============================================================================= /*! * Default constructor diff --git a/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldIntDriver.hxx b/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldIntDriver.hxx index bb43c893f..0243baf9b 100644 --- a/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldIntDriver.hxx +++ b/src/MEDMEM_SWIG/MEDMEM_SWIG_MedFieldIntDriver.hxx @@ -4,18 +4,18 @@ #include "MEDMEM_MedFieldDriver.hxx" #include "MEDMEM_SWIG_FieldInt.hxx" -class MED_FIELDINT_DRIVER : public MED_FIELD_DRIVER +class MED_FIELDINT_DRIVER : public MEDMEM::MED_FIELD_DRIVER { public: MED_FIELDINT_DRIVER(); MED_FIELDINT_DRIVER(const string & fileName, FIELDINT * ptrField, - med_mode_acces accessMode); + MED_EN::med_mode_acces accessMode); ~MED_FIELDINT_DRIVER(); }; -class MED_FIELDINT_RDONLY_DRIVER : public MED_FIELD_RDONLY_DRIVER +class MED_FIELDINT_RDONLY_DRIVER : public MEDMEM::MED_FIELD_RDONLY_DRIVER { public: MED_FIELDINT_RDONLY_DRIVER(); @@ -26,7 +26,7 @@ public: ~MED_FIELDINT_RDONLY_DRIVER(); }; -class MED_FIELDINT_WRONLY_DRIVER : public MED_FIELD_WRONLY_DRIVER +class MED_FIELDINT_WRONLY_DRIVER : public MEDMEM::MED_FIELD_WRONLY_DRIVER { public: MED_FIELDINT_WRONLY_DRIVER(); @@ -37,7 +37,7 @@ public: ~MED_FIELDINT_WRONLY_DRIVER(); }; -class MED_FIELDINT_RDWR_DRIVER : public MED_FIELD_RDWR_DRIVER +class MED_FIELDINT_RDWR_DRIVER : public MEDMEM::MED_FIELD_RDWR_DRIVER { public: MED_FIELDINT_RDWR_DRIVER(); diff --git a/src/MEDMEM_SWIG/Makefile.in b/src/MEDMEM_SWIG/Makefile.in index 78a657e02..e0bf76295 100644 --- a/src/MEDMEM_SWIG/Makefile.in +++ b/src/MEDMEM_SWIG/Makefile.in @@ -67,12 +67,15 @@ EXPORT_PYSCRIPTS = libMEDMEM_Swig.py \ ############################################################################# +LDFLAGS= -L$(top_builddir)/lib/salome +LDFLAGSFORBIN= -L$(top_builddir)/lib/salome + CPPFLAGS+= $(PYTHON_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS+=-ftemplate-depth-42 -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS+= @CXXTMPDPTHFLAGS@ -I${KERNEL_ROOT_DIR}/include/salome LIBS= $(PYTHON_LIBS) #LDFLAGS+= -lmedmem $(MED2_LIBS) $(HDF5_LIBS) -lSalomeLoggerServer -L${KERNEL_ROOT_DIR}/lib/salome # change motivated by the bug KERNEL4778. -LDFLAGS+= -lmedmem $(MED2_LIBS) $(HDF5_LIBS) -lSALOMELocalTrace -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS+= -lmedmem $(MED2_LIBS) $(HDF5_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -lSALOMELocalTrace ############################################################################# diff --git a/src/MEDMEM_SWIG/libMEDMEM_Swig.i b/src/MEDMEM_SWIG/libMEDMEM_Swig.i index 3ca7473ab..b1adf35f8 100644 --- a/src/MEDMEM_SWIG/libMEDMEM_Swig.i +++ b/src/MEDMEM_SWIG/libMEDMEM_Swig.i @@ -31,6 +31,9 @@ #include "MEDMEM_SWIG_MedFieldDoubleDriver.hxx" #include "MEDMEM_SWIG_MedFieldIntDriver.hxx" #include "MEDMEM_Meshing.hxx" + + using namespace MEDMEM; + using namespace MED_EN; %} %include "typemaps.i" @@ -1628,8 +1631,7 @@ class MED SUPPORT * getSupport(char * meshName, medEntityMesh entity) { - return self->getSupport(string(meshName), - (MED_FR::med_entite_maillage) entity); + return self->getSupport(string(meshName),entity); } } }; diff --git a/src/MEDMEM_SWIG/testMedMemGeneral.py b/src/MEDMEM_SWIG/testMedMemGeneral.py index 54e73170f..f663ad44d 100755 --- a/src/MEDMEM_SWIG/testMedMemGeneral.py +++ b/src/MEDMEM_SWIG/testMedMemGeneral.py @@ -87,6 +87,12 @@ meshNameFiles.append("CUBE_EN_HEXA8_QUAD4") files.append("pointe.med") meshNameFiles.append("maa1") +files.append("Mistrat.med") +meshNameFiles.append("Mistrat_Hexa") + +## files.append("TimeStamps.med") +## meshNameFiles.append("dom") + # # Castem or Gibi file list # @@ -859,42 +865,49 @@ for i in range(nbOfFiles): valueI = fieldintmul.getValueI(MED_FULL_INTERLACE,k+1) print " *",valueI[:nbOfComp] print "" - fieldintdiv = fieldint / fieldint2 - print "Test of the division of two integer fields with creation a new one" - print "" - name = fieldintdiv.getName() - desc = fieldintdiv.getDescription() - nbOfComp = fieldintdiv.getNumberOfComponents() - print " Field",name," : ",desc - print " Number Of Components:",nbOfComp - iterationNb = fieldintdiv.getIterationNumber() - orderNb = fieldintdiv.getOrderNumber() - time = fieldintdiv.getTime() - print " Iteration Number",iterationNb - print " Order Number",orderNb - print " Time",time - for k in range(nbOfComp): - kp1 = k+1 - compName = fieldintdiv.getComponentName(kp1) - compDesc = fieldintdiv.getComponentDescription(kp1) - compUnit = fieldintdiv.getMEDComponentUnit(kp1) - print " * Component:",kp1 - print " Name:",compName - print " Description:",compDesc - print " Unit:",compUnit - - support = fieldintdiv.getSupport() - nbOf = support.getNumberOfElements(MED_ALL_ELEMENTS) - print " Values:",nbOf - for k in range(nbOf): - valueI = fieldintdiv.getValueI(MED_FULL_INTERLACE,k+1) - print " *",valueI[:nbOfComp] - print "" - print "TESTS OPERATIONS SUR FIELDINT : " + try: + fieldintdiv = fieldint / fieldint2 + print "Test of the division of two integer fields with creation a new one" + print "" + name = fieldintdiv.getName() + desc = fieldintdiv.getDescription() + nbOfComp = fieldintdiv.getNumberOfComponents() + print " Field",name," : ",desc + print " Number Of Components:",nbOfComp + iterationNb = fieldintdiv.getIterationNumber() + orderNb = fieldintdiv.getOrderNumber() + time = fieldintdiv.getTime() + print " Iteration Number",iterationNb + print " Order Number",orderNb + print " Time",time + for k in range(nbOfComp): + kp1 = k+1 + compName = fieldintdiv.getComponentName(kp1) + compDesc = fieldintdiv.getComponentDescription(kp1) + compUnit = fieldintdiv.getMEDComponentUnit(kp1) + print " * Component:",kp1 + print " Name:",compName + print " Description:",compDesc + print " Unit:",compUnit + + support = fieldintdiv.getSupport() + nbOf = support.getNumberOfElements(MED_ALL_ELEMENTS) + print " Values:",nbOf + for k in range(nbOf): + valueI = fieldintdiv.getValueI(MED_FULL_INTERLACE,k+1) + print " *",valueI[:nbOfComp] + print "" + print "TESTS OPERATIONS SUR FIELDINT : " + except: + print "testMedMemGeneral fieldintdiv = fieldint / fieldint2 catch/except error" fieldintadd = fieldint+fieldint2 fieldintsub = fieldint-fieldint2 fieldintmul = fieldint*fieldint2 - fieldintdiv = fieldint/fieldint2 + try: + fieldintdiv = fieldint/fieldint2 + except: + fieldintdiv = None + print "testMedMemGeneral fieldintdiv = fieldint/fieldint2 catch/except error" fieldintasso = fieldint+fieldint*fieldint fieldintSP=createFieldIntScalarProduct(fieldint, fieldint2) @@ -904,18 +917,26 @@ for i in range(nbOfFiles): print " + : ",fieldintadd.getValue(MED_FULL_INTERLACE) print " - : ",fieldintsub.getValue(MED_FULL_INTERLACE) print " * : ",fieldintmul.getValue(MED_FULL_INTERLACE) - print " / : ",fieldintdiv.getValue(MED_FULL_INTERLACE) + if fieldintdiv == None : + print "testMedMemGeneral / : None" + else: + print " / : ",fieldintdiv.getValue(MED_FULL_INTERLACE) fieldint+=fieldint2; print " += : ",fieldint.getValue(MED_FULL_INTERLACE) fieldint-=fieldint2; print " -= : ",fieldint.getValue(MED_FULL_INTERLACE) fieldint*=fieldint2; print " *= : ",fieldint.getValue(MED_FULL_INTERLACE) - fieldint/=fieldint2; - print " /= : ",fieldint.getValue(MED_FULL_INTERLACE) + try: + fieldint/=fieldint2; + print " /= : ",fieldint.getValue(MED_FULL_INTERLACE) + except : + fieldint = None + print " /= : Catch/Except : None" print "f1+f2*f2: ",fieldintasso.getValue(MED_FULL_INTERLACE) - fieldint.applyLin(4,1); - print " 4f1+1 : ",fieldint.getValue(MED_FULL_INTERLACE) + if fieldint != None : + fieldint.applyLin(4,1); + print " 4f1+1 : ",fieldint.getValue(MED_FULL_INTERLACE) print " f1.f2 : ",fieldintSP.getValue(MED_FULL_INTERLACE) fieldint2.applyPyFunc(add_one) print " CB:f2+1: ",fieldint2.getValue(MED_FULL_INTERLACE) @@ -1060,41 +1081,49 @@ for i in range(nbOfFiles): valueI = fielddoublemul.getValueI(MED_FULL_INTERLACE,k+1) print " *",valueI[:nbOfComp] print "" - fielddoublediv = fielddouble / fielddouble2 - print "Test of the division of two double fields with creation a new one" - print "" - name = fielddoublediv.getName() - desc = fielddoublediv.getDescription() - nbOfComp = fielddoublediv.getNumberOfComponents() - print " Field",name," : ",desc - print " Number Of Components:",nbOfComp - iterationNb = fielddoublediv.getIterationNumber() - orderNb = fielddoublediv.getOrderNumber() - time = fielddoublediv.getTime() - print " Iteration Number",iterationNb - print " Order Number",orderNb - print " Time",time - for k in range(nbOfComp): - kp1 = k+1 - compName = fielddoublediv.getComponentName(kp1) - compDesc = fielddoublediv.getComponentDescription(kp1) - compUnit = fielddoublediv.getMEDComponentUnit(kp1) - print " * Component:",kp1 - print " Name:",compName - print " Description:",compDesc - print " Unit:",compUnit - - support = fielddoublediv.getSupport() - nbOf = support.getNumberOfElements(MED_ALL_ELEMENTS) - print " Values:",nbOf - for k in range(nbOf): - valueI = fielddoublediv.getValueI(MED_FULL_INTERLACE,k+1) - print " *",valueI[:nbOfComp] + try: + fielddoublediv = fielddouble / fielddouble2 + print "Test of the division of two double fields with creation a new one" + print "" + name = fielddoublediv.getName() + desc = fielddoublediv.getDescription() + nbOfComp = fielddoublediv.getNumberOfComponents() + print " Field",name," : ",desc + print " Number Of Components:",nbOfComp + iterationNb = fielddoublediv.getIterationNumber() + orderNb = fielddoublediv.getOrderNumber() + time = fielddoublediv.getTime() + print " Iteration Number",iterationNb + print " Order Number",orderNb + print " Time",time + for k in range(nbOfComp): + kp1 = k+1 + compName = fielddoublediv.getComponentName(kp1) + compDesc = fielddoublediv.getComponentDescription(kp1) + compUnit = fielddoublediv.getMEDComponentUnit(kp1) + print " * Component:",kp1 + print " Name:",compName + print " Description:",compDesc + print " Unit:",compUnit + + support = fielddoublediv.getSupport() + nbOf = support.getNumberOfElements(MED_ALL_ELEMENTS) + print " Values:",nbOf + for k in range(nbOf): + valueI = fielddoublediv.getValueI(MED_FULL_INTERLACE,k+1) + print " *",valueI[:nbOfComp] + except: + print "testMedMemGeneral fielddoublediv = fielddouble / fielddouble2 catch/except error" + print "" print "TESTS OPERATIONS SUR FIELDDOUBLE : " fielddoublesub = fielddouble-fielddouble2 fielddoublemul = fielddouble*fielddouble2 - fielddoublediv = fielddouble/fielddouble2 + try: + fielddoublediv = fielddouble/fielddouble2 + except: + print "testMedMemGeneral /= : catch/except error" + fielddoublediv = None fielddoubleasso = fielddouble+fielddouble2*fielddouble2 fielddoubleSP=createFieldDoubleScalarProduct(fielddouble, fielddouble2) print " f1 : ",fielddouble.getValue(MED_FULL_INTERLACE) @@ -1103,16 +1132,20 @@ for i in range(nbOfFiles): print " + : ",fielddoubleadd.getValue(MED_FULL_INTERLACE) print " - : ",fielddoublesub.getValue(MED_FULL_INTERLACE) print " * : ",fielddoublemul.getValue(MED_FULL_INTERLACE) - print " / : ",fielddoublediv.getValue(MED_FULL_INTERLACE) - + if fielddoublediv != None: + print " / : ",fielddoublediv.getValue(MED_FULL_INTERLACE) + pass fielddouble+=fielddouble2; print " += : ",fielddouble.getValue(MED_FULL_INTERLACE) fielddouble-=fielddouble2; print " -= : ",fielddouble.getValue(MED_FULL_INTERLACE) fielddouble*=fielddouble2; print " *= : ",fielddouble.getValue(MED_FULL_INTERLACE) - fielddouble/=fielddouble2; - print " /= : ",fielddouble.getValue(MED_FULL_INTERLACE) + try: + fielddouble/=fielddouble2; + print " /= : ",fielddouble.getValue(MED_FULL_INTERLACE) + except: + print "testMedMemGeneral /= : " print "f1+f2*f2: ",fielddoubleasso.getValue(MED_FULL_INTERLACE) fielddouble.applyLin(4,1); print " 4f1+1 : ",fielddouble.getValue(MED_FULL_INTERLACE) diff --git a/src/Makefile.in b/src/Makefile.in index e806a2374..ca1cc170e 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -31,6 +31,16 @@ VPATH=.:@srcdir@ @COMMENCE@ +ifeq (@WITHIHM@,yes) SUBDIRS = MEDMEM MEDMEM_SWIG MEDMEM_I MED MEDGUI MedCorba_Swig MED_SWIG MedClient INTERPOLATION +endif + +ifeq (@WITHIHM@,no) +SUBDIRS = MEDMEM MEDMEM_SWIG MEDMEM_I MED MedCorba_Swig MED_SWIG MedClient INTERPOLATION + +endif + +LDFLAGS= -L$(top_builddir)/lib/salome +LDFLAGSFORBIN= -L$(top_builddir)/lib/salome @MODULE@ diff --git a/src/MedClient/src/CONNECTIVITYClient.cxx b/src/MedClient/src/CONNECTIVITYClient.cxx index 03d5818d5..d771344b7 100644 --- a/src/MedClient/src/CONNECTIVITYClient.cxx +++ b/src/MedClient/src/CONNECTIVITYClient.cxx @@ -71,7 +71,7 @@ void CONNECTIVITYClient::blankCopy() long iT, nT; //convertCorbaArray // (Types, nT, IOR_Mesh->getTypes(Entity)); - convertCorbaArray + convertCorbaArray (Types, nT, &all->meshTypes); ASSERT(nT == (int) getNumberOfTypes(Entity)); @@ -151,12 +151,12 @@ void CONNECTIVITYClient::fillCopy() /*! */ //============================================================================= -med_int CONNECTIVITYClient::getNumberOf(medEntityMesh Entity, +int CONNECTIVITYClient::getNumberOf(medEntityMesh Entity, medGeometryElement Type) const { BEGIN_OF("void CONNECTIVITYClient::getNumberOf()"); - med_int n = 0; + int n = 0; SCRUTE(Type); SCRUTE(Entity); @@ -168,7 +168,7 @@ med_int CONNECTIVITYClient::getNumberOf(medEntityMesh Entity, if (Type==MED_ALL_ELEMENTS) n = _totalNumberOfElements_client; - for (med_int i=0; i<_numberOfTypes; i++) { + for (int i=0; i<_numberOfTypes; i++) { SCRUTE(_geometricTypes[i]); if (_geometricTypes[i] == Type) { n = _numberOfElements_client[i]; @@ -192,7 +192,7 @@ med_int CONNECTIVITYClient::getNumberOf(medEntityMesh Entity, /*! */ //============================================================================= -const med_int * CONNECTIVITYClient::getConnectivity +const int * CONNECTIVITYClient::getConnectivity (medConnectivity ConnectivityType, medEntityMesh Entity, medGeometryElement Type) @@ -202,7 +202,7 @@ const med_int * CONNECTIVITYClient::getConnectivity if (!_complete) fillCopy(); - const med_int * c = CONNECTIVITY::getConnectivity + const int * c = CONNECTIVITY::getConnectivity (ConnectivityType, Entity, Type); END_OF("void CONNECTIVITYClient::getConnectivity()"); @@ -213,7 +213,7 @@ const med_int * CONNECTIVITYClient::getConnectivity /*! */ //============================================================================= -const med_int * CONNECTIVITYClient::getConnectivityIndex +const int * CONNECTIVITYClient::getConnectivityIndex (medConnectivity ConnectivityType, medEntityMesh Entity) { @@ -222,7 +222,7 @@ const med_int * CONNECTIVITYClient::getConnectivityIndex if (!_complete) fillCopy(); - const med_int *c = CONNECTIVITY::getConnectivityIndex + const int *c = CONNECTIVITY::getConnectivityIndex (ConnectivityType, Entity); END_OF("void CONNECTIVITYClient::getConnectivityIndex()"); @@ -303,7 +303,7 @@ bool CONNECTIVITYClient::existConnectivity(medConnectivity ConnectivityType, /*! */ //============================================================================= -const med_int * CONNECTIVITYClient::getReverseConnectivity +const int * CONNECTIVITYClient::getReverseConnectivity (medConnectivity ConnectivityType, medEntityMesh Entity) throw (MEDEXCEPTION) { @@ -312,7 +312,7 @@ const med_int * CONNECTIVITYClient::getReverseConnectivity if (!_complete) fillCopy(); - const med_int *c = CONNECTIVITY::getReverseConnectivity + const int *c = CONNECTIVITY::getReverseConnectivity (ConnectivityType, Entity); END_OF("void CONNECTIVITYClient::getReverseConnectivity()"); @@ -324,7 +324,7 @@ const med_int * CONNECTIVITYClient::getReverseConnectivity /*! */ //============================================================================= -const med_int * CONNECTIVITYClient::getReverseConnectivityIndex +const int * CONNECTIVITYClient::getReverseConnectivityIndex (medConnectivity ConnectivityType, medEntityMesh Entity) throw (MEDEXCEPTION) { @@ -333,7 +333,7 @@ const med_int * CONNECTIVITYClient::getReverseConnectivityIndex if (!_complete) fillCopy(); - const med_int *c = CONNECTIVITY::getReverseConnectivityIndex + const int *c = CONNECTIVITY::getReverseConnectivityIndex (ConnectivityType, Entity); END_OF("void CONNECTIVITYClient::getReverseConnectivityIndex()"); @@ -345,7 +345,7 @@ const med_int * CONNECTIVITYClient::getReverseConnectivityIndex /*! */ //============================================================================= -const med_int* CONNECTIVITYClient::getValue(medConnectivity TypeConnectivity, +const int* CONNECTIVITYClient::getValue(medConnectivity TypeConnectivity, medGeometryElement Type) { BEGIN_OF("void CONNECTIVITYClient::getValue()"); @@ -353,7 +353,7 @@ const med_int* CONNECTIVITYClient::getValue(medConnectivity TypeConnectivity, if (!_complete) fillCopy(); - const med_int * c = CONNECTIVITY::getValue(TypeConnectivity, Type); + const int * c = CONNECTIVITY::getValue(TypeConnectivity, Type); END_OF("void CONNECTIVITYClient::()"); @@ -364,14 +364,14 @@ const med_int* CONNECTIVITYClient::getValue(medConnectivity TypeConnectivity, /*! */ //============================================================================= -const med_int* CONNECTIVITYClient::getValueIndex(medConnectivity TypeConnectivity) +const int* CONNECTIVITYClient::getValueIndex(medConnectivity TypeConnectivity) { BEGIN_OF("void CONNECTIVITYClient::getValueIndex()"); if (!_complete) fillCopy(); - const med_int * c = CONNECTIVITY::getValueIndex(TypeConnectivity); + const int * c = CONNECTIVITY::getValueIndex(TypeConnectivity); END_OF("void CONNECTIVITYClient::getValueIndex()"); @@ -382,14 +382,14 @@ const med_int* CONNECTIVITYClient::getValueIndex(medConnectivity TypeConnectivit /*! */ //============================================================================= -const med_int* CONNECTIVITYClient::getNeighbourhood() const +const int* CONNECTIVITYClient::getNeighbourhood() const { BEGIN_OF("void CONNECTIVITYClient::getNeighbourhood()"); if (!_complete) (const_cast(this))->fillCopy(); - const med_int * c = CONNECTIVITY::getNeighbourhood(); + const int * c = CONNECTIVITY::getNeighbourhood(); END_OF("void CONNECTIVITYClient::getNeighbourhood()"); diff --git a/src/MedClient/src/CONNECTIVITYClient.hxx b/src/MedClient/src/CONNECTIVITYClient.hxx index b3c611ccf..de1d71eec 100644 --- a/src/MedClient/src/CONNECTIVITYClient.hxx +++ b/src/MedClient/src/CONNECTIVITYClient.hxx @@ -26,12 +26,12 @@ public: void fillCopy(); void blankCopy(); - med_int getNumberOf(medEntityMesh Entity, medGeometryElement Type) const; + int getNumberOf(medEntityMesh Entity, medGeometryElement Type) const; - const med_int * getConnectivity (medConnectivity ConnectivityType, + const int * getConnectivity (medConnectivity ConnectivityType, medEntityMesh Entity, medGeometryElement Type); - const med_int * getConnectivityIndex (medConnectivity ConnectivityType, + const int * getConnectivityIndex (medConnectivity ConnectivityType, medEntityMesh Entity); void calculateConnectivity (medConnectivity connectivityType, @@ -44,19 +44,19 @@ public: bool existConnectivity(medConnectivity ConnectivityType, medEntityMesh Entity) const; - const med_int* getReverseConnectivity (medConnectivity ConnectivityType, + const int* getReverseConnectivity (medConnectivity ConnectivityType, medEntityMesh Entity=MED_CELL) throw (MEDEXCEPTION); - const med_int* getReverseConnectivityIndex (medConnectivity ConnectivityType, + const int* getReverseConnectivityIndex (medConnectivity ConnectivityType, medEntityMesh Entity=MED_CELL) throw (MEDEXCEPTION); - const med_int* getValue (medConnectivity TypeConnectivity, + const int* getValue (medConnectivity TypeConnectivity, medGeometryElement Type); - const med_int* getValueIndex (medConnectivity TypeConnectivity); - const med_int* getNeighbourhood() const; + const int* getValueIndex (medConnectivity TypeConnectivity); + const int* getNeighbourhood() const; }; }; diff --git a/src/MedClient/src/COORDINATEClient.cxx b/src/MedClient/src/COORDINATEClient.cxx index cd9c1b3bb..a07c73c10 100644 --- a/src/MedClient/src/COORDINATEClient.cxx +++ b/src/MedClient/src/COORDINATEClient.cxx @@ -6,6 +6,8 @@ #include "ReceiverFactory.hxx" using namespace MEDMEM; +using namespace MED_EN; + //============================================================================= /*! * Constructeur diff --git a/src/MedClient/src/COORDINATEClient.hxx b/src/MedClient/src/COORDINATEClient.hxx index 51037c880..698bda285 100644 --- a/src/MedClient/src/COORDINATEClient.hxx +++ b/src/MedClient/src/COORDINATEClient.hxx @@ -24,7 +24,7 @@ public: Parameters in : m (Mesh Corba IOR) mode (FULL_ or NO_ interlace) */ - COORDINATEClient(const SALOME_MED::MESH_ptr m, medModeSwitch Mode); + COORDINATEClient(const SALOME_MED::MESH_ptr m, MED_EN::medModeSwitch Mode); /*! @@ -50,7 +50,7 @@ public: virtual ~COORDINATEClient() {}; - virtual const double * getCoordinates(medModeSwitch Mode); + virtual const double * getCoordinates(MED_EN::medModeSwitch Mode); virtual double getCoordinate(int Number,int Axis); virtual const double * getCoordinateAxis(int Axis); virtual const int* getNodesNumbers() const; diff --git a/src/MedClient/src/FIELDClient.cxx b/src/MedClient/src/FIELDClient.cxx index a859c6039..1d49cd830 100644 --- a/src/MedClient/src/FIELDClient.cxx +++ b/src/MedClient/src/FIELDClient.cxx @@ -1,24 +1,20 @@ -//#include "ReceiverFactory.hxx" - -//using namespace MEDMEM; - template -FIELDClient::FIELDClient(typename T2::_ptr_type ptrCorba,SUPPORT * S):_fieldPtr(T2::_duplicate(ptrCorba)),_ownSupport(false) +FIELDClient::FIELDClient(typename T2::_ptr_type ptrCorba,MEDMEM::SUPPORT * S):_fieldPtr(T2::_duplicate(ptrCorba)),_ownSupport(false) { if (!S) { _ownSupport=true; - S=new SUPPORTClient(_fieldPtr->getSupport()); + S=new MEDMEM::SUPPORTClient(_fieldPtr->getSupport()); } - FIELD::setSupport(S); + MEDMEM::FIELD::setSupport(S); setName(_fieldPtr->getName()); - FIELD::setDescription(_fieldPtr->getDescription()); + MEDMEM::FIELD::setDescription(_fieldPtr->getDescription()); int nc = _fieldPtr->getNumberOfComponents(); - FIELD::setNumberOfComponents(nc); + MEDMEM::FIELD::setNumberOfComponents(nc); - FIELD::setNumberOfValues( S->getNumberOfElements(MED_ALL_ELEMENTS)); + MEDMEM::FIELD::setNumberOfValues( S->getNumberOfElements(MED_EN::MED_ALL_ELEMENTS)); string * _s = new string[nc]; @@ -26,17 +22,17 @@ FIELDClient::FIELDClient(typename T2::_ptr_type ptrCorba,SUPPORT * S):_fi s = _fieldPtr->getComponentsNames(); for (int i=0; i::setComponentsNames(_s); + MEDMEM::FIELD::setComponentsNames(_s); s = _fieldPtr->getComponentsDescriptions(); for (int i=0; i::setComponentsDescriptions(_s); + MEDMEM::FIELD::setComponentsDescriptions(_s); s = _fieldPtr->getComponentsUnits(); for (int i=0; i::setMEDComponentsUnits(_s); + MEDMEM::FIELD::setMEDComponentsUnits(_s); delete [] _s; @@ -56,8 +52,8 @@ void FIELDClient::fillCopy() //setValueType(typeChamps); WARNING TO DO..... //setValueType(_fieldPtr->getValueType()); long n; - T1 *v = (T1 *)ReceiverFactory::getValue(_fieldPtr->getSenderForValue(MED_FULL_INTERLACE),n); - MEDARRAY * M = new MEDARRAY(v, FIELD::getNumberOfComponents(),FIELD::getNumberOfValues(),MED_FULL_INTERLACE,true,true); + T1 *v = (T1 *)ReceiverFactory::getValue(_fieldPtr->getSenderForValue(MED_EN::MED_FULL_INTERLACE),n); + MEDMEM::MEDARRAY * M = new MEDMEM::MEDARRAY(v, MEDMEM::FIELD::getNumberOfComponents(),MEDMEM::FIELD::getNumberOfValues(),MED_EN::MED_FULL_INTERLACE,true,true); setValue(M); } @@ -67,6 +63,6 @@ FIELDClient::~FIELDClient() _fieldPtr->release(); CORBA::release(_fieldPtr); if(_ownSupport) - delete FIELD::_support; + delete MEDMEM::FIELD::_support; } diff --git a/src/MedClient/src/FIELDClient.hxx b/src/MedClient/src/FIELDClient.hxx index 08cf70ce1..b17def5fb 100644 --- a/src/MedClient/src/FIELDClient.hxx +++ b/src/MedClient/src/FIELDClient.hxx @@ -11,13 +11,13 @@ //exemple _FIELDClient //_FIELDClient template -class FIELDClient : public FIELD +class FIELDClient : public MEDMEM::FIELD { private: typename T2::_ptr_type _fieldPtr; bool _ownSupport; public: - FIELDClient(typename T2::_ptr_type ptrCorba,SUPPORT * S = NULL); + FIELDClient(typename T2::_ptr_type ptrCorba,MEDMEM::SUPPORT * S = NULL); ~FIELDClient(); private: void fillCopy(); diff --git a/src/MedClient/src/FIELDDOUBLEClient.cxx b/src/MedClient/src/FIELDDOUBLEClient.cxx index 3428c2101..b60eb352c 100644 --- a/src/MedClient/src/FIELDDOUBLEClient.cxx +++ b/src/MedClient/src/FIELDDOUBLEClient.cxx @@ -6,7 +6,7 @@ */ //============================================================================= FIELDDOUBLEClient::FIELDDOUBLEClient(SALOME_MED::FIELDDOUBLE_ptr ptrCorba, - SUPPORT * S) : + MEDMEM::SUPPORT * S) : FIELDClient(ptrCorba,S) { BEGIN_OF("Constructor with arguments (for Python API) FIELDDOUBLEClient"); diff --git a/src/MedClient/src/FIELDINTClient.cxx b/src/MedClient/src/FIELDINTClient.cxx index 756156dd8..7668ff74e 100644 --- a/src/MedClient/src/FIELDINTClient.cxx +++ b/src/MedClient/src/FIELDINTClient.cxx @@ -6,7 +6,7 @@ */ //============================================================================= FIELDINTClient::FIELDINTClient(SALOME_MED::FIELDINT_ptr ptrCorba, - SUPPORT * S) : + MEDMEM::SUPPORT * S) : FIELDClient(ptrCorba,S) { BEGIN_OF("Constructor with arguments (for Python API) FIELDINTClient"); diff --git a/src/MedClient/src/MESHClient.cxx b/src/MedClient/src/MESHClient.cxx index 8fa64f3b2..70b5a1dd7 100644 --- a/src/MedClient/src/MESHClient.cxx +++ b/src/MedClient/src/MESHClient.cxx @@ -5,6 +5,10 @@ #include "CONNECTIVITYClient.hxx" #include "FAMILYClient.hxx" #include "GROUPClient.hxx" + +using namespace MEDMEM; +using namespace MED_EN; + //============================================================================= /*! * Constructeur diff --git a/src/MedClient/src/Makefile.in b/src/MedClient/src/Makefile.in index f1326db2f..944b2cc23 100644 --- a/src/MedClient/src/Makefile.in +++ b/src/MedClient/src/Makefile.in @@ -78,6 +78,8 @@ BIN_SRC = BIN_SERVER_IDL = BIN_CLIENT_IDL = +LDFLAGS= -L$(top_builddir)/lib/salome +LDFLAGSFORBIN= -L$(top_builddir)/lib/salome CPPFLAGS+= $(MED2_INCLUDES) $(HDF5_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS+=-I${KERNEL_ROOT_DIR}/include/salome diff --git a/src/MedClient/src/SUPPORTClient.cxx b/src/MedClient/src/SUPPORTClient.cxx index 0ed41de8d..3d60a2954 100644 --- a/src/MedClient/src/SUPPORTClient.cxx +++ b/src/MedClient/src/SUPPORTClient.cxx @@ -5,6 +5,7 @@ #include "ReceiverFactory.hxx" using namespace MEDMEM; +using namespace MED_EN; //============================================================================= /*! diff --git a/src/MedClient/src/SUPPORTClient.hxx b/src/MedClient/src/SUPPORTClient.hxx index 24aa4cb9f..ea490ef21 100644 --- a/src/MedClient/src/SUPPORTClient.hxx +++ b/src/MedClient/src/SUPPORTClient.hxx @@ -29,7 +29,7 @@ public : MEDSKYLINEARRAY * getnumber() const throw (MEDEXCEPTION); - const int * getNumber(medGeometryElement GeometricType) + const int * getNumber(MED_EN::medGeometryElement GeometricType) const throw (MEDEXCEPTION); const int * getNumberIndex() const throw (MEDEXCEPTION); diff --git a/src/MedClient/src/libMEDClient.i b/src/MedClient/src/libMEDClient.i index 408f846e9..df63110be 100644 --- a/src/MedClient/src/libMEDClient.i +++ b/src/MedClient/src/libMEDClient.i @@ -8,6 +8,9 @@ #include CORBA_CLIENT_HEADER(MED) /* #define FIELDDOUBLEClient FIELDClient */ /* #define FIELDINTClient FIELDClient */ + + using namespace MEDMEM; + using namespace MED_EN; %} %include "libMedCorba_Swig.i" diff --git a/src/MedClient/test/test1/TestMedCorba1.py b/src/MedClient/test/test1/TestMedCorba1.py index c62ef22ce..2085039c7 100644 --- a/src/MedClient/test/test1/TestMedCorba1.py +++ b/src/MedClient/test/test1/TestMedCorba1.py @@ -24,7 +24,7 @@ mLocal.read() from omniORB import CORBA from LifeCycleCORBA import * -from libSALOME_Swig import * +#CCRTfrom libSALOME_Swig import * orb = CORBA.ORB_init([''], CORBA.ORB_ID) lcc = LifeCycleCORBA(orb) diff --git a/src/MedClient/test/test2/Compo2.cxx b/src/MedClient/test/test2/Compo2.cxx index f9abdd2a1..ac60fca83 100644 --- a/src/MedClient/test/test2/Compo2.cxx +++ b/src/MedClient/test/test2/Compo2.cxx @@ -7,6 +7,9 @@ #include #include +using namespace MEDMEM; +using namespace MED_EN; + Compo2::Compo2() : _F(NULL) { } diff --git a/src/MedClient/test/test2/Compo2.hxx b/src/MedClient/test/test2/Compo2.hxx index c296dbb9a..a579ca992 100644 --- a/src/MedClient/test/test2/Compo2.hxx +++ b/src/MedClient/test/test2/Compo2.hxx @@ -10,15 +10,15 @@ class Compo2 { - FIELD * _F; + MEDMEM::FIELD * _F; public: Compo2(); ~Compo2(); - std::string Calcul(const MESH &M); - const FAMILY * Calcul2(const MESH &M); - void Calcul3(const FIELD &S); + std::string Calcul(const MEDMEM::MESH &M); + const MEDMEM::FAMILY * Calcul2(const MEDMEM::MESH &M); + void Calcul3(const MEDMEM::FIELD &S); }; #endif diff --git a/src/MedClient/test/test2/Makefile.in b/src/MedClient/test/test2/Makefile.in index 43d046a9a..55e46f1a2 100644 --- a/src/MedClient/test/test2/Makefile.in +++ b/src/MedClient/test/test2/Makefile.in @@ -42,6 +42,9 @@ LIB = libCompo2cmodule.la LIB_SRC = Compo2.cxx LIB_CLIENT_IDL= SALOME_Component.idl SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl SALOME_Comm.idl MED.idl +LDFLAGS= -L$(top_builddir)/lib/salome +LDFLAGSFORBIN= -L$(top_builddir)/lib/salome + CPPFLAGS += ${MED2_INCLUDES} ${HDF5_INCLUDES} ${PYTHON_INCLUDES} -I${KERNEL_ROOT_DIR}/include/salome LIBS = -L${KERNEL_ROOT_DIR}/lib/salome -lMEDClientcmodule -lMEDMEM_Swigcmodule -lmedmem -lMEDMEMImpl ${MED2_LIBS} ${HDF5_LIBS} diff --git a/src/MedClient/test/test2/libCompo2.i b/src/MedClient/test/test2/libCompo2.i index a43ee3d18..c4bab3631 100644 --- a/src/MedClient/test/test2/libCompo2.i +++ b/src/MedClient/test/test2/libCompo2.i @@ -2,6 +2,9 @@ %{ #include "Compo2.hxx" + + using namespace MEDMEM; + using namespace MED_EN; %} %include "std_string.i" diff --git a/src/MedCorba_Swig/Makefile.in b/src/MedCorba_Swig/Makefile.in index 3353a9e2a..71ab27776 100644 --- a/src/MedCorba_Swig/Makefile.in +++ b/src/MedCorba_Swig/Makefile.in @@ -50,6 +50,9 @@ EXPORT_HEADERS = libMedCorba_Swig.i ############################################################################# +LDFLAGS= -L$(top_builddir)/lib/salome +LDFLAGSFORBIN= -L$(top_builddir)/lib/salome + CPPFLAGS+= $(PYTHON_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS+=-ftemplate-depth-42 -I${KERNEL_ROOT_DIR}/include/salome LIBS= $(PYTHON_LIBS) diff --git a/src/MedCorba_Swig/libMedCorba_Swig.i b/src/MedCorba_Swig/libMedCorba_Swig.i index db16e3283..b005a2304 100644 --- a/src/MedCorba_Swig/libMedCorba_Swig.i +++ b/src/MedCorba_Swig/libMedCorba_Swig.i @@ -14,6 +14,9 @@ #include "MEDMEM_Support_i.hxx" #include "MEDMEM_SWIG_FieldDouble.hxx" #include "MEDMEM_SWIG_FieldInt.hxx" + + using namespace MEDMEM; + using namespace MED_EN; %} /*