# MAJ_21_22_profils.c

Aller à la documentation de ce fichier.

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