コード例 #1
0
ファイル: MEDfieldnComponent.c プロジェクト: vejmarie/libMED
med_int
MEDfieldnComponent(const med_idt fid, 
		   const int ind)
{
  med_err _ret       = -1;
  char    _fieldname[MED_NAME_SIZE+1]="";
  int     _num       = ind-1;
  char    _path        [MED_TAILLE_CHA+MED_NAME_SIZE+1]=MED_CHA;
  /*
   * On inhibe le gestionnaire d'erreur HDF
   */
  _MEDmodeErreurVerrouiller();


  /*
   * On recupere le nom du champ
   */
  if ( _MEDobjectGetName(fid, _path ,_num, _fieldname) < 0 ) {
    MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);ISCRUTE_int(_num);
    goto ERROR;
  }

  if ( (_ret=MEDfieldnComponentByName( fid, _fieldname )) < 0) {
    MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,MED_ERR_FIELD_MSG);
    SSCRUTE(_fieldname);SSCRUTE(_path);SSCRUTE("MEDfieldnComponentbyName");
    goto ERROR;
  }

 ERROR:
  return _ret;
}
コード例 #2
0
med_err
MEDstructElementInfo(const med_idt             fid,
		     const int                 mit,
		     char *              const modelname,
		     med_geometry_type * const mgeotype,
		     med_int*            const modeldim,
		     char*               const supportmeshname,
		     med_entity_type*    const sentitytype,
		     med_int*            const snnode,
		     med_int*            const sncell,
		     med_geometry_type*  const sgeotype,
		     med_int*            const nconstantattribute,
		     med_bool*           const anyprofile,
		     med_int*            const nvariableattribute
			   )
{

  med_err  _ret=-1;
  char     _path[MED_TAILLE_STRCT+MED_NAME_SIZE+1]=MED_STRCT;
  int      _num = mit -1;

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

  /*
   * On recupere le nom de l'élément de structure
   */
  if ( _MEDobjectGetName(fid, _path ,_num, modelname) < 0 ) {
    MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);ISCRUTE_int(mit);
    goto ERROR;
  }
  strcat(_path,modelname);

  if (
      MEDstructElementInfoByName(fid,
				 modelname,
				 mgeotype,
				 modeldim,
				 supportmeshname,
				 sentitytype,
				 snnode,
				 sncell,
				 sgeotype,
				 nconstantattribute,
				 anyprofile,
				 nvariableattribute
				 ) < 0 ) {
    MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,MED_ERR_STRUCT_MSG);
    SSCRUTE(modelname);SSCRUTE(_path);SSCRUTE("MEDstructElementInfoByName");
    goto ERROR;
  }

  _ret = 0;

 ERROR:

  return _ret;
}
コード例 #3
0
med_int
MEDfieldnValueWithProfileByName(const med_idt fid,
				const char * const fieldname,
				const med_int numdt,
				const med_int numit,
				const med_entity_type entitype, 
				const med_geometry_type geotype,
				const char * const profilename,
				const med_storage_mode storagemode,
				med_int * const profilesize,
				char * const localizationname, 
				med_int * const nintegrationpoint)
{
  med_int  _ret=-1;

  if ( (_ret = _MEDfieldnValue(fid,  fieldname, numdt, numit,
			      entitype,  geotype,
			      (char * const) profilename,-1,
			      storagemode, profilesize,
			      localizationname, nintegrationpoint)) < 0) {
    MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE("_MEDfieldnValue");
    goto ERROR;
  }

 ERROR:

  return _ret;
}
コード例 #4
0
ファイル: test30.c プロジェクト: vejmarie/libMED
int afficheCorres(med_idt fid, char *maa, char *jnt,
		 med_entite_maillage typ_ent_local,   med_geometrie_element typ_geo_local,
		 med_entite_maillage typ_ent_distant, med_geometrie_element typ_geo_distant,
		 char *type)
{
  med_int nc;
  med_int *cortab;
  int k,ncor,ret=0;

  if ((nc = MEDjointnCorres(fid,maa,jnt,typ_ent_local,typ_geo_local,typ_ent_distant,typ_geo_distant)) < 0) {
    MESSAGE("Erreur a la lecture des infos sur le nombre d'entite en regard de type");
    SSCRUTE(type);
    return -1;
  }
	
  printf("nb de couples d'entites en regard %s: "IFORMAT" \n",type,nc);
  
  if (nc > 0) {
    cortab = (med_int*) malloc(sizeof(med_int)*nc*2);
    if ((ret=MEDjointLire(fid,maa,jnt,cortab,nc*2,
			  typ_ent_local,typ_geo_local,typ_ent_distant,typ_geo_distant)) < 0) {
      MESSAGE("Erreur a la lecture des correspondances sur ");
      SSCRUTE(type);
      ret = -1;
    }
    if (ret == 0)
      for (k=0;k<nc;k++)
	printf("Correspondance %d : "IFORMAT" et "IFORMAT" \n",k+1,*(cortab+2*k),
	       *(cortab+2*k+1));
    free(cortab);
  }
  return ret;
}
コード例 #5
0
med_err
MEDparameterComputationStepInfo(const med_idt      fid,
				const char * const paramname,
				const int          csit,
				med_int * const    numdt,
				med_int * const    numit,
				med_float * const  dt )
{
  med_err _ret = -1, _err = -1;
  med_idt _cpstidt = 0;
  char    _path[(MED_TAILLE_NUM_DATA+MED_NAME_SIZE+1)+2*MED_MAX_PARA+1]=MED_NUM_DATA;
  int     _num=csit-1;
  char    _cstpname[2*MED_MAX_PARA+1]="";

  _MEDmodeErreurVerrouiller();
  
  /* On recupere le nom du pas de temps */
  strcat(_path, paramname);
  if ( _MEDobjectGetName(fid, _path ,_num, _cstpname) < 0 ) {
    MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);ISCRUTE_int(_num);
    goto ERROR;
  }

  /* on ouvre le groupe HDF correspondant */
  strcat(_path,"/");
  strcat(_path,_cstpname);
  if ((_cpstidt = _MEDdatagroupOuvrir(fid,_path)) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);
    goto ERROR;
  }

  /* Lecture des attributs */
  if (_MEDattrEntierLire(_cpstidt, MED_NOM_NDT, (med_int*) numdt) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_NDT);
    SSCRUTE(_path);ISCRUTE(*numdt);goto ERROR;
  }
  if (_MEDattrFloatLire(_cpstidt, MED_NOM_PDT, (med_float*) dt) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_PDT);
    SSCRUTE(_path);RSCRUTE(*dt);goto ERROR;
  }
  if (_MEDattrEntierLire(_cpstidt, MED_NOM_NOR, (med_int*) numit) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_NOR);
    SSCRUTE(_path);ISCRUTE(*numit);goto ERROR;
  }

  _ret = 0;
 ERROR:

  /* on ferme tout */
  if (_cpstidt > 0)            
    if (_MEDdatagroupFermer(_cpstidt) < 0) {
      MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
      ISCRUTE_id(_cpstidt);
    }

  return _ret;
}
コード例 #6
0
ファイル: MEDinterpInfo.c プロジェクト: vejmarie/libMED
/**\ingroup MEDinterp
  \brief \MEDinterpInfoBrief
  \param fid           \fid
  \param interpit      \interpit
  \param interpname    \interpname
  \param geotype       \geotype
  \param cellnode      \cellnode
  \param nbasisfunc \nbasisfunc
  \param nvariable  \nvariable
  \param maxdegree     \maxdegree
  \param nmaxcoef      \nmaxcoef

  \return \error
  \details \MEDinterpInfoDetails
  \see     MEDinterpInfoByName

 */
med_err
MEDinterpInfo(const med_idt                 fid,
	      const int                      interpit,
	            char*              const interpname,
	            med_geometry_type* const geotype,
	            med_bool*          const cellnode,
	            med_int*           const nbasisfunc,
	            med_int*           const nvariable,
	            med_int*           const maxdegree,
	            med_int*           const nmaxcoef
	      )
{
  med_err  _ret=-1;
  char     _interppath[MED_TAILLE_INTERP+MED_NAME_SIZE+1]=MED_INTERP;
  int      _num = interpit -1;

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

  /*
   * On recupere le nom de l'interpolation
   */
  if ( _MEDobjectGetName(fid, _interppath ,_num, interpname) < 0 ) {
    MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_interppath);ISCRUTE_int(interpit);
    goto ERROR;
  }
  strcat(_interppath,interpname);

  if (  MEDinterpInfoByName(fid,
			    interpname,
			    geotype,
			    cellnode,
			    nbasisfunc,
			    nvariable,
			    maxdegree,
			    nmaxcoef
			    )    < 0 ) {
    MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,MED_ERR_INTERP_MSG);
    SSCRUTE(interpname);SSCRUTE(_interppath);SSCRUTE("MEDinterpInfoByName");
    goto ERROR;
  }

  _ret = 0;

 ERROR:

  return _ret;
}
コード例 #7
0
int main (int argc, char **argv)

