#define MESGERR 1
#ifdef DEF_LECT_ECR
#define MODE_ACCES MED_LECTURE_ECRITURE
#elif DEF_LECT_AJOUT
#define MODE_ACCES MED_LECTURE_AJOUT
#else
#define MODE_ACCES MED_CREATION
#endif
med_entite_maillage typ_ent_local, med_geometrie_element typ_geo_local,
med_entite_maillage typ_ent_distant, med_geometrie_element typ_geo_distant,
char *type);
int main (
int argc,
char **argv)
{
char maa[MED_TAILLE_NOM+1],maa_dist[MED_TAILLE_NOM+1];
char jnt[MED_TAILLE_NOM+1],corr[MED_TAILLE_NOM+1];
char des[MED_TAILLE_DESC+1];
med_entite_maillage typ_ent_local,typ_ent_distant;
med_geometrie_element typ_geo_local,typ_geo_distant;
int i,j,k;
med_maillage type;
if (argc != 2) {
MESSAGE(
"Il faut passer un fichier MED en paramètre");
return -1;
}
if ((fid = MEDouvrir(argv[1],MED_LECTURE)) < 0) {
return -1;
}
if (MEDmaaInfo(fid,1,maa,&mdim,&type,des) < 0) {
MESSAGE(
"Erreur a lecture des infos sur le 1er maillage");
return -1;
}
printf(
"Maillage de nom %s et de dimension "IFORMAT" \n",maa,mdim);
if ((njnt = MEDnJoint(fid,maa)) < 0) {
MESSAGE(
"Erreur a la lecture du nombre de joints");
return -1;
}
printf(
"Nombre de joints : "IFORMAT" \n",njnt);
if (njnt > 0)
for (i = 0;i<njnt;i++) {
printf("Joint numero : %d \n",i+1);
if (MEDjointInfo(fid,maa,i+1,jnt,des,&ndom,maa_dist) < 0) {
MESSAGE(
"Erreur a la lecture du joint d'indice");
return -1;
}
printf("Nom du joint: %s \n",jnt);
printf("Description du joint : %s \n",des);
printf(
"Domaine en regard : "IFORMAT" \n",ndom);
printf("Maillage distant : %s \n",maa_dist);
afficheCorres(fid,maa,jnt,MED_NOEUD,0,MED_NOEUD,0,
"noeud/noeud");
ncor=1;
while (MEDjointTypeCorres(fid,maa,jnt,ncor,
&typ_ent_local,&typ_geo_local,&typ_ent_distant,&typ_geo_distant)>=0) {
afficheCorres(fid,maa,jnt,typ_ent_local,typ_geo_local,typ_ent_distant,typ_geo_distant,
"noeud/noeud");
ncor++;
}
}
if (MEDfermer(fid) < 0) {
MESSAGE(
"Erreur a la fermeture du fichier ");
return -1;
}
return ret;
}
med_entite_maillage typ_ent_local, med_geometrie_element typ_geo_local,
med_entite_maillage typ_ent_distant, med_geometrie_element typ_geo_distant,
char *type)
{
int k,ncor,ret=0;
if ((nc = MEDjointnCorres(fid,maa,jnt,typ_ent_local,typ_geo_local,typ_ent_distant,typ_geo_distant)) < 0) {
MESSAGE(
"Erreur a la lecture des infos sur le nombre d'entite en regard de type");
return -1;
}
printf(
"nb de couples d'entites en regard %s: "IFORMAT" \n",type,nc);
if (nc > 0) {
if ((ret=MEDjointLire(fid,maa,jnt,cortab,nc*2,
typ_ent_local,typ_geo_local,typ_ent_distant,typ_geo_distant)) < 0) {
MESSAGE(
"Erreur a la lecture des correspondances sur ");
ret = -1;
}
if (ret == 0)
for (k=0;k<nc;k++)
printf(
"Correspondance %d : "IFORMAT" et "IFORMAT" \n",k+1,*(cortab+2*k),
*(cortab+2*k+1));
free(cortab);
}
return ret;
}