From f437cc1b5e2f7feaced1f6e138ffec81822dd4b5 Mon Sep 17 00:00:00 2001 From: nadir Date: Tue, 27 Apr 2004 12:27:13 +0000 Subject: [PATCH] merging in the main branch with the branch br_MedFileV2_2. --- src/MED/Med_Gen_i.cxx | 2 +- src/MEDMEM/INTERPOLATION/Makefile.in | 4 +- .../INTERPOLATION/create_mesh_interpolation.c | 982 ++++++++-------- src/MEDMEM/MEDMEM_GenDriver.cxx | 16 +- src/MEDMEM/MEDMEM_Grid.cxx | 15 +- src/MEDMEM/MEDMEM_Grid.hxx | 33 +- src/MEDMEM/MEDMEM_Med.cxx | 9 +- src/MEDMEM/MEDMEM_MedFieldDriver.hxx | 82 +- src/MEDMEM/MEDMEM_MedMedDriver.cxx | 666 ++++++----- src/MEDMEM/MEDMEM_MedMeshDriver.cxx | 1028 ++++++++++------- src/MEDMEM/MEDMEM_Mesh.cxx | 23 +- src/MEDMEM/MEDMEM_Mesh.hxx | 16 +- src/MEDMEM/MEDMEM_Meshing.cxx | 23 +- src/MEDMEM/MEDMEM_Meshing.hxx | 2 +- src/MEDMEM/MEDMEM_define.hxx | 44 +- src/MEDMEM/create_grid.c | 229 ++-- src/MEDMEM/create_mesh.c | 113 +- src/MEDMEM/create_mesh_c2q4.c | 75 +- src/MEDMEM/create_mesh_c2q4s2.c | 77 +- src/MEDMEM/create_mesh_c2q4s2_wrong.c | 77 +- src/MEDMEM/create_mesh_c3h8.c | 71 +- src/MEDMEM/create_mesh_c3h8q4.c | 77 +- src/MEDMEM/create_mesh_c3h8q4_wrong.c | 77 +- src/MEDMEM_I/MEDMEM_Med_i.cxx | 4 +- src/MEDMEM_SWIG/libMEDMEM_Swig.i | 23 +- 25 files changed, 2167 insertions(+), 1601 deletions(-) diff --git a/src/MED/Med_Gen_i.cxx b/src/MED/Med_Gen_i.cxx index 1686174f3..8128a62d5 100755 --- a/src/MED/Med_Gen_i.cxx +++ b/src/MED/Med_Gen_i.cxx @@ -450,7 +450,7 @@ throw (SALOME::SALOME_Exception) }; break; } - case MED_FR::MED_REEL64: + case MED_FR::MED_FLOAT64: { try { diff --git a/src/MEDMEM/INTERPOLATION/Makefile.in b/src/MEDMEM/INTERPOLATION/Makefile.in index b3ff8292e..20a5571fe 100644 --- a/src/MEDMEM/INTERPOLATION/Makefile.in +++ b/src/MEDMEM/INTERPOLATION/Makefile.in @@ -81,9 +81,9 @@ UseCaseWrapper_Maillage CPPFLAGS+=-U_DEBUG_ $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I../ CXXFLAGS+=-U_DEBUG_ -ftemplate-depth-42 -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lSalomeLoggerServer -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lSALOMELocalTrace -L${KERNEL_ROOT_DIR}/lib/salome -LDFLAGSFORBIN+=$(MED2_LIBS) $(HDF5_LIBS) -L../.libs -lmedmem -lSalomeLoggerServer -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGSFORBIN+=$(MED2_LIBS) $(HDF5_LIBS) -L../.libs -lmedmem -lSALOMELocalTrace -L${KERNEL_ROOT_DIR}/lib/salome LIBSFORBIN= diff --git a/src/MEDMEM/INTERPOLATION/create_mesh_interpolation.c b/src/MEDMEM/INTERPOLATION/create_mesh_interpolation.c index f99bb91d0..963701980 100644 --- a/src/MEDMEM/INTERPOLATION/create_mesh_interpolation.c +++ b/src/MEDMEM/INTERPOLATION/create_mesh_interpolation.c @@ -1,523 +1,595 @@ #include #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 - /*****************************************************************************************************/ void affiche_noeuds(med_float * nodes,int nnpl) - { - int nbr_nodes=nnpl*nnpl*nnpl; - int i; - - for (i=0;i=3*nbr_nodes) {printf("%d : OUT OF RANGE REQUEST\n",num_noeud);exit(-1);} - if (3*num_noeud+1>=3*nbr_nodes) {printf("%d : OUT OF RANGE REQUEST\n",num_noeud);exit(-1);} - if (3*num_noeud+2>=3*nbr_nodes) {printf("%d : OUT OF RANGE REQUEST\n",num_noeud);exit(-1);} - - coord_nodes[3*num_noeud ]= (double) (i+flag)/diviseur; - coord_nodes[3*num_noeud+1]= (double) (j+flag)/diviseur; - coord_nodes[3*num_noeud+2]= (double) (k+flag)/diviseur; - } +{ + int i,j,k; + int nbr_nodes=nnpl*nnpl*nnpl; + int num_noeud; + int diviseur=nnpl-1+flag; + + /*coord_nodes=(med_float *) malloc(3*nbr_nodes*sizeof(med_float));*/ + + for (i=0;i=3*nbr_nodes) + {printf("%d : OUT OF RANGE REQUEST\n",num_noeud);exit(-1);} + if (3*num_noeud+1>=3*nbr_nodes) + {printf("%d : OUT OF RANGE REQUEST\n",num_noeud);exit(-1);} + if (3*num_noeud+2>=3*nbr_nodes) + {printf("%d : OUT OF RANGE REQUEST\n",num_noeud);exit(-1);} + + coord_nodes[3*num_noeud ]= (double) (i+flag)/diviseur; + coord_nodes[3*num_noeud+1]= (double) (j+flag)/diviseur; + coord_nodes[3*num_noeud+2]= (double) (k+flag)/diviseur; + } - affiche_noeuds(coord_nodes,nnpl); - - } + affiche_noeuds(coord_nodes,nnpl); + +} + void cree_num_nodes(med_int * num_nodes,int nnpl) - { - int nbr_nodes=nnpl*nnpl*nnpl; - int i; - /*num_nodes=(med_int *) malloc(nbr_nodes*sizeof(med_int));*/ - for (i=0;i=8*nbr_hexa8) {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);} - if (8*num_hexa8+1>=8*nbr_hexa8) {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);} - if (8*num_hexa8+2>=8*nbr_hexa8) {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);} - if (8*num_hexa8+3>=8*nbr_hexa8) {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);} - if (8*num_hexa8+4>=8*nbr_hexa8) {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);} - if (8*num_hexa8+5>=8*nbr_hexa8) {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);} - if (8*num_hexa8+6>=8*nbr_hexa8) {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);} - if (8*num_hexa8+7>=8*nbr_hexa8) {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);} + if (8*num_hexa8 >=8*nbr_hexa8) + {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);} + if (8*num_hexa8+1>=8*nbr_hexa8) + {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);} + if (8*num_hexa8+2>=8*nbr_hexa8) + {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);} + if (8*num_hexa8+3>=8*nbr_hexa8) + {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);} + if (8*num_hexa8+4>=8*nbr_hexa8) + {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);} + if (8*num_hexa8+5>=8*nbr_hexa8) + {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);} + if (8*num_hexa8+6>=8*nbr_hexa8) + {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);} + if (8*num_hexa8+7>=8*nbr_hexa8) + {printf("%d : OUT OF RANGE REQUEST\n",num_hexa8);exit(-1);} - conn_hexa8[8*num_hexa8 ] = num_nodes[ i0+nnpl*j1+nnpl*nnpl*k1 ]; - conn_hexa8[8*num_hexa8+1] = num_nodes[ i0+nnpl*j0+nnpl*nnpl*k1 ]; - conn_hexa8[8*num_hexa8+2] = num_nodes[ i1+nnpl*j0+nnpl*nnpl*k1 ]; - conn_hexa8[8*num_hexa8+3] = num_nodes[ i1+nnpl*j1+nnpl*nnpl*k1 ]; - conn_hexa8[8*num_hexa8+4] = num_nodes[ i0+nnpl*j1+nnpl*nnpl*k0 ]; - conn_hexa8[8*num_hexa8+5] = num_nodes[ i0+nnpl*j0+nnpl*nnpl*k0 ]; - conn_hexa8[8*num_hexa8+6] = num_nodes[ i1+nnpl*j0+nnpl*nnpl*k0 ]; - conn_hexa8[8*num_hexa8+7] = num_nodes[ i1+nnpl*j1+nnpl*nnpl*k0 ]; + conn_hexa8[8*num_hexa8 ] = num_nodes[ i0+nnpl*j1+nnpl*nnpl*k1 ]; + conn_hexa8[8*num_hexa8+1] = num_nodes[ i0+nnpl*j0+nnpl*nnpl*k1 ]; + conn_hexa8[8*num_hexa8+2] = num_nodes[ i1+nnpl*j0+nnpl*nnpl*k1 ]; + conn_hexa8[8*num_hexa8+3] = num_nodes[ i1+nnpl*j1+nnpl*nnpl*k1 ]; + conn_hexa8[8*num_hexa8+4] = num_nodes[ i0+nnpl*j1+nnpl*nnpl*k0 ]; + conn_hexa8[8*num_hexa8+5] = num_nodes[ i0+nnpl*j0+nnpl*nnpl*k0 ]; + conn_hexa8[8*num_hexa8+6] = num_nodes[ i1+nnpl*j0+nnpl*nnpl*k0 ]; + conn_hexa8[8*num_hexa8+7] = num_nodes[ i1+nnpl*j1+nnpl*nnpl*k0 ]; - } + } - for (num_hexa8=0;num_hexa8 0 + - les numeros de familles des elements sont < 0 + - rien d'imposer sur les noms de familles + */ + + /* la famille 0 */ + + if (ret == 0) + { + strcpy(nomfam,"FAMILLE_0"); + numfam = 0; + ret = MEDfamCr(fromfid,frommaa,nomfam,numfam,&attide,&attval,attdes,0, + gro,0); + } + + printf("MEDfamCr : %d \n",ret); + /*****************************************************************************************************/ + if (ret == 0) + { + strcpy(nomfam,"FAMILLE_0"); + numfam = 0; + ret = MEDfamCr(tofid,tomaa,nomfam,numfam,&attide,&attval,attdes,0,gro,0); + } + + printf("MEDfamCr : %d \n",ret); + /*****************************************************************************************************/ + /* Les champs */ + + if (ret == 0) + { + 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_NOGAUSS, + MED_ALL, MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0, + MED_NOPDT," ", 0. , MED_NONOR); -/*****************************************************************************************************/ - tofid = MEDouvrir("toMesh.med",MED_REMP); - if (tofid < 0) - ret = -1; - else - ret = 0; - printf("MEDouvrir : %d\n",ret); -/*****************************************************************************************************/ - if (ret == 0) - ret = MEDmaaCr(fromfid,frommaa,mdim); - printf("MEDmaaCr : %d\n",ret); + printf("MEDchampEcr : %d \n",ret); + } + } -/*****************************************************************************************************/ + if (ret == 0) + { + ret = MEDchampCr(fromfid,champcell,MED_FLOAT64,champcell_comp, + champcell_unit,3); - if (ret == 0) - ret = MEDmaaCr(tofid,tomaa,mdim); - printf("MEDmaaCr : %d\n",ret); + printf("MEDchampCr : %d \n",ret); -/*****************************************************************************************************/ - if (ret == 0) - 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); - printf("MEDnoeudsEcr : %d\n",ret); -/*****************************************************************************************************/ + if (ret == 0) + { + ret = MEDchampEcr(fromfid, frommaa, champcell, + (unsigned char *)fieldcelldoublevector, + MED_FULL_INTERLACE, fromnhexa8, MED_NOGAUSS, + MED_ALL, MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, + MED_HEXA8, MED_NOPDT," ", 0., MED_NONOR); - if (ret == 0) - 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); - printf("MEDnoeudsEcr : %d\n",ret); + printf("MEDchampEcr : %d \n",ret); + } + } + + if (ret == 0) + { + ret = MEDchampCr(fromfid,champcellscalar,MED_FLOAT64, + champcellscalar_comp,champcellscalar_unit,1); + printf("MEDchampCr : %d \n",ret); -/*****************************************************************************************************/ -/* ecriture des mailles MED_HEXA8 : - - connectivite - - noms (optionnel) - - numeros (optionnel) - - numeros des familles */ - 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); - printf("MEDelementsEcr : %d \n",ret); + if (ret == 0) + { + ret = MEDchampEcr(fromfid, frommaa, champcellscalar, + (unsigned char *)fieldcelldouble, + MED_FULL_INTERLACE, fromnhexa8, MED_NOGAUSS, + MED_ALL, MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, + MED_HEXA8, MED_NOPDT," ", 0., MED_NONOR); -/*****************************************************************************************************/ -/* ecriture des mailles MED_HEXA8 : - - connectivite - - noms (optionnel) - - numeros (optionnel) - - numeros des familles */ + printf("MEDchampEcr : %d \n",ret); + } + } + + if (ret == 0) + { + 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_NOGAUSS, + MED_ALL, MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, + 0, MED_NOPDT," ", 0. , MED_NONOR); - 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); - printf("MEDelementsEcr : %d \n",ret); + printf("MEDchampEcr : %d \n",ret); + } + } + + + /***************************************************************************/ + ret = MEDfermer(fromfid); -/*****************************************************************************************************/ -/* 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) - - 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) - { - strcpy(nomfam,"FAMILLE_0"); - numfam = 0; - ret = MEDfamCr(fromfid,frommaa,nomfam,numfam,&attide,&attval,attdes,0,gro,0); - } - printf("MEDfamCr : %d \n",ret); -/*****************************************************************************************************/ + printf("MEDfermer : %d\n",ret); + /***************************************************************************/ + ret = MEDfermer(tofid); - if (ret == 0) - { - strcpy(nomfam,"FAMILLE_0"); - numfam = 0; - ret = MEDfamCr(tofid,tomaa,nomfam,numfam,&attide,&attval,attdes,0,gro,0); - } - printf("MEDfamCr : %d \n",ret); + printf("MEDfermer : %d\n",ret); -/*****************************************************************************************************/ -/* Les champs */ - - if (ret == 0) - { - ret = MEDchampCr(fromfid,champnode,MED_REEL64,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, - 0, MED_NOPDT," ", 0. , MED_NONOR); - printf("MEDchampEcr : %d \n",ret); - } - } - - if (ret == 0) - { - ret = MEDchampCr(fromfid,champcell,MED_REEL64,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_HEXA8, MED_NOPDT," ", 0., MED_NONOR); - printf("MEDchampEcr : %d \n",ret); - } - } - - if (ret == 0) - { - ret = MEDchampCr(fromfid,champcellscalar,MED_REEL64,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_HEXA8, MED_NOPDT," ", 0., MED_NONOR); - printf("MEDchampEcr : %d \n",ret); - } - } - - if (ret == 0) - { - ret = MEDchampCr(fromfid,champnodevector,MED_REEL64,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, - 0, MED_NOPDT," ", 0. , MED_NONOR); - printf("MEDchampEcr : %d \n",ret); - } - } - - -/***************************************************************************/ -ret = MEDfermer(fromfid); -printf("MEDfermer : %d\n",ret); -/***************************************************************************/ -ret = MEDfermer(tofid); -printf("MEDfermer : %d\n",ret); - -return 0; + return 0; } diff --git a/src/MEDMEM/MEDMEM_GenDriver.cxx b/src/MEDMEM/MEDMEM_GenDriver.cxx index e99ec8af4..cff81aed6 100644 --- a/src/MEDMEM/MEDMEM_GenDriver.cxx +++ b/src/MEDMEM/MEDMEM_GenDriver.cxx @@ -115,25 +115,27 @@ ostream & MEDMEM::operator<<(ostream &os,const GENDRIVER & drv) switch (drv._accessMode) { case MED_RDONLY : - os<<"C'est un IO de READ"< MED::getMeshNames () const { MESH * MED::getMesh ( const string & meshName ) const throw (MED_EXCEPTION) { - const char * LOC = "MED::getMesh ( const string & meshName ) const : "; BEGIN_OF(LOC); + SCRUTE(meshName); + map::const_iterator itMeshes = _meshes.find(meshName); if ( itMeshes == _meshes.end() ) diff --git a/src/MEDMEM/MEDMEM_MedFieldDriver.hxx b/src/MEDMEM/MEDMEM_MedFieldDriver.hxx index a95deb874..9ecc949dd 100644 --- a/src/MEDMEM/MEDMEM_MedFieldDriver.hxx +++ b/src/MEDMEM/MEDMEM_MedFieldDriver.hxx @@ -478,19 +478,32 @@ template void MED_FIELD_RDONLY_DRIVER::read(void) for (int i=0; i_support->getEntity()); - NumberOfValues[i] = - MEDnVal(_medIdt, - const_cast (_fieldName.c_str()), - (MED_FR::med_entite_maillage)_ptrField->_support->getEntity(), - (MED_FR::med_geometrie_element)Types[i], - _ptrField->_iterationNumber, - _ptrField->_orderNumber) ; // no time step ! prend en compte le nbre de pt de gauss +// NumberOfValues[i] = +// MEDnVal(_medIdt, +// const_cast (_fieldName.c_str()), +// (MED_FR::med_entite_maillage)_ptrField->_support->getEntity(), +// (MED_FR::med_geometrie_element)Types[i], +// _ptrField->_iterationNumber, +// _ptrField->_orderNumber) ; // no time step ! prend en compte le nbre de pt de gauss // test if NumberOfValues is the same in _support !!! TODO that !! // we suppose it is // we could allocate array + // Be really carefull about the profil; especially the last arg of + // MEDnVal + + NumberOfValues[i] = + MEDnVal(_medIdt, + const_cast (_fieldName.c_str()), + (MED_FR::med_entite_maillage)_ptrField->_support->getEntity(), + (MED_FR::med_geometrie_element) Types[i], + _ptrField->_iterationNumber, _ptrField->_orderNumber, + const_cast (_ptrField->_support->getMesh()->getName().c_str()), + MED_FR::MED_COMPACT) ; + myValues[i] = new T[ NumberOfValues[i]*numberOfComponents ] ; TotalNumberOfValues+=NumberOfValues[i] ;// diviser par le nombre de point de gauss char * ProfilName = new char[MED_TAILLE_NOM+1]; + char * LocalGaussName = new char[MED_TAILLE_NOM+1]; MESSAGE ("NumberOfValues :"<< NumberOfValues[i]); MESSAGE ("NumberOfComponents :"<< numberOfComponents); MESSAGE ("MESH_NAME :"<< MeshName.c_str()); @@ -500,22 +513,25 @@ template void MED_FIELD_RDONLY_DRIVER::read(void) MESSAGE("Iteration :"<<_ptrField->getIterationNumber()); MESSAGE("Order :"<<_ptrField->getOrderNumber()); _ptrField->_numberOfValues+=NumberOfValues[i]; // problem with gauss point : _numberOfValues != TotalNumberOfValues !!!!!!! - if ( MED_FR::MEDchampLire(_medIdt,const_cast (MeshName.c_str()), - const_cast (_fieldName.c_str()), - (unsigned char*) myValues[i], - MED_FR::MED_NO_INTERLACE, - MED_ALL, - ProfilName, - (MED_FR::med_entite_maillage) _ptrField->_support->getEntity(),(MED_FR::med_geometrie_element)Types[i], - _ptrField->getIterationNumber(), - _ptrField->getOrderNumber() - ) < 0) { + + err = MEDchampLire(_medIdt,const_cast (MeshName.c_str()), + const_cast (_fieldName.c_str()), + (unsigned char*) myValues[i], + MED_FR::MED_NO_INTERLACE,MED_ALL, + LocalGaussName,ProfilName, + MED_FR::MED_NO_PFLMOD, + (MED_FR::med_entite_maillage) _ptrField->_support->getEntity(),(MED_FR::med_geometrie_element)Types[i], + _ptrField->getIterationNumber(), + _ptrField->getOrderNumber()); + + if ( err < 0) { // we must do some delete !!! for(int j=0; j<=i;j++) delete[] myValues[j]; delete[] myValues; delete[] NumberOfValues ; delete[] ProfilName; + delete[] LocalGaussName; delete[] _ptrField->_componentsTypes ; delete[] _ptrField->_componentsNames ; delete[] _ptrField->_componentsUnits ; @@ -530,7 +546,10 @@ template void MED_FIELD_RDONLY_DRIVER::read(void) throw MEDEXCEPTION( LOCALIZED( STRING(LOC) <<": ERROR when read value")) ; } + // At this time ProfilName should be MED_FR::MED_NOPFL and + // LocalGaussName should be MED_FR::MED_NOGAUSS delete[] ProfilName ; + delete[] LocalGaussName ; } // allocate _value // probleme avec les points de gauss : voir lorsqu-il y en a (!= 1) @@ -743,16 +762,32 @@ template void MED_FIELD_WRONLY_DRIVER::write(void) const cout<<"==================> valeur de MED_FR::MED_REEL64 = "< ( MeshName.c_str()) , //( string(mesh_name).resize(MED_TAILLE_NOM).c_str()) +// const_cast ( (_ptrField->getName()).c_str()), +// (unsigned char*)value, +// MED_FR::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], +// _ptrField->getIterationNumber(), +// " ", +// _ptrField->getTime(), +// _ptrField->getOrderNumber() +// ); + err=MED_FR::MEDchampEcr(_medIdt, const_cast ( MeshName.c_str()) , //( string(mesh_name).resize(MED_TAILLE_NOM).c_str()) const_cast ( (_ptrField->getName()).c_str()), - (unsigned char*)value, + (unsigned char*)value, MED_FR::MED_FULL_INTERLACE, - NumberOfElements, - NumberOfGaussPoint[i], - MED_ALL, - MED_NOPFL, - MED_FR::MED_REMP, // PROFIL NON GERE, mode de remplacement non géré + NumberOfElements*NumberOfGaussPoint[i], + MED_NOGAUSS, MED_ALL, MED_NOPFL, + MED_FR::MED_NO_PFLMOD, // PROFIL NON GERE, mode de remplacement non géré (MED_FR::med_entite_maillage)mySupport->getEntity(), (MED_FR::med_geometrie_element)Types[i], _ptrField->getIterationNumber(), @@ -760,6 +795,7 @@ template void MED_FIELD_WRONLY_DRIVER::write(void) const _ptrField->getTime(), _ptrField->getOrderNumber() ); + if (err < MED_VALID ) throw MEDEXCEPTION(LOCALIZED( STRING(LOC) <<": Error in writing Field "<< _ptrField->getName() <<", type "<getIsAGrid(); + +// MED_FR::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) ; - if (err != MED_VALID) - throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) << ": can't get information about the mesh n°" - << i <<" of the file |" << _fileName << "| !" - ) - ); - MESSAGE(LOC<<": Mesh n°"<setId ( getId() ); - ptrDriver->setMeshName ( meshName ); - ptrMesh->addDriver(*ptrDriver); - delete ptrDriver ; - - if (isAGrid) - _ptrMed->_meshes[meshName] = (MESH *) ptrMesh; - else +// 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) ; +// if (err != MED_VALID) +// throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) << ": can't get information about the mesh n°" +// << i <<" of the file |" << _fileName << "| !" +// ) +// ); +// MESSAGE(LOC<<": Mesh n°"<V2_2 + case MED_EN::MED_LECTURE: + ptrDriver = new MED_MESH_RDONLY_DRIVER(_fileName, ptrMesh); + break ; + // case MED_EN::MED_REMP: V2_1->V2_2 + case MED_EN::MED_LECTURE_ECRITURE: + ptrDriver = new MED_MESH_RDWR_DRIVER(_fileName, ptrMesh); + break ; + // case MED_EN::MED_ECRI: // should never append !! V2_1->V2_2 + case MED_EN::MED_LECTURE_AJOUT: // should never append !! + // ptrDriver = new MED_MESH_RDONLY_DRIVER(_fileName, ptrMesh); + ptrDriver = new MED_MESH_WRONLY_DRIVER(_fileName, ptrMesh); + break; + case MED_EN::MED_CREATION: // V2_1->V2_2 + ptrDriver = new MED_MESH_WRONLY_DRIVER(_fileName, ptrMesh); + break; + default: + throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Bad file mode access !")); + } + ptrDriver->setId ( getId() ); + ptrDriver->setMeshName ( meshName ); + ptrMesh->addDriver(*ptrDriver); + delete ptrDriver ; + + if (isAGrid) + _ptrMed->_meshes[meshName] = (MESH *) ptrMesh; + else + _ptrMed->_meshes[meshName] = ptrMesh; + _ptrMed->_meshes[meshName] = ptrMesh; - ptrMesh->setName(meshName); - - SCRUTE(ptrMesh); - - MESSAGE(LOC<<"is" << (isAGrid ? "" : " NOT") << " a GRID and its name is "<getName()); - - // we create all global support (for each entity type : - 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) ; - 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 ; - MESSAGE(LOC<< "The support " << supportName.c_str() << " on entity " << (*currentEntity).first << " is built"); - index++; + ptrMesh->setName(meshName); + + ptrMesh->setDescription(meshDescription); + + SCRUTE(ptrMesh); + + MESSAGE(LOC<<"is" << (isAGrid ? "" : " NOT") << " a GRID and its name is "<getName()); + + // we create all global support (for each entity type : + 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) ; + 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 ; + MESSAGE(LOC<< "The support " << supportName.c_str() << " on entity " << (*currentEntity).first << " is built"); + index++; + } + MESSAGE(LOC <<"The mesh " <getName() << " has " << index << " support(s)"); } - MESSAGE(LOC <<"The mesh " <getName() << " has " << index << " support(s)"); - } map >::const_iterator const_itSupportOnMesh ; @@ -340,219 +386,319 @@ void MED_MED_RDONLY_DRIVER::readFileStruct( void ) char timeStepUnit[MED_TAILLE_PNOM+1] ; double timeStep = 0.0; int orderNumber = -1; //???init????? + int numberOfRefMesh = 0; + MED_FR::med_booleen meshLink; map & _meshes = _ptrMed->_meshes; map & _fields = _ptrMed->_fields; map & _meshName = _ptrMed->_meshName; map > & _support = _ptrMed->_support; - numberOfFields = MEDnChamp(_medIdt,0) ; if ( numberOfFields <= 0 ) - MESSAGE(LOC << "Be careful there is no field in file |"<<_fileName<<"| !"); - - for (i=1;i<=numberOfFields;i++) { + MESSAGE(LOC << "Be careful there is no field in file |"<< + _fileName<<"| !"); - numberOfComponents = 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°" - << i << "in file |"<<_fileName<<"| !")); - - componentName = new char[numberOfComponents*MED_TAILLE_PNOM+1] ; - unitName = new char[numberOfComponents*MED_TAILLE_PNOM+1] ; - - err = MEDchampInfo(_medIdt, i, fieldName, &type, componentName, - unitName, numberOfComponents) ; + for (i=1;i<=numberOfFields;i++) + { + numberOfComponents = MEDnChamp(_medIdt,i) ; - if (err != MED_VALID) - throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) - << ": can't get information about the field n°" - << i <<" of the file |" << _fileName << "| !")); - - MESSAGE(LOC << "Field n°"< MED_VALID ) - break ; // There are value for some med_geometrie_element of this med_entite_maillage. - } - if (numberOfTimeSteps>0) // we have at least one + componentName = new char[numberOfComponents*MED_TAILLE_PNOM+1] ; + unitName = new char[numberOfComponents*MED_TAILLE_PNOM+1] ; + + err = MEDchampInfo(_medIdt, i, fieldName, &type, componentName, + unitName, numberOfComponents) ; + + if (err != MED_VALID) + throw MED_EXCEPTION(LOCALIZED(STRING(LOC) << ": can't get information about the field n°" << i <<" of the file |" << _fileName << "| !")); + + MESSAGE(LOC << "Field n°"< MED_VALID ) + break ; + // There are value for some med_geometrie_element of this + // med_entite_maillage. + } + if (numberOfTimeSteps>0) // we have at least one - for (currentGeometry = (*currentEntity).second.begin();currentGeometry != (*currentEntity).second.end(); currentGeometry++) { - - MESSAGE("Field information 3 : Geom : "<<(*currentGeometry)); - for (j=1;j <= numberOfTimeSteps; j++) { - - MESSAGE("Field information 4 : time step j = "<100) - NbOfGaussPts=1 ; - if (timeStepNumber<0) - timeStepNumber=-1 ; - + for (currentGeometry = (*currentEntity).second.begin(); + currentGeometry != (*currentEntity).second.end(); + currentGeometry++) + { + MESSAGE("Field information 3 : Geom : "<<(*currentGeometry)); + + for (j=1;j <= numberOfTimeSteps; j++) + { + MESSAGE("Field information 4 : time step j = "<addDriver(_ptrDriver); + // _fields[fieldName]=ptrField; - // Il faudra traiter le cas d'un champ qui utilise +sieurs (entity,geom) voir le travail de patrick - // Il faudra traiter le cas des profils... - // ptrField = new FIELD(); - // _ptrDriver = new MED_FIELD_RDWR_DRIVER(_fileName, ptrField); - // ptrField->addDriver(_ptrDriver); - // _fields[fieldName]=ptrField; + // Verify meshName is already known - // Verify meshName is already known - - map::iterator _meshesIt = _meshes.find(meshName); - if ( _meshesIt == _meshes.end() ) { - MESSAGE(LOC << "There is no mesh |" - << meshName <<"| in the file |" - << _fileName <<"|, but |" << meshName <<"| is referenced by field |" - << fieldName <<"|, entity : |" - << entNames [ (MED_FR::med_entite_maillage) (*currentEntity).first] <<"|, geometric element of type |" - << geoNames [ (MED_FR::med_geometrie_element) (*currentGeometry)] <<"|" - ); - } // POURQUOI SI JE NE MET PAS DE BLOCK J'AI UN PARSE ERROR : PG : c'est la macro MESSAGE qui fait ca ! - else - ptrMesh = _meshes[meshName]; - - ptrSupport = _support[meshName][(MED_FR::med_entite_maillage) (*currentEntity).first]; - if (NbOfGaussPts != 1) - throw MEDEXCEPTION(LOCALIZED( STRING(LOC) <<"Number of Gauss Point must be equal to 1 for instance")) ; - - // init to null to prevent some error if not correctly allocated ! - ptrField = (FIELD_*)NULL ; - ptrDriver = (GENDRIVER*)NULL ; - - switch ( type) { - case MED_FR::MED_INT64 : - if ( sizeof(MED_FR::med_int) != 8 ) - throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) << - " The Field type of |" - << fieldName <<"|, entity : |" - << entNames [(MED_FR::med_entite_maillage) (*currentEntity).first] <<"|, geometric element of type |" - << geoNames [(MED_FR::med_geometrie_element) (*currentGeometry) ] << - "| is MED_INT64 but size of med_int is not equal to 8 bytes !" - ) - ); - break; - case MED_FR::MED_INT32 : { -// throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) << -// "NOT IMPLEMENTED : BUG IN STL !") -// ) ; - // 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); - break ; - case MED_EN::MED_REMP: - 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); - break; - default: - throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Bad file mode access !")); + map::iterator _meshesIt = + _meshes.find(meshName); + if ( _meshesIt == _meshes.end() ) { + MESSAGE(LOC << "There is no mesh |" << meshName << + "| in the file |" << _fileName << + "|, but |" << meshName << + "| is referenced by field |" << + fieldName <<"|, entity : |" << + entNames [ (MED_FR::med_entite_maillage) + (*currentEntity).first] << + "|, geometric element of type |" << + geoNames [ (MED_FR::med_geometrie_element) + (*currentGeometry)] <<"|"); + } + // POURQUOI SI JE NE MET PAS DE BLOCK J'AI UN PARSE + // ERROR : PG : c'est la macro MESSAGE qui fait ca ! + else + ptrMesh = _meshes[meshName]; + + ptrSupport = _support[meshName][(MED_FR::med_entite_maillage) (*currentEntity).first]; + if (NbOfGaussPts != 1) + throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Number of Gauss Point must be equal to 1 for instance")) ; + + // init to null to prevent some error if not + // correctly allocated ! + + ptrField = (FIELD_*)NULL ; + ptrDriver = (GENDRIVER*)NULL ; + + switch ( type) { + case MED_FR::MED_INT64 : + if ( sizeof(MED_FR::med_int) != 8 ) + throw MED_EXCEPTION(LOCALIZED(STRING(LOC) <<" The Field type of |" << fieldName <<"|, entity : |" << entNames [(MED_FR::med_entite_maillage) (*currentEntity).first] <<"|, geometric element of type |" << geoNames [(MED_FR::med_geometrie_element) (*currentGeometry) ] << "| is MED_INT64 but size of med_int is not equal to 8 bytes !")); + break; + case MED_FR::MED_INT32 : { + // throw MED_EXCEPTION(LOCALIZED(STRING(LOC) << + // "NOT IMPLEMENTED : BUG IN STL !") + //) ; + // 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 : "<V2_2 + case MED_EN::MED_LECTURE: + ptrDriver = new + MED_FIELD_RDONLY_DRIVER + (_fileName, (FIELD *) + ptrField); + break ; + // case MED_EN::MED_REMP: V2_1->V2_2 + case MED_EN::MED_LECTURE_ECRITURE: + ptrDriver = new + MED_FIELD_RDWR_DRIVER + (_fileName, (FIELD *) + ptrField); + break ; + // case MED_EN::MED_ECRI: + // should never append !! V2_1->V2_2 + case MED_EN::MED_LECTURE_AJOUT: + // should never append !! + // ptrDriver = new + // MED_FIELD_RDONLY_DRIVER + // (_fileName, (FIELD *) + // ptrField); + ptrDriver = new + MED_FIELD_WRONLY_DRIVER + (_fileName, (FIELD *) + ptrField); + break; + case MED_EN::MED_CREATION: // V2_1->V2_2 + ptrDriver = new + MED_FIELD_WRONLY_DRIVER + (_fileName, (FIELD *) + ptrField); + break; + default: + throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Bad file mode access !")); + } + break; + } + case MED_EN::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 : "<V2_2 + case MED_EN::MED_LECTURE: + ptrDriver = new + MED_FIELD_RDONLY_DRIVER + (_fileName, (FIELD *) + ptrField); + break ; + // case MED_EN::MED_REMP: V2_1->V2_2 + case MED_EN::MED_LECTURE_ECRITURE: + ptrDriver = new + MED_FIELD_RDWR_DRIVER + (_fileName, (FIELD *) + ptrField); + break ; + // case MED_EN::MED_ECRI: + // should never append !! V2_1->V2_2 + case MED_EN::MED_LECTURE_AJOUT: + // should never append !! + // ptrDriver = new + // MED_FIELD_RDONLY_DRIVER + // (_fileName, (FIELD *) + // ptrField); + ptrDriver = new + MED_FIELD_WRONLY_DRIVER + (_fileName, (FIELD *) + ptrField); + break; + case MED_EN::MED_CREATION: + // should never append !! + ptrDriver = new + MED_FIELD_WRONLY_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 - MESSAGE("#### SET NAME in FIELD : "<(_fileName, (FIELD *)ptrField); - break ; - case MED_EN::MED_REMP: - 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); - break; - default: - throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Bad file mode access !")); - } - break; - } - default : { - if ( numberOfTimeSteps > 1) - throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) << - " The Field type of |" - << fieldName <<"|, entity : |" - << entNames [(MED_FR::med_entite_maillage) (*currentEntity).first] - <<"|, geometric element of type |" - << geoNames [(MED_FR::med_geometrie_element) (*currentGeometry)] - <<"| is neither MED_INT, MED_INT32, MED_INT64 nor MED_REEL64 !" - ) - ); - break ; - } - } - ptrField->setValueType((MED_EN::med_type_champ) type) ; // need to write field ! + break; + } + default : { + if ( numberOfTimeSteps > 1) + throw MED_EXCEPTION(LOCALIZED(STRING(LOC) << " The Field type of |" << fieldName <<"|, entity : |" << entNames [(MED_FR::med_entite_maillage) (*currentEntity).first] <<"|, geometric element of type |" << geoNames [(MED_FR::med_geometrie_element) (*currentGeometry)] <<"| is neither MED_INT, MED_INT32, MED_INT64 nor MED_REEL64 !")); + break ; + } + } + ptrField->setValueType((MED_EN::med_type_champ) + type) ; + // need to write field ! - MESSAGE("timeStepNumber :"<setIterationNumber ( timeStepNumber); // A ajouter dans la classe FIELD - ptrField->setOrderNumber ( orderNumber); - ptrField->setTime ( timeStep); + MESSAGE("timeStepNumber :"<setIterationNumber ( timeStepNumber); + // A ajouter dans la classe FIELD + ptrField->setOrderNumber ( orderNumber); + ptrField->setTime ( timeStep); - // Create a driver for this (field n°dt,n°it) - ptrDriver->setId ( getId() ); - MESSAGE("###### ptrDriver->setFieldName : #"<setFieldName(fieldName); - ptrField->addDriver(*ptrDriver); - // driver is duplicated : remove it - delete ptrDriver; - - DT_IT_ dtIt; - dtIt.dt = timeStepNumber; - dtIt.it = orderNumber; + // Create a driver for this (field n°dt,n°it) + ptrDriver->setId ( getId() ); + MESSAGE("###### ptrDriver->setFieldName : #"<< + fieldName<<"#"); + ptrDriver->setFieldName(fieldName); + ptrField->addDriver(*ptrDriver); + // driver is duplicated : remove it + delete ptrDriver; + + DT_IT_ dtIt; + dtIt.dt = timeStepNumber; + dtIt.it = orderNumber; - (_fields [fieldName])[dtIt] = ptrField; - _meshName[ptrField ] = meshName; - } - } + (_fields [fieldName])[dtIt] = ptrField; + _meshName[ptrField ] = meshName; + } + } + } } + delete[] componentName ; + delete[] unitName ; } - delete[] componentName ; - delete[] unitName ; - } } // read profil count and their names diff --git a/src/MEDMEM/MEDMEM_MedMeshDriver.cxx b/src/MEDMEM/MEDMEM_MedMeshDriver.cxx index 145f467c0..71a351db2 100644 --- a/src/MEDMEM/MEDMEM_MedMeshDriver.cxx +++ b/src/MEDMEM/MEDMEM_MedMeshDriver.cxx @@ -219,164 +219,166 @@ void MED_MESH_RDONLY_DRIVER::getGRID() GRID * ptrGrid = (GRID *) _ptrMesh; + SCRUTE(ptrGrid); + int err, i; - // Read the dimension of the space for the mesh <_meshName> - int SpaceDimension = MED_FR::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 << "|")) ; - _ptrMesh->_spaceDimension = SpaceDimension; + // Read the dimension of the mesh <_meshName> + int MeshDimension = MED_FR::MEDdimLire(_medIdt, const_cast + (_meshName.c_str())) ; - // Read Array length - int * ArrayLen[] = { & ptrGrid->_iArrayLength, - & ptrGrid->_jArrayLength, - & ptrGrid->_kArrayLength }; - int idim; - for (idim = 0; idim < _ptrMesh->_spaceDimension; ++idim) - { - int lenght = MED_FR::MEDnGrid(_medIdt, - const_cast (_ptrMesh->_name.c_str()), - (MED_FR::med_grid) - idim - ); - if ( lenght <= MED_VALID ) - throw MEDEXCEPTION(STRING(LOC) <<"The number of nodes |" << lenght << - "| seems to be incorrect " - << "for the mesh : |" << _meshName << "|" ) ; - - ArrayLen [idim][0] = lenght; - } + if (MeshDimension == MED_INVALID) + throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "The mesh dimension |" << + MeshDimension << "| seems to be incorrect " << + "for the mesh : |" << _meshName << "|")) ; + + _ptrMesh->_meshDimension = MeshDimension; + + // Read or get the dimension of the space for the mesh <_meshName> + int SpaceDimension = MeshDimension; + + int SpaceDimensionRead = MED_FR::MEDdimEspaceLire(_medIdt, + const_cast + (_meshName.c_str())) ; + + if (SpaceDimensionRead != MED_INVALID) SpaceDimension = SpaceDimensionRead; + + _ptrMesh->_spaceDimension = SpaceDimension; MED_FR::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()) ) ; char * tmp_unit= (const_cast ( tmp_unit_coord.c_str()) ) ; - - // Read node coordinates for MED_BODY_FITTED grid - SCRUTE(ptrGrid->getGridType()); + // Read Array length + int * ArrayLen[] = { & ptrGrid->_iArrayLength, + & ptrGrid->_jArrayLength, + & ptrGrid->_kArrayLength }; + + med_type_grille gridType = ptrGrid->getGridType(); - if (ptrGrid->getGridType() == MED_EN::MED_BODY_FITTED) + int NumberOfNodes; + + if (gridType == MED_EN::MED_GRILLE_STANDARD) { - // Read nb of nodes - int NumberOfNodes = MED_FR::MEDnGrid(_medIdt, - const_cast (_meshName.c_str()), - MED_FR::MED_GRID_NOEUD); + NumberOfNodes = MED_FR::MEDnEntMaa(_medIdt, + const_cast + (_ptrMesh->_name.c_str()), + MED_FR::MED_COOR,MED_FR::MED_NOEUD, + MED_FR::MED_NONE,MED_FR::MED_NOD); + if ( NumberOfNodes <= MED_VALID ) - throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"The number of nodes |" << NumberOfNodes << + throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"The number of nodes |" << + NumberOfNodes << "| seems to be incorrect " - << "for the mesh : |" << _meshName << "|" )) ; + << "for the mesh : |" << + _meshName << "|" )) ; + _ptrMesh->_numberOfNodes = NumberOfNodes ; - // this array is useless because families numbers are read in getFAMILY - int * MEDArrayNodeFamily = new int[ NumberOfNodes ]; - // create coordinates + // create coordinates and its structure _ptrMesh->_coordinate = new COORDINATE(SpaceDimension,NumberOfNodes, MED_EN::MED_FULL_INTERLACE); - // Read coordinates and families -// double * coo = const_cast -// (_ptrMesh->_coordinate->getCoordinates(MED_EN::MED_FULL_INTERLACE)); - -// err = MED_FR::MEDbodyFittedLire (_medIdt, -// const_cast (_ptrMesh->_name.c_str()), -// _ptrMesh->_spaceDimension, -// coo, -// MED_FR::MED_FULL_INTERLACE, -// & rep, -// tmp_nom, -// tmp_unit, -// MEDArrayNodeFamily, -// NumberOfNodes); - - err = MED_FR::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, - & rep, - tmp_nom, - tmp_unit, - MEDArrayNodeFamily, - NumberOfNodes); - - MESSAGE(LOC << " NumberOfNodes = " << NumberOfNodes << " SpaceDimension = " << SpaceDimension); + int * structure = new int[MeshDimension]; - ptrGrid->_is_coordinates_filled = true; + err = MED_FR::MEDstructureCoordLire(_medIdt, + const_cast + (_ptrMesh->_name.c_str()), + MeshDimension,structure); -// for (int icoor = 0 ; icoor (_ptrMesh->_name.c_str()), + _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_ALL, // we read all the coordinates + NULL, // we don't use a profile + 0, // so the profile's size is 0 + &rep,tmp_nom,tmp_unit); - // _ptrMesh->_MEDArrayNodeFamily = fam ; + if (err != MED_VALID) + throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Can't read coordinates of the |" << + NumberOfNodes << "| nodes for the mesh : |" << + _meshName << "| of space dimension |" << + SpaceDimension << "| with units names |" << + tmp_nom << "| and units |" << + tmp_unit << " |")) ; + ptrGrid->_is_coordinates_filled = true; } - else + else if ((gridType == MED_EN::MED_GRILLE_CARTESIENNE) || + (gridType == MED_EN::MED_GRILLE_POLAIRE)) { - // Read Arrays and Node families in Cartesian or Polar Grid + NumberOfNodes = 1; - int nbNodes = 1; double * Array[] = { (double*) 0, (double*) 0, (double*) 0 }; - for (idim = 0; idim < _ptrMesh->_spaceDimension; ++idim) + + for (int idim = 0; idim < _ptrMesh->_meshDimension; ++idim) { - int nbNodesDim = * ArrayLen [idim]; - nbNodes *= nbNodesDim; - Array [idim] = new double [ nbNodesDim ]; - err = MED_FR::MEDgridLire (_medIdt, - const_cast (_ptrMesh->_name.c_str()), - _ptrMesh->_spaceDimension, - Array [idim], - idim, - MED_FR::MED_FULL_INTERLACE, - & rep, - tmp_nom, - tmp_unit); - if (err != MED_VALID) - throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Error in MEDgridLire for dimention" << idim )); + MED_FR::med_table table; + if (idim == 0) table = MED_FR::MED_COOR_IND1; + else if (idim == 1) table = MED_FR::MED_COOR_IND2; + else if (idim == 2) table = MED_FR::MED_COOR_IND3; + + int length = MED_FR::MEDnEntMaa(_medIdt, + const_cast (_ptrMesh->_name.c_str()), + table,MED_FR::MED_NOEUD, + MED_FR::MED_NONE, + MED_FR::MED_NOD); + if ( length <= MED_VALID ) + throw MEDEXCEPTION(STRING(LOC) <<"The number of nodes |" << length << + "| seems to be incorrect " + << "for the mesh : |" << _meshName << "|" ) ; + + ArrayLen [idim][0] = length; + NumberOfNodes *= length; + + Array [idim] = new double [ length ]; + err = MED_FR::MEDindicesCoordLire(_medIdt, const_cast + (_ptrMesh->_name.c_str()), + _ptrMesh->_meshDimension, + Array [idim], length, (idim+1), + tmp_nom+(idim*MED_TAILLE_PNOM), + tmp_unit+(idim*MED_TAILLE_PNOM)); + + if (err != MED_VALID) + throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Error in reading coordinates indices " << + idim << "of the grid : |" << + _meshName << "|" )) ; } + ptrGrid->_iArray = Array[0]; ptrGrid->_jArray = Array[1]; ptrGrid->_kArray = Array[2]; - - _ptrMesh->_numberOfNodes = nbNodes ; + + _ptrMesh->_numberOfNodes = NumberOfNodes ; // create coordinates - _ptrMesh->_coordinate = new COORDINATE(SpaceDimension,nbNodes, + _ptrMesh->_coordinate = new COORDINATE(SpaceDimension,NumberOfNodes, MED_EN::MED_FULL_INTERLACE); - // Read node families -// int nbFamNodes = MED_FR::MEDnGrid(_medIdt, -// const_cast (_ptrMesh->_name.c_str()), -// MED_FR::MED_FAM_NOEUD); -// if (nbFamNodes > 0) -// { -// // int * fam = new int[ nbFamNodes ]; - -// //_ptrMesh->_MEDArrayNodeFamily = new int[ nbFamNodes ]; -// // this array is useless because families numbers are read in getFAMILY -// int * MEDArrayNodeFamily = new int[ nbFamNodes ]; - -// err = MED_FR::MEDfamGridLire (_medIdt, -// const_cast (_ptrMesh->_name.c_str()), -// MEDArrayNodeFamily, -// nbFamNodes, -// MED_FR::MED_NOEUD); - -// if (err != MED_VALID) -// throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Can't read grid nodes families for " -// << idim << "-th dimention")); -// else -// _ptrMesh->_MEDArrayNodeFamily = fam; -// } - } // end read Cartesian or Polar Grid + if (gridType == MED_EN::MED_GRILLE_CARTESIENNE) + rep = MED_FR::MED_CART; + else if (gridType == MED_EN::MED_GRILLE_POLAIRE) + { + if (SpaceDimension == 2) rep = MED_FR::MED_CYL; + else if (SpaceDimension == 3) rep = MED_FR::MED_SPHER; + } + } + else + throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<" bad grid type : " << gridType)); // set coordinate names @@ -401,7 +403,6 @@ void MED_MESH_RDONLY_DRIVER::getGRID() _ptrMesh->_coordinate->setCoordinatesSystem(coordinateSystem); - END_OF(LOC); } @@ -412,21 +413,36 @@ void MED_MESH_RDONLY_DRIVER::getGRID() int MED_MESH_RDONLY_DRIVER::getCOORDINATE() { const char * LOC = "MED_MESH_RDONLY_DRIVER::getCOORDINATE() : " ; + BEGIN_OF(LOC); if (_status==MED_OPENED) { int err ; - // 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())) ; - if ( SpaceDimension <= MED_VALID ) - throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"The space dimension |" << SpaceDimension << "| seems to be incorrect " - << "for the mesh : |" << _meshName << "|")) ; - _ptrMesh->_spaceDimension = SpaceDimension ; + // Read the dimension of the mesh <_meshName> + int MeshDimension = MED_FR::MEDdimLire(_medIdt, const_cast + (_meshName.c_str())) ; - + if ( MeshDimension == MED_INVALID ) + throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "The mesh dimension |" << + MeshDimension << + "| seems to be incorrect " << + "for the mesh : |" << _meshName << "|")) ; + + _ptrMesh->_meshDimension = MeshDimension; + + // Read or get the dimension of the space for the mesh <_meshName> + int SpaceDimension = MeshDimension; + + int SpaceDimensionRead = MED_FR::MEDdimEspaceLire(_medIdt, + const_cast + (_meshName.c_str())) ; + + if (SpaceDimensionRead != MED_INVALID) + SpaceDimension = SpaceDimensionRead; + + _ptrMesh->_spaceDimension = SpaceDimension; // Read the number of nodes used in the mesh <_meshName> // to be able to create a COORDINATE object @@ -441,8 +457,6 @@ int MED_MESH_RDONLY_DRIVER::getCOORDINATE() << "for the mesh : |" << _meshName << "|" )) ; _ptrMesh->_numberOfNodes = NumberOfNodes ; - - // create a COORDINATE object _ptrMesh->_coordinate = new COORDINATE(SpaceDimension, NumberOfNodes, MED_EN::MED_FULL_INTERLACE); @@ -585,7 +599,7 @@ int MED_MESH_RDONLY_DRIVER::getCONNECTIVITY() throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "We could not read any Connectivity")) ; } - _ptrMesh->_meshDimension = Connectivity->_entityDimension ; + // _ptrMesh->_meshDimension = Connectivity->_entityDimension ; // At this point Connectivity->_typeConnectivity is either NODAL or DESCENDING // If both connectivities are found Connectivity->_typeConnectivity is NODAL @@ -600,6 +614,7 @@ int MED_MESH_RDONLY_DRIVER::getCONNECTIVITY() if(Connectivity->_constituent==NULL) { SCRUTE(_ptrMesh->_meshDimension); + SCRUTE(Connectivity->_entityDimension); if (_ptrMesh->_meshDimension == 3) { MESSAGE(LOC<<" ESSAI DE LECTURE DE LA CONNECTIVITE DES FACES..." ); CONNECTIVITY * ConnectivityFace = new CONNECTIVITY(MED_EN::MED_FACE) ; @@ -1190,85 +1205,117 @@ int MED_MESH_RDONLY_DRIVER::getFAMILY() const char * LOC = "MED_MESH_RDONLY_DRIVER::getFAMILY() : " ; BEGIN_OF(LOC); - if (_status==MED_OPENED) { - int err = 0 ; + if (_status==MED_OPENED) + { + int err = 0 ; - int * MEDArrayNodeFamily = NULL ; - int ** MEDArrayCellFamily = NULL ; - int ** MEDArrayFaceFamily = NULL ; - int ** MEDArrayEdgeFamily = NULL ; + int * MEDArrayNodeFamily = NULL ; + int ** MEDArrayCellFamily = NULL ; + int ** MEDArrayFaceFamily = NULL ; + int ** MEDArrayEdgeFamily = NULL ; - if ( !_ptrMesh->getIsAGrid() ) - { - // read number : - // NODE : - MEDArrayNodeFamily = new int[_ptrMesh->getNumberOfNodes()] ; - err = getNodesFamiliesNumber(MEDArrayNodeFamily) ; // error only if (_status!=MED_OPENED), other case exeception ! - // CELL +// if ( !_ptrMesh->getIsAGrid() ) +// { + // read number : + // NODE : + MEDArrayNodeFamily = new int[_ptrMesh->getNumberOfNodes()] ; - MESSAGE(LOC << "error returned from getNodesFamiliesNumber " << err); + err = getNodesFamiliesNumber(MEDArrayNodeFamily) ; + // error only if (_status!=MED_OPENED), other case exeception ! + // CELL - MEDArrayCellFamily = new (int*)[_ptrMesh->getNumberOfTypes(MED_CELL)] ; // ET SI IL N'Y A PAS DE CELLS ? - const medGeometryElement * myTypes = _ptrMesh->getTypes(MED_CELL); - for (int i=0;i<_ptrMesh->getNumberOfTypes(MED_CELL);i++) - MEDArrayCellFamily[i] = new int[_ptrMesh->getNumberOfElements(MED_CELL,myTypes[i])] ; + MESSAGE(LOC << "error returned from getNodesFamiliesNumber " << err); - err = getCellsFamiliesNumber(MEDArrayCellFamily,_ptrMesh->_connectivity) ; + MEDArrayCellFamily = new (int*)[_ptrMesh->getNumberOfTypes(MED_CELL)] ; + // ET SI IL N'Y A PAS DE CELLS ? - MESSAGE(LOC << "error returned from getCellsFamiliesNumber for Cells " << err); + const medGeometryElement * myTypes = _ptrMesh->getTypes(MED_CELL); + for (int i=0;i<_ptrMesh->getNumberOfTypes(MED_CELL);i++) + MEDArrayCellFamily[i] = new + int[_ptrMesh->getNumberOfElements(MED_CELL,myTypes[i])] ; + + err = getCellsFamiliesNumber(MEDArrayCellFamily, + _ptrMesh->_connectivity) ; - if (_ptrMesh->_connectivity->_constituent != NULL) { - if (_ptrMesh->_connectivity->_constituent->_entity == MED_EN::MED_FACE) { + MESSAGE(LOC << "error returned from getCellsFamiliesNumber for Cells " << err); + + if (_ptrMesh->_connectivity->_constituent != NULL) + { + if (_ptrMesh->_connectivity->_constituent->_entity == MED_EN::MED_FACE) + { // FACE - MEDArrayFaceFamily = new (int*)[_ptrMesh->getNumberOfTypes(MED_FACE)] ; + MEDArrayFaceFamily = new + (int*)[_ptrMesh->getNumberOfTypes(MED_FACE)] ; + myTypes = _ptrMesh->getTypes(MED_FACE); 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) ; + MEDArrayFaceFamily[i] = new + int[_ptrMesh->getNumberOfElements(MED_FACE,myTypes[i])] ; + + err = + getCellsFamiliesNumber(MEDArrayFaceFamily, + _ptrMesh->_connectivity->_constituent) ; MESSAGE(LOC << "error returned from getCellsFamiliesNumber for Faces " << err); - - } else { + } + else + { // EDGE in 2D - MEDArrayEdgeFamily = new (int*)[_ptrMesh->getNumberOfTypes(MED_EDGE)] ; + MEDArrayEdgeFamily = new + (int*)[_ptrMesh->getNumberOfTypes(MED_EDGE)] ; + 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) ; + MEDArrayEdgeFamily[i] = new + int[_ptrMesh->getNumberOfElements(MED_EDGE,myTypes[i])] ; + err = + getCellsFamiliesNumber(MEDArrayEdgeFamily, + _ptrMesh->_connectivity->_constituent) ; + MESSAGE(LOC << "error returned from getCellsFamiliesNumber for Edges in 2D " << err); - } - // EDGE in 3D - if (_ptrMesh->_connectivity->_constituent->_constituent != NULL) { - MEDArrayEdgeFamily = new (int*)[_ptrMesh->getNumberOfTypes(MED_EDGE)] ; + // EDGE in 3D + if (_ptrMesh->_connectivity->_constituent->_constituent != NULL) + { + MEDArrayEdgeFamily = new + (int*)[_ptrMesh->getNumberOfTypes(MED_EDGE)] ; + 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 ! + MEDArrayEdgeFamily[i] = new + int[_ptrMesh->getNumberOfElements(MED_EDGE,myTypes[i])] ; + err = + getCellsFamiliesNumber(MEDArrayEdgeFamily, + _ptrMesh->_connectivity->_constituent->_constituent); + // we are in 3D ! + MESSAGE(LOC << "error returned from getCellsFamiliesNumber for Edges in 3D " << err); } - } - } - else - { - // node - int NumberOfNodes = _ptrMesh->getNumberOfNodes() ; - MEDArrayNodeFamily = new int[ NumberOfNodes ]; - err = MED_FR::MEDfamGridLire (_medIdt, - const_cast (_ptrMesh->_name.c_str()), - MEDArrayNodeFamily, - NumberOfNodes, - MED_FR::MED_NOEUD); - - // what about cell face and edge ? } +// } +// else +// { +// // node +// int NumberOfNodes = _ptrMesh->getNumberOfNodes() ; +// MEDArrayNodeFamily = new int[ NumberOfNodes ]; +// err = MED_FR::MEDfamGridLire (_medIdt, +// const_cast (_ptrMesh->_name.c_str()), +// MEDArrayNodeFamily, +// NumberOfNodes, +// MED_FR::MED_NOEUD); + +// // 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_FR::MED_FAMILLE) ; + + int NumberOfFamilies = MED_FR::MEDnFam(_medIdt, const_cast + (_meshName.c_str())) ; + if ( NumberOfFamilies < 1 ) // at least family 0 must exist throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<"There is no FAMILY, FAMILY 0 must exists" )); @@ -1284,164 +1331,202 @@ int MED_MESH_RDONLY_DRIVER::getFAMILY() int numberOfFacesFamilies = 0 ; int numberOfEdgesFamilies = 0 ; - for (int i=0;i (_meshName.c_str()),i+1,MED_FR::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) ; - if (NumberOfGroups < 0) - throw MEDEXCEPTION("MED_MESH_RDONLY_DRIVER::getFAMILY() : NumberOfGroups" ); - - 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()), - i+1,const_cast (FamilyName.c_str()), - &FamilyIdentifier,AttributesIdentifier,AttributesValues, - const_cast (AttributesDescription.c_str()), - &NumberOfAttributes, - const_cast (GroupsNames.c_str()),&NumberOfGroups - ); - - - SCRUTE(GroupsNames); - SCRUTE(FamilyName); - SCRUTE(err); - SCRUTE(i); - - 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, - AttributesValues,AttributesDescription, - NumberOfGroups,GroupsNames, - MEDArrayNodeFamily, - MEDArrayCellFamily, - MEDArrayFaceFamily, - MEDArrayEdgeFamily - ) ; - // All good ? - // if nothing found, delete Family - - - //MESSAGE(LOC << " Well is that OK now ?? " << (*Family)); - - - - if (Family->getNumberOfTypes() == 0) { - MESSAGE(LOC<<"Nothing found for family "<getEntity()) { - case MED_EN::MED_NODE : - NodeFamilyVector.push_back(Family) ; - numberOfNodesFamilies++ ; - break ; - case MED_EN::MED_CELL : - CellFamilyVector.push_back(Family) ; - numberOfCellsFamilies++ ; - break ; - case MED_EN::MED_FACE : - FaceFamilyVector.push_back(Family) ; - numberOfFacesFamilies++ ; - break ; - case MED_EN::MED_EDGE : - EdgeFamilyVector.push_back(Family) ; - numberOfEdgesFamilies++ ; - break ; - } + for (int i=0;i + // (_meshName.c_str()),i+1,MED_FR::MED_ATTR) ; - // MESSAGE(LOC << (*Family)); + int NumberOfAttributes = MED_FR::MEDnAttribut(_medIdt, + const_cast + (_meshName.c_str()), + (i+1)); + 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) ; + int NumberOfGroups = MED_FR::MEDnGroupe(_medIdt, const_cast + (_meshName.c_str()),(i+1)) ; + if (NumberOfGroups < 0) + throw MEDEXCEPTION("MED_MESH_RDONLY_DRIVER::getFAMILY() : NumberOfGroups" ); + + 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()), + (i+1),const_cast + (FamilyName.c_str()), &FamilyIdentifier, + AttributesIdentifier,AttributesValues, + const_cast + (AttributesDescription.c_str()), + &NumberOfAttributes, const_cast + (GroupsNames.c_str()),&NumberOfGroups); + + + SCRUTE(GroupsNames); + SCRUTE(FamilyName); + SCRUTE(err); + SCRUTE(i); + + 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, + AttributesValues, + AttributesDescription, + NumberOfGroups,GroupsNames, + MEDArrayNodeFamily, + MEDArrayCellFamily, + MEDArrayFaceFamily, + MEDArrayEdgeFamily) ; + + // All good ? + // if nothing found, delete Family + + + //MESSAGE(LOC << " Well is that OK now ?? " << (*Family)); + + if (Family->getNumberOfTypes() == 0) + { + MESSAGE(LOC<<"Nothing found for family "<getEntity()) + { + case MED_EN::MED_NODE : + NodeFamilyVector.push_back(Family) ; + numberOfNodesFamilies++ ; + break ; + case MED_EN::MED_CELL : + CellFamilyVector.push_back(Family) ; + numberOfCellsFamilies++ ; + break ; + case MED_EN::MED_FACE : + FaceFamilyVector.push_back(Family) ; + numberOfFacesFamilies++ ; + break ; + case MED_EN::MED_EDGE : + EdgeFamilyVector.push_back(Family) ; + numberOfEdgesFamilies++ ; + break ; + } + // MESSAGE(LOC << (*Family)); + } + delete [] AttributesIdentifier ; + delete [] AttributesValues ; } - delete [] AttributesIdentifier ; - delete [] AttributesValues ; - } - if (MEDArrayNodeFamily != NULL) delete[] MEDArrayNodeFamily ; - if (MEDArrayCellFamily != NULL) { - for (int i=0;i<_ptrMesh->getNumberOfTypes(MED_CELL);i++) - delete[] MEDArrayCellFamily[i] ; - delete[] MEDArrayCellFamily ; - } - if (MEDArrayFaceFamily != NULL) { - for (int i=0;i<_ptrMesh->getNumberOfTypes(MED_FACE);i++) - delete[] MEDArrayFaceFamily[i] ; - delete[] MEDArrayFaceFamily ; - } - if (MEDArrayEdgeFamily != NULL) { - for (int i=0;i<_ptrMesh->getNumberOfTypes(MED_EDGE);i++) - delete[] MEDArrayEdgeFamily[i] ; - delete[] MEDArrayEdgeFamily ; - } + + if (MEDArrayCellFamily != NULL) + { + for (int i=0;i<_ptrMesh->getNumberOfTypes(MED_CELL);i++) + delete[] MEDArrayCellFamily[i] ; + delete[] MEDArrayCellFamily ; + } + + if (MEDArrayFaceFamily != NULL) + { + for (int i=0;i<_ptrMesh->getNumberOfTypes(MED_FACE);i++) + delete[] MEDArrayFaceFamily[i] ; + delete[] MEDArrayFaceFamily ; + } + + if (MEDArrayEdgeFamily != NULL) + { + for (int i=0;i<_ptrMesh->getNumberOfTypes(MED_EDGE);i++) + delete[] MEDArrayEdgeFamily[i] ; + delete[] MEDArrayEdgeFamily ; + } END_OF(LOC); return MED_VALID ; - } + } + return MED_ERROR; } int MED_MESH_RDONLY_DRIVER::getNodesFamiliesNumber(int * MEDArrayNodeFamily) { const char * LOC = "MED_MESH_RDONLY_DRIVER::getNodesFamiliesNumber() : " ; + BEGIN_OF(LOC); - if (_status==MED_OPENED) { - int err = 0 ; - err = MEDfamLire(_medIdt,(const_cast (_ptrMesh->_name.c_str())), - MEDArrayNodeFamily, - _ptrMesh->getNumberOfNodes(), - MED_FR::MED_NOEUD,(enum MED_FR::med_geometrie_element) MED_NONE); - if ( err != MED_VALID) { - throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "There is no family for the |"<< _ptrMesh->getNumberOfNodes() - << "| nodes in mesh |" - << _ptrMesh->_name.c_str() << "|" )); + + if (_status==MED_OPENED) + { + int err = 0 ; + + err = MEDfamLire(_medIdt, const_cast + (_ptrMesh->_name.c_str()), MEDArrayNodeFamily, + _ptrMesh->getNumberOfNodes(), MED_FR::MED_NOEUD, + (enum MED_FR::med_geometrie_element) MED_NONE); + + if ( err != MED_VALID) + throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "There is no family for the |"<< _ptrMesh->getNumberOfNodes() << "| nodes in mesh |" << _ptrMesh->_name.c_str() << "|")); + + END_OF(LOC); + return MED_VALID; } - END_OF(LOC); - return MED_VALID; - } + return MED_ERROR; } int MED_MESH_RDONLY_DRIVER::getCellsFamiliesNumber(int **MEDArrayFamily,CONNECTIVITY *Connectivity) { const char * LOC = "MED_MESH_RDONLY_DRIVER::getCellsFamiliesNumber " ; + BEGIN_OF(LOC); - if (_status==MED_OPENED) { - int i, err = 0 ; - for (i=0;i_numberOfTypes;i++) { - int NumberOfCell = Connectivity->_count[i+1]-Connectivity->_count[i] ; - err=MEDfamLire(_medIdt,const_cast (_ptrMesh->_name.c_str()), - MEDArrayFamily[i],NumberOfCell, - (MED_FR::med_entite_maillage) Connectivity->_entity, - (MED_FR::med_geometrie_element) Connectivity->_geometricTypes[i]); - - // provisoire : si les faces ou les aretes sont des mailles !!! - if (err != MED_VALID) { - MESSAGE(LOC<<"search face/edge family on cell !!!"); - err=MEDfamLire(_medIdt,const_cast (_ptrMesh->_name.c_str()), - MEDArrayFamily[i],NumberOfCell, - MED_FR::MED_MAILLE, - (MED_FR::med_geometrie_element) Connectivity->_geometricTypes[i]); - } + if (_status==MED_OPENED) + { + int i, err = 0 ; - if (err != MED_VALID) - throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<" Family not found for entity "<_entity<<" and geometric type "<_geometricTypes[i])); - + SCRUTE(Connectivity->_numberOfTypes); + + for (i=0;i_numberOfTypes;i++) + { + int NumberOfCell = Connectivity->_count[i+1]-Connectivity->_count[i]; + + SCRUTE(NumberOfCell); + + err=MEDfamLire(_medIdt,const_cast (_ptrMesh->_name.c_str()), + MEDArrayFamily[i],NumberOfCell, + (MED_FR::med_entite_maillage) Connectivity->_entity, + (MED_FR::med_geometrie_element) + Connectivity->_geometricTypes[i]); + + // provisoire : si les faces ou les aretes sont des mailles !!! + if (err != MED_VALID) + { + MESSAGE(LOC<<"search face/edge family on cell !!!"); + err=MEDfamLire(_medIdt,const_cast + (_ptrMesh->_name.c_str()), + MEDArrayFamily[i],NumberOfCell, + MED_FR::MED_MAILLE, + (MED_FR::med_geometrie_element) + Connectivity->_geometricTypes[i]); + } + + if (err != MED_VALID) + throw MEDEXCEPTION(LOCALIZED(STRING(LOC)<<" Family not found for entity "<_entity<<" and geometric type "<_geometricTypes[i])); + } + return MED_VALID; } - return MED_VALID; - } return MED_ERROR; } @@ -1640,26 +1725,37 @@ int MED_MESH_WRONLY_DRIVER::writeGRID() const // Test if the mesh <_meshName> already exists // If it doesn't exists create it - // If it already exists verify if its dimension is the same as <_ptrMesh->_spaceDimension> + // If it already exists verify if its space and mesh dimensions are the same + // as <_ptrMesh->_spaceDimension>, <_ptrMesh->_meshDimension> respectively // rem : <_meshName> is the driver meshName not _meshName> - int dim = MED_FR::MEDdimLire(_medIdt, const_cast (_meshName.c_str()) ); - if (dim < MED_VALID) - { - err = MEDgridCr(_medIdt, - const_cast (_meshName.c_str()), - _ptrMesh->_spaceDimension, - (MED_FR::med_grid_type) ptrGrid->getGridType()); + + int spaceDimension = MED_FR::MEDdimEspaceLire(_medIdt, const_cast + (_meshName.c_str()) ); + + int meshDimension = MED_FR::MEDdimLire(_medIdt, const_cast + (_meshName.c_str()) ); + + if ((spaceDimension != MED_VALID) && (meshDimension != MED_VALID)) + { + err = MEDmaaCr(_medIdt, + const_cast (_meshName.c_str()), + _ptrMesh->_meshDimension,MED_FR::MED_STRUCTURE, + const_cast (_ptrMesh->_description.c_str())); + if (err != MED_VALID) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Unable to create Grid")); else MESSAGE(LOC<<"Grid "<<_meshName<<" created in file "<<_fileName<<" !"); } - else if (dim != _ptrMesh->_spaceDimension) + else if ((spaceDimension != _ptrMesh->_spaceDimension) && + (meshDimension != _ptrMesh->_meshDimension)) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Grid |" << _meshName.c_str() << "| already exists in file |" << _fileName << - "| with dimension |" << dim << - "| but the dimension of the mesh we want to write is |" - << _ptrMesh->_spaceDimension <<"|" )) ; + "| with space dimension |" << spaceDimension << + "| and mesh dimension |" << meshDimension << + "| but the space dimension and the mesh dimension of the mesh we want to write are respectively |" + << _ptrMesh->_spaceDimension <<"|" << + _ptrMesh->_meshDimension <<"|" )) ; // Recompose the <_spaceDimension> strings in 1 string int lengthString ; @@ -1692,70 +1788,76 @@ int MED_MESH_WRONLY_DRIVER::writeGRID() const ptrGrid->_jArrayLength, ptrGrid->_kArrayLength }; - // Write node coordinates for MED_BODY_FITTED grid - if (ptrGrid->getGridType() == MED_EN::MED_BODY_FITTED) - { + med_type_grille gridType = ptrGrid->getGridType(); - // Write Coordinates and families - double * coo = const_cast - (_ptrMesh->_coordinate->getCoordinates(MED_EN::MED_FULL_INTERLACE)); + // Write node coordinates for MED_BODY_FITTED grid + if (gridType == MED_EN::MED_GRILLE_STANDARD) + { + // Write Coordinates and families + double * coo = const_cast + (_ptrMesh->_coordinate->getCoordinates(MED_EN::MED_FULL_INTERLACE)); - // Write unused families - int * MEDArrayNodeFamily = new int[_ptrMesh->_numberOfNodes] ; - - err = MEDbodyFittedEcr (_medIdt, - const_cast (_ptrMesh->_name.c_str()), - _ptrMesh->_spaceDimension, - coo, - ArrayLen, - MED_FR::MED_FULL_INTERLACE, - rep, - const_cast (tmp_name.c_str()), - const_cast (tmp_unit.c_str()), - MEDArrayNodeFamily, - _ptrMesh->_numberOfNodes, - MED_FR::MED_REMP); - delete[] MEDArrayNodeFamily; + int* structure = new int [meshDimension]; - if (err != MED_VALID) - throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"error in MEDbodyFittedEcr()")); + for (int idim = 0; idim < meshDimension; ++idim) + structure[idim] = ArrayLen [idim]; + - } - else - { - // Write Arrays of Cartesian or Polar Grid + err = MED_FR::MEDstructureCoordEcr(_medIdt, const_cast + (_meshName.c_str()), meshDimension, + structure); - double * Array[] = { ptrGrid->_iArray, - ptrGrid->_jArray, - ptrGrid->_kArray }; - int idim; - for (idim = 0; idim < _ptrMesh->_spaceDimension; ++idim) - { - err = MEDgridEcr (_medIdt, - const_cast (_ptrMesh->_name.c_str()), - _ptrMesh->_spaceDimension, - Array [idim], - ArrayLen [idim], - idim, - MED_FR::MED_FULL_INTERLACE, - rep, - const_cast (tmp_name.c_str()), - const_cast (tmp_unit.c_str()), - MED_FR::MED_REMP); if (err != MED_VALID) - throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Can't read grid coordinates for " - << idim << "-th dimention")); + throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"error in writing the structure of the grid |" << _meshName.c_str())); + + delete structure; + + err = MEDcoordEcr(_medIdt, const_cast (_meshName.c_str()), + _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, _ptrMesh->_numberOfNodes, + // _ptrMesh->_coordinate->_numberOfNodes + rep, const_cast (tmp_name.c_str()), + const_cast (tmp_unit.c_str())); + + if (err != MED_VALID) + throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Can't write coordinates of the grid |" << _meshName.c_str() << "| in file |" << _fileName + << "| with dimension |" << _ptrMesh->_spaceDimension <<"| and" + << " with units names |" << tmp_name + << "| and units |" << tmp_unit + << " |")) ; } + else if ((gridType == MED_EN::MED_GRILLE_CARTESIENNE) || + (gridType == MED_EN::MED_GRILLE_POLAIRE)) + { + // Write Arrays of Cartesian or Polar Grid -// err = MEDfamGridEcr(_medIdt, -// const_cast (_ptrMesh->_name.c_str()), -// _ptrMesh->_MEDArrayNodeFamily, -// _ptrMesh->_numberOfNodes, -// MED_FR::MED_REMP, -// MED_FR::MED_NOEUD); - if (err != MED_VALID) - throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"error in MEDfamGridEcr()")); + double * Array[] = { ptrGrid->_iArray, + ptrGrid->_jArray, + ptrGrid->_kArray }; + for (int idim = 0; idim < _ptrMesh->_meshDimension; ++idim) + { + string str_name = string (tmp_name,idim*MED_TAILLE_PNOM, + MED_TAILLE_PNOM); + string str_unit = string (tmp_unit,idim*MED_TAILLE_PNOM, + MED_TAILLE_PNOM); + + err = MED_FR::MEDindicesCoordEcr(_medIdt, const_cast + (_ptrMesh->_name.c_str()), + _ptrMesh->_meshDimension, + Array[idim], ArrayLen[idim], + (idim+1), const_cast + (str_name.c_str()), + const_cast + (str_unit.c_str())); + + if (err != MED_VALID) + throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << + "Can't write grid coordinates for " << + idim << "-th dimention")); + } } // end Write Cartesian or Polar Grid END_OF(LOC); @@ -1791,20 +1893,36 @@ int MED_MESH_WRONLY_DRIVER::writeCoordinates() const { // Test if the mesh <_meshName> already exists // If it doesn't exists create it - // If it already exists verify if its dimension is the same as <_ptrMesh->_spaceDimension> + // If it already exists verify if its space and mesh dimensions are the same + // as <_ptrMesh->_spaceDimension>, <_ptrMesh->_meshDimension> respectively // rem : <_meshName> is the driver meshName not _meshName> - int dim = MED_FR::MEDdimLire(_medIdt, const_cast (_meshName.c_str()) ); - if (dim < MED_VALID) - if (MED_FR::MEDmaaCr(_medIdt,const_cast (_meshName.c_str()),_ptrMesh->_spaceDimension) != 0 ) - throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Unable to create Mesh : |" << _meshName << "|")); - else - { + + int spaceDimension = MED_FR::MEDdimEspaceLire(_medIdt, const_cast + (_meshName.c_str())); + + int meshDimension = MED_FR::MEDdimLire(_medIdt, const_cast + (_meshName.c_str()) ); + + if ((spaceDimension != MED_VALID) && (meshDimension != MED_VALID)) + { + err = MEDmaaCr(_medIdt, const_cast (_meshName.c_str()), + _ptrMesh->_meshDimension, MED_FR::MED_NON_STRUCTURE, + const_cast (_ptrMesh->_description.c_str())); + + if (err != MED_VALID) + throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Unable to create Mesh : |" << _meshName << "|")); + else MESSAGE(LOC<<"Mesh "<<_meshName<<" created in file "<<_fileName<<" !"); - } - else if (dim != _ptrMesh->_spaceDimension) - throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Mesh |" << _meshName.c_str() << "| already exists in file |" << _fileName - << "| with dimension |" << dim << "| but the dimension of the mesh we want to write is |" - << _ptrMesh->_spaceDimension <<"|" )) ; + } + else if ((spaceDimension != _ptrMesh->_spaceDimension) && + (meshDimension != _ptrMesh->_meshDimension)) + throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Mesh |" << _meshName.c_str() << + "| already exists in file |" << _fileName << + "| with space dimension |" << spaceDimension << + "| and mesh dimension |" << meshDimension << + "| but the space dimension and the mesh dimension of the mesh we want to write are respectively |" + << _ptrMesh->_spaceDimension <<"|" << + _ptrMesh->_meshDimension << "|")) ; // Pourquoi le stocker sous forme de chaîne ? const string & coordinateSystem = _ptrMesh->_coordinate->_coordinateSystem; @@ -1819,17 +1937,26 @@ int MED_MESH_WRONLY_DRIVER::writeCoordinates() const { << _ptrMesh->_coordinate->_coordinateSystem << "|" )) ; +// err = MEDcoordEcr(_medIdt, const_cast (_meshName.c_str()), +// _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, +// _ptrMesh->_numberOfNodes, // _ptrMesh->_coordinate->_numberOfNodes +// MED_FR::MED_LECTURE_ECRITURE, +// rep, +// const_cast (tmp_name.c_str()), +// const_cast (tmp_unit.c_str()) +// ); + err = MEDcoordEcr(_medIdt, const_cast (_meshName.c_str()), _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, - _ptrMesh->_numberOfNodes, // _ptrMesh->_coordinate->_numberOfNodes - MED_FR::MED_REMP, - rep, - const_cast (tmp_name.c_str()), - const_cast (tmp_unit.c_str()) - ); + MED_FR::MED_FULL_INTERLACE, _ptrMesh->_numberOfNodes, + // _ptrMesh->_coordinate->_numberOfNodes + rep, const_cast (tmp_name.c_str()), + const_cast (tmp_unit.c_str())); if (err<0) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Can't write coordinates of mesh |" << _meshName.c_str() << "| in file |" << _fileName @@ -1849,15 +1976,15 @@ int MED_MESH_WRONLY_DRIVER::writeCoordinates() const { if (_ptrMesh->_arePresentOptionnalNodesNumbers==1) { - err = MEDnumEcr(_medIdt,const_cast (_meshName.c_str()), + 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) ); - + _ptrMesh->_numberOfNodes, MED_FR::MED_NOEUD, + MED_FR::med_geometrie_element(0) ); - if (err<0) - throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Can't write optionnal numbers of mesh |" << _meshName.c_str() - << "| in file |" << _fileName << " |")) ; + if (err != MED_VALID) + throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Can't write optionnal numbers of mesh |" << + _meshName.c_str() << "| in file |" << + _fileName << " |")) ; } ////////////////////////////////////////////////////////////////////////////////////// @@ -1940,11 +2067,19 @@ int MED_MESH_WRONLY_DRIVER::writeConnectivities(medEntityMesh entity) const { ////////////////////////////////////////////////////////////////////////////////////// - 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 ); +// err = MEDconnEcr( _medIdt, const_cast ( _meshName.c_str()), _ptrMesh->_spaceDimension, +// connectivityArray, MED_FR::MED_FULL_INTERLACE , numberOfElements, +// MED_FR::MED_LECTURE_ECRITURE, +// (MED_FR::med_entite_maillage ) entity, +// (MED_FR::med_geometrie_element) types[i], MED_FR::MED_NOD ); + + err = MEDconnEcr(_medIdt, const_cast ( _meshName.c_str()), + _ptrMesh->_spaceDimension, connectivityArray, + MED_FR::MED_FULL_INTERLACE , numberOfElements, + (MED_FR::med_entite_maillage ) entity, + (MED_FR::med_geometrie_element) types[i], + MED_FR::MED_NOD); + delete[] connectivityArray ; if (err<0) // ETENDRE LES EXPLICATIONS @@ -1965,16 +2100,26 @@ 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, - const_cast ( _meshName.c_str()), - _ptrMesh->_spaceDimension, - const_cast (connectivity), - 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_DESC ); +// err = MED_FR::MEDconnEcr( _medIdt, +// const_cast ( _meshName.c_str()), +// _ptrMesh->_spaceDimension, +// const_cast (connectivity), +// MED_FR::MED_FULL_INTERLACE, +// numberOfElements, +// MED_FR::MED_LECTURE_ECRITURE, +// (MED_FR::med_entite_maillage ) entity, +// (MED_FR::med_geometrie_element) types[i], +// MED_FR::MED_DESC ); + + err = MED_FR::MEDconnEcr(_medIdt, + const_cast ( _meshName.c_str()), + _ptrMesh->_spaceDimension, + const_cast (connectivity), + MED_FR::MED_FULL_INTERLACE, + numberOfElements, + (MED_FR::med_entite_maillage ) entity, + (MED_FR::med_geometrie_element) types[i], + MED_FR::MED_DESC ); if (err<0) // ETENDRE LES EXPLICATIONS throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Can't write connectivities of mesh |" << _meshName.c_str() << "| in file |" << _fileName @@ -2035,21 +2180,24 @@ int MED_MESH_WRONLY_DRIVER::writeFamilyNumbers() const { MEDArrayNodeFamily[Number[j]-1]=FamilyIdentifier ; } } + for(int j=0; jgetIsAGrid() ) - err = MEDfamEcr(_medIdt, const_cast ( _meshName.c_str() ), - MEDArrayNodeFamily, NumberOfNodes,MED_FR::MED_REMP , - MED_FR::MED_NOEUD, - (enum MED_FR::med_geometrie_element) MED_NONE); - else - err = MEDfamGridEcr(_medIdt, - const_cast (_ptrMesh->_name.c_str()), - MEDArrayNodeFamily, - NumberOfNodes, - MED_FR::MED_REMP, - MED_FR::MED_NOEUD); + +// if ( !_ptrMesh->getIsAGrid() ) + + err = MEDfamEcr(_medIdt, const_cast ( _meshName.c_str() ), + MEDArrayNodeFamily, NumberOfNodes, MED_FR::MED_NOEUD, + (enum MED_FR::med_geometrie_element) MED_NONE); + +// else +// err = MEDfamGridEcr(_medIdt, +// const_cast (_ptrMesh->_name.c_str()), +// MEDArrayNodeFamily, +// NumberOfNodes, +// MED_FR::MED_LECTURE_ECRITURE, +// MED_FR::MED_NOEUD); if ( err != MED_VALID) throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Can't write node family for the |"<< NumberOfNodes @@ -2111,11 +2259,11 @@ int MED_MESH_WRONLY_DRIVER::writeFamilyNumbers() const { for (int i=0; i ( _meshName.c_str() ), - MEDArrayFamily+typeCount[i]-1,typeCount[i+1]-typeCount[i], - MED_FR::MED_REMP , + (MEDArrayFamily+typeCount[i]-1), + (typeCount[i+1]-typeCount[i]), (MED_FR::med_entite_maillage) entity, - (MED_FR::med_geometrie_element) types[i] -); + (MED_FR::med_geometrie_element) types[i]); + MESSAGE("OK "<getNumberOfElements(entity, types[i]) @@ -2179,11 +2327,10 @@ int MED_MESH_WRONLY_DRIVER::writeFamilyNumbers() const { const int * typeCount = _ptrMesh->getGlobalNumberingIndex(entity) ; for (int i=0; i ( _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]); @@ -2249,14 +2396,13 @@ int MED_MESH_WRONLY_DRIVER::writeFamilyNumbers() const { const int * typeCount = _ptrMesh->getGlobalNumberingIndex(entity) ; for (int i=0; i ( _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]); - + 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 |" diff --git a/src/MEDMEM/MEDMEM_Mesh.cxx b/src/MEDMEM/MEDMEM_Mesh.cxx index 435890dc9..3a617e1a4 100644 --- a/src/MEDMEM/MEDMEM_Mesh.cxx +++ b/src/MEDMEM/MEDMEM_Mesh.cxx @@ -147,6 +147,8 @@ void MESH::init() { string _name = "NOT DEFINED"; // A POSITIONNER EN FCT DES IOS ? + string _decription = "NOT DEFINED"; // A POSITIONNER EN FCT DES IOS ? + _coordinate = (COORDINATE *) NULL; _connectivity = (CONNECTIVITY *) NULL; @@ -168,7 +170,8 @@ MESH::MESH():_coordinate(NULL),_connectivity(NULL), _isAGrid(false) { MESH::MESH(MESH &m) { - _name=m._name; + _name = m._name; + _description = m._description; _isAGrid = m._isAGrid; if (m._coordinate != NULL) @@ -2082,14 +2085,16 @@ FIELD* MESH::getBarycenter(const SUPPORT * Support) const throw (MEDEXCE bool MESH::isEmpty() const { - bool notempty = _name != "" || _coordinate != NULL || _connectivity != NULL || - _spaceDimension !=MED_INVALID || _meshDimension !=MED_INVALID || - _numberOfNodes !=MED_INVALID || _groupNode.size() != 0 || - _familyNode.size() != 0 || _groupCell.size() != 0 || - _familyCell.size() != 0 || _groupFace.size() != 0 || - _familyFace.size() != 0 || _groupEdge.size() != 0 || - _familyEdge.size() != 0 || _isAGrid != 0 ; - return !notempty; + bool notempty = _name != "" || _description != "" || + _coordinate != NULL || _connectivity != NULL || + _spaceDimension !=MED_INVALID || + _meshDimension !=MED_INVALID || + _numberOfNodes !=MED_INVALID || _groupNode.size() != 0 || + _familyNode.size() != 0 || _groupCell.size() != 0 || + _familyCell.size() != 0 || _groupFace.size() != 0 || + _familyFace.size() != 0 || _groupEdge.size() != 0 || + _familyEdge.size() != 0 || _isAGrid != 0 ; + return !notempty; } void MESH::read(int index) diff --git a/src/MEDMEM/MEDMEM_Mesh.hxx b/src/MEDMEM/MEDMEM_Mesh.hxx index d4a4e2deb..94531af2c 100644 --- a/src/MEDMEM/MEDMEM_Mesh.hxx +++ b/src/MEDMEM/MEDMEM_Mesh.hxx @@ -98,6 +98,7 @@ protected: protected : string _name; // A POSITIONNER EN FCT DES IOS ? + string _description; mutable COORDINATE * _coordinate; mutable CONNECTIVITY * _connectivity; @@ -191,8 +192,9 @@ public : inline void setName(string name); - + inline void setDescription(string description); inline string getName() const; + inline string getDescription() const; inline int getSpaceDimension() const; inline int getMeshDimension() const; inline bool getIsAGrid(); @@ -394,6 +396,18 @@ inline string MESH::getName() const return _name; } +/*! Set the MESH description */ +inline void MESH::setDescription(string description) +{ + _description=description; //NOM interne à la classe +} + +/*! Get the MESH description */ +inline string MESH::getDescription() const +{ + return _description; +} + /*! Get the dimension of the space */ inline int MESH::getSpaceDimension() const { diff --git a/src/MEDMEM/MEDMEM_Meshing.cxx b/src/MEDMEM/MEDMEM_Meshing.cxx index e04c642c3..355677673 100644 --- a/src/MEDMEM/MEDMEM_Meshing.cxx +++ b/src/MEDMEM/MEDMEM_Meshing.cxx @@ -15,7 +15,7 @@ using namespace std; #include "MEDMEM_Group.hxx" using namespace MEDMEM; -/*! Create an empty MESH. */ +/*! Create an empty %MESH. */ MESHING::MESHING(): MESH() { MESSAGE("MESHING::MESHING()"); @@ -40,7 +40,7 @@ void MESHING::setSpaceDimension(const int SpaceDimension) // _meshDimension = MeshDimension ; // } -/*! Set the number of nodes used in the MESH */ +/*! Set the number of nodes used in the %MESH */ void MESHING::setNumberOfNodes(const int NumberOfNodes) { _numberOfNodes = NumberOfNodes ; @@ -53,8 +53,8 @@ void MESHING::setNumberOfNodes(const int NumberOfNodes) - "CYLINDRICAL" - "SPHERICAL" The interlacing mode are : - - MED_NO_INTERLACE : X1 X2 Y1 Y2 Z1 Z2 - - MED_FULL_INTERLACE : X1 Y1 Z1 X2 Y2 Z2 + - %MED_NO_INTERLACE : X1 X2 Y1 Y2 Z1 Z2 + - %MED_FULL_INTERLACE : X1 Y1 Z1 X2 Y2 Z2 */ void MESHING::setCoordinates(const int SpaceDimension, const int NumberOfNodes, @@ -76,7 +76,10 @@ void MESHING::setCoordinates(const int SpaceDimension, _coordinate->setCoordinatesSystem(System); } -/*! Set the system in which coordinates are given (CARTESIAN,CYLINDRICAL,SPHERICAL) __??MED_CART??__. */ +/*! Set the system in which coordinates are given + - "CARTESIAN" + - "CYLINDRICAL" + - "SPHERICAL". */ void MESHING::setCoordinatesSystem(const string System) throw (MEDEXCEPTION) { @@ -86,7 +89,7 @@ void MESHING::setCoordinatesSystem(const string System) } /*! Set the coordinate names array ("x ","y ","z ") - of size n*MED_TAILLE_PNOM + of size n*%MED_TAILLE_PNOM */ void MESHING::setCoordinatesNames(const string * name) { @@ -97,7 +100,7 @@ void MESHING::setCoordinatesNames(const string * name) /*! Set the (i+1)^th component of coordinate names array - ("x ","y ","z ") of size n*MED_TAILLE_PNOM + ("x ","y ","z ") of size n*%MED_TAILLE_PNOM */ void MESHING::setCoordinateName(const string name, const int i) { @@ -105,7 +108,7 @@ void MESHING::setCoordinateName(const string name, const int i) } /*! Set the coordinate unit names array ("cm ","cm ","cm ") - of size n*MED_TAILLE_PNOM + of size n*%MED_TAILLE_PNOM */ void MESHING::setCoordinatesUnits(const string * units) { @@ -116,7 +119,7 @@ void MESHING::setCoordinatesUnits(const string * units) /*! Set the (i+1)^th component of the coordinate unit names array - ("cm ","cm ","cm ") of size n*MED_TAILLE_PNOM + ("cm ","cm ","cm ") of size n*%MED_TAILLE_PNOM */ void MESHING::setCoordinateUnit(const string unit, const int i) { @@ -179,7 +182,7 @@ void MESHING::setNumberOfTypes(const int NumberOfTypes, REM : Don't use MED_NODE and MED_ALL_ENTITIES - If entity is not defined, throw an exception. + If entity is not defined, throws an exception. */ void MESHING::setTypes(const medGeometryElement * Types, const medEntityMesh entity) diff --git a/src/MEDMEM/MEDMEM_Meshing.hxx b/src/MEDMEM/MEDMEM_Meshing.hxx index 164ed112c..867b62e8d 100644 --- a/src/MEDMEM/MEDMEM_Meshing.hxx +++ b/src/MEDMEM/MEDMEM_Meshing.hxx @@ -11,7 +11,7 @@ using namespace MED_EN; /*! - This class MESHING is a special class to set a MESH object. + This class %MESHING is a special class to set a %MESH object. */ namespace MEDMEM { diff --git a/src/MEDMEM/MEDMEM_define.hxx b/src/MEDMEM/MEDMEM_define.hxx index bbc2be345..8e5c48ccf 100644 --- a/src/MEDMEM/MEDMEM_define.hxx +++ b/src/MEDMEM/MEDMEM_define.hxx @@ -27,8 +27,10 @@ namespace MED_EN { #define MED_TAILLE_IDENT 8 #define MED_TAILLE_NOM 32 #define MED_TAILLE_LNOM 80 -#define MED_TAILLE_PNOM 8 +#define MED_TAILLE_PNOM 16 +#define MED_PNOM_BLANC " " +#define MED_NOM_BLANC " " typedef long medGeometryElement; const medGeometryElement MED_NONE = 0; @@ -47,6 +49,8 @@ namespace MED_EN { const medGeometryElement MED_PYRA13 = 313; const medGeometryElement MED_PENTA15 = 315; const medGeometryElement MED_HEXA20 = 320; + const medGeometryElement MED_POLYGONE = 400; + const medGeometryElement MED_POLYEDRE = 500; const medGeometryElement MED_ALL_ELEMENTS = 999; typedef long medEntityMesh; @@ -59,18 +63,31 @@ namespace MED_EN { typedef long medModeSwitch; const medModeSwitch MED_FULL_INTERLACE = 0; const medModeSwitch MED_NO_INTERLACE = 1; + + typedef enum {MED_NO_PFLMOD, MED_GLOBAL, MED_COMPACT } med_mode_profil; typedef long medConnectivity; const medConnectivity MED_NODAL = 0; const medConnectivity MED_DESCENDING = 1; - typedef enum {MED_CARTESIAN, MED_POLAR, MED_BODY_FITTED} med_grid_type; +// typedef enum {MED_CARTESIAN, MED_POLAR, MED_BODY_FITTED} med_grid_type; +// V2_1->V2_2 - typedef enum {MED_LECT,MED_ECRI,MED_REMP} med_mode_acces; +// typedef enum {MED_LECT,MED_ECRI,MED_REMP} med_mode_acces; V2_1->V2_2 - typedef enum {MED_COOR, MED_CONN, MED_NOM, MED_NUM, MED_FAM} med_table; + typedef enum {MED_LECTURE, MED_LECTURE_ECRITURE, MED_LECTURE_AJOUT, + MED_CREATION} med_mode_acces; + + typedef enum {MED_NON_STRUCTURE, MED_STRUCTURE} med_maillage; + + typedef enum {MED_GRILLE_CARTESIENNE, MED_GRILLE_POLAIRE, + MED_GRILLE_STANDARD} med_type_grille; + + typedef enum {MED_COOR, MED_CONN, MED_NOM, MED_NUM, MED_FAM, MED_COOR_IND1, + MED_COOR_IND2,MED_COOR_IND3} med_table; - typedef enum {MED_REEL64=6, MED_INT32=24,MED_INT64=26, MED_INT} med_type_champ; + typedef enum {MED_REEL64=6, MED_INT32=24,MED_INT64=26, + MED_INT=28} med_type_champ; #define MED_NBR_GEOMETRIE_MAILLE 15 #define MED_NBR_GEOMETRIE_FACE 4 @@ -87,14 +104,20 @@ typedef enum {MED_COMP, MED_DTYPE} med_dim_champ; typedef enum {MED_HDF_VERSION, MED_VERSION, MED_FICH_DES} med_fich_info; #define MED_NOPG 1 /* -> pas de point de Gauss */ +#define MED_NOGAUSS "" /* -> pas de point de Gauss */ +#define MED_NOGAUSSi MED_NOM_BLANC /* Variable Interne */ #define MED_NOPFL "" /* -> pas de profils utilisateur */ -#define MED_NOPFLi " " /* Variable Interne */ +#define MED_NOPFLi MED_NOM_BLANC /* Variable Interne */ +#define MED_NOLIEN "" +#define MED_NOLIENi MED_NOM_BLANC /* 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 !!!!! NB: WARNING MED_ALL deja utilise dans l'enum medGeometryElement !!!!!!!! #define MED_ALL 0 +#define MED_NOREF "" +#define MED_DEFAUT "" /* Toutes les donnees champs ou maillage pour le montage */ #if defined(SUN4SOL2) || defined(PCLINUX) || defined(OSF1) || defined(IRIX64_32) || defined(RS6000) /* interface C/FORTRAN */ @@ -186,14 +209,17 @@ typedef double med_float; #define MED_VALID 0 //#define MED_NULL NULL -#define MED_RDONLY MED_LECT +//#define MED_RDONLY MED_LECT V2_1->V2_2 +#define MED_RDONLY MED_LECTURE // rem: MED_WRONLY=MED_ECR n'empêche malheureusement pas de lire le fichier // mais permet de conserver l'existant. Attention à la création d'objet // ne prenant pas de paramètre de type mode d'accès il faut tester si il // est déjà présent dans le fichier. Si MED_WRONLY=MED_REMP le fichier est // réinitialisé. Cf une évolution de MED. -#define MED_WRONLY MED_ECRI -#define MED_RDWR MED_ECRI + //#define MED_WRONLY MED_ECRI V2_1->V2_2 +#define MED_WRONLY MED_LECTURE_AJOUT + //#define MED_RDWR MED_ECRI V2_1->V2_2 +#define MED_RDWR MED_LECTURE_ECRITURE // Fin #define FAUX 0 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 2d85f4cab..011a38259 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,7 +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 3896ae7e2..bc899cac4 100644 --- a/src/MEDMEM/create_mesh_c2q4s2.c +++ b/src/MEDMEM/create_mesh_c2q4s2.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"; + 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, 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}; @@ -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,8 +141,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 */ @@ -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); } } diff --git a/src/MEDMEM/create_mesh_c2q4s2_wrong.c b/src/MEDMEM/create_mesh_c2q4s2_wrong.c index a4d020de7..65812328a 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); } } diff --git a/src/MEDMEM/create_mesh_c3h8.c b/src/MEDMEM/create_mesh_c3h8.c index 1153597da..8cd1adeba 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); } } diff --git a/src/MEDMEM/create_mesh_c3h8q4.c b/src/MEDMEM/create_mesh_c3h8q4.c index 19c3675c4..f1ecfa234 100644 --- a/src/MEDMEM/create_mesh_c3h8q4.c +++ b/src/MEDMEM/create_mesh_c3h8q4.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"; + 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 }; - 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,8 +168,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 */ @@ -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); } } diff --git a/src/MEDMEM/create_mesh_c3h8q4_wrong.c b/src/MEDMEM/create_mesh_c3h8q4_wrong.c index 77db282f1..884d4bf26 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); } } diff --git a/src/MEDMEM_I/MEDMEM_Med_i.cxx b/src/MEDMEM_I/MEDMEM_Med_i.cxx index b8ba93cc3..16946a5ad 100644 --- a/src/MEDMEM_I/MEDMEM_Med_i.cxx +++ b/src/MEDMEM_I/MEDMEM_Med_i.cxx @@ -168,7 +168,7 @@ void MED_i::init(SALOMEDS::Study_ptr myStudy,driverTypes driverType, const strin break; } - case MED_FR::MED_REEL64: + case MED_FR::MED_FLOAT64: { ((FIELD*)myField)->read(); FIELDDOUBLE_i * myFieldDoubleI @@ -471,7 +471,7 @@ void MED_i::initWithFieldType(SALOMEDS::Study_ptr myStudy,driverTypes driverType break; } - case MED_FR::MED_REEL64: + case MED_FR::MED_FLOAT64: { ((FIELD*)myField)->read(); FIELDDOUBLE_i * myFieldDoubleI diff --git a/src/MEDMEM_SWIG/libMEDMEM_Swig.i b/src/MEDMEM_SWIG/libMEDMEM_Swig.i index 405eba3c1..d6adb29d3 100644 --- a/src/MEDMEM_SWIG/libMEDMEM_Swig.i +++ b/src/MEDMEM_SWIG/libMEDMEM_Swig.i @@ -207,11 +207,20 @@ enum of the C++ MED used in the Python API */ -typedef enum {MED_CARTESIAN, MED_POLAR, MED_BODY_FITTED} med_grid_type; +typedef enum {MED_NON_STRUCTURE, MED_STRUCTURE} med_maillage; + +typedef enum {MED_GRILLE_CARTESIENNE, MED_GRILLE_POLAIRE, + MED_GRILLE_STANDARD} med_type_grille; typedef enum {MED_FULL_INTERLACE, MED_NO_INTERLACE} medModeSwitch; +/* typedef enum {MED_LECT, MED_ECRI, MED_REMP} med_mode_acces; + V2_1->V2_2 +*/ + +typedef enum {MED_LECTURE, MED_LECTURE_ECRITURE, MED_LECTURE_AJOUT, + MED_CREATION} med_mode_acces; typedef enum {MED_CELL, MED_FACE, MED_EDGE, MED_NODE, MED_ALL_ENTITIES} medEntityMesh; @@ -220,8 +229,8 @@ typedef enum {MED_NONE=0, MED_POINT1=1, MED_SEG2=102, MED_SEG3=103, MED_TRIA3=203, MED_QUAD4=204, MED_TRIA6=206, MED_QUAD8=208, MED_TETRA4=304, MED_PYRA5=305, MED_PENTA6=306, MED_HEXA8=308, MED_TETRA10=310, MED_PYRA13=313, - MED_PENTA15=315, MED_HEXA20=320, - MED_ALL_ELEMENTS=999} medGeometryElement; + MED_PENTA15=315, MED_HEXA20=320, MED_POLYGONE=400, + MED_POLYEDRE=500, MED_ALL_ELEMENTS=999} medGeometryElement; typedef enum {MED_NODAL, MED_DESCENDING} medConnectivity ; @@ -229,7 +238,7 @@ typedef enum {MED_DRIVER=0, GIBI_DRIVER=1, PORFLOW_DRIVER = 2, VTK_DRIVER=254, NO_DRIVER=255} driverTypes; typedef enum {MED_REEL64=6, MED_INT32=24, MED_INT64=26, - MED_INT} med_type_champ; + MED_INT=28} med_type_champ; typedef struct { int dt; int it; } DT_IT_; @@ -1524,13 +1533,15 @@ class GRID : public MESH int getFaceNumber(const int Axis, const int i, const int j=0, const int k=0) const ; - med_grid_type getGridType(); +/* med_grid_type getGridType(); */ + med_type_grille getGridType(); int getArrayLength( const int Axis ); const double getArrayValue (const int Axis, const int i); - void setGridType(med_grid_type gridType); +/* void setGridType(med_grid_type gridType); */ + void setGridType(med_type_grille gridType); %extend { GRID(driverTypes driverType, const char * fileName="", const char * meshName="") -- 2.39.2