{
  med_err           _ret=0;
  med_idt           _fid=0;

  char    _fieldname1[MED_NAME_SIZE+1]  = "champ reel";
  char    _interpname[MED_NAME_SIZE+1]  = "";
  med_int _ninterp  = 0;
  int     _interpit=0;


  /* Ouverture en mode creation du fichier "current.med" */
  _fid = MEDfileOpen("current.med",MED_ACC_RDONLY);
  if (_fid < 0) {
    MESSAGE("Erreur a la creation du fichier current.med");
    return -1;
  }

  if ( (_ninterp =  MEDfieldnInterp(_fid,
				    _fieldname1
				    )  ) < 0 ) {
    MESSAGE("Erreur à la lecture du nombre de fonctions d'interpolation  sur le champ : ");
    SSCRUTE(_fieldname1);_ret=_ninterp; goto ERROR;
  }

  for (_interpit=0;_interpit < _ninterp; ++_interpit ) {
    if ( (_ret =	MEDfieldInterpInfo(_fid,
					   _fieldname1,
					   _interpit+1,
					   _interpname ) <0) ) {
    MESSAGE("Erreur à la lecture des informations de la fonction d'interpolation n° :");
    ISCRUTE(_interpit);SSCRUTE("sur le champ : ");SSCRUTE(_fieldname1);
    goto ERROR;
    }
    else
      fprintf(stdout,"Le nom de la fonction d'interpolation n°%d du champ %s est %s\n",
	      _interpit+1,_fieldname1,_interpname);

  }

 ERROR:
  if (MEDfileClose(_fid) < 0) {
    MESSAGE("ERROR : file closing");
    return -1;
  }

  return _ret;

}
コード例 #8
0
ファイル: _MEDnFamily236.c プロジェクト: mndjinga/CDMATH
void _MEDnFamily236(int dummy, ...)
{


  med_int       _ret=-1;
  med_int       _n=0;
  
  MED_VARGS_DECL(const, med_idt      , , fid      );
  MED_VARGS_DECL(const, char * , const , meshname );
  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(, med_int *          ,, fret     );


  if ( ( _n = MEDnFam(fid,(char *) meshname) ) < 0) {
    MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDnFam");
    SSCRUTE(meshname);
    goto ERROR;
  }

  _ret =  _n;
 ERROR:
  va_end(params);
  *fret = _ret;

  return;
}
コード例 #9
0
ファイル: MEDfileCommentWr.c プロジェクト: vejmarie/libMED
med_err
MEDfileCommentWr(const med_idt fid,
		 const char* const comment)
{
  med_idt _rootId=0;
  med_err _ret=-1;

  _MEDmodeErreurVerrouiller();
 if (_MEDcheckVersion30(fid) < 0) goto ERROR;

  /* the root data group is open */
  if ((_rootId = _MEDdatagroupOuvrir(fid,"/")) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP," : '/'");
    goto ERROR;
  }

  /* The comment is stored in a HDF attribute */
  if (_MEDattributeStringWr(_rootId,MED_COMMENT_NAME,MED_COMMENT_SIZE,(char*)comment) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_COMMENT_NAME);
    SSCRUTE(comment);
    goto ERROR;
  }

  _ret = 0;
 ERROR:

  /* the "/" group has to be closed */
  if (_rootId > 0)
    if (_MEDdatagroupFermer(_rootId) < 0) {
      MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP," : '/'");
    }
  return _ret;
}
コード例 #10
0
med_err _MEDdatagroupExist(const med_idt        gid,
			   const char * const   datagroupname,
			   med_bool *   const   datagroupexist,
			   med_bool *   const   isasoftlink )
/*Pour l'instant, dans le modèle interne les liens sont uniquement des liens vers
  des datasets*/

{
  med_err        _ret=-1;
  H5L_info_t     _linkinfo;
  H5O_info_t     _oinfo;

  if ( H5Lget_info( gid, datagroupname,  &_linkinfo, H5P_DEFAULT ) >= 0 ) {

    switch ( _linkinfo.type ) {

    case H5L_TYPE_SOFT:
      *isasoftlink=MED_TRUE;
      _oinfo.type=H5G_LINK;
      break;

    case H5L_TYPE_HARD:
      *isasoftlink  = MED_FALSE;
      if ( H5Oget_info_by_name( gid, datagroupname, &_oinfo, H5P_DEFAULT ) <0) {
	MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"H5Oget_info_by_name");
	SSCRUTE( datagroupname);
      }
      break;

    case H5L_TYPE_EXTERNAL:
    case H5L_TYPE_ERROR:
    default:
      MED_ERR_(_ret,MED_ERR_UNRECOGNIZED,MED_ERR_HDFTYPE, datagroupname);
      ISCRUTE( _linkinfo.type);
      goto ERROR;
      break;
    }

    /*TODO : A vérifier sur un lien de datagroup, à mon avis ne fonctionne pas */
    switch ( _oinfo.type ) {
    case H5G_GROUP:
    case H5G_LINK:
      *datagroupexist = MED_TRUE;
      break;
    default:
      *datagroupexist = MED_FALSE;
    }

  } else {
      *datagroupexist = MED_FALSE;
      *isasoftlink    = MED_FALSE;
  }

  _ret = 0;
 ERROR:

  return _ret;
}
コード例 #11
0
void
_MEDequivalenceCorrespondenceRd236(int dummy, ...) {

  med_err _ret=-1;

  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 ( MEDequivLire(fid, (char *) meshname, (char *) equivname, correspondence, -1 ,
		    entitype, geotype) < 0 ) {
    MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDequivLire");
    SSCRUTE(meshname); SSCRUTE(equivname); 
    ISCRUTE_int(entitype);ISCRUTE_int(geotype);goto ERROR;

  }

  _ret=0;
 ERROR:

  va_end(params);
  *fret = _ret;

  return;
}
コード例 #12
0
int main (int argc, char **argv)

