Salome HOME
Final version of the V2_2_0 in the main trunk of the CVS tree.
[modules/med.git] / src / MEDMEM / create_mesh_c3h8.c
index c172f97a116632eeb74c7cbcb2409c10d7ec7e44..93d2612d9d40d04474b469d164552ac1afb21e36 100644 (file)
@@ -14,6 +14,7 @@ int main (int argc, char **argv)
   med_err ret;
   med_idt fid;
   char maa[MED_TAILLE_NOM+1] = "CUBE_EN_HEXA8";
+  char maadesc[MED_TAILLE_DESC+1] = "Example de maillage non structure 3D";
   med_int mdim = 3;
   med_int nnoe = 27;
   /*
@@ -48,8 +49,8 @@ int main (int argc, char **argv)
     0.5, 1.0, 1.0, 
     1.0, 1.0, 1.0
   };
-  char nomcoo[3*MED_TAILLE_PNOM+1] = "x       y       z       ";
-  char unicoo[3*MED_TAILLE_PNOM+1] = "cm      cm      cm      ";
+  char nomcoo[3*MED_TAILLE_PNOM+1] = "x               y               z               ";
+  char unicoo[3*MED_TAILLE_PNOM+1] = "cm              cm              cm              ";
   /*  char nomnoe[19*MED_TAILLE_PNOM+1] = "nom1    nom2    nom3    nom4";*/
   char *nomnoe ;
   med_int numnoe[27] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27};
@@ -68,7 +69,7 @@ int main (int argc, char **argv)
     16, 25, 26, 17, 13, 22, 23, 14,
     17, 26, 27, 18, 14, 23, 24, 15
   };
-  char nomhexa8[MED_TAILLE_PNOM*8+1] = "hexa1   hexa2   hexa3   hexa4   hexa5   hexa6   hexa7   hexa8   ";
+  char nomhexa8[MED_TAILLE_PNOM*8+1] = "hexa1           hexa2           hexa3           hexa4           hexa5           hexa6           hexa7           hexa8           ";
   med_int numhexa8[8] = {1,2,3,4,5,6,7,8};
   med_int nufahexa8[8] = {-1,-1,-1,-1,-2,-2,-2,-2};
 
@@ -90,43 +91,43 @@ int main (int argc, char **argv)
   */
 
   char champ1[MED_TAILLE_NOM+1]="fieldnodeint" ;
-  char champ1_comp[MED_TAILLE_PNOM+1]="comp1   " ;
-  char champ1_unit[MED_TAILLE_PNOM+1]="M       " ;
+  char champ1_comp[MED_TAILLE_PNOM+1]="comp1           " ;
+  char champ1_unit[MED_TAILLE_PNOM+1]="M               " ;
   med_int fieldnodeint[27] = {1,1,3,2,2,3,4,4,5,1,1,3,2,2,3,4,4,5,1,1,3,2,2,3,4,4,5};
 
   char champ2[MED_TAILLE_NOM+1]="fieldnodedouble" ;
-  char champ2_comp[MED_TAILLE_PNOM+1]="comp1   " ;
-  char champ2_unit[MED_TAILLE_PNOM+1]="J       " ;
+  char champ2_comp[MED_TAILLE_PNOM+1]="comp1           " ;
+  char champ2_unit[MED_TAILLE_PNOM+1]="J               " ;
   med_float fieldnodedouble1[27] = {1.,3.,4.,1.,3.,4.,3.,2.,5.,1.,3.,4.,1.,3.,4.,3.,2.,5.,1.,3.,4.,1.,3.,4.,3.,2.,5.};
   med_float fieldnodedouble2[27] = {1.,2.,2.,3.,3.,3.,4.,4.,5.,1.,2.,2.,3.,3.,3.,4.,4.,5.,1.,2.,2.,3.,3.,3.,4.,4.,5.};
 
   char champ3[MED_TAILLE_NOM+1]="fieldcelldouble" ;
-  char champ3_comp[MED_TAILLE_PNOM*3+1]="comp1   comp2   comp3   " ;
-  char champ3_unit[MED_TAILLE_PNOM*3+1]="M/S     m/s     m/s     " ;
+  char champ3_comp[MED_TAILLE_PNOM*3+1]="comp1           comp2           comp3           " ;
+  char champ3_unit[MED_TAILLE_PNOM*3+1]="M/S             m/s             m/s             " ;
   med_float fieldcelldouble[8*3] = {0.,1.,1.,1.,1.,2.,2.,3.,0.,1.,1.,1.,1.,2.,2.,3.,0.,1.,1.,1.,1.,2.,2.,3.};
 
   /***************************************************************************/
-  fid = MEDouvrir("cube_hexa8.med",MED_REMP);
+  fid = MEDouvrir("cube_hexa8.med",MED_LECTURE_ECRITURE);
   if (fid < 0)
     ret = -1;
   else
     ret = 0;
-  printf("%d\n",ret);
+  printf("MEDouvrir : %d\n",ret);
 
   /***************************************************************************/
   if (ret == 0)
