MED fichier
MAJ_500_510_dataset_attr_ILC.c
Aller à la documentation de ce fichier.
1/* This file is part of MED.
2 *
3 * COPYRIGHT (C) 1999 - 2025 EDF R&D, CEA/DEN
4 * MED is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * MED is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with MED. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18
19#include "med_config.h"
20#include "med_outils.h"
21#include "med.h"
22
23#include <string.h>
24
25#include "MAJ_500_510.h"
26#include "MAJ_version.h"
27
28#define USER_MODE MED_COMPACT_STMODE
29
30
31med_err _MEDadd_dataset_attr(med_idt id,const char *lname, const H5L_info_t *linfo, visitordatas *data) {
32
33 /* med_err (*)(med_idt, const char * , const H5L_info2_t * , visitordatas *) */
34 /* {aka int (*)(long int, const char * , const H5L_info2_t * , visitordatas *)} */
35 /*herr_t (*func)(hid_t g_id, const char *name, const H5L_info_t *info, void *op_data) ) */
36
37 med_err _ret=-1;
38 /*Depuis hdf5-1.12, malgré -DH5_USE_16_API, H5version.h choisi la version 3*/
39 H5O_info_t oinfo;
40 med_idt _dataset=0;
41 med_int _medintdiskswitchmode = MED_NO_INTERLACE;
42
43
44#ifdef _DEBUG_
45 SSCRUTE(lname);
46#endif
47
48 if (!strcmp(lname,".")) return 0;
49
50 switch ( (*linfo).type ) {
51
52 case H5L_TYPE_SOFT:
53 /* Rem : On affecte un H5G (deprecated) a un H5O pour pouvoir tester
54 de façon uniforme dans le switch */
55 oinfo.type=H5G_LINK;
56 break;
57 case H5L_TYPE_HARD:
58 /* Le pb de cette routine est qu'elle renvoie seulement :
59 H5O_TYPE_GROUP, H5O_TYPE_DATASET, H5O_TYPE_NAMED_DATATYPE, H5O_TYPE_NTYPES
60 sur un lien hard
61 Sur un lien soft H5O_TYPE_UNKNOWN
62 */
63 /*Depuis hdf5-1.12, malgré -DH5_USE_16_API, H5version.h choisi la version 3*/
64 if ( H5Oget_info_by_name( id, lname, &oinfo, H5P_DEFAULT ) <0) {
65 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"H5Oget_info_by_name");
66 SSCRUTE(lname);
67 }
68 break;
69 case H5L_TYPE_EXTERNAL:
70 case H5L_TYPE_ERROR:
71 default:
73 ISCRUTE_int((*linfo).type);
74 goto ERROR;
75 break;
76 }
77
78 switch ( oinfo.type ) {
79
80 case H5G_GROUP:
81 case H5G_LINK:
82 break;
83 case H5G_DATASET:
84
85 if ( (_dataset = H5Dopen(id,lname)) < 0) {
87 goto ERROR;
88 }
89
90 if ( _MEDattributeIntWr(_dataset,MED_NOM_ILC,&_medintdiskswitchmode) < 0 ) {
92 SSCRUTE(MED_NOM_ILC);ISCRUTE(_medintdiskswitchmode);
93 goto ERROR;
94 }
95
96 if ( H5Dclose(_dataset) < 0 ) {
98 goto ERROR;
99 }
100
101 break;
102 case H5G_TYPE:
103 default:
105 goto ERROR;
106 }
107 _ret = 0;
108
109 ERROR:
110 return _ret;
111}
112
114{
115 med_err _ret=0;
116
117 fprintf(stdout," >>> Normalisation des datasets \n");
118
119 if ( (_ret = _MEDvisit(fid, "/", "/", (medvisitorfunc) _MEDadd_dataset_attr)) < 0 ) {
121 }
122
123 fprintf(stdout," >>> Normalisation des datasets : ... OK ... \n");
124
125 /* _MEDobjetsOuverts(fid); */
126
127}
128
med_err _MEDadd_dataset_attr(med_idt id, const char *lname, const H5L_info_t *linfo, visitordatas *data)
void MAJ_500_510_dataset_attr_ILC(med_idt fid)
#define MED_ERR_(rt, r1, r2, r3)
#define SSCRUTE(chaine)
#define MED_ERR_EXIT_IF(expression, r1, r2, arg)
#define ISCRUTE(entier)
#define ISCRUTE_int(entier)
#define MED_ERR_OPEN
Definition med_err.h:37
#define MED_ERR_HDFTYPE
Definition med_err.h:114
#define MED_ERR_CALL
Definition med_err.h:48
#define MED_ERR_DATAGROUP
Definition med_err.h:99
#define MED_ERR_CLOSE
Definition med_err.h:30
#define MED_ERR_ATTRIBUTE
Definition med_err.h:100
#define MED_ERR_API
Definition med_err.h:111
#define MED_ERR_WRITE
Definition med_err.h:29
#define MED_ERR_UNRECOGNIZED
Definition med_err.h:39
#define MED_ERR_ATTRIBUTE_MSG
Definition med_err.h:152
#define MED_ERR_DATASET
Definition med_err.h:98
#define MED_ERR_VISIT
Definition med_err.h:49
herr_t(* medvisitorfunc)(hid_t g_id, const char *name, const H5L_info_t *info, void *op_data)
Definition med_hdfi.h:522
#define _MEDattributeIntWr(w, x, y)
Definition med_hdfi.h:45
MEDC_EXPORT med_err _MEDvisit(const med_idt fid, const char *const srcpath, const char *const dstpath, medvisitorfunc)
#define MED_NOM_ILC
Definition med_outils.h:68