{
  int      _i=0;
  med_err  _ret=-1;
  med_idt  _fid=0;
  med_int  _ngeotype=0;

  const char         _meshname[MED_NAME_SIZE+1]="maa1";
  med_bool           _chgt=MED_FALSE,_trsf=MED_FALSE;
  /*TODO : Traduire   MED_TAILLE_NOM_ENTITE */
  char               _geotypename[MED_NAME_SIZE+1]="";
  med_geometry_type  _geotype=MED_NO_GEOTYPE;
 /* Ouverture en mode creation du fichier med */
  _fid = MEDfileOpen("Test_MEDmeshStructElementVarAttWr.med",MED_ACC_RDONLY);
  if (_fid < 0) {
    MESSAGE("Erreur a la creation du fichier current.med");
    return -1;
  }

  /* TODO : Créer un itérateur sur les types d'entités*/
  if ( (_ngeotype = MEDmeshnEntity(_fid,_meshname,MED_NO_DT,MED_NO_IT,
				   MED_STRUCT_ELEMENT,MED_GEO_ALL,MED_CONNECTIVITY,MED_GLOBAL_STMODE,
				   &_chgt,&_trsf) ) < 0 ) {
    MESSAGE ("Erreur à la lecture du nombre de type géométrique pour le type d'entités MED_STRUCT_ELEMENT");
    goto ERROR;
  }

  ISCRUTE(_ngeotype);
  for (_i=0; _i < _ngeotype; _i++) {

    if ( MEDmeshEntityInfo(_fid,
			   _meshname,
			   MED_NO_DT,MED_NO_IT,
			   MED_STRUCT_ELEMENT,
			   _i+1,
			   _geotypename,&_geotype
			   ) <0 ){
      MESSAGE ("Erreur à la demande d'informations pour le type d'entités MED_STRUCT_ELEMENT");
      ISCRUTE_int(_i);
      goto ERROR;
    }
    SSCRUTE(_geotypename);
    ISCRUTE(_geotype);
  }

  _ret = 0;
 ERROR:
  if (MEDfileClose(_fid) < 0) {
    MESSAGE("ERROR : file closing");
    return -1;
  }

  return _ret;

}
コード例 #13
0
ファイル: MEDfileObjectExist.c プロジェクト: mndjinga/CDMATH
/**\ingroup MEDfile
  \brief \MEDfileObjectExistBrief
  \param fid \fid
  \param medclass \medclass
  \param objectname \objectname
  \param objectexist \objectexist
  \retval med_err  \error
  \details \MEDfileObjectExistDetails
  \par Remarques
*/
med_err
MEDfileObjectExist(const med_idt           fid,
		   const med_class         medclass,
		   const char      * const objectname,
		         med_bool  * const objectexist )
{
  med_idt _fid = 0;
  med_err _ret = -1;
  char    _link[2*MED_NAME_SIZE+1]="";
  med_bool _datagroupexist=MED_FALSE,_isasoftlink=MED_FALSE;
  int _objsize = 0;

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

  *objectexist = MED_FALSE;
  /*
   * Give access to the class object in the local file
   */
  switch(medclass) {

    MY_CASE(MESH);
    MY_CASE(MESH_SUPPORT);
    MY_CASE(ELSTRUCT);
    MY_CASE(FAMILY);
    MY_CASE(EQUIVALENCE);
    MY_CASE(JOINT);
    MY_CASE(FIELD);
    MY_CASE(LOCALIZATION);
    MY_CASE(PROFILE);
    MY_CASE(INTERPOLATION);
    MY_CASE(NUMERICAL_DATA);

  default :
    MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_CLASS,_link);
   goto ERROR;
  }

  strncpy(_link+_objsize,objectname,MED_NAME_SIZE+1);
  _link[2*MED_NAME_SIZE]='\0';
	 
  if( _MEDdatagroupExist(fid,_link,&_datagroupexist,&_isasoftlink) < 0 ) {
    MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDdatagroupExist");
    SSCRUTE(_link);goto ERROR;
  }

  if ( _datagroupexist ) *objectexist = MED_TRUE;

  _ret=0;
 ERROR:

  return _ret;
}
コード例 #14
0
ファイル: MEDgaussInfo.c プロジェクト: mndjinga/CDMATH
med_err
MEDgaussInfo(med_idt fid, int indice, char * locname, med_geometrie_element * type_geo,
	     med_int * ngauss )
{
  int numero=0;
  med_idt locid=0;
  med_err ret=-1;
  char chemin[MED_TAILLE_GAUSS+MED_TAILLE_NOM+1]="";
  med_int typegeo;

  /*
   * On inhibe le gestionnaire d'erreur
   */
  _MEDmodeErreurVerrouiller();
if (MEDcheckVersion(fid) < 0) return -1;


  /*
   * On recupere le nom du groupe de rang "indice"
   */ 
  numero = indice-1;
  if ( _MEDobjetIdentifier(fid,MED_GAUSS,numero,locname) < 0)
    goto ERROR;

  /*
   * On va chercher l'attribut ngauss 
   */
  strcpy(chemin,MED_GAUSS);
  strcat(chemin,locname);
  if ((locid = _MEDdatagroupOuvrir(fid,chemin)) < 0) {
    MESSAGE("Impossible d'ouvrir le datagroup : ");
    SSCRUTE(chemin); goto ERROR;
  }

  /* Lecture de  <ngauss> */
  if (_MEDattrEntierLire(locid,MED_NOM_NBR,ngauss) < 0) {
    MESSAGE("Erreur à la lecture de l'attribut MED_NOM_NBR : ");
    ISCRUTE(*ngauss);goto ERROR;
  };
  
  /* Lecture <type_geo> sous forme d'attribut */
  if (_MEDattrEntierLire(locid,MED_NOM_GEO,&typegeo) < 0) {
    MESSAGE("Erreur à la lecture de l'attribut MED_NOM_GEO : ");
    ISCRUTE(*type_geo);goto ERROR;
  };
  *type_geo = ( med_geometrie_element ) typegeo;

  ret = 0;

 ERROR:
  if ( locid > 0 ) if (_MEDdatagroupFermer(locid) < 0)
    goto ERROR;
  
  return 0;
}
コード例 #15
0
med_err
MEDsupportMeshInfoByName(const med_idt         fid,
			 const char *    const supportmeshname,
			 med_int *       const spacedim,
			 med_int *       const meshdim,
			 char *          const description,
			 med_axis_type * const axistype,
			 char *          const axisname,
			 char *          const axisunit)
{
  med_err          _ret=-1;
  char             _dtunit[MED_SNAME_SIZE+1]="";
  med_sorting_type _sortingtype=MED_SORT_UNDEF;
  med_mesh_type    _meshtype = MED_UNDEF_MESH_TYPE;
  med_int          _nstep=0;

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


  if ( _MEDmeshInfoByName(fid, MED_MESH_SUPPORT_GRP, supportmeshname, spacedim, meshdim, &_meshtype,
			  description, _dtunit, &_sortingtype, &_nstep,
			  axistype,  axisname, axisunit)  < 0) {
    MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,MED_ERR_MESH_MSG);
    SSCRUTE(supportmeshname);SSCRUTE("MEDmeshInfoByName");
    goto ERROR;
  }

  _ret = 0;

 ERROR:

  return _ret;
}
コード例 #16
0
ファイル: MEDlocalizationInfo.c プロジェクト: vejmarie/libMED
med_err
MEDlocalizationInfo(const med_idt             fid,
		    const int                 localizationit,
		    char              * const localizationname,
		    med_geometry_type * const geotype,
		    med_int           * const spacedimension,
		    med_int           * const nipoint,
		    char *              const geointerpname,
		    char *              const sectionmeshname,
		    med_int           * const nsectionmeshcell,
		    med_geometry_type * const sectiongeotype)
{
  med_err _ret=-1;
  char    _path[MED_TAILLE_GAUSS+MED_NAME_SIZE+1]=MED_GAUSS;
  int     _num=localizationit-1;

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

  /*
   * ouverture du groupe /GAUSS/"nom"
   */
  if ( _MEDobjectGetName(fid, _path ,_num, localizationname) < 0 ) {
    MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);
    ISCRUTE_int(localizationit);
    goto ERROR;
  }

  if ( MEDlocalizationInfoByName(fid, localizationname, geotype, spacedimension,
				 nipoint,geointerpname, 
				 sectionmeshname, nsectionmeshcell,sectiongeotype ) < 0) {
    MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDlocalizationInfoByName");
    SSCRUTE(localizationname);
    goto ERROR;
  }

  _ret = 0;
 ERROR:

  return _ret;
}
コード例 #17
0
med_err _MEDattributeStringRdByName(med_idt pid,
				    const char * const path,
				    const char * const attname,
				    const med_size attsize,
				    char * const val)
{
  med_err _ret=-1;
  med_idt _attid=0;
  int     type_hdf=0;

  if ( (type_hdf = H5Tcopy(H5T_C_S1)) < 0) {
    MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_HDFTYPE, MED_ERR_NAME_MSG );
    SSCRUTE("H5T_C_S1"); goto ERROR;
  }

  if ( H5Tset_size(type_hdf,attsize+1) < 0) {
    MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_HDFTYPE, MED_ERR_NAME_MSG );
    SSCRUTE("H5T_C_S1"); goto ERROR;
  }

  if ( (_attid=H5Aopen_by_name( pid, path, attname, H5P_DEFAULT, H5P_DEFAULT )) < 0 ) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_ATTRIBUTE, MED_ERR_NAME_MSG );
    SSCRUTE(attname); SSCRUTE(path);goto ERROR;
  }

  if ( H5Aread(_attid,type_hdf,val) < 0 ) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE, MED_ERR_NAME_MSG );
    SSCRUTE(attname); SSCRUTE(path);goto ERROR;
  }

  _ret=0;

 ERROR:

  if (type_hdf >0) if ( H5Tclose(type_hdf) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_HDFTYPE, MED_ERR_ID_MSG );
    ISCRUTE_int(type_hdf);
  }

  if (_attid >0) if ( H5Aclose(_attid) < 0) {
    MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_ATTRIBUTE, MED_ERR_ID_MSG );
    ISCRUTE_id(_attid);
  }

  return _ret;
}
コード例 #18
0
ファイル: MEDnValProfil.c プロジェクト: PROJECT-CDMATH/CDMATH
med_int 
MEDnValProfil(med_idt fid, char *nom)
{
  med_int n = 0;
  med_idt gid;
  char chemin[MED_TAILLE_PROFILS+MED_TAILLE_NOM+1]; 
  med_err ret;
  
  /*
   * On inhibe le gestionnaire d'erreur HDF 5
   */
  _MEDmodeErreurVerrouiller();
if (MEDcheckVersion(fid) < 0) return -1;


  /* 
   * ouverture du groupe /PROFILS/<nom>
   */  
  strcpy(chemin,MED_PROFILS);
  strcat(chemin,nom); 
  if ((gid = _MEDdatagroupOuvrir(fid,chemin)) < 0){
    MESSAGE("Impossible d'ouvrir le groupe MED_PROFILS : ");
    SSCRUTE(chemin); return -1;
  }
  
  if ((ret = _MEDattrEntierLire(gid,MED_NOM_NBR,&n)) < 0) {
    MESSAGE("Erreur à la lecture de l'attribut MED_NOM_NBR : ");
    ISCRUTE(n); return -1;
  }
  
  /*
   * On ferme tout
   */
  if ((ret = _MEDdatagroupFermer(gid)) < 0)
    return -1; 

  return n;
}
コード例 #19
0
ファイル: _MEDprofileRd236.c プロジェクト: vejmarie/libMED
void _MEDprofileRd236(int dummy, ...) {


  med_idt        _pfid=0;
  med_err        _ret=-1;
  char           _path[MED_TAILLE_PROFILS+MED_NAME_SIZE+1]=MED_PROFILS;
  med_filter     _filter        = MED_FILTER_INIT;
  med_int        _nentity=0;
  
  MED_VARGS_DECL(const, med_idt         , , fid          );
  MED_VARGS_DECL(const, char    * , const , profilename  );
  MED_VARGS_DECL(, med_int *, const , profilearray       );
  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 , profilename  );
  MED_VARGS_DEF(, med_int *, const , profilearray       );
  MED_VARGS_DEF(, med_err *       ,, fret               );


  if ( MEDprofilLire( fid,profilearray, (char *) profilename) < 0 ) {
    MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDprofilLire");
    SSCRUTE(profilename);
    goto ERROR;
  }

  _ret = 0;
 ERROR:

  va_end(params);
  *fret = _ret;

  return;
}
コード例 #20
0
ファイル: MEDouvrir.c プロジェクト: vejmarie/libMED
med_idt
MEDouvrir(char *nom, med_mode_acces mode_acces)
{
  med_idt fid=0; 

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

  /*
   * On ouvre le fichier MED sous HDF
   */
  switch(mode_acces)
    {
    case MED_LECTURE :
      if (access(nom,F_OK)) {

	MESSAGE("Impossible d'accéder aux fichier :");
	SSCRUTE(nom);
	return -1;
	
      } else { 
	if ((fid = _MEDfichierOuvrir(nom,mode_acces)) < 0)  return -1;
	/*_MEDsetModeAcces(fid,MED_LECTURE);*/
      };
      break;

    case MED_LECTURE_ECRITURE : 
      if (access(nom,F_OK)) {
	  if ((fid = _MEDfichierCreer(nom,mode_acces)) < 0)
	    return -1;
      } else 
	if ((fid = _MEDfichierOuvrir(nom,mode_acces)) < 0)
	  return -1;
      break;

    case MED_LECTURE_AJOUT    :
      if (access(nom,F_OK))
	{
	  if ((fid = _MEDfichierCreer(nom,mode_acces)) < 0)
	    return -1;
	}
      else 
	if ((fid = _MEDfichierOuvrir(nom,mode_acces)) < 0)
	  return -1;
      break;
      
    case MED_CREATION :
      if ((fid = _MEDfichierCreer(nom,MED_LECTURE_ECRITURE)) < 0)
	return -1;
      break;

    default :
      return -1;
    }

if (MEDcheckVersion(fid) < 0) {
	if (fid >0) _MEDfichierFermer(fid); 
        return -1;
}

  return fid;
}
コード例 #21
0
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;
}
コード例 #22
0
void
_MEDlocalizationInfoByName30(int dummy, ...) {


  med_idt           _lzid =  0;
  med_err           _ret  = -1;
  char              _path[MED_TAILLE_GAUSS+MED_NAME_SIZE+1]=MED_GAUSS;
  char              _sectiongeotypename[MED_TAILLE_NOM_ENTITE+1]="";
  med_int           _intgeotype      = -1,_nsectiongeotype=0, _nsectionmeshcell=0;
  med_entity_type   _sectionentitype = MED_CELL;
  med_geometry_type _sectiongeotype  = MED_UNDEF_GEOTYPE;
  med_data_type     _conorcoo        = MED_CONNECTIVITY;
  med_bool          _chgt=MED_FALSE,_trsf=MED_FALSE;


  MED_VARGS_DECL(const, med_idt                   , , fid                  );
  MED_VARGS_DECL(const, char        * , const       , localizationname     );
  MED_VARGS_DECL(, med_geometry_type *, const , geotype                    );
  MED_VARGS_DECL(, med_int           *, const , spacedimension             );
  MED_VARGS_DECL(, med_int           *, const , nipoint                 );
  MED_VARGS_DECL(, char        *, const       , geointerpname              );
  MED_VARGS_DECL(, char        *, const       , sectionmeshname            );
  MED_VARGS_DECL(, med_int     *, const       , nsectionmeshcell           );
  MED_VARGS_DECL(, med_geometry_type *, const , sectiongeotype             );
  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       , localizationname     );
  MED_VARGS_DEF(, med_geometry_type *, const , geotype                    );
  MED_VARGS_DEF(, med_int           *, const , spacedimension             );
  MED_VARGS_DEF(, med_int           *, const , nipoint                 );
  MED_VARGS_DEF(, char        *, const       , geointerpname              );
  MED_VARGS_DEF(, char        *, const       , sectionmeshname            );
  MED_VARGS_DEF(, med_int     *, const       , nsectionmeshcell           );
  MED_VARGS_DEF(, med_geometry_type *, const , sectiongeotype             );
  MED_VARGS_DEF(, med_err *                 ,, fret                       );

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

  /*
   * ouverture du groupe /GAUSS/"nom"
   */
  strcat(_path,localizationname);
  if ((_lzid = _MEDdatagroupOuvrir(fid,_path)) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_LOCALIZATION_MSG);
    SSCRUTE(_path);
    goto ERROR;
  }

  /*
   * Lecture de l'attribut MED_NOM_NBR
   */
  if (_MEDattrEntierLire(_lzid,MED_NOM_NBR,nipoint) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
    SSCRUTE(_path);SSCRUTE(MED_NOM_NBR);ISCRUTE(*nipoint);
    goto ERROR;
  }


  /*
   * On lit <typgeo> sous forme d'attribut
   */
  /* sizeof(enum) tjrs = sizeof(int) en C, or
     sur machines 64 bits par défaut med_int==long,
     du coup sur  machines 64 bits _MEDattributeIntWr utilise 
     le type hdf NATIVE_LONG, ce qui pose un problème qd on passe
     un enum.
  */
  if (_MEDattrEntierLire(_lzid,MED_NOM_GEO,&_intgeotype) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
    SSCRUTE(localizationname);SSCRUTE(MED_NOM_GEO);ISCRUTE(_intgeotype);
    goto ERROR;
  };
  *geotype = (med_geometry_type) _intgeotype;

  /*
   * On lit <spacedimension>
   */
  if (_MEDattrEntierLire(_lzid,MED_NOM_DIM,spacedimension) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
    SSCRUTE(localizationname);SSCRUTE(MED_NOM_DIM);ISCRUTE(*spacedimension);
    goto ERROR;
  };

  /*
   * Lecture de l'attribut MED_NOM_NOM (nom du maillage de section)
   */
  if ( _MEDattrStringLire(_lzid,MED_NOM_NOM,MED_NAME_SIZE,sectionmeshname) < 0) {
    sectionmeshname[0]='\0';
  }

  if ( strlen(sectionmeshname) &&
       ( _intgeotype > MED_STRUCT_GEO_INTERNAL) &&
       ( _intgeotype < MED_STRUCT_GEO_SUP_INTERNAL) ) {

    if ( _MEDgetSupportMeshNbOfEntities(fid,sectionmeshname,&_sectionentitype,
					&_sectiongeotype,NULL,&_nsectionmeshcell) < 0) {
      MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDgetSupportMeshNbOfEntities");
      SSCRUTE(sectionmeshname);ISCRUTE_int(_sectionentitype);
      ISCRUTE(_sectiongeotype);ISCRUTE(_nsectionmeshcell);goto ERROR;
    }
  }
  *sectiongeotype= _sectiongeotype;
  *nsectionmeshcell= _nsectionmeshcell;


  if ( _MEDattrStringLire(_lzid,MED_NOM_INM,MED_NAME_SIZE,geointerpname) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
    SSCRUTE(localizationname);SSCRUTE(MED_NOM_INM);SSCRUTE(geointerpname);
    goto ERROR;
  }

  _ret = 0;
 ERROR:

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

  va_end(params);
  *fret = _ret;
  return;
  }
