void _MEDsubdomainCorrespondenceSize30(int dummy, ...) {


  med_err  _ret=-1;
  med_idt  _eqid=0,_datagroup1=0,_dataset=0;
  char     _path[MED_JOINT_GRP_SIZE+2*MED_NAME_SIZE+2+2*MED_MAX_PARA+1+4*MED_TAILLE_NOM_ENTITE+4]=MED_JOINT_GRP;
  char     _datagroupname1[2*MED_TAILLE_NOM_ENTITE+2]="";
  char     _cstpname[2*MED_MAX_PARA+1]="";
  med_size          _njointarray=0;
  med_sorting_type  _sortingtype=0;
  med_int           _intlocalentitype;
  med_int           _intlocalgeotype;
  char              _localgeotypename [MED_TAILLE_NOM_ENTITE+1]="";
  char              _remotegeotypename  [MED_TAILLE_NOM_ENTITE+1]="";


  MED_VARGS_DECL(const, med_idt              , , fid             );
  MED_VARGS_DECL(const, char * , const         , meshname        );
  MED_VARGS_DECL(const, char * , const         , jointname       );
  MED_VARGS_DECL(const, med_int              , , numdt           );
  MED_VARGS_DECL(const, med_int              , , numit           );
  MED_VARGS_DECL(const, med_entity_type      , , localentitype   );
  MED_VARGS_DECL(const, med_geometry_type    , , localgeotype    );
  MED_VARGS_DECL(const, med_entity_type      , , remoteentitype  );
  MED_VARGS_DECL(const, med_geometry_type    , , remotegeotype   );
  MED_VARGS_DECL(, med_int *, const            , nentitycor      );
  MED_VARGS_DECL(, med_err *                  ,, fret            );

  va_list params;
  va_start(params,dummy);

  MED_VARGS_DEF(const, med_idt              , , fid             );
  MED_VARGS_DEF(const, char * , const         , meshname        );
  MED_VARGS_DEF(const, char * , const         , jointname       );
  MED_VARGS_DEF(const, med_int              , , numdt           );
  MED_VARGS_DEF(const, med_int              , , numit           );
  MED_VARGS_DEF(const, med_entity_type      , , localentitype   );
  MED_VARGS_DEF(const, med_geometry_type    , , localgeotype    );
  MED_VARGS_DEF(const, med_entity_type      , , remoteentitype  );
  MED_VARGS_DEF(const, med_geometry_type    , , remotegeotype   );
  MED_VARGS_DEF(, med_int *, const            , nentitycor      );
  MED_VARGS_DEF(, med_err *                  ,, fret            );

  /*
   * On inhibe le gestionnaire d'erreur
   */

  _MEDmodeErreurVerrouiller();


  if ( MEDmeshSortingTypeRd(fid,meshname,&_sortingtype) < 0 ) {
    MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API," MEDmeshSortingTypeRd");
    SSCRUTE(meshname);ISCRUTE_int(_sortingtype);goto ERROR;
  }


  strcat( _path, meshname);
  strcat( _path, "/");
  strcat( _path, jointname);
  strcat( _path, "/");
  _MEDgetComputationStepName(_sortingtype,numdt,numit,&_path[strlen(_path)]);
  strcat( _path, "/");

  /*
   *  Construction du nom de  datagroup <localentitype>[.<localgeotype>].<remoteentitype>[.<remotegeotype>]
   */
  if (_MEDgetEntityTypeName(&_path[strlen(_path)],localentitype) < 0) {
    MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
    ISCRUTE_int(localentitype);SSCRUTE(jointname);goto ERROR;
  }
  if ( localentitype != MED_NODE ) {
    if ( _MEDgetInternalGeometryTypeName(0,_localgeotypename,localgeotype) < 0) {
      MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
      ISCRUTE_int(localgeotype);SSCRUTE(jointname);goto ERROR;
    }
      strcat(_path,".");
      strcat(_path,_localgeotypename);
  }

  strcat(_path,".");

  if (_MEDgetEntityTypeName(&_path[strlen(_path)],remoteentitype) < 0) {
    MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
    ISCRUTE_int(remoteentitype);SSCRUTE(jointname);goto ERROR;
  }
  if ( remoteentitype != MED_NODE ) {
    if ( _MEDgetInternalGeometryTypeName(fid,_remotegeotypename,remotegeotype) < 0) {
      MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
      ISCRUTE_int(remotegeotype);SSCRUTE(jointname);goto ERROR;
    }
      strcat(_path,".");
      strcat(_path,_remotegeotypename);
  }


  if ( (_datagroup1 = _MEDdatagroupOuvrir(fid,_path)) < 0 ) {
    *nentitycor=0;
    goto SORTIE;
  }

  if ((_dataset = _MEDdatasetOuvrir(_datagroup1,MED_NOM_COR)) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATASET,MED_NOM_COR);
    SSCRUTE(_path);
    goto ERROR;
  }

  if ( _MEDattrEntierLire(_dataset,MED_NOM_NBR,nentitycor) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_SUBDOMAINJOINT_MSG);
    SSCRUTE(_path);SSCRUTE(MED_NOM_NBR);ISCRUTE(*nentitycor);
    goto ERROR;
  }

 SORTIE:
  _ret = 0;
 ERROR:

  if (_dataset>0)     if (_MEDdatasetFermer(_dataset) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATASET,MED_NOM_COR);
    ISCRUTE_id(_dataset);
  }

  if (_datagroup1>0)     if (_MEDdatagroupFermer(_datagroup1) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
    ISCRUTE_id(_datagroup1);
  }

  va_end(params);
  *fret = _ret;
  return;
}
Exemplo n.º 2
0
void
_MEDmeshnEntity236(int dummy, ...)
{

   med_int          _ret=-1,_n=0,_tmpn=0;
   med_size         _nn =0;
   med_data_type    _meddatatype;
   med_int          _nfaces=0;
   char             _meshpath[MED_TAILLE_MAA+MED_TAILLE_NOM+1]=MED_MAA;
   med_idt          _meshid=0,_datagroup1=0;
   char             _datagroupname1[MED_TAILLE_NOM_ENTITE+1]="";
   med_err          _err =0;
   med_bool         _datagroupexist=MED_FALSE;
   med_bool         _isasoftlink   =MED_FALSE;
   int              _cmodeit=0, _ncmode=1;
   med_connectivite _cmode[2] = { MED_NO_CMODE, MED_NO_CMODE };
 
  MED_VARGS_DECL(const, med_idt                , , fid           );
  MED_VARGS_DECL(const, char * , const           , meshname      );
  MED_VARGS_DECL(const, med_int                , , numdt         );
  MED_VARGS_DECL(const, med_int                , , numit         );
  MED_VARGS_DECL(const, med_entity_type        , , entitytype    );
  MED_VARGS_DECL(const, med_geometry_type      , , geotype       );
  MED_VARGS_DECL(const, med_data_type          , , meddatatype   );
  MED_VARGS_DECL(const, med_connectivity_mode  , , cmode         );
  MED_VARGS_DECL(const, med_storage_mode       , , storagemode   );
  MED_VARGS_DECL(, char     *, const       , profilename         );
  MED_VARGS_DECL(, med_int  *, const       , profilesize         );
  MED_VARGS_DECL(, med_bool *, const       , changement          );
  MED_VARGS_DECL(, med_bool *, const       , transformation      );
  MED_VARGS_DECL(, med_int  *             ,, fret                );

  va_list params;
  va_start(params,dummy);

  MED_VARGS_DEF(const, med_idt                , , fid           );
  MED_VARGS_DEF(const, char * , const           , meshname      );
  MED_VARGS_DEF(const, med_int                , , numdt         );
  MED_VARGS_DEF(const, med_int                , , numit         );
  MED_VARGS_DEF(const, med_entity_type        , , entitytype    );
  MED_VARGS_DEF(const, med_geometry_type      , , geotype       );
  MED_VARGS_DEF(const, med_data_type          , , meddatatype   );
  MED_VARGS_DEF(const, med_connectivity_mode  , , cmode         );
  MED_VARGS_DEF(const, med_storage_mode       , , storagemode   );
  MED_VARGS_DEF(, char     *, const       , profilename         );
  MED_VARGS_DEF(, med_int  *, const       , profilesize         );
  MED_VARGS_DEF(, med_bool *, const       , changement          );
  MED_VARGS_DEF(, med_bool *, const       , transformation      );
  MED_VARGS_DEF(, med_int  *             ,, fret                );

  _meddatatype=meddatatype;
   
 
  if ( (numdt != MED_NO_DT) || (numit != MED_NO_IT) ) {
    MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_COMPUTINGSTEP,MED_ERR_MESH_MSG);
    SSCRUTE(meshname);ISCRUTE(numdt);ISCRUTE(numit);
    goto ERROR;
  }

  _cmode[0]= (med_connectivite) cmode;

  if ( entitytype == MED_UNDEF_ENTITY_TYPE ) goto SORTIE;

  /*
   * Gestion entitytype == MED_ALL_ENTITY_TYPE
   */
  if ( entitytype == MED_ALL_ENTITY_TYPE ) {

    strcat(_meshpath,meshname);
    if ((_meshid = _MEDdatagroupOuvrir(fid,_meshpath)) < 0) {
      MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_meshpath);
      ISCRUTE_id(_meshid);goto ERROR;
    }

    if( _MEDdatagroupExist(_meshid,MED_NOM_NOE,&_datagroupexist,&_isasoftlink) < 0 ) {
      MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDdatagroupExist");
      SSCRUTE(MED_NOM_NOE);goto ERROR;
    }
    if ( _datagroupexist ) _nn++;

    if( _MEDdatagroupExist(_meshid,MED_NOM_MAI,&_datagroupexist,&_isasoftlink) < 0 ) {
      MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDdatagroupExist");
      SSCRUTE(MED_NOM_MAI);goto ERROR;
    }
    if ( _datagroupexist ) _nn++;

    if( _MEDdatagroupExist(_meshid,MED_NOM_FAC,&_datagroupexist,&_isasoftlink) < 0 ) {
      MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDdatagroupExist");
      SSCRUTE(MED_NOM_FAC);goto ERROR;
    }
    if ( _datagroupexist ) _nn++;

    if( _MEDdatagroupExist(_meshid,MED_NOM_ARE,&_datagroupexist,&_isasoftlink) < 0 ) {
      MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDdatagroupExist");
      SSCRUTE(MED_NOM_ARE);goto ERROR;
    }
    if ( _datagroupexist ) _nn++;

