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_err 
00029 MEDjointLire  (med_idt fid, char *maa, char *jn, med_int *corrtab,med_int n,
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 {
00034   med_entite_maillage _type_ent_local   = (med_entite_maillage) ( (int)(type_ent_local) % 10 );
00035   med_entite_maillage _type_ent_distant = (med_entite_maillage) ( (int)(type_ent_distant) % 10 );
00036   med_idt corrid, datagroup;
00037   med_err ret;
00038   char chemin[MED_TAILLE_MAA+MED_TAILLE_JNT+2*MED_TAILLE_NOM+1]; 
00039   char nomdatagroup[MED_TAILLE_NOM+1+MED_TAILLE_NOM+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   if ((corrid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
00068     return -1;  
00069   
00070   
00071 
00072 
00073 
00074 
00075   if ((ret = _MEDnomEntite(nomdatagroup,_type_ent_local)) < 0)
00076     return -1;
00077   if ((_type_ent_local != MED_NOEUD))
00078     {
00079       if ((ret = _MEDnomGeometrie30(tmp,typ_geo_local)) < 0)
00080         return -1;
00081       strcat(nomdatagroup,".");
00082       strcat(nomdatagroup,tmp);
00083     }
00084 
00085 
00086 
00087   if ((ret = _MEDnomEntite(tmp,_type_ent_distant)) < 0)
00088     return -1;
00089   strcat(nomdatagroup,".");
00090   strcat(nomdatagroup,tmp);
00091   if ((_type_ent_distant != MED_NOEUD))
00092     {
00093       if ((ret = _MEDnomGeometrie30(tmp,typ_geo_distant)) < 0)
00094         return -1;
00095       strcat(nomdatagroup,".");
00096       strcat(nomdatagroup,tmp);
00097     }
00098 
00099 
00100   
00101 
00102 
00103 
00104   if (((datagroup = _MEDdatagroupOuvrir(corrid,nomdatagroup)) < 0) )
00105     return -1;
00106 
00107 
00108 #if defined(HAVE_F77INT64)
00109   if ((ret =  _MEDdatasetNumLire(datagroup,MED_NOM_COR,MED_INT64,
00110                                  MED_NO_INTERLACE,1,MED_ALL,
00111                                  MED_NOPF,MED_NO_PFLMOD,MED_PFL_NON_COMPACT,0,MED_NOPG,0,
00112                                  (unsigned char *) corrtab)) < 0)
00113     return -1;
00114 #else
00115   if ((ret =  _MEDdatasetNumLire(datagroup,MED_NOM_COR,MED_INT32,
00116                                  MED_NO_INTERLACE,1,MED_ALL,
00117                                  MED_NOPF,MED_NO_PFLMOD,MED_PFL_NON_COMPACT,0,MED_NOPG,0,
00118                                  (unsigned char *) corrtab)) < 0)
00119     return -1;
00120 #endif
00121 
00122 
00123   
00124 
00125 
00126   if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
00127     return -1;
00128   if ((ret = _MEDdatagroupFermer(corrid)) < 0)
00129     return -1;
00130 
00131   return 0; 
00132 }
00133 
00134 
00135