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