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