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 00019 #include <med.h> 00020 #include <med_config.h> 00021 #include <med_outils.h> 00022 #include <hdf5.h> 00023 00024 /* 00025 * - Nom de la fonction : _MEDnObjets 00026 * - Description : indique le nombre d'objets HDF contenu dans le 00027 * datagroup passe en argument 00028 * - Parametres : 00029 * - fid (IN) : l'ID du fichier HDF 00030 * - chemin (IN) : chemin d'acces au datagroup 00031 * - n (OUT) : le nombre recherche 00032 * - Resultat : 0 en cas de succes, -1 sinon 00033 */ 00034 med_err 00035 _MEDnObjets(med_idt fid,char *chemin,int *n) 00036 { 00037 /*int idx;*/ 00038 /* if ((idx = H5Giterate(fid,chemin,NULL,_MEDindiceNum,(void *)n)) < 0) */ 00039 /* return -1; */ 00040 00041 /* EF */ 00042 med_err ret=-1; 00043 med_idt id=0; 00044 herr_t err; 00045 hsize_t num_obj=0; 00046 00047 if ( (id = H5Gopen(fid,chemin)) < 0 ) goto ERROR; 00048 00049 if ( (err =H5Gget_num_objs(id,&num_obj) ) < 0 ) goto ERROR; 00050 00051 ret = 0; 00052 *n = (med_err) num_obj; 00053 00054 ERROR: 00055 if (id) H5Gclose(id); 00056 00057 return ret; 00058 }