     1  /*************************************************************************
     2  * COPYRIGHT (C) 1999 - 2003  EDF R&D
     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  #include <med_utils.h>
    28  #include <stdio.h>
    29  #include <string.h>
    30  #include <stdlib.h>
    31
    32  int main (int argc, char **argv)
    33  {
    34    med_idt fid;
    35    char maa[MED_TAILLE_NOM+1]= "maa1";
    36    char equ[MED_TAILLE_NOM+1] = "equivalence";
    37    char des[MED_TAILLE_DESC+1] = "equivalence sur les mailles MED_TRIA3";
    38    med_int mdim = 3;
    39    med_int ncor = 3;
    40    med_int cor[6] = {1,2,3,4,5,6};
    41
    42    /* Creation du fichier "test12.med" */
    43    if ((fid = MEDouvrir("test12.med",MED_CREATION)) < 0) {
    44      MESSAGE("Erreur a la creation du fichier test12.med");
    45      return -1;
    46    }
    47
    48    /* Creation du maillage */
    49    if (MEDmaaCr(fid,maa,3,MED_NON_STRUCTURE,
    50             "Un maillage pour test12") < 0) {
    51      MESSAGE("Erreur a la creation du maillage");
    52      return -1;
    53    }
    54
    55    /* Creation de l'equivalence */
    56    if (MEDequivCr(fid,maa,equ,des) < 0) {
    57      MESSAGE("Erreur a la creation de l'equivalence");
    58      return -1;
    59    }
    60
    61    /* Ecriture des sur les mailles MED_TRIA3 */
    62    if (MEDequivEcr(fid,maa,equ,cor,ncor,MED_MAILLE,MED_TRIA3) < 0) {
    63      MESSAGE("Erreur a l'ecriture du tableau des correspondances");
    64      return -1;
    65    }
    66
    67    /* Fermeture du fichier */
    68    if (MEDfermer(fid) < 0) {
    69      MESSAGE("Erreur a la fermeture du fichier");
    70      return -1;
    71    }
    72
    73    return 0;
    74  }