MEDgaussLire.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 #include <med.h>
00019 #include <med_config.h>
00020 #include <med_outils.h>
00021 
00022 #include <string.h>
00023 #include <stdlib.h>
00024 
00025 med_err 
00026 MEDgaussLire(med_idt fid, med_float *refcoo, med_float *gscoo, med_float * wg, med_mode_switch mode_coo, char *locname)
00027 {
00028   med_err ret = -1;
00029   med_idt locid=0;
00030   char chemin[MED_TAILLE_GAUSS+MED_TAILLE_NOM+1]=""; 
00031   med_int type_geo;
00032   
00033   /*
00034    * On inhibe le gestionnaire d'erreur HDF 5
00035    */
00036   _MEDmodeErreurVerrouiller();
00037 if (MEDcheckVersion(fid) < 0) return -1;
00038 
00039 
00040   /* 
00041    * ouverture du groupe /PROFILS/"nom"
00042    */  
00043   strcpy(chemin,MED_GAUSS);
00044   strcat(chemin,locname); 
00045   if ((locid = _MEDdatagroupOuvrir(fid,chemin)) < 0) {
00046     MESSAGE("Impossible d'ouvrir le datagroup : ");
00047     SSCRUTE(chemin); goto ERROR;
00048   }
00049 
00050   
00051   /* Lecture <type_geo> sous forme d'attribut */
00052   if (_MEDattrEntierLire(locid,MED_NOM_GEO,&type_geo) < 0) {
00053     MESSAGE("Erreur à la lecture de l'attribut MED_NOM_GEO : ");
00054     ISCRUTE(type_geo);goto ERROR;
00055   };
00056 
00057   /*
00058    * Lecture de la localisation
00059    */
00060 
00061   /*
00062    * On stocke les coordonnées de référence dans un dataset
00063    */
00064  
00065   if ( _MEDdatasetNumLire(locid,MED_NOM_COO,MED_FLOAT64,mode_coo,(type_geo/100),MED_ALL,MED_NOPF,MED_NO_PFLMOD,MED_PFL_NON_COMPACT,0,MED_NOPG,0,
00066                           (unsigned char*) refcoo)  < 0 ) {
00067     MESSAGE("Impossible de lire le dataset : ");SSCRUTE(MED_NOM_COO);
00068     goto ERROR;
00069   }
00070 
00071   /*
00072    * On stocke les points d'intégration dans un dataset
00073    */
00074    
00075   if ( _MEDdatasetNumLire(locid,MED_NOM_GAU,MED_FLOAT64,mode_coo,(type_geo/100),MED_ALL,MED_NOPF,MED_NO_PFLMOD,MED_PFL_NON_COMPACT,0,MED_NOPG,0,
00076                           (unsigned char*) gscoo)  < 0 ) {
00077     MESSAGE("Impossible de lire le dataset : ");SSCRUTE(MED_NOM_GAU);
00078     goto ERROR;
00079   }
00080   
00081   /*
00082    * On stocke les poids dans un dataset
00083    */
00084    
00085   if ( _MEDdatasetNumLire(locid,MED_NOM_VAL,MED_FLOAT64,mode_coo,1,MED_ALL,MED_NOPF,MED_NO_PFLMOD,MED_PFL_NON_COMPACT,0,MED_NOPG,0,
00086                           (unsigned char*) wg)  < 0 ) {
00087     MESSAGE("Impossible de lire le dataset : ");SSCRUTE(MED_NOM_VAL);
00088     goto ERROR;
00089   }
00090   
00091 
00092   /*
00093    * On ferme tout
00094    */
00095 
00096   ret = 0;
00097  ERROR:
00098 
00099   if ( locid > 0 ) if ( _MEDdatagroupFermer(locid) < 0) {
00100     MESSAGE("Impossible de fermer le datagroup : ");
00101     ISCRUTE_id(locid); ret = -1;
00102   }
00103   
00104   return ret;
00105 }
00106 

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