};
break;
}
- case MED_FR::MED_REEL64:
+ case MED_FR::MED_FLOAT64:
{
try
{
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=
#include <med.h>
#include <string.h>
-#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<nbr_nodes;i++) printf("Noeud %d : ( %4.5f ; %4.5f ; %4.5f )\n",i,nodes[3*i],nodes[3*i+1],nodes[3*i+2]);
-
- }
+{
+ int nbr_nodes=nnpl*nnpl*nnpl;
+ int i;
+ for (i=0;i<nbr_nodes;i++)
+ printf("Noeud %d : ( %4.5f ; %4.5f ; %4.5f )\n",i,nodes[3*i],nodes[3*i+1],
+ nodes[3*i+2]);
+}
void cree_nodes(med_float * coord_nodes,int nnpl, int flag)
- {
- 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<nnpl;i++) for (j=0;j<nnpl;j++) for (k=0;k<nnpl;k++)
- {
- num_noeud=i+nnpl*j+nnpl*nnpl*k;
-
- if (3*num_noeud >=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<nnpl;i++) for (j=0;j<nnpl;j++) for (k=0;k<nnpl;k++)
+ {
+ num_noeud=i+nnpl*j+nnpl*nnpl*k;
+
+ if (3*num_noeud >=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<nbr_nodes;i++) num_nodes[i]=i+1;//nbr_nodes+i;
- }
+{
+ int nbr_nodes=nnpl*nnpl*nnpl;
+ int i;
+ /*num_nodes=(med_int *) malloc(nbr_nodes*sizeof(med_int));*/
+ for (i=0;i<nbr_nodes;i++) num_nodes[i]=i+1;//nbr_nodes+i;
+}
+
void cree_Hexa8(med_int * conn_hexa8, int nnpl,med_int * num_nodes)
- {
- int i,j,k;
- int i0,j0,k0,i1,j1,k1;
- int nbr_nodes=nnpl*nnpl*nnpl;
- int nbr_hexa8=(nnpl-1)*(nnpl-1)*(nnpl-1);
- int num_hexa8;
-
- /*conn_hexa8=(med_int *) malloc(8*nbr_hexa8*sizeof(med_int));*/
-
- for (i=0;i<nnpl-1;i++) for (j=0;j<nnpl-1;j++) for (k=0;k<nnpl-1;k++)
- {
- i0=i;j0=j;k0=k;
- i1=i+1;j1=j+1;k1=k+1;
+{
+ int i,j,k;
+ int i0,j0,k0,i1,j1,k1;
+ int nbr_nodes=nnpl*nnpl*nnpl;
+ int nbr_hexa8=(nnpl-1)*(nnpl-1)*(nnpl-1);
+ int num_hexa8;
+
+ /*conn_hexa8=(med_int *) malloc(8*nbr_hexa8*sizeof(med_int));*/
+
+ for (i=0;i<nnpl-1;i++) for (j=0;j<nnpl-1;j++) for (k=0;k<nnpl-1;k++)
+ {
+ i0=i;j0=j;k0=k;
+ i1=i+1;j1=j+1;k1=k+1;
- num_hexa8=i+(nnpl-1)*j+(nnpl-1)*(nnpl-1)*k;
+ num_hexa8=i+(nnpl-1)*j+(nnpl-1)*(nnpl-1)*k;
- 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);}
+ 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<nbr_hexa8;num_hexa8++)
- {
- printf("Maille numéro %4d :",num_hexa8);
- printf("%4d ",conn_hexa8[8*num_hexa8 ]);
- printf("%4d ",conn_hexa8[8*num_hexa8+1]);
- printf("%4d ",conn_hexa8[8*num_hexa8+2]);
- printf("%4d ",conn_hexa8[8*num_hexa8+3]);
- printf("%4d ",conn_hexa8[8*num_hexa8+4]);
- printf("%4d ",conn_hexa8[8*num_hexa8+5]);
- printf("%4d ",conn_hexa8[8*num_hexa8+6]);
- printf("%4d ",conn_hexa8[8*num_hexa8+7]);
- printf("\n");
- }
- }
+ for (num_hexa8=0;num_hexa8<nbr_hexa8;num_hexa8++)
+ {
+ printf("Maille numéro %4d :",num_hexa8);
+ printf("%4d ",conn_hexa8[8*num_hexa8 ]);
+ printf("%4d ",conn_hexa8[8*num_hexa8+1]);
+ printf("%4d ",conn_hexa8[8*num_hexa8+2]);
+ printf("%4d ",conn_hexa8[8*num_hexa8+3]);
+ printf("%4d ",conn_hexa8[8*num_hexa8+4]);
+ printf("%4d ",conn_hexa8[8*num_hexa8+5]);
+ printf("%4d ",conn_hexa8[8*num_hexa8+6]);
+ printf("%4d ",conn_hexa8[8*num_hexa8+7]);
+ printf("\n");
+ }
+}
+
void cree_noms_mailles(char * noms, int nnpl)
- {
- int nbr_hexa8=(nnpl-1)*(nnpl-1)*(nnpl-1);
- int i;
- char pnom[MED_TAILLE_PNOM+1]="hexa ";
-
- /*noms=(char *) malloc((nbr_hexa8*MED_TAILLE_PNOM+1)*sizeof(char));*/
+{
+ int nbr_hexa8=(nnpl-1)*(nnpl-1)*(nnpl-1);
+ int i;
+ char pnom[MED_TAILLE_PNOM+1]="hexa ";
- for (i=0;i<nbr_hexa8;i++) strncpy(&noms[i*MED_TAILLE_PNOM],pnom,MED_TAILLE_PNOM);
+ /*noms=(char *) malloc((nbr_hexa8*MED_TAILLE_PNOM+1)*sizeof(char));*/
- noms[nbr_hexa8*MED_TAILLE_PNOM]='\n';
+ for (i=0;i<nbr_hexa8;i++) strncpy(&noms[i*MED_TAILLE_PNOM],pnom,MED_TAILLE_PNOM);
- }
+ noms[nbr_hexa8*MED_TAILLE_PNOM]='\n';
+}
+
void cree_num_mailles(med_int * num_mailles,int nnpl)
- {
- int nbr_hexa8=(nnpl-1)*(nnpl-1)*(nnpl-1);
- int i;
-
- /*num_mailles=(med_int *) malloc(nbr_hexa8*sizeof(med_int));*/
-
- for (i=0;i<nbr_hexa8;i++) num_mailles[i]=i+1;
- }
+{
+ int nbr_hexa8=(nnpl-1)*(nnpl-1)*(nnpl-1);
+ int i;
+
+ /*num_mailles=(med_int *) malloc(nbr_hexa8*sizeof(med_int));*/
+
+ for (i=0;i<nbr_hexa8;i++) num_mailles[i]=i+1;
+}
+
void cree_fam_nodes(med_int * fam,int nnpl)
- {
- int nbr_nodes=nnpl*nnpl*nnpl;
- int i;
-
- /*fam=(med_int *) malloc(nbr_nodes*sizeof(med_int));*/
-
- for (i=0;i<nbr_nodes;i++) fam[i]=0;
- }
+{
+ int nbr_nodes=nnpl*nnpl*nnpl;
+ int i;
+
+ /*fam=(med_int *) malloc(nbr_nodes*sizeof(med_int));*/
+
+ for (i=0;i<nbr_nodes;i++) fam[i]=0;
+}
+
void cree_fam_mailles(med_int * fam,int nnpl)
- {
- int nbr_hexa8=(nnpl-1)*(nnpl-1)*(nnpl-1);
- int i;
-
- /*fam=(med_int *) malloc(nbr_hexa8*sizeof(med_int));*/
-
- for (i=0;i<nbr_hexa8;i++) fam[i]=0;
- }
+{
+ int nbr_hexa8=(nnpl-1)*(nnpl-1)*(nnpl-1);
+ int i;
+
+ /*fam=(med_int *) malloc(nbr_hexa8*sizeof(med_int));*/
+
+ for (i=0;i<nbr_hexa8;i++) fam[i]=0;
+}
+
void cree_valeurs_champ_node(med_float * val,int nnpl)
- {
- int i,j,k;
- int nbr_nodes=nnpl*nnpl*nnpl;
- int num_noeud;
- int diviseur=3*(nnpl-1);
-
- /*val=(med_float *) malloc(nbr_nodes*sizeof(med_float));*/
-
- for (i=0;i<nnpl;i++) for (j=0;j<nnpl;j++) for (k=0;k<nnpl;k++)
- {
- num_noeud=i+nnpl*j+nnpl*nnpl*k;
- val[num_noeud] = (med_float) (i+j+k)/diviseur;
- }
- for (num_noeud=0;num_noeud<nbr_nodes;num_noeud++) printf("Valeur Scalaire noeud %5d : %4.5f\n",num_noeud,val[num_noeud]);
- }
+{
+ int i,j,k;
+ int nbr_nodes=nnpl*nnpl*nnpl;
+ int num_noeud;
+ int diviseur=3*(nnpl-1);
+
+ /*val=(med_float *) malloc(nbr_nodes*sizeof(med_float));*/
+
+ for (i=0;i<nnpl;i++) for (j=0;j<nnpl;j++) for (k=0;k<nnpl;k++)
+ {
+ num_noeud=i+nnpl*j+nnpl*nnpl*k;
+ val[num_noeud] = (med_float) (i+j+k)/diviseur;
+ }
+ for (num_noeud=0;num_noeud<nbr_nodes;num_noeud++)
+ printf("Valeur Scalaire noeud %5d : %4.5f\n",num_noeud,val[num_noeud]);
+}
+
void cree_valeurs_champ_vector_node(med_float * val,int nnpl)
- {
- int i,j,k;
- int nbr_nodes=nnpl*nnpl*nnpl;
- int num_noeud;
-
- /*val=(med_float *) malloc(nbr_nodes*sizeof(med_float));*/
-
- for (i=0;i<nnpl;i++) for (j=0;j<nnpl;j++) for (k=0;k<nnpl;k++)
- {
- num_noeud=i+nnpl*j+nnpl*nnpl*k;
- val[3*num_noeud ] = (med_float) 0;
- val[3*num_noeud+1] = (med_float) 1;
- val[3*num_noeud+2] = (med_float) 2;
- }
- for (num_noeud=0;num_noeud<nbr_nodes;num_noeud++) printf("Valeur Vectorielle noeud %5d : %4.5f %4.5f %4.5f \n ",num_noeud,val[3*num_noeud],val[3*num_noeud+1],val[3*num_noeud+2]);
- }
+{
+ int i,j,k;
+ int nbr_nodes=nnpl*nnpl*nnpl;
+ int num_noeud;
+
+ /*val=(med_float *) malloc(nbr_nodes*sizeof(med_float));*/
+
+ for (i=0;i<nnpl;i++) for (j=0;j<nnpl;j++) for (k=0;k<nnpl;k++)
+ {
+ num_noeud=i+nnpl*j+nnpl*nnpl*k;
+ val[3*num_noeud ] = (med_float) 0;
+ val[3*num_noeud+1] = (med_float) 1;
+ val[3*num_noeud+2] = (med_float) 2;
+ }
+ for (num_noeud=0;num_noeud<nbr_nodes;num_noeud++)
+ printf("Valeur Vectorielle noeud %5d : %4.5f %4.5f %4.5f \n ",num_noeud,
+ val[3*num_noeud],val[3*num_noeud+1],val[3*num_noeud+2]);
+}
+
void cree_valeurs_champ_cell(med_float * val,int nnpl)
- {
- int i,j,k;
- int nbr_cells=(nnpl-1)*(nnpl-1)*(nnpl-1);
- int num_cell;
+{
+ int i,j,k;
+ int nbr_cells=(nnpl-1)*(nnpl-1)*(nnpl-1);
+ int num_cell;
- med_float diviseur=3*(nnpl-2);
+ med_float diviseur=3*(nnpl-2);
- /*val=(med_float *) malloc(3*nbr_cells*sizeof(med_float));*/
+ /*val=(med_float *) malloc(3*nbr_cells*sizeof(med_float));*/
- for (i=0;i<nnpl-1;i++) for (j=0;j<nnpl-1;j++) for (k=0;k<nnpl-1;k++)
- {
- num_cell=i+(nnpl-1)*j+(nnpl-1)*(nnpl-1)*k;
- val[num_cell ] = (med_float) (i+j+k)/diviseur;
- }
- for (num_cell=0;num_cell<nbr_cells;num_cell++) printf("Valeur scalaire maille %5d : %4.5f\n ",num_cell,val[num_cell]);
- }
+ for (i=0;i<nnpl-1;i++) for (j=0;j<nnpl-1;j++) for (k=0;k<nnpl-1;k++)
+ {
+ num_cell=i+(nnpl-1)*j+(nnpl-1)*(nnpl-1)*k;
+ val[num_cell ] = (med_float) (i+j+k)/diviseur;
+ }
+ for (num_cell=0;num_cell<nbr_cells;num_cell++)
+ printf("Valeur scalaire maille %5d : %4.5f\n ",num_cell,val[num_cell]);
+}
+
void cree_valeurs_champ_vector_cell(med_float * val,int nnpl)
- {
- int i,j,k;
- int nbr_cells=(nnpl-1)*(nnpl-1)*(nnpl-1);
- int num_cell;
-
- /*val=(med_float *) malloc(3*nbr_cells*sizeof(med_float));*/
-
- for (i=0;i<nnpl-1;i++) for (j=0;j<nnpl-1;j++) for (k=0;k<nnpl-1;k++)
- {
- num_cell=i+(nnpl-1)*j+(nnpl-1)*(nnpl-1)*k;
- val[3*num_cell ] = (med_float) 0;
- val[3*num_cell+1] = (med_float) 1;
- val[3*num_cell+2] = (med_float) 2;
- }
- for (num_cell=0;num_cell<nbr_cells;num_cell++) printf("Valeur Vectorielle maille %5d : %4.5f %4.5f %4.5f \n ",num_cell,val[3*num_cell],val[3*num_cell+1],val[3*num_cell+2]);
- }
+{
+ int i,j,k;
+ int nbr_cells=(nnpl-1)*(nnpl-1)*(nnpl-1);
+ int num_cell;
+
+ /*val=(med_float *) malloc(3*nbr_cells*sizeof(med_float));*/
+
+ for (i=0;i<nnpl-1;i++) for (j=0;j<nnpl-1;j++) for (k=0;k<nnpl-1;k++)
+ {
+ num_cell=i+(nnpl-1)*j+(nnpl-1)*(nnpl-1)*k;
+ val[3*num_cell ] = (med_float) 0;
+ val[3*num_cell+1] = (med_float) 1;
+ val[3*num_cell+2] = (med_float) 2;
+ }
+ for (num_cell=0;num_cell<nbr_cells;num_cell++)
+ printf("Valeur Vectorielle maille %5d : %4.5f %4.5f %4.5f \n ",num_cell,
+ val[3*num_cell],val[3*num_cell+1],val[3*num_cell+2]);
+}
/*****************************************************************************************************/
int main (int argc, char **argv)
- {
+{
- int i,j,k;
-
- int nnpl;
-
- int nbr_nodes, nbr_hexa8;
-
- med_err ret;
- med_idt fromfid;
- med_idt tofid;
- char frommaa[MED_TAILLE_NOM+1] = "fromMesh";
- char tomaa[MED_TAILLE_NOM+1] = "toMesh";
- const med_int mdim = 3;
- med_int fromnnoe;
- med_int tonnoe;
-
- med_float * tocoo;
- med_float * fromcoo;
-
- char nomcoo[3*MED_TAILLE_PNOM+1] = "x y z ";
- char unicoo[3*MED_TAILLE_PNOM+1] = "cm cm cm ";
-
- char * nomnoe = NULL ;
-
- med_int * fromnumnoe;
- med_int * fromnufano;
-
- med_int * tonumnoe;
- med_int * tonufano;
-
- med_int fromnhexa8;
- med_int * fromhexa8;
-
- med_int tonhexa8;
- med_int * tohexa8;
-
-
- char * fromnomhexa8;
- med_int * fromnumhexa8;
- med_int * fromnufahexa8;
-
- char * tonomhexa8;
- med_int * tonumhexa8;
- med_int * tonufahexa8;
-
-/*****************************************************************************************************/
-
- char nomfam[MED_TAILLE_NOM+1];
- med_int numfam;
- char attdes[MED_TAILLE_DESC+1];
- med_int natt;
- med_int attide;
- med_int attval;
- med_int ngro;
- char gro[MED_TAILLE_LNOM+1];
- char gro2[MED_TAILLE_LNOM*2+1];
- char gro3[MED_TAILLE_LNOM*3+1];
- int nfame = 1;
- int nfamn = 1;
-
-/*****************************************************************************************************/
-
- /* Some fields : one on nodes : double , one on cells : double */
+ int i,j,k;
+
+ int nnpl;
+
+ int nbr_nodes, nbr_hexa8;
+
+ med_err ret;
+ med_idt fromfid;
+ med_idt tofid;
+ char frommaa[MED_TAILLE_NOM+1] = "fromMesh";
+ char frommaadesc[MED_TAILLE_DESC+1] = "First 3D non-structured mesh example for the Interpolation module in Med Memory";
+ char tomaa[MED_TAILLE_NOM+1] = "toMesh";
+ char tomaadesc[MED_TAILLE_DESC+1] = "Second 3D non-structured mesh example for the Interpolation module in Med Memory";
+ const med_int mdim = 3;
+ med_int fromnnoe;
+ med_int tonnoe;
+
+ med_float * tocoo;
+ med_float * fromcoo;
+
+ char nomcoo[3*MED_TAILLE_PNOM+1] = "x y z ";
+ char unicoo[3*MED_TAILLE_PNOM+1] = "cm cm cm ";
+
+ char * nomnoe = NULL ;
+
+ med_int * fromnumnoe;
+ med_int * fromnufano;
+
+ med_int * tonumnoe;
+ med_int * tonufano;
+
+ med_int fromnhexa8;
+ med_int * fromhexa8;
+
+ med_int tonhexa8;
+ med_int * tohexa8;
+
+
+ char * fromnomhexa8;
+ med_int * fromnumhexa8;
+ med_int * fromnufahexa8;
+
+ char * tonomhexa8;
+ med_int * tonumhexa8;
+ med_int * tonufahexa8;
+
+ /*****************************************************************************************************/
+
+ char nomfam[MED_TAILLE_NOM+1];
+ med_int numfam;
+ char attdes[MED_TAILLE_DESC+1];
+ med_int natt;
+ med_int attide;
+ med_int attval;
+ med_int ngro;
+ char gro[MED_TAILLE_LNOM+1];
+ char gro2[MED_TAILLE_LNOM*2+1];
+ char gro3[MED_TAILLE_LNOM*3+1];
+ int nfame = 1;
+ int nfamn = 1;
+
+ /*****************************************************************************************************/
+
+ /* Some fields : one on nodes : double , one on cells : double */
+
+ char champnode[MED_TAILLE_NOM+1]="fieldnodedouble" ;
+ char champnode_comp[MED_TAILLE_PNOM+1]="X+Y+Z " ;
+ char champnode_unit[MED_TAILLE_PNOM+1]="X+Y+Z " ;
+ med_float * fieldnodedouble;
+
+ char champnodevector[MED_TAILLE_NOM+1]="fieldnodedoublevector" ;
+ char champnodevector_comp[MED_TAILLE_PNOM*3+1]="0 1 2 " ;
+ char champnodevector_unit[MED_TAILLE_PNOM*3+1]="O 1 2 " ;
+ med_float * fieldnodedoublevector;
+
+ char champcellscalar[MED_TAILLE_NOM+1]="fieldcelldouble" ;
+ char champcellscalar_comp[MED_TAILLE_PNOM+1]="X+Y+Z " ;
+ char champcellscalar_unit[MED_TAILLE_PNOM+1]="X+Y+Z " ;
+ med_float * fieldcelldouble;
+
+ char champcell[MED_TAILLE_NOM+1]="fieldcelldoublevector" ;
+ char champcell_comp[MED_TAILLE_PNOM*3+1]="0 1 2 " ;
+ char champcell_unit[MED_TAILLE_PNOM*3+1]="0 1 2 " ;
+ med_float * fieldcelldoublevector;
+
+ /*****************************************************************************************************/
+
+ if (argc!=2)
+ {
+ printf("Il manque un paramètre : le nombre de point par ligne\n");
+ exit(-1);
+ }
+
+ sscanf(argv[1],"%d",&nnpl);
+
+ printf("VERSION 2.0\n");
+ printf("Traitement avec %d noeuds par ligne\n",nnpl);
+
+ fromnnoe = nnpl*nnpl*nnpl ;
+ fromnhexa8 = (nnpl-1)*(nnpl-1)*(nnpl-1) ;
+ tonnoe = (nnpl-1)*(nnpl-1)*(nnpl-1) ;
+ tonhexa8 = (nnpl-2)*(nnpl-2)*(nnpl-2) ;
+
+ nbr_nodes=nnpl*nnpl*nnpl;
+ nbr_hexa8=(nnpl-1)*(nnpl-1)*(nnpl-1);
+
+ fromcoo = (med_float *) malloc(3*nbr_nodes*sizeof(med_float));
+ cree_nodes ( fromcoo , nnpl, 0 );
+
+ fromnumnoe = (med_int *) malloc(nbr_nodes*sizeof(med_int));
+ cree_num_nodes ( fromnumnoe , nnpl );
+
+ fromnufano = (med_int *) malloc(nbr_nodes*sizeof(med_int));
+ cree_fam_nodes ( fromnufano , nnpl );
+
+ fromhexa8 = (med_int *) malloc(8*nbr_hexa8*sizeof(med_int));
+ cree_Hexa8 ( fromhexa8 , nnpl ,fromnumnoe);
+
+ fromnomhexa8 = (char *) malloc((nbr_hexa8*MED_TAILLE_PNOM+1)*sizeof(char));
+ cree_noms_mailles ( fromnomhexa8 , nnpl );
+
+ fromnumhexa8 = (med_int *) malloc(nbr_hexa8*sizeof(med_int));
+ cree_num_mailles ( fromnumhexa8 , nnpl );
+
+ fromnufahexa8 = (med_int *) malloc(nbr_hexa8*sizeof(med_int));
+ cree_fam_mailles ( fromnufahexa8 , nnpl );
+
+ fieldnodedouble = (med_float *) malloc(nbr_nodes*sizeof(med_float));
+ cree_valeurs_champ_node ( fieldnodedouble , nnpl );
+
+ fieldnodedoublevector = (med_float *) malloc(3*nbr_nodes*sizeof(med_float));
+ cree_valeurs_champ_vector_node ( fieldnodedoublevector , nnpl );
+
+ fieldcelldouble = (med_float *) malloc(nbr_hexa8*sizeof(med_float));
+ cree_valeurs_champ_cell ( fieldcelldouble , nnpl );
+
+ fieldcelldoublevector = (med_float *) malloc(3*nbr_hexa8*sizeof(med_float));
+ cree_valeurs_champ_vector_cell ( fieldcelldoublevector , nnpl );
+
+ nbr_nodes=(nnpl-1)*(nnpl-1)*(nnpl-1);
+ nbr_hexa8=(nnpl-2)*(nnpl-2)*(nnpl-2);
+
+ tocoo = (med_float *) malloc(3*nbr_nodes*sizeof(med_float));
+ cree_nodes ( tocoo , nnpl-1, 1 );
+
+ tonumnoe = (med_int *) malloc(nbr_nodes*sizeof(med_int));
+ cree_num_nodes ( tonumnoe , nnpl-1 );
+
+ tonufano = (med_int *) malloc(nbr_nodes*sizeof(med_int));
+ cree_fam_nodes ( tonufano , nnpl-1 );
+
+ tohexa8 = (med_int *) malloc(8*nbr_hexa8*sizeof(med_int));
+ cree_Hexa8 ( tohexa8 , nnpl-1 ,tonumnoe);
+
+ tonomhexa8 = (char *) malloc((nbr_hexa8*MED_TAILLE_PNOM+1)*sizeof(char));
+ cree_noms_mailles ( tonomhexa8 , nnpl-1 );
- char champnode[MED_TAILLE_NOM+1]="fieldnodedouble" ;
- char champnode_comp[MED_TAILLE_PNOM+1]="X+Y+Z " ;
- char champnode_unit[MED_TAILLE_PNOM+1]="X+Y+Z " ;
- med_float * fieldnodedouble;
+ tonumhexa8 = (med_int *) malloc(nbr_hexa8*sizeof(med_int));
+ cree_num_mailles ( tonumhexa8 , nnpl-1 );
- char champnodevector[MED_TAILLE_NOM+1]="fieldnodedoublevector" ;
- char champnodevector_comp[MED_TAILLE_PNOM*3+1]="0 1 2 " ;
- char champnodevector_unit[MED_TAILLE_PNOM*3+1]="O 1 2 " ;
- med_float * fieldnodedoublevector;
+ tonufahexa8 = (med_int *) malloc(nbr_hexa8*sizeof(med_int));
+ cree_fam_mailles ( tonufahexa8 , nnpl-1 );
- char champcellscalar[MED_TAILLE_NOM+1]="fieldcelldouble" ;
- char champcellscalar_comp[MED_TAILLE_PNOM+1]="X+Y+Z " ;
- char champcellscalar_unit[MED_TAILLE_PNOM+1]="X+Y+Z " ;
- med_float * fieldcelldouble;
+
+ /*****************************************************************************************************/
+ fromfid = MEDouvrir("fromMesh.med",MED_LECTURE_ECRITURE);
- char champcell[MED_TAILLE_NOM+1]="fieldcelldoublevector" ;
- char champcell_comp[MED_TAILLE_PNOM*3+1]="0 1 2 " ;
- char champcell_unit[MED_TAILLE_PNOM*3+1]="0 1 2 " ;
- med_float * fieldcelldoublevector;
+ if (fromfid < 0)
+ ret = -1;
+ else
+ ret = 0;
-/*****************************************************************************************************/
+ printf("MEDouvrir : %d\n",ret);
+ /*****************************************************************************************************/
+ tofid = MEDouvrir("toMesh.med",MED_LECTURE_ECRITURE);
-
- if (argc!=2)
- {
- printf("Il manque un paramètre : le nombre de point par ligne\n");
- exit(-1);
- }
+ if (tofid < 0)
+ ret = -1;
+ else
+ ret = 0;
- sscanf(argv[1],"%d",&nnpl);
-
- printf("VERSION 2.0\n");
- printf("Traitement avec %d noeuds par ligne\n",nnpl);
+ printf("MEDouvrir : %d\n",ret);
+ /*****************************************************************************************************/
+ if (ret == 0)
+ ret = MEDmaaCr(fromfid,frommaa,mdim,MED_NON_STRUCTURE,frommaadesc);
- fromnnoe = nnpl*nnpl*nnpl ;
- fromnhexa8 = (nnpl-1)*(nnpl-1)*(nnpl-1) ;
- tonnoe = (nnpl-1)*(nnpl-1)*(nnpl-1) ;
- tonhexa8 = (nnpl-2)*(nnpl-2)*(nnpl-2) ;
+ printf("MEDmaaCr : %d\n",ret);
+ /*****************************************************************************************************/
+ if (ret == 0)
+ ret = MEDmaaCr(tofid,tomaa,mdim,MED_NON_STRUCTURE,tomaadesc);
+ printf("MEDmaaCr : %d\n",ret);
+ /*****************************************************************************************************/
+ if (ret == 0)
+ ret = MEDnoeudsEcr(fromfid,frommaa,mdim,fromcoo,MED_FULL_INTERLACE,
+ MED_CART,nomcoo,unicoo,nomnoe,MED_FAUX,fromnumnoe,
+ MED_FAUX,fromnufano,fromnnoe);
+ printf("MEDnoeudsEcr : %d\n",ret);
+ /*****************************************************************************************************/
+ if (ret == 0)
+ ret = MEDnoeudsEcr(tofid,tomaa,mdim,tocoo,MED_FULL_INTERLACE,MED_CART,
+ nomcoo,unicoo,nomnoe,MED_FAUX,tonumnoe,MED_FAUX,
+ tonufano,tonnoe);
- nbr_nodes=nnpl*nnpl*nnpl;
- nbr_hexa8=(nnpl-1)*(nnpl-1)*(nnpl-1);
+ printf("MEDnoeudsEcr : %d\n",ret);
- fromcoo = (med_float *) malloc(3*nbr_nodes*sizeof(med_float)); cree_nodes ( fromcoo , nnpl, 0 );
- fromnumnoe = (med_int *) malloc(nbr_nodes*sizeof(med_int)); cree_num_nodes ( fromnumnoe , nnpl );
- fromnufano = (med_int *) malloc(nbr_nodes*sizeof(med_int)); cree_fam_nodes ( fromnufano , nnpl );
- fromhexa8 = (med_int *) malloc(8*nbr_hexa8*sizeof(med_int)); cree_Hexa8 ( fromhexa8 , nnpl ,fromnumnoe);
- fromnomhexa8 = (char *) malloc((nbr_hexa8*MED_TAILLE_PNOM+1)*sizeof(char)); cree_noms_mailles ( fromnomhexa8 , nnpl );
- fromnumhexa8 = (med_int *) malloc(nbr_hexa8*sizeof(med_int)); cree_num_mailles ( fromnumhexa8 , nnpl );
- fromnufahexa8 = (med_int *) malloc(nbr_hexa8*sizeof(med_int)); cree_fam_mailles ( fromnufahexa8 , nnpl );
+ /*****************************************************************************************************/
+ /* ecriture des mailles MED_HEXA8 :
+ - connectivite
+ - noms (optionnel)
+ - numeros (optionnel)
+ - numeros des familles */
- fieldnodedouble = (med_float *) malloc(nbr_nodes*sizeof(med_float)); cree_valeurs_champ_node ( fieldnodedouble , nnpl );
- fieldnodedoublevector = (med_float *) malloc(3*nbr_nodes*sizeof(med_float)); cree_valeurs_champ_vector_node ( fieldnodedoublevector , nnpl );
- fieldcelldouble = (med_float *) malloc(nbr_hexa8*sizeof(med_float)); cree_valeurs_champ_cell ( fieldcelldouble , nnpl );
- fieldcelldoublevector = (med_float *) malloc(3*nbr_hexa8*sizeof(med_float)); cree_valeurs_champ_vector_cell ( fieldcelldoublevector , nnpl );
-
+ 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);
- nbr_nodes=(nnpl-1)*(nnpl-1)*(nnpl-1);
- nbr_hexa8=(nnpl-2)*(nnpl-2)*(nnpl-2);
+ printf("MEDelementsEcr : %d \n",ret);
+ /*****************************************************************************************************/
+/* ecriture des mailles MED_HEXA8 :
+ - connectivite
+ - noms (optionnel)
+ - numeros (optionnel)
+ - numeros des familles */
- tocoo = (med_float *) malloc(3*nbr_nodes*sizeof(med_float)); cree_nodes ( tocoo , nnpl-1, 1 );
- tonumnoe = (med_int *) malloc(nbr_nodes*sizeof(med_int)); cree_num_nodes ( tonumnoe , nnpl-1 );
- tonufano = (med_int *) malloc(nbr_nodes*sizeof(med_int)); cree_fam_nodes ( tonufano , nnpl-1 );
- tohexa8 = (med_int *) malloc(8*nbr_hexa8*sizeof(med_int)); cree_Hexa8 ( tohexa8 , nnpl-1 ,tonumnoe);
- tonomhexa8 = (char *) malloc((nbr_hexa8*MED_TAILLE_PNOM+1)*sizeof(char)); cree_noms_mailles ( tonomhexa8 , nnpl-1 );
- tonumhexa8 = (med_int *) malloc(nbr_hexa8*sizeof(med_int)); cree_num_mailles ( tonumhexa8 , nnpl-1 );
- tonufahexa8 = (med_int *) malloc(nbr_hexa8*sizeof(med_int)); cree_fam_mailles ( tonufahexa8 , nnpl-1 );
+ 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);
-
-/*****************************************************************************************************/
- fromfid = MEDouvrir("fromMesh.med",MED_REMP);
- if (fromfid < 0)
- ret = -1;
- else
- ret = 0;
- printf("MEDouvrir : %d\n",ret);
+ 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)
+ - 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);
+ /*****************************************************************************************************/
+ 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;
}
switch (drv._accessMode)
{
case MED_RDONLY :
- os<<"C'est un IO de READ"<<endl;
+ os << "C'est un IO de READ" << endl;
break;
case MED_RDWR :
- os<<"C'est un IO d'READ/WRITE"<<endl;
+ os << "C'est un IO d'READ/WRITE" << endl;
break;
- case MED_REMP :
- os <<"C'est un IO de remplacement"<<endl;
+ case MED_WRONLY :
+ os << "C'est un IO de READ et AJOUT" << endl;
break;
+ case MED_CREATION :
+ os << "C'est un IO de CREATION" << endl;
}
switch (drv._status)
{
case MED_OPENED :
- os<<"L'IO_Mesh_MED est open"<<endl;
+ os << "L'IO_Mesh_MED est open" << endl;
break;
case MED_CLOSED :
- os<<"L'IO_Mesh_MED est fermé"<<endl;
+ os << "L'IO_Mesh_MED est fermé" << endl;
break;
case MED_INVALID :
- os<<"L'IO_Mesh_MED est non-valide"<<endl;
+ os << "L'IO_Mesh_MED est non-valide" << endl;
break;
}
return os;
//purpose : empty constructor
//=======================================================================
-GRID::GRID(const med_grid_type type)
+// GRID::GRID(const med_grid_type type)
+// {
+// init();
+// _gridType = type;
+// MESSAGE("A TYPED GRID CREATED");
+// }
+
+GRID::GRID(const med_type_grille type)
{
init();
_gridType = type;
void GRID::init()
{
- _gridType = MED_CARTESIAN;
+// _gridType = MED_CARTESIAN;
+ _gridType = MED_GRILLE_CARTESIENNE;
_iArray = _jArray = _kArray = (double* ) NULL;
_iArrayLength = _jArrayLength = _kArrayLength = 0;
_is_coordinates_filled = false;
_is_connectivity_filled = false;
- if (_gridType == MED_BODY_FITTED)
+// if (_gridType == MED_BODY_FITTED)
+ if (_gridType == MED_GRILLE_STANDARD)
{
_is_coordinates_filled = true;
//-----------------------//
// 1. grid type: MED_CARTESIAN, MED_POLAR, MED_BODY_FITTED
- med_grid_type _gridType;
-
+// med_grid_type _gridType;
+
+ // 1. grid type MED_GRILLE_CARTESIENNE, MED_GRILLE_POLAIRE,
+ // MED_GRILLE_STANDARD
+ med_type_grille _gridType;
+
// 2. node coordinates
// For MED_BODY_FITTED MESH::_coordinate is used
//-----------------------//
GRID();
- GRID(const med_grid_type type);
+// GRID(const med_grid_type type);
+ GRID(const med_type_grille type);
GRID(const GRID &m);
GRID( driverTypes driverType, const string & fileName="",const string & meshName="");
GRID & operator=(const GRID &m);
// Access to fields
- inline med_grid_type getGridType() const;
+// inline med_grid_type getGridType() const;
// return MED_CARTESIAN, MED_POLAR or MED_BODY_FITTED
+ inline med_type_grille getGridType() const;
+ // returns MED_GRILLE_CARTESIENNE, MED_GRILLE_POLAIRE, MED_GRILLE_STANDARD
+
int getArrayLength( const int Axis ) const throw (MEDEXCEPTION);
// return array length. Axis = [1,2,3] meaning [i,j,k],
// exception if Axis out of [1-3] range
// Setting fields
- inline void setGridType(med_grid_type gridType);
+// inline void setGridType(med_grid_type gridType);
+ inline void setGridType(med_type_grille gridType);
friend class MED_MESH_RDONLY_DRIVER;
friend class MED_MESH_WRONLY_DRIVER;
// Inline Methods Implementation
//----------------------------------//
-inline med_grid_type GRID::getGridType() const
+// inline med_grid_type GRID::getGridType() const
+// {
+// return _gridType;
+// }
+
+inline med_type_grille GRID::getGridType() const
{
return _gridType;
}
//purpose : set the _gridType field od the class GRID
//=======================================================================
-inline void GRID::setGridType(med_grid_type gridType)
+// inline void GRID::setGridType(med_grid_type gridType)
+// {
+// _gridType = gridType;
+// }
+
+inline void GRID::setGridType(med_type_grille gridType)
{
_gridType = gridType;
}
const char * LOC = "MED::getNumberOfMeshes ( void ) const : ";
BEGIN_OF(LOC);
- return _meshes.size();
+ int size = _meshes.size();
+
+ SCRUTE(size);
END_OF(LOC);
+
+ return size;
};
/*!
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<MESH_NAME_,MESH*>::const_iterator itMeshes = _meshes.find(meshName);
if ( itMeshes == _meshes.end() )
for (int i=0; i<NumberOfTypes; i++) {
MESSAGE ("Type["<<i+1<<"] :"<< Types[i]);
MESSAGE ("Entity :"<<_ptrField->_support->getEntity());
- NumberOfValues[i] =
- MEDnVal(_medIdt,
- const_cast <char*> (_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 <char*> (_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 <char*> (_fieldName.c_str()),
+ (MED_FR::med_entite_maillage)_ptrField->_support->getEntity(),
+ (MED_FR::med_geometrie_element) Types[i],
+ _ptrField->_iterationNumber, _ptrField->_orderNumber,
+ const_cast <char*> (_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());
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 <char*> (MeshName.c_str()),
- const_cast <char*> (_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 <char*> (MeshName.c_str()),
+ const_cast <char*> (_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 ;
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)
cout<<"==================> valeur de MED_FR::MED_REEL64 = "<<MED_FR::MED_REEL64<<endl;
*/
+// err=MED_FR::MEDchampEcr(_medIdt,
+// const_cast <char*> ( MeshName.c_str()) , //( string(mesh_name).resize(MED_TAILLE_NOM).c_str())
+// const_cast <char*> ( (_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 <char*> ( MeshName.c_str()) , //( string(mesh_name).resize(MED_TAILLE_NOM).c_str())
const_cast <char*> ( (_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(),
_ptrField->getTime(),
_ptrField->getOrderNumber()
);
+
if (err < MED_VALID )
throw MEDEXCEPTION(LOCALIZED( STRING(LOC)
<<": Error in writing Field "<< _ptrField->getName() <<", type "<<Types[i]
{
int numberOfMeshes;
char meshName[MED_TAILLE_NOM+1]="";
+ char meshDescription[MED_TAILLE_DESC+1]="";
int meshDim;
+ MED_FR::med_maillage meshType;
+
MESH * ptrMesh;
// MED_MESH_RDWR_DRIVER * ptrDriver; !! UNUSED VARIABLE !!
MESSAGE(LOC << "Be careful there is no mesh in file |"<<_fileName<<"| !");
MESH_ENTITIES::const_iterator currentEntity;
- for (i=1;i<=numberOfMeshes;i++) {
+ for (i=1;i<=numberOfMeshes;i++)
+ {
+ //get infoamation on the i^th mesh
+
+ err = MEDmaaInfo(_medIdt, i ,meshName, &meshDim, &meshType,
+ meshDescription) ;
+
+ if (err != MED_VALID)
+ throw MED_EXCEPTION(LOCALIZED(STRING(LOC) << ": can't get information about the mesh n°" << i << " of the file |" << _fileName << "| !"));
+
+ switch (meshType)
+ {
+ case MED_FR::MED_STRUCTURE:
+ MESSAGE(LOC<<": Mesh n°"<< i <<" nammed "<< meshName << " with the description " << meshDescription << " is structured");
+
+ MED_FR::med_type_grille type;
- // find out if the mesh is a Grid
+ err = MEDnatureGrilleLire(_medIdt, meshName, &type);
+
+ if (err != MED_VALID)
+ throw MED_EXCEPTION(LOCALIZED(STRING(LOC) << ": can't get the nature of the grid which is the mesh n°" << i << " of the file |" << _fileName << "| !"));
+
+ ptrMesh = new GRID((MED_EN::med_type_grille) type);
+ break;
+ case MED_FR::MED_NON_STRUCTURE:
+ MESSAGE(LOC<<": Mesh n°"<< i <<" nammed "<< meshName << " with the description " << meshDescription << " is not structured");
+
+ ptrMesh = new MESH();
+ break;
+ default:
+ throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Bad file mesh type !"));
+ }
+
+// // find out if the mesh is a Grid
- int isAGrid = false;
- MED_FR::med_grid_type type;
+ bool isAGrid = ptrMesh->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°"<<i<<" nammed "<<meshName);
-
- if (isAGrid)
- ptrMesh = new GRID((MED_EN::med_grid_type) type);
- else
- ptrMesh = new MESH();
-
- //MED_MESH_RDWR_DRIVER * _ptrDriver = new MED_MESH_RDWR_DRIVER(_fileName, ptrMesh);
- MED_EN::med_mode_acces myMode = getAccessMode();
- MED_MESH_DRIVER * ptrDriver ;
- switch (myMode) {
- case MED_EN::MED_LECT:
- ptrDriver = new MED_MESH_RDONLY_DRIVER(_fileName, ptrMesh);
- break ;
- case MED_EN::MED_REMP:
- ptrDriver = new MED_MESH_RDWR_DRIVER(_fileName, ptrMesh);
- break ;
- case MED_EN::MED_ECRI: // should never append !!
- ptrDriver = new MED_MESH_RDONLY_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
+// 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°"<<i<<" nammed "<<meshName);
+
+// if (isAGrid)
+// ptrMesh = new GRID((MED_EN::med_grid_type) type);
+// else
+// ptrMesh = new MESH();
+
+ //MED_MESH_RDWR_DRIVER * _ptrDriver = new MED_MESH_RDWR_DRIVER(_fileName, ptrMesh);
+ MED_EN::med_mode_acces myMode = getAccessMode();
+ MED_MESH_DRIVER * ptrDriver ;
+ switch (myMode) {
+ // case MED_EN::MED_LECT: V2_1->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 "<<ptrMesh->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 "<<ptrMesh->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 " <<ptrMesh->getName() << " has " << index << " support(s)");
}
- MESSAGE(LOC <<"The mesh " <<ptrMesh->getName() << " has " << index << " support(s)");
- }
map<MESH_NAME_, map<MED_FR::med_entite_maillage,SUPPORT *> >::const_iterator const_itSupportOnMesh ;
char timeStepUnit[MED_TAILLE_PNOM+1] ;
double timeStep = 0.0;
int orderNumber = -1; //???init?????
+ int numberOfRefMesh = 0;
+ MED_FR::med_booleen meshLink;
map<MESH_NAME_,MESH*> & _meshes = _ptrMed->_meshes;
map<FIELD_NAME_,MAP_DT_IT_> & _fields = _ptrMed->_fields;
map<FIELD_ *, MESH_NAME_> & _meshName = _ptrMed->_meshName;
map<MESH_NAME_, map<MED_FR::med_entite_maillage,SUPPORT *> > & _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°"<<i<<" nammed "<< fieldName
- << " ,component(s) : " << componentName
- <<" ,unit(s) : " << unitName);
-
+ 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<<"| !"));
- // Loop on all (entity type,geometry type) until you find an existing one then
- // get the (n°dt,n°it) pairs list for the current (field,entity type,geometry type)
- // We suppose there is the same list whatever the existing (entity type,geometry type) pair
- // support map :
- for (currentEntity=meshEntities.begin();currentEntity != meshEntities.end(); currentEntity++) {
- // numberOfTimeSteps MUST be given by MEDchampInfo !!!!!
- for (currentGeometry = (*currentEntity).second.begin();currentGeometry != (*currentEntity).second.end(); currentGeometry++) {
- MESSAGE("Field information with Entity,Geom = "<<(*currentEntity).first<<","<<(*currentGeometry));
- numberOfTimeSteps = MEDnPasdetemps(_medIdt, fieldName,
- (MED_FR::med_entite_maillage)(*currentEntity).first,
- (MED_FR::med_geometrie_element) (*currentGeometry) );
- MESSAGE("Field information 2 : NumberOfTimeStep :"<<numberOfTimeSteps);
- if ( numberOfTimeSteps > 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°"<<i<<" nammed "<< fieldName
+ << " ,component(s) : " << componentName
+ <<" ,unit(s) : " << unitName);
+
+ // Loop on all (entity type,geometry type) until you find an existing
+ // one then get the (n°dt,n°it) pairs list for the current
+ // (field,entity type,geometry type) We suppose there is the same list
+ // whatever the existing (entity type,geometry type) pair
+
+ // support map :
+
+ for (currentEntity=meshEntities.begin();currentEntity != meshEntities.end(); currentEntity++)
+ {
+ // numberOfTimeSteps MUST be given by MEDchampInfo !!!!!
+ for (currentGeometry = (*currentEntity).second.begin();
+ currentGeometry != (*currentEntity).second.end();
+ currentGeometry++)
+ {
+ MESSAGE("Field information with Entity,Geom = "<<
+ (*currentEntity).first<<","<<(*currentGeometry));
+
+ numberOfTimeSteps =
+ MEDnPasdetemps(_medIdt, fieldName,
+ (MED_FR::med_entite_maillage)(*currentEntity).first,
+ (MED_FR::med_geometrie_element) (*currentGeometry) );
+
+ MESSAGE("Field information 2 : NumberOfTimeStep :"<<
+ numberOfTimeSteps);
+
+ if ( numberOfTimeSteps > 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 = "<<j);
- err = MEDpasdetempsInfo( _medIdt, fieldName,
- (MED_FR::med_entite_maillage) (*currentEntity).first,
- (*currentGeometry),j,
- meshName, &NbOfGaussPts,
- &timeStepNumber, timeStepUnit, &timeStep,
- &orderNumber);
- if (err == MED_VALID) { // we have found for (*currentEntity).first and (*currentGeometry)
-
- MESSAGE("Field information 5 ;: NumberOfGaussPoint : "<<NbOfGaussPts<<", timeStepNumber : "<<timeStepNumber);
- // CORRECT a bug in MEDpasdetempsInfo :
- // we get a value n'importe quoi in NbOfGaussPts !!!!
-
- if (NbOfGaussPts>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 = "<<j);
+
+ // err = MEDpasdetempsInfo( _medIdt, fieldName,
+ // (MED_FR::med_entite_maillage) (*currentEntity).first,
+ // (*currentGeometry),j, meshName,
+ // &NbOfGaussPts, &timeStepNumber,
+ // timeStepUnit, &timeStep, &orderNumber);
+
+ err = MEDpasdetempsInfo(_medIdt, fieldName,
+ (MED_FR::med_entite_maillage)
+ (*currentEntity).first,
+ (MED_FR::med_geometrie_element)
+ (*currentGeometry),j,
+ &NbOfGaussPts, &timeStepNumber,
+ &orderNumber, timeStepUnit,
+ &timeStep, meshName, &meshLink,
+ &numberOfRefMesh);
+
+ if (err == MED_VALID)
+ { // we have found for (*currentEntity).first and
+ // (*currentGeometry)
+ MESSAGE("Field information 5 ;: NumberOfGaussPoint : " << NbOfGaussPts << ", timeStepNumber : " << timeStepNumber << ", orderNumber : " << orderNumber);
+ // CORRECT a bug in MEDpasdetempsInfo :
+ // we get a value n'importe quoi in NbOfGaussPts !!!!
+
+ if (timeStepNumber<0) timeStepNumber=-1 ;
+ if ((numberOfRefMesh != 1) ||
+ (meshLink != MED_FR::MED_VRAI) ||
+ (NbOfGaussPts != 1))
+ {
+ NbOfGaussPts = 1;
+ numberOfRefMesh=1;
+ meshLink != MED_FR::MED_VRAI;
+ MESSAGE("This field is Med Memory compliant because NumberOfGaussPoint : " << NbOfGaussPts << ", or numberOfRefMesh : " << numberOfRefMesh << ", or meshLink : " << meshLink);
+ }
+
+ // ATTENTION TRAITER L'EXCEPTION CI DESSUS !!!!!!!!
- // ATTENTION TRAITER L'EXCEPTION !!!!!!!!!!!!
+ // 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;
- // 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<MESH_NAME_,MESH*>::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<MED_FR::med_int> ( ptrSupport,numberOfComponents ); // Les valeurs du champ ne doivent pas être lue pour l'instant
-
- ptrField = new FIELD<MED_FR::med_int> ( ); // Les valeurs du champ ne doivent pas être lue pour l'instant
- ((FIELD<MED_FR::med_int>*) ptrField)->setSupport(ptrSupport);
- ((FIELD<MED_FR::med_int>*) ptrField)->setNumberOfComponents(numberOfComponents);
- ((FIELD<MED_FR::med_int>*) ptrField)->setName(fieldName) ; //provisoire, pour debug
- MESSAGE("#### SET NAME in FIELD : "<<fieldName);
-
- MED_EN::med_mode_acces myMode = getAccessMode();
- switch (myMode) {
- case MED_EN::MED_LECT:
- ptrDriver = new MED_FIELD_RDONLY_DRIVER<MED_FR::med_int>(_fileName, (FIELD<MED_FR::med_int> *)ptrField);
- break ;
- case MED_EN::MED_REMP:
- ptrDriver = new MED_FIELD_RDWR_DRIVER<MED_FR::med_int>(_fileName, (FIELD<MED_FR::med_int> *)ptrField);
- break ;
- case MED_EN::MED_ECRI: // should never append !!
- ptrDriver = new MED_FIELD_RDONLY_DRIVER<MED_FR::med_int>(_fileName, (FIELD<MED_FR::med_int> *)ptrField);
- break;
- default:
- throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Bad file mode access !"));
+ map<MESH_NAME_,MESH*>::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<MED_FR::med_int> (ptrSupport,numberOfComponents);
+ // Les valeurs du champ ne doivent pas être lue
+ // pour l'instant
+
+ ptrField = new FIELD<MED_FR::med_int> ( );
+ // Les valeurs du champ ne doivent pas être lue
+ // pour l'instant
+ ((FIELD<MED_FR::med_int>*)
+ ptrField)->setSupport(ptrSupport);
+ ((FIELD<MED_FR::med_int>*)
+ ptrField)->setNumberOfComponents(numberOfComponents);
+ ((FIELD<MED_FR::med_int>*)
+ ptrField)->setName(fieldName) ;
+ //provisoire, pour debug
+ MESSAGE("#### SET NAME in FIELD : "<<fieldName);
+
+ MED_EN::med_mode_acces myMode = getAccessMode();
+ switch (myMode) {
+ // case MED_EN::MED_LECT: V2_1->V2_2
+ case MED_EN::MED_LECTURE:
+ ptrDriver = new
+ MED_FIELD_RDONLY_DRIVER<MED_FR::med_int>
+ (_fileName, (FIELD<MED_FR::med_int> *)
+ ptrField);
+ break ;
+ // case MED_EN::MED_REMP: V2_1->V2_2
+ case MED_EN::MED_LECTURE_ECRITURE:
+ ptrDriver = new
+ MED_FIELD_RDWR_DRIVER<MED_FR::med_int>
+ (_fileName, (FIELD<MED_FR::med_int> *)
+ 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<MED_FR::med_int>
+ // (_fileName, (FIELD<MED_FR::med_int> *)
+ // ptrField);
+ ptrDriver = new
+ MED_FIELD_WRONLY_DRIVER<MED_FR::med_int>
+ (_fileName, (FIELD<MED_FR::med_int> *)
+ ptrField);
+ break;
+ case MED_EN::MED_CREATION: // V2_1->V2_2
+ ptrDriver = new
+ MED_FIELD_WRONLY_DRIVER<MED_FR::med_int>
+ (_fileName, (FIELD<MED_FR::med_int> *)
+ ptrField);
+ break;
+ default:
+ throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Bad file mode access !"));
+ }
+ break;
+ }
+ case MED_EN::MED_REEL64 : {
+ // ptrField = new FIELD<MED_FR::med_float>
+ // (ptrSupport,numberOfComponents );
+ // Les valeurs du champ ne doivent pas être lue
+ // pour l'instant
+ ptrField = new FIELD<MED_FR::med_float> ( );
+ // Les valeurs du champ ne doivent pas être lue
+ // pour l'instant
+ ((FIELD<MED_FR::med_float>*)
+ ptrField)->setSupport(ptrSupport);
+ ((FIELD<MED_FR::med_float>*)
+ ptrField)->setNumberOfComponents(numberOfComponents);
+ ((FIELD<MED_FR::med_float>*)
+ ptrField)->setName(fieldName) ;
+ //provisoire, pour debug
+ MESSAGE("#### SET NAME in FIELD : "<<fieldName);
+
+ MED_EN::med_mode_acces myMode = getAccessMode();
+ switch (myMode) {
+ // case MED_EN::MED_LECT: V2_1->V2_2
+ case MED_EN::MED_LECTURE:
+ ptrDriver = new
+ MED_FIELD_RDONLY_DRIVER<MED_FR::med_float>
+ (_fileName, (FIELD<MED_FR::med_float> *)
+ ptrField);
+ break ;
+ // case MED_EN::MED_REMP: V2_1->V2_2
+ case MED_EN::MED_LECTURE_ECRITURE:
+ ptrDriver = new
+ MED_FIELD_RDWR_DRIVER<MED_FR::med_float>
+ (_fileName, (FIELD<MED_FR::med_float> *)
+ 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<MED_FR::med_float>
+ // (_fileName, (FIELD<MED_FR::med_float> *)
+ // ptrField);
+ ptrDriver = new
+ MED_FIELD_WRONLY_DRIVER<MED_FR::med_float>
+ (_fileName, (FIELD<MED_FR::med_float> *)
+ ptrField);
+ break;
+ case MED_EN::MED_CREATION:
+ // should never append !!
+ ptrDriver = new
+ MED_FIELD_WRONLY_DRIVER<MED_FR::med_float>
+ (_fileName, (FIELD<MED_FR::med_float> *)
+ ptrField);
+ break;
+ default:
+ throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Bad file mode access !"));
}
- break;
- }
- case MED_FR::MED_REEL64 : {
- // ptrField = new FIELD<MED_FR::med_float> ( ptrSupport,numberOfComponents ); // Les valeurs du champ ne doivent pas être lue pour l'instant
- ptrField = new FIELD<MED_FR::med_float> ( ); // Les valeurs du champ ne doivent pas être lue pour l'instant
- ((FIELD<MED_FR::med_float>*) ptrField)->setSupport(ptrSupport);
- ((FIELD<MED_FR::med_float>*) ptrField)->setNumberOfComponents(numberOfComponents);
- ((FIELD<MED_FR::med_float>*) ptrField)->setName(fieldName) ; //provisoire, pour debug
- MESSAGE("#### SET NAME in FIELD : "<<fieldName);
-
- MED_EN::med_mode_acces myMode = getAccessMode();
- switch (myMode) {
- case MED_EN::MED_LECT:
- ptrDriver = new MED_FIELD_RDONLY_DRIVER<MED_FR::med_float>(_fileName, (FIELD<MED_FR::med_float> *)ptrField);
- break ;
- case MED_EN::MED_REMP:
- ptrDriver = new MED_FIELD_RDWR_DRIVER<MED_FR::med_float>(_fileName, (FIELD<MED_FR::med_float> *)ptrField);
- break ;
- case MED_EN::MED_ECRI: // should never append !!
- ptrDriver = new MED_FIELD_RDONLY_DRIVER<MED_FR::med_float>(_fileName, (FIELD<MED_FR::med_float> *)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 :"<<timeStepNumber<<",orderNumber :"<<orderNumber);
- ptrField->setIterationNumber ( timeStepNumber); // A ajouter dans la classe FIELD
- ptrField->setOrderNumber ( orderNumber);
- ptrField->setTime ( timeStep);
+ MESSAGE("timeStepNumber :"<<timeStepNumber<<
+ ",orderNumber :"<<orderNumber);
+ ptrField->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 : #"<<fieldName<<"#");
- ptrDriver->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
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 <char *> (_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 <char *>
+ (_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 <char *> (_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 <char *>
+ (_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 <char *> ( tmp_nom_coord.c_str()) ) ;
char * tmp_unit= (const_cast <char *> ( 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 <char *> (_meshName.c_str()),
- MED_FR::MED_GRID_NOEUD);
+ NumberOfNodes = MED_FR::MEDnEntMaa(_medIdt,
+ const_cast <char *>
+ (_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 <double *>
-// (_ptrMesh->_coordinate->getCoordinates(MED_EN::MED_FULL_INTERLACE));
-
-// err = MED_FR::MEDbodyFittedLire (_medIdt,
-// const_cast <char *> (_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 <char *> (_ptrMesh->_name.c_str()),
- _ptrMesh->_spaceDimension,
- const_cast <double *> ( _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 <char *>
+ (_ptrMesh->_name.c_str()),
+ MeshDimension,structure);
-// for (int icoor = 0 ; icoor<NumberOfNodes ; icoor++)
-// for(int jcoor = 0 ; jcoor<SpaceDimension ; jcoor++)
-// MESSAGE(LOC << " icoor = " << icoor << " jcoor = " << jcoor << " COOR = " << _ptrMesh->getCoordinates(MED_FULL_INTERLACE)[icoor*SpaceDimension+jcoor]);
-
- delete[] MEDArrayNodeFamily;
if (err != MED_VALID)
- throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"error in MEDbodyFittedLire()"));
+ throw MEDEXCEPTION(STRING(LOC) <<"Error in reading the structure of grid : |" << _meshName << "|" ) ;
+
+ for (int idim = 0; idim < MeshDimension; idim++)
+ ArrayLen [idim][0] = structure[idim];
+
+ delete [] structure;
+
+ err = MEDcoordLire(_medIdt,
+ const_cast <char *> (_ptrMesh->_name.c_str()),
+ _ptrMesh->_spaceDimension,
+ //const_cast <double *> ( _ptrMesh->_coordinate->_coordinate->get(MED_EN::MED_FULL_INTERLACE) ),
+ const_cast <double *> ( _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 <char *> (_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 <char *> (_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 <char *>
+ (_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 <char *> (_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 <char *> (_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
_ptrMesh->_coordinate->setCoordinatesSystem(coordinateSystem);
-
END_OF(LOC);
}
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 <char *> (_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 <char *>
+ (_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 <char *>
+ (_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
<< "for the mesh : |" << _meshName << "|" )) ;
_ptrMesh->_numberOfNodes = NumberOfNodes ;
-
-
// create a COORDINATE object
_ptrMesh->_coordinate = new COORDINATE(SpaceDimension, NumberOfNodes, MED_EN::MED_FULL_INTERLACE);
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
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) ;
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 <char *> (_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 <char *> (_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 <char *> (_meshName.c_str()),0,MED_FR::MED_FAMILLE) ;
+// int NumberOfFamilies = MEDnFam(_medIdt,const_cast <char *> (_meshName.c_str()),0,MED_FR::MED_FAMILLE) ;
+
+ int NumberOfFamilies = MED_FR::MEDnFam(_medIdt, const_cast <char *>
+ (_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" ));
int numberOfFacesFamilies = 0 ;
int numberOfEdgesFamilies = 0 ;
- for (int i=0;i<NumberOfFamilies;i++) {
-
- int NumberOfAttributes = MEDnFam(_medIdt,const_cast <char *> (_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 <char *> (_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 <char *> (_meshName.c_str()),
- i+1,const_cast <char *> (FamilyName.c_str()),
- &FamilyIdentifier,AttributesIdentifier,AttributesValues,
- const_cast <char *> (AttributesDescription.c_str()),
- &NumberOfAttributes,
- const_cast <char *> (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 "<<FamilyName<< " : skip");
- delete Family;
- } else
- switch (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<NumberOfFamilies;i++)
+ {
+ // int NumberOfAttributes = MEDnFam(_medIdt,const_cast <char *>
+ // (_meshName.c_str()),i+1,MED_FR::MED_ATTR) ;
- // MESSAGE(LOC << (*Family));
+ int NumberOfAttributes = MED_FR::MEDnAttribut(_medIdt,
+ const_cast <char *>
+ (_meshName.c_str()),
+ (i+1));
+ if (NumberOfAttributes < 0)
+ throw MEDEXCEPTION("MED_MESH_RDONLY_DRIVER::getFAMILY() : NumberOfAttributes" );
+
+ // int NumberOfGroups = MEDnFam(_medIdt,const_cast <char *>
+ // (_meshName.c_str()),i+1,MED_FR::MED_GROUPE) ;
+ int NumberOfGroups = MED_FR::MEDnGroupe(_medIdt, const_cast <char *>
+ (_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 <char *>
+ (_meshName.c_str()),
+ (i+1),const_cast <char *>
+ (FamilyName.c_str()), &FamilyIdentifier,
+ AttributesIdentifier,AttributesValues,
+ const_cast <char *>
+ (AttributesDescription.c_str()),
+ &NumberOfAttributes, const_cast <char *>
+ (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 "<<FamilyName<<
+ " : skip");
+ delete Family;
+ }
+ else
+ switch (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 <char *> (_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 <char *>
+ (_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<Connectivity->_numberOfTypes;i++) {
- int NumberOfCell = Connectivity->_count[i+1]-Connectivity->_count[i] ;
- err=MEDfamLire(_medIdt,const_cast <char *> (_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 <char *> (_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 "<<Connectivity->_entity<<" and geometric type "<<Connectivity->_geometricTypes[i]));
-
+ SCRUTE(Connectivity->_numberOfTypes);
+
+ for (i=0;i<Connectivity->_numberOfTypes;i++)
+ {
+ int NumberOfCell = Connectivity->_count[i+1]-Connectivity->_count[i];
+
+ SCRUTE(NumberOfCell);
+
+ err=MEDfamLire(_medIdt,const_cast <char *> (_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 <char *>
+ (_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 "<<Connectivity->_entity<<" and geometric type "<<Connectivity->_geometricTypes[i]));
+ }
+ return MED_VALID;
}
- return MED_VALID;
- }
return MED_ERROR;
}
// 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 <ptrMesh->_meshName>
- int dim = MED_FR::MEDdimLire(_medIdt, const_cast <char *> (_meshName.c_str()) );
- if (dim < MED_VALID)
- {
- err = MEDgridCr(_medIdt,
- const_cast <char *> (_meshName.c_str()),
- _ptrMesh->_spaceDimension,
- (MED_FR::med_grid_type) ptrGrid->getGridType());
+
+ int spaceDimension = MED_FR::MEDdimEspaceLire(_medIdt, const_cast <char *>
+ (_meshName.c_str()) );
+
+ int meshDimension = MED_FR::MEDdimLire(_medIdt, const_cast <char *>
+ (_meshName.c_str()) );
+
+ if ((spaceDimension != MED_VALID) && (meshDimension != MED_VALID))
+ {
+ err = MEDmaaCr(_medIdt,
+ const_cast <char *> (_meshName.c_str()),
+ _ptrMesh->_meshDimension,MED_FR::MED_STRUCTURE,
+ const_cast <char *> (_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 ;
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 <double *>
- (_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 <double *>
+ (_ptrMesh->_coordinate->getCoordinates(MED_EN::MED_FULL_INTERLACE));
- // Write unused families
- int * MEDArrayNodeFamily = new int[_ptrMesh->_numberOfNodes] ;
-
- err = MEDbodyFittedEcr (_medIdt,
- const_cast <char *> (_ptrMesh->_name.c_str()),
- _ptrMesh->_spaceDimension,
- coo,
- ArrayLen,
- MED_FR::MED_FULL_INTERLACE,
- rep,
- const_cast <char *> (tmp_name.c_str()),
- const_cast <char *> (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 <char *>
+ (_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 <char *> (_ptrMesh->_name.c_str()),
- _ptrMesh->_spaceDimension,
- Array [idim],
- ArrayLen [idim],
- idim,
- MED_FR::MED_FULL_INTERLACE,
- rep,
- const_cast <char *> (tmp_name.c_str()),
- const_cast <char *> (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 <char *> (_meshName.c_str()),
+ _ptrMesh->_spaceDimension,
+ //const_cast <double *> ( _ptrMesh->_coordinate->_coordinate->get(MED_EN::MED_FULL_INTERLACE) ),
+ const_cast <double *> ( _ptrMesh->_coordinate->_coordinate.get(MED_EN::MED_FULL_INTERLACE) ),
+ MED_FR::MED_FULL_INTERLACE, _ptrMesh->_numberOfNodes,
+ // _ptrMesh->_coordinate->_numberOfNodes
+ rep, const_cast <char *> (tmp_name.c_str()),
+ const_cast <char *> (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 <char *> (_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 <char *>
+ (_ptrMesh->_name.c_str()),
+ _ptrMesh->_meshDimension,
+ Array[idim], ArrayLen[idim],
+ (idim+1), const_cast <char *>
+ (str_name.c_str()),
+ const_cast <char *>
+ (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);
// 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 <ptrMesh->_meshName>
- int dim = MED_FR::MEDdimLire(_medIdt, const_cast <char *> (_meshName.c_str()) );
- if (dim < MED_VALID)
- if (MED_FR::MEDmaaCr(_medIdt,const_cast <char *> (_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 <char *>
+ (_meshName.c_str()));
+
+ int meshDimension = MED_FR::MEDdimLire(_medIdt, const_cast <char *>
+ (_meshName.c_str()) );
+
+ if ((spaceDimension != MED_VALID) && (meshDimension != MED_VALID))
+ {
+ err = MEDmaaCr(_medIdt, const_cast <char *> (_meshName.c_str()),
+ _ptrMesh->_meshDimension, MED_FR::MED_NON_STRUCTURE,
+ const_cast <char *> (_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;
<< _ptrMesh->_coordinate->_coordinateSystem
<< "|" )) ;
+// err = MEDcoordEcr(_medIdt, const_cast <char *> (_meshName.c_str()),
+// _ptrMesh->_spaceDimension,
+// //const_cast <double *> ( _ptrMesh->_coordinate->_coordinate->get(MED_EN::MED_FULL_INTERLACE) ),
+// const_cast <double *> ( _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 <char *> (tmp_name.c_str()),
+// const_cast <char *> (tmp_unit.c_str())
+// );
+
err = MEDcoordEcr(_medIdt, const_cast <char *> (_meshName.c_str()),
_ptrMesh->_spaceDimension,
//const_cast <double *> ( _ptrMesh->_coordinate->_coordinate->get(MED_EN::MED_FULL_INTERLACE) ),
const_cast <double *> ( _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 <char *> (tmp_name.c_str()),
- const_cast <char *> (tmp_unit.c_str())
- );
+ MED_FR::MED_FULL_INTERLACE, _ptrMesh->_numberOfNodes,
+ // _ptrMesh->_coordinate->_numberOfNodes
+ rep, const_cast <char *> (tmp_name.c_str()),
+ const_cast <char *> (tmp_unit.c_str()));
if (err<0)
throw MEDEXCEPTION(LOCALIZED(STRING(LOC) <<"Can't write coordinates of mesh |" << _meshName.c_str() << "| in file |" << _fileName
if (_ptrMesh->_arePresentOptionnalNodesNumbers==1) {
- err = MEDnumEcr(_medIdt,const_cast <char *> (_meshName.c_str()),
+ err = MEDnumEcr(_medIdt, const_cast <char *> (_meshName.c_str()),
const_cast <med_int *> (_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 << " |")) ;
}
//////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////
- err = MEDconnEcr( _medIdt, const_cast <char *> ( _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 <char *> ( _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 <char *> ( _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
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 <char *> ( _meshName.c_str()),
- _ptrMesh->_spaceDimension,
- const_cast <int *> (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 <char *> ( _meshName.c_str()),
+// _ptrMesh->_spaceDimension,
+// const_cast <int *> (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 <char *> ( _meshName.c_str()),
+ _ptrMesh->_spaceDimension,
+ const_cast <int *> (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
MEDArrayNodeFamily[Number[j]-1]=FamilyIdentifier ;
}
}
+
for(int j=0; j<NumberOfNodes; j++) {
SCRUTE(MEDArrayNodeFamily[j]);
}
- if ( !_ptrMesh->getIsAGrid() )
- err = MEDfamEcr(_medIdt, const_cast <char *> ( _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 <char *> (_ptrMesh->_name.c_str()),
- MEDArrayNodeFamily,
- NumberOfNodes,
- MED_FR::MED_REMP,
- MED_FR::MED_NOEUD);
+
+// if ( !_ptrMesh->getIsAGrid() )
+
+ err = MEDfamEcr(_medIdt, const_cast <char *> ( _meshName.c_str() ),
+ MEDArrayNodeFamily, NumberOfNodes, MED_FR::MED_NOEUD,
+ (enum MED_FR::med_geometrie_element) MED_NONE);
+
+// else
+// err = MEDfamGridEcr(_medIdt,
+// const_cast <char *> (_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
for (int i=0; i<numberOfTypes; i++) {
err = MEDfamEcr(_medIdt, const_cast <char *> ( _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 "<<i);
if ( err != MED_VALID)
throw MEDEXCEPTION(LOCALIZED(STRING(LOC) << "Can't write family for the |"<< _ptrMesh->getNumberOfElements(entity, types[i])
const int * typeCount = _ptrMesh->getGlobalNumberingIndex(entity) ;
for (int i=0; i<numberOfTypes; i++) {
-
int typeNumberOfElements = typeCount[i+1] - typeCount[i] ;
+
err = MEDfamEcr(_medIdt, const_cast <char *> ( _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]);
const int * typeCount = _ptrMesh->getGlobalNumberingIndex(entity) ;
for (int i=0; i<numberOfTypes; i++) {
-
int typeNumberOfElements = typeCount[i+1] - typeCount[i] ;
+
err = MEDfamEcr(_medIdt, const_cast <char *> ( _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 |"
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;
MESH::MESH(MESH &m)
{
- _name=m._name;
+ _name = m._name;
+ _description = m._description;
_isAGrid = m._isAGrid;
if (m._coordinate != NULL)
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)
protected :
string _name; // A POSITIONNER EN FCT DES IOS ?
+ string _description;
mutable COORDINATE * _coordinate;
mutable CONNECTIVITY * _connectivity;
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();
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
{
#include "MEDMEM_Group.hxx"
using namespace MEDMEM;
-/*! Create an empty MESH. */
+/*! Create an empty %MESH. */
MESHING::MESHING(): MESH()
{
MESSAGE("MESHING::MESHING()");
// _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 ;
- "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,
_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)
{
}
/*! 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)
{
/*!
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)
{
}
/*! 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)
{
/*!
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)
{
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)
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 {
#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;
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;
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
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 */
#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
/*----------------------------------------------------------------------------
-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
----------------------------------------------------------------------------*/
/******************************************************************************
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;
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
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];
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:
*/
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
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)
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) */
}
}
- if (ret == 0)
+ if (ret == 0)
{
nfamn = 2;
for (i=0;i<nfamn;i++)
/* fermeture du fichier */
ret = MEDfermer(fid);
- printf("%d\n",ret);
+ printf("MEDfermer : %d\n",ret);
-/* Ecriture d'un deuxieme maillage structure : body fitted
- ******************************************************* */
+ /* Ecriture d'un deuxieme maillage structure : grille standard
+ ************************************************************* */
- fid = MEDouvrir("test19.med",MED_ECRI);
+ fid = MEDouvrir("test19.med", MED_LECTURE_ECRITURE);
if (fid < 0)
ret = -1;
else
ret = 0;
- printf("%d\n",ret);
+ printf("MEDouvrir : %d\n",ret);
+
+ strcpy(maa, "Grille Standard");
+ strcpy(maadesc, "Example de maillage structure grille standard 2D");
+ /* creation du maillage grille standard maa de dimension 2 */
+ if (ret == 0)
+ ret = MEDmaaCr(fid, maa, mdim, MED_STRUCTURE, maadesc);
+ printf("MEDmaaCr : %d\n",ret);
- strcpy(maa, "bodyfitted");
- /* creation du maillage body fitted maa de dimension 2 */
if (ret == 0)
- ret = MEDgridCr(fid, maa, mdim, MED_BODY_FITTED);
- printf("%d\n",ret);
+ ret = MEDnatureGrilleEcr(fid, maa, MED_GRILLE_STANDARD);
+ printf("MEDnatureGrilleEcr : %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 = MEDstructureCoordEcr(fid,maa,mdim,nbr); */
+/* printf("MEDstructureCoordEcr : %d\n",ret); */
+
if (ret == 0)
- ret = MEDbodyFittedEcr(fid,maa,mdim,coo,nbr,MED_FULL_INTERLACE,MED_CART,
- nomcoo,unicoo,nufano,nnoe,MED_ECRI);
- printf("%d\n",ret);
+ ret = MEDcoordEcr(fid,maa,mdim,coo,MED_FULL_INTERLACE,nnoe,MED_CART,
+ nomcoo,unicoo);
+ printf("MEDcoordEcr : %d\n",ret);
+
+ if (ret == 0)
+ ret = MEDstructureCoordEcr(fid,maa,mdim,nbr);
+ printf("MEDstructureCoordEcr : %d\n",ret);
+
+ /* Ecriture des familles de la grille standard */
+
+ /* les noeuds */
+
+ if (ret == 0) {
+ famNodeStd[ 0]=1; famNodeStd[ 1]=1;
+ famNodeStd[ 2]=2; famNodeStd[ 3]=2;
+
+ ret = MEDfamEcr(fid, maa, famNodeStd, 4, MED_NOEUD, 0);
+ };
+ printf("MEDfamEcr for Nodes : %d\n",ret);
+
+ /* les elements */
+
+ if (ret == 0) {
+ famElmtStd[ 0]=0;
+
+ ret = MEDfamEcr(fid, maa, famElmtStd, 1, MED_MAILLE, MED_QUAD4);
+ };
+ printf("MEDfamEcr for Elements : %d\n",ret);
+
+ /* les faces/edges */
+
+ if (ret == 0) {
+ for (i=0; i<4; i++) famFaceStd[i]=0;
+
+ ret = MEDfamEcr(fid, maa, famFaceStd, 4, MED_ARETE, MED_SEG2);
+ };
+ printf("MEDfamEcr for Elements : %d\n",ret);
/* la famille 0 */
if (ret == 0)
ret = MEDfamCr(fid,maa,nomfam,numfam,&attide,&attval,attdes,0,
gro,0);
}
- printf("%d \n",ret);
-
-
+ printf("MEDfamCr : %d\n",ret);
- if (ret == 0)
+ if (ret == 0)
{
nfamn = 2;
for (i=0;i<nfamn;i++)
}
}
-
-
-
/* fermeture du fichier */
ret = MEDfermer(fid);
- printf("%d\n",ret);
+ printf("MEDfermer : %d\n",ret);
-/* Ecriture d'un troisieme maillage structure : grille cartesienne
- *************************************************************** */
+ /* Ecriture d'un troisieme maillage structure : grille cartesienne
+ *************************************************************** */
- fid = MEDouvrir("test19.med", MED_ECRI);
+ fid = MEDouvrir("test19.med", MED_LECTURE_ECRITURE);
if (fid < 0)
ret = -1;
else
ret = 0;
- printf("%d\n",ret);
+ printf("MEDouvrir : %d\n",ret);
- strcpy(maa, "CartGrid");
+ strcpy(maa, "Grille Cartesienne");
+ strcpy(maadesc, "Example de maillage structure grille cartesienne 2D");
/* creation d'une grille cartesienne maa de dimension 2 */
if (ret == 0)
- ret = MEDgridCr(fid, maa, mdim, MED_CARTESIAN);
- printf("%d\n",ret);
-
- /* Ecriture des indices de la grille cartesienne :
- - des coo en mode MED_FULL_INTERLACE : (X1,Y1,X2,Y2,X3,Y3,...) */
- for (i=0; i<mdim; i++) {
- coo[0] = 1.1+i;
- coo[1] = 1.2+i;
- coo[2] = 1.3+i;
- coo[3] = 1.4+i;
- if (ret == 0) {
- ret = MEDgridEcr(fid, maa, mdim, coo, nnoe, i, MED_FULL_INTERLACE, MED_CART, nomcoo, unicoo, MED_ECRI);
- };
- };
- printf("%d\n",ret);
+ ret = MEDmaaCr(fid, maa, mdim, MED_STRUCTURE, maadesc);
+ printf("MEDmaaCr : %d\n",ret);
- /* Ecriture des familles de la grille cartesienne */
+ if (ret == 0)
+ ret = MEDnatureGrilleEcr(fid, maa, MED_GRILLE_CARTESIENNE);
+ printf("MEDnatureGrilleEcr : %d\n",ret);
+
+ /* Ecriture des indices de la grille cartesienne :
+ - des coo en mode MED_FULL_INTERLACE : (X1,Y1,X2,Y2,X3,Y3,...) */
+ for (i=0; i<mdim; i++) {
+ ip1 = i + 1;
+ coo[0] = 1.1+i;
+ coo[1] = 1.2+i;
+ coo[2] = 1.3+i;
+ coo[3] = 1.4+i;
if (ret == 0) {
- fam[ 0]=3; fam[ 1]=3; fam[ 2]=2; fam[ 3]=1;
- fam[ 4]=7; fam[ 5]=8; fam[ 6]=2; fam[ 7]=4;
- fam[ 8]=2; fam[ 9]=9; fam[10]=0; fam[11]=2;
- fam[12]=5; fam[13]=5; fam[14]=6; fam[15]=7;
- ret = MEDfamGridEcr(fid, maa, fam, 16, MED_ECRI,MED_NOEUD);
+ ret = MEDindicesCoordEcr(fid, maa, mdim, coo, nnoe, ip1,
+ nomcooi, unicooi);
};
+ };
+ printf("MEDindicesCoordEcr : %d\n",ret);
+
+ /* Ecriture des familles de la grille cartesienne */
+
+ /* les noeuds */
+
+ if (ret == 0) {
+ famNodeCart[ 0]=3; famNodeCart[ 1]=3; famNodeCart[ 2]=2; famNodeCart[ 3]=1;
+ famNodeCart[ 4]=7; famNodeCart[ 5]=8; famNodeCart[ 6]=2; famNodeCart[ 7]=4;
+ famNodeCart[ 8]=2; famNodeCart[ 9]=9; famNodeCart[10]=0; famNodeCart[11]=2;
+ famNodeCart[12]=5; famNodeCart[13]=5; famNodeCart[14]=6; famNodeCart[15]=7;
+
+ ret = MEDfamEcr(fid, maa, famNodeCart, 16, MED_NOEUD, 0);
+ };
+ printf("MEDfamEcr for Nodes : %d\n",ret);
+
+ /* les elements */
+
+ if (ret == 0) {
+ for(i=0; i<9; i++) famElmtCart[i]=0;
+
+ ret = MEDfamEcr(fid, maa, famElmtCart, 9, MED_MAILLE, MED_QUAD4);
+ };
+ printf("MEDfamEcr for Elements : %d\n",ret);
+
+ /* les faces/edges */
+ if (ret == 0) {
+ for(i=0; i<24; i++) famFaceCart[i]=0;
+
+ ret = MEDfamEcr(fid, maa, famFaceCart, 24, MED_ARETE, MED_SEG2);
+ };
+ printf("MEDfamEcr for Elements : %d\n",ret);
/* la famille 0 */
if (ret == 0)
ret = MEDfamCr(fid,maa,nomfam,numfam,&attide,&attval,attdes,0,
gro,0);
}
- printf("%d \n",ret);
-
+ printf("MEDfamCr : %d \n",ret);
- if (ret == 0)
+ if (ret == 0)
{
nfamn = 9;
for (i=0;i<nfamn;i++)
}
}
-
/* fermeture du fichier */
ret = MEDfermer(fid);
- printf("%d\n",ret);
+ printf("MEDfermer : %d\n",ret);
return 0;
}
#include <med.h>
#include <string.h>
-#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] = {
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};
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};
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};
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
/***************************************************************************/
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);
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);
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 :
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 :
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);
/***************************************************************************/
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);
}
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);
}
}
/* 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);
}
}
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;
/*
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};
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};
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
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 */
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)
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);
}
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);
}
}
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);
}
}
/***************************************************************************/
ret = MEDfermer(fid);
- printf("%d\n",ret);
+ printf("MEDfermer : %d\n",ret);
return 0;
}
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;
/*
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};
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};
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};
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
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
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 */
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);
}
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);
}
}
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);
}
}
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;
/*
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};
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};
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};
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
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
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 */
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);
}
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);
}
}
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);
}
}
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;
/*
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};
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};
*/
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
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 */
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);
}
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);
}
}
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);
}
}
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;
/*
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};
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};
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};
*/
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
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
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 */
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);
}
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);
}
}
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);
}
}
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;
/*
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};
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};
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};
*/
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
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
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 */
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);
}
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);
}
}
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);
}
}
break;
}
- case MED_FR::MED_REEL64:
+ case MED_FR::MED_FLOAT64:
{
((FIELD<double>*)myField)->read();
FIELDDOUBLE_i * myFieldDoubleI
break;
}
- case MED_FR::MED_REEL64:
+ case MED_FR::MED_FLOAT64:
{
((FIELD<double>*)myField)->read();
FIELDDOUBLE_i * myFieldDoubleI
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;
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 ;
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_;
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="")