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 #include "MAJ_version.h"
00027
00028
00029 int afficheCorres(med_idt fid, const char * const maa, char *jnt,
00030 med_entity_type typ_ent_local, med_geometry_type typ_geo_local,
00031 med_entity_type typ_ent_distant, med_geometry_type typ_geo_distant,
00032 char *type);
00033
00034 med_err MAJ_236_300_joint(med_idt fid, const char * const maa)
00035
00036
00037 {
00038 med_err ret = 0;
00039 char maa_dist[MED_NAME_SIZE+1];
00040 med_int mdim,sdim;
00041 med_int njnt,ncor,ndom,nc;
00042 char jnt[MED_NAME_SIZE+1],corr[MED_NAME_SIZE+1];
00043 char des[MED_COMMENT_SIZE+1];
00044 med_int njstep=0,nodtitncor=0,nentity=0;
00045 med_entity_type typ_ent_local,typ_ent_distant;
00046 med_geometry_type typ_geo_local,typ_geo_distant;
00047 int i,j,k;
00048
00049 MAJ_version_num(fid,2,3,6);
00050
00051
00052 if ((njnt = MEDnSubdomainJoint(fid,maa)) < 0) {
00053 MESSAGE("Erreur a la lecture du nombre de joints");
00054 return -1;
00055 }
00056
00057
00058
00059 for (i = 0;i<njnt;i++) {
00060
00061
00062
00063 if (MEDsubdomainJointInfo(fid,maa,i+1,jnt,des,&ndom,maa_dist,&njstep,&nodtitncor) < 0) {
00064 MESSAGE("Erreur a la lecture du joint d'indice");
00065 ISCRUTE_int(i+1);
00066 return -1;
00067 }
00068
00069
00070
00071
00072
00073
00074
00075 fprintf(stdout," >>> Normalisation du joint [%s] du maillage [%s] \n",
00076 jnt,maa);
00077
00078
00079 MAJ_version_num(fid,3,0,8);
00080 if (MEDsubdomainJointCr(fid,maa,jnt,des,ndom,maa_dist) < 0) {
00081 MESSAGE("Erreur a la creation du joint");
00082 return -1;
00083 }
00084 MAJ_version_num(fid,2,3,6);
00085
00086
00087
00088
00089
00090 ncor=1;
00091
00092 while ( ncor <= nodtitncor ) {
00093
00094 if ( MEDsubdomainCorrespondenceSizeInfo(fid,maa,jnt,MED_NO_DT,MED_NO_IT,ncor,
00095 &typ_ent_local,&typ_geo_local,&typ_ent_distant,&typ_geo_distant,
00096 &nentity) < 0 ) {
00097 MESSAGE("Erreur a la lecture des infos sur le nombre d'entite en regard");
00098 return -1;
00099 }
00100
00101
00102 if ( afficheCorres(fid,maa,jnt,typ_ent_local,typ_geo_local,typ_ent_distant,typ_geo_distant,"------") < 0)
00103 return -1;
00104
00105 ncor++;
00106 }
00107
00108 }
00109 MAJ_version_num(fid,3,0,8);
00110
00111 return ret;
00112 }
00113
00114
00115
00116
00117 int afficheCorres(med_idt fid, const char * const maa, char *jnt,
00118 med_entity_type typ_ent_local, med_geometry_type typ_geo_local,
00119 med_entity_type typ_ent_distant, med_geometry_type typ_geo_distant,
00120 char *type)
00121 {
00122 med_int nc;
00123 med_int *cortab;
00124 int k,ncor,ret=0;
00125
00126 if ( MEDsubdomainCorrespondenceSize(fid,maa,jnt,MED_NO_DT,MED_NO_IT,
00127 typ_ent_local,typ_geo_local,typ_ent_distant,typ_geo_distant,
00128 &nc) < 0) {
00129 MESSAGE("Erreur a la lecture des infos sur le nombre d'entite en regard de type");
00130 SSCRUTE(type);
00131 return -1;
00132 }
00133
00134
00135
00136 if (nc > 0) {
00137 cortab = (med_int*) malloc(sizeof(med_int)*nc*2);
00138 if ((ret=MEDsubdomainCorrespondenceRd(fid,maa,jnt,MED_NO_DT,MED_NO_IT,
00139 typ_ent_local,typ_geo_local,typ_ent_distant,typ_geo_distant,
00140 cortab)) < 0) {
00141 MESSAGE("Erreur a la lecture des correspondances sur ");
00142 SSCRUTE(type);
00143 ret = -1;
00144 }
00145 if (ret == 0) {
00146 MAJ_version_num(fid,3,0,8);
00147 for (k=0;k<nc;k++)
00148
00149
00150
00151 if (MEDsubdomainCorrespondenceWr(fid,maa,jnt,MED_NO_DT,MED_NO_IT,
00152 typ_ent_local,typ_geo_local,typ_ent_distant,typ_geo_distant,
00153 nc,cortab) < 0) {
00154 MESSAGE("Erreur a l'ecriture du tableau des correspondances :");
00155 ret = -1;
00156 }
00157 MAJ_version_num(fid,2,3,6);
00158
00159 }
00160 free(cortab);
00161 }
00162 return ret;
00163 }
00164