/* En 2.3.6 les familles, les équivalences ... sont stockées dans le groupe <meshname>*/
/*     _err=_MEDnObjects(_meshid,".",&_nn); */
/*     if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) { */
/*       MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,_meshid); */
/*       goto ERROR; */
/*     } */
    _n = _nn;
    goto SORTIE;
  }

  if ( geotype == MED_GEO_ALL ) {

      strcat(_meshpath,meshname);
      if ((_meshid = _MEDdatagroupOuvrir(fid,_meshpath)) < 0) {
	MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_meshpath);
	ISCRUTE_id(_meshid);goto ERROR;
      }

      if (_MEDgetEntityTypeName(_datagroupname1,entitytype) < 0) {
	MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
	ISCRUTE_int(entitytype);SSCRUTE(meshname);goto ERROR;
      }

      if ((_datagroup1 = _MEDdatagroupOuvrir(_meshid,_datagroupname1)) < 0) {
	_n=0;_datagroup1=0;
	goto SORTIE;
      }

      _err=_MEDnObjects(_datagroup1,".",&_nn);
      if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
	MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,_datagroupname1);
	goto ERROR;
      }
/*       SSCRUTE(_datagroupname1);ISCRUTE_long(_nn); */
      if ( ( entitytype == MED_NODE ) && (_nn > 0) ) _nn=1;