-    ret = MEDmaaCr(fid,maa,mdim);
-  printf("%d\n",ret);
+    ret = MEDmaaCr(fid,maa,mdim,MED_NON_STRUCTURE,maadesc);
+  printf("MEDmaaCr : %d\n",ret);
   if (ret == 0)
     ret = MEDunvCr(fid,maa);
-  printf("%d\n",ret);
+  printf("MEDunvCr : %d\n",ret);
 
   /***************************************************************************/
   if (ret == 0)
     ret = MEDnoeudsEcr(fid,maa,mdim,coo,MED_FULL_INTERLACE,MED_CART,
                       nomcoo,unicoo,nomnoe,MED_FAUX,numnoe,MED_VRAI,
-                      nufano,nnoe,MED_ECRI);
-  printf("%d\n",ret);
+                      nufano,nnoe);
+  printf("MEDnoeudsEcr : %d\n",ret);
 
   /* ecriture des mailles MED_HEXA8 :
      - connectivite
@@ -136,8 +137,8 @@ int main (int argc, char **argv)
   if (ret == 0) 
     ret = MEDelementsEcr(fid,maa,mdim,hexa8,MED_FULL_INTERLACE,
                         nomhexa8,MED_FAUX,numhexa8,MED_VRAI,nufahexa8,nhexa8,
-                        MED_MAILLE,MED_HEXA8,MED_NOD,MED_ECRI);
-  printf("%d \n",ret);
+                        MED_MAILLE,MED_HEXA8,MED_NOD);
+  printf("MEDelementsEcr : %d \n",ret);
 
   /***************************************************************************/
   /* ecriture des familles */
@@ -224,9 +225,9 @@ int main (int argc, char **argv)
       printf("MEDchampCr : %d \n",ret);
       if (ret == 0) {
        ret = MEDchampEcr(fid, maa, champ1, (unsigned char *)fieldnodeint,
-                         MED_FULL_INTERLACE, nnoe,
-                         MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, 
-                         0, MED_NOPDT,"        ", 0., MED_NONOR);
+                         MED_FULL_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL,
+                         MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0,
+                         MED_NOPDT,"        ", 0., MED_NONOR);
        
        printf("MEDchampEcr : %d \n",ret);
       }
@@ -234,18 +235,18 @@ int main (int argc, char **argv)
   
   if (ret == 0)
     {
-      ret = MEDchampCr(fid,champ2,MED_REEL64,champ2_comp,champ2_unit,1);
+      ret = MEDchampCr(fid,champ2,MED_FLOAT64,champ2_comp,champ2_unit,1);
       printf("MEDchampCr : %d \n",ret);
       if (ret == 0) {
        ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble1,
-                         MED_FULL_INTERLACE, nnoe,
-                         MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, 
-                         0, 1,"S       ", 1.1 , MED_NONOR);
+                         MED_FULL_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL,
+                         MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0,
+                         1,"S       ", 1.1 , MED_NONOR);
        printf("MEDchampEcr1 : %d \n",ret);
        ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble2,
-                         MED_FULL_INTERLACE, nnoe,
-                         MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, 
-                         0, 2,"S       ", 1.2 , MED_NONOR);
+                         MED_FULL_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL,
+                         MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0,
+                         2,"S       ", 1.2 , MED_NONOR);
        printf("MEDchampEcr2 : %d \n",ret);
       }
     }
@@ -254,21 +255,21 @@ int main (int argc, char **argv)
   if (ret == 0)
     {
       ret = MEDchampEcr(fid, maa, champ2, (unsigned char *)fieldnodedouble1,
-                       MED_FULL_INTERLACE, nnoe,
-                       MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_NOEUD, 
-                       0, MED_NOPDT,"        ", 0. , MED_NONOR);
+                       MED_FULL_INTERLACE, nnoe, MED_NOGAUSS, MED_ALL,
+                       MED_NOPFL, MED_NO_PFLMOD, MED_NOEUD, 0,
+                       MED_NOPDT,"        ", 0. , MED_NONOR);
       printf("MEDchampEcr : %d \n",ret); 
     }
 
   if (ret == 0)
     {
-      ret = MEDchampCr(fid,champ3,MED_REEL64,champ3_comp,champ3_unit,3);
+      ret = MEDchampCr(fid,champ3,MED_FLOAT64,champ3_comp,champ3_unit,3);
       printf("MEDchampCr : %d \n",ret);
       if (ret == 0) {
        ret = MEDchampEcr(fid, maa, champ3, (unsigned char *)fieldcelldouble,
-                         MED_FULL_INTERLACE, nhexa8,
-                         MED_NOPG, MED_ALL, MED_NOPFL, MED_ECRI, MED_MAILLE, 
-                         MED_HEXA8, MED_NOPDT,"        ", 0., MED_NONOR);
+                         MED_FULL_INTERLACE, nhexa8, MED_NOGAUSS, MED_ALL,
+                         MED_NOPFL, MED_NO_PFLMOD, MED_MAILLE, MED_HEXA8,
+                         MED_NOPDT,"        ", 0., MED_NONOR);
        printf("MEDchampEcr : %d \n",ret);
       }
     }
@@ -280,4 +281,3 @@ int main (int argc, char **argv)
   
   return 0;
 }
-