med_int nmipfiin(med_int *fid, char *name, med_int *lon1, med_int *gtype, med_int *cnode, med_int *nbf, med_int *nvar, med_int *mdeg, med_int *nmaxc) #endif { med_int _ret; char *_fn1; med_geometry_type _gtype; med_bool _cnode; _fn1 = _MED2cstring(name, (int) * lon1); if (!_fn1 ) return(-1); _ret = (med_int) MEDinterpInfoByName((med_idt) *fid, _fn1, &_gtype, &_cnode, (med_int*) nbf, (med_int*) nvar, (med_int*) mdeg, (med_int*) nmaxc ); *gtype = (med_int) _gtype; *cnode = (med_int) _cnode; _MEDcstringFree(_fn1); return(_ret); }
/**\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; }
int main (int argc, char **argv) { med_idt fid; const char interpname[MED_NAME_SIZE+1] = "MED_TRIA3 interpolation family"; med_geometry_type geotype =MED_NONE; med_bool cellnodes =MED_FALSE; med_int nbasisfunc =0; med_int nvariable =0; med_int maxdegree =0; med_int nmaxcoefficient =0; int basisfuncit =0; int powerit =0; med_int ncoefficient =0; med_int* power =NULL; med_float* coefficient =NULL; int coefficientit =0; int ret=-1; /* file creation */ fid = MEDfileOpen("UsesCase_MEDinterp_1.med",MED_ACC_RDONLY); if (fid < 0) { MESSAGE("ERROR : file creation ..."); goto ERROR; } /* with direct access by the family name */ if (MEDinterpInfoByName(fid,interpname,&geotype,&cellnodes,&nbasisfunc, &nvariable,&maxdegree,&nmaxcoefficient) < 0) { MESSAGE("ERROR : interpolation function information ..."); goto ERROR; } /* read each basis function */ for ( basisfuncit=1; basisfuncit<= nbasisfunc; ++basisfuncit) { if ((ncoefficient = MEDinterpBaseFunctionCoefSize(fid,interpname,basisfuncit) ) <0 ) { MESSAGE("ERROR : read number of coefficient in the base function ..."); goto ERROR; } coefficient = (med_float*) calloc(sizeof(med_float),ncoefficient); power = (med_int*) calloc(sizeof(med_int),nvariable*ncoefficient); if (MEDinterpBaseFunctionRd(fid,interpname,basisfuncit,&ncoefficient,power,coefficient) < 0) { MESSAGE("ERROR : read base function ..."); free(coefficient); free(power); goto ERROR; } free(coefficient); free(power); } ret=0; ERROR: /* close file */ if (MEDfileClose(fid) < 0) { MESSAGE("ERROR : close file ..."); ret=-1; } return ret; }