/*       SSCRUTE(_datagroupname1);ISCRUTE_long(_nn); */
      _n = _nn;
      goto SORTIE;

  }


  switch( meddatatype )
    {
    case MED_GLOBAL_NUMBER:
    case MED_NAME:
    case MED_NUMBER:
    case MED_FAMILY_NUMBER:

      switch (entitytype) {
      case MED_NODE:
	/*Pour connaître le nombre d'entités des attributs optionnels,
	  on se base sur le tableau de coordonnées */
/* 	_meddatatype = MED_COORDINATE; */
	break;
      case MED_CELL:
      case MED_DESCENDING_FACE:
      case MED_DESCENDING_EDGE:
	/*Pour connaître le nombre d'entités des attributs optionnels,
	  on se base sur le tableau de connectivité */
/* 	_meddatatype = MED_CONNECTIVITY; */

	/*
	 * Positionne un mode de connectivité _cmode si le meddatatype demandé
	 * est autre chose que des coordonnées ou des connectivités et le cmode non
	 * positionné.
	 * Cette Information est necessaire pour construire le nom du datatset.
	 */
	if ( _cmode[0] == MED_NO_CMODE ) {
	  _ncmode =2;_cmode[0]=MED_NOD;_cmode[1]=MED_DESC;
	}
	break;
      default:
	MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
	ISCRUTE_int(entitytype);goto ERROR;
      }
      goto CALL_NENT;

    case MED_COORDINATE: /*Par extension au CONNECTIVITY mais ne devrait pas être utilisé.*/
    case MED_CONNECTIVITY:
      if ( geotype == MED_POLYGON2 ) {_n=0; break;}
      if ( geotype == MED_POLYGON ) {
	  if ( MEDpolygoneInfo( fid,(char *)meshname, (med_entite_maillage) entitytype, (med_connectivite) _cmode[0],
				&_n) < 0) {
/* 	    MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDpolygoneInfo");SSCRUTE(meshname); */
/* 	    ISCRUTE(meddatatype);ISCRUTE(entitytype);ISCRUTE(geotype);goto ERROR; */
	    _n=0;
	  }
	  break;
      }

      if ( geotype == MED_POLYHEDRON ) {
	if (    MEDpolyedreInfo(fid,(char *) meshname, (med_connectivite) _cmode[0]
				,&_nfaces,&_n) < 0) {
/* 	  MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDpolyedreInfo");SSCRUTE(meshname); */
/* 	  ISCRUTE(meddatatype);ISCRUTE(entitytype);ISCRUTE(geotype);goto ERROR; */
	  _n=0;
	}
	break;
      }
      goto CALL_NENT;

    case MED_INDEX_FACE:
      if ( geotype == MED_POLYHEDRON ) {

	_meddatatype = MED_CONNECTIVITY;
	_n=1 ;

	goto CALL_NENT;

/* 	if ( (_n = MEDnEntMaa(fid,meshname,(med_table) MED_CONNECTIVITY, (med_entite_maillage) MED_CELL, */
/* 			      (med_geometrie_element) MED_POLYHEDRON, (med_connectivite) MED_NOD)) < 0) { */
/* 	  MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDnEntMaa");SSCRUTE(meshname); */
/* 	  ISCRUTE(meddatatype);ISCRUTE(entitytype);ISCRUTE(geotype);goto ERROR; */
/* 	} */

	_n+=1;
	break;
      } else {
	MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
	ISCRUTE_int(geotype);
	goto ERROR;
      }
    case MED_INDEX_NODE:
      if ( geotype == MED_POLYHEDRON ) {
	if ( MEDpolyedreInfo(fid,(char *) meshname, (med_connectivite) _cmode[0],&_nfaces, &_n) < 0) {
/* 	  MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDpolyedreInfo");SSCRUTE(meshname); */
/* 	  ISCRUTE(meddatatype);ISCRUTE(entitytype);ISCRUTE(geotype);goto ERROR; */
	  _nfaces=0;
	}
	_n=_nfaces;
	break;
      } else
	if ( (geotype == MED_POLYGON) || (geotype == MED_POLYGON2) ) {
	  _meddatatype = MED_CONNECTIVITY;
	  _n = 1;
	} else {
	  MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
	  ISCRUTE_int(geotype);goto ERROR;
	}
    case MED_COORDINATE_AXIS1:
    case MED_COORDINATE_AXIS2:
    case MED_COORDINATE_AXIS3:

    CALL_NENT:

      for (_cmodeit=0; _cmodeit < _ncmode; ++_cmodeit)
	if ( (_tmpn =  MEDnEntMaa( fid, (char *) meshname,
				   (med_table)             _meddatatype,
				   (med_entite_maillage)   entitytype,
				   (med_geometrie_element) geotype,
				   (med_connectivite)      _cmode[_cmodeit]) ) > 0 )
	  break;

      if ( _tmpn < 0 ) {
	MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDnEntMaa");SSCRUTE(meshname);
	ISCRUTE_int(_meddatatype);ISCRUTE_int(entitytype);ISCRUTE_int(geotype);goto ERROR;
      }

      _n+=_tmpn;
      break;

    default:
      MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_MEDDATATYPE,MED_ERR_VALUE_MSG);
      ISCRUTE_int(meddatatype);goto ERROR;

    }

 SORTIE:

 *transformation = MED_FALSE;
 /*TODO : 3.0.1 : Tester la présence d'autres datasets
  que les coord/conn/index pour positionner chgt TRUE uniquement
 dans ce cas de figure.*/
 *changement     = MED_TRUE;
 *profilesize    = 0;
 profilename[0]  = '\0';

  _ret = _n;

 ERROR:
  if (_datagroup1>0)     if (_MEDdatagroupFermer(_datagroup1) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname1);
    ISCRUTE_id(_datagroup1);
  }

  if (_meshid>0)            if (_MEDdatagroupFermer(_meshid) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_meshpath);
    ISCRUTE_id(_meshid);
  }

  *fret = _ret;
  va_end(params);
  return;
}
Exemplo n.º 3
0
void
_MEDmeshnEntity30(int dummy, ...)
{


  med_access_mode       _MED_ACCESS_MODE;
  med_int               _ret=-1,_err=-1;
  med_idt               _meshid=0, _datagroup=0,_datagroupf=0,_datagroup1=0;
  med_idt               _datagroup2=0,_datagroup3=0,_datagroup4=0,_dataset=0;
  char                  _meshpath         [MED_TAILLE_SUP_MAA+MED_NAME_SIZE+1]="";
  char                  _datagroupname1   [2*MED_MAX_PARA+1]       ="";
  char                  _datagroupname2   [MED_TAILLE_NOM_ENTITE+1]="";
  char                  _datagroupname3   [MED_TAILLE_NOM_ENTITE+1]="";
  char                  _datagroupname4   [MAX(MED_TAILLE_VARATR,MED_TAILLE_COOTRF)]="";
  char                  _datasetconame    [3 + 1 + 3 + 1 ]         ="";
  char                  _profilename      [MED_NAME_SIZE+1]        ="";
  char                  _geotypename      [MED_TAILLE_NOM_ENTITE+1]="";
  char                  _datasetname      [MED_TAILLE_NOM_ENTITE+1]="";
  med_sorting_type      _sortingtype       = 0;
  med_int               _intsortingtype    = 0;
  med_int               _profilearraysize  = 0;
  med_int               _changement=0, _changement_s=0, _transformation=0;
  med_bool              _changement_co     = MED_FALSE;
  med_size              _n=0;
  med_int               _intn=0;
  med_bool              _isasupportmesh    = MED_FALSE;
  med_bool              _isasoftlink       = MED_FALSE;
  med_bool              _datasetexist      = MED_FALSE;
  med_int               _ntmpmeddatatype   = 1;
  med_data_type         _tmpmeddatatype[4] = {MED_UNDEF_DATATYPE,MED_UNDEF_DATATYPE,MED_UNDEF_DATATYPE,MED_UNDEF_DATATYPE};
  med_grid_type         _gridtype          = MED_UNDEF_GRID_TYPE;
  med_int               _intgridtype       = 0;
  med_int               _intmeshtype       = 0;
  med_int               _meshdim           = 0;
  int                   _i                 = 0;
  med_connectivity_mode _cmode                ;


  MED_VARGS_DECL(const, med_idt                , , fid           );
  MED_VARGS_DECL(const, char * , const           , meshname      );
  MED_VARGS_DECL(const, med_int                , , numdt         );
  MED_VARGS_DECL(const, med_int                , , numit         );
  MED_VARGS_DECL(const, med_entity_type        , , entitytype    );
  MED_VARGS_DECL(const, med_geometry_type      , , geotype       );
  MED_VARGS_DECL(const, med_data_type          , , meddatatype   );
  MED_VARGS_DECL(const, med_connectivity_mode  , , cmode         );
  MED_VARGS_DECL(const, med_storage_mode       , , storagemode   );
  MED_VARGS_DECL(, char     *, const       , profilename         );
  MED_VARGS_DECL(, med_int  *, const       , profilesize         );
  MED_VARGS_DECL(, med_bool *, const       , changement          );
  MED_VARGS_DECL(, med_bool *, const       , transformation      );
  MED_VARGS_DECL(, med_int  *             ,, fret                );

  va_list params;
  va_start(params,dummy);

  MED_VARGS_DEF(const, med_idt                , , fid           );
  MED_VARGS_DEF(const, char * , const           , meshname      );
  MED_VARGS_DEF(const, med_int                , , numdt         );
  MED_VARGS_DEF(const, med_int                , , numit         );
  MED_VARGS_DEF(const, med_entity_type        , , entitytype    );
  MED_VARGS_DEF(const, med_geometry_type      , , geotype       );
  MED_VARGS_DEF(const, med_data_type          , , meddatatype   );
  MED_VARGS_DEF(const, med_connectivity_mode  , , cmode         );
  MED_VARGS_DEF(const, med_storage_mode       , , storagemode   );
  MED_VARGS_DEF(, char     *, const       , profilename         );
  MED_VARGS_DEF(, med_int  *, const       , profilesize         );
  MED_VARGS_DEF(, med_bool *, const       , changement          );
  MED_VARGS_DEF(, med_bool *, const       , transformation      );
  MED_VARGS_DEF(, med_int  *             ,, fret                );

  _cmode = cmode;

  /*
   * On inhibe le gestionnaire d'erreur HDF 5
   */
  _MEDmodeErreurVerrouiller();

  if ( (_MED_ACCESS_MODE = _MEDmodeAcces(fid) ) == MED_ACC_UNDEF ) {
    MED_ERR_(_ret,MED_ERR_UNRECOGNIZED,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
    goto ERROR;
  }

  /*
   * Ouverture du datagroup de niveau 1 <_meshpath>/<meshname>
   */
  NOFINALBLANK(meshname,ERROR);

  if ((_meshid=_MEDmeshDatagroupOpen(fid,meshname,_meshpath,&_isasupportmesh)) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
    SSCRUTE(_meshpath); goto ERROR;
  }

  /* Lecture de la dimension du maillage  */
  if (_MEDattrEntierLire(_meshid,MED_NOM_DIM,&_meshdim) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
    SSCRUTE(meshname);SSCRUTE(MED_NOM_DIM);ISCRUTE(_meshdim);goto ERROR;
  }

  /* Lecture du type de maillage (attribut MED_NOM_TYP)  */
  if (_MEDattrEntierLire(_meshid,MED_NOM_TYP,&_intmeshtype) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
    SSCRUTE(meshname);SSCRUTE(MED_NOM_TYP);ISCRUTE(_intmeshtype);goto ERROR;
  }

  if ( ( (med_mesh_type) _intmeshtype ) != MED_UNSTRUCTURED_MESH ) {

    /* Lecture de l'attribut MED_NOM_GTY  */
    if (_MEDattrEntierLire(_meshid,MED_NOM_GTY,&_intgridtype) < 0) {
      MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
      SSCRUTE(meshname);SSCRUTE(MED_NOM_GTY);ISCRUTE(_intgridtype);goto ERROR;
    }
    _gridtype= (med_grid_type) _intgridtype;
  }

  /*
   * Ouverture du datagroup de niveau 2 <numdt>.<numit>
   */
  if ( _MEDattrEntierLire(_meshid,MED_NOM_SRT,&_intsortingtype) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
    SSCRUTE(meshname);SSCRUTE(MED_NOM_SRT);ISCRUTE(_intsortingtype);goto ERROR;
  }
  _sortingtype = (med_sorting_type) (_intsortingtype);

  _MEDgetComputationStepName(_sortingtype,numdt,numit,_datagroupname1);
  if ( (_datagroup1 = _MEDdatagroupOuvrir(_meshid,_datagroupname1)) < 0 ) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
    SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);
    SSCRUTE(_datagroupname1);ISCRUTE_id(_datagroup1);goto ERROR;
  }


  /*
   * Attribut CGT (un changement a eu lieu depuis l'étape de calcul précédente)
   */
  if ( _MEDattrEntierLire(_datagroup1,MED_NOM_CGT,&_changement) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
    SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);
    SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_CGT);goto ERROR;
  }

  *changement     = (med_bool) _changement;
  *transformation = MED_FALSE;
  /*
   * Gestion entitytype == MED_UNDEF_ENTITY_TYPE
   */
  if ( entitytype == MED_UNDEF_ENTITY_TYPE ) {
    _n=0; goto SORTIE;
  }

  /*
   * Gestion entitytype == MED_ALL_ENTITY_TYPE
   */
  if ( entitytype == MED_ALL_ENTITY_TYPE ) {
    _err=_MEDnObjects(_datagroup1,".",&_n);
    if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
      MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,_datagroupname1);
      goto ERROR;
    }
    goto SORTIE;
  }


  /*
   *  Ouverture du datagroup de niveau 3 <entitytype>
   */
  if (_MEDgetEntityTypeName(_datagroupname2,entitytype) < 0) {
    MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
    ISCRUTE_int(entitytype);SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);goto ERROR;
  }

  if ((_datagroup2 = _MEDdatagroupOuvrir(_datagroup1,_datagroupname2)) < 0) {
    *changement     = (med_bool) MED_FALSE;
    _n=0;_datagroup2=0;
    goto SORTIE;
  }

  /*  MAJ du changement pour le type d'entité <entitytype>
   *   ( annulant eventuellement le changement global précédent concernant tous les types d'entités)
   *  Attribut CGT (un changement a eu lieu depuis l'étape de calcul précédente)
   */
  if ( _MEDattrEntierLire(_datagroup2,MED_NOM_CGT,&_changement) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
    SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);
    SSCRUTE(_datagroupname2);SSCRUTE(MED_NOM_CGT);
    goto ERROR;
  }
  *changement = (med_bool) _changement;

  /*
   *  Ouverture du datagroup de niveau 4 <geotype>
   */

  /* Pas Utilisation pour MED_NODE  */
  if ( geotype == MED_GEO_ALL ) {

    _err=_MEDnObjects(_datagroup2,".",&_n);
    if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
      MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,_datagroupname2);
      goto ERROR;
    }
    /*Par construction du modèle, le tableau de coordonnées preexiste aux autres */
    if ( ( entitytype == MED_NODE ) && (_n > 0) ) _n=1;
    goto SORTIE;
  }

  if ( entitytype != MED_NODE ) {

    /* Lecture du nom de type géométrique */
    /*TODO : Remplacer les deux appels suivants par un seul gérant les geotype dynamiques et statiques*/
    if ( entitytype == MED_STRUCT_ELEMENT ) {
      if ( MEDstructElementName(fid, geotype,_datagroupname3) < 0 ) {
	MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDstructElementName");
	ISCRUTE_int(geotype);goto ERROR;
      }
    } else
      if ( _MEDgetInternalGeometryTypeName(_datagroupname3,geotype) < 0) {
	MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
	ISCRUTE_int(geotype);SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);
	SSCRUTE(_datagroupname2);goto ERROR;
      }

    if ((_datagroup3 = _MEDdatagroupOuvrir(_datagroup2,_datagroupname3)) < 0) {
      _n=0;
      *changement = MED_FALSE;
      goto SORTIE;
    }
  }

  if (_datagroup3) _datagroup=_datagroup3; else _datagroup=_datagroup2;

  /*  MAJ du changement pour le type géométrique d'entité <geotype>
   *   ( annulant eventuellement le changement global précédent concernant tous les types d'entités)
   *  Attribut CGT (un changement a eu lieu depuis l'étape de calcul précédente)
   * Prend en charge le cas d'un dataset vide écrit pour un typegeo donné (CHGT==1)
   */
  if (_datagroup3) {
    if ( _MEDattrEntierLire(_datagroup3,MED_NOM_CGT,&_changement) < 0) {
      MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
      SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname2);
      SSCRUTE(_datagroupname3);SSCRUTE(MED_NOM_CGT);
      goto ERROR;
    }
    *changement = (med_bool) _changement;
  }

  /*
   * Lecture du flag de modification sur autre chose que MED_CONNECTIVITY,MED_COORDINATE,MED_COORDINATE_AXIS<i>
   *
   */
  if ( _MEDattrEntierLire(_datagroup,MED_NOM_CGS,&_changement_s) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
    SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname2);
    SSCRUTE(_datagroupname3);SSCRUTE(MED_NOM_CGS);goto ERROR;
  }

  /* 1) Lorsque l'utilisateur interroge un <meddatatype> qui est relatif a des coordonnées (famille,....) il faut mettre
   * le flag chgt à jour par rapport à des modifications potentiellement effectuées sur ces coordonnées
   * <=>
   * Si on interroge autre chose que MED_CONNECTIVITY,MED_COORDINATE
   * et qu'un changement est présent sur MED_CONNECTIVITY,MED_COORDINATE
   * le flag chgt doit être positionné à vrai
   * Une demande entitype==MED_NODE && (meddatatype == MED_COORDINATE_AXIS1)||(meddatatype == MED_COORDINATE_AXIS2)
   *    ||(meddatatype === MED_COORDINATE_AXIS3) est assimilée à une demande concernant des coordonnées
   * <=>
   * Y-a-t'il une modification des datasets COO(si NOE)| NOD|DES(si !NOE)
   */
  /* 2)
   * Positionne un mode de connectivité _cmode si le meddatatype demandé
   * est autre chose que des coordonnées ou des connectivités et que le cmode n'a pas été
   * spécifié par l'utilisateur.
   * Cette Information est necessaire pour construire le nom du dataset.
   */
  if (    (meddatatype != MED_CONNECTIVITY) && ( meddatatype != MED_COORDINATE )
       && (meddatatype != MED_COORDINATE_AXIS1)
       && (meddatatype != MED_COORDINATE_AXIS2)
       && (meddatatype != MED_COORDINATE_AXIS3)
       && (meddatatype != MED_INDEX_FACE)
       && (meddatatype != MED_INDEX_NODE)) {

    if (entitytype == MED_NODE) {
      if ( ( (med_mesh_type) _intmeshtype ) != MED_UNSTRUCTURED_MESH ) {
	if ( (_gridtype == MED_CARTESIAN_GRID) ||
	     (_gridtype == MED_CURVILINEAR_GRID) ) {
	  _ntmpmeddatatype=_meshdim;
	  _tmpmeddatatype[0] = MED_COORDINATE_AXIS1;
	  _tmpmeddatatype[1] = MED_COORDINATE_AXIS2;
	  _tmpmeddatatype[2] = MED_COORDINATE_AXIS3;
	} else  if (_gridtype == MED_CURVILINEAR_GRID ) {
/*Les grilles curvilinéaires utilisent MED_COORDINATE_AXISx pour stocker la structure et le tableau MED_COORDINATE pour stocker les coordonnées des noeuds */
	  ++_ntmpmeddatatype;
	  _tmpmeddatatype[3] = MED_COORDINATE;
	} else {
	MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_GRIDTYPE,MED_ERR_MESH_MSG);
	SSCRUTE(meshname);ISCRUTE_int(_gridtype);goto ERROR;
	}
      } else
	_tmpmeddatatype[0] = MED_COORDINATE;
    } else {
      switch (geotype) {
      case MED_POLYHEDRON:
	_ntmpmeddatatype=3;
	_tmpmeddatatype[2] = MED_CONNECTIVITY;
	_tmpmeddatatype[1] = MED_INDEX_FACE;
	_tmpmeddatatype[0] = MED_INDEX_NODE;
	break;
      case MED_POLYGON:
	_ntmpmeddatatype=2;
	_tmpmeddatatype[1] = MED_CONNECTIVITY;
	_tmpmeddatatype[0] = MED_INDEX_NODE;
	break;
      default:
	if ( ( (med_mesh_type) _intmeshtype ) == MED_STRUCTURED_MESH ) {
	  _ntmpmeddatatype=0;
	  break;
	}
	_tmpmeddatatype[0] = MED_CONNECTIVITY;
	if ( cmode == MED_NO_CMODE ) {
	  if ( _MEDdatasetExistByMedtype(_datagroup,MED_CONNECTIVITY,MED_NODAL,
				&_datasetexist, &_isasoftlink) < 0) {
	    MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDdatasetExistByMedtype");
	    SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname2);
	    SSCRUTE(_datagroupname3);goto ERROR;
	  }

	  if ( _datasetexist ) _cmode= MED_NODAL;
	  else
	    if ( _MEDdatasetExistByMedtype(_datagroup,MED_CONNECTIVITY,MED_DESCENDING,
				  &_datasetexist, &_isasoftlink)  < 0) {
	      MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDdatasetExistByMedtype");
	      SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname2);
	      SSCRUTE(_datagroupname3);goto ERROR;
	    } else
	      _cmode = MED_DESCENDING;
	}
      }
    }

    *changement = MED_FALSE;
    for (_i=0; _i < _ntmpmeddatatype ;++_i) {
      if ( _MEDgetDatasetChgt( _datagroup, _tmpmeddatatype[_i], _cmode,
			       &_isasoftlink, &_changement_co ) < 0) {
	MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"getDatasetChgt");
	SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname2);
	SSCRUTE(_datagroupname3);goto ERROR;
      }
      *changement |= _changement_co;
    }
  }


  /*
   * Niveau de datagroup 5 supplémentaire pour les éléments de structure ou les transformations.
   */
  if (  (meddatatype==MED_VARIABLE_ATTRIBUTE) || (meddatatype==MED_COORDINATE_TRSF ) ) {
    if (meddatatype == MED_VARIABLE_ATTRIBUTE)
      strcpy(_datagroupname4,MED_VARATR_NOM);
    else
      strcpy(_datagroupname4,MED_COOTRF_NOM);

    if ((_datagroup4 = _MEDdatagroupOuvrir(_datagroup,_datagroupname4)) < 0) {
      _n=0;
      goto SORTIE;
    }
  }
  if ( (meddatatype==MED_VARIABLE_ATTRIBUTE) || (meddatatype==MED_COORDINATE_TRSF ) )
    _datagroupf=_datagroup4;
  else
    _datagroupf=_datagroup;


  /*
   * Construction du nom du dataset à lire
   */
  if (  _MEDgetDatasetName(_datasetname,meddatatype,cmode) < 0) {
    MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDgetDatasetName");
    SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname2);
    SSCRUTE(_datagroupname3);goto ERROR;
  }

  /*
   *  MAJ du champ transformation pour le (meddatatype==MED_VARIABLE_ATTRIBUTE) || (meddatatype==MED_COORDINATE_TRSF)
   */
  if (_datagroup4) {
    if ( _MEDattrEntierLire(_datagroup4,MED_NOM_CGT,&_transformation) < 0) {
      MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
      SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname2);
      SSCRUTE(_datagroupname3);SSCRUTE(_datagroupname4);SSCRUTE(MED_NOM_CGT);
      goto ERROR;
    }
  }

  if ( (_dataset = _MEDdatasetOuvrir(_datagroupf,_datasetname)) < 0) {
    _n=0;_dataset=0;*transformation = (med_bool) MED_FALSE;
/*     if ( (numdt != MED_NO_DT) || (numit != MED_NO_IT) ) { */
/*       MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATASET,_datasetname); */
/*       SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt); */
/*       SSCRUTE(_datagroupname2);SSCRUTE(_datagroupname3);SSCRUTE(_datagroupname4); */
/*       ISCRUTE_size(_n); */
/*       goto ERROR; */
/*     } */
    goto SORTIE;
  }


  if (!_datagroup4) {

    /*
     * Lire l'attribut CGT pour savoir si le dataset a changé
     * n'a pas de sens si le dataset est en fait un lien vers le dataset précedent.
     * En testant si le dataset est un lien on détermine si un changement a eu lieu
     * depuis la séquence de calcul précédente.
     * Ce traitement ne doit pas être effectué pour le pas de temps initial et pour
     * (meddatatype==MED_VARIABLE_ATTRIBUTE) || (meddatatype==MED_COORDINATE_TRSF)
     */

    if ( _MEDisasoftlink(_datagroupf, _datasetname,MED_TRUE, &_isasoftlink ) < 0) {
      MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_LINK,_datasetname);
      SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);
      SSCRUTE(_datagroupname2);SSCRUTE(_datagroupname3);SSCRUTE(_datagroupname4);
      ISCRUTE_size(_n);goto ERROR;
    }

    if (_isasoftlink)
      _transformation = MED_FALSE;
    else {

      if ( _MEDattrEntierLire(_dataset,MED_NOM_CGT,&_transformation) < 0) {
	MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
	SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname2);
	SSCRUTE(_datagroupname3);SSCRUTE(MED_NOM_CGT);
	goto ERROR;
      }
    }

  }

  *transformation = (med_bool) _transformation;

  if ( ( meddatatype == MED_CONNECTIVITY) && ( meddatatype == MED_COORDINATE ) ) {
    *transformation &= (med_bool) !_changement_s;
  }

  /*
   * Attribut PFL (nombre de noeuds ou d'elements)
   * la lecture est faite sur le datagroup _datagroup et non sur _datagroupf
   * pour (meddatatype==MED_VARIABLE_ATTRIBUTE) || (meddatatype==MED_COORDINATE_TRSF)
   */
  _profilearraysize = 0;
  profilename[0]='\0';

  if ( _MEDattrStringLire(_datagroup,MED_NOM_PFL,MED_NAME_SIZE,_profilename) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
    SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname2);
    SSCRUTE(_datagroupname3); SSCRUTE(MED_NOM_PFL);SSCRUTE(_profilename);goto ERROR;
  }

  if ( strcmp(_profilename,MED_NO_PROFILE_INTERNAL) ) {
    strncpy(profilename,_profilename,MED_NAME_SIZE+1);
    profilename[MED_NAME_SIZE]='\0';

    if ( ( _profilearraysize = MEDprofileSizeByName( fid,_profilename) ) < 0 ) {
      MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,MED_ERR_MESH_MSG);
      SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname2);
      SSCRUTE(_profilename);SSCRUTE("MEDprofileSizeByName");goto ERROR;
    }
  }
  *profilesize=(med_int) _profilearraysize;
  

  /*
   * Attribut NBR (nombre d'entité)
   */
  if ( _MEDattrEntierLire(_dataset,MED_NOM_NBR,&_intn) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
    SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);
    SSCRUTE(_datagroupname2);SSCRUTE(_datagroupname3);SSCRUTE(_datagroupname4);
    SSCRUTE(_datasetname);SSCRUTE(MED_NOM_NBR);ISCRUTE_size(_n);goto ERROR;
  }
  _n = _intn;

  if (_profilearraysize)
    switch(storagemode) {

    case MED_GLOBAL_PFLMODE :
      break;

    case MED_COMPACT_PFLMODE :
      if ( meddatatype!=MED_COORDINATE_TRSF )
	_n=_profilearraysize;

      break;

    default :
      MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_STORAGEMODE,MED_ERR_VALUE_MSG);
      ISCRUTE_int(storagemode);goto ERROR;
      break;

    }

 SORTIE:

  _ret = _n;

 ERROR:


  if (_dataset>0)     if (_MEDdatasetFermer(_dataset) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATASET,MED_NOM_COO);
    ISCRUTE_id(_dataset);
  }

  if (_datagroup4>0)     if (_MEDdatagroupFermer(_datagroup4) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname4);
    ISCRUTE_id(_datagroup4);
  }

  if (_datagroup3>0)     if (_MEDdatagroupFermer(_datagroup3) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname3);
    ISCRUTE_id(_datagroup3);
  }

  if (_datagroup2>0)     if (_MEDdatagroupFermer(_datagroup2) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname2);
    ISCRUTE_id(_datagroup2);
  }

  if (_datagroup1>0)     if (_MEDdatagroupFermer(_datagroup1) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname1);
    ISCRUTE_id(_datagroup1);
  }

  if (_meshid>0)            if (_MEDdatagroupFermer(_meshid) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_meshpath);
    ISCRUTE_id(_meshid);
  }

