1 /*  This file is part of MED.
2  *
3  *  COPYRIGHT (C) 1999 - 2019  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.h>
20 #include <med_config.h>
21 #include <med_outils.h>
22 
23 #include <string.h>
24 #include <stdlib.h>
25 
_MEDfieldValueAdvancedRd33(int dummy,...)26 void _MEDfieldValueAdvancedRd33(int dummy,...) {
27 
28   med_err               _ret=-1;
29   med_idt               _gid=0,_locgid=0, _datagroup1=0, _datagroup2=0, _datagroup3=0;
30   med_int               _nconstituentpervalue=0,_nvaluesperentityfromloc=0;
31   med_int               _nvaluesperentity=0,_profilearraysize=0;
32   med_int               _nsectioncell=1;
33   med_bool              _filterparameterexist=MED_FALSE;
34   med_field_type        _fieldtype=0;
35   med_int               _intfieldtype=0;
36   med_geometry_type     _locgeotype=0,_sectiongeotype=0;
37   med_int               _intlocgeotype=0;
38   char _gidname           [MED_FIELD_GRP_SIZE+MED_NAME_SIZE+1]=MED_FIELD_GRP;
39   char _datagroupname1    [2*MED_MAX_PARA+1]="";
40   char _datagroupname2    [2*MED_TAILLE_NOM_ENTITE+2]="";
41   char _profilename       [MED_NAME_SIZE+1]=""; /*TODO DEFAULT? */
42   char _meshname          [MED_NAME_SIZE+1]="";
43   char _locgidname        [MED_LOCALIZATION_GRP_SIZE+MED_NAME_SIZE+1]="";
44   char _sectionmeshname      [MED_NAME_SIZE+1]="";
45   char _localizationname  [MED_NAME_SIZE+1]=""; /*TODO DEFAULT? */
46   med_filter *               _filter           = NULL;
47   med_filter                 _tmpfilter        = MED_FILTER_INIT;
48   med_filter                 _paramfilter      = MED_FILTER_INIT;
49   med_bool                   _chgt=MED_FALSE,_trsf=MED_FALSE;
50 
51 
52   MED_VARGS_DECL(const, med_idt               , , fid              );
53   MED_VARGS_DECL(const, char * , const          , fieldname        );
54   MED_VARGS_DECL(const, med_int               , , numdt            );
55   MED_VARGS_DECL(const, med_int               , , numit            );
56   MED_VARGS_DECL(const, med_entity_type       , , entitytype       );
57   MED_VARGS_DECL(const, med_geometry_type     , , geotype          );
58   MED_VARGS_DECL(const, char * , const          , meshname         );
59   MED_VARGS_DECL(const, med_storage_mode      , , storagemode      );
60   MED_VARGS_DECL(const, char * , const          , profilename      );
61   MED_VARGS_DECL(const, med_switch_mode       , , switchmode       );
62   MED_VARGS_DECL(const, med_int               , , componentselect  );
63   MED_VARGS_DECL(const, med_filter* , const     , filter           );
64   MED_VARGS_DECL(,unsigned char*, const         , value            );
65   MED_VARGS_DECL(, med_err *                   ,, fret             );
66 
67   va_list params;
68   va_start(params,dummy);
69 
70   MED_VARGS_DEF(const, med_idt               , , fid              );
71   MED_VARGS_DEF(const, char * , const          , fieldname        );
72   MED_VARGS_DEF(const, med_int               , , numdt            );
73   MED_VARGS_DEF(const, med_int               , , numit            );
74   MED_VARGS_DEF(const, med_entity_type       , , entitytype       );
75   MED_VARGS_DEF(const, med_geometry_type     , , geotype          );
76   MED_VARGS_DEF(const, char * , const          , meshname         );
77   MED_VARGS_DEF(const, med_storage_mode      , , storagemode      );
78   MED_VARGS_DEF(const, char * , const          , profilename      );
79   MED_VARGS_DEF(const, med_switch_mode       , , switchmode       );
80   MED_VARGS_DEF(const, med_int               , , componentselect  );
81   MED_VARGS_DEF(const, med_filter* , const     , filter           );
82   MED_VARGS_DEF(,unsigned char*, const         , value            );
83   MED_VARGS_DEF(, med_err *                   ,, fret             );
84 
85   if (filter) {
86     _filter=(med_filter*)(filter); _filterparameterexist=MED_TRUE;
87   }
88   else {
89     _filter=&_tmpfilter;
90 /*   (*_filter).nentity              = nentity; */
91 /*   (*_filter).nvaluesperentity     = nvaluesperentity; */
92 /*   (*_filter).nconstituentpervalue = nconstituentpervalue; */
93     (*_filter).constituentselect       = componentselect;
94     (*_filter).switchmode              = switchmode;
95     (*_filter).storagemode             = storagemode;
96     strcpy((*_filter).profilename,profilename);
97 /*   (*_filter).profilearraysize        = profilearraysize; */
98   }
99 
100   /*
101    * On inhibe le gestionnaire d'erreur HDF 5
102    */
103   _MEDmodeErreurVerrouiller();
104 
105   /*
106    * Si le Data Group cha n'existe pas => erreur
107    */
108   strcat(_gidname,fieldname);
109 
110   /* Lecture de l'attribut MED_NOM_MAI */
111   if ( _MEDattributeStringRdByName(fid,_gidname,MED_NOM_MAI,MED_NAME_SIZE,_meshname) < 0) {
112     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
113     SSCRUTE(_gidname);SSCRUTE(MED_NOM_MAI);SSCRUTE(_meshname);
114     goto ERROR;
115   }
116 
117   if (strlen(meshname) )
118     if (strcmp(_meshname,meshname) ) {
119       MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_PARAMETER,"meshname");
120       SSCRUTE(_gidname);SSCRUTE(_meshname);SSCRUTE(meshname);
121       goto ERROR;
122     }
123 
124   if ((_gid = _MEDdatagroupOuvrir(fid,_gidname)) < 0) {
125     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_FIELD_MSG);
126     SSCRUTE(fieldname);SSCRUTE(_gidname); goto ERROR;
127   }
128 
129   /* Lecture de l'attribut MED_NOM_NCO */
130   /* Coh�rence de l'attribut MED_NOM_NCO avec le filtre*/
131   if (_MEDattrEntierLire(_gid,MED_NOM_NCO,&_nconstituentpervalue) < 0) {
132     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
133     SSCRUTE(fieldname);SSCRUTE(MED_NOM_NCO);goto ERROR;
134   }
135 
136   if (_filterparameterexist) {
137     if ((*_filter).nconstituentpervalue != _nconstituentpervalue ) {
138       MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_ATTRIBUTE,MED_ERR_VALUE_MSG);
139       ISCRUTE((*_filter).nconstituentpervalue); ISCRUTE(_nconstituentpervalue );
140       goto ERROR;
141     }
142   } else {
143     (*_filter).nconstituentpervalue = _nconstituentpervalue;
144   }
145 
146   /* Lecture de l'attribut MED_NOM_TYP */
147   if ( _MEDattrEntierLire(_gid,MED_NOM_TYP,&_intfieldtype) < 0) {
148     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
149     SSCRUTE(fieldname);SSCRUTE(MED_NOM_TYP);
150     goto ERROR;
151   }
152   _fieldtype = (med_field_type) (_intfieldtype);
153 
154   /*
155    *  Si le Data Group de niveau 1 <numdt>.<numit> n'existe pas => erreur
156    */
157 
158   _MEDgetComputationStepName(MED_SORT_DTIT,numdt,numit,_datagroupname1);
159 
160   _datagroup1 = 0;
161   if ( (_datagroup1 = _MEDdatagroupOuvrir(_gid,_datagroupname1)) < 0 ) {
162     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_FIELD_MSG);
163     SSCRUTE(fieldname);SSCRUTE(_datagroupname1);goto ERROR;
164   }
165 
166 
167   /*
168    * Si le Data Group  de niveau 2 <type_ent>[.<type_geo>] n'existe pas => erreur
169    */
170   if (_MEDgetFieldEntityGeoTypeName(fid,_datagroupname2,entitytype,geotype) < 0) {
171     MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDgetFieldEntityGeoTypeName");
172     SSCRUTE(fieldname);ISCRUTE_int(entitytype);ISCRUTE_int(geotype);goto ERROR;
173   }
174   _datagroup2 = 0;
175   if ( (_datagroup2 = _MEDdatagroupOuvrir(_datagroup1,_datagroupname2)) < 0) {
176     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_datagroupname2);
177     SSCRUTE(fieldname);goto ERROR;
178   }
179 
180 
181   /*
182    * Ouvre le datagroup de niveau 3 <profilename>
183    */
184 
185   /*MODEL : Il n'y a plus de datagroup de niveau 3 <maa> mais <profilename> */
186 
187   /* MODEL : d�placement de l'attribut MED_NOM_PFL */
188   /*Cree ou ouvre  l'attribut MED_NOM_PFL   */
189 
190   NOFINALBLANK(profilename,ERROR);
191 
192   if ( strlen((*_filter).profilename) == 0 ) {  /* idem MED_NOPFL*/
193 
194     /* Ecriture de MED_NO_PROFILE_INTERNAL car le datagroup profil ne peut �tre ""*/
195     strncpy(_profilename,MED_NO_PROFILE_INTERNAL,MED_NAME_SIZE+1);
196     _profilearraysize = MED_UNDEF_SIZE;
197   } else {
198     strncpy(_profilename,(*_filter).profilename,MED_NAME_SIZE+1);
199     _profilename[MED_NAME_SIZE]='\0'; /*On tronque les eventuels noms trop long*/
200     if ( ( _profilearraysize = MEDprofileSizeByName( fid,_profilename) ) < 0 ) {
201       MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,MED_ERR_FIELD_MSG);
202       SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);
203       SSCRUTE(_profilename);SSCRUTE("MEDprofileSizeByName");goto ERROR;
204     }
205   }
206 
207   /*INUTILE : le param�tre est positionn� dans  MEDfilterEntityCr */
208   if (!_filterparameterexist) (*_filter).profilearraysize =  _profilearraysize;
209 
210 
211   _datagroup3 = 0;
212   if ((_datagroup3 = _MEDdatagroupOuvrir(_datagroup2,_profilename)) < 0) {
213 	MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_profilename);
214 	SSCRUTE(fieldname);SSCRUTE(_profilename);goto ERROR;
215   }
216 
217   /*MODEL : MED_NOM_NBR nbelem qui contenait nentity*nvalueperentity mais pas nconstituentpervalue  */
218   /*Lit le nombre d'entit�s */
219   if ( _MEDattrEntierLire(_datagroup3,MED_NOM_NBR,&((*_filter).nentity)) < 0) {
220     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
221     SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);SSCRUTE(_profilename);
222     SSCRUTE(MED_NOM_NBR);ISCRUTE((*_filter).nentity);goto ERROR;
223   }
224 
225   /* Lecture du nom de la localization  */
226   if ( _MEDattrStringLire(_datagroup3,MED_NOM_GAU,MED_NAME_SIZE,_localizationname) < 0) {
227       MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
228       SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);SSCRUTE(_profilename);
229       SSCRUTE(MED_NOM_GAU);SSCRUTE(_localizationname);goto ERROR;
230   }
231 /*   SSCRUTE(_localizationname); */
232 
233   /* Lecture du nombre de points d'int�gration */
234   /* Ecriture de l'attribut portant le nombre de points de gauss  */
235   if ( _MEDattrEntierLire(_datagroup3,MED_NOM_NGA,&_nvaluesperentity) < 0) {
236     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
237     SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);SSCRUTE(_profilename);
238     SSCRUTE(MED_NOM_NGA);ISCRUTE(_nvaluesperentity);goto ERROR;
239   }
240 
241 
242   if (entitytype == MED_NODE_ELEMENT ) {
243     if (strlen(_localizationname) ) {
244       MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_PARAMETER,_localizationname);
245       SSCRUTE(MED_NO_LOCALIZATION);ISCRUTE_int(entitytype);goto ERROR;
246     }
247     _nvaluesperentityfromloc = geotype % 100;
248   } else if (! strcmp(_localizationname,MED_GAUSS_ELNO)) {
249     /* Les points de Gauss sont d�finis sur les noeuds de l'element (mot cle) */
250     /* le nombre de points de Gauss est egal au nombre de noeuds de l'element */
251     _nvaluesperentityfromloc = geotype % 100;
252   } else  if ( strlen( _localizationname) ) {
253     strcpy(_locgidname,MED_LOCALIZATION_GRP);
254     strcat(_locgidname,_localizationname);
255 
256     if ((_locgid = _MEDdatagroupOuvrir(fid,_locgidname)) < 0) {
257       MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_locgidname);
258       goto ERROR;
259     }
260 
261     if (_MEDattrEntierLire(_locgid,MED_NOM_NBR,&_nvaluesperentityfromloc) < 0) {
262       MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
263       SSCRUTE(_localizationname);SSCRUTE(MED_NOM_NBR);ISCRUTE(_nvaluesperentity);goto ERROR;
264     }
265 
266 
267     if ( entitytype == MED_STRUCT_ELEMENT ) {
268 
269       /*
270        * Lecture de l'attribut MED_NOM_NOM (nom du maillage support de section)
271        */
272       if ( _MEDattrStringLire(_locgid,MED_NOM_NOM,MED_NAME_SIZE,_sectionmeshname) < 0) {
273 	MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_locgidname);
274 	SSCRUTE(MED_NOM_NOM);SSCRUTE(_sectionmeshname);
275 	goto ERROR;
276       }
277 
278       if (strlen(_sectionmeshname) ) {
279 
280 	if ( _MEDgetSupportMeshNbOfEntities(fid,_sectionmeshname,NULL,NULL,NULL,
281 					    &_nsectioncell) < 0) {
282 	  MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDgetSupportMeshNbOfEntities");
283 	  SSCRUTE(_sectionmeshname);ISCRUTE(_nsectioncell);goto ERROR;
284 	}
285       }
286     }
287 
288     _nvaluesperentityfromloc*=_nsectioncell;
289 
290 
291     if (_MEDattrEntierLire(_locgid,MED_NOM_GEO,&_intlocgeotype) < 0) {
292       MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
293       SSCRUTE(_localizationname);SSCRUTE(MED_NOM_GEO);ISCRUTE_int(_locgeotype);goto ERROR;
294     }
295     _locgeotype = (med_geometry_type) _intlocgeotype;
296 
297     if ( _locgeotype != geotype ) {
298       MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
299       SSCRUTE(_localizationname);SSCRUTE(MED_NOM_GEO);ISCRUTE_int(_locgeotype);ISCRUTE_int(geotype);goto ERROR;
300     }
301   } else {
302     _nvaluesperentityfromloc = 1;
303   }
304 
305   if ( _nvaluesperentityfromloc != _nvaluesperentity ) {
306     MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
307     SSCRUTE(_localizationname);SSCRUTE(MED_NOM_GEO);ISCRUTE(_nvaluesperentityfromloc);
308     ISCRUTE(_nvaluesperentity);goto ERROR;
309   }
310 
311   if (!_filterparameterexist) (*_filter).nvaluesperentity=_nvaluesperentity;
312 
313 
314   /*Ce n'est plus un param�tre de sortie*/
315   /* FT 108 : on r�tablit la bonne valeur externe de locname : MED_NOGAUSS */
316 /*   if ( ! strcmp(locname,MED_NOGAUSSi)) */
317 /*     strcpy(locname,MED_NOGAUSS); */
318 
319 
320   if (!_filterparameterexist) {
321 
322     if ( MEDfilterEntityCr(fid, (*_filter).nentity,         (*_filter).nvaluesperentity,
323 			   (*_filter).nconstituentpervalue, (*_filter).constituentselect,
324 			   (*_filter).switchmode,              (*_filter).storagemode,
325 			   (*_filter).profilename, MED_UNDEF_SIZE, NULL, &_paramfilter) < 0 ) {
326       MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,MED_ERR_INTERNAL_MSG);
327       goto ERROR;
328     }
329 
330 
331     _filter = &_paramfilter;
332   }
333 
334 #ifdef _DEBUG_
335     ISCRUTE((*_filter).nentity              );
336     ISCRUTE((*_filter).nvaluesperentity     );
337     ISCRUTE((*_filter).nconstituentpervalue );
338     ISCRUTE((*_filter).constituentselect       );
339     ISCRUTE_int((*_filter).switchmode              );
340     ISCRUTE((*_filter).filterarraysize         );
341     ISCRUTE((*_filter).profilearraysize        );
342     ISCRUTE_int((*_filter).storagemode             );
343     SSCRUTE((*_filter).profilename             );
344 #endif
345   /*
346    * Lecture du champ
347    */
348 
349   /* Tous les types med_field_type sont maintenant autorisés dans MEDfieldCr mais :
350 
351    Avant la 3.3.0 seuls les types : MED_FLOAT64, MED_INT32 et MED_INT64 étaient autorisés dans MEDfieldCr et seuls les types med_int et med_float64 pouvaient être utilisés en C.
352      La configuration du med_int était prédominante sur le choix du type de champ pour définir de la taille de stockage interne.
353      Il faut garder à l'esprit que les étapes d'écriture et de lecture ne se font pas forcément avec la même configuration de med_int.
354 
355    A l'écriture :
356       - si med_int=int  les champs MED_INT32 sont stockés   en 32bits
357       - si med_int=int  les champs MED_INT64 sont interdits
358       - si med_int=long les champs MED_INT32 sont stockés   en 64bits
359       - si med_int=long les champs MED_INT64 sont stockés   en 64bits
360 
361    A la lecture :
362       - si med_int=int  les champs MED_INT32 sont lus       en 32bits avec conversion 64->32 s'il avait été stocké en 64bits (configuration écriture med_int=long)
363       - si med_int=int  les champs MED_INT64 ne pouvaient pas être lu (pour prevenir la perte d'information)
364       - si med_int=long les champs MED_INT32 sont lus       en 64bits avec conversion 32->64 s'il avait été stocké en 32bits (configuration écriture med_int=int)
365       - si med_int=long les champs MED_INT64 sont lus       en 64bits
366 
367    Depuis la 3.3.0 en plus des types MED_FLOAT64, MED_INT32 et MED_INT64, les types MED_FLOAT32 et MED_INT sont autorisés.
368      Aux types med_int et med_float64 utilisés en C sont ajoutés les types med_float32, med_int32 et med_int64.
369      Si la plateforme possède des entiers 64bits testé à la configuration.
370 
371    A l'écriture :
372       - si med_int=int  les champs MED_INT32 sont toujours  stockés              en 32bits  (utiliser med_int32 ou med_int   )
373       - si med_int=int  les champs MED_INT64 sont désormais autorisés et stockés en 64bits  (utiliser med_int64              )
374       - si med_int=int  les champs MED_INT   sont désormais acceptés  et stockés en 32bits  (utiliser med_int   ou med_int32 )
375       - si med_int=long les champs MED_INT32 sont désormais stockés              en 32bits  (utiliser med_int32)
376       - si med_int=long les champs MED_INT64 sont toujours  autorisés et stockés en 64bits  (utiliser med_int64 ou med_int )
377       - si med_int=long les champs MED_INT   sont désormais acceptés  et stockés en 64bits  (utiliser med_int ou med_int64 )
378 
379    A la lecture :
380       - si med_int=int  les champs MED_INT32 sont toujours    lus                en 32bits                 (utiliser med_int32 ou med_int)
381       - si med_int=int  les champs MED_INT64 sont acceptés et lus                en 64bits sans conversion (utiliser med_int64)
382       - si med_int=int  les champs MED_INT   sont acceptés et lus                en 32bits avec conversion si necessaire (0 si > maxint32 , utiliser med_int ou med_int32)
383       - si med_int=long les champs MED_INT32 sont toujours    lus                en 32bits sans conversion (utiliser le type med_int32)
384       - si med_int=long les champs MED_INT64 sont toujours    lus                en 64bits sans conversion (utiliser le type med_int64 ou med_int)
385       - si med_int=long les champs MED_INT   sont acceptés et lus                en 64bits avec conversion  si necessaire (utiliser le type med_int32)
386 
387 REM :
388    Sur un Unix 32 bits sur architecture 64bits il est possible d'utiliser des MED_INT64, l'étape de configuration vérifier qu'elle peut utiliser ou définit le type C int64_t
389 REM2:
390    A lecture d'un fichier < 3.3.0 avec une bibliothèque >= 3.3.0 configurée avec med_int=long :
391      - Si le fichier contient un champ MED_INT32, le driver 3.0 de la bibliothèque > 3.3.0 relis en 64 bits ce qui provoque une erreur de segmentation si l'allocation n'est pas adéquate.
392 
393   */
394 
395   switch(_fieldtype)
396     {
397     case MED_FLOAT64 :
398     case MED_FLOAT32 :
399     case MED_INT32   :
400     case MED_INT64   :
401       if ( _MEDdatasetRd(_datagroup3,MED_NOM_CO,_fieldtype,_filter,value) < 0) {
402 	MED_ERR_(_ret,MED_ERR_READ,MED_ERR_DATASET,MED_NOM_CO);
403 	SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);SSCRUTE(_profilename);
404 /* 	ISCRUTE((void*)value); */
405 /* 	H5Eprint1(stderr); */
406 	goto ERROR;
407       }
408       break;
409       /*Le champ est un champ 32bits stocké */
410     case MED_INT :
411 #if defined(HAVE_F77INT64)
412       if ( _MEDdatasetRd(_datagroup3,MED_NOM_CO,MED_INT64,_filter,value) < 0) {
413 	MED_ERR_(_ret,MED_ERR_READ,MED_ERR_DATASET,MED_NOM_CO);
414 	SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);SSCRUTE(_profilename);
415 	goto ERROR;
416       }
417 #else
418       if ( _MEDdatasetRd(_datagroup3,MED_NOM_CO,MED_INT32,_filter,value) < 0) {
419 	MED_ERR_(_ret,MED_ERR_READ,MED_ERR_DATASET,MED_NOM_CO);
420 	SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);SSCRUTE(_profilename);
421 	goto ERROR;
422       }
423 #endif
424      break;
425 
426     default :
427       MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_RANGE,MED_ERR_FIELD_MSG);
428       SSCRUTE(fieldname);ISCRUTE_int(_fieldtype);
429       goto ERROR;
430     }
431 
432 
433   /*
434    * On ferme tout
435    */
436 
437   _ret = 0;
438 
439  ERROR:
440 
441 /*   if ( pfluse ) { free(pfltab); free(pfltabtmp);} */
442   if (!_filterparameterexist) {
443     if ( MEDfilterClose(_filter) < 0 ) {
444       MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,MED_ERR_FIELD_MSG);
445       SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);SSCRUTE(_profilename);
446       goto ERROR;
447     }
448   }
449 
450   if (_datagroup3>0)     if (_MEDdatagroupFermer(_datagroup3) < 0) {
451     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_profilename);
452     ISCRUTE_id(_datagroup3);
453   }
454 
455   if (_datagroup2>0)     if (_MEDdatagroupFermer(_datagroup2) < 0) {
456     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname2);
457     ISCRUTE_id(_datagroup2);
458   }
459 
460   if (_datagroup1>0)     if (_MEDdatagroupFermer(_datagroup1) < 0) {
461     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname1);
462     ISCRUTE_id(_datagroup1);
463   }
464 
465   if (_gid>0)            if (_MEDdatagroupFermer(_gid) < 0) {
466     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_gidname);
467     ISCRUTE_id(_gid);
468   }
469 
470   if (_locgid>0)     if (_MEDdatagroupFermer(_locgid) < 0) {
471     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_locgidname);
472     ISCRUTE_id(_locgid);
473   }
474 
475   va_end(params);
476   *fret = _ret;
477   return;
478 }
479 
480 
481 
482 
483