MEDfieldComputingStepMeshWr.c
Aller à la documentation de ce fichier.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <med.h>
00020 #include <med_config.h>
00021 #include <med_outils.h>
00022 #include <string.h>
00023
00035 med_err
00036 MEDfieldComputingStepMeshWr(const med_idt fid,
00037 const char * const fieldname,
00038 const med_int numdt,
00039 const med_int numit,
00040 const med_int meshnumdt,
00041 const med_int meshnumit) {
00042
00043 med_access_mode _MED_ACCESS_MODE;
00044 med_err _ret=-1;
00045 med_idt _gid=0;
00046 char _path [(MED_TAILLE_CHA+MED_NAME_SIZE+1)+2*MED_MAX_PARA+1]=MED_CHA;
00047
00048
00049
00050
00051
00052
00053
00054 _MEDmodeErreurVerrouiller();
00055 if (_MEDcheckVersion30(fid) < 0) goto ERROR;
00056
00057 if ( (_MED_ACCESS_MODE = _MEDmodeAcces(fid) ) == MED_ACC_UNDEF ) {
00058 MED_ERR_(_ret,MED_ERR_UNRECOGNIZED,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
00059 goto ERROR;
00060 }
00061
00062 if ( _MED_ACCESS_MODE == MED_ACC_RDONLY) {
00063 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
00064 ISCRUTE_int(_MED_ACCESS_MODE);
00065 goto ERROR;
00066 }
00067
00068
00069
00070
00071 strcat(_path,fieldname);
00072 strcat(_path,"/");
00073 _MEDgetComputationStepName(MED_SORT_DTIT,numdt,numit,&_path[strlen(_path)]);
00074
00075
00076 if ((_gid = _MEDdatagroupOuvrir(fid,_path)) < 0) {
00077 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);
00078 goto ERROR;
00079 }
00080
00081
00082
00083
00084
00085
00086 if (_MEDattributeIntWr(_gid,MED_NOM_RDT, &meshnumdt) < 0) {
00087 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_NOM_RDT);
00088 SSCRUTE(_path);ISCRUTE(meshnumdt);goto ERROR;
00089 }
00090
00091 if (_MEDattributeIntWr(_gid,MED_NOM_ROR, &meshnumit) < 0) {
00092 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_NOM_ROR);
00093 SSCRUTE(_path);ISCRUTE(meshnumit);goto ERROR;
00094 }
00095
00096
00097 _ret = 0;
00098
00099 ERROR:
00100
00101
00102 if (_gid>0) if (_MEDdatagroupFermer(_gid) < 0) {
00103 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
00104 ISCRUTE_id(_gid);
00105 }
00106
00107 return _ret;
00108 }