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; }
med_err MEDlinkWr(const med_idt fid, const char * const meshname, const char * const link) { med_access_mode _MED_ACCESS_MODE; med_idt _lid=0, _root=0; med_err _ret=-1; char _path[MED_TAILLE_LIENS+MED_NAME_SIZE+1]=MED_LIENS; med_int _n=0; med_filter _filter = MED_FILTER_INIT; /* * On inhibe le gestionnaire d'erreur HDF 5 */ _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 /LIENS/ 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(link,ERROR); /* * Si le DataGroup /LIENS/<meshname> n'existe pas, on le cree */ if ((_lid = _MEDdatagroupOuvrir(_root,meshname)) < 0) if ((_lid = _MEDdatagroupCreer(_root,meshname)) < 0) { MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,meshname); SSCRUTE(_path);goto ERROR; } strcat(_path,meshname); /* * On stocke <n> sous forme d'attribut */ _n = strlen(link); if (_MEDattributeIntWr(_lid,MED_NOM_NBR,&_n) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_LINK_MSG); SSCRUTE(_path);SSCRUTE(MED_NOM_NBR);ISCRUTE(_n); goto ERROR; } /* * On stocke le link dans un dataset */ if ( MEDfilterEntityCr(fid,_n, 1, 1, MED_ALL_CONSTITUENT, MED_NO_INTERLACE,MED_UNDEF_STMODE, MED_NO_PROFILE, MED_UNDEF_SIZE, NULL, &_filter) < 0 ) { MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,MED_ERR_INTERNAL_MSG); goto ERROR; } /* SSCRUTE(link); */ if ( _MEDdatasetWr(_lid,MED_NOM_LIE,MED_INTERNAL_CHAR,&_filter, link) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_DATASET,MED_NOM_LIE);SSCRUTE(_path); goto ERROR; } if ( MEDfilterClose(&_filter) < 0 ) { MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,MED_ERR_LINK_MSG); SSCRUTE(_path); goto ERROR; } _ret = 0; ERROR: if (_lid>0) if (_MEDdatagroupFermer(_lid) < 0) { MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,meshname); ISCRUTE_id(_lid); } if (_root>0) if (_MEDdatagroupFermer(_root) < 0) { MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_LIENS); ISCRUTE_id(_root); } return _ret; }
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; }
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; }
/**\ingroup MEDinterp \brief \MEDinterpCrBrief \param fid \fid \param interpname \interpname \param geotype \geotype \param cellnode \cellnode \param nvariable \nvariable \param maxdegree \maxdegree \param nmaxcoef \nmaxcoef \return \error \details \MEDinterpCrDetails \see MEDinterpBaseFunctionWr \remarks \li \MEDinterpCrcellnodeCm1 \li \MEDinterpCrcellnodeCm2 */ med_err MEDinterpCr(const med_idt fid, const char* const interpname, const med_geometry_type geotype, const med_bool cellnode, const med_int nvariable, const med_int maxdegree, const med_int nmaxcoef ) { med_access_mode _MED_ACCESS_MODE; med_idt _root=0,_interpid=0; med_int _ret=-1; char _path[MED_INTERPOLATION_GRP_SIZE+MED_NAME_SIZE+1]=MED_INTERPOLATION_GRP; med_int _cellnodes = cellnode; med_int _geotype = geotype; /* * 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 /INTERP/ n'existe pas, on le cree */ if ((_root = _MEDdatagroupOpen(fid,_path)) < 0) if ((_root = _MEDdatagroupCreer(fid,_path)) < 0) { MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,_path); goto ERROR; } NOFINALBLANK(interpname,ERROR); /* * Si le DataGroup /INTERP/<interpname> n'existe pas, on le cree */ if ((_interpid = _MEDdatagroupOpen(_root,interpname)) < 0) if ((_interpid = _MEDdatagroupCreer(_root,interpname)) < 0) { MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,interpname); SSCRUTE(_path);goto ERROR; } strcat(_path,interpname); /* * Creation/Ecriture de l'attribut MED_NOM_GEO */ if ( _MEDattributeIntWr(_interpid,MED_NOM_GEO,&_geotype) < 0 ) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,_path); SSCRUTE(MED_NOM_GEO);ISCRUTE(_geotype); goto ERROR; } /* * Creation/Ecriture de l'attribut MED_NOM_NBB */ /* if ( _MEDattributeIntWr(_interpid,MED_NOM_NBB,&nbasisfunc) < 0 ) { */ /* MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,_path); */ /* SSCRUTE(MED_NOM_NBB);ISCRUTE(nbasisfunc); */ /* goto ERROR; */ /* } */ /* * Creation/Ecriture de l'attribut MED_NOM_NBV */ if ( _MEDattributeIntWr(_interpid,MED_NOM_NBV,&nvariable) < 0 ) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,_path); SSCRUTE(MED_NOM_NBV);ISCRUTE(nvariable); goto ERROR; } /* * Creation/Ecriture de l'attribut MED_NOM_MDG */ if ( _MEDattributeIntWr(_interpid,MED_NOM_MDG,&maxdegree) < 0 ) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,_path); SSCRUTE(MED_NOM_MDG);ISCRUTE(maxdegree); goto ERROR; } /* * Creation/Ecriture de l'attribut MED_NOM_MCF */ if ( _MEDattributeIntWr(_interpid,MED_NOM_MCF,&nmaxcoef) < 0 ) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,_path); SSCRUTE(MED_NOM_MCF);ISCRUTE(nmaxcoef); goto ERROR; } /* * Creation/Ecriture de l'attribut MED_NOM_FCN */ if ( _MEDattributeIntWr(_interpid,MED_NOM_FCN,&_cellnodes) < 0 ) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,_path); SSCRUTE(MED_NOM_FCN);ISCRUTE(_cellnodes); goto ERROR; } _ret = 0; ERROR: if (_interpid>0) if (_MEDdatagroupFermer(_interpid) < 0) { MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path); ISCRUTE_id(_interpid); } if (_root>0) if (_MEDdatagroupFermer(_root) < 0) { MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_INTERPOLATION_GRP); ISCRUTE_id(_root); } return _ret; }
med_err MEDmeshComputationStepCr(const med_idt fid, const char * const meshname, const med_int numdt1, const med_int numit1, const med_int numdt2, const med_int numit2, const med_float dt2 ) { med_access_mode _MED_ACCESS_MODE; med_err _ret=-1; med_idt _meshid=0,_datagroup1=0,_datagroup2=0,_datagroup3=0; char _meshpath [MED_MESH_SUPPORT_GRP_SIZE+MED_NAME_SIZE+1]=""; char _datagroupname [2*MED_MAX_PARA+1]=""; char _datagroupname2[2*MED_MAX_PARA+1]=""; char _datagroupname1bis[2*MED_MAX_PARA+1]=""; char _latestcpstname[2*MED_MAX_PARA+1]=""; char* _datagroupname1=_datagroupname; char _datagroupname3[2*MED_MAX_PARA+1]=""; char _prevcpstname[2*MED_MAX_PARA+1]=""; char _pathsrc[MED_MESH_SUPPORT_GRP_SIZE+MED_NAME_SIZE+1+2*MED_MAX_PARA+1+1]=""; char _pathdst[MED_MESH_SUPPORT_GRP_SIZE+MED_NAME_SIZE+1+2*MED_MAX_PARA+1+1]=""; med_bool _datagroup1exist = MED_TRUE; med_bool _isasupportmesh = MED_FALSE; med_int _nextdt=MED_NO_DT, _nextit=MED_NO_IT,_pvdt=MED_NO_DT, _pvit=MED_NO_IT; med_int _lastnumdt=MED_NO_DT, _lastnumit=MED_NO_IT; med_int _numdt1=numdt1,_numit1=numit1; med_int _false = 0; med_sorting_type _sortingtype; med_int _intsortingtype; /* * 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; } /* strcat( _meshpath, meshname); */ /* strcat( _pathsrc , meshname);strcat( _pathsrc , "/"); */ /* strcat( _pathdst , meshname);strcat( _pathdst , "/"); */ /* if ((_meshid = _MEDdatagroupOuvrir(fid,_meshpath)) < 0) { */ /* MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_meshpath); */ /* SSCRUTE(_meshid);goto 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; } strcat( _pathsrc , _meshpath);strcat( _pathsrc , "/"); strcat( _pathdst , _meshpath);strcat( _pathdst , "/"); if ( _MEDattrEntierLire(_meshid,MED_NOM_NXT,&_lastnumdt) < 0) { /* MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); */ /* SSCRUTE(meshname);SSCRUTE(_meshpath);SSCRUTE(MED_NOM_NXT); */ /* goto ERROR; */ _lastnumdt = MED_NO_DT; } if ( _MEDattrEntierLire(_meshid,MED_NOM_NXI,&_lastnumit) < 0) { /* MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); */ /* SSCRUTE(meshname);SSCRUTE(_meshpath);SSCRUTE(MED_NOM_NXI); */ /* goto ERROR; */ _lastnumit = MED_NO_IT; } 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,numdt1,numit1,_datagroupname); _MEDgetComputationStepName(_sortingtype,numdt2,numit2,_datagroupname2); _MEDgetComputationStepName(_sortingtype,_lastnumdt,_lastnumit,_latestcpstname); /* L'utilisateur peut demander la création d'une nouvelle étape de calcul postérieure à toutes les autres en indiquant (numdt1 == numdt2) && (numit1 == numit2) Celà fonctionne aussi pour MED_NO_DT, NED_NO_IT */ if ( (numdt1 == numdt2) && (numit1 == numit2) ) { _numdt1 = _lastnumdt; _numit1 = _lastnumit; _datagroupname1 = _latestcpstname; } /*Vérifie que le _datagroupname2 est bien postérieur ou égal au _datagroupname1 REM: _datagroupname1 peut être la première/dernière séquence de calcul ou une séquence intermédiaire */ if ( strncmp(_datagroupname2,_datagroupname1,2*MED_MAX_PARA+2) < 0) { MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_COMPUTINGSTEP,_datagroupname2); SSCRUTE(meshname);SSCRUTE(_datagroupname1);goto ERROR; } strcat( _pathsrc , _datagroupname1 );strcat( _pathsrc , "/"); strcat( _pathdst , _datagroupname2 );strcat( _pathdst , "/"); /* On accepte l'absence de _datagroupname1 uniquement si numdt2 == MED_NO_DT && numit2 == MED_NO_IT */ if ( (_datagroup1 = _MEDdatagroupOuvrir(_meshid,_datagroupname1)) < 0 ) { if ( (numdt2 != MED_NO_DT ) || (numit2 != MED_NO_IT) ) { MED_ERR_(_ret,MED_ERR_DOESNTEXIST,MED_ERR_COMPUTINGSTEP,_datagroupname1); SSCRUTE(meshname);goto ERROR; } } /*L'étape de calcul à créer ne doit pas déjà exister*/ if ( (_datagroup2 = _MEDdatagroupOuvrir(_meshid,_datagroupname2)) >= 0 ) { MED_ERR_(_ret,MED_ERR_EXIST,MED_ERR_COMPUTINGSTEP,_datagroupname2); SSCRUTE(meshname);goto ERROR; } if ( _datagroup1 > 0 ) { /*Lecture NEXT et PREV du datagroup1 */ if ( _MEDattrEntierLire(_datagroup1,MED_NOM_NXT,&_nextdt) < 0) { MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_NXT); goto ERROR; } if ( _MEDattrEntierLire(_datagroup1,MED_NOM_NXI,&_nextit) < 0) { MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_NXI); goto ERROR; } /* On vérifie que la nouvelle étape de calcul s'insère correctement : < au next du datagroup1 */ /* if ( !((_nextdt == MED_NO_DT) && (_nextit == MED_NO_IT) )) { */ if ( (_nextdt != MED_NO_DT) || (_nextit != MED_NO_IT) ) { _MEDgetComputationStepName(_sortingtype,_nextdt,_nextit,_datagroupname3); if ( strncmp(_datagroupname3,_datagroupname2,2*MED_MAX_PARA+2) <= 0) { MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_COMPUTINGSTEP,_datagroupname2); SSCRUTE(meshname);SSCRUTE(_datagroupname3);goto ERROR; } } /*On crée la nouvelle étape de calcul (au plus tard, après vérifs...)*/ if ((_datagroup2 = _MEDdatagroupCreer(_meshid,_datagroupname2)) < 0 ) { MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,_datagroupname2); SSCRUTE(meshname);goto ERROR; } /*On crée les datagroups, attributs et liens sur les datatsets et les liens symboliques pour avoir une image de l'étape de calcul précedente.*/ if ( _MEDvisit(fid,_pathsrc,_pathdst,(medvisitorfunc) _MEDlinkobjs ) < 0 ) { MED_ERR_(_ret,MED_ERR_VISIT,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_pathsrc);SSCRUTE(_pathdst); goto ERROR; } /*Ecriture NEXT et PREV du nouveau datagroup2 */ if ( _MEDattributeIntWr(_datagroup2,MED_NOM_NXT,&_nextdt) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname2);SSCRUTE(MED_NOM_NXT); goto ERROR; } if ( _MEDattributeIntWr(_datagroup2,MED_NOM_NXI,&_nextit) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname2);SSCRUTE(MED_NOM_NXI); goto ERROR; } if ( _MEDattributeIntWr(_datagroup2,MED_NOM_PVT,&_numdt1) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname2);SSCRUTE(MED_NOM_PVT); goto ERROR; } if ( _MEDattributeIntWr(_datagroup2,MED_NOM_PVI,&_numit1) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname2);SSCRUTE(MED_NOM_PVI); goto ERROR; } /*Modification du NEXT du datagroup1 */ if ( _MEDattributeIntWr(_datagroup1,MED_NOM_NXT,&numdt2) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_NXT); goto ERROR; } if ( _MEDattributeIntWr(_datagroup1,MED_NOM_NXI,&numit2) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_NXI); goto ERROR; } /*Modification de PREV du ( NEXT de datagroup1 ) s'il existe*/ if (strlen(_datagroupname3) ) { if ( (_datagroup3 = _MEDdatagroupOuvrir(_meshid,_datagroupname3)) < 0 ) { MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_COMPUTINGSTEP,_datagroupname3); SSCRUTE(meshname);goto ERROR; } if ( _MEDattrEntierLire(_datagroup3,MED_NOM_PVT,&_pvdt) < 0) { MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname3);SSCRUTE(MED_NOM_PVT); goto ERROR; } if ( _MEDattrEntierLire(_datagroup3,MED_NOM_PVI,&_pvit) < 0) { MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname3);SSCRUTE(MED_NOM_PVI); goto ERROR; } _MEDgetComputationStepName(_sortingtype,_pvdt,_pvit,_datagroupname1bis); if ( strncmp(_datagroupname1,_datagroupname1bis,2*MED_MAX_PARA+2) != 0) { MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_COMPUTINGSTEP,_datagroupname1); SSCRUTE(meshname);SSCRUTE(_datagroupname1bis);goto ERROR; } if ( _MEDattributeIntWr(_datagroup3,MED_NOM_PVT,&numdt2) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname3);SSCRUTE(MED_NOM_PVT); goto ERROR; } if ( _MEDattributeIntWr(_datagroup3,MED_NOM_PVI,&numit2) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname3);SSCRUTE(MED_NOM_PVI); goto ERROR; } } } else { /* Création de la première étape de calcul */ /*On crée la nouvelle étape de calcul (au plus tard, après vérifs...) */ if ((_datagroup2 = _MEDdatagroupCreer(_meshid,_datagroupname2)) < 0 ) { MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,_datagroupname2); SSCRUTE(meshname);goto ERROR; } /* Ecriture de MED_NO_IT, MED_NO_DT pour NEXT et PREV de la première étape de calcul */ if ( _MEDattributeIntWr(_datagroup2,MED_NOM_NXT,&numdt2) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname2);SSCRUTE(MED_NOM_NXT); goto ERROR; } if ( _MEDattributeIntWr(_datagroup2,MED_NOM_NXI,&numit2) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname2);SSCRUTE(MED_NOM_NXI); goto ERROR; } if ( _MEDattributeIntWr(_datagroup2,MED_NOM_PVT,&numdt2) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname2);SSCRUTE(MED_NOM_PVT); goto ERROR; } if ( _MEDattributeIntWr(_datagroup2,MED_NOM_PVI,&numit2) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname2);SSCRUTE(MED_NOM_PVI); goto ERROR; } } /*Cree ou ouvre l'attribut MED_NOM_NDT pour écriture */ if ( _MEDattributeIntWr(_datagroup2,MED_NOM_NDT,&numdt2) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname2);SSCRUTE(MED_NOM_NDT); ISCRUTE(numdt2);goto ERROR; } /*Cree ou ouvre l'attribut MED_NOM_PDT pour écriture */ if ( _MEDattrFloatEcrire(_datagroup2,MED_NOM_PDT,&dt2) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname2);SSCRUTE(MED_NOM_PDT); RSCRUTE(dt2);goto ERROR; } /*Cree ou ouvre l'attribut MED_NOM_NOR pour écriture */ if ( _MEDattributeIntWr(_datagroup2,MED_NOM_NOR,&numit2) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname2);SSCRUTE(MED_NOM_NOR); ISCRUTE(numit2); goto ERROR; } /* Une nouvelle étape de calcul est vierge de toute modifiation*/ if ( _MEDattributeIntWr(_datagroup2,MED_NOM_CGT,&_false) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname3);SSCRUTE(MED_NOM_CGT); goto ERROR; } /* Ecriture de NEXT et PREV au niveau meshid (dernière étape de calcul créée */ if ( strncmp(_datagroupname2,_latestcpstname,2*MED_MAX_PARA+2) >= 0) { if ( _MEDattributeIntWr(_meshid,MED_NOM_NXT,&numdt2) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname2);SSCRUTE(MED_NOM_NXT); goto ERROR; } if ( _MEDattributeIntWr(_meshid,MED_NOM_NXI,&numit2) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname2);SSCRUTE(MED_NOM_NXI); goto ERROR; } } _ret = 0; ERROR: 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); } return _ret; }
med_err MEDparameterCr(const med_idt fid, const char * const paramname, const med_parameter_type paramtype, const char* const description, const char * const dtunit ) { med_err _ret=-1; med_idt _root=0,_datagroup1=0; med_access_mode _MED_ACCESS_MODE; char _datagroupname1 [MED_NAME_SIZE+1]=""; med_int _paramtype = (med_int) paramtype; _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 MED_NUM_DATA n'existe pas, on le cree */ if ((_root = _MEDdatagroupOuvrir(fid,MED_NUM_DATA)) < 0) if ((_root = _MEDdatagroupCreer(fid,MED_NUM_DATA)) < 0) { MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,MED_NUM_DATA); goto ERROR; } NOFINALBLANK(paramname,ERROR); /* * Si le Data Group "/NUM_DATA/<paramname>" n'existe pas, on le cree */ if ((_datagroup1 = _MEDdatagroupOuvrir(_root,paramname)) < 0) if ((_datagroup1 = _MEDdatagroupCreer(_root,paramname)) < 0 ) { MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,MED_NUM_DATA); SSCRUTE(paramname);goto ERROR; } /* * Ecriture des infos relatives au parametre : type, dtunit, description */ if ( _MEDattributeIntWr(_datagroup1,MED_NOM_TYP,&_paramtype) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_PARAM_MSG); SSCRUTE(paramname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_TYP); ISCRUTE(_paramtype);goto ERROR; } if ( _MEDattributeStringWr(_datagroup1,MED_NOM_DES,MED_COMMENT_SIZE,description) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_PARAM_MSG); SSCRUTE(paramname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_DES); SSCRUTE(description);goto ERROR; } if ( _MEDattributeStringWr(_datagroup1,MED_NOM_UNT,MED_SNAME_SIZE,dtunit) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_PARAM_MSG); SSCRUTE(paramname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_UNT); SSCRUTE(dtunit);goto ERROR; } _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_NUM_DATA); ISCRUTE_id(_root); } return _ret; }
void _MEDfieldCr30(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 = _MEDdatagroupCreer(_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; } 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; }
med_err MEDmeshAttributeWr(const med_idt fid, const char * const meshname, const med_int isolatednodes, const med_int verticesnodes, const med_int cellmaxnodes) { med_access_mode _MED_ACCESS_MODE; med_err _ret=-1; med_idt _meshid=0; char _path [MED_TAILLE_MAA+MED_NAME_SIZE+1]=MED_MAA; /* * 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 maillage n'existe pas => erreur */ strcat(_path,meshname); if ((_meshid = _MEDdatagroupOuvrir(fid,_path)) < 0) { MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path); ISCRUTE_id(_meshid);goto ERROR; } /* * Creation de l'attribut "Nombre de Noeuds Isoles" */ if ( _MEDattributeIntWr(_meshid,MED_NOM_NNI,&isolatednodes) < 0 ) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(MED_NOM_NNI);ISCRUTE(isolatednodes);goto ERROR; } /* * Creation de l'attribut "Nombre de Noeuds Sommets" */ if ( _MEDattributeIntWr(_meshid,MED_NOM_NNS,&verticesnodes) < 0 ) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(MED_NOM_NNS);ISCRUTE(verticesnodes);goto ERROR; } /* * Creation de l'attribut "Nombre de Noeuds Max par maille" */ if ( _MEDattributeIntWr(_meshid,MED_NOM_NNM,&cellmaxnodes) < 0 ) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(MED_NOM_NNM);ISCRUTE(cellmaxnodes);goto ERROR; } _ret = 0; ERROR: if (_meshid>0) if (_MEDdatagroupFermer(_meshid) < 0) { MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path); ISCRUTE_id(_meshid); } return _ret; }
med_err MEDmeshNodeCoordinateWr(const med_idt fid, const char* const meshname, const med_int numdt, const med_int numit, const med_float dt, const med_switch_mode switchmode, const med_int nentity, const med_float* const coordinate) { med_idt _meshid = 0; med_idt _datagroup1=0,_datagroup2=0,_datagroup3=0,_datagroup_trsf=0; med_idt _dataset_trsf = 0; med_err _ret = -1; med_grid_type _gridtype = MED_UNDEF_GRID_TYPE; med_int _intgridtype = 0; med_int _intmeshtype = 0; med_int _meshdim = 0; char _meshpath [MED_TAILLE_SUP_MAA+MED_NAME_SIZE+1]=""; char _geotypename[MED_TAILLE_NOM_ENTITE+1]=""; char _datagroup_trsfname[MED_TAILLE_NOM_ENTITE+MED_TAILLE_COOTRF+1]=MED_NOM_NOE MED_COOTRF; int _i=0; med_bool _isasupportmesh=MED_FALSE,_isasoftlink=MED_FALSE; med_int _0 = 0; med_int _medintgeotype = MED_NO_GEOTYPE; if (_MEDcheckVersion30(fid) < 0) goto ERROR; /* Ouverture du maillage de calcul ou du maillage support */ 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 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; } /*Sortir en erreur si maillage support et numdt,numit != MED_NO_PDT,MED_NO_IT*/ /* Accès (création éventuelle) du datagroup numdt,numit */ if ( _isasupportmesh ) { if (( numdt != MED_NO_DT) && (numit != MED_NO_IT) ) { MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_PARAMETER,MED_ERR_MESH_MSG); SSCRUTE(meshname);ISCRUTE(numdt);ISCRUTE(numit);goto ERROR; } } else if ( (_datagroup1 =_MEDmeshAssociatedGroupCr(fid, MED_MAA, meshname, numdt, numit, dt,MED_FALSE, "." ) ) < 0 ) { MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDmeshAssociatedGroupCr"); goto ERROR; } /* Création de la structure de connectivité assoiciée aux grilles MED_CURVILLINEAR_GRID*/ 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_int(_gridtype);goto ERROR; } _gridtype= (med_grid_type) _intgridtype; if ( _gridtype == MED_CURVILINEAR_GRID ) { if ((_datagroup2 = _MEDdatagroupOuvrir(_datagroup1,MED_NOM_MAI)) < 0) { if ((_datagroup2 = _MEDdatagroupCreer(_datagroup1,MED_NOM_MAI)) < 0) { MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,MED_NOM_MAI); SSCRUTE(meshname);ISCRUTE(numdt);ISCRUTE(numit); goto ERROR; } if ( _MEDattributeIntWr(_datagroup2,MED_NOM_CGT,&_0) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(MED_NOM_CGT); goto ERROR; } /* Lecture de l'attribut MED_NOM_DIM */ 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; } switch ( _meshdim ) { case 1 : strcpy(_geotypename,MED_NOM_SE2); _medintgeotype = MED_SEG2; break; case 2 : strcpy(_geotypename,MED_NOM_QU4); _medintgeotype = MED_QUAD4; break; case 3 : strcpy(_geotypename,MED_NOM_HE8); break; _medintgeotype = MED_HEXA8; case 0 : strcpy(_geotypename,MED_NOM_PO1); _medintgeotype = MED_POINT1; break; default : MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_PARAMETER,""); SSCRUTE(meshname);ISCRUTE(numdt);ISCRUTE(numit); goto ERROR; } if ((_datagroup3 = _MEDdatagroupCreer(_datagroup2,_geotypename)) < 0) { MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,_geotypename); SSCRUTE(meshname);ISCRUTE(numdt);ISCRUTE(numit); goto ERROR; } if ( _MEDattributeStringWr(_datagroup3,MED_NOM_PFL,MED_NAME_SIZE,MED_NO_PROFILE_INTERNAL) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt); goto ERROR; } if ( _MEDattributeIntWr(_datagroup3,MED_NOM_CGT,&_0) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(MED_NOM_CGT); goto ERROR; } if ( _MEDattributeIntWr(_datagroup3,MED_NOM_CGS,&_0) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(MED_NOM_CGS); goto ERROR; } if (_MEDattributeIntWr(_datagroup3,MED_NOM_GEO,&_medintgeotype) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_NOM_GEO); ISCRUTE(_medintgeotype); goto ERROR; } } } else { MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GRIDTYPE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(MED_NOM_GTY);ISCRUTE_int(_gridtype);goto ERROR; } } /*Réinitialisation du lien MED_TRSF_NOM/MED_COORDINATE_TRSF s'il existe */ /*Si un dataset de transformation existe une erreur est générée par _MEDsoftlinkDel */ if ( !_isasupportmesh) if ((_datagroup_trsf = _MEDdatagroupOuvrir(_datagroup1,_datagroup_trsfname)) > 0) { if ( _MEDisasoftlink(_datagroup_trsf, MED_NOM_TRF,MED_FALSE, &_isasoftlink ) < 0 ) { MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_LINK,MED_NOM_COO); goto ERROR; } if (_isasoftlink ) { if ( _MEDsoftlinkDel(_datagroup_trsf, MED_NOM_TRF, MED_TRUE) < 0 ) { MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDsoftlinkDel"); goto ERROR; } } else { if ( (_dataset_trsf = _MEDdatasetOuvrir(_datagroup_trsf,MED_NOM_TRF)) >= 0 ) { _MEDdatasetFermer(_dataset_trsf); MED_ERR_(_ret,MED_ERR_NULL,MED_ERR_DATASET,MED_NOM_TRF); goto ERROR; } } } /*Ecriture des coordonnées*/ if ( _MEDmeshAdvancedWr(fid, meshname, MED_COORDINATE, MED_NO_NAME, MED_INTERNAL_UNDEF, numdt, numit, dt, MED_NODE, MED_NONE, MED_NO_CMODE, MED_UNDEF_PFLMODE, MED_NO_PROFILE, switchmode, MED_ALL_CONSTITUENT, NULL, nentity, coordinate) < 0 ) { MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDmeshAdvancedWr"); goto ERROR; } _ret = 0; ERROR: if (_datagroup_trsf>0) if (_MEDdatagroupFermer(_datagroup_trsf) < 0) { MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroup_trsfname); ISCRUTE_id(_datagroup_trsf); } if (_datagroup3>0) if (_MEDdatagroupFermer(_datagroup3) < 0) { MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_geotypename); ISCRUTE_id(_datagroup3); } if (_datagroup2>0) if (_MEDdatagroupFermer(_datagroup2) < 0) { MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_NOM_MAI); ISCRUTE_id(_datagroup2); } if (_datagroup1>0) if (_MEDdatagroupFermer(_datagroup1) < 0) { MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_meshpath); ISCRUTE_id(_datagroup1);ISCRUTE(numdt);ISCRUTE(numit); } if (_meshid>0) if (_MEDdatagroupFermer(_meshid) < 0) { MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,meshname); ISCRUTE_id(_meshid); } return _ret; }
med_geometry_type MEDstructElementCr(const med_idt fid, const char* const modelname, const med_int modeldim, const char* const supportmeshname, const med_entity_type sentitytype, const med_geometry_type sgeotype ) { med_access_mode _MED_ACCESS_MODE; med_err _err=-1; med_idt _root=0,_elemid=0; med_int _ret=-1; char _path[MED_TAILLE_STRCT+MED_NAME_SIZE+1]=MED_STRCT; med_size _tmpn=0; med_geometry_type _stgeotype=0; med_int _medintstgeotype = 0; med_int _medintsgeotype = sgeotype; med_int _intentitytype = sentitytype; med_int _nnode=0,_ncell=0; med_bool _chgt=MED_FALSE,_trsf=MED_FALSE; /* char _entitytypename[MED_TAILLE_NOM_ENTITE+1]=""; */ /* * 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 /STRUCT/ n'existe pas, on le cree */ if ((_root = _MEDdatagroupOpen(fid,_path)) < 0) if ((_root = _MEDdatagroupCrOrderCr(fid,_path)) < 0) { MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,_path); goto ERROR; } NOFINALBLANK(modelname,ERROR); /* * Si le DataGroup /STRUCT/<modelname> n'existe pas, on le cree */ if ((_elemid = _MEDdatagroupOpen(_root,modelname)) < 0) { if ((_elemid = _MEDdatagroupCreer(_root,modelname)) < 0) { MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,modelname); SSCRUTE(_path);goto ERROR; } } else { /* * Lecture de l'attribut MED_NOM_NEO (num�ro de type g�om�trique associ� � un �l�ment de structure) */ if ( _MEDattrEntierLire(_elemid,MED_NOM_NEO,&_medintstgeotype) < 0 ) { MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path); SSCRUTE(MED_NOM_NEO);ISCRUTE(_medintstgeotype); goto ERROR; } _stgeotype = _medintstgeotype; } strcat(_path,modelname); /* * Creation/Ecriture de l'attribut MED_NOM_DIM (dimension de l'�l�ment) */ if ( _MEDattributeIntWr(_elemid,MED_NOM_DIM,&modeldim) < 0 ) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,_path); SSCRUTE(MED_NOM_DIM);ISCRUTE(modeldim); goto ERROR; } /* * Creation/Ecriture de l'attribut MED_NOM_NOM (nom du maillage support) */ if ( _MEDattributeStringWr(_elemid,MED_NOM_NOM,MED_NAME_SIZE,supportmeshname) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,_path); SSCRUTE(MED_NOM_NOM);SSCRUTE(supportmeshname); goto ERROR; } /* * Creation/Ecriture de l'attribut MED_NOM_ENT (type d'entit� support) */ /* if (_MEDgetEntityTypeName(_entitytypename,sentitytype) < 0) { */ /* MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG); */ /* ISCRUTE_int(sentitytype);SSCRUTE(_entitytypename);SSCRUTE(_path); */ /* goto ERROR; */ /* } */ if ( _MEDattributeIntWr(_elemid,MED_NOM_ENT,&_intentitytype) < 0 ) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,_path); SSCRUTE(MED_NOM_ENT);ISCRUTE(_intentitytype); goto ERROR; } /* Lecture dans le maillages support du nombre de noeuds S'il n'y a pas de maillage support : 1 */ if (strlen(supportmeshname)) { if ( (_nnode = MEDmeshnEntity(fid,supportmeshname,MED_NO_DT,MED_NO_IT, MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE, &_chgt,&_trsf) ) <= 0) { MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshnEntity"); ISCRUTE(_nnode);goto ERROR; } } else { _nnode=1; } if (strlen(supportmeshname)) { if ( (_ncell = MEDmeshnEntity(fid,supportmeshname,MED_NO_DT,MED_NO_IT, MED_CELL,sgeotype,MED_CONNECTIVITY,MED_NODAL, &_chgt,&_trsf) ) < 0) { MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshnEntity"); ISCRUTE(_ncell);goto ERROR; } } else { _ncell=0; } /* * Creation/Ecriture de l'attribut MED_NOM_GEO (type g�om�trique des mailles support) */ _medintsgeotype = sgeotype; if ( _MEDattributeIntWr(_elemid,MED_NOM_GEO,&_medintsgeotype) < 0 ) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,_path); SSCRUTE(MED_NOM_GEO);ISCRUTE(_medintsgeotype); goto ERROR; } /* * Creation/Ecriture de l'attribut MED_NOM_NAV (nombre d'attributs variables associ�s � un �l�ment de structure) */ /* if ( _MEDattributeIntWr(_elemid,MED_NOM_NAV,&nvariableattribute) < 0 ) { */ /* MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,_path); */ /* SSCRUTE(MED_NOM_NAV);ISCRUTE(nvariableattribute); */ /* goto ERROR; */ /* } */ /* * Creation/Ecriture de l'attribut MED_NOM_NAC (nombre d'attributs constant associ�s � un �l�ment de structure) */ /* if ( _MEDattributeIntWr(_elemid,MED_NOM_NAC,&nconstattribute) < 0 ) { */ /* MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,_path); */ /* SSCRUTE(MED_NOM_NAC);ISCRUTE(nconstattribute); */ /* goto ERROR; */ /* } */ /* * Nombre d'�l�ments de structure */ if ( !_stgeotype ) { /*Si l'�l�ment de struture ne pr�-existait pas, il a �t� cr�e en d�but de proc�dure (il y a au moins 1 �l�ment dans le groupe) */ if ((_err=_MEDnObjects(fid,MED_STRCT,&_tmpn)) <0) { MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_STRUCT,MED_STRCT); goto ERROR; } _stgeotype=_tmpn+MED_STRUCT_GEO_INTERNAL; _medintstgeotype=_stgeotype; /* * Ecriture de l'attribut MED_NOM_NEO (num�ro de type g�om�trique associ� � un �l�ment de structure) */ if ( _MEDattributeIntWr(_elemid,MED_NOM_NEO,&_medintstgeotype) < 0 ) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,_path); SSCRUTE(MED_NOM_NEO);ISCRUTE(_medintstgeotype); goto ERROR; } } _ret = _stgeotype; ERROR: if (_elemid>0) if (_MEDdatagroupFermer(_elemid) < 0) { MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path); ISCRUTE_id(_elemid); } if (_root>0) if (_MEDdatagroupFermer(_root) < 0) { MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_STRCT); ISCRUTE_id(_root); } return _ret; }
med_err _MEDmeshCr(const med_idt fid, const char * const root, const char * const meshname, const med_int spacedim, const med_int meshdim, const med_mesh_type meshtype, const char * const description, const char * const dtunit, const med_sorting_type sortingtype, const med_axis_type axistype, const char * const axisname, const char * const axisunit) { med_access_mode _MED_ACCESS_MODE; med_err _ret=-1; med_idt _root=0,_datagroup1=0; /* _datagroup2=0,_datagroup3=0; */ med_int _intmeshtype = (med_int) meshtype; med_int _intaxistype = (med_int) axistype; char _datagroupname1[MED_NAME_SIZE+1]=""; /* char _geotypename[MED_NAME_SIZE_ENTITE+1]=""; */ med_int _lastnumdt=MED_NO_DT, _lastnumit=MED_NO_IT; med_int _intsortingtype =(med_int) MED_SORT_UNDEF; med_int _intexistingmeshtype=(med_int) MED_UNDEF_MESH_TYPE; med_mesh_type _existingmeshtype = meshtype; med_sorting_type _existingsortingtype = sortingtype; med_size _nstep=0; /* * 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; } if ( sortingtype == MED_SORT_UNDEF) { MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_PARAMETER,"sortingtype"); ISCRUTE_int(sortingtype); goto ERROR; } /* * Si le DataGroup root n'existe pas, on le cree */ if ((_root = _MEDdatagroupOuvrir(fid,root)) < 0) if ((_root = _MEDdatagroupCreer(fid,root)) < 0) { MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,root); goto ERROR; } NOFINALBLANK(meshname,ERROR); /* * Si le Data Group "/MAA.../<meshname>" n'existe pas, on le cree */ if ((_datagroup1 = _MEDdatagroupOuvrir(_root,meshname)) < 0) if ((_datagroup1 = _MEDdatagroupCreer(_root,meshname)) < 0 ) { MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,meshname); goto ERROR; } /* * Creation de l'attribut dimension du maillage */ if (meshdim > spacedim) { MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_PARAMETER,"meshdim"); ISCRUTE(meshdim);ISCRUTE(spacedim); SSCRUTE(root);SSCRUTE(meshname);goto ERROR; } /* * Creation de l'attribut dimension de l'espace */ if ( _MEDattributeIntWr(_datagroup1,MED_NOM_ESP,&spacedim) < 0 ) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_ESP); ISCRUTE(spacedim);goto ERROR; } /* * Creation de l'attribut dimension du maillage */ if ( _MEDattributeIntWr(_datagroup1,MED_NOM_DIM,&meshdim) < 0 ) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_DIM); ISCRUTE(meshdim);goto ERROR; } /* Lecture de l'attribut MED_NOM_TYP */ if (_MEDattrEntierLire(_datagroup1,MED_NOM_TYP,&_intexistingmeshtype) >= 0) _existingmeshtype = (med_mesh_type) (_intexistingmeshtype); if ( _existingmeshtype != meshtype ) { MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_WRITE,MED_ERR_ATTRIBUTE_MSG); SSCRUTE(MED_NOM_TYP);SSCRUTE(meshname);SSCRUTE(_datagroupname1); ISCRUTE_int(_existingmeshtype);ISCRUTE_int(meshtype);goto ERROR; } /* * Creation de l'attribut correspondant au type du maillage (MED_STRUCTURE, MED_NON_STRUCTURE) * L'attribut "TYP" */ if ( _MEDattributeIntWr(_datagroup1,MED_NOM_TYP,&_intmeshtype) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_TYP); ISCRUTE(_intmeshtype);goto ERROR; } /* * La description associee au maillage */ if ( _MEDattributeStringWr(_datagroup1,MED_NOM_DES,MED_COMMENT_SIZE,description) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_DES); SSCRUTE(description);goto ERROR; } /* * Creation de l'attribut nom de l'unit~ des dates */ if ( _MEDattributeStringWr(_datagroup1,MED_NOM_UNT,MED_SNAME_SIZE,dtunit) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_UNT); SSCRUTE(dtunit);goto ERROR; } /* * Test de l'existence de l'attribut de tri des s~quences de calcul */ if ( _MEDattrEntierLire(_datagroup1,MED_NOM_SRT,&_intsortingtype) >= 0) { _existingsortingtype = (med_sorting_type) (_intsortingtype); /* Nombre d'~tapes de calcul existantes */ _MEDnObjects(_datagroup1,".",&_nstep); } if ( (_existingsortingtype != sortingtype) && _nstep ) { MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_COMPUTINGSTEP,MED_ERR_ATTRIBUTE_MSG); SSCRUTE(MED_NOM_SRT);SSCRUTE(meshname);SSCRUTE(_datagroupname1); ISCRUTE_int(_existingsortingtype);ISCRUTE_int(sortingtype);goto ERROR; } /* * Creation de l'attribut de tri des s~quences de calcul */ _intsortingtype = sortingtype; if ( _MEDattributeIntWr(_datagroup1,MED_NOM_SRT,&_intsortingtype) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_SRT); ISCRUTE_int(sortingtype);goto ERROR; } /* * Creation de l'attribut de la derni~re it~ration cr~e */ /* if ( _MEDattributeIntWr(_datagroup1,MED_NOM_NXI,&_lastnumit) < 0) { */ /* MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); */ /* SSCRUTE(meshname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_NXI); */ /* ISCRUTE(_lastnumit);goto ERROR; */ /* } */ /* * L'attribut "REP" */ if ( _MEDattributeIntWr(_datagroup1,MED_NOM_REP,&_intaxistype) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_REP); ISCRUTE(_intaxistype);goto ERROR; } /* * Attribut "NOM" */ if ( _MEDattributeStringWr(_datagroup1,MED_NOM_NOM,spacedim*MED_SNAME_SIZE,axisname) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_NOM); SSCRUTE(axisname);goto ERROR; } /* * Attribut "UNI" */ if ( _MEDattributeStringWr(_datagroup1,MED_NOM_UNI,spacedim*MED_SNAME_SIZE,axisunit) < 0) { MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG); SSCRUTE(meshname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_UNI); SSCRUTE(axisunit);goto ERROR; } /* * Cr~ation du datagroup des mailles associ~es ~ un maillage structur~ * Cel~ permet d'utiliser les routines famille, num~ros/noms optionnels * de la m~me fa~on que pour les maillages non structur~s */ /* if ( meshtype == MED_STRUCTURE ) { */ /* if ((_datagroup2 = _MEDdatagroupCreer(_datagroup1,MED_NOM_MAI)) < 0) { */ /* MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,root); */ /* SSCRUTE(meshname);SSCRUTE(MED_NOM_MAI);goto ERROR; */ /* } */ /* switch ( meshdim ) { */ /* case 1 : strcpy(_geotypename,MED_NOM_SE2); */ /* break; */ /* case 2 : strcpy(_geotypename,MED_NOM_QU4); */ /* break; */ /* case 3 : strcpy(_geotypename,MED_NOM_HE8); */ /* break; */ /* case 0 : strcpy(_geotypename,MED_NOM_PO1); */ /* break; */ /* default : */ /* MED_ERR_(_ret,MED_ERR_RANGE,MED_ERR_PARAMETER,""); */ /* ISCRUTE(meshdim);SSCRUTE(root);SSCRUTE(meshname);goto ERROR; */ /* } */ /* if ((_datagroup3 = _MEDdatagroupCreer(_datagroup2,_geotypename)) < 0) { */ /* MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,_geotypename); */ /* SSCRUTE(root);SSCRUTE(meshname);SSCRUTE(MED_NOM_MAI);ISCRUTE_int(_geotypename); */ /* goto ERROR; */ /* } */ /* } */ /* * Nettoyages divers */ _ret = 0; ERROR: /* if (_datagroup3>0) if (_MEDdatagroupFermer(_datagroup3) < 0) { */ /* MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_geotypename); */ /* ISCRUTE_id(_datagroup3); */ /* } */ /* if (_datagroup2>0) if (_MEDdatagroupFermer(_datagroup2) < 0) { */ /* MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_NOM_MAI); */ /* ISCRUTE_id(_datagroup2); */ /* } */ if (_datagroup1>0) if (_MEDdatagroupFermer(_datagroup1) < 0) { MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,meshname); ISCRUTE_id(_datagroup1); } if (_root>0) if (_MEDdatagroupFermer(_root) < 0) { MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,root); ISCRUTE_id(_root); } return _ret; }