コード例 #23
0
void
_MEDlocalizationInfoByName236(int dummy, ...) {


  med_idt _lzid=0;
  med_err _ret=-1;
  char    _path[MED_TAILLE_GAUSS+MED_NAME_SIZE+1]=MED_GAUSS;
  med_int _intgeotype = -1;


  MED_VARGS_DECL(const, med_idt                   , , fid                 );
  MED_VARGS_DECL(const, char        * , const       , localizationname    );
  MED_VARGS_DECL(, med_geometry_type *, const , geotype                   );
  MED_VARGS_DECL(, med_int           *, const , spacedimension            );
  MED_VARGS_DECL(, med_int           *, const , nipoint                );
  MED_VARGS_DECL(, char        *, const       , geointerpname             );
  MED_VARGS_DECL(, char        *, const       , sectionmeshname           );
  MED_VARGS_DECL(, med_int     *, const       , nsectionmeshcell          );
  MED_VARGS_DECL(, med_geometry_type *, const , sectiongeotype            );
  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       , localizationname    );
  MED_VARGS_DEF(, med_geometry_type *, const , geotype                   );
  MED_VARGS_DEF(, med_int           *, const , spacedimension            );
  MED_VARGS_DEF(, med_int           *, const , nipoint                );
  MED_VARGS_DEF(, char        *, const       , geointerpname             );
  MED_VARGS_DEF(, char        *, const       , sectionmeshname           );
  MED_VARGS_DEF(, med_int     *, const       , nsectionmeshcell          );
  MED_VARGS_DEF(, med_geometry_type *, const , sectiongeotype            );
  MED_VARGS_DEF(, med_err *                 ,, fret                      );

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


  /*
   * ouverture du groupe /GAUSS/"nom"
   */
  strcat(_path,localizationname);
  if ((_lzid = _MEDdatagroupOuvrir(fid,_path)) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_LOCALIZATION_MSG);
    SSCRUTE(_path);
    goto ERROR;
  }

  /*
   * Lecture de l'attribut MED_NOM_NBR
   */
  if (_MEDattrEntierLire(_lzid,MED_NOM_NBR,nipoint) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
    SSCRUTE(_path);SSCRUTE(MED_NOM_NBR);ISCRUTE(*nipoint);
    goto ERROR;
  }


  /*
   * On lit <typgeo> sous forme d'attribut
   */
  /* sizeof(enum) tjrs = sizeof(int) en C, or
     sur machines 64 bits par défaut med_int==long,
     du coup sur  machines 64 bits _MEDattributeIntWr utilise
     le type hdf NATIVE_LONG, ce qui pose un problème qd on passe
     un enum.
  */
  if (_MEDattrEntierLire(_lzid,MED_NOM_GEO,&_intgeotype) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
    SSCRUTE(localizationname);SSCRUTE(MED_NOM_GEO);ISCRUTE(_intgeotype);
    goto ERROR;
  };
  *geotype = (med_geometry_type) _intgeotype;

  *spacedimension = (_intgeotype/100);

  sectionmeshname[0]='\0';
  geointerpname[0]='\0';
  *nsectionmeshcell=0;
  *sectiongeotype=MED_UNDEF_GEOTYPE;

  _ret = 0;
 ERROR:

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

  va_end(params);
  *fret = _ret;
  return;
  }