/*   _MEDobjetsOuverts(fid); */

  *fret = _ret;
  va_end(params);
  return;
}
void
_MEDequivalenceCorrespondenceRd30(int dummy, ...) {

  med_idt            _root=0,_eqid=0,_meshid=0,_cstpid=0,_datagroup2=0;
  med_idt            _dataset=0;
  med_err            _ret=-1;
  char               _path[MED_TAILLE_EQS+2*MED_NAME_SIZE+2]=MED_EQS;
  char               _computationstepname[2*MED_MAX_PARA+1]="";
  char               _datagroupname2[2*MED_TAILLE_NOM_ENTITE+2]="";
  char               _geotypename   [MED_TAILLE_NOM_ENTITE+1]="";
  med_sorting_type   _sortingtype=0;
  med_filter         _filter        = MED_FILTER_INIT;
  med_geometry_type  _geotype=MED_NONE;
  med_int            _nentity=0;

  MED_VARGS_DECL(const, med_idt            , , fid            );
  MED_VARGS_DECL(const, char * , const       , meshname       );
  MED_VARGS_DECL(const, char * , const       , equivname      );
  MED_VARGS_DECL(const, med_int            , , numdt          );
  MED_VARGS_DECL(const, med_int            , , numit          );
  MED_VARGS_DECL(const, med_entity_type    , , entitype       );
  MED_VARGS_DECL(const, med_geometry_type  , , geotype        );
  MED_VARGS_DECL(, med_int *, const          , correspondence );
  MED_VARGS_DECL(, med_err *                ,, fret           );

  va_list params;
  va_start(params,dummy);

  MED_VARGS_DEF(const, med_idt            , , fid            );
  MED_VARGS_DEF(const, char * , const       , meshname       );
  MED_VARGS_DEF(const, char * , const       , equivname      );
  MED_VARGS_DEF(const, med_int            , , numdt          );
  MED_VARGS_DEF(const, med_int            , , numit          );
  MED_VARGS_DEF(const, med_entity_type    , , entitype       );
  MED_VARGS_DEF(const, med_geometry_type  , , geotype        );
  MED_VARGS_DEF(, med_int *, const          , correspondence );
  MED_VARGS_DEF(, med_err *                ,, fret           );
  if ( entitype == MED_NODE_ELEMENT ) _geotype=MED_NODE ;

  if ( (geotype / 100 ) > 2 )  {
    MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_GEOMETRIC,MED_ERR_EQUIVALENCE_MSG);
    SSCRUTE(equivname);ISCRUTE_int(geotype);
    goto ERROR;
  }

  if ( entitype != MED_NODE ) _geotype=geotype ;


  /*
   * On inhibe le gestionnaire d'erreur
   */
  _MEDmodeErreurVerrouiller();

 
  /*
   * Ouverture du dataGroup /EQS/
   */
  if ((_root = _MEDdatagroupOuvrir(fid,_path)) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);
    goto ERROR;
  }

  /*
   * Ouverture du dataGroup <meshname>
   */
  if ((_meshid = _MEDdatagroupOuvrir(_root,meshname)) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,meshname);
    SSCRUTE(_path);goto ERROR;
  }

  strcat(_path,meshname);

  /*
   * Si le Data Group "/EQS/<meshname>/<equivname>" n'existe pas, on le cree
   */
  if ((_eqid = _MEDdatagroupOuvrir(_meshid,equivname)) < 0) {
      MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,equivname);
      SSCRUTE(_path);goto ERROR;
  }

  strcat(_path,"/");
  strcat(_path,equivname);

  if ( MEDmeshSortingTypeRd(fid,meshname,&_sortingtype) < 0 ) {
    MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API," MEDmeshSortingTypeRd");
    SSCRUTE(meshname);ISCRUTE_int(_sortingtype);goto ERROR;
  }

  _MEDgetComputationStepName(_sortingtype,numdt,numit,_computationstepname);

  if ((_cstpid = _MEDdatagroupOuvrir(_eqid,_computationstepname)) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_computationstepname);
    SSCRUTE(_path);goto ERROR;
  }


  /*
   *  Ouverture du datagroup de niveau <entitype>[.<geotype>]
   */
  if (_MEDgetEntityTypeName(_datagroupname2,entitype) < 0) {
    MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
    ISCRUTE_int(entitype);SSCRUTE(equivname);goto ERROR;
  }
  if ( entitype != MED_NODE ) {
    if ( _MEDgetInternalGeometryTypeName(_geotypename,geotype) < 0) {
      MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
      ISCRUTE_int(geotype);SSCRUTE(equivname);goto ERROR;
    }
      strcat(_datagroupname2,".");
      strcat(_datagroupname2,_geotypename);
  }

  if ( (_datagroup2 = _MEDdatagroupOuvrir(_cstpid,_datagroupname2)) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_datagroupname2);
    SSCRUTE(_path);SSCRUTE(equivname);goto ERROR;
  }


  if ((_dataset = _MEDdatasetOuvrir(_datagroup2,MED_NOM_COR)) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATASET,MED_NOM_COR);
    SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);SSCRUTE(_datagroupname2);
    goto ERROR;
  }

  if ( _MEDattrEntierLire(_dataset,MED_NOM_NBR,&_nentity) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_EQUIVALENCE_MSG);
    SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);SSCRUTE(_datagroupname2);
    SSCRUTE(MED_NOM_NBR);ISCRUTE(_nentity);goto ERROR;
  }

  if ( MEDfilterEntityCr(fid, _nentity, 1, 2, MED_ALL_CONSTITUENT,
			 MED_NO_INTERLACE,MED_UNDEF_PFLMODE,
			 MED_NO_PROFILE, MED_UNDEF_SIZE, NULL, &_filter) < 0 ) {
    MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,MED_ERR_INTERNAL_MSG);
    goto ERROR;
  }

  if ( _MEDdatasetRd(_datagroup2,MED_NOM_COR,MED_INTERNAL_INT,&_filter, (unsigned char *) correspondence) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_DATASET,MED_NOM_COR);
    SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
    goto ERROR;
  }

  if ( MEDfilterClose(&_filter) < 0 ) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,MED_ERR_EQUIVALENCE_MSG);
    SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
    goto ERROR;
  }

  _ret=0;
 ERROR:

  if (_dataset>0)     if (_MEDdatasetFermer(_dataset) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATASET,MED_NOM_COR);
    ISCRUTE_id(_dataset);
  }

  if (_datagroup2>0)            if (_MEDdatagroupFermer(_datagroup2) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname2);
    ISCRUTE_id(_datagroup2);SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
  }

  if (_cstpid>0)            if (_MEDdatagroupFermer(_cstpid) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_computationstepname);
    ISCRUTE_id(_cstpid);SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
  }

  if (_eqid>0)            if (_MEDdatagroupFermer(_eqid) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,equivname);
    ISCRUTE_id(_eqid);SSCRUTE(_path);
  }

  if (_meshid>0)            if (_MEDdatagroupFermer(_meshid) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,meshname);
    ISCRUTE_id(_eqid);
  }

  if (_root>0)            if (_MEDdatagroupFermer(_root) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_EQS);
    ISCRUTE_id(_eqid);
  }

  va_end(params);
  *fret = _ret;

  return;
}
med_err
MEDsubdomainCorrespondenceWr(const med_idt            fid,
			     const char * const       localmeshname,
			     const char * const       jointname,
			     const med_int            numdt,
			     const med_int            numit,
			     const med_entity_type    localentitype,
			     const med_geometry_type  localgeotype,
			     const med_entity_type    remoteentitype,
			     const med_geometry_type  remotegeotype,
			     const med_int            nentity,
			     const med_int * const    correspondence) {
  
  med_access_mode     _MED_ACCESS_MODE;
  med_idt            _root=0,_jntid=0,_meshid=0,_cstpid=0,_datagroup2=0;
  med_idt            _dataset=0;
  med_err            _ret=-1;
  char               _path[MED_TAILLE_JNT+2*MED_NAME_SIZE+2]=MED_JNT;
  char               _computationstepname[2*MED_MAX_PARA+1]="";
  char               _datagroupname2[4*MED_TAILLE_NOM_ENTITE+4]="";
  char               _localgeotypename   [MED_TAILLE_NOM_ENTITE+1]="";
  char               _remotegeotypename  [MED_TAILLE_NOM_ENTITE+1]="";
  med_sorting_type   _sortingtype=0;
  med_filter         _filter        = MED_FILTER_INIT;
  med_int            _localgeotype   = MED_NONE;
  med_int            _localentitype  = localentitype;
  med_int            _remotegeotype  = MED_NONE;
  med_int            _remoteentitype = remoteentitype;

  if ( localentitype == MED_NODE_ELEMENT ) _localgeotype=MED_NODE ;

 
  if ( localentitype  != MED_NODE ) _localgeotype  = localgeotype ;
  if ( remoteentitype != MED_NODE ) _remotegeotype = remotegeotype ;

  /*
   * On inhibe le gestionnaire d'erreur
   */
  _MEDmodeErreurVerrouiller();
 if (_MEDcheckVersion30(fid) < 0) goto ERROR;

  if ( (_MED_ACCESS_MODE = _MEDmodeAcces(fid) ) == MED_ACC_UNDEF ) {
    MED_ERR_(_ret,MED_ERR_UNRECOGNIZED,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
    goto ERROR;
  }

  if ( _MED_ACCESS_MODE == MED_ACC_RDONLY) {
    MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
    ISCRUTE_int(_MED_ACCESS_MODE);
    goto ERROR;
  }

  /*
   * Ouverture du dataGroup /JNT/
   */
  if ((_root = _MEDdatagroupOuvrir(fid,_path)) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);
    goto ERROR;
  }

  /*
   * Ouverture du dataGroup <meshname>
   */
  if ((_meshid = _MEDdatagroupOuvrir(_root,localmeshname)) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,localmeshname);
    SSCRUTE(_path);goto ERROR;
  }

  strcat(_path,localmeshname);

  /*
   * Ouverture du data Group "/JNT/<localmeshname>/<jointname>"
   */
  if ((_jntid = _MEDdatagroupOuvrir(_meshid,jointname)) < 0) {
      MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,jointname);
      SSCRUTE(_path);goto ERROR;
  }

  strcat(_path,"/");
  strcat(_path,jointname);

  if ( MEDmeshSortingTypeRd(fid,localmeshname,&_sortingtype) < 0 ) {
    MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API," MEDmeshSortingTypeRd");
    SSCRUTE(localmeshname);ISCRUTE_int(_sortingtype);goto ERROR;
  }

  _MEDgetComputationStepName(_sortingtype,numdt,numit,_computationstepname);

  if ((_cstpid = _MEDdatagroupOuvrir(_jntid,_computationstepname)) < 0)
    if ((_cstpid = _MEDdatagroupCreer(_jntid,_computationstepname)) < 0 ) {
      MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,_computationstepname);
      SSCRUTE(_path);goto ERROR;
    }

  /*Cree ou ouvre l'attribut MED_NOM_NDT pour �criture */
  if ( _MEDattributeIntWr(_cstpid,MED_NOM_NDT,&numdt) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_SUBDOMAINJOINT_MSG);
    SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
    goto ERROR;
  }


  /*Cree ou ouvre l'attribut MED_NOM_NOR pour �criture */
  if ( _MEDattributeIntWr(_cstpid,MED_NOM_NOR,&numit) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_SUBDOMAINJOINT_MSG);
    SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
    goto ERROR;
  }


  /*
   *  Creation/Ouverture du datagroup de niveau
   *   <localentitype>[.<localgeotype>].<remoteentitype>[.<remotegeotype>]
   */
  if (_MEDgetEntityTypeName(_datagroupname2,localentitype) < 0) {
    MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
    ISCRUTE_int(localentitype);SSCRUTE(jointname);goto ERROR;
  }
  if ( localentitype != MED_NODE ) {
    if ( _MEDgetInternalGeometryTypeName(_localgeotypename,localgeotype) < 0) {
      MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
      ISCRUTE_int(localgeotype);SSCRUTE(jointname);goto ERROR;
    }
      strcat(_datagroupname2,".");
      strcat(_datagroupname2,_localgeotypename);
  }

  strcat(_datagroupname2,".");

  if (_MEDgetEntityTypeName(&_datagroupname2[strlen(_datagroupname2)],remoteentitype) < 0) {
    MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
    ISCRUTE_int(remoteentitype);SSCRUTE(jointname);goto ERROR;
  }
  if ( remoteentitype != MED_NODE ) {
    if ( _MEDgetInternalGeometryTypeName(_remotegeotypename,remotegeotype) < 0) {
      MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
      ISCRUTE_int(remotegeotype);SSCRUTE(jointname);goto ERROR;
    }
      strcat(_datagroupname2,".");
      strcat(_datagroupname2,_remotegeotypename);
  }


  if ( (_datagroup2 = _MEDdatagroupOuvrir(_cstpid,_datagroupname2)) < 0)
    if ((_datagroup2 = _MEDdatagroupCreer(_cstpid,_datagroupname2)) < 0) {
      MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,_datagroupname2);
      SSCRUTE(_path);SSCRUTE(jointname);goto ERROR;
    }

  /*Cree ou ouvre l'attribut MED_NOM_ENT pour �criture */
  if (_MEDattributeIntWr(_datagroup2,MED_NOM_ENT,&_localentitype) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_NOM_ENT);
    ISCRUTE(_localentitype);goto ERROR;
  }

  /*Cree ou ouvre l'attribut MED_NOM_GEO pour �criture */
  if (_MEDattributeIntWr(_datagroup2,MED_NOM_GEO,&_localgeotype) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_NOM_GEO);
    ISCRUTE(_localgeotype);goto ERROR;
  }

  /*Cree ou ouvre l'attribut MED_NOM_END pour �criture */
  if (_MEDattributeIntWr(_datagroup2,MED_NOM_END,&_remoteentitype) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_NOM_END);
    ISCRUTE(_remoteentitype);goto ERROR;
  }

  /*Cree ou ouvre l'attribut MED_NOM_GED pour �criture */
  if (_MEDattributeIntWr(_datagroup2,MED_NOM_GED,&_remotegeotype) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_NOM_GED);
    ISCRUTE(_remotegeotype);goto ERROR;
  }


  if ( MEDfilterEntityCr(fid, nentity, 1, 2, MED_ALL_CONSTITUENT,
			 MED_NO_INTERLACE,MED_UNDEF_PFLMODE,
			 MED_NO_PROFILE, MED_UNDEF_SIZE, NULL, &_filter) < 0 ) {
    MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,MED_ERR_INTERNAL_MSG);
    goto ERROR;
  }

  if ( _MEDdatasetWr(_datagroup2,MED_NOM_COR,MED_INTERNAL_INT,&_filter, correspondence) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_DATASET,MED_NOM_COR);
    SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
    goto ERROR;
  }

  if ( MEDfilterClose(&_filter) < 0 ) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,MED_ERR_SUBDOMAINJOINT_MSG);
    SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
    goto ERROR;
  }

  if ((_dataset = _MEDdatasetOuvrir(_datagroup2,MED_NOM_COR)) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATASET,MED_NOM_COR);
    SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);SSCRUTE(_datagroupname2);
    goto ERROR;
  }

  if ( _MEDattributeIntWr(_dataset,MED_NOM_NBR,&nentity) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_SUBDOMAINJOINT_MSG);
    SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);SSCRUTE(_datagroupname2);
    SSCRUTE(MED_NOM_NBR);ISCRUTE(nentity);goto ERROR;
  }



  _ret=0;
 ERROR:

  if (_dataset>0)     if (_MEDdatasetFermer(_dataset) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATASET,MED_NOM_COR);
    ISCRUTE_id(_dataset);
  }

  if (_datagroup2>0)            if (_MEDdatagroupFermer(_datagroup2) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname2);
    ISCRUTE_id(_datagroup2);SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
  }

  if (_cstpid>0)            if (_MEDdatagroupFermer(_cstpid) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_computationstepname);
    ISCRUTE_id(_cstpid);SSCRUTE(_path);ISCRUTE(numdt);ISCRUTE(numit);
  }

  if (_jntid>0)            if (_MEDdatagroupFermer(_jntid) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,jointname);
    ISCRUTE_id(_jntid);SSCRUTE(_path);
  }

  if (_meshid>0)            if (_MEDdatagroupFermer(_meshid) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,localmeshname);
    ISCRUTE_id(_meshid);
  }

  if (_root>0)            if (_MEDdatagroupFermer(_root) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_JNT);
    ISCRUTE_id(_root);
  }

  return _ret;
}
Exemplo n.º 6
0
void
_MEDfieldnProfile30(int dummy, ...) {


  med_int  _ret=-1,_err=-1;
  med_idt  _gid=0,_datagroup1=0;
  char     _path[(MED_TAILLE_CHA+MED_NAME_SIZE+1)+(2*MED_MAX_PARA+1)+1]=MED_CHA;
  char     _datagroupname1[2*MED_TAILLE_NOM_ENTITE+2]="";
  char     _geotypename      [MED_TAILLE_NOM_ENTITE+1]="";
  char     _profilename  [MED_NAME_SIZE+1]="";
  med_int  _numdt=0, _numit=0;
  med_size _n=0;


  MED_VARGS_DECL(const, med_idt           , , fid                     );
  MED_VARGS_DECL(const, char * , const      , fieldname               );
  MED_VARGS_DECL(const, med_int           , , numdt                   );
  MED_VARGS_DECL(const, med_int           , , numit                   );
  MED_VARGS_DECL(const, med_entity_type   , , entitype                );
  MED_VARGS_DECL(const, med_geometry_type , , geotype                 );
  MED_VARGS_DECL(, char *, const      , defaultprofilename            );
  MED_VARGS_DECL(, char *, const      , defaultlocalizationname       );
  MED_VARGS_DECL(, med_int *         ,, fret                          );

  va_list params;
  va_start(params,dummy);

  MED_VARGS_DEF(const, med_idt           , , fid                     );
  MED_VARGS_DEF(const, char * , const      , fieldname               );
  MED_VARGS_DEF(const, med_int           , , numdt                   );
  MED_VARGS_DEF(const, med_int           , , numit                   );
  MED_VARGS_DEF(const, med_entity_type   , , entitype                );
  MED_VARGS_DEF(const, med_geometry_type , , geotype                 );
  MED_VARGS_DEF(, char *, const      , defaultprofilename            );
  MED_VARGS_DEF(, char *, const      , defaultlocalizationname       );
  MED_VARGS_DEF(, med_int *         ,, fret                          );

  /*
   * On inhibe le gestionnaire d'erreur HDF 5
   */
  _MEDmodeErreurVerrouiller();

  NOFINALBLANK(fieldname,ERROR);

  /*
   * On construit le chemin d'acc�s jusqu'aux groupes <type_ent>[.<type_geo>]
   */
  strcat(_path,fieldname);
  strcat(_path,"/");
  _MEDgetComputationStepName(MED_SORT_DTIT,numdt,numit,&_path[strlen(_path)]);
  strcat(_path,"/");

  if ((_gid = _MEDdatagroupOuvrir(fid,_path)) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE(_path); goto ERROR;
  }


  /*Lit l'attribut MED_NOM_NDT  */
  if ( _MEDattrEntierLire(_gid,MED_NOM_NDT, &_numdt) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE(_path);SSCRUTE(MED_NOM_NDT);
    ISCRUTE(_numdt);goto ERROR;
  }

  if ( _numdt != numdt) {
    MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);ISCRUTE(_numdt);ISCRUTE(numdt);goto ERROR;
  }

  /*Lit l'attribut MED_NOM_NOR */
  if ( _MEDattrEntierLire(_gid,MED_NOM_NOR, &_numit) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE(_path);SSCRUTE(MED_NOM_NOR);
    ISCRUTE(_numit); goto ERROR;
  }

  if ( _numit != numit) {
    MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);ISCRUTE(_numit);ISCRUTE(numit);goto ERROR;
  }

  /*
   * Si le Data Group  de niveau <type_ent>[.<type_geo>] n'existe pas retroune 0
   */

  if (_MEDgetEntityTypeName(_datagroupname1,entitype) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ENTITY,_datagroupname1);
    goto ERROR;
  }

  if (entitype != MED_NODE) {
    if ( entitype == MED_STRUCT_ELEMENT ) {
      if ( MEDstructElementName(fid,geotype,_geotypename) < 0 ) {
	MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDstructElementName");
	ISCRUTE_int(geotype);goto ERROR;
      }
    } else {
      if (_MEDgetInternalGeometryTypeName(_geotypename,geotype) < 0) {
	MED_ERR_(_ret,MED_ERR_READ,MED_ERR_GEOMETRIC,_geotypename);
	goto ERROR;
      }
    }
    strcat(_datagroupname1,".");
    strcat(_datagroupname1,_geotypename);
  }
