2.3.6/test23.c

Aller à la documentation de ce fichier.
00001 /*  This file is part of MED.
00002  *
00003  *  COPYRIGHT (C) 1999 - 2015  EDF R&D, CEA/DEN
00004  *  MED is free software: you can redistribute it and/or modify
00005  *  it under the terms of the GNU Lesser General Public License as published by
00006  *  the Free Software Foundation, either version 3 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  MED is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU Lesser General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Lesser General Public License
00015  *  along with MED.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 
00019 /******************************************************************************
00020  * - Nom du fichier : test23.c
00021  *
00022  * - Description : ecriture de mailles/faces de type MED_POLYGONE
00023  *                 dans un maillage MED
00024  *
00025  *****************************************************************************/
00026 
00027 #include <med.h>
00028 #define MESGERR 1
00029 #include <med_utils.h>
00030 
00031 #ifdef DEF_LECT_ECR
00032 #define MODE_ACCES MED_LECTURE_ECRITURE
00033 #elif DEF_LECT_AJOUT
00034 #define MODE_ACCES MED_LECTURE_AJOUT
00035 #else
00036 #define MODE_ACCES MED_CREATION
00037 #endif
00038 
00039 int main (int argc, char **argv)
00040 
00041 
00042 {
00043   med_idt fid;
00044   char maa[MED_TAILLE_NOM+1] = "maa1";
00045   med_int mdim = 3;
00046   med_int index[4] = {1,6,12,17};
00047   med_int con[16] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
00048   med_int n=3,ni = 4;
00049   /*                             123456789012345612345678901234561234567890123456 */
00050   char nom[MED_TAILLE_PNOM*3+1]="poly1           poly2           poly3           ";
00051   med_int num[3] = {1,2,3};
00052   med_int fam[3] = {0,-1,-2};
00053 
00054   /* Creation du fichier test23.med */
00055   fid = MEDouvrir("test23.med",MODE_ACCES);
00056   if (fid == -1) {
00057     MESSAGE("Erreur a la creation du fichier test23.med");
00058     return -1;
00059   }
00060   printf("Creation du fichier test23.med \n");
00061  
00062   /* Creation du maillage */
00063   if (MEDmaaCr(fid,maa,mdim,MED_NON_STRUCTURE,
00064                "un maillage pour test23") < 0) {
00065     MESSAGE("Erreur a la creation du maillage");
00066     return -1;
00067   }
00068   printf("Creation du maillage \n");
00069 
00070   /* Ecriture de la connectivite des mailles polygones en mode nodal */
00071   if (MEDpolygoneConnEcr(fid,maa,index,ni,con,MED_MAILLE,MED_NOD) < 0) {
00072     MESSAGE("Erreur a l'ecriture de la connectivite des mailles MED_POLYGONE");
00073     return -1;
00074   }
00075   printf("Ecriture des connectivites de mailles de type MED_POLYGONE en mode nodal \n"); 
00076 
00077   /* Ecriture des noms des polygones */
00078   if (MEDnomEcr(fid,maa,nom,n,MED_MAILLE,MED_POLYGONE) < 0) {
00079     MESSAGE("Erreur a l'ecriture des noms mailles MED_POLYGONE");
00080     return -1;
00081   }
00082   printf("Ecriture des noms des polygones \n");
00083 
00084   /* Ecriture des numeros des polygones */
00085   if (MEDnumEcr(fid,maa,num,n,MED_MAILLE,MED_POLYGONE) < 0) {
00086     MESSAGE("Erreur a l'ecriture des numeros des mailles MED_POLYGONE");
00087     return -1;
00088   }
00089   printf("Ecriture des numeros des polygones \n");
00090 
00091   /* Ecriture des numeros des familles des polygones */
00092   if (MEDfamEcr(fid,maa,fam,n,MED_MAILLE,MED_POLYGONE) < 0) {
00093     MESSAGE("Erreur a l'ecriture des numeros de famille des mailles MED_POLYGONE");
00094     return -1;
00095   }
00096   printf("Ecriture des numeros des familles des polygones \n");
00097   
00098   /* Fermeture du fichier */
00099   if (MEDfermer(fid) < 0) {
00100     MESSAGE("Erreur a la fermeture du fichier");
00101     return -1;
00102   } 
00103   printf("Fermeture du fichier test23.med \n");
00104 
00105   return 0; 
00106 }

Généré le Thu Oct 8 14:26:17 2015 pour MED fichier par  doxygen 1.6.1