     1 /*************************************************************************
     2 * COPYRIGHT (C) 1999 - 2007  EDF R&D, CEA/DEN
     3 * THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
     4 * IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
     5 * AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
     6 * EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
     7 *
     8 * THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
     9 * WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
    10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
    11 * LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
    12 *
    13 * YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
    14 * ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
    15 * INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
    16 *
    17 *************************************************************************/
    18
    19 /******************************************************************************
    20  * - Nom du fichier : test12.c
    21  *
    22  * - Description : ecriture d'une equivalence dans un maillage MED
    23  *
    24  *****************************************************************************/
    25
    26 #include <med.h>
    27 #define MESGERR
    28 #include <med_utils.h>
    29
    30 #ifdef DEF_LECT_ECR
    31 #define MODE_ACCES MED_LECTURE_ECRITURE
    32 #elif DEF_LECT_AJOUT
    33 #define MODE_ACCES MED_LECTURE_AJOUT
    34 #else
    35 #define MODE_ACCES MED_CREATION
    36 #endif
    37
    38 int main (int argc, char **argv)
    39
    40
    41 {
    42   med_idt fid;
    43   char maa[MED_TAILLE_NOM+1]= "maa1";
    44   char equ[MED_TAILLE_NOM+1] = "equivalence";
    45   char des[MED_TAILLE_DESC+1] = "equivalence sur les mailles MED_TRIA3";
    46   med_int mdim = 3;
    47   med_int ncor = 3;
    48   med_int cor[6] = {1,2,3,4,5,6};
    49
    50   /* Creation du fichier "test12.med" */
    51   if ((fid = MEDouvrir("test12.med",MODE_ACCES)) < 0) {
    52     MESSAGE("Erreur a la creation du fichier test12.med");
    53     return -1;
    54   }
    55
    56   /* Creation du maillage */
    57   if (MEDmaaCr(fid,maa,3,MED_NON_STRUCTURE,
    58                    "Un maillage pour test12") < 0) {
    59     MESSAGE("Erreur a la creation du maillage");
    60     return -1;
    61   }
    62
    63   /* Creation de l'equivalence */
    64   if (MEDequivCr(fid,maa,equ,des) < 0) {
    65     MESSAGE("Erreur a la creation de l'equivalence");
    66     return -1;
    67   }
    68
    69   /* Ecriture des sur les mailles MED_TRIA3 */
    70   if (MEDequivEcr(fid,maa,equ,cor,ncor,MED_MAILLE,MED_TRIA3) < 0) {
    71     MESSAGE("Erreur a l'ecriture du tableau des correspondances");
    72     return -1;
    73   }
    74
    75   /* Fermeture du fichier */
    76   if (MEDfermer(fid) < 0) {
    77     MESSAGE("Erreur a la fermeture du fichier");
    78     return -1;
    79   }
    80
    81   return 0;
    82 }
    83
    84
    85
    86