/*   strcat(_path,_datagroupname1); */
/*   strcat(_path,"/"); */


  if ((_datagroup1 = _MEDdatagroupOuvrir(_gid,_datagroupname1)) < 0) {
    *defaultprofilename='\0';
    *defaultlocalizationname='\0';
    _ret = 0;
    goto ERROR;
  }

  if ((_err=_MEDnObjects(_datagroup1,".",&_n)) <0)
    if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
      MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,_datagroupname1);
      goto ERROR;
    }

  /* Lit le nom du profil associ� s'il en existe d�j� un */
  if ( _MEDattrStringLire(_datagroup1,MED_NOM_PFL,MED_NAME_SIZE,_profilename) < 0 ) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE(_path);SSCRUTE(MED_NOM_PFL);
    goto ERROR;
  }

  if ( strcmp(_profilename,MED_NO_PROFILE_INTERNAL) ) {
    strncpy(defaultprofilename,_profilename,MED_NAME_SIZE+1);
    defaultprofilename[MED_NAME_SIZE]='\0';
  } else {
    defaultprofilename[0]='\0';
  }

  /* Lit le nom de la localization associ� s'il en existe d�j� une */
  if ( _MEDattrStringLire(_datagroup1,MED_NOM_GAU,MED_NAME_SIZE,defaultlocalizationname) < 0 ) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE(_path);SSCRUTE(MED_NOM_GAU);
    goto ERROR;
  }

  _ret = (med_int) _n;

 ERROR:


  if (_datagroup1>0)            if (_MEDdatagroupFermer(_datagroup1) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
    SSCRUTE(_datagroupname1); ISCRUTE_id(_datagroup1);
  }

  if (_gid>0)            if (_MEDdatagroupFermer(_gid) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
    ISCRUTE_id(_gid);
  }

  va_end(params);
  *fret = _ret;
  return;
}