MEDjointnCorres.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 <string.h>
00024 #include <stdlib.h>
00025
00026 extern int mode_interlace;
00027
00028 med_int
00029 MEDjointnCorres (med_idt fid, char *maa, char *jn,
00030 med_entite_maillage type_ent_local, med_geometrie_element typ_geo_local,
00031 med_entite_maillage type_ent_distant, med_geometrie_element typ_geo_distant)
00032 {
00033 med_entite_maillage _type_ent_local = (med_entite_maillage) ( (int)(type_ent_local) % 10 );
00034 med_entite_maillage _type_ent_distant = (med_entite_maillage) ( (int)(type_ent_distant) % 10 );
00035 med_idt datagroup1=0,datagroup2=0;
00036 med_int n=0, ret=-1;
00037
00038 char chemin[MED_TAILLE_MAA+MED_TAILLE_JNT+2*MED_TAILLE_NOM+1];
00039 char nomdatagroup[MED_TAILLE_NOM_ENTITE*4+3+1];
00040 char tmp[MED_TAILLE_NOM_ENTITE+1];
00041 med_size dimd[1];
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 _MEDmodeErreurVerrouiller();
00057 if (MEDcheckVersion(fid) < 0) return -1;
00058
00059
00060
00061
00062
00063 strcpy(chemin,MED_MAA);
00064 strcat(chemin,maa);
00065 strcat(chemin,MED_JNT);
00066 strcat(chemin,jn);
00067
00068
00069 if ((datagroup1 = _MEDdatagroupOuvrir(fid,chemin)) < 0) {
00070 MESSAGE("Impossible d'ouvrir le datagroup : ");
00071 SSCRUTE(chemin);
00072 goto ERREUR;
00073 }
00074
00075
00076
00077
00078
00079
00080 if ( _MEDnomEntite(nomdatagroup,_type_ent_local) < 0)
00081 goto ERREUR;
00082 if ((_type_ent_local != MED_NOEUD)) {
00083 if ( _MEDnomGeometrie30(tmp,typ_geo_local) < 0) goto ERREUR;
00084 strcat(nomdatagroup,".");
00085 strcat(nomdatagroup,tmp);
00086 }
00087
00088
00089 if ( _MEDnomEntite(tmp,_type_ent_distant) < 0) goto ERREUR;
00090 strcat(nomdatagroup,".");
00091 strcat(nomdatagroup,tmp);
00092 if ((_type_ent_distant != MED_NOEUD)) {
00093 if ( _MEDnomGeometrie30(tmp,typ_geo_distant) < 0) goto ERREUR;
00094 strcat(nomdatagroup,".");
00095 strcat(nomdatagroup,tmp);
00096 }
00097
00098
00099
00100
00101 if ((datagroup2 = _MEDdatagroupOuvrir(datagroup1,nomdatagroup)) < 0 ) goto SORTIE;
00102
00103
00104
00105
00106 if ( _MEDattrEntierLire(datagroup2,MED_NOM_NBR,&n) < 0) {
00107 MESSAGE("Impossible de lire l'attribut NBR : ");
00108 SSCRUTE(chemin);SSCRUTE(MED_NOM_NBR); goto ERREUR;
00109 }
00110
00111
00112
00113
00114
00115 SORTIE:
00116 ret= n;
00117 ERREUR:
00118
00119 if (datagroup2 > 0 ) if ( _MEDdatagroupFermer(datagroup2) < 0) {
00120 MESSAGE("Impossible de fermer le groupe : ");
00121 SSCRUTE(chemin);SSCRUTE(nomdatagroup);ret=-1;
00122 }
00123
00124 if (datagroup1 > 0 ) if ( _MEDdatagroupFermer(datagroup1) < 0) {
00125 MESSAGE("Impossible de fermer le groupe : ");
00126 SSCRUTE(chemin);ret= -1;
00127 }
00128
00129 return (med_int) ret;
00130
00131 }
00132
00133
00134