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 #include <string.h>
23 #include <stdlib.h>
24 
25 #include <2.3.6/med23v30.h>
26 #include <2.3.6/med23v30_proto.h>
27 #include "2.3.6/med23v30_misc.h"
28 #include "2.3.6/med23v30_hdfi.h"
29 
30 
_MEDmeshAdvancedRd236(int dummy,...)31 void _MEDmeshAdvancedRd236(int dummy, ...)
32 {
33   med_access_mode       _MED_ACCESS_MODE;
34   med_err               _ret=-1;
35   med_idt               _meshid=0;
36   med_idt               _datagroup=0, _datagroup2=0,_datagroup3=0,_dataset=0;
37   char                  _meshpath         [MED_MESH_SUPPORT_GRP_SIZE+MED_NAME_SIZE+1]="";
38   char                  _datagroupname2   [MED_TAILLE_NOM_ENTITE+1]="";
39   char                  _datagroupname3   [MED_TAILLE_NOM_ENTITE+1]="";
40   char                  _datasetname      [MED_TAILLE_NOM_ENTITE+1]="";
41 
42   char                  _geotypename      [MED_TAILLE_NOM_ENTITE+1]="";
43   med_bool              _filterparameterexist=MED_FALSE;
44   med_filter *          _filter           = NULL;
45   med_filter            _tmpfilter        = MED_FILTER_INIT;
46   med_int               _nconstituentpervalue=0,_spacedim=0;
47   med_internal_type     _datatype;
48   med_int               _nvalueperentity=0;
49   med_mesh_type         _meshtype=MED_UNDEF_MESH_TYPE;
50   med_int               _intmeshtype=0;
51   med_bool              _isasupportmesh=MED_FALSE;
52   med_int               _intgridtype=0;
53   med_grid_type         _gridtype=MED_UNDEF_GRID_TYPE;
54 
55 
56   MED_VARGS_DECL(const, med_idt               , , fid         );
57   MED_VARGS_DECL(const, char*  , const          , meshname    );
58   MED_VARGS_DECL(const, med_data_type         , , meddatatype );
59   MED_VARGS_DECL(const, char*  , const          , datasetname );
60   MED_VARGS_DECL(const, med_internal_type     , , datatype    );
61   MED_VARGS_DECL(const, med_int               , , numdt       );
62   MED_VARGS_DECL(const, med_int               , , numit       );
63   MED_VARGS_DECL(const, med_entity_type       , , entitytype  );
64   MED_VARGS_DECL(const, med_geometry_type     , , geotype     );
65   MED_VARGS_DECL(const, med_connectivity_mode , , cmode       );
66   MED_VARGS_DECL(const, med_storage_mode      , , storagemode );
67   MED_VARGS_DECL(const, char * , const          , profilename );
68   MED_VARGS_DECL(const, med_switch_mode       , , switchmode  );
69   MED_VARGS_DECL(const, med_int               , , dimselect   );
70   MED_VARGS_DECL(const, med_filter * , const    , filter      );
71   MED_VARGS_DECL(,unsigned char*, const         , value       );
72   MED_VARGS_DECL(, med_err *                   ,, fret        );
73 
74   va_list params;
75   va_start(params,dummy);
76 
77   MED_VARGS_DEF(const, med_idt               , , fid         );
78   MED_VARGS_DEF(const, char*  , const          , meshname           );
79   MED_VARGS_DEF(const, med_data_type         , , meddatatype );
80   MED_VARGS_DEF(const, char*  , const          , datasetname );
81   MED_VARGS_DEF(const, med_internal_type     , , datatype           );
82   MED_VARGS_DEF(const, med_int               , , numdt           );
83   MED_VARGS_DEF(const, med_int               , , numit           );
84   MED_VARGS_DEF(const, med_entity_type       , , entitytype  );
85   MED_VARGS_DEF(const, med_geometry_type     , , geotype           );
86   MED_VARGS_DEF(const, med_connectivity_mode , , cmode           );
87   MED_VARGS_DEF(const, med_storage_mode      , , storagemode );
88   MED_VARGS_DEF(const, char * , const          , profilename );
89   MED_VARGS_DEF(const, med_switch_mode       , , switchmode  );
90   MED_VARGS_DEF(const, med_int               , , dimselect   );
91   MED_VARGS_DEF(const, med_filter * , const    , filter           );
92   MED_VARGS_DEF(,unsigned char*, const         , value       );
93   MED_VARGS_DEF(, med_err *                   ,, fret        );
94 
95   _datatype=datatype;
96 
97   if (filter) {
98     _filter=(med_filter*)(filter); _filterparameterexist=MED_TRUE;
99   }
100   else {
101     _filter=&_tmpfilter;
102 /*  Inutilisé en lecture 2.3.x*/
103 /*     (*_filter).nentity              = nentity; */
104     (*_filter).nvaluesperentity     = 1;
105 /*   (*_filter).nconstituentpervalue = nconstituentpervalue; */
106     (*_filter).constituentselect       = dimselect;
107     (*_filter).switchmode              = switchmode;
108     (*_filter).storagemode             = storagemode;
109     strcpy((*_filter).profilename,profilename);
110     (*_filter).profilearraysize        = 0;
111   }
112 
113   if ( (*_filter).storagemode == MED_UNDEF_PFLMODE)
114     (*_filter).storagemode              = MED_GLOBAL_PFLMODE;
115 
116   /*
117    * On inhibe le gestionnaire d'erreur HDF 5
118    */
119   _MEDmodeErreurVerrouiller();
120 
121   if ( (_MED_ACCESS_MODE = _MEDmodeAcces(fid) ) == MED_ACC_UNDEF ) {
122     MED_ERR_(_ret,MED_ERR_UNRECOGNIZED,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
123     goto ERROR;
124   }
125 
126   /*
127    * Si le DataGroup MED_MESH_GRP n'existe pas => erreur
128    */
129   NOFINALBLANK(meshname,ERROR);
130 
131 
132   /* Les séquences de calcul dans les maillages ne sont gérées qu'à partir de la 3.0*/
133   if ( (numdt != MED_NO_DT) || (numit != MED_NO_IT) ) {
134     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_COMPUTINGSTEP,MED_ERR_MESH_MSG);
135     SSCRUTE(meshname);ISCRUTE(numdt);ISCRUTE(numit);
136     goto ERROR;
137   }
138 
139   if ((_meshid=_MEDmeshDatagroupOpen(fid,meshname,_meshpath,&_isasupportmesh)) < 0) {
140     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
141     SSCRUTE(_meshpath); goto ERROR;
142   }
143 
144   /* Lecture de l'attribut MED_NOM_ESP  */
145   if (_MEDattrEntierLire(_meshid,MED_NOM_ESP,&_spacedim) < 0) {
146     if (_MEDattrEntierLire(_meshid,MED_NOM_DIM,&_spacedim) < 0) {
147       MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
148       SSCRUTE(meshname);SSCRUTE(MED_NOM_DIM);goto ERROR;
149     }
150   }
151 
152   /* Lecture de l'attribut MED_NOM_TYP  */
153   if (_MEDattrEntierLire(_meshid,MED_NOM_TYP,&_intmeshtype) < 0) {
154     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
155     SSCRUTE(meshname);SSCRUTE(MED_NOM_TYP);ISCRUTE(_intmeshtype);goto ERROR;
156   }
157   _meshtype = (med_mesh_type) _intmeshtype;
158 
159   if ( _meshtype == MED_STRUCTURED_MESH ) {
160  /*
161    * Lecture du type de grille (attribut MED_NOM_GTY)
162    */
163     if (_MEDattrEntierLire(_meshid,MED_NOM_GTY,&_intgridtype) < 0) {
164       MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
165       SSCRUTE(meshname);SSCRUTE(MED_NOM_GTY);ISCRUTE(_intgridtype);goto ERROR;
166     }
167     _gridtype=(med_grid_type) _intgridtype;
168   }
169 
170 
171   if ( (entitytype == MED_STRUCT_ELEMENT) || (meddatatype == MED_VARIABLE_ATTRIBUTE) ) {
172     MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
173     ISCRUTE_int(entitytype);ISCRUTE_int(meddatatype);goto ERROR;
174   }
175 
176 
177   /* Si un nom de dataset est précisé, il n'est pas géré en 2.3.6
178      Detection automatique en
179      fonction des paramètres meddatatype et cmode */
180   if ( !strlen(datasetname) ) {
181     if ( _MEDgetDatasetName( _datasetname, meddatatype, cmode ) < 0 ) {
182       MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDgetDatasetname");
183       ISCRUTE_int(meddatatype);ISCRUTE_int(cmode);SSCRUTE( _datasetname);goto ERROR;
184     }
185   } else {
186     MED_ERR_(_ret,MED_ERR_NULL,MED_ERR_DATASET,datasetname);
187     goto ERROR;
188   }
189 
190   /* Si un type de dataset est précisé, il est prioritaire sur la détection automatique en
191      fonction des paramètres meddatatype et cmode */
192   /* TODO : renommer datatype en idatatype (internal) */
193 /*   if ( _datatype == MED_INTERNAL_UNDEF) */
194 /*     if ( _MEDgetDatatype( &_datatype, meddatatype, cmode ) < 0 ) { */
195 /*       MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDgetDatatype"); */
196 /*       ISCRUTE(meddatatype);ISCRUTE(cmode);ISCRUTE(_datatype);goto ERROR; */
197 /*     } */
198 
199   /* Vérification :
200      Le type de données MED traitées sont-elles compatibles avec le type de maillage ?
201   */
202   /* REM : Si datasetname ou datatype ne sont pas précisés, meddatatype doit l'être */
203 /*   if ( meddatatype != MED_UNDEF_DATATYPE ) */
204 /*     if ( _MEDmeshtypeCompatibility(meddatatype, _intmeshtype) < 0) { */
205 /*       MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_MEDDATATYPE,MED_ERR_VALUE_MSG); */
206 /*       ISCRUTE_int(meddatatype);ISCRUTE_int(_intmeshtype);goto ERROR; */
207 /*     } */
208 
209   if ( ! (_nvalueperentity && _nconstituentpervalue) )
210     if ( _MEDgetDatasetParameter( meddatatype, _spacedim, entitytype, geotype, cmode,
211 				  &_nvalueperentity,&_nconstituentpervalue) < 0 ) {
212       MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDgetDatasetParameter");
213       ISCRUTE_int(meddatatype);ISCRUTE_int(cmode);ISCRUTE(_nvalueperentity);
214       ISCRUTE(_nconstituentpervalue);goto ERROR;
215     }
216 
217   if (_filterparameterexist) {
218     if ((*_filter).nconstituentpervalue != _nconstituentpervalue ) {
219       MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_ATTRIBUTE,MED_ERR_VALUE_MSG);
220       ISCRUTE((*_filter).nconstituentpervalue); ISCRUTE(_nconstituentpervalue );
221       goto ERROR;
222     }
223     if ((*_filter).nvaluesperentity != _nvalueperentity ) {
224       MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_ATTRIBUTE,MED_ERR_VALUE_MSG);
225       ISCRUTE((*_filter).nvaluesperentity); ISCRUTE(_nvalueperentity );
226       goto ERROR;
227     }
228   } else {
229     (*_filter).nconstituentpervalue = _nconstituentpervalue;
230     (*_filter).nvaluesperentity     = _nvalueperentity;
231   }
232 
233 
234   /*
235    *  Ouverture du datagroup de niveau 3 <entitytype>
236    */
237   if (_MEDgetEntityTypeName(_datagroupname2,entitytype) < 0) {
238     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
239     ISCRUTE_int(entitytype);SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);goto ERROR;
240   }
241 
242   if ((_datagroup2 = _MEDdatagroupOuvrir(_meshid,_datagroupname2)) < 0) {
243     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
244     SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname2);
245     goto ERROR;
246   }
247 
248 
249   /*
250    *  Ouverture du datagroup de niveau 4 [.<geotype>]
251    */
252 
253   if ( entitytype != MED_NODE ) {
254 
255     if (strlen(_geotypename))
256       strncpy(_datagroupname3,_geotypename,MED_NAME_SIZE+1);
257     else
258       if ( _MEDgetInternalGeometryTypeName(fid,_datagroupname3,geotype) < 0) {
259 	MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
260 	ISCRUTE_int(geotype);SSCRUTE(meshname);SSCRUTE(_datagroupname2);
261 	goto ERROR;
262       }
263 
264     if ((_datagroup3 = _MEDdatagroupOuvrir(_datagroup2,_datagroupname3)) < 0) {
265 	  MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
266 	  SSCRUTE(meshname);SSCRUTE(_datagroupname2);SSCRUTE(_datagroupname3);
267 	  goto ERROR;
268     }
269   }
270 
271 
272   if (_datagroup3) _datagroup=_datagroup3; else _datagroup=_datagroup2;
273 
274 
275   /*
276    * Cohérence de l'attribut PFL (nombre de noeuds ou d'elements)
277    */
278   if ( strlen((*_filter).profilename)  ) {  /* != MED_NOPFL*/
279     MED_ERR_(_ret,MED_ERR_NULL,MED_ERR_PROFILE,(*_filter).profilename);
280     SSCRUTE(meshname);SSCRUTE(_datagroupname2);
281     SSCRUTE(_datagroupname3);goto ERROR;
282   }
283 
284   if ((*_filter).storagemode != MED_GLOBAL_PFLMODE ) {
285     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_FILTER,"");
286     ISCRUTE_int(geotype);SSCRUTE(meshname);SSCRUTE(_datagroupname2);
287     ISCRUTE_int((*_filter).storagemode);goto ERROR;
288   }
289 
290   switch(meddatatype)
291     {
292 
293     case MED_COORDINATE_AXIS1 :
294       strcpy(_datasetname,MED_NOM_IN1);
295       if (_gridtype == MED_CURVILINEAR_GRID) goto CURVILINEAR_LABEL; else goto COORDINATE_LABEL;
296 
297     case MED_COORDINATE_AXIS2 :
298       strcpy(_datasetname,MED_NOM_IN2);
299       if (_gridtype == MED_CURVILINEAR_GRID) goto CURVILINEAR_LABEL; else goto COORDINATE_LABEL;
300 
301     case MED_COORDINATE_AXIS3 :
302       strcpy(_datasetname,MED_NOM_IN3);
303       if (_gridtype == MED_CURVILINEAR_GRID) goto CURVILINEAR_LABEL; else goto COORDINATE_LABEL;
304 
305     CURVILINEAR_LABEL:
306       if ((_dataset = _MEDdatasetOuvrir(_datagroup,MED_NOM_COO)) < 0) {
307 	MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATASET,MED_NOM_COO);
308 	goto ERROR;
309       }
310 
311       if (_MEDattrEntierLire(_dataset,_datasetname, (unsigned char*) value ) < 0) {
312 	MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_datasetname);
313 	goto ERROR;
314       }
315       break;
316 
317 
318     case MED_COORDINATE :
319     COORDINATE_LABEL:
320       if (_MEDdatasetNumLire(_datagroup,_datasetname,MED_FLOAT64,
321 				    (med_mode_switch) (*_filter).switchmode ,
322 				    (med_size)        (*_filter).nconstituentpervalue,
323 				    (med_size)        (*_filter).constituentselect,
324 				    (med_size)        (*_filter).filterarraysize,
325 				    MED_COMPACT,MED_PFL_NON_COMPACT,
326 				    (*_filter).filterarray23v30,
327 				    MED_NOPG, 0, (unsigned char*) value ) < 0)
328 	goto ERROR;
329       break;
330 
331 
332     case MED_INDEX_FACE :
333     case MED_INDEX_NODE :
334       switch(cmode)
335 	{
336 	case MED_NODAL :
337 	  switch(meddatatype)
338 	    {
339 	    case MED_CONNECTIVITY :
340 	      strcpy(_datasetname,MED_NOM_NOD);
341 	      break;
342 	    case MED_INDEX_FACE :
343 	      if (geotype == MED_POLYHEDRON)
344 		strcpy(_datasetname,MED_NOM_INN);
345 	      else
346 		strcpy(_datasetname,MED_NOM_IFN);
347 	      break;
348 	    case MED_INDEX_NODE :
349 	      if (geotype == MED_POLYHEDRON)
350 		strcpy(_datasetname,MED_NOM_IFN);
351 	      else
352 		strcpy(_datasetname,MED_NOM_INN);
353 	      break;
354 	    }
355 	  break;
356 
357 	case MED_DESCENDING :
358 	  switch(meddatatype)
359 	    {
360 	    case MED_CONNECTIVITY :
361 	      strcpy(_datasetname,MED_NOM_DES);
362 	      break;
363 	    case MED_INDEX_FACE :
364 	      if (geotype == MED_POLYHEDRON)
365 		strcpy(_datasetname,MED_NOM_IND);
366 	      else
367 		strcpy(_datasetname,MED_NOM_IFD);
368 	      break;
369 	    case MED_INDEX_NODE :
370 	      if (geotype == MED_POLYHEDRON)
371 		strcpy(_datasetname,MED_NOM_IFD);
372 	      else
373 		strcpy(_datasetname,MED_NOM_IND);
374 	      break;
375 	    }
376 	  break;
377 
378 	default :
379 	  MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_CONNECTIVITYMODE,MED_ERR_VALUE_MSG);
380 	  ISCRUTE_int(cmode);goto ERROR;
381 	}
382 
383     case MED_CONNECTIVITY :
384 #if defined(HAVE_F77INT64)
385       if ( _MEDdatasetNumLire(_datagroup,_datasetname,MED_INT64,
386 			      (med_mode_switch) (*_filter).switchmode ,
387 			      (med_size) (*_filter).nconstituentpervalue,
388 			      (med_size) (*_filter).constituentselect,
389 			      (med_size) (*_filter).filterarraysize,MED_COMPACT,MED_PFL_NON_COMPACT,
390 			      (*_filter).filterarray23v30,
391 			      MED_NOPG, 0, (unsigned char*) value ) < 0)
392 	goto ERROR;
393 #else
394       if ( _MEDdatasetNumLire(_datagroup,_datasetname,MED_INT32,
395 			      (med_mode_switch) (*_filter).switchmode ,
396 			      (med_size) (*_filter).nconstituentpervalue,
397 			      (med_size) (*_filter).constituentselect,
398 			      (med_size) (*_filter).filterarraysize,MED_COMPACT,MED_PFL_NON_COMPACT,
399 			      (*_filter).filterarray23v30,
400 			      MED_NOPG, 0, (unsigned char*) value ) < 0)
401 	goto ERROR;
402 #endif
403 
404       break;
405 
406     case MED_NAME :
407       if (_MEDdatasetStringLire(_datagroup,_datasetname,(char *) value) < 0)
408 	goto ERROR;
409       break;
410 
411     case MED_NUMBER :
412     case MED_GLOBAL_NUMBER :
413     case MED_FAMILY_NUMBER :
414 #if defined(HAVE_F77INT64)
415       if (_MEDdatasetNumLire(_datagroup,_datasetname,MED_INT64,
416 			     MED_NO_INTERLACE,
417 			     (med_size)1,
418 			     (med_size) (*_filter).constituentselect,
419 			     (med_size) MED_NOPF,MED_NO_PFLMOD,MED_PFL_NON_COMPACT,
420 			     (med_size *) NULL, MED_NOPG,0,
421 			     (unsigned char*) value) < 0)
422 	goto ERROR;
423 #else
424       if (_MEDdatasetNumLire(_datagroup,_datasetname,MED_INT32,
425 			     MED_NO_INTERLACE,
426 			     (med_size) 1,
427 			     (med_size) (*_filter).constituentselect,
428 			     (med_size) MED_NOPF,MED_NO_PFLMOD,MED_PFL_NON_COMPACT,
429 			     (med_size *) NULL, MED_NOPG,0,
430 			     (unsigned char*) value) < 0)
431 	goto ERROR;
432 #endif
433       break;
434 
435 
436     case MED_COORDINATE_TRSF :
437     default :
438       MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_MEDDATATYPE,MED_ERR_VALUE_MSG);
439       ISCRUTE_int(meddatatype);goto ERROR;
440     }
441 
442 
443   _ret = 0;
444 
445  ERROR:
446 
447 /*   if (!_filterparameterexist) { */
448 /*     if ( MEDfilterClose(_filter) < 0 ) { */
449 /*       MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,MED_ERR_MESH); */
450 /*     SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname2);SSCRUTE(_datagroupname3); */
451 /*     SSCRUTE(_profilename);goto ERROR; */
452 /*     } */
453 /*   } */
454 
455 /*   if (_dataset>0)     if (_MEDdatasetFermer(_dataset) < 0) { */
456 /*     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATASET,MED_NOM_COO); */
457 /*     ISCRUTE_id(_dataset); */
458 /*   } */
459 
460 /*   if (_datagroup4>0)     if (_MEDdatagroupFermer(_datagroup4) < 0) { */
461 /*     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_VARATR_NOM); */
462 /*     ISCRUTE_id(_datagroup4); */
463 /*   } */
464 
465   if (_dataset>0)     if (_MEDdatasetFermer(_dataset) < 0) {
466     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATASET,MED_NOM_COO);
467     ISCRUTE_id(_dataset);
468   }
469 
470   if (_datagroup3>0)     if (_MEDdatagroupFermer(_datagroup3) < 0) {
471     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname3);
472     ISCRUTE_id(_datagroup3);
473   }
474 
475   if (_datagroup2>0)     if (_MEDdatagroupFermer(_datagroup2) < 0) {
476     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname2);
477     ISCRUTE_id(_datagroup2);
478   }
479 
480 /*   if (_datagroup1>0)     if (_MEDdatagroupFermer(_datagroup1) < 0) { */
481 /*     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname1); */
482 /*     ISCRUTE_id(_datagroup1); */
483 /*   } */
484 
485   if (_meshid>0)            if (_MEDdatagroupFermer(_meshid) < 0) {
486     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_meshpath);
487     ISCRUTE_id(_meshid);
488   }
489 
490 
491   va_end(params);
492   *fret = _ret;
493 
494   return;
495 }
496 
497