コード例 #24
0
void
_MEDfieldInfoByName30(int dummy, ...) {


  med_err  _ret=-1,_err=-1;
  med_idt  _fieldgid=0,_meshgid=0,_linkgid=0;
  char     _fieldpath[MED_TAILLE_CHA+MED_NAME_SIZE+1]=MED_CHA;
  char     _meshpath [MED_TAILLE_MAA+MED_NAME_SIZE+1]=MED_MAA;
  char     _linkpath [MED_TAILLE_LIENS+MED_NAME_SIZE+1]=MED_LIENS;
  med_size _ncstp=0;
  med_int  _n=0;
  med_int  _intfieldtype=0;


  MED_VARGS_DECL(const, med_idt           , , fid           );
  MED_VARGS_DECL(const, char * , const     , fieldname     );
  MED_VARGS_DECL(, char *, const           , meshname      );
  MED_VARGS_DECL(, med_bool *, const       , localmesh     );
  MED_VARGS_DECL(, med_field_type *, const , fieldtype     );
  MED_VARGS_DECL(, char *, const           , componentname );
  MED_VARGS_DECL(, char *, const           , componentunit );
  MED_VARGS_DECL(, char *, const           , dtunit        );
  MED_VARGS_DECL(, med_int *, const        , ncstp      );
  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     , fieldname     );
  MED_VARGS_DEF(, char *, const           , meshname      );
  MED_VARGS_DEF(, med_bool *, const       , localmesh     );
  MED_VARGS_DEF(, med_field_type *, const , fieldtype     );
  MED_VARGS_DEF(, char *, const           , componentname );
  MED_VARGS_DEF(, char *, const           , componentunit );
  MED_VARGS_DEF(, char *, const           , dtunit        );
  MED_VARGS_DEF(, med_int *, const        , ncstp      );
  MED_VARGS_DEF(, med_err *              ,, fret          );

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

  strcat(_fieldpath,fieldname);

  /*
   * On recupere le nombre de composants
   */
  if ((_fieldgid = _MEDdatagroupOuvrir(fid,_fieldpath)) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_fieldpath);
    goto ERROR;
  }

  if ( _MEDattrEntierLire(_fieldgid,MED_NOM_NCO,&_n) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_NCO);
    SSCRUTE(_fieldpath);goto ERROR;
  }

  /*
   * La liste des attributs
   */

  /* Lecture de l'attribut MED_NOM_TYP */
  if ( _MEDattrEntierLire(_fieldgid,MED_NOM_TYP,&_intfieldtype) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE(MED_NOM_TYP);
    goto ERROR;
  }
  *fieldtype = (med_field_type) (_intfieldtype);


  /*
   * Les infos sur les composantes du champ
   */
  if (_MEDattrStringLire(_fieldgid,MED_NOM_NOM,_n*MED_SNAME_SIZE,
			 componentname) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE(_fieldpath);SSCRUTE(MED_NOM_NOM);
    SSCRUTE(componentname);goto ERROR;
  }

  if (_MEDattrStringLire(_fieldgid,MED_NOM_UNI,_n*MED_SNAME_SIZE,
			 componentunit) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE(_fieldpath);SSCRUTE(MED_NOM_UNI);
    SSCRUTE(componentunit);goto ERROR;
  }
  /*MODEL : MED_NOM_UNI vient du niveau en dessous
    Cree ou ouvre l'attribut  MED_NOM_UNI pour écriture
  */
  if ( _MEDattrStringLire(_fieldgid,MED_NOM_UNT,MED_SNAME_SIZE,dtunit) < 0) {
   MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE(_fieldpath);SSCRUTE(MED_NOM_UNT);
    SSCRUTE(dtunit);goto ERROR;
  }

  /* Lecture de l'attribut MED_NOM_MAI */
  if ( _MEDattrStringLire(_fieldgid,MED_NOM_MAI,MED_NAME_SIZE,meshname) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE(MED_NOM_MAI);SSCRUTE(meshname);
    goto ERROR;
  }

 /* Maillage local ou distant */
  strcat(_meshpath,meshname);

  /* Le maillage est il distant */
  if ( (_meshgid = _MEDdatagroupOuvrir(fid,_meshpath)) < 0)  {

    /* Verifie que le maillage est bien référencé comme distant */
    strcat(_linkpath,meshname);
    if ((_linkgid = _MEDdatagroupOuvrir(fid,_linkpath)) < 0) {
/*       MED_ERR_(_ret,MED_ERR_DOESNTEXIST,MED_ERR_MESH,MED_ERR_FIELD_MSG); */
/*       SSCRUTE(fieldname);SSCRUTE(_meshpath);SSCRUTE(_linkpath); */
/*       goto ERROR; */
      *localmesh = MED_FALSE;
    }
    *localmesh = MED_FALSE;
  } else
    *localmesh = MED_TRUE;

  /* Nombre d'étapes de calcul*/
  if ( (_err=_MEDnObjects(_fieldgid,".",&_ncstp)) <0)
    if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
      MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,_fieldpath);
      goto ERROR;
    }

  *ncstp = (med_int) _ncstp;

  _ret = 0;

 ERROR:


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

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

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

  va_end(params);
  *fret = _ret;
  return;
}
コード例 #25
0
ファイル: _MEDfieldCr31.c プロジェクト: mndjinga/CDMATH
void
_MEDfieldCr31(int dummy, ...) {

  med_err _ret=-1;
  med_idt _root=0,_datagroup1=0;
  med_int _fieldtype ;
  char    _datagroupname1[MED_NAME_SIZE+1]="";
  med_access_mode _MED_ACCESS_MODE;


  MED_VARGS_DECL(const, med_idt           , , fid           );
  MED_VARGS_DECL(const, char * , const      , fieldname     );
  MED_VARGS_DECL(const, med_field_type    , , fieldtype     );
  MED_VARGS_DECL(const, med_int           , , ncomponent    );
  MED_VARGS_DECL(const, char *, const       , componentname );
  MED_VARGS_DECL(const, char *, const       , componentunit );
  MED_VARGS_DECL(const, char *, const       , dtunit        );
  MED_VARGS_DECL(const, char *, const       , meshname      );
  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      , fieldname     );
  MED_VARGS_DEF(const, med_field_type,     , fieldtype     );
  MED_VARGS_DEF(const, med_int           , , ncomponent    );
  MED_VARGS_DEF(const, char *, const       , componentname );
  MED_VARGS_DEF(const, char *, const       , componentunit );
  MED_VARGS_DEF(const, char *, const       , dtunit        );
  MED_VARGS_DEF(const, char *, const       , meshname      );
  MED_VARGS_DEF(, med_err *              , , fret          );


 _MEDmodeErreurVerrouiller();

 _fieldtype = (med_int) fieldtype;

 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;
  }

  /*
   * Si le DataGroup MED_FIELD_GRP n'existe pas, on le cree
   */
  if ((_root = _MEDdatagroupOuvrir(fid,MED_FIELD_GRP)) < 0)
    if ((_root = _MEDdatagroupCreer(fid,MED_FIELD_GRP)) < 0) {
     MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,MED_FIELD_GRP);
     goto ERROR;
    }

  NOFINALBLANK(fieldname,ERROR);
  /*
   * Si le Data Group "/CHA/<fieldname>" n'existe pas, on le cree
   */
  if ((_datagroup1 = _MEDdatagroupOuvrir(_root,fieldname)) < 0)
    if ((_datagroup1 = _MEDdatagroupCrOrderCr(_root,fieldname)) < 0 ) {
      MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,MED_FIELD_GRP);
      SSCRUTE(fieldname);goto ERROR;
    }


  /*
   * Les infos sur les composantes du champ
   */
  if ( _MEDattributeIntWr(_datagroup1,MED_NOM_NCO,&ncomponent) < 0 ) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_NCO);
    ISCRUTE(ncomponent);goto ERROR;
  }



  
  /* Tous les types med_field_type sont autorisés dans MEDfieldCr mais :
     Avant la 3.3.0 seuls les types : MED_FLOAT64,MED_INT32 et MED_INT64 étaient autorisés dans MEDfieldValueAdvancedWr 
       et seul le type med_int et med_float64 pouvaient être utilisés en C.

      A l'écriture, si med_int=int  les champs MED_INT32 étaient stockés en interne en HDFINT32bits
      A l'écriture, si med_int=long les champs MED_INT32 étaient stockés en interne en HDFINT64bits
      A la lecture : - si med_int=int  le champ MED_INT32 est relu en en HDFINT32bit avec conversion 64->32 si necessaire
                    - si med_int=long le champ MED_INT32 est relu en en HDFINT64bit avec conversion 32->64 si necessaire
      A l'écriture, si med_int=int les champs MED_INT64 étaient interdits
      A l'écriture, si med_int=long les champs MED_INT64 étaient stockés en interne en HDFINT64bits
      A la lecture : - si med_int=int  le champ MED_INT64 ne pouvait pas être relu (pour prevenir la perte d'information)
                    - si med_int=long le champ MED_INT64 est relu sans conversion

     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 dans MEDfieldValueAdvancedWr et aux types med_int et med_float64 utilisés en C sont ajoutés les types med_float32, med_int32 et med_int64.

     MED_INT32 :
      A l'écriture :  si med_int=int  les champs MED_INT32 sont toujours  stockés en interne en HDFINT32bits   (utiliser med_int32 ou med_int(!))
                      si med_int=long les champs MED_INT32 sont désormais stockés en interne en HDFINT32bits   (utiliser le type med_int64) et désormais 
      A la lecture :  si med_int=int  les champs MED_INT32 sont toujours  relus en HDFINT32bits sans conversion (utiliser med_int32 ou med_int(!))
                      si med_int=long les champs MED_INT32 sont désormais relus en HDFINT32bits sans conversion (utiliser le type med_int32)
     MED_INT64 :
      A l'écriture :  si med_int=int  les champs MED_INT64 sont désormais autorisés et stockés en interne en HDFINT64bits  (utiliser le type med_int64)
                      si med_int=long les champs MED_INT64 sont toujours  autorisés et stockés en interne en HDFINT64bits  (utiliser le type med_int64 ou med_int(!))
      A la lecture :  si med_int=int  les champs MED_INT64 sont désormais relus en HDFINT64bits sans conversion (utiliser le type med_int64)
                      si med_int=long les champs MED_INT64 sont toujours  relus en HDFINT64bits sans conversion  (utiliser le type med_int64 ou med_int(!))
    
     MED_INT :
      A l'écriture :  si med_int=int  les champs MED_INT sont désormais acceptés et stockés en interne en HDFINT32bits    (utiliser med_int ou med_int32(!))
                      si med_int=long les champs MED_INT sont désormais acceptés et stockés en interne en HDFINT64bits    (utiliser med_int ou med_int64(!)) 
      A la lecture :  si med_int=int  les champs MED_INT sont désormais acceptés et relus en HDFINT32bits avec conversion/maxint si necessaire (utiliser med_int ou med_int32(!))
                      si med_int=long les champs MED_INT sont désormais acceptés et relus en HDFINT64bits avec conversion        si necessaire (utiliser le type med_int32)
   

     Plateforme 32 bits : TODO si la plateforme est 32 bits, il faut .... ?
  */

  if ( _MEDattributeIntWr(_datagroup1,MED_NOM_TYP,&_fieldtype) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_TYP);
    ISCRUTE(_fieldtype);goto ERROR;
  }
  if ( _MEDattributeStringWr(_datagroup1,MED_NOM_NOM,
			    MED_SNAME_SIZE*ncomponent,componentname) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_NOM);
    SSCRUTE(componentname);goto ERROR;
  }
  if ( _MEDattributeStringWr(_datagroup1,MED_NOM_UNI,
			    MED_SNAME_SIZE*ncomponent,componentunit) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_UNI);
    SSCRUTE(componentunit);goto ERROR;
  }

  /*MODEL : MED_NOM_UNI vient du niveau en dessous
    Cree ou ouvre l'attribut  MED_NOM_UNI pour écriture
  */
  if ( _MEDattributeStringWr(_datagroup1,MED_NOM_UNT,MED_SNAME_SIZE,dtunit) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_UNT);
    SSCRUTE(dtunit);goto ERROR;
  }

  /*MODEL : MED_NOM_MAI est écrit dans l'API de création de champ
   * Si c'est la première référence à un maillage, initialise l'attribut MED_MAI à ce maillage
   */
  NOFINALBLANK(meshname,ERROR);

  if (_MEDattributeStringWr(_datagroup1,MED_NOM_MAI,MED_NAME_SIZE,meshname) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
    SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_MAI);
    SSCRUTE(meshname);
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,meshname);
    goto ERROR;
  }


  /*
   * On ferme tout
   */

  _ret=0;
 ERROR:

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

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

  va_end(params);
  *fret = _ret;
  return;
}
コード例 #26
0
void
_MEDfield23ComputingStepMeshInfo236(int dummy,...)
{


  med_err   _ret=-1,_err=0;
  med_size  _num,_nmesh=0;

  med_idt   _datagroup1=0,_meshgid=0,_linkgid=0;
  char      _datagroupname1[2*MED_MAX_PARA+1]         ="";
  char      _ent_geo       [2*MED_TAILLE_NOM_ENTITE+2]="";
  char      _path          [(MED_TAILLE_CHA+MED_TAILLE_NOM+1)+
			    (2*MED_TAILLE_NOM_ENTITE+1)+1+(2*MED_MAX_PARA)+1]=MED_CHA;
  char     _meshpath [MED_TAILLE_MAA+MED_TAILLE_NOM+1]=MED_MAA;
  char     _linkpath [MED_TAILLE_LIENS+MED_TAILLE_NOM+1]=MED_LIENS;
  med_size _ncpst=0;
  med_bool _checkmultiplemesh=MED_TRUE, _multiplemesh       =MED_FALSE;
  med_bool _checkmeshname    =MED_TRUE, _samedefaultmeshname=MED_FALSE;


  MED_VARGS_DECL(const, med_idt       , , fid       );
  MED_VARGS_DECL(const, char * , const  , fieldname );
  MED_VARGS_DECL(const, int           , , csit      );
  MED_VARGS_DECL(, med_int *, const     , numdt     );
  MED_VARGS_DECL(, med_int *, const     , numit     );
  MED_VARGS_DECL(, med_float *, const   , dt        );
  MED_VARGS_DECL(, med_int *, const     , nmesh     );
  MED_VARGS_DECL(, char *, const        , meshname  );
  MED_VARGS_DECL(, med_bool *, const    , localmesh );
  MED_VARGS_DECL(, med_int *, const     , meshnumdt );
  MED_VARGS_DECL(, med_int *, const     , meshnumit );
  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  , fieldname );
  MED_VARGS_DEF(const, int           , , csit      );
  MED_VARGS_DEF(, med_int *, const     , numdt     );
  MED_VARGS_DEF(, med_int *, const     , numit     );
  MED_VARGS_DEF(, med_float *, const   , dt        );
  MED_VARGS_DEF(, med_int *, const     , nmesh     );
  MED_VARGS_DEF(, char *, const        , meshname  );
  MED_VARGS_DEF(, med_bool *, const    , localmesh );
  MED_VARGS_DEF(, med_int *, const     , meshnumdt );
  MED_VARGS_DEF(, med_int *, const     , meshnumit );
  MED_VARGS_DEF(, med_err *           ,, fret      );

  _num=csit-1;

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

  /*
   * On construit le nom du datagroup
   */
  strcat(_path,fieldname);

