00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef MESGERR
00020 #define MESGERR 1
00021 #endif
00022
00023 #include "med_config.h"
00024 #include "med_outils.h"
00025 #include "med_versioned.h"
00026 #include <string.h>
00027
00028
00029 #include "MAJ_236_300.h"
00030
00031 int MAJ_236_300_entites(med_idt fid,
00032 char * const _pathi,
00033 char * const _pathf,
00034 const char * const meshname,
00035 const med_entity_type enttype)
00036 {
00037 med_err _fret =-1,_ret=-1,ret=-1;
00038 int dummy=0;
00039 med_idt _datagroupi=0,_datagroupf=0;
00040 char _enttypename[MED_TAILLE_NOM_ENTITE+1]="";
00041 char _geotypename[MED_TAILLE_NOM_ENTITE+1]="";
00042 med_geometry_type _geotype = MED_UNDEF_GEOMETRY_TYPE;
00043 med_int _intgeotype = MED_UNDEF_GEOMETRY_TYPE;
00044 med_int _ngeotype = 0;
00045 int _itgeotype = 0;
00046 int _itmplen=0,_isavlen=0;
00047 int _ftmplen=0,_fsavlen=0;
00048 int _tmplen = 0;
00049 med_int _1 = 1;
00050 med_bool _chgt=MED_FALSE, _trsf=MED_FALSE;
00051 char _profilename[MED_NAME_SIZE+1]="";
00052 med_int _profilesize=0;
00053
00054
00055
00056
00057
00058
00059 _MEDmeshnEntity236(dummy,fid, meshname, (med_int) MED_NO_DT, (med_int) MED_NO_IT, enttype, MED_GEO_ALL,
00060 MED_UNDEF_DATATYPE, MED_NO_CMODE,MED_UNDEF_INTERLACE,
00061 _profilename, &_profilesize,&_chgt, &_trsf,&_ngeotype);
00062 if ( _ngeotype < 0) {
00063 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshnEntity");
00064 SSCRUTE(meshname);SSCRUTE(MED_GET_ENTITY_TYPENAME[enttype+1]);
00065 goto ERROR;
00066 }
00067
00068
00069 if (_ngeotype == 0) goto SORTIE;
00070
00071 if (_MEDgetEntityTypeName(_enttypename,enttype) < 0) goto ERROR;
00072
00073
00074
00075 _itmplen=strlen(_pathi);
00076 _ftmplen=strlen(_pathf);
00077 _tmplen = strlen(_enttypename);
00078
00079 strcpy(&_pathi[_itmplen],_enttypename);
00080 strcpy(&_pathf[_ftmplen],_enttypename);
00081 _itmplen += _tmplen;
00082 _ftmplen += _tmplen;;
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 if ( _MEDattributeNumWrByName(fid,_pathi,MED_NOM_CGT,
00095 MED_INTERNAL_INT,(const unsigned char * const) &_1 ) < 0 ) {
00096 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
00097 SSCRUTE(_pathi);SSCRUTE(MED_GET_ENTITY_TYPENAME[enttype+1]);
00098 goto ERROR;
00099 }
00100
00101 if (enttype != MED_NODE ) {
00102 _pathi[_itmplen]='/';++_itmplen;_pathi[_itmplen]='\0';
00103 _pathf[_ftmplen]='/';++_ftmplen;_pathf[_ftmplen]='\0';
00104 }
00105 _isavlen=_itmplen;
00106 _fsavlen=_ftmplen;
00107
00108
00109
00110
00111 for ( _itgeotype=1; _itgeotype <= _ngeotype; ++_itgeotype) {
00112
00113
00114
00115 _MEDmeshEntityInfo236(dummy,fid, meshname, MED_NO_DT, MED_NO_IT, enttype,_itgeotype,
00116 _geotypename,&_geotype,&_fret);
00117 if (_fret < 0) {
00118 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshEntityInfo");
00119 SSCRUTE(meshname);SSCRUTE(MED_GET_ENTITY_TYPENAME[enttype+1]);ISCRUTE_int(_itgeotype);
00120 goto ERROR;
00121 }
00122
00123 _tmplen = strlen(_geotypename);
00124 strcpy(&_pathi[_isavlen],_geotypename);
00125 strcpy(&_pathf[_fsavlen],_geotypename);
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135 _intgeotype = (med_int) _geotype;
00136 if (enttype != MED_NODE )
00137 if ( _MEDattributeNumWrByName(fid,_pathi,MED_NOM_GEO,MED_INTERNAL_INT,
00138 (const unsigned char * const) &_intgeotype) < 0 ) {
00139 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
00140 SSCRUTE(_pathi);SSCRUTE(MED_GET_ENTITY_TYPENAME[enttype+1]);ISCRUTE_int(_itgeotype);
00141 ISCRUTE(_intgeotype);
00142 goto ERROR;
00143 }
00144
00145
00146
00147
00148 if ( _MEDattributeStringWrByName(fid,_pathi,MED_NOM_PFL,MED_NAME_SIZE,MED_NO_PROFILE_INTERNAL) < 0) {
00149 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
00150 SSCRUTE(meshname);SSCRUTE(MED_GET_ENTITY_TYPENAME[enttype+1]);ISCRUTE_int(_itgeotype);
00151 ISCRUTE(_intgeotype);SSCRUTE(MED_NOM_PFL);SSCRUTE(MED_NO_PROFILE_INTERNAL);
00152 goto ERROR;
00153 }
00154
00155
00156
00157
00158
00159 if (enttype != MED_NODE )
00160 if ( _MEDattributeNumWrByName(fid,_pathi,MED_NOM_CGT,MED_INTERNAL_INT,
00161 (const unsigned char * const) &_1 ) < 0 ) {
00162 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
00163 SSCRUTE(_pathi);SSCRUTE(MED_GET_ENTITY_TYPENAME[enttype+1]);
00164 goto ERROR;
00165 }
00166
00167
00168
00169
00170
00171
00172 if ( MAJ_236_300_mesh_datasets(fid, _pathi, _pathf, meshname, enttype, _geotype)< 0) {
00173 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MAJ_236_300_mesh_datasets");
00174 SSCRUTE(_pathi);
00175 goto ERROR;
00176 }
00177
00178 }
00179
00180
00181
00182 _pathi[_isavlen]='\0';
00183 _pathf[_fsavlen]='\0';
00184
00185
00186 ret = H5Gmove(fid, _pathi, _pathf );
00187 EXIT_IF(ret < 0,"Déplacement des entités de type",MED_GET_ENTITY_TYPENAME[enttype+1]);
00188
00189 SORTIE:
00190 _ret=0;
00191 ERROR:
00192 return (int) _ret;
00193 }