示例#1
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;
}
示例#2
0
med_int 
nmsefsin(med_int *fid, 
	 char *mname, med_int *mnamelen,
	 med_int *mgtype, med_int * mdim,
	 char *smname, 
	 med_int *setype, med_int *snnode, med_int *sncell,
	 med_int *sgtype, med_int *ncatt, med_int *ap,
	 med_int *nvatt)
#endif
{
  med_int _ret;
  char *_fn1;
  char _fs2[MED_NAME_SIZE+1]="";
  med_entity_type _setype;
  med_geometry_type _mgeotype;
  med_geometry_type _sgtype;
  med_bool _ap;

  _fn1 = _MED2cstring((char *) mname, (int) *mnamelen);
  if (!_fn1)
    return(-1);

  _ret = (med_int) MEDstructElementInfoByName((const med_idt) *fid, 
					      _fn1,
					      &_mgeotype,
					      (med_int *) mdim,
					      _fs2,
					      &_setype,
					      (med_int *) snnode, 
					      (med_int *) sncell,
					      &_sgtype,
					      (med_int *) ncatt,
					      &_ap,
					      (med_int *) nvatt);
  
  _MEDc2fString(_fs2,smname,MED_NAME_SIZE);
  *mgtype = (med_int) _mgeotype;
  *setype = (med_int) _setype;
  *sgtype = (med_int) _sgtype;
  *ap = (med_int) _ap;

  _MEDcstringFree(_fn1);

  return _ret;
}
示例#3
0
med_int 
nmsefsar(med_int *fid, char *mname, med_int *mnamelen, 
	 char *aname, med_int *anamelen,
	 char *val)
#endif
{
  med_int _ret;
  char *_fn1, *_fn2;
  char *_fs1;
  med_entity_type _setype;
  med_geometry_type _mgeotype, _gctype;
  med_geometry_type _sgtype;
  med_int _mdim, _nnode, _ncell;
  char _meshname[MED_NAME_SIZE+1]="";
  char _pname[MED_NAME_SIZE+1]="";
  med_entity_type _etype;
  med_int _ncatt, _nvatt, _ncomp, _psize;
  med_bool _ap;
  med_attribute_type _type;
  int _size=0; 

  _fn1 = _MED2cstring((char *) mname, (int) *mnamelen);
  if (!_fn1)
    return(-1);

  _fn2 = _MED2cstring((char *) aname, (int) *anamelen);
  if (!_fn2)
    return(-1);

  if (MEDstructElementInfoByName((med_idt) *fid, 
				 _fn1, 
				 &_mgeotype, 
				 &_mdim,
                                 _meshname, 
				 &_etype, 
				 &_nnode, 
				 &_ncell,
                                 &_gctype, 
				 &_ncatt, 
				 &_ap, 
				 &_nvatt)  < 0) 
    return -1;

  if (MEDstructElementConstAttInfoByName((med_idt) *fid, 
					 _fn1,  
					 _fn2, 
					 &_type, 
					 &_ncomp, 
					 &_setype,
                                         _pname, 
					 &_psize) < 0) 
    return -1;

  if (_psize != 0)
    _size = _psize*_ncomp*MED_NAME_SIZE*sizeof(char);
  else
    if (_etype == MED_NODE)
      _size = _nnode*_ncomp*MED_NAME_SIZE*sizeof(char);
    else
      _size = _ncell*_ncomp*MED_NAME_SIZE*sizeof(char);
  _fs1 = (char *) malloc(_size+1);
  *_fs1='\0';

  _ret = (med_int) MEDstructElementConstAttRd((const med_idt) *fid, 
					      _fn1, 
					      _fn2, 
					      (void *) _fs1);

  _MEDc2fString(_fs1,val,_size);
  free(_fs1);

  _MEDcstringFree(_fn1);
  _MEDcstringFree(_fn2);

  return _ret;
}
示例#4
0
med_int 
nmsefspw(med_int *fid, char *mname, med_int *mnamelen, 
	 char *aname, med_int *anamelen,
	 med_int *atype, med_int *anc, med_int *setype,
	 char *pname, med_int *pnamelen,
	 char *val, med_int *vallen)
#endif
{
  med_int _ret;
  char *_fn1, *_fn2,*_fn3, *_fn4;
  med_attribute_type _atype = (med_attribute_type) *atype;
  med_entity_type _setype = (med_entity_type) *setype;
  int _nentity=0; 
  med_geometry_type _geotype=0;
  med_int _modeldim=0;
  char _supportmeshname[MED_NAME_SIZE+1]="";
  med_entity_type _entitytype=0;
  med_int _nnode=0;
  med_int _ncell=0; 
  med_geometry_type _sgeotype=0; 
  med_int _nconstatt=0; 
  med_bool _anyprofile=0;
  med_int _nvaratt=0;
  med_bool _coordinatechangement=MED_FALSE;
  med_bool _geotransformation=MED_FALSE;

  _fn1 = _MED2cstring((char *) mname, (int) *mnamelen);
  if (!_fn1)
    return(-1);

  _fn2 = _MED2cstring((char *) aname, (int) *anamelen);
  if (!_fn2)
    return(-1);

  _fn3 = _MED2cstring((char *) pname, (int) *pnamelen);
  if (!_fn3)
    return(-1);

  /* on recupere le nom du maillage support */
  _ret = MEDstructElementInfoByName((med_idt) *fid,
				    _fn1,
				    &_geotype, 
				    &_modeldim,
                                    _supportmeshname, 
				    &_entitytype, 
				    &_nnode, 
				    &_ncell,
                                    &_sgeotype, 
				    &_nconstatt, 
				    &_anyprofile, 
				    &_nvaratt);
  if (_ret < 0)
    return (-1);
  
  /* on recupere le nombre d'entite dans le maillage support :
     MED_NODE ou MED_CELL */
  if (_setype == MED_NODE)
    _nentity = MEDmeshnEntity((med_idt) *fid, 
			      _supportmeshname, 
			      MED_NO_DT, 
			      MED_NO_IT, 
			      _setype, 
			      _sgeotype,
			      MED_COORDINATE, 
			      MED_NO_CMODE,
			      &_coordinatechangement,
			      &_geotransformation);
  else
    _nentity = MEDmeshnEntity((med_idt) *fid, 
			      _supportmeshname, 
			      MED_NO_DT, 
			      MED_NO_IT, 
			      _setype, 
			      _sgeotype,
			      MED_CONNECTIVITY, 
			      MED_NODAL,
			      &_coordinatechangement,
			      &_geotransformation);
  if (_nentity < 0)
    return (-1); 
  
  _fn4 = _MED1cstring((char *) val, (int) *vallen*_nentity, (int) *anc*_nentity*MED_NAME_SIZE);
  if (!_fn4)
    return(-1);

  _ret = (med_int) MEDstructElementConstAttWithProfileWr((const med_idt) *fid, 
							 _fn1, 
							 _fn2, 
							 _atype,
							 (med_int) *anc,
							 _setype,
							 _fn3,
							 (void *) _fn4);

  _MEDcstringFree(_fn1);
  _MEDcstringFree(_fn2);
  _MEDcstringFree(_fn3);
  _MEDcstringFree(_fn4);


  return _ret;
}