/*   if ( _MEDfieldComputingStepCheck236(fid,  fieldname, */
/* 				      &_ncpst, */
/* 				      _checkmultiplemesh, &_multiplemesh, */
/* 				      _checkmeshname,     &_samedefaultmeshname) < 0) { */
/*     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_FIELD,fieldname); */
/*     goto ERROR; */
/*   } */

/*
 * On suppose que le modèle 2.3.6 est respecté :
 * Il y a les mêmes séquences de calcul pour tous les couples
 * (typent,typegeo). Autrement dit selon l'utilisation de l'API 2.3.6 :
 * A chaque séquence de calcul, on utilise le même ensemble de (typent,typegeo).
 * En conséquence si l'on fixe le (typeent,typegeo) les séquences
 * de calcul que l'on va trouver seront représentatives de celles
 * présentent dans tous les (typent,typegeo) utilisés.
 */
  if ( _MEDobjectGetName(fid, _path ,0, _ent_geo) < 0 ) {
    MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);
    SSCRUTE(_path); SSCRUTE(_ent_geo); goto ERROR;
  }

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

  if ( _MEDobjectGetName(fid, _path ,_num, _datagroupname1) < 0 ) {
    MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);
    SSCRUTE(_path); SSCRUTE(_ent_geo); goto ERROR;
  }

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

  if ((_datagroup1 = _MEDdatagroupOuvrir(fid,_path)) < 0) {
    MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);
    goto ERROR;
  }


  /*
   * Lecture des attributs
   */

  if (_MEDattrEntierLire(_datagroup1,MED_NOM_NDT,(med_int*) numdt) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_NDT);
    SSCRUTE(_path);ISCRUTE(*numdt);goto ERROR;
  }

  if (_MEDattrFloatLire(_datagroup1,MED_NOM_PDT,(med_float*) dt) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_PDT);
    SSCRUTE(_path);RSCRUTE(*dt);goto ERROR;
  }

  if (_MEDattrEntierLire(_datagroup1,MED_NOM_NOR,(med_int*) numit) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_NOR);
    SSCRUTE(_path);ISCRUTE(*numit);goto ERROR;
  }

  if (_MEDattrStringLire(_datagroup1,MED_NOM_MAI,MED_TAILLE_NOM,meshname) < 0) {
    MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_MAI);
    SSCRUTE(_path);SSCRUTE(meshname);goto ERROR;
  }


  /* Nombre de maillages
   * La gestion d'une incohérence sur le nombre de séquences de calcul par couple (entitytype,geotype)
   * se fait à partir des appels :
   *  MEDfieldnProfile,MEDfieldnValue*
   * La vérification complémentaire que l'ensemble des maillages utilisés sont les mêmes pour toutes les séquences
   * de calcul identiques est effectué dans MEDfield23nValue
   */
  if ( (_err=_MEDnObjects(_datagroup1,".",&_nmesh)) <0)
    if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
      MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,_path);
      goto ERROR;
    }
  *nmesh = (med_int) _nmesh;


  /* Maillage local ou distant */
  strcat(_meshpath,meshname);

  /* Le maillage est il distant */
  if ( (_meshgid = _MEDdatagroupOuvrir(fid,_meshpath)) < 0)  {

    /* Verifie que le maillage est bien référencé comme distant */
    strcat(_linkpath,meshname);
    if ((_linkgid = _MEDdatagroupOuvrir(fid,_linkpath)) < 0) {
/*       MED_ERR_(_ret,MED_ERR_DOESNTEXIST,MED_ERR_MESH,MED_ERR_FIELD_MSG); */
/*       SSCRUTE(fieldname);SSCRUTE(_meshpath);SSCRUTE(_linkpath); */
/*       goto ERROR; */
      *localmesh = MED_FALSE;
    }
    *localmesh = MED_FALSE;
  } else
    *localmesh = MED_TRUE;

  *meshnumdt=MED_NO_DT;
  *meshnumit=MED_NO_IT;

  _ret = 0;

 ERROR:

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

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

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

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

}
コード例 #27
0
ファイル: MEDscalaireCr.c プロジェクト: mndjinga/CDMATH
med_err
MEDscalaireCr(med_idt fid,char *scalaire, med_type_champ type, char *desc)
{
  med_err ret=-1;
  med_idt root=0,gid=0;
  char chemin[MED_TAILLE_NUM_DATA+1];
  med_int _type = (med_int) type;
  med_mode_acces MED_MODE_ACCES;

  /*
   * On inhibe le gestionnaire d'erreur
   */
  _MEDmodeErreurVerrouiller();
if (MEDcheckVersion(fid) < 0) return -1;


  if ( (MED_MODE_ACCES = _MEDmodeAcces(fid) ) == MED_UNDEF_MODE_ACCES ) {
    MESSAGE("Impossible de déterminer le mode d'acces au fichier.");
    goto ERROR;
  }

  if ( MED_MODE_ACCES == MED_LECTURE ) {
    MESSAGE("Impossible de créer une variable scalaire en mode MED_LECTURE.");
    goto ERROR;
  };

  /* 
   * Si le Groupe  HDF "/NUM_DATA" n'existe pas, on le cree
   */
  strncpy(chemin,MED_NUM_DATA,MED_TAILLE_NUM_DATA-1);
  chemin[MED_TAILLE_NUM_DATA-1] = '\0';
  if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
    if ((root = _MEDdatagroupCreer(fid,chemin)) < 0){
      MESSAGE("Erreur à la création du datagroup : ");
      SSCRUTE(chemin);
      goto ERROR;
    }

  /* 
   * Si le groupe HDF "scalaire" n'existe pas, on le cree
   * Sinon => erreur
   */
  NOFINALBLANK(scalaire,ERROR);
  if ((gid = _MEDdatagroupCreer(root,scalaire)) < 0) {
    MESSAGE("Erreur à la création de la variable scalaire : ");
    SSCRUTE(scalaire);
    goto ERROR;
  }

  /* 
   * On stocke l'unite, et le type de la valeur scalaire
   */
  if ((ret = _MEDattrEntierEcrire(gid,MED_NOM_TYP,&_type)) < 0) {
    MESSAGE("Erreur à l'écriture du type de la varaible scalaire : ");
    ISCRUTE(_type);
    goto ERROR;
  }
  if ((ret = _MEDattrStringEcrire(gid,MED_NOM_DES,MED_TAILLE_DESC,desc)) < 0) {
    MESSAGE("Erreur à l'écriture de la description de la variable scalaire : ");
    SSCRUTE(desc);
    goto ERROR;
  }

  /*
   * On ferme tout
   */
  ret = 0;
 ERROR:
  if (gid>0)     if (_MEDdatagroupFermer(gid) < 0) {
    MESSAGE("Impossible de fermer le datagroup : ");
    ISCRUTE_id(gid);ret=-1; 
  }
  
  if (root>0)     if (_MEDdatagroupFermer(root) < 0) {
    MESSAGE("Impossible de fermer le datagroup : ");
    ISCRUTE_id(root);ret=-1; 
  }

  return ret;
}
コード例 #28
0
ファイル: MEDjointnCorres.c プロジェクト: vejmarie/libMED
med_int
MEDjointnCorres (med_idt fid, char *maa, char *jn, 
		 med_entite_maillage type_ent_local,   med_geometrie_element typ_geo_local,
		 med_entite_maillage type_ent_distant, med_geometrie_element typ_geo_distant)
{
  med_entite_maillage _type_ent_local   = (med_entite_maillage) ( (int)(type_ent_local) % 10 );
  med_entite_maillage _type_ent_distant = (med_entite_maillage) ( (int)(type_ent_distant) % 10 );
  med_idt datagroup1=0,datagroup2=0;
  med_int n=0, ret=-1;

  char chemin[MED_TAILLE_MAA+MED_TAILLE_JNT+2*MED_TAILLE_NOM+1]; 
  char nomdatagroup[MED_TAILLE_NOM_ENTITE*4+3+1];
  char tmp[MED_TAILLE_NOM_ENTITE+1];
  med_size dimd[1];

/*   if (typ_geo_local   == MED_TETRA4 || typ_geo_local    == MED_TETRA10 || */
/*       typ_geo_local   == MED_HEXA8  || typ_geo_local    == MED_HEXA20  || */
/*       typ_geo_local   == MED_PENTA6 || typ_geo_local    == MED_PENTA15 || */
/*       typ_geo_local   == MED_PYRA5  || typ_geo_local    == MED_PYRA13  || */
/*       typ_geo_distant == MED_TETRA4 || typ_geo_distant == MED_TETRA10 || */
/*       typ_geo_distant == MED_HEXA8  || typ_geo_distant == MED_HEXA20  || */
/*       typ_geo_distant == MED_PENTA6 || typ_geo_distant == MED_PENTA15 || */
/*       typ_geo_distant == MED_PYRA5  || typ_geo_distant == MED_PYRA13) */
/*     return -1; */

  /*
   * On inhibe le gestionnaire d'erreur HDF 5
   */
  _MEDmodeErreurVerrouiller();
if (MEDcheckVersion(fid) < 0) return -1;


  /* 
   * Si le Data Group de "JNT/Corres" n'existe pas => erreur
   */
  strcpy(chemin,MED_MAA);
  strcat(chemin,maa);
  strcat(chemin,MED_JNT);
  strcat(chemin,jn);


  if ((datagroup1 = _MEDdatagroupOuvrir(fid,chemin)) < 0) {
    MESSAGE("Impossible d'ouvrir le datagroup  : ");
    SSCRUTE(chemin); 
    goto ERREUR;
  }

  /*
   * Ecriture de la correspondance
   *   construction du tag HDF "reperant" la correspondance 
   *   
   */
  if ( _MEDnomEntite(nomdatagroup,_type_ent_local) < 0)
    goto ERREUR;
  if ((_type_ent_local != MED_NOEUD)) {
    if ( _MEDnomGeometrie30(tmp,typ_geo_local) < 0) goto ERREUR;
    strcat(nomdatagroup,".");
    strcat(nomdatagroup,tmp);
  }


  if ( _MEDnomEntite(tmp,_type_ent_distant) < 0)  goto ERREUR;
  strcat(nomdatagroup,".");
  strcat(nomdatagroup,tmp);
  if ((_type_ent_distant != MED_NOEUD)) {
    if ( _MEDnomGeometrie30(tmp,typ_geo_distant) < 0) goto ERREUR;
    strcat(nomdatagroup,".");
    strcat(nomdatagroup,tmp);
  }


  /* le couple d'entite n'existe pas, on renvoie 0 */

  if ((datagroup2 = _MEDdatagroupOuvrir(datagroup1,nomdatagroup)) < 0 ) goto SORTIE;

  /* erreur : le couple d'entite existe mais on
     ne peut lire l'attribut NBR */

  if ( _MEDattrEntierLire(datagroup2,MED_NOM_NBR,&n) < 0) {
    MESSAGE("Impossible de lire l'attribut NBR : ");
    SSCRUTE(chemin);SSCRUTE(MED_NOM_NBR); goto ERREUR;
  }

  /*
   * On ferme tout 
   */
  
 SORTIE:
  ret= n;
 ERREUR:

  if (datagroup2 > 0 ) if ( _MEDdatagroupFermer(datagroup2) < 0) {
    MESSAGE("Impossible de fermer le groupe  : ");
    SSCRUTE(chemin);SSCRUTE(nomdatagroup);ret=-1;
  }

  if (datagroup1 > 0 ) if ( _MEDdatagroupFermer(datagroup1) < 0) {
    MESSAGE("Impossible de fermer le groupe  : ");
    SSCRUTE(chemin);ret= -1;
  }

  return (med_int) ret;  

}
コード例 #29
0
ファイル: MEDprofileWr.c プロジェクト: PROJECT-CDMATH/CDMATH
med_err
MEDprofileWr(const med_idt        fid,
	     const char* const    profilename,
	     const med_int        profilesize,
	     const med_int* const profilearray)
{
  med_access_mode _MED_ACCESS_MODE;
  med_idt        _root=0,_pfid=0;
  med_err        _ret=-1;
  char           _path[MED_TAILLE_PROFILS+MED_NAME_SIZE+1]=MED_PROFILS;
  med_filter     _filter        = MED_FILTER_INIT;

  /*
   * 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;
  }

 /*
   * Si le DataGroup /PROFILS/ n'existe pas, on le cree
   */
  if ((_root = _MEDdatagroupOuvrir(fid,_path)) < 0)
    if ((_root = _MEDdatagroupCreer(fid,_path)) < 0) {
      MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,_path);
     goto ERROR;
    }

  NOFINALBLANK(profilename,ERROR);
  /*
   * Si le DataGroup /PROFILS/<profilename> n'existe pas, on le cree
   */
  if ((_pfid = _MEDdatagroupOuvrir(_root,profilename)) < 0)
    if ((_pfid = _MEDdatagroupCreer(_root,profilename)) < 0) {
      MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,profilename);
      SSCRUTE(_path);goto ERROR;
    }

  strcat(_path,profilename);


  /*
   * On stocke "profilesize" sous forme d'attribut
   */
  if (_MEDattributeIntWr(_pfid,MED_NOM_NBR,&profilesize) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_PROFILE_MSG);
    SSCRUTE(profilename);SSCRUTE(MED_NOM_NBR);ISCRUTE(profilesize);
    goto ERROR;
  }

  /*
   * On stocke le profil dans un dataset
   */
  if ( MEDfilterEntityCr(fid, profilesize, 1, 1, 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(_pfid,MED_NOM_PFL,MED_INTERNAL_INT,&_filter, profilearray) < 0) {
    MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_DATASET,MED_NOM_PFL);SSCRUTE(_path);
    goto ERROR;
  }

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

  _ret = 0;

 ERROR:

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

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

  return _ret;
}
コード例 #30
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;
}