# MAJ_21_22_profils.c

Aller à la documentation de ce fichier.

    00001 /*  This file is part of MED.
    00002  *
    00003  *  COPYRIGHT (C) 1999 - 2012  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 #include "med_config.h"
    00021 #include "med_outils.h"
    00022 #include <string.h>
    00023
    00024 /* #ifdef __cplusplus */
    00025 /* } */
    00026 /* #endif */
    00027
    00028 #include <hdf5.h>
    00029 #include "med21.h"
    00030 #include "med_hdfi21.h"
    00031 #include "MAJ_21_22.h"
    00032
    00033 void MAJ_21_22_profils(med_idt fid,med_int nprofil)
    00034 {
    00035   med_err ret;
    00036   med_int i;
    00037   char nom[MED_TAILLE_NOM+1];
    00038   char chemin[MED_TAILLE_DESC+1];
    00039   med_idt gid;
    00040   med_int att;
    00041
    00042   for (i=0;i<nprofil;i++)
    00043     {
    00044       /* on recupere le nom du profil */
    00045       ret = _MEDobjetIdentifier(fid,(char *) MED_PROFILS,i,nom);
    00046       EXIT_IF(ret < 0,"Identification d'un profil",NULL);
    00047       fprintf(stdout,"  >>> Normalisation du profil [%s] \n",nom);
    00048
    00049       /* on accede au profil */
    00050       strcpy(chemin,MED_PROFILS);
    00051       strcat(chemin,nom);
    00052       gid = _MEDdatagroupOuvrir(fid,chemin);
    00053       EXIT_IF(gid < 0,"Accès au profil",nom);
    00054
    00055       /* On change l'attribut MED_NOM_N => MED_NOM_NBR */
    00056       ret = _MEDattrEntierLire(gid,(char *) "N",&att);
    00057       EXIT_IF(ret < 0,"Lecture de l'attribut MED_NOM_N",NULL);
    00058       ret = H5Adelete(gid,"N");
    00059       EXIT_IF(ret < 0,"Destruction de l'attribut MED_NOM_N",NULL);
    00060       ret = _MEDattrEntierEcrire(gid,(char *)(MED_NOM_NBR),&att);
    00061       EXIT_IF(ret < 0,"Ecriture de l'attribut MED_NOM_NBR dans le profil ",nom);
    00062
    00063       /* on ferme le profil */
    00064       ret = _MEDdatagroupFermer(gid);
    00065       EXIT_IF(ret < 0,"Fermeture de l'acces au profil",nom);
    00066
    00067       fprintf(stdout,"  >>> Normalisation du profil [%s] effectuée \n",nom);
    00068     }
    00069 }
    00070
    00071