2.3.6/test16.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  * - Nom du fichier : test16.c
00020  *
00021  * - Description : ecriture d'elements de maillages MED
00022  *                 via les routines de niveau 2
00023  *                 - equivalent a test6.c
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   med_int nse2 = 5;
00045   med_int se2[10] = {1,2,1,3,2,4,3,4,2,3};
00046   /*                                12345678901234561234567890123456123456789012345612345678901234561234567890123456 */
00047   char nomse2[MED_TAILLE_PNOM*5+1]="se1             se2             se3             se4             se5             ";
00048   med_int numse2[5] = {1,2,3,4,5};
00049   med_int nufase2[5] = {-1,-1,0,-2,-3}; 
00050   med_int ntr3 = 2;
00051   med_int tr3[6] = {1,2,-5,-5,3,-4};
00052   /*                                  1234567890123456123456789012345612345678901234561234567890123456 */
00053   /* Erreur sur la taille de tr1, il manque deux blancs.*/
00054   char nomtr3[MED_TAILLE_PNOM*2+1] = "tr1           tr2             ";
00055   med_int numtr3[2] = {4,5};
00056   med_int nufatr3[2] = {0,-1};
00057   char maa[MED_TAILLE_NOM+1] = "maa1";
00058   med_int mdim = 2;
00059 
00060   /* Creation du fichier test16.med */
00061   if ( (fid = MEDouvrir("test16.med",MODE_ACCES) ) < 0) {
00062     MESSAGE("Impossible de creer le fichier test16.med : ");
00063     return -1;
00064   }
00065 
00066   /* Creation du maillage */
00067   if ( MEDmaaCr(fid,maa,mdim,MED_NON_STRUCTURE,
00068                    "un maillage pour test16") < 0 ) {
00069     MESSAGE("Impossible de creer le maillage : ");
00070     return -1;
00071   }
00072 
00073   /* Ecriture des aretes segments MED_SEG2 :
00074      - connectivite
00075      - noms (optionnel) 
00076      - numeros (optionnel)
00077      - numeros des familles */
00078   if ( MEDelementsEcr(fid,maa,mdim,se2,MED_NO_INTERLACE,nomse2,MED_VRAI,numse2,MED_VRAI,
00079                          nufase2,nse2,MED_ARETE,MED_SEG2,MED_DESC)< 0 ) {
00080     MESSAGE("Impossible d'ecrire la connectivité des aretes : ");
00081     return -1;
00082   }
00083 
00084   /* Ecriture des mailles MED_TRIA3 :
00085      - Connectivite
00086      - Noms (optionnel) 
00087      - Numeros (optionnel)
00088      - Numeros des familles */
00089   if ( MEDelementsEcr(fid,maa,mdim,tr3,MED_NO_INTERLACE,nomtr3,MED_VRAI,numtr3,MED_VRAI,
00090                          nufatr3,ntr3,MED_MAILLE,MED_TRIA3,MED_DESC) < 0 ) {
00091     MESSAGE("Impossible d'ecrire les éléments triangles : ");
00092     return -1;
00093   }
00094 
00095   /* Fermeture du fichier */
00096   if (  MEDfermer(fid) < 0) {
00097     MESSAGE("Impossible de fermerle fichier : ");
00098     return -1;
00099   }
00100 
00101   return 0;
00102   
00103 }
00104 
00105 
00106 
00107 
00108 
00109 

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