MEDglobalNumLire.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
00023 #include <stdlib.h>
00024 #include <string.h>
00025
00026 med_err
00027 MEDglobalNumLire(med_idt fid,char *maa, med_int *num, med_int n,
00028 med_entite_maillage type_ent,med_geometrie_element type_geo)
00029 {
00030 med_idt root=0,maaid=0, entid=0, geoid=0;
00031 med_err ret=-1;
00032 char chemin [MED_TAILLE_MAA+MED_TAILLE_NOM+1];
00033 char nom_ent[MED_TAILLE_NOM_ENTITE+1];
00034 char nom_geo[MED_TAILLE_NOM_ENTITE+1];
00035 med_entite_maillage _type_ent=type_ent;
00036
00037 if ( type_ent == MED_NOEUD_MAILLE ) _type_ent=MED_NOEUD ;
00038
00039
00040
00041
00042 _MEDmodeErreurVerrouiller();
00043 if (MEDcheckVersion(fid) < 0) return -1;
00044
00045
00046
00047
00048
00049 strcpy(chemin,MED_MAA);
00050 strcat(chemin,maa);
00051 if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
00052 goto ERREUR;
00053
00054
00055
00056
00057
00058 if ( _MEDnomEntite(nom_ent,_type_ent ) < 0)
00059 goto ERREUR;
00060
00061
00062
00063
00064 if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
00065 goto ERREUR;
00066
00067
00068
00069
00070
00071 if ((_type_ent==MED_MAILLE)||(_type_ent==MED_FACE)||(_type_ent==MED_ARETE)) {
00072 if ( _MEDnomGeometrie30(nom_geo,type_geo) < 0)
00073 goto ERREUR;
00074 if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
00075 goto ERREUR;
00076 } else
00077 geoid = -1;
00078
00079
00080
00081
00082 if (geoid == -1)
00083 root = entid;
00084 else
00085 root = geoid;
00086
00087 #if defined(HAVE_F77INT64)
00088 if ( _MEDdatasetNumLire(root,MED_NOM_GLB,MED_INT64,
00089 MED_NO_INTERLACE,1,MED_ALL,
00090 MED_NOPF,MED_NO_PFLMOD,MED_PFL_NON_COMPACT,0,MED_NOPG,0,
00091 (unsigned char *)num) < 0 )
00092 goto ERREUR;
00093 #else
00094 if ( _MEDdatasetNumLire(root,MED_NOM_GLB,MED_INT32,
00095 MED_NO_INTERLACE,1,MED_ALL,
00096 MED_NOPF,MED_NO_PFLMOD,MED_PFL_NON_COMPACT,0,MED_NOPG,0,
00097 (unsigned char *)num) < 0 )
00098 goto ERREUR;
00099 #endif
00100
00101 ret = 0;
00102 ERREUR:
00103
00104
00105
00106
00107 if (geoid>0) if (_MEDdatagroupFermer(geoid) < 0) {
00108 MESSAGE("Impossible de fermer le datagroup : ");
00109 ISCRUTE_int(geoid); ret = -1;
00110 }
00111
00112 if (entid>0) if (_MEDdatagroupFermer(entid) < 0) {
00113 MESSAGE("Impossible de fermer le datagroup : ");
00114 ISCRUTE_int(entid); ret = -1;
00115 }
00116
00117 if (maaid>0) if (_MEDdatagroupFermer(maaid) < 0) {
00118 MESSAGE("Impossible de fermer le datagroup : ");
00119 ISCRUTE_int(maaid); ret = -1;
00120 }
00121
00122 return ret;
00123 }
00124
00125
00126
00127
00128
00129
00130
00131