00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 #ifndef MESGERR
00062 #define MESGERR 1
00063 #endif
00064
00065 #ifdef __cplusplus
00066 extern "C" {
00067 #endif
00068
00069 #include <med.h>
00070 #include <med_config.h>
00071 #include <med_utils.h>
00072 #include <med_misc.h>
00073 #include <stdio.h>
00074 #include <string.h>
00075 #include <stdlib.h>
00076
00077 #ifdef __cplusplus
00078 }
00079 #endif
00080
00081 #ifdef PPRO_NT
00082 #define F_OK 0
00083 #define snprintf _snprintf
00084 #else
00085 #include <unistd.h>
00086 #endif
00087
00088
00089 extern med_entity_type MED23MESH_GET_ENTITY_TYPE[MED_N_ENTITY_TYPES+2];
00090 extern const char * const MED23MESH_GET_ENTITY_TYPENAME[MED_N_ENTITY_TYPES+2];
00091 extern med_geometry_type MED23MESH_GET_CELL_GEOMETRY_TYPE[MED_N_CELL_FIXED_GEO+2];
00092 extern const char * const MED23MESH_GET_CELL_GEOMETRY_TYPENAME[MED_N_CELL_FIXED_GEO+2];
00093 extern med_geometry_type MED23MESH_GET_FACE_GEOMETRY_TYPE[MED_N_FACE_FIXED_GEO+2];
00094 extern const char * const MED23MESH_GET_FACE_GEOMETRY_TYPENAME[MED_N_FACE_FIXED_GEO+2];
00095 extern med_geometry_type MED23MESH_GET_EDGE_GEOMETRY_TYPE[MED_N_EDGE_FIXED_GEO+2];
00096 extern const char * MED23MESH_GET_EDGE_GEOMETRY_TYPENAME[MED_N_EDGE_FIXED_GEO+2];
00097 extern med_geometry_type MED23MESH_GET_NODE_GEOMETRY_TYPE[MED_N_NODE_FIXED_GEO+2];
00098 extern const char * MED23MESH_GET_NODE_GEOMETRY_TYPENAME[MED_N_NODE_FIXED_GEO+2];
00099
00100 extern med_entity_type MED23FIELD_GET_ENTITY_TYPE[MED_N_ENTITY_TYPES+2];
00101 extern const char * const MED23FIELD_GET_ENTITY_TYPENAME[MED_N_ENTITY_TYPES+2];
00102 extern med_geometry_type MED23FIELD_GET_CELL_GEOMETRY_TYPE[MED_N_CELL_FIXED_GEO+2];
00103 extern const char * const MED23FIELD_GET_CELL_GEOMETRY_TYPENAME[MED_N_CELL_FIXED_GEO+2];
00104 extern med_geometry_type MED23FIELD_GET_FACE_GEOMETRY_TYPE[MED_N_FACE_FIXED_GEO+2];
00105 extern const char * const MED23FIELD_GET_FACE_GEOMETRY_TYPENAME[MED_N_FACE_FIXED_GEO+2];
00106 extern med_geometry_type MED23FIELD_GET_EDGE_GEOMETRY_TYPE[MED_N_EDGE_FIXED_GEO+2];
00107 extern const char * MED23FIELD_GET_EDGE_GEOMETRY_TYPENAME[MED_N_EDGE_FIXED_GEO+2];
00108 extern med_geometry_type MED23FIELD_GET_NODE_GEOMETRY_TYPE[MED_N_NODE_FIXED_GEO+2];
00109 extern const char * MED23FIELD_GET_NODE_GEOMETRY_TYPENAME[MED_N_NODE_FIXED_GEO+2];
00110
00111
00112
00113
00114
00115 int structure = 0;
00116
00117
00118 const med_geometry_type * const typmai = MED23MESH_GET_CELL_GEOMETRY_TYPE+1;
00119 const med_geometry_type * const typfac = MED23MESH_GET_FACE_GEOMETRY_TYPE+1;
00120 const med_geometry_type * const typare = MED23MESH_GET_EDGE_GEOMETRY_TYPE+1;
00121
00122 const char * const *nommai = MED23MESH_GET_CELL_GEOMETRY_TYPENAME+1;
00123 const char * const *nomfac = MED23MESH_GET_FACE_GEOMETRY_TYPENAME+1;
00124 const char * const *nomare = MED23MESH_GET_EDGE_GEOMETRY_TYPENAME+1;
00125
00126 #define MED_LECTURE_MAILLAGE_SUPPORT_UNIQUEMENT 2
00127 #define MED_LECTURE_ENTETE_SEULEMENT 1
00128
00129 #define USER_MODE MED_COMPACT_STMODE
00130
00131 #define xstr(s) str(s)
00132 #define str(s) #s
00133
00134 #define MIN(a,b) ((a) < (b) ? (a) : (b))
00135 #define MAX(a,b) ((a) > (b) ? (a) : (b))
00136
00137 #define MAXBANNERLEN 255
00138
00139 void affd(const void *pva)
00140 {
00141 const double *pa = pva;
00142 printf(" %f ",*pa);
00143 }
00144
00145 void affi(const void *pva)
00146 {
00147 const med_int *pa = pva;
00148
00149
00150 printf(" "IFORMAT" " ,*pa);
00151 }
00152
00153 void affs(const void *pva)
00154 {
00155 const char *pa = pva;
00156 printf(" %.*s ",MED_NAME_SIZE,pa);
00157 }
00158
00159 typedef void (*_myfuncptr)(const void*);
00160
00161 _myfuncptr MEDstructPrintFunction(med_attribute_type atttype) {
00162 switch (atttype) {
00163 case MED_ATT_INT :
00164 return affi;
00165 break;
00166 case MED_ATT_FLOAT64:
00167 return affd;
00168 break;
00169 case MED_ATT_NAME:
00170 return affs;
00171 break;
00172 default:
00173 EXIT_IF(-1,"lors de la lecture du type d'attribut à afficher.",NULL);
00174 return NULL;
00175
00176 }
00177 return NULL;
00178
00179 }
00180
00181 med_int lecture_nombre_famille(med_idt fid,const char * const nommaa)
00182 {
00183 med_int nfam = MEDnFamily(fid,nommaa);
00184 EXIT_IF(nfam < 0,"lors de la lecture du nombre de familles",NULL);
00185 fprintf(stdout,"- Nombre de familles : "IFORMAT" \n",nfam);
00186
00187 return nfam;
00188 }
00189
00190 void lecture_famille_maillage(med_idt fid,const char * const nommaa,med_int nfam)
00191 {
00192 med_int i,j;
00193 med_int natt,ngro;
00194 char *attdes=NULL,*gro=NULL;
00195 med_int *attval=NULL,*attide=NULL;
00196 char nomfam[MED_NAME_SIZE+1];
00197 med_int numfam;
00198 char str1[MED_COMMENT_SIZE+1];
00199 char str2[MED_LNAME_SIZE+1];
00200 med_err ret = 0;
00201 int famille_0 = 0;
00202
00203 if (nfam) {
00204 fprintf(stdout,"\n(**************************)\n");
00205 fprintf(stdout,"(* FAMILLES DU MAILLAGE : *)\n");
00206 fprintf(stdout,"(**************************)\n");
00207 }
00208
00209 for (i=0;i<nfam;i++) {
00210
00211
00212 ngro = MEDnFamilyGroup(fid,nommaa,i+1);
00213 EXIT_IF(ngro < 0,"lors de la lecture du nombre de groupe d'une famille",
00214 NULL);
00215
00216
00217 natt = MEDnFamily23Attribute(fid,nommaa,i+1);
00218 EXIT_IF(natt < 0,"lors de la lecture du nombre d'attributs d'une famille",
00219 NULL);
00220
00221 fprintf(stdout,"- Famille "IFORMAT" a "IFORMAT" attributs et "IFORMAT" groupes \n",i+1,natt,
00222 ngro);
00223
00224
00225
00226
00227 attide = (med_int*) malloc(sizeof(med_int)*natt);
00228 EXIT_IF(attide == NULL,NULL,NULL);
00229 attval = (med_int*) malloc(sizeof(med_int)*natt);
00230 EXIT_IF(attval == NULL,NULL,NULL);
00231 attdes = (char *) malloc(MED_COMMENT_SIZE*natt+1);
00232 EXIT_IF(attdes == NULL,NULL,NULL);
00233 gro = (char*) malloc(MED_LNAME_SIZE*ngro+1);
00234 EXIT_IF(gro == NULL,NULL,NULL);
00235 ret = MEDfamily23Info(fid,nommaa,i+1,nomfam,attide,attval,
00236 attdes,&numfam,gro);
00237 EXIT_IF(ret < 0,"lors de la lecture des informations d'une famille",
00238 NULL);
00239 if (numfam == 0)
00240 famille_0 = 1;
00241
00242 if (!structure) {
00243
00244 fprintf(stdout," - Famille de nom %s et de numero "IFORMAT" : \n",nomfam,numfam);
00245 fprintf(stdout," - Attributs : \n");
00246 for (j=0;j<natt;j++) {
00247 strncpy(str1,attdes+j*MED_COMMENT_SIZE,MED_COMMENT_SIZE);
00248 str1[MED_COMMENT_SIZE] = '\0';
00249 fprintf(stdout," ide = "IFORMAT" - val = "IFORMAT" - des = %s\n",*(attide+j),
00250 *(attval+j),str1);
00251 }
00252 }
00253
00254
00255 if (attide) {free(attide);attide=NULL;}
00256 if (attval) {free(attval);attval=NULL;}
00257 if (attdes) {free(attdes);attdes=NULL;}
00258
00259 if (!structure) {
00260 fprintf(stdout," - Groupes :\n");
00261 for (j=0;j<ngro;j++) {
00262 strncpy(str2,gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
00263 str2[MED_LNAME_SIZE] = '\0';
00264 fprintf(stdout," gro = %s\n",str2);
00265 }
00266 }
00267
00268
00269 if (gro) {free(gro);gro=NULL;}
00270 }
00271
00272 if (famille_0 != 1) {
00273 MESSAGE("Erreur : La famille FAMILLE_ZERO n'a pas été trouvée, elle est obligatoire. ");
00274 }
00275
00276 return;
00277 }
00278
00279 med_int lecture_nombre_equivalence(med_idt fid,const char * const nommaa)
00280 {
00281 med_int nequ = MEDnEquivalence(fid,nommaa);
00282 EXIT_IF(nequ < 0,"lors de la lecture du nombre d'equivalences",NULL);
00283 fprintf(stdout,"- Nombre d'equivalences : "IFORMAT" \n",nequ);
00284
00285 return nequ;
00286 }
00287
00288
00289 void lecture_equivalence_maillage(med_idt fid,const char * const nommaa,med_int nequ)
00290 {
00291 med_int i,j,k;
00292 med_int ncor;
00293 med_int *cor;
00294 char equ[MED_NAME_SIZE+1];
00295 char des[MED_COMMENT_SIZE+1];
00296 med_err ret = 0;
00297 med_int nstep=0,nocstpncor=0;
00298 int _cstpit=0;
00299 med_int _numdt,_numit;
00300
00301
00302 if ( (nequ != 0) ) {
00303 fprintf(stdout,"\n(******************************)\n");
00304 fprintf(stdout,"(* EQUIVALENCES DU MAILLAGE : *)\n");
00305 fprintf(stdout,"(******************************)\n");
00306 }
00307
00308
00309 for (i = 0;i<nequ;i++) {
00310
00311
00312 ret = MEDequivalenceInfo(fid,nommaa,i+1,equ,des,&nstep,&nocstpncor);
00313 EXIT_IF(ret < 0,"lors de la lecture des informations sur une equivalence",
00314 NULL);
00315
00316
00317 fprintf(stdout,"- Equivalence numero : "IFORMAT" ",i+1);
00318 fprintf(stdout,"\n - Nom de l'equivalence: %s \n",equ);
00319 fprintf(stdout,"\n - Description de l'equivalence : %s \n",des);
00320 if (nstep > 1)
00321 fprintf(stdout,"\n - L'equivalence est définie sur "IFORMAT" étapes de calcul\n",nstep);
00322
00323
00324 for (_cstpit=1; _cstpit <= nstep; ++_cstpit) {
00325
00326 ret = MEDequivalenceComputingStepInfo (fid, nommaa, equ, _cstpit,
00327 & _numdt, &_numit,&nocstpncor);
00328 EXIT_IF(ret < 0,
00329 "lors de la lecture des valeurs de séquence de calcul d'une equivalence",
00330 NULL);
00331
00332 if ( (_numdt != MED_NO_DT) || (_numit != MED_NO_IT) )
00333 fprintf(stdout,"\n - Séquence de calcul définie sur (numdt,numit) ("IFORMAT","IFORMAT") :\n",_numdt,_numit);
00334
00335
00336
00337
00338 ret = MEDequivalenceCorrespondenceSize(fid,nommaa,equ,_numdt,_numit,MED_NODE,MED_NONE,&ncor);
00339 EXIT_IF(ret < 0,
00340 "lors de la lecture du nombre de correspondances d'une equivalence",
00341 NULL);
00342 fprintf(stdout,"\n - Il y a "IFORMAT" correspondances sur les noeuds \n",ncor);
00343
00344 if (ncor > 0) {
00345
00346
00347 cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
00348 EXIT_IF(cor == NULL,NULL,NULL);
00349 ret= MEDequivalenceCorrespondenceRd(fid,nommaa,equ,_numdt,_numit,
00350 MED_NODE,MED_NONE,cor);
00351 EXIT_IF(ret < 0,"lors de la lecture du tableau des correspondances",
00352 NULL);
00353 if (!structure) {
00354 for (j=0;j<ncor;j++)
00355 fprintf(stdout,"\n - Correspondance "IFORMAT" : "IFORMAT" et "IFORMAT" \n",j+1,*(cor+2*j),
00356 *(cor+2*j+1));
00357 }
00358 free(cor);
00359 }
00360
00361
00362 for (j=0;j<MED_N_CELL_FIXED_GEO;j++) {
00363
00364 ret = MEDequivalenceCorrespondenceSize(fid,nommaa,equ,_numdt,_numit,MED_CELL,typmai[j],&ncor);
00365 EXIT_IF(ret < 0,
00366 "lors de la lecture du nombre de correspondances dans une equivalence",
00367 NULL);
00368 fprintf(stdout,"\n - Il y a "IFORMAT" correspondances sur les mailles %s \n",ncor,
00369 nommai[j]);
00370
00371 if (ncor > 0) {
00372
00373
00374 cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
00375 EXIT_IF(cor == NULL,NULL,NULL);
00376 ret = MEDequivalenceCorrespondenceRd(fid,nommaa,equ,_numdt,_numit,
00377 MED_CELL,typmai[j],cor);
00378 EXIT_IF(ret < 0,"lors de la lecture du tableau des equivalences",
00379 NULL);
00380
00381 if (!structure) {
00382 for (k=0;k<ncor;k++)
00383 fprintf(stdout,"\n - Correspondance "IFORMAT" : "IFORMAT" et "IFORMAT" \n",k+1,
00384 *(cor+2*k),*(cor+2*k+1));
00385 }
00386 free(cor);
00387 }
00388 }
00389
00390
00391
00392 for (j=0;j<MED_N_FACE_FIXED_GEO;j++) {
00393
00394 ret = MEDequivalenceCorrespondenceSize(fid,nommaa,equ,_numdt,_numit,
00395 MED_DESCENDING_FACE,typfac[j],&ncor);
00396
00397 EXIT_IF(ret < 0,
00398 "lors de la lecture du nombre de correspondances dans une equivalence",
00399 NULL);
00400 fprintf(stdout,"\n - Il y a "IFORMAT" correspondances sur les faces %s\n",ncor,
00401 nomfac[j]);
00402
00403 if (ncor > 0) {
00404
00405
00406 cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
00407 EXIT_IF(cor == NULL,NULL,NULL);
00408 ret = MEDequivalenceCorrespondenceRd(fid,nommaa,equ,_numdt,_numit,
00409 MED_DESCENDING_FACE,typfac[j],cor);
00410 EXIT_IF(ret < 0,"lors de la lecture du tableau des equivalences",
00411 NULL);
00412
00413 if (!structure) {
00414 for (k=0;k<ncor;k++)
00415 fprintf(stdout,"\n - Correspondance "IFORMAT" : "IFORMAT" et "IFORMAT" \n",k+1,*(cor+2*k),
00416 *(cor+2*k+1));
00417 }
00418 free(cor);
00419 }
00420 }
00421
00422
00423
00424 for (j=0;j<MED_N_NODE_FIXED_GEO;j++) {
00425
00426 ret = MEDequivalenceCorrespondenceSize(fid,nommaa,equ,_numdt,_numit,
00427 MED_DESCENDING_EDGE,typare[j],&ncor);
00428 EXIT_IF(ret < 0,"lors de la lecture du nombre de correspondances",
00429 NULL);
00430 fprintf(stdout,"\n - Il y a "IFORMAT" correspondances sur les aretes %s \n",
00431 ncor,nomare[j]);
00432
00433 if (ncor > 0) {
00434
00435
00436 cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
00437 EXIT_IF(cor == NULL,NULL,NULL);
00438 ret =MEDequivalenceCorrespondenceRd(fid,nommaa,equ,_numdt,_numit,
00439 MED_DESCENDING_EDGE,typare[j],cor);
00440 EXIT_IF(ret < 0,"lors de la lecture du tableau des equivalences",
00441 NULL);
00442
00443 if (!structure) {
00444 for (k=0;k<ncor;k++)
00445 fprintf(stdout,"\n Correspondance "IFORMAT" : "IFORMAT" et "IFORMAT" \n",k+1,*(cor+2*k),
00446 *(cor+2*k+1));
00447 }
00448
00449 free(cor);
00450 }
00451 }
00452 }
00453 }
00454
00455 return;
00456 }
00457
00458
00459 med_int lecture_nombre_joint(med_idt fid,const char * const nommaa)
00460 {
00461 med_int njnt = MEDnSubdomainJoint(fid,nommaa);
00462 EXIT_IF(njnt < 0,"lors de la lecture du nombre de joints",NULL);
00463 fprintf(stdout,"- Nombre de joints : "IFORMAT" \n",njnt);
00464
00465 return njnt;
00466 }
00467
00468
00469 void lecture_joint_maillage(med_idt fid,const char * const nommaa,med_int njnt)
00470 {
00471 med_int i,k;
00472 char des[MED_COMMENT_SIZE+1];
00473 med_int ndom,nent;
00474 med_int typ_ent_local,typ_geo_local,typ_ent_distant,typ_geo_distant;
00475
00476
00477 char jn [MED_NAME_SIZE+1]="";
00478 char maa_dist [MED_NAME_SIZE+1]="";
00479 char nom_geo_ent_local [MED_NAME_SIZE+1]="";
00480 char nom_geo_ent_distant [MED_NAME_SIZE+1]="";
00481 med_int *cortab;
00482
00483 med_err ret = 0;
00484 med_int njstep=0,ncor=0,nodtitncor=0;
00485 int corit=0,csit=0;
00486 med_int _numdt,_numit;
00487
00488 if ( (njnt != 0) ) {
00489 fprintf(stdout,"\n(******************************)\n");
00490 fprintf(stdout,"(* JOINTS DU MAILLAGE : *)\n");
00491 fprintf(stdout,"(******************************)\n");
00492 }
00493
00494
00495 for (i = 0;i<njnt;i++) {
00496 fprintf(stdout,"- Joint numero : "IFORMAT" ",i+1);
00497
00498
00499 ret = MEDsubdomainJointInfo(fid,nommaa,i+1,jn,des,&ndom,maa_dist,&njstep,&nodtitncor);
00500 EXIT_IF(ret < 0,"lors de la lecture des informations sur un joint",
00501 NULL);
00502
00503 fprintf(stdout,"\n - Nom du joint: %s \n",jn);
00504 fprintf(stdout,"\n - Description du joint : %s ",des);
00505 fprintf(stdout,"\n - Domaine en regard : "IFORMAT" ",ndom);
00506 fprintf(stdout,"\n - Maillage distant : %s ",maa_dist);
00507 if (njstep > 1 ) {
00508 printf("Nombre d'étapes de calcul : "IFORMAT" \n",njstep);
00509 printf("Nombre de correspondance pour (NO_DT,NO_IT) : "IFORMAT" \n",nodtitncor);
00510 }
00511
00512 for (csit=1; csit <= njstep; ++csit) {
00513
00514 ret = MEDsubdomainComputingStepInfo( fid, nommaa, jn, csit, &_numdt, &_numit, &ncor);
00515 EXIT_IF(ret < 0,"Erreur a la lecture des valeurs (numdt,numit) dans les joints",
00516 NULL);
00517 if ( (_numdt != MED_NO_DT) || (_numit != MED_NO_IT) ) {
00518 printf("Séquence de calcul (numdt,numit) : ("IFORMAT","IFORMAT")\n",_numdt,_numit);
00519 }
00520 corit=1;
00521 while ( corit <= ncor ) {
00522
00523 ret = MEDsubdomainCorrespondenceSizeInfo(fid,nommaa,jn,_numdt,_numit,corit,
00524 (med_entity_type *) &typ_ent_local, (med_geometry_type *) &typ_geo_local,
00525 (med_entity_type *) &typ_ent_distant,(med_geometry_type *)&typ_geo_distant,
00526 &nent);
00527 EXIT_IF(ret < 0,"Erreur a la lecture des infos sur le nombre d'entite en regard",
00528 NULL);
00529 if (nent > 0) {
00530 if (typ_ent_local == MED_NODE) strcpy(nom_geo_ent_local,"MED_NOEUD");
00531 else ret = _MEDgetInternalGeometryTypeName(nom_geo_ent_local,typ_geo_local);
00532 EXIT_IF(ret < 0,"Erreur à l'appel de _MEDgetInternalGeometryTypeName", NULL);
00533 if (typ_ent_distant == MED_NODE) strcpy(nom_geo_ent_distant,"MED_NOEUD");
00534 else ret = _MEDgetInternalGeometryTypeName(nom_geo_ent_distant,typ_geo_distant);
00535 EXIT_IF(ret < 0,"Erreur à l'appel de _MEDgetInternalGeometryTypeName", NULL);
00536 fprintf(stdout,"\n\t\t- nb de couples d'entites en regard (local,distant)=(%s,%s) : "IFORMAT" \n",
00537 nom_geo_ent_local,nom_geo_ent_distant, nent);
00538
00539
00540 cortab = (med_int*) malloc(sizeof(med_int)*nent*2);
00541 if ( (ret=MEDsubdomainCorrespondenceRd(fid,nommaa,jn,_numdt,_numit,
00542 typ_ent_local,typ_geo_local,typ_ent_distant,typ_geo_distant,
00543 cortab)) < 0) {
00544 fprintf(stdout,"\n\t\t- Erreur a la lecture des correspondances sur (%s,%s,%s,%s)",
00545 MED23MESH_GET_ENTITY_TYPENAME[typ_ent_local+1],nom_geo_ent_local,
00546 MED23MESH_GET_ENTITY_TYPENAME[typ_ent_distant+1],nom_geo_ent_distant);
00547 } else {
00548 if (!structure) {
00549 for (k=0;k<nent;k++)
00550 fprintf(stdout,"\n\t\t- Correspondance "IFORMAT" : "IFORMAT" et "IFORMAT" ",k+1,
00551 *(cortab+2*k),*(cortab+2*k+1));
00552 }
00553 }
00554 free(cortab);
00555 }
00556
00557 corit++;
00558 }
00559 }
00560 }
00561
00562 return;
00563 }
00564
00565
00566 med_int lecture_nombre_noeuds_maillage_non_structure(const med_idt fid,
00567 const char * nommaa,
00568 const med_int numdt,
00569 const med_int numit)
00570 {
00571
00572
00573 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
00574
00575 med_int nnoe = MEDmeshnEntity(fid,nommaa,numdt,numit,
00576 MED_NODE,MED_NO_GEOTYPE,
00577 MED_COORDINATE,MED_NODAL,&chgt,&trsf);
00578 EXIT_IF(nnoe < 0,"lors de la lecture du nombre de noeuds",NULL);
00579 fprintf(stdout,"- Nombre de noeuds : "IFORMAT" \n",nnoe);
00580
00581 return nnoe;
00582 }
00583
00584
00585 void lecture_noeuds_maillage_non_structure(const med_idt fid,
00586 const char * const nommaa,
00587 const med_int numdt,
00588 const med_int numit,
00589 const med_int mdim,
00590 const med_int edim,
00591 const med_int nnoe,
00592 const med_switch_mode mode_coo,
00593 const char * const nomcoo,
00594 const char * const unicoo,
00595 const med_axis_type *const rep)
00596 {
00597 med_float *coo;
00598 char *nomnoe;
00599 med_int *numnoe;
00600 med_int *nufano;
00601 med_bool inonoe,inunoe,ifano;
00602 med_err ret = 0;
00603 med_int i;
00604 char str[MED_SNAME_SIZE+1];
00605
00606
00607
00608
00609
00610 coo = (med_float*) malloc(sizeof(med_float)*nnoe*edim);
00611 EXIT_IF(coo == NULL,NULL,NULL);
00612
00613
00614 numnoe = (med_int*) malloc(sizeof(med_int)*nnoe);
00615 EXIT_IF(numnoe == NULL,NULL,NULL);
00616 nufano = (med_int*) malloc(sizeof(med_int)*nnoe);
00617 EXIT_IF(nufano == NULL,NULL,NULL);
00618
00619
00620 nomnoe = (char*) malloc(MED_SNAME_SIZE*nnoe+1);
00621 EXIT_IF(nomnoe == NULL,NULL,NULL);
00622
00623
00624
00625
00626
00627
00628 ret = MEDmeshNodeRd(fid,nommaa,numdt,numit, mode_coo, coo,
00629 &inonoe,nomnoe,&inunoe,numnoe,&ifano,nufano);
00630
00631
00632 EXIT_IF(ret < 0,"lors de la lecture des noeuds du maillage \n",NULL);
00633
00634
00635 if (nnoe) {
00636 fprintf(stdout,"\n(************************)\n");
00637 fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n");
00638 fprintf(stdout,"(************************)\n\n");
00639 }
00640 if (!structure) {
00641 fprintf(stdout,"- Type de repere des coordonnees : %d \n",*rep);
00642 fprintf(stdout,"- Nom des coordonnees : \n");
00643 for (i=0;i<edim;i++) {
00644 strncpy(str,nomcoo+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
00645 str[MED_SNAME_SIZE] = '\0';
00646 fprintf(stdout," %s ",str);
00647 }
00648 fprintf(stdout,"\n- Unites des coordonnees : \n");
00649 for (i=0;i<edim;i++) {
00650 strncpy(str,unicoo+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
00651 str[MED_SNAME_SIZE] = '\0';
00652 fprintf(stdout," %s ",str);
00653 }
00654 fprintf(stdout,"\n- Coordonnees des noeuds : ");
00655 for (i=0;i<nnoe*edim;i++) {
00656 if (mode_coo == MED_FULL_INTERLACE && !(i % edim))
00657 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (i/edim + 1) );
00658 if (mode_coo == MED_NO_INTERLACE && ! (i % nnoe))
00659 fprintf(stdout,"\n\n ");
00660 fprintf(stdout," %-+9.6f ",*(coo+i));
00661 }
00662
00663 if (inonoe) {
00664 fprintf(stdout,"\n- Noms des noeuds : \n");
00665 for (i=0;i<nnoe;i++) {
00666 strncpy(str,nomnoe+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
00667 str[MED_SNAME_SIZE] = '\0';
00668 fprintf(stdout," %s ",str);
00669 }
00670 }
00671 if (inunoe) {
00672 fprintf(stdout,"\n- Numeros des noeuds : \n");
00673 for (i=0;i<nnoe;i++)
00674 fprintf(stdout," "IFORMAT" ",*(numnoe+i));
00675 }
00676
00677 fprintf(stdout,"\n- Numeros des familles des noeuds : \n");
00678 for (i=0;i<nnoe;i++) {
00679 if (ifano)
00680 fprintf(stdout," "IFORMAT" ",*(nufano+i));
00681 else
00682 fprintf(stdout," %d ",0);
00683 }
00684 fprintf(stdout,"\n");
00685 }
00686
00687
00688
00689 free(coo);
00690 free(nomnoe);
00691 free(numnoe);
00692 free(nufano);
00693
00694 return;
00695 }
00696
00697
00698 med_int lecture_nombre_mailles_standards(const med_idt fid,
00699 const char * const nommaa,
00700 const med_int numdt,
00701 const med_int numit,
00702 const med_geometry_type typ_geo,
00703 const med_connectivity_mode typ_con,
00704 const int indice)
00705 {
00706
00707 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
00708
00709 med_int nmailles = MEDmeshnEntity(fid,nommaa,numdt,numit,
00710 MED_CELL,typ_geo,
00711 MED_CONNECTIVITY,typ_con,&chgt,&trsf);
00712 EXIT_IF(nmailles < 0," lors de la lecture du nombre de mailles",NULL);
00713
00714 if ( (indice < (MED_N_CELL_GEO_FIXED_CON-5) ) ||
00715 (indice >= (MED_N_CELL_GEO_FIXED_CON-5) && (nmailles > 0) ) )
00716 if (nmailles)
00717 fprintf (stdout,"- Nombre de mailles de type %s : "IFORMAT" \n",nommai[indice],
00718 nmailles);
00719
00720 return nmailles;
00721 }
00722
00723 med_int lecture_nombre_et_type_mailles_elstruct(const med_idt fid,
00724 const char * const nommaa,
00725 const med_int numdt,
00726 const med_int numit,
00727 const int indice,
00728 med_geometry_type* geotype,
00729 char* geotypename
00730 )
00731 {
00732 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
00733 med_err _ret=-1;
00734 med_int _nmailles=0;
00735
00736 _ret = MEDmeshEntityInfo(fid,nommaa,numdt,numit, MED_STRUCT_ELEMENT,
00737 indice+1,geotypename,geotype );
00738 EXIT_IF(_ret<0,
00739 "Erreur à la demande d'informations pour le type d'entités MED_STRUCT_ELEMENT",NULL);
00740
00741 _nmailles = MEDmeshnEntity(fid,nommaa,numdt,numit,
00742 MED_STRUCT_ELEMENT,*geotype,
00743 MED_CONNECTIVITY,MED_NODAL,&chgt,&trsf);
00744
00745 EXIT_IF(_nmailles < 0," lors de la lecture du nombre de mailles",NULL);
00746
00747 if (_nmailles)
00748 fprintf (stdout,"- Nombre de mailles de type %s : "IFORMAT" \n",geotypename, _nmailles);
00749
00750 return _nmailles;
00751 }
00752
00753 void lecture_mailles_elstruct(const med_idt fid,
00754 const char * const nommaa,
00755 const med_int numdt,
00756 const med_int numit,
00757 const med_int nmodels,
00758 const med_geometry_type* const geotype,
00759 const char* const geotypename,
00760 const med_int * const nmailles,
00761 const med_switch_mode mode_coo)
00762 {
00763 med_err _ret=-1;
00764 med_int taille=0;
00765 char str[MED_SNAME_SIZE+1];
00766
00767 med_int *connectivite;
00768 char *nomele;
00769 med_int *numele;
00770 med_int *nufael;
00771 med_bool inoele=MED_FALSE, inuele=MED_FALSE, inufael=MED_FALSE;
00772
00773 med_geometry_type _geotype=MED_NONE;
00774 med_int _elementdim=0;
00775 char _supportmeshname[MED_NAME_SIZE+1]="";
00776 med_entity_type _entitytype=MED_UNDEF_ENTITY_TYPE;
00777 med_int _nbofnode=0;
00778 med_int _nbofcell=0;
00779 med_entity_type _geocelltype=MED_NONE;
00780 med_int _nbofconstantatribute=0;
00781 med_bool _anyprofile=0;
00782 med_int _nbofvariableattribute=0;
00783
00784 char _attname[MED_NAME_SIZE+1]="";
00785 med_attribute_type _atttype;
00786 med_int _atttypesize=0;
00787 med_int _attvaluesize=0;
00788 med_int _nattcomp=0;
00789 void *_attvalue=NULL;
00790 void (*_printf)(const void*);
00791 int i=0,j=0,k=0;
00792 med_int dispbanner=MED_FALSE;
00793
00794 for (i=0; i<nmodels; i++ ) {
00795
00796 _ret = MEDstructElementInfoByName(fid, &geotypename[i*(MED_NAME_SIZE+1)],
00797 &_geotype,&_elementdim,
00798 _supportmeshname,&_entitytype,&_nbofnode,&_nbofcell,
00799 &_geocelltype,&_nbofconstantatribute,&_anyprofile,&_nbofvariableattribute);
00800
00801 if (_nbofcell > 0 )
00802 taille=_nbofcell*_geocelltype%100;
00803 else
00804 taille = _nbofnode;
00805
00806
00807
00808
00809
00810
00811
00812 connectivite = (med_int*) calloc(taille*nmailles[i],sizeof(med_int));
00813 EXIT_IF(connectivite == NULL,NULL,NULL);
00814 nomele = (char*) malloc(sizeof(char)*MED_SNAME_SIZE*nmailles[i]+1);
00815 EXIT_IF(nomele == NULL,NULL,NULL);
00816 numele = (med_int*) malloc(sizeof(med_int)*nmailles[i]);
00817 EXIT_IF(numele == NULL,NULL,NULL);
00818 nufael = (med_int*) malloc(sizeof(med_int)*nmailles[i]);
00819 EXIT_IF(nufael == NULL,NULL,NULL);
00820
00821
00822 _ret = MEDmeshElementRd( fid,nommaa,numdt,numit,MED_STRUCT_ELEMENT,geotype[i],
00823 MED_NODAL, mode_coo, connectivite,
00824 &inoele,nomele,&inuele,numele,&inufael,nufael );
00825
00826 EXIT_IF(_ret < 0,"lors de la lecture des mailles",NULL);
00827
00828
00829 if ( !dispbanner) {
00830 fprintf(stdout,"\n(***************************************)\n");
00831 fprintf(stdout, "(* ELEMENTS DE STRUCTURE DU MAILLAGE : *)\n");
00832 fprintf(stdout, "(***************************************)\n");
00833 dispbanner=MED_TRUE;
00834 }
00835 if (!structure) {
00836
00837 fprintf(stdout,"\n- Mailles de type %s : ", &geotypename[i*(MED_NAME_SIZE+1)]);
00838 if (strcmp(&geotypename[i*(MED_NAME_SIZE+1)],"MED_PARTICLE") ) {
00839 fprintf(stdout,"\n - Connectivité : ");
00840 for (j=0;j<nmailles[i]*taille;j++) {
00841 if (mode_coo == MED_FULL_INTERLACE && !(j % taille))
00842 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/taille +1) );
00843 if (mode_coo == MED_NO_INTERLACE && !(j % nmailles[i]))
00844 fprintf(stdout,"\n");
00845 fprintf(stdout," %9"MED_IFORMAT" ",*(connectivite+j));
00846 }
00847 }
00848
00849 if (inoele) {
00850 fprintf(stdout,"\n - Noms : \n");
00851 for (j=0;j<nmailles[i];j++) {
00852 strncpy(str,nomele+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
00853 str[MED_SNAME_SIZE] = '\0';
00854 fprintf(stdout," %s ",str);
00855 }
00856 }
00857 if (inuele) {
00858 fprintf(stdout,"\n - Numeros :\n");
00859 for (j=0;j<nmailles[i];j++)
00860 fprintf(stdout," "IFORMAT" ",*(numele+j));
00861 }
00862 fprintf(stdout,"\n - Numéros de familles : \n");
00863 for (j=0;j<nmailles[i];j++)
00864 if (inufael)
00865 fprintf(stdout," "IFORMAT" ",*(nufael+j));
00866 else
00867 fprintf(stdout," %d ",0);
00868 fprintf(stdout,"\n");
00869 }
00870
00871
00872
00873 for (k=0; k<_nbofvariableattribute; k++) {
00874
00875
00876 _ret = MEDstructElementVarAttInfo(fid, &geotypename[i*(MED_NAME_SIZE+1)], k+1,
00877 _attname, &_atttype, &_nattcomp);
00878 EXIT_IF(_ret < 0,"lors de la lecture des caractéristiques de attributs variables",NULL);
00879
00880
00881 _atttypesize = MEDstructElementAttSizeof(_atttype);
00882 _attvaluesize = nmailles[i]*_nattcomp*_atttypesize;
00883 if ( _atttype == MED_ATT_NAME) ++_attvaluesize;
00884 _attvalue = (void *) malloc( _attvaluesize*sizeof(char));
00885 --_attvaluesize;
00886
00887
00888 _ret =MEDmeshStructElementVarAttRd(fid, nommaa, numdt, numit,
00889 *(geotype+i), _attname, _attvalue );
00890 if (_ret < 0 ) free(_attvalue);
00891 EXIT_IF(_ret < 0,"lors de la lecture des attributs variables",NULL);
00892
00893 _printf=MEDstructPrintFunction(_atttype);
00894
00895 if (!structure) {
00896 fprintf(stdout,"\n - Valeurs de l'attribut |%s| pour le type géométrique |%s| : \n",_attname,
00897 &geotypename[i*(MED_NAME_SIZE+1)]);
00898 for (j=0;j<nmailles[i]*_nattcomp;j++) {
00899 if ( ( _nattcomp > 1 ) && !(j % _nattcomp) )
00900 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/_nattcomp +1) );
00901 _printf( (void *)( (char *)(_attvalue) + j*_atttypesize) );
00902 }
00903 }
00904
00905 free(_attvalue);
00906
00907 }
00908
00909
00910 free(connectivite);
00911 free(nomele);
00912 free(numele);
00913 free(nufael);
00914 }
00915
00916 return;
00917 }
00918
00919 void lecture_mailles_standards(const med_idt fid,
00920 const char *nommaa,
00921 const med_int numdt,
00922 const med_int numit,
00923 const med_int mdim,
00924 const med_int * const nmailles,
00925 const med_switch_mode mode_coo,
00926 const med_connectivity_mode typ_con)
00927 {
00928 med_int taille;
00929 med_int *connectivite;
00930 char *nomele;
00931 med_int *numele;
00932 med_int *nufael;
00933 med_bool inoele=MED_FALSE, inuele=MED_FALSE, inufael=MED_FALSE;
00934 med_int entdim;
00935 med_int nnodes;
00936 med_int nndes;
00937 med_int i,j;
00938 med_err ret = 0;
00939 char str[MED_SNAME_SIZE+1];
00940 med_int dispbanner=MED_FALSE;
00941
00942
00943 for (i=0;i<MED_N_CELL_GEO_FIXED_CON;i++)
00944 if (nmailles[i] > 0) {
00945
00946 ret=_MEDgetGeometricParameter(MED_CELL, typmai[i],&entdim,&nnodes,&nndes);
00947 EXIT_IF(ret < 0,"lors de la lecture des caractéristiques des mailles",NULL);
00948
00949 switch(typ_con) {
00950 case MED_NODAL :
00951 taille = nnodes;
00952 break;
00953
00954 case MED_DESCENDING :
00955 taille = nndes;
00956 break;
00957
00958 default :
00959 ret = -1;
00960 }
00961
00962
00963 connectivite = (med_int*) malloc(sizeof(med_int)*taille*nmailles[i]);
00964 EXIT_IF(connectivite == NULL,NULL,NULL);
00965 nomele = (char*) malloc(sizeof(char)*MED_SNAME_SIZE*nmailles[i]+1);
00966 EXIT_IF(nomele == NULL,NULL,NULL);
00967 numele = (med_int*) malloc(sizeof(med_int)*nmailles[i]);
00968 EXIT_IF(numele == NULL,NULL,NULL);
00969 nufael = (med_int*) malloc(sizeof(med_int)*nmailles[i]);
00970 EXIT_IF(nufael == NULL,NULL,NULL);
00971
00972
00973 ret = MEDmeshElementRd( fid,nommaa,numdt,numit,MED_CELL,typmai[i],
00974 typ_con, mode_coo, connectivite,
00975 &inoele,nomele,&inuele,numele,&inufael,nufael );
00976
00977 EXIT_IF(ret < 0,"lors de la lecture des mailles",NULL);
00978
00979 if ( !dispbanner) {
00980 fprintf(stdout,"\n(**************************)\n");
00981 fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n");
00982 fprintf(stdout,"(**************************)\n");
00983 dispbanner=MED_TRUE;
00984 }
00985 if (!structure) {
00986
00987 fprintf(stdout,"\n- Mailles de type %s : ", nommai[i]);
00988 fprintf(stdout,"\n - Connectivité : ");
00989 for (j=0;j<nmailles[i]*taille;j++) {
00990 if (mode_coo == MED_FULL_INTERLACE && !(j % taille))
00991 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/taille +1) );
00992 if (mode_coo == MED_NO_INTERLACE && !(j % nmailles[i]))
00993 fprintf(stdout,"\n");
00994 fprintf(stdout," %9"MED_IFORMAT" ",*(connectivite+j));
00995 }
00996
00997 if (inoele) {
00998 fprintf(stdout,"\n - Noms : \n");
00999 for (j=0;j<nmailles[i];j++) {
01000 strncpy(str,nomele+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
01001 str[MED_SNAME_SIZE] = '\0';
01002 fprintf(stdout," %s ",str);
01003 }
01004 }
01005 if (inuele) {
01006 fprintf(stdout,"\n - Numeros :\n");
01007 for (j=0;j<nmailles[i];j++)
01008 fprintf(stdout," "IFORMAT" ",*(numele+j));
01009 }
01010 fprintf(stdout,"\n - Numéros de familles : \n");
01011 for (j=0;j<nmailles[i];j++)
01012 if (inufael)
01013 fprintf(stdout," "IFORMAT" ",*(nufael+j));
01014 else
01015 fprintf(stdout," %d ",0);
01016 fprintf(stdout,"\n");
01017 }
01018
01019
01020 free(connectivite);
01021 free(nomele);
01022 free(numele);
01023 free(nufael);
01024 }
01025
01026 return;
01027 }
01028
01029
01030 med_int lecture_nombre_mailles_polygones(const med_idt fid,
01031 const char * const nommaa,
01032 const med_int numdt,
01033 const med_int numit,
01034 const med_connectivity_mode typ_con)
01035 {
01036
01037 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01038
01039 med_int nmpolygones = MEDmeshnEntity(fid,nommaa,numdt,numit,
01040 MED_CELL,MED_POLYGON,
01041 MED_INDEX_NODE,typ_con,&chgt,&trsf);
01042
01043 EXIT_IF(nmpolygones < 0,"lors de la lecture du nombre de mailles polygone\n",
01044 NULL);
01045 if (nmpolygones > 0 ) nmpolygones--; else nmpolygones=0;
01046 if (nmpolygones)
01047 fprintf(stdout,"- Nombre de mailles de type MED_POLYGONE : "IFORMAT" \n",
01048 nmpolygones);
01049
01050 return nmpolygones;
01051 }
01052
01053 void lecture_mailles_polygones(const med_idt fid,
01054 const char * const nommaa,
01055 const med_int numdt,
01056 const med_int numit,
01057 const med_int nmpolygones,
01058 const med_switch_mode mode_coo,
01059 const med_connectivity_mode typ_con)
01060 {
01061 med_int i,j;
01062 med_err ret = 0;
01063 med_int taille;
01064 med_int *connectivite;
01065 char *nomele;
01066 med_int *numele;
01067 med_int *nufael;
01068 med_int *indexp;
01069 int ind1,ind2;
01070 char tmp[MED_NAME_SIZE+1];
01071 med_err ret1,ret2,ret3;
01072 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01073
01074
01075
01076
01077 taille=MEDmeshnEntity(fid,nommaa,numdt,numit,
01078 MED_CELL,MED_POLYGON,MED_CONNECTIVITY,typ_con,
01079 &chgt,&trsf);
01080 EXIT_IF(taille < 0,"lors de la lecture des parametres des mailles polygones",
01081 NULL);
01082
01083
01084 indexp = (med_int *) malloc(sizeof(med_int)*(nmpolygones+1));
01085 EXIT_IF(indexp == NULL,NULL,NULL);
01086 connectivite = (med_int *) malloc(sizeof(med_int)*taille);
01087 EXIT_IF(connectivite == NULL,NULL,NULL);
01088 numele = (med_int *) malloc(sizeof(med_int)*nmpolygones);
01089 EXIT_IF(numele == NULL,NULL,NULL);
01090 nufael = (med_int *) malloc(sizeof(med_int)*nmpolygones);
01091 EXIT_IF(nufael == NULL,NULL,NULL);
01092 nomele = (char *) malloc(sizeof(char)*MED_SNAME_SIZE*nmpolygones+1);
01093 EXIT_IF(nomele == NULL,NULL,NULL);
01094
01095
01096 ret = MEDmeshPolygonRd(fid,nommaa,numdt,numit,MED_CELL,typ_con,
01097 indexp,connectivite);
01098
01099 EXIT_IF(ret < 0,"lors de la lecture des connectivites des mailles polygones",
01100 NULL);
01101
01102
01103 ret1 = MEDmeshEntityNameRd(fid,nommaa,numdt,numit,
01104 MED_CELL,MED_POLYGON, nomele);
01105
01106
01107 ret2 = (med_int) MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,
01108 MED_CELL, MED_POLYGON, numele);
01109
01110
01111 ret3 = MEDmeshEntityFamilyNumberRd(fid, nommaa, MED_NO_DT, MED_NO_IT,
01112 MED_CELL, MED_POLYGON, nufael);
01113
01114 if (!structure) {
01115
01116 fprintf(stdout,"\n\n- Mailles de type MED_POLYGONE : ");
01117 for (i=0;i<nmpolygones;i++) {
01118 fprintf(stdout,"\n >> Maille MED_POLYGONE "IFORMAT" : \n",i+1);
01119 fprintf(stdout,"\n - Connectivité : ");
01120 ind1 = *(indexp+i)-1;
01121 ind2 = *(indexp+i+1)-1;
01122 for (j=ind1;j<ind2;j++)
01123 printf(" "IFORMAT" ",*(connectivite+j));
01124 if (ret1 == 0) {
01125 strncpy(tmp,nomele+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
01126 tmp[MED_SNAME_SIZE] = '\0';
01127 fprintf(stdout,"\n - Nom : %s \n",tmp);
01128 }
01129 if (ret2 == 0)
01130 fprintf(stdout,"\n - Numero : "IFORMAT" \n",*(numele+i));
01131
01132 if ( ret3 >= 0 )
01133 fprintf(stdout,"\n - Numéro de famille : "IFORMAT" \n",*(nufael+i));
01134 else
01135 fprintf(stdout,"\n - Numéro de famille : %d \n",0);
01136 }
01137 }
01138
01139
01140 free(indexp);
01141 free(connectivite);
01142 free(numele);
01143 free(nufael);
01144 free(nomele);
01145
01146 return;
01147 }
01148
01149
01150 med_int lecture_nombre_mailles_polyedres(const med_idt fid,
01151 const char * const nommaa,
01152 const med_int numdt,
01153 const med_int numit,
01154 const med_connectivity_mode typ_con)
01155 {
01156 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01157
01158 med_int npolyedres = MEDmeshnEntity(fid,nommaa,numdt,numit,
01159 MED_CELL,MED_POLYHEDRON,
01160 MED_INDEX_FACE,typ_con,&chgt,&trsf);
01161
01162 EXIT_IF(npolyedres < 0,"lors de la lecture du nombre de mailles polyedre \n",
01163 NULL);
01164 if ( npolyedres > 0 ) npolyedres--; else npolyedres=0;
01165 if (npolyedres)
01166 fprintf(stdout,"- Nombre de mailles de type MED_POLYEDRE : "IFORMAT" \n",
01167 npolyedres);
01168
01169 return npolyedres;
01170 }
01171
01172
01173 void lecture_mailles_polyedres(const med_idt fid,
01174 const char * const nommaa,
01175 const med_int numdt,
01176 const med_int numit,
01177 const med_int npolyedres,
01178 const med_switch_mode mode_coo,
01179 const med_connectivity_mode typ_con)
01180 {
01181 med_int i,j,k;
01182 med_err ret = 0;
01183 med_int taille;
01184 med_int *connectivite;
01185 char *nomele;
01186 med_int *numele;
01187 med_int *nufael;
01188 med_int *indexf, *indexn;
01189 int ind1,ind2;
01190 char tmp[MED_SNAME_SIZE+1];
01191 med_err ret1,ret2,ret3;
01192 med_int nfa;
01193 med_int nnoe;
01194 med_int nindn;
01195 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01196
01197
01198
01199 taille = MEDmeshnEntity(fid,nommaa,numdt,numit,
01200 MED_CELL,MED_POLYHEDRON,MED_CONNECTIVITY,typ_con,
01201 &chgt,&trsf);
01202 EXIT_IF(taille < 0,"lors de la lecture des parametres des mailles polyedres",
01203 NULL);
01204
01205 nindn = MEDmeshnEntity(fid,nommaa,numdt,numit,
01206 MED_CELL,MED_POLYHEDRON,MED_INDEX_NODE,typ_con,
01207 &chgt,&trsf);
01208 EXIT_IF(nindn < 0,"lors de la lecture des parametres des mailles polyedres",
01209 NULL);
01210
01211
01212
01213 indexf = (med_int *) malloc(sizeof(med_int)*(npolyedres+1));
01214 EXIT_IF(indexf == NULL,NULL,NULL);
01215 indexn = (med_int *) malloc(sizeof(med_int)*nindn);
01216 EXIT_IF(indexn == NULL,NULL,NULL);
01217 connectivite = (med_int *) malloc(sizeof(med_int)*taille);
01218 EXIT_IF(connectivite == NULL,NULL,NULL);
01219 numele = (med_int *) malloc(sizeof(med_int)*npolyedres);
01220 EXIT_IF(numele == NULL,NULL,NULL);
01221 nufael = (med_int *) malloc(sizeof(med_int)*npolyedres);
01222 EXIT_IF(nufael == NULL,NULL,NULL);
01223 nomele = (char *) malloc(sizeof(char)*MED_SNAME_SIZE*npolyedres+1);
01224 EXIT_IF(nomele == NULL,NULL,NULL);
01225
01226 ret = MEDmeshPolyhedronRd(fid,nommaa,numdt,numit,MED_CELL,typ_con,
01227 indexf,indexn,connectivite);
01228 EXIT_IF(ret < 0,
01229 "lors de la lecture de la connectivite des mailles polyedres",
01230 NULL);
01231
01232
01233 ret1 = MEDmeshEntityNameRd(fid,nommaa,numdt,numit,MED_CELL,MED_POLYHEDRON,nomele);
01234
01235
01236 ret2 = MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,MED_CELL,MED_POLYHEDRON,numele);
01237
01238
01239 ret3 = MEDmeshEntityFamilyNumberRd(fid,nommaa,numdt,numit,MED_CELL,MED_POLYHEDRON,nufael);
01240
01241 if (!structure) {
01242
01243 fprintf(stdout,"\n\n- Mailles de type MED_POLYEDRE : ");
01244 for (i=0;i<npolyedres;i++) {
01245 fprintf(stdout,"\n >> Maille MED_POLYEDRE "IFORMAT" : \n",i+1);
01246 fprintf(stdout,"\n - Connectivité : \n");
01247 nfa = *(indexf+i+1) - *(indexf+i);
01248
01249 ind1 = *(indexf+i) - 1;
01250 for (j=0;j<nfa;j++) {
01251 if (typ_con == MED_NODAL) {
01252
01253
01254 ind2 = *(indexn+ind1+j) - 1;
01255 nnoe = *(indexn+ind1+j+1) - *(indexn+ind1+j);
01256 fprintf(stdout," - Face "IFORMAT" : [ ", j+1);
01257 for (k=0;k<nnoe;k++)
01258 printf(" "IFORMAT" ",*(connectivite+ind2+k));
01259 printf(" ] \n");
01260 }
01261 else {
01262 nfa = *(indexf+i+1) - *(indexf+i);
01263
01264
01265 ind1 = *(indexf+i) - 1;
01266 for (j=0;j<nfa;j++)
01267 fprintf(stdout," - Face "IFORMAT" de numero : "IFORMAT" et de type "IFORMAT" \n", j+1,
01268 *(connectivite+ind1+j),*(indexn+ind1+j));
01269 }
01270 }
01271 if (ret1 == 0) {
01272 strncpy(tmp,nomele+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
01273 tmp[MED_SNAME_SIZE] = '\0';
01274 fprintf(stdout,"\n - Nom : %s \n",tmp);
01275 }
01276 if (ret2 == 0)
01277 fprintf(stdout,"\n - Numero : "IFORMAT" \n",*(numele+i));
01278 if (ret3 >= 0)
01279 fprintf(stdout,"\n - Numéro de famille : "IFORMAT" \n",*(nufael+i));
01280 else
01281 fprintf(stdout,"\n - Numéro de famille : %d \n",0);
01282
01283 }
01284 }
01285
01286
01287 free(indexf);
01288 free(indexn);
01289 free(connectivite);
01290 free(numele);
01291 free(nufael);
01292 free(nomele);
01293
01294 return;
01295 }
01296
01297 med_int lecture_nombre_faces_standards(const med_idt fid,
01298 const char * const nommaa,
01299 const med_int numdt,
01300 const med_int numit,
01301 const med_geometry_type typ_geo,
01302 const med_int indice
01303 )
01304 {
01305
01306 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01307
01308 med_int nfaces = MEDmeshnEntity(fid,nommaa,numdt,numit,
01309 MED_DESCENDING_FACE,typ_geo,
01310 MED_CONNECTIVITY,MED_DESCENDING,&chgt,&trsf);
01311 EXIT_IF(nfaces < 0,"lors de la lecture du nombre de faces",NULL);
01312
01313 if ( (indice < (MED_N_FACE_GEO_FIXED_CON-2) ) ||
01314 (indice >= (MED_N_FACE_GEO_FIXED_CON-2) && (nfaces > 0) ) )
01315 if (nfaces)
01316 fprintf (stdout,"- Nombre de faces de type %s : "IFORMAT" \n",
01317 nomfac[indice],nfaces);
01318
01319 return nfaces;
01320 }
01321
01322 void lecture_faces_standard(const med_idt fid,
01323 const char * const nommaa,
01324 const med_int numdt,
01325 const med_int numit,
01326 const med_int mdim,
01327 const med_int *const nfaces,
01328 const med_switch_mode mode_coo)
01329 {
01330 med_int taille;
01331 med_int *connectivite;
01332 char *nomele;
01333 med_int *numele;
01334 med_int *nufael;
01335 med_bool inoele,inuele,inufael;
01336 med_int i,j;
01337 med_err ret = 0;
01338 char str[MED_SNAME_SIZE+1];
01339 med_int entdim;
01340 med_int nnodes;
01341
01342 for (i=0;i<MED_N_FACE_GEO_FIXED_CON;i++)
01343 if (nfaces[i] > 0 ) {
01344
01345
01346 ret=_MEDgetGeometricParameter(MED_DESCENDING_FACE, typfac[i],&entdim,&nnodes,&taille);
01347 EXIT_IF(ret < 0,"lors de la lecture des caractéristiques des mailles",NULL);
01348
01349
01350 connectivite = (med_int*)malloc(sizeof(med_int)*taille*nfaces[i]);
01351 EXIT_IF(connectivite == NULL,NULL,NULL);
01352 nomele = (char*)malloc(sizeof(char)*MED_SNAME_SIZE*nfaces[i]+1);
01353 EXIT_IF(nomele == NULL,NULL,NULL);
01354 numele = (med_int*)malloc(sizeof(med_int)*nfaces[i]);
01355 EXIT_IF(numele == NULL,NULL,NULL);
01356 nufael = (med_int*)malloc(sizeof(med_int)*nfaces[i]);
01357 EXIT_IF(nufael == NULL,NULL,NULL);
01358
01359
01360 ret = MEDmeshElementRd( fid,nommaa,numdt,numit,MED_DESCENDING_FACE,typmai[i],
01361 MED_DESCENDING, mode_coo, connectivite,
01362 &inoele,nomele,&inuele,numele,&inufael,nufael );
01363 EXIT_IF(ret < 0,"lors de la lecture des faces",NULL);
01364
01365 if (!structure) {
01366
01367 fprintf(stdout,"\n- Faces de type %s : ", nomfac[i]);
01368 fprintf(stdout,"\n - Connectivité : ");
01369 for (j=0;j<nfaces[i]*taille;j++) {
01370 if (mode_coo == MED_FULL_INTERLACE && !(j % taille))
01371 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/taille+1) );
01372 if (mode_coo == MED_NO_INTERLACE && !(j % nfaces[i]))
01373 fprintf(stdout,"\n");
01374 fprintf(stdout," %9"MED_IFORMAT" ",*(connectivite+j));
01375 }
01376
01377 if (inoele) {
01378 fprintf(stdout,"\n - Noms : \n");
01379 for (j=0;j<nfaces[i];j++) {
01380 strncpy(str,nomele+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
01381 str[MED_SNAME_SIZE] = '\0';
01382 fprintf(stdout," %s ",str);
01383 }
01384 }
01385 if (inuele) {
01386 fprintf(stdout,"\n - Numeros :\n");
01387 for (j=0;j<nfaces[i];j++)
01388 fprintf(stdout," "IFORMAT" ",*(numele+j));
01389 }
01390 fprintf(stdout,"\n - Numéros de familles : \n");
01391 for (j=0;j<nfaces[i];j++)
01392 if ( inufael )
01393 fprintf(stdout," "IFORMAT" ",*(nufael+j));
01394 else
01395 fprintf(stdout," %d ",0);
01396 }
01397
01398
01399 free(connectivite);
01400 free(nomele);
01401 free(numele);
01402 free(nufael);
01403 }
01404
01405 return;
01406 }
01407
01408 med_int lecture_nombre_faces_polygones(const med_idt fid,
01409 const char * const nommaa,
01410 const med_int numdt,
01411 const med_int numit)
01412 {
01413
01414 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01415
01416 med_int nfpolygones = MEDmeshnEntity(fid,nommaa,numdt,numit,
01417 MED_CELL,MED_POLYGON,
01418 MED_INDEX_NODE,MED_DESCENDING,&chgt,&trsf);
01419
01420 EXIT_IF(nfpolygones < 0,"lors de la lecture du nombre de faces polygone \n",
01421 NULL);
01422 if (nfpolygones > 0 ) nfpolygones--; else nfpolygones=0;
01423 if (nfpolygones)
01424 fprintf(stdout,"- Nombre de faces de type MED_POLYGONE : "IFORMAT" \n",
01425 nfpolygones);
01426
01427 return nfpolygones;
01428 }
01429
01430 void lecture_faces_polygones(const med_idt fid,
01431 const char * const nommaa,
01432 const med_int numdt,
01433 const med_int numit,
01434 const med_int nfpolygones,
01435 const med_switch_mode mode_coo)
01436 {
01437 med_int i,j;
01438 med_err ret = 0;
01439 char *nomele;
01440 med_int *numele;
01441 med_int *nufael;
01442 med_int *connectivite;
01443 med_int taille;
01444 med_int *indexp;
01445 int ind1,ind2;
01446 char tmp[MED_NAME_SIZE+1];
01447 med_err ret1,ret2,ret3;
01448 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01449
01450
01451 taille=MEDmeshnEntity(fid,nommaa,numdt,numit,
01452 MED_DESCENDING_FACE,MED_POLYGON,MED_CONNECTIVITY,MED_DESCENDING,
01453 &chgt,&trsf);
01454 EXIT_IF(taille < 0,"lors de la lecture des parametres des faces polygones",
01455 NULL);
01456
01457
01458 indexp = (med_int *) malloc(sizeof(med_int)*(nfpolygones+1));
01459 EXIT_IF(indexp == NULL,NULL,NULL);
01460 connectivite = (med_int *) malloc(sizeof(med_int)*taille);
01461 EXIT_IF(connectivite == NULL,NULL,NULL);
01462 numele = (med_int *) malloc(sizeof(med_int)*nfpolygones);
01463 EXIT_IF(numele == NULL,NULL,NULL);
01464 nufael = (med_int *) malloc(sizeof(med_int)*nfpolygones);
01465 EXIT_IF(nufael == NULL,NULL,NULL);
01466 nomele = (char *) malloc(sizeof(char)*MED_SNAME_SIZE*nfpolygones+1);
01467 EXIT_IF(nomele == NULL,NULL,NULL);
01468
01469
01470 ret = MEDmeshPolygonRd(fid,nommaa,numdt,numit,MED_DESCENDING_FACE,MED_DESCENDING,
01471 indexp,connectivite);
01472 EXIT_IF(ret < 0,"lors de la lecture des connectivites des faces polygones", NULL);
01473
01474
01475 ret1 = MEDmeshEntityNameRd(fid,nommaa,numdt,numit,
01476 MED_DESCENDING_FACE,MED_POLYGON, nomele);
01477
01478
01479 ret2 = (med_int) MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,
01480 MED_DESCENDING_FACE, MED_POLYGON, numele);
01481
01482
01483 ret3 = MEDmeshEntityFamilyNumberRd(fid, nommaa, MED_NO_DT, MED_NO_IT,
01484 MED_DESCENDING_FACE, MED_POLYGON, nufael);
01485
01486 if (!structure) {
01487
01488 fprintf(stdout,"\n\n- Faces de type MED_POLYGONE : ");
01489 for (i=0;i<nfpolygones;i++) {
01490 fprintf(stdout,"\n >> Face MED_POLYGONE "IFORMAT" : \n",i+1);
01491 fprintf(stdout,"\n - Connectivité : ");
01492 ind1 = *(indexp+i)-1;
01493 ind2 = *(indexp+i+1)-1;
01494 for (j=ind1;j<ind2;j++)
01495 fprintf(stdout," "IFORMAT" ",*(connectivite+j));
01496 if (ret1 == 0) {
01497 strncpy(tmp,nomele+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
01498 tmp[MED_SNAME_SIZE] = '\0';
01499 fprintf(stdout,"\n - Nom : %s \n",tmp);
01500 }
01501 if (ret2 == 0)
01502 fprintf(stdout,"\n - Numero : "IFORMAT" \n",*(numele+j));
01503 if ( ret3 > 0 )
01504 fprintf(stdout,"\n - Numéro de famille : "IFORMAT" \n",*(nufael+i));
01505 else
01506 fprintf(stdout,"\n - Numéro de famille : %d \n",0);
01507 }
01508 }
01509
01510
01511 free(indexp);
01512 free(connectivite);
01513 free(numele);
01514 free(nufael);
01515 free(nomele);
01516
01517 return;
01518 }
01519
01520
01521 med_int lecture_nombre_aretes_standards(const med_idt fid,
01522 const char *const nommaa,
01523 const med_int numdt,
01524 const med_int numit,
01525 const med_geometry_type typ_geo,
01526 const med_int indice)
01527 {
01528
01529 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01530
01531 med_int naretes = MEDmeshnEntity(fid,nommaa,numdt,numit,
01532 MED_DESCENDING_EDGE, typ_geo,
01533 MED_CONNECTIVITY,MED_DESCENDING,&chgt,&trsf);
01534 EXIT_IF(naretes < 0,"lors de la lecture du nombre d'aretes",NULL);
01535 if ( (indice < (MED_N_EDGE_GEO_FIXED_CON-1) ) ||
01536 (indice >= (MED_N_EDGE_GEO_FIXED_CON-1) && (naretes > 0) ) )
01537 if (naretes)
01538 fprintf (stdout,
01539 "- Nombre d'aretes de type %s : "IFORMAT" \n",nomare[indice],naretes);
01540
01541 return naretes;
01542 }
01543
01544 void lecture_aretes_standards(const med_idt fid,
01545 const char * const nommaa,
01546 const med_int numdt,
01547 const med_int numit,
01548 const med_int mdim,
01549 const med_int * const naretes,
01550 const med_switch_mode mode_coo)
01551 {
01552 med_int taille;
01553 med_int *connectivite;
01554 char *nomele;
01555 med_int *numele;
01556 med_int *nufael;
01557 med_bool inoele,inuele,inufael;
01558 med_int i,j;
01559 med_err ret = 0;
01560 char str[MED_SNAME_SIZE+1];
01561 med_int entdim;
01562 med_int nnodes;
01563
01564 for (i=0;i<MED_N_EDGE_GEO_FIXED_CON;i++)
01565 if (naretes[i] > 0) {
01566
01567 ret=_MEDgetGeometricParameter(MED_DESCENDING_EDGE, typare[i],&entdim,&nnodes,&taille);
01568 EXIT_IF(ret < 0,"lors de la lecture des caractéristiques des mailles",NULL);
01569
01570
01571 connectivite = (med_int*)malloc(sizeof(med_int)*taille*naretes[i]);
01572 EXIT_IF(connectivite == NULL,NULL,NULL);
01573 nomele = (char*)malloc(sizeof(char)*MED_SNAME_SIZE*naretes[i]+1);
01574 EXIT_IF(nomele == NULL,NULL,NULL);
01575 numele = (med_int*)malloc(sizeof(med_int)*naretes[i]);
01576 EXIT_IF(numele == NULL,NULL,NULL);
01577 nufael = (med_int*)malloc(sizeof(med_int)*naretes[i]);
01578 EXIT_IF(nufael == NULL,NULL,NULL);
01579
01580
01581 ret = MEDmeshElementRd( fid,nommaa,numdt,numit,MED_DESCENDING_EDGE,typare[i],
01582 MED_DESCENDING, mode_coo, connectivite,
01583 &inoele,nomele,&inuele,numele,&inufael,nufael );
01584 EXIT_IF(ret < 0,"lors de la lecture des aretes",
01585 NULL);
01586
01587 if (!structure) {
01588
01589 fprintf(stdout,"\n- Aretes de type %s : ", nomare[i]);
01590 fprintf(stdout,"\n - Connectivité : ");
01591 for (j=0;j<naretes[i]*taille;j++) {
01592 if (mode_coo == MED_FULL_INTERLACE && !(j % taille))
01593 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/taille+1) );
01594 if (mode_coo == MED_NO_INTERLACE && !(j % naretes[i]))
01595 fprintf(stdout,"\n");
01596 fprintf(stdout," %9"MED_IFORMAT" ",*(connectivite+j));
01597 }
01598
01599 if (inoele) {
01600 fprintf(stdout,"\n - Noms : \n");
01601 for (j=0;j<naretes[i];j++) {
01602 strncpy(str,nomele+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
01603 str[MED_SNAME_SIZE] = '\0';
01604 fprintf(stdout," %s ",str);
01605 }
01606 }
01607 if (inuele) {
01608 fprintf(stdout,"\n - Numeros :\n");
01609 for (j=0;j<naretes[i];j++)
01610 fprintf(stdout," "IFORMAT" ",*(numele+j));
01611 }
01612 fprintf(stdout,"\n - Numéros de familles : \n");
01613 for (j=0;j<naretes[i];j++)
01614 if ( inufael )
01615 fprintf(stdout," "IFORMAT" ",*(nufael+j));
01616 else
01617 fprintf(stdout," %d ",0);
01618 }
01619
01620
01621 free(connectivite);
01622 free(nomele);
01623 free(numele);
01624 free(nufael);
01625 }
01626
01627 return;
01628 }
01629
01630
01631
01632
01633
01634
01635
01636
01637
01638
01639
01640
01641
01642
01643
01644
01645
01646
01647 void lecture_maillage_non_structure(med_idt fid,
01648 const char *nommaa,
01649 const med_int numdt,
01650 const med_int numit,
01651 const med_int mdim,
01652 const med_int edim,
01653 const med_switch_mode mode_coo,
01654 const med_connectivity_mode typ_con,
01655 const char * const nomcoo,
01656 const char * const unicoo,
01657 const med_axis_type *const rep,
01658 med_int* nmodels,
01659 med_geometry_type** geotype_elst,
01660 char** geotypename_elst,
01661 const int lecture_en_tete_seulement)
01662 {
01663 med_int i;
01664
01665 med_int nnoe;
01666 med_int nmailles[MED_N_CELL_GEO_FIXED_CON];
01667 med_int nfaces[MED_N_FACE_GEO_FIXED_CON];
01668 med_int naretes[MED_N_EDGE_GEO_FIXED_CON];
01669
01670 med_int nmpolygones, npolyedres, nfpolygones;
01671
01672 med_int nfam;
01673
01674 med_int nequ;
01675
01676 med_int njnt;
01677
01678 med_int _nmodels=0,*_nmailles_elst = NULL;
01679 med_geometry_type *_geotype_elst = NULL;
01680 char *_geotypename_elst = NULL;
01681 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01682
01683
01684 nnoe = lecture_nombre_noeuds_maillage_non_structure(fid,nommaa,numdt,numit);
01685
01686
01687 _nmodels = MEDmeshnEntity(fid,nommaa,numdt,numit,
01688 MED_STRUCT_ELEMENT,MED_GEO_ALL,MED_CONNECTIVITY,MED_GLOBAL_PFLMODE,
01689 &chgt,&trsf);
01690 EXIT_IF(_nmodels<0,
01691 "Erreur à la lecture du nombre de type géométrique pour le type d'entités MED_STRUCT_ELEMENT",NULL);
01692
01693 _nmailles_elst = (med_int *) malloc(_nmodels*sizeof(med_int));
01694 _geotype_elst = (med_geometry_type *) malloc(_nmodels*sizeof(med_geometry_type));
01695 _geotypename_elst = (char *) malloc(_nmodels*sizeof(char)*(MED_NAME_SIZE+1));
01696
01697 for (i=0; i < _nmodels; i++) {
01698 _nmailles_elst[i]=lecture_nombre_et_type_mailles_elstruct(fid,nommaa,numdt,numit,i,
01699 &_geotype_elst[i],&_geotypename_elst[i*(MED_NAME_SIZE+1)]);
01700 }
01701 if (_nmodels) {
01702 *nmodels = _nmodels;
01703 *geotype_elst = _geotype_elst;
01704 *geotypename_elst = _geotypename_elst;
01705 } else *nmodels=0;
01706
01707
01708
01709 for (i=0;i<MED_N_CELL_GEO_FIXED_CON;i++)
01710 nmailles[i] = lecture_nombre_mailles_standards(fid,nommaa,numdt,numit,typmai[i],
01711 typ_con,i);
01712
01713
01714 nmpolygones = lecture_nombre_mailles_polygones(fid,nommaa,numdt,numit,typ_con);
01715
01716
01717 npolyedres = lecture_nombre_mailles_polyedres(fid,nommaa,numdt,numit,typ_con);
01718
01719
01720 if (typ_con == MED_DESCENDING) {
01721
01722
01723 for (i=0;i<MED_N_FACE_GEO_FIXED_CON;i++)
01724 nfaces[i] = lecture_nombre_faces_standards(fid,nommaa,numdt,numit,typfac[i],i);
01725
01726
01727 nfpolygones = lecture_nombre_faces_polygones(fid,nommaa,numdt,numit);
01728
01729
01730 for (i=0;i<MED_N_EDGE_GEO_FIXED_CON;i++)
01731 naretes[i] = lecture_nombre_aretes_standards(fid,nommaa,numdt,numit,typare[i],i);
01732 }
01733
01734 if (lecture_en_tete_seulement != MED_LECTURE_MAILLAGE_SUPPORT_UNIQUEMENT) {
01735
01736 nfam = lecture_nombre_famille(fid,nommaa);
01737
01738
01739 nequ = lecture_nombre_equivalence(fid,nommaa);
01740
01741
01742 njnt = lecture_nombre_joint(fid,nommaa);
01743 }
01744
01745
01746 if (lecture_en_tete_seulement == MED_LECTURE_ENTETE_SEULEMENT) {
01747
01748
01749
01750
01751
01752 return;
01753 }
01754
01755
01756
01757 lecture_noeuds_maillage_non_structure(fid,nommaa,numdt,numit,mdim,edim,nnoe,mode_coo,nomcoo,unicoo,rep);
01758
01759
01760
01761
01762
01763
01764
01765
01766
01767
01768
01769
01770
01771
01772
01773
01774 lecture_mailles_standards(fid,nommaa,numdt,numit,mdim,nmailles,mode_coo,typ_con);
01775
01776
01777 if (lecture_en_tete_seulement == MED_LECTURE_MAILLAGE_SUPPORT_UNIQUEMENT) return;
01778
01779 if (_nmodels>0) {
01780 lecture_mailles_elstruct(fid,nommaa,numdt,numit,_nmodels,
01781 _geotype_elst,_geotypename_elst,_nmailles_elst,mode_coo);
01782
01783
01784
01785
01786
01787 }
01788
01789
01790 if (nmpolygones > 0)
01791 lecture_mailles_polygones(fid,nommaa,numdt,numit,nmpolygones,mode_coo,typ_con);
01792
01793
01794 if (npolyedres > 0)
01795 lecture_mailles_polyedres(fid,nommaa,numdt,numit,npolyedres,mode_coo,typ_con);
01796
01797
01798
01799 if (typ_con == MED_DESCENDING) {
01800 lecture_faces_standard(fid,nommaa,numdt,numit,mdim,nfaces,mode_coo);
01801 if (nfpolygones > 0)
01802 lecture_faces_polygones(fid,nommaa,numdt,numit,nfpolygones,mode_coo);
01803 }
01804
01805
01806
01807 if (typ_con == MED_DESCENDING)
01808 lecture_aretes_standards(fid,nommaa,numdt,numit,mdim,naretes,mode_coo);
01809
01810
01811
01812
01813
01814 lecture_famille_maillage(fid,nommaa,nfam);
01815
01816
01817
01818
01819
01820
01821 lecture_equivalence_maillage(fid,nommaa,nequ);
01822
01823
01824
01825
01826
01827
01828 lecture_joint_maillage(fid,nommaa,njnt);
01829
01830
01831 return;
01832 }
01833
01834
01835 void lecture_caracteristiques_grille(const med_idt fid,
01836 const char * const nommaa,
01837 const med_int numdt,
01838 const med_int numit,
01839 const med_int mdim,
01840 med_int *nind,
01841 med_int *nnoe,
01842 med_int *nmai,
01843 med_grid_type *type)
01844 {
01845 med_err ret = 0;
01846 med_int axe;
01847 med_int *structure_grille;
01848 med_data_type quoi;
01849 med_int j;
01850 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01851
01852
01853 ret = MEDmeshGridTypeRd(fid,nommaa,type);
01854 EXIT_IF(ret < 0,"a la lecture du type d'une grille ",NULL);
01855
01856 switch(*type) {
01857
01858 case MED_CARTESIAN_GRID :
01859 case MED_POLAR_GRID :
01860 if (*type == MED_CARTESIAN_GRID)
01861 fprintf(stdout,"- Type de grille : MED_GRILLE_CARTESIENNE \n");
01862 else
01863 fprintf(stdout,"- Type de grille : MED_GRILLE_POLAIRE \n");
01864 for (axe=1;axe<=mdim;axe++) {
01865 switch(axe) {
01866
01867 case 1:
01868 quoi = MED_COORDINATE_AXIS1;
01869 break;
01870
01871 case 2:
01872 quoi = MED_COORDINATE_AXIS2;
01873 break;
01874
01875 case 3:
01876 quoi = MED_COORDINATE_AXIS3;
01877 break;
01878 }
01879 nind[axe - 1] = MEDmeshnEntity(fid,nommaa, numdt, numit,
01880 MED_NODE, MED_NONE, quoi, MED_NO_CMODE, &chgt, &trsf);
01881
01882 EXIT_IF(nind[axe - 1] < 0,
01883 "lors de la lecture de la taille d'un indice d'une grille",
01884 NULL);
01885 *nnoe = nind[axe - 1] * (*nnoe);
01886 *nmai = (nind[axe - 1] - 1) * (*nmai);
01887 fprintf(stdout,
01888 "- Taille de l'indice de l'axe "IFORMAT" des coordonnees : "IFORMAT" \n",
01889 axe,nind[axe - 1]);
01890 }
01891 break;
01892
01893 case MED_CURVILINEAR_GRID:
01894 fprintf(stdout,"- Type de grille : MED_GRILLE_DESTRUCTUREE \n");
01895 *nnoe = MEDmeshnEntity(fid, nommaa, numdt, numit,
01896 MED_NODE, MED_NONE, MED_COORDINATE, MED_NO_CMODE, &chgt, &trsf);
01897 EXIT_IF(*nnoe < 0,"lors de la lecture du nombre de noeuds du maillage "
01898 ,nommaa);
01899
01900
01901 structure_grille = (med_int *) malloc(sizeof(med_int)*mdim);
01902 EXIT_IF(structure_grille == NULL,NULL,NULL);
01903
01904
01905 ret = MEDmeshGridStructRd(fid,nommaa,numdt, numit, structure_grille);
01906 EXIT_IF(ret < 0,"lors de la lecture de la structure de la grille",
01907 NULL);
01908 fprintf(stdout,"- Structure de la grille : [ ");
01909 for (j=0;j<mdim;j++) {
01910 *nmai = (*(structure_grille+j) - 1) * (*nmai);
01911 fprintf(stdout," "IFORMAT" ",*(structure_grille+j));
01912 }
01913 fprintf(stdout," ] \n");
01914
01915 free(structure_grille);
01916 break;
01917
01918 case MED_UNDEF_GRID_TYPE:
01919 default:
01920 EXIT_IF(-1,"Type de grille non reconnu.",nommaa);
01921
01922 }
01923
01924 fprintf(stdout,"- Nombre de noeuds : "IFORMAT" \n",*nnoe);
01925 fprintf(stdout,"- Nombre de mailles : "IFORMAT" \n",*nmai);
01926
01927 return;
01928 }
01929
01930
01931 void lecture_noeuds_maillage_structure(const med_idt fid,
01932 const char * const nommaa,
01933 const med_int numdt,
01934 const med_int numit,
01935 const med_int mdim,
01936 const med_int edim,
01937 const med_int * const nind,
01938 const med_int nnoe,
01939 const char * const comp,
01940 const char * const unit,
01941 const med_grid_type type,
01942 const med_switch_mode mode_coo)
01943 {
01944 med_err ret = 0;
01945 med_int axe,i,j;
01946 char str[MED_SNAME_SIZE+1];
01947 med_float *coo = NULL;
01948 med_float *indices = NULL;
01949 med_int *nufano = NULL;
01950 med_int *numnoe = NULL;
01951 char *nomnoe = NULL;
01952 med_bool inufael=MED_FALSE;
01953
01954 fprintf(stdout,"\n(*************************)\n");
01955 fprintf(stdout,"(* NOEUDS DE LA GRILLE : *)\n");
01956 fprintf(stdout,"(*************************)\n");
01957
01958 switch(type) {
01959
01960 case MED_CARTESIAN_GRID :
01961 case MED_POLAR_GRID :
01962
01963 for (axe = 1; axe<=mdim; axe++) {
01964
01965 indices = (med_float *) malloc(sizeof(med_float)*nind[axe - 1]);
01966 EXIT_IF(indices == NULL,NULL,NULL);
01967
01968
01969 ret = MEDmeshGridIndexCoordinateRd(fid,nommaa,numdt,numit, axe,indices);
01970 EXIT_IF(ret < 0,"lors de la lecture d'un tableau d'indice",
01971 NULL);
01972 fprintf(stdout,"\n - Axe %." xstr(MED_SNAME_SIZE) "s [%." xstr(MED_SNAME_SIZE) "s] : [ ",
01973 &comp[MED_SNAME_SIZE*(axe-1)],&unit[MED_SNAME_SIZE*(axe-1)]);
01974 for (j=0;j<nind[axe - 1];j++)
01975 fprintf(stdout," %f ",*(indices+j));
01976 printf(" ] \n");
01977
01978 free(indices);
01979 }
01980 break;
01981
01982 case MED_CURVILINEAR_GRID:
01983
01984 coo = (med_float *) malloc(sizeof(med_float)*nnoe*edim);
01985 EXIT_IF(coo == NULL,NULL,NULL);
01986
01987 ret = MEDmeshNodeCoordinateRd(fid,nommaa,numdt,numit, MED_FULL_INTERLACE,coo);
01988
01989 EXIT_IF(ret < 0,"lors de la lecture des noeuds du maillage",NULL);
01990
01991 fprintf(stdout,"- Nom des coordonnees : \n");
01992 for (i=0;i<edim;i++) {
01993 strncpy(str,comp+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
01994 str[MED_SNAME_SIZE] = '\0';
01995 fprintf(stdout," %s ",str);
01996 }
01997 fprintf(stdout,"\n- Unites des coordonnees : \n");
01998 for (i=0;i<edim;i++) {
01999 strncpy(str,unit+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
02000 str[MED_SNAME_SIZE] = '\0';
02001 fprintf(stdout," %s ",str);
02002 }
02003 if (!structure) {
02004 fprintf(stdout,"\n - Coordonnees des noeuds : [ ");
02005 for (j=0;j<nnoe*edim;j++)
02006 fprintf(stdout," %f ",*(coo+j));
02007 fprintf(stdout," ] \n");
02008 }
02009
02010
02011 free(coo);
02012 break;
02013
02014 case MED_UNDEF_GRID_TYPE:
02015 default:
02016 EXIT_IF(-1,"Type de grille non reconnu.",nommaa);
02017
02018 }
02019
02020
02021
02022
02023
02024
02025
02026 numnoe = (med_int *) malloc(sizeof(med_int)*nnoe);
02027 EXIT_IF(numnoe == NULL,NULL,NULL);
02028 nomnoe = (char*) malloc(MED_SNAME_SIZE*nnoe+1);
02029 EXIT_IF(nomnoe == NULL,NULL,NULL);
02030 nufano = (med_int *) malloc(sizeof(med_int)*nnoe);
02031 EXIT_IF(nufano == NULL,NULL,NULL);
02032
02033
02034 ret = MEDmeshEntityFamilyNumberRd(fid,nommaa,numdt,numit,MED_NODE,MED_NO_GEOTYPE,nufano);
02035 if (ret < 0) ret=0; else inufael=MED_TRUE;
02036
02037 EXIT_IF(ret < 0,"lors de la lecture des numeros de familles des noeuds",
02038 NULL);
02039 if (!structure) {
02040
02041 fprintf(stdout,"\n- Numeros des familles des noeuds : \n");
02042 for (i=0;i<nnoe;i++)
02043 if (inufael)
02044 fprintf(stdout," "IFORMAT" ",*(nufano+i));
02045 else
02046 fprintf(stdout," %d ",0);
02047 fprintf(stdout,"\n");
02048 }
02049
02050
02051 if (MEDmeshEntityNameRd(fid,nommaa,numdt,numit,MED_NODE,MED_NO_GEOTYPE,nomnoe) == 0) {
02052 if (!structure) {
02053 fprintf(stdout,"\n- Noms des noeuds : \n");
02054 for (i=0;i<nnoe;i++) {
02055 strncpy(str,nomnoe+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
02056 str[MED_SNAME_SIZE] = '\0';
02057 fprintf(stdout," %s ",str);
02058 }
02059 }
02060 }
02061
02062
02063 if (MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,MED_NODE,MED_NO_GEOTYPE,numnoe) == 0) {
02064 if (!structure) {
02065 fprintf(stdout,"\n- Numeros des noeuds : \n");
02066 for (i=0;i<nnoe;i++)
02067 fprintf(stdout," "IFORMAT" ",*(numnoe+i));
02068 }
02069 }
02070
02071
02072 free(nufano);
02073 free(numnoe);
02074 free(nomnoe);
02075
02076 return;
02077 }
02078
02079
02080 void lecture_mailles_maillage_structure(const med_idt fid,
02081 const char * const nommaa,
02082 const med_int numdt,
02083 const med_int numit,
02084 const med_int mdim,
02085 const med_int nmai)
02086
02087 {
02088 med_err ret = 0;
02089 med_int i;
02090 med_int *nufael = NULL;
02091 char *nomele = NULL;
02092 med_int *numele = NULL;
02093 char str[MED_SNAME_SIZE+1];
02094
02095 med_geometry_type typgeo;
02096
02097 fprintf(stdout,"\n(***************************)\n");
02098 fprintf(stdout,"(* ELEMENTS DE LA GRILLE : *)\n");
02099 fprintf(stdout,"(***************************)\n");
02100
02101
02102 switch(mdim) {
02103 case 0 :
02104 typgeo = MED_POINT1;
02105 break;
02106 case 1 :
02107 typgeo = MED_SEG2;
02108 break;
02109 case 2 :
02110 typgeo = MED_QUAD4;
02111 break;
02112 default :
02113 typgeo = MED_HEXA8;
02114 }
02115
02116
02117
02118
02119
02120
02121
02122
02123 numele = (med_int *) malloc(sizeof(med_int)*nmai);
02124 EXIT_IF(numele == NULL,NULL,NULL);
02125 nomele = (char *) malloc(sizeof(char)*MED_SNAME_SIZE*nmai+1);
02126 EXIT_IF(nomele == NULL,NULL,NULL);
02127 nufael = (med_int *) malloc(sizeof(med_int)*nmai);
02128 EXIT_IF(nufael == NULL,NULL,NULL);
02129
02130
02131 ret = MEDmeshEntityFamilyNumberRd(fid,nommaa,numdt,numit,MED_CELL,typgeo,nufael);
02132 if (ret < 0)
02133 for (i=0;i<nmai;i++)
02134 *(nufael+i) = 0;
02135
02136 if (!structure) {
02137
02138 fprintf(stdout,"\n- Numeros des familles des mailles : \n");
02139 for (i=0;i<nmai;i++)
02140 fprintf(stdout," "IFORMAT" ",*(nufael+i));
02141 fprintf(stdout,"\n");
02142 }
02143
02144
02145 if (MEDmeshEntityNameRd(fid,nommaa,numdt,numit,MED_CELL,typgeo,nomele) == 0) {
02146 if (!structure) {
02147 fprintf(stdout,"\n - Noms : \n");
02148 for (i=0;i<nmai;i++) {
02149 strncpy(str,nomele+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
02150 str[MED_SNAME_SIZE] = '\0';
02151 fprintf(stdout," %s ",str);
02152 }
02153 }
02154 }
02155
02156
02157 if (MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,MED_CELL,typgeo,numele) == 0) {
02158 if (!structure) {
02159 fprintf(stdout,"\n - Numeros :\n");
02160 for (i=0;i<nmai;i++)
02161 fprintf(stdout," "IFORMAT" ",*(numele+i));
02162 }
02163 }
02164
02165
02166 free(nufael);
02167 free(nomele);
02168 free(numele);
02169
02170 return;
02171 }
02172
02173 void lecture_maillage_structure(const med_idt fid,
02174 const char * const nommaa,
02175 const med_int numdt,
02176 const med_int numit,
02177 const med_int mdim,
02178 const med_int edim,
02179 const med_switch_mode mode_coo,
02180 const char * const comp,
02181 const char * const unit,
02182 const int lecture_en_tete_seulement)
02183 {
02184
02185 med_int nind[3];
02186 med_int nnoe = 1;
02187 med_int nmai = 1;
02188
02189 med_grid_type type;
02190
02191 med_int nfam;
02192
02193 med_int nequ;
02194
02195 med_int njnt;
02196
02197
02198
02199
02200
02201
02202 lecture_caracteristiques_grille(fid,nommaa,numdt,numit,mdim,nind,&nnoe,&nmai,&type);
02203
02204
02205 nfam = lecture_nombre_famille(fid,nommaa);
02206
02207
02208 nequ = lecture_nombre_equivalence(fid,nommaa);
02209
02210
02211 njnt = lecture_nombre_joint(fid,nommaa);
02212
02213 if (lecture_en_tete_seulement)
02214 return ;
02215
02216
02217
02218
02219 lecture_noeuds_maillage_structure(fid,nommaa,numdt,numit,mdim,edim,nind,nnoe,comp,unit,type,mode_coo);
02220
02221
02222
02223
02224 lecture_mailles_maillage_structure(fid,nommaa,numdt,numit,mdim,nmai);
02225
02226
02227
02228
02229 lecture_famille_maillage(fid,nommaa,nfam);
02230
02231
02232
02233
02234 lecture_equivalence_maillage(fid,nommaa,nequ);
02235
02236
02237
02238
02239 lecture_joint_maillage(fid,nommaa,njnt);
02240
02241 return ;
02242 }
02243
02244 med_err getFieldsOn(const med_idt fid,
02245 const char * const maillage,
02246 const med_int mnumdt,
02247 const med_int mnumit,
02248 const med_int nmodels,
02249 const med_geometry_type* const geotype_elst,
02250 const char* const geotypename_elst,
02251 const char * const nomcha,
02252 const char * const dtunit,
02253 const med_field_type typcha,
02254 const med_int ncomp,
02255 const char * const comp,
02256 const char * const unit,
02257 const med_entity_type entite,
02258 const med_switch_mode stockage,
02259 const med_int ncstp) {
02260
02261 int i,j,k,l,m,n,nb_geo=0;
02262 med_int nbpdtnor=0,pflsize,*pflval,ngauss=0,ngroup,*vale=NULL,nval;
02263 med_int numdt=0,numo=0,_nbofprofile;
02264 med_int meshnumdt=0,meshnumit=0;
02265 med_float *valr=NULL,dt=0.0;
02266 med_err ret=0;
02267 char pflname [MED_NAME_SIZE+1]="";
02268 char locname [MED_NAME_SIZE+1]="";
02269 char meshname [MED_NAME_SIZE+1]="";
02270 char maa_ass [MED_NAME_SIZE+1]="";
02271 char * lien = NULL;
02272 med_bool localmesh;
02273 med_int nmesh=0;
02274 med_int lnsize=0;
02275 med_geometry_type * type_geo;
02276
02277 size_t _bannerlen=255;
02278 size_t _bannerlen1=0,_bannershift1=0;
02279 char _temp1[MAXBANNERLEN+1]="";
02280 char * _bannerstr1=NULL;
02281 size_t _bannerlen2=0,_bannershift2=0;
02282 char _temp2[MAXBANNERLEN+1]="";
02283 char * _bannerstr2=NULL;
02284
02285 const char * const * AFF;
02286 const char * const * AFF_ENT=MED23FIELD_GET_ENTITY_TYPENAME+1;
02287 const char * * AFF_STRUCT = NULL;
02288
02289 switch (entite) {
02290 case MED_NODE :
02291 type_geo = MED23FIELD_GET_NODE_GEOMETRY_TYPE;
02292 nb_geo = MED_N_NODE_FIXED_GEO;
02293 AFF = MED23FIELD_GET_NODE_GEOMETRY_TYPENAME;
02294 break;
02295 case MED_CELL :
02296 case MED_NODE_ELEMENT :
02297 type_geo = MED23FIELD_GET_CELL_GEOMETRY_TYPE;
02298 nb_geo = MED_N_CELL_FIXED_GEO;
02299 AFF = MED23FIELD_GET_CELL_GEOMETRY_TYPENAME;
02300 break;
02301 case MED_DESCENDING_FACE :
02302 type_geo = MED23FIELD_GET_FACE_GEOMETRY_TYPE;
02303 nb_geo = MED_N_FACE_FIXED_GEO;
02304 AFF = MED23FIELD_GET_FACE_GEOMETRY_TYPENAME;
02305 break;
02306 case MED_DESCENDING_EDGE :
02307 type_geo = MED23FIELD_GET_EDGE_GEOMETRY_TYPE;
02308 nb_geo = MED_N_EDGE_FIXED_GEO;
02309 AFF = MED23FIELD_GET_EDGE_GEOMETRY_TYPENAME;
02310 break;
02311 case MED_STRUCT_ELEMENT :
02312 AFF_STRUCT = (const char * *) calloc(sizeof(const char * ),nmodels+1);
02313 for(i=0;i<nmodels;++i) AFF_STRUCT[i+1]= &geotypename_elst[(MED_NAME_SIZE+1)*i];
02314 type_geo = (med_geometry_type*)(geotype_elst)-1;
02315 nb_geo = nmodels;
02316 AFF = AFF_STRUCT;
02317 break;
02318 }
02319
02320 for (k=1;k<=nb_geo;k++) {
02321
02322
02323 nbpdtnor = ncstp;
02324 if (nbpdtnor < 1 ) continue;
02325
02326 for (j=0;j<nbpdtnor;j++) {
02327
02328 if ( MEDfield23ComputingStepMeshInfo(fid, nomcha,j+1, &numdt, &numo, &dt,
02329 &nmesh, maa_ass, &localmesh, &meshnumdt, &meshnumit ) <0) {
02330 MESSAGE("Erreur a la demande d'information sur (pdt,nor) : ");
02331 ISCRUTE(numdt); ISCRUTE(numo);ISCRUTE(nmesh);SSCRUTE(meshname);ISCRUTE_int(localmesh);
02332 ISCRUTE(meshnumdt);ISCRUTE(meshnumit);
02333 ret = -1; continue;
02334 }
02335
02336 for (i=0;i< nmesh;++i) {
02337
02338 if ( (_nbofprofile = MEDfield23nProfile(fid,nomcha,numdt,numo,entite,type_geo[k],i+1,
02339 meshname,pflname,locname ) ) < 0 ) {
02340 MESSAGE("Erreur a la demande du nombre de profils referencés par le champ : ");
02341 SSCRUTE(nomcha); ISCRUTE(numdt); ISCRUTE(numo);SSCRUTE(meshname);
02342 ISCRUTE_int(entite);ISCRUTE_int(type_geo[k]);SSCRUTE(pflname);SSCRUTE(locname);
02343 SSCRUTE(AFF_ENT[(int)entite]);SSCRUTE(AFF[k]);
02344 ret = -1; continue;
02345 };
02346
02347 for (l=0;l<_nbofprofile;l++) {
02348
02349 if ( (nval = MEDfield23nValueWithProfile(fid, nomcha, numdt, numo, entite, type_geo[k],meshname,
02350 l+1, USER_MODE, pflname,&pflsize,
02351 locname, &ngauss) ) < 0 ) {
02352 MESSAGE("Erreur a la lecture du nombre de valeurs du champ : ");
02353 SSCRUTE(nomcha);ISCRUTE(numdt);ISCRUTE(numo);SSCRUTE(meshname);
02354 ISCRUTE_int(entite);ISCRUTE_int(type_geo[k]);
02355 ISCRUTE_int(USER_MODE);
02356 ret = -1; continue;
02357 };
02358
02359 if ( (!strcmp(meshname,maillage)) && (meshnumdt == mnumdt) && (meshnumit == mnumit) ) {
02360
02361
02362 _bannerstr1 = "(* CHAMP |%s| A L'ÉTAPE DE CALCUL (n°dt,n°it)="
02363 "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT") , %.*s*)\n";
02364
02365 _bannerstr2 = "(* SUR LE MAILLAGE |%s| A L'ÉTAPE DE CALCUL (n°dt,n°it)="
02366 "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT") : %.*s*)\n";
02367 snprintf(_temp1,MAXBANNERLEN+1,_bannerstr1,nomcha,numdt,numo,0,"");
02368 snprintf(_temp2,MAXBANNERLEN+1,_bannerstr2,meshname,meshnumdt,meshnumit,0,"");
02369 _bannerlen1 = strlen(_temp1);
02370 _bannerlen2 = strlen(_temp2);
02371 _bannerlen=MAX(_bannerlen1,_bannerlen2);
02372 if (_bannerlen1>_bannerlen2) {
02373 _bannershift1 = 0; _bannershift2 = _bannerlen1-_bannerlen2;
02374 } else {
02375 _bannershift2 = 0; _bannershift1 = _bannerlen2-_bannerlen1;
02376 }
02377 fprintf(stdout,"\n(");
02378 for (i=0;i< _bannerlen-6; i++) fprintf(stdout,"*");
02379 fprintf(stdout,")\n");
02380 fprintf(stdout,_bannerstr1,nomcha,numdt,numo,_bannershift1,MED_NAME_BLANK);
02381 fprintf(stdout,_bannerstr2,meshname,meshnumdt,meshnumit,_bannershift2,MED_NAME_BLANK);
02382 fprintf(stdout,"(");
02383 for (i=0;i< _bannerlen-6; i++) fprintf(stdout,"*");
02384 fprintf(stdout,")\n");
02385
02386
02387
02388
02389
02390
02391
02392
02393
02394
02395
02396 fprintf(stdout,"- Valeur de la date du champ %f [%s] : \n",dt,dtunit);
02397 fprintf(stdout,"- Type des composantes du champ : %d\n",typcha);
02398 fprintf(stdout,"- Nombre de composantes par valeur : "IFORMAT"\n",ncomp);
02399 fprintf(stdout,"- Unité des composantes : |%s|\n",unit);
02400 fprintf(stdout,"- Nom des composantes : |%s|\n",comp);
02401
02402 printf("\t- Il y a "IFORMAT" entités qui portent des valeurs en mode %i."
02403 "\n\t Chaque entite %s de type geometrique %s associes au profil |%s| a "IFORMAT" point(s) d'intégration \n",
02404 nval,USER_MODE,AFF_ENT[(int)entite],AFF[k],pflname,ngauss);
02405
02406
02407 if ( !localmesh ) {
02408
02409 if ( (lnsize=MEDlinkInfoByName(fid,maa_ass) ) < 0 ) {
02410 MESSAGE("Erreur a la lecture de la taille du lien : ");
02411 SSCRUTE(maa_ass);
02412 ret = -1;
02413 } else {
02414 lien = (char *)malloc(lnsize*sizeof(char) + 1);
02415 EXIT_IF(lien == NULL,NULL,NULL);
02416
02417 if ( MEDlinkRd(fid, maa_ass, lien) < 0 ) {
02418 MESSAGE("Erreur a la lecture du lien : ");
02419 SSCRUTE(maa_ass);SSCRUTE(lien);
02420 ret = -1;
02421 } else {
02422 lien[lnsize] = '\0';
02423 printf("\tLe maillage |%s| est porte par un fichier distant |%s|\n",maa_ass,lien);
02424 }
02425 free(lien);
02426 }
02427 }
02428
02429
02430 if (typcha == MED_FLOAT64) {
02431
02432 valr = (med_float*) calloc(ncomp*nval*ngauss,sizeof(med_float));
02433 EXIT_IF(valr == NULL,NULL,NULL);
02434
02435 if (MEDfield23ValueWithProfileRd(fid, nomcha, numdt,numo, entite,type_geo[k],meshname,
02436 USER_MODE, pflname, stockage,MED_ALL_CONSTITUENT,
02437 (unsigned char*) valr) < 0 ) {
02438 MESSAGE("Erreur a la lecture des valeurs du champ : ");
02439 SSCRUTE(nomcha);ISCRUTE_int(entite);ISCRUTE_int(type_geo[k]);
02440 ISCRUTE(numdt);ISCRUTE(numo);
02441 ret = -1;
02442 }
02443 } else {
02444
02445 vale = (med_int*) calloc(ncomp*nval*ngauss,sizeof(med_int));
02446 EXIT_IF(vale == NULL,NULL,NULL);
02447
02448 if (MEDfield23ValueWithProfileRd(fid, nomcha, numdt,numo, entite,type_geo[k],meshname,
02449 USER_MODE, pflname, stockage,MED_ALL_CONSTITUENT,
02450 (unsigned char*) vale) < 0 ) {
02451 MESSAGE("Erreur a la lecture des valeurs du champ : ");
02452 SSCRUTE(nomcha);ISCRUTE_int(entite);ISCRUTE_int(type_geo[k]);
02453 ISCRUTE(numdt);ISCRUTE(numo);
02454 ret = -1;
02455 }
02456 }
02457
02458 if ( strlen(locname) && (_nbofprofile > 1) )
02459 printf("\t- Modèle de localisation des points de Gauss de nom |%s|\n",locname);
02460
02461 if (entite == MED_NODE_ELEMENT)
02462 ngroup = (type_geo[k] % 100);
02463 else
02464 ngroup = ngauss;
02465
02466 switch (stockage) {
02467
02468 case MED_FULL_INTERLACE :
02469 if (!structure) {
02470 printf("\t- Valeurs :\n\t");
02471 for (m=0;m<(nval*ngauss)/ngroup;m++) {
02472 printf("|");
02473 for (n=0;n<ngroup*ncomp;n++)
02474 if (typcha == MED_FLOAT64)
02475 printf(" %f ",*(valr+(m*ngroup*ncomp)+n));
02476 else
02477 printf(" "IFORMAT" ",*(vale+(m*ngroup*ncomp)+n));
02478 }
02479 }
02480 break;
02481
02482
02483 case MED_NO_INTERLACE :
02484 if (!structure) {
02485 printf("\t- Valeurs :\n\t");
02486 for (m=0;m<ncomp;m++) {
02487 printf("|");
02488 for (n=0;n<(nval*ngauss);n++)
02489 if (typcha == MED_FLOAT64)
02490 printf(" %f ",*(valr+(m*nval)+n));
02491 else
02492 printf(" "IFORMAT" ",*(vale+(m*nval)+n));
02493 }
02494 }
02495 break;
02496 }
02497
02498 if (!structure) {
02499 printf("|\n");
02500 }
02501
02502 if (typcha == MED_FLOAT64) {
02503 if ( valr ) {free(valr);valr = NULL;}}
02504 else
02505 if (vale) { free(vale);vale = NULL; }
02506
02507
02508 if (strcmp(pflname,MED_NO_PROFILE) == 0 ) {
02509 printf("\t- Profil : MED_NOPFL\n");
02510 } else {
02511 if ( (pflsize = MEDprofileSizeByName(fid,pflname)) <0 ) {
02512 MESSAGE("Erreur a la lecture du nombre de valeurs du profil : ");
02513 SSCRUTE(pflname);
02514 ret = -1; continue;
02515 }
02516
02517 printf("\t- Profil : |%s| de taille "IFORMAT"\n",pflname,pflsize);
02518
02519 pflval = (med_int*) malloc(sizeof(med_int)*pflsize);
02520 EXIT_IF(pflval == NULL,NULL,NULL);
02521 if ( MEDprofileRd(fid,pflname,pflval) <0) {
02522 MESSAGE("Erreur a la lecture des valeurs du profil : ");
02523 SSCRUTE(pflname);
02524 ret = -1;
02525 }
02526 if (!structure) {
02527 printf("\t");
02528 for (m=0;m<pflsize;m++) printf(" "IFORMAT" ",*(pflval+m));
02529 printf("\n");
02530 }
02531 free(pflval);
02532 }
02533 }
02534 }
02535 }
02536 }
02537 }
02538
02539 free(AFF_STRUCT);
02540 return ret;
02541 }
02542
02543
02544
02545
02546
02547
02548
02549
02550
02551
02552
02553
02554
02555
02556
02557 void lecture_resultats(const med_idt fid,
02558 const char * const maillage,
02559 const med_int mnumdt,
02560 const med_int mnumit,
02561 const med_switch_mode mode_coo,
02562 const med_int nmodels,
02563 const med_geometry_type* geotype_elst,
02564 const char* geotypename_elst,
02565 const int lecture_en_tete_seulement)
02566 {
02567 med_err ret,lret;
02568 char *comp, *unit;
02569 char nomcha [MED_NAME_SIZE+1]="";
02570 med_int ncomp,ncha;
02571 med_field_type typcha;
02572 int i;
02573
02574 char nommaa[MED_NAME_SIZE+1]="";
02575 med_bool localmaa = MED_FALSE;
02576 char dtunit[MED_SNAME_SIZE+1]="";
02577 med_int nbofcstp=0;
02578
02579
02580
02581 ncha = MEDnField(fid);
02582 EXIT_IF(ncha < 0,"lors de la lecture du nombre de champs",NULL);
02583
02584 if ( !strlen(maillage) || lecture_en_tete_seulement ) {
02585 fprintf(stdout,"\n(************************)\n");
02586 fprintf(stdout,"(* CHAMPS DU MAILLAGE : *)\n");
02587 fprintf(stdout,"(************************)\n");
02588 fprintf(stdout,"- Nombre de champs : "IFORMAT" \n",ncha);
02589 }
02590
02591
02592
02593
02594 ret = 0;
02595
02596
02597 for (i =0;i<ncha;i++) {
02598 lret = 0;
02599
02600
02601 if ((ncomp = MEDfieldnComponent(fid,i+1)) < 0) {
02602 MESSAGE("Erreur à la lecture du nombre de composantes : ");
02603 ISCRUTE(ncomp);
02604 ret = -1; continue;
02605 }
02606
02607
02608
02609 comp = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
02610 EXIT_IF(comp == NULL,NULL,NULL);
02611 unit = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
02612 EXIT_IF(unit == NULL,NULL,NULL);
02613
02614 if ( MEDfieldInfo(fid, i+1, nomcha, nommaa, &localmaa,
02615 &typcha, comp, unit, dtunit, &nbofcstp) < 0 ) {
02616 MESSAGE("Erreur à la demande d'information sur les champs : ");
02617 ret = -1; continue;
02618 }
02619
02620
02621 if ( !strlen(maillage) || lecture_en_tete_seulement ) {
02622 printf("\nChamp numero : |%d| \n",i+1);
02623 printf("Nom du champ : |%s| de type |%d|\n",nomcha,typcha);
02624 printf("Nom des composantes : |%s|\n",comp);
02625 printf("Unites des composantes : |%s| \n",unit);
02626 if (strlen(dtunit))
02627 printf("Unité des dates : |%s|\n",dtunit);
02628 if ( nbofcstp > 1 )
02629 printf("Nombre d'étapes de calcul : |"IFORMAT"| \n",nbofcstp);
02630 }
02631
02632
02633 if (lecture_en_tete_seulement) {
02634 free(comp);
02635 free(unit);
02636 continue;
02637 }
02638
02639
02640 lret = getFieldsOn(fid, maillage, mnumdt, mnumit, nmodels,geotype_elst,geotypename_elst,
02641 nomcha, dtunit, typcha, ncomp, comp, unit, MED_NODE,mode_coo, nbofcstp);
02642
02643
02644 if (lret == 0) lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels,geotype_elst,geotypename_elst,
02645 nomcha, dtunit, typcha, ncomp, comp, unit, MED_CELL,mode_coo, nbofcstp);
02646 else { MESSAGE("Erreur à la lecture des champs aux noeuds "); ret = -1; continue;}
02647
02648 if (lret == 0) lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels,geotype_elst,geotypename_elst,
02649 nomcha, dtunit, typcha, ncomp, comp, unit, MED_DESCENDING_FACE,mode_coo, nbofcstp);
02650 else { MESSAGE("Erreur à la lecture des champs aux mailles "); ret = -1; continue;}
02651
02652 if (lret == 0) lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels,geotype_elst,geotypename_elst,
02653 nomcha, dtunit, typcha, ncomp, comp, unit, MED_DESCENDING_EDGE,mode_coo, nbofcstp);
02654 else {MESSAGE("Erreur à la lecture des champs aux faces "); ret = -1; continue;}
02655
02656 if (lret == 0) lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels,geotype_elst,geotypename_elst,
02657 nomcha, dtunit, typcha, ncomp, comp, unit, MED_NODE_ELEMENT,mode_coo, nbofcstp);
02658 else {MESSAGE("Erreur a la lecture des champs aux aretes "); ret = -1; continue;}
02659
02660 if (lret != 0) {MESSAGE("Erreur a la lecture des champs aux noeuds des mailles "); ret = -1;};
02661
02662 if (nmodels)
02663 lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels, geotype_elst,geotypename_elst,
02664 nomcha, dtunit, typcha, ncomp, comp, unit, MED_STRUCT_ELEMENT,mode_coo, nbofcstp);
02665 if (lret != 0) {MESSAGE("Erreur a la lecture des champs aux éléments de sructure "); ret = -1;};
02666
02667 free(comp);
02668 free(unit);
02669
02670 }
02671
02672 return;
02673 }
02674
02675
02676
02677
02678
02679
02680
02681
02682
02683
02684
02685
02686 void lecture_parametres_scalaires(med_idt fid,
02687 int lecture_en_tete_seulement)
02688 {
02689 med_err ret = 0;
02690 char nom_scalaire[MED_NAME_SIZE+1];
02691 char description[MED_COMMENT_SIZE+1];
02692 med_int vali;
02693 med_float valr;
02694 med_int i,n,npdt,j;
02695 med_parameter_type type;
02696 med_int numdt,numo;
02697 med_float dt;
02698 char dt_unit[MED_SNAME_SIZE+1];
02699
02700
02701
02702 n = MEDnParameter(fid);
02703 EXIT_IF(n < 0,"lors de la lecture du nombre de scalaires",NULL);
02704
02705 if (n) {
02706 fprintf(stdout,"\n(*******************************)\n");
02707 fprintf(stdout,"(* VARIABLES SCALAIRES : *)\n");
02708 fprintf(stdout,"(*******************************)\n\n");
02709 fprintf(stdout,"- Nombre de variables scalaires : "IFORMAT"\n",n);
02710 }
02711 if (lecture_en_tete_seulement)
02712 return ;
02713
02714 for (i=1;i<=n;i++) {
02715
02716
02717 ret = MEDparameterInfo( fid,i,nom_scalaire,&type,description,
02718 dt_unit, &npdt );
02719 EXIT_IF(ret < 0,"lors de la lecture des parametres d'un scalaire",NULL);
02720 fprintf(stdout,"- Scalaire n°"IFORMAT" de nom %s \n",i,nom_scalaire);
02721 if (type == MED_FLOAT64)
02722 fprintf(stdout," Type flottant. \n");
02723 else
02724 fprintf(stdout," Type entier. \n");
02725 printf(" Description associee : [%s] \n",description);
02726
02727
02728
02729 EXIT_IF(npdt < 0,
02730 "lors de la lecture du nombre de pas de temps d'un scalaire"
02731 ,NULL);
02732 fprintf(stdout," Nombre de valeurs stockees : "IFORMAT" \n",npdt);
02733
02734 for (j=1;j<=npdt;j++) {
02735
02736 ret = MEDparameterComputationStepInfo(fid,nom_scalaire,j, &numdt,&numo,&dt);
02737 EXIT_IF(ret < 0,
02738 "lors de la lecture des parametres d'un pas de temps d'un scalaire",
02739 NULL);
02740
02741 if (numdt == MED_NO_DT)
02742 fprintf(stdout," - Aucun de pas de temps \n");
02743 else
02744 fprintf(stdout,
02745 " - Pas de de temps de numero "IFORMAT" de valeur %f [%s] \n",numdt,
02746 dt,dt_unit);
02747 if (numo == MED_NO_IT)
02748 fprintf(stdout," - Aucun numero d'ordre \n");
02749 else
02750 fprintf(stdout," - Numero d'ordre : "IFORMAT" \n",numo);
02751
02752 if (type == MED_FLOAT64) {
02753 ret = MEDparameterValueRd(fid,nom_scalaire,numdt,numo,(unsigned char * ) &valr);
02754 fprintf(stdout," - Valeur : %f \n",valr);
02755 }
02756 else {
02757 ret = MEDparameterValueRd(fid,nom_scalaire,numdt,numo,(unsigned char * ) &vali);
02758 fprintf(stdout," - Valeur : "IFORMAT" \n",vali);
02759 }
02760 EXIT_IF(ret < 0,"lors de la lecture de la valeur d'un scalaire",NULL);
02761
02762 }
02763 }
02764
02765 return ;
02766 }
02767
02768
02769
02770
02771
02772
02773
02774
02775
02776
02777
02778
02779 void lecture_profils(med_idt fid,
02780 int lecture_en_tete_seulement)
02781 {
02782 med_err ret;
02783 char pflname[MED_NAME_SIZE+1]="";
02784 med_int npro,*pflval,nval;
02785 int i,j;
02786
02787
02788
02789 npro = MEDnProfile(fid);
02790 EXIT_IF(npro < 0,"lors de la lecture du nombre de profils",NULL);
02791
02792 if (npro) {
02793 fprintf(stdout,"\n(*************)\n");
02794 fprintf(stdout, "(* PROFILS : *)\n");
02795 fprintf(stdout, "(*************)\n");
02796 printf("\nNombre de profils stockes : "IFORMAT"\n\n",npro);
02797 }
02798
02799 for (i=1 ; i <= npro ; i++ ) {
02800 if ( MEDprofileInfo(fid, i, pflname, &nval) < 0) {
02801 MESSAGE("Erreur a la demande d'information sur le profil n° : "); ISCRUTE_int(i);
02802 ret = -1;continue;
02803 }
02804 printf("\t- Profil n°%i de nom |%s| et de taille "IFORMAT"\n",i,pflname,nval);
02805 pflval = (med_int*) malloc(sizeof(med_int)*nval);
02806 if ( MEDprofileRd(fid, pflname, pflval) < 0) {
02807 MESSAGE("Erreur a la lecture des valeurs du profil : ");
02808 SSCRUTE(pflname);
02809 ret = -1;
02810 } else {
02811 if (!structure) {
02812 printf("\t");
02813 for (j=0;j<nval;j++) printf(" "IFORMAT" ",*(pflval+j));
02814 }
02815 printf("\n\n");
02816 }
02817 free(pflval);
02818 }
02819 return;
02820 }
02821
02822
02823
02824
02825
02826
02827
02828
02829
02830
02831
02832
02833 void lecture_modeles_elstruct(med_idt fid,
02834 int lecture_en_tete_seulement)
02835 {
02836 med_err _ret=0;
02837 int _i =0,_j=0,_k=0, _n=0,_nvalue=0;
02838 med_int _nstructelement=0;
02839
02840 med_geometry_type _geotype=MED_NONE;
02841
02842 char _elementname[MED_NAME_SIZE+1]="";
02843 med_int _elementdim=0;
02844 char _supportmeshname[MED_NAME_SIZE+1]="";
02845 med_entity_type _entitytype=MED_UNDEF_ENTITY_TYPE;
02846 med_int _nbofnode=0;
02847 med_int _nbofcell=0;
02848 med_geometry_type _geocelltype=MED_NONE;
02849 char _geocelltypename[MED_SNAME_SIZE+1]="";
02850 med_int _nbofconstantattribute=0;
02851 med_bool _anyprofile=0;
02852 med_int _nbofvariableattribute=0;
02853
02854 char _constattname[MED_NAME_SIZE+1]="";
02855 med_attribute_type _constatttype=MED_ATT_UNDEF;
02856 char _varattname[MED_NAME_SIZE+1]="";
02857 med_attribute_type _varatttype=MED_ATT_UNDEF;
02858 med_int _nbofcomponent=0;
02859 med_entity_type _attentitytype=MED_UNDEF_ENTITY_TYPE;
02860 char _profilename[MED_NAME_SIZE+1]="";
02861 med_int _profilesize=0;
02862
02863 unsigned char * _value=NULL;
02864 void (*_printf)(const void*);
02865 med_int _atttypesize=0;
02866
02867 _nstructelement = MEDnStructElement(fid);
02868 EXIT_IF(_nstructelement < 0,"lors de la lecture du nombre d'éléments de structure",NULL);
02869
02870 if(_nstructelement) {
02871 fprintf(stdout,"\n(*************************************)\n");
02872 fprintf(stdout, "(* MODELES D'ELEMENTS DE STRUCTURE : *)\n");
02873 fprintf(stdout, "(*************************************)\n");
02874 printf("\nNombre d'éléments de structure : "IFORMAT"\n\n",_nstructelement);
02875 }
02876
02877 for ( _i=1; _i<= _nstructelement; ++_i) {
02878
02879 _ret= MEDstructElementInfo(fid,_i,_elementname,&_geotype,&_elementdim,_supportmeshname,
02880 &_entitytype,&_nbofnode,&_nbofcell,&_geocelltype,&_nbofconstantattribute,&_anyprofile,
02881 &_nbofvariableattribute );
02882 EXIT_IF(_ret < 0,"lors de la demande d'information sur les éléments de structure",NULL);
02883
02884 fprintf(stdout,"\nElément de structure n°%d |%s| de type géométrique n°%d et de dimension "IFORMAT"\n",
02885 _i,_elementname,_geotype,_elementdim);
02886 if ( strlen(_supportmeshname) ) {
02887 fprintf(stdout,"\t Maillage support de nom |%s|",_supportmeshname);
02888 if (_nbofcell) {
02889 MEDmeshGeotypeName(fid,_geocelltype,_geocelltypename);
02890 fprintf(stdout," avec "IFORMAT" maille(s) de type |%s| et",_nbofcell,_geocelltypename);
02891 }
02892 if (_nbofnode)
02893 fprintf(stdout," avec "IFORMAT" noeud(s)\n",_nbofnode);
02894 else {
02895 fprintf(stderr,"\n Erreur : les noeuds doivent être définis s'il existe un maillage support\n");
02896 }
02897 } else
02898 fprintf(stdout,"\t Maillage support implicite sur noeud\n");
02899
02900 fprintf(stdout,"\t Nombre d'attribut(s) constant(s) : "IFORMAT"",_nbofconstantattribute);
02901 if (_anyprofile) fprintf(stdout,", avec profil.\n"); else fprintf(stdout,", sans profil.\n");
02902
02903 if ( _nbofconstantattribute ) {
02904 for (_j=1;_j<=_nbofconstantattribute;++_j) {
02905 _ret= MEDstructElementConstAttInfo(fid, _elementname,_j,
02906 _constattname, &_constatttype, &_nbofcomponent,
02907 &_attentitytype, _profilename, &_profilesize );
02908 EXIT_IF(_ret < 0,"lors de la demande d'information sur les attributs constants des éléments de structure",NULL);
02909
02910 fprintf(stdout,"\t\t Attribut constant de nom |%s| de type %d à "IFORMAT" composantes\n",
02911 _constattname,_constatttype,_nbofcomponent);
02912
02913 if (!_profilesize) {
02914 if (_attentitytype == MED_NODE) _nvalue = _nbofnode; else _nvalue=_nbofcell;
02915 } else {
02916 _nvalue = _profilesize;
02917 }
02918 _n = _nbofcomponent*_nvalue;
02919 if ( _attentitytype == MED_ATT_NAME) ++_n;
02920 _atttypesize = MEDstructElementAttSizeof(_constatttype);
02921 _value = (unsigned char *) malloc(_n*_atttypesize);
02922 if ( _attentitytype == MED_ATT_NAME) --_n;
02923
02924 _ret= MEDstructElementConstAttRd(fid, _elementname,_constattname, _value );
02925 if (_ret < 0 ) free(_value);
02926 EXIT_IF(_ret < 0,"lors de la lecture des valeurs des attributs constants",NULL);
02927 _printf=MEDstructPrintFunction(_constatttype);
02928
02929 if (!structure) {
02930 fprintf(stdout,"\t\t - Valeurs de l'attribut sur les d'entité |%s|",
02931 MED23MESH_GET_ENTITY_TYPENAME[_attentitytype+1]);
02932 if ( _profilesize)
02933 fprintf(stdout," avec un profil |%s| de taille "IFORMAT": ",_profilename,_profilesize);
02934 else
02935 fprintf(stdout," sans profil : ");
02936
02937 for (_k=0;_k<_nvalue*_nbofcomponent;_k++) {
02938
02939 if ( !(_k % _nbofcomponent) )
02940 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (_k/_nbofcomponent +1) );
02941 _printf( (void *)( (char *)(_value) + _k*_atttypesize) );
02942 }
02943 printf("\n");
02944 }
02945
02946 free(_value);
02947 printf("\n");
02948 }
02949 }
02950
02951 fprintf(stdout,"\t Nombre d'attribut(s) variable(s) : "IFORMAT"\n",_nbofvariableattribute);
02952 if ( _nbofvariableattribute ) {
02953 for (_j=1;_j<=_nbofvariableattribute;++_j) {
02954 _ret = MEDstructElementVarAttInfo(fid, _elementname,_j,_varattname,&_varatttype,&_nbofcomponent );
02955 EXIT_IF(_ret < 0,"lors de la lecture des valeurs des attributs variables",NULL);
02956 fprintf(stdout,"\t\t Attribut variable de nom |%s| de type %d à "IFORMAT" composantes\n",
02957 _varattname,_varatttype,_nbofcomponent);
02958 }
02959 }
02960
02961 }
02962
02963 return;
02964 }
02965
02966
02967
02968
02969
02970
02971
02972
02973
02974
02975
02976
02977 void lecture_fonctions_interpolation(med_idt fid,
02978 int lecture_en_tete_seulement)
02979 {
02980
02981 med_err _ret=-1;
02982 med_int _ninterp=0;
02983 int _interpit =0;
02984 char _interpname[MED_NAME_SIZE+1]="";
02985 med_geometry_type _geotype =MED_NONE;
02986 char _geotypename[MED_SNAME_SIZE+1]="";
02987 med_int _geodim=0,_geonnodes=0;
02988 med_bool _cellnodes =MED_FALSE;
02989 med_int _nbofbasisfunc =0;
02990 med_int _nbofvariable =0;
02991 med_int _maxdegree =0;
02992 med_int _nmaxcoefficient =0;
02993 int _basisfuncit =0;
02994 int _powerit =0;
02995 med_int _nbofcoefficient =0;
02996 med_int* _power =NULL;
02997 med_float* _coefficient =NULL;
02998 int _coefficientit =0;
02999
03000
03001 _ninterp = MEDnInterp(fid);
03002 if (_ninterp) {
03003 fprintf(stdout,"\n(********************************)\n");
03004 fprintf(stdout, "(* FONCTIONS D'INTERPOLATION : *)\n");
03005 fprintf(stdout, "(********************************)\n");
03006 printf("\nNombre de fonctions d'interpolation : "IFORMAT"\n\n",_ninterp);
03007 }
03008
03009 for ( _interpit=1; _interpit<= _ninterp; ++_interpit) {
03010
03011 if (MEDinterpInfo(fid,_interpit,_interpname,&_geotype,&_cellnodes,&_nbofbasisfunc,
03012 &_nbofvariable,&_maxdegree,&_nmaxcoefficient) < 0 ) {
03013 MESSAGE("Erreur à la demande d'information de la fonction d'interpolation n°");
03014 ISCRUTE_int(_interpit);
03015 _ret = -1;continue;
03016 }
03017
03018 MEDmeshGeotypeName(fid,_geotype,_geotypename);
03019 fprintf(stdout,"Fonction d'interpolation n° %d |%s| sur le type géométrique |%s|\n",
03020 _interpit,_interpname, _geotypename);
03021
03022 if ( MEDmeshGeotypeParameter(fid,_geotype,&_geodim,&_geonnodes) <0 ) {
03023 MESSAGE("Erreur à la lecture du nom associé au typegeo : "); ISCRUTE_int(_geotype);
03024 _ret = -1;continue;
03025 }
03026
03027 if ( _cellnodes ) {
03028 if ( _nbofbasisfunc == _geonnodes )
03029 fprintf(stdout,"\t Les noeuds de construction sont les noeuds de la maille de référence.\n");
03030 else {
03031 MESSAGE("Erreur : le nombre de noeuds de construction "\
03032 "est différent du nombre de noeuds de la maille de référence.\n");
03033 ISCRUTE(_nbofbasisfunc); ISCRUTE(_geonnodes);
03034 _ret = -1;continue;
03035 }
03036 }
03037
03038
03039
03040
03041
03042
03043
03044 fprintf(stdout,"\t Il y a "IFORMAT" fonctions de base avec "IFORMAT" variables\n ",_nbofbasisfunc,_nbofvariable);
03045 fprintf(stdout,"\t Le degré maximum des fonctions de base est "IFORMAT" et possèdent au maximum "IFORMAT" coefficients\n"
03046 ,_maxdegree,_nmaxcoefficient);
03047
03048
03049 _coefficient = (med_float*) calloc(sizeof(med_float),_nmaxcoefficient);
03050 _power = (med_int*) calloc(sizeof(med_int),_nbofvariable*_nmaxcoefficient);
03051
03052 for ( _basisfuncit=1; _basisfuncit<= _nbofbasisfunc; ++_basisfuncit) {
03053
03054
03055 if ( (_ret = MEDinterpBaseFunctionRd( fid,_interpname,_basisfuncit,&_nbofcoefficient,_power,_coefficient) <0) ) {
03056 MESSAGE("Erreur à la lecture de la fonction de base n°");ISCRUTE_int(_basisfuncit);
03057 _ret=-1;continue;
03058 } else {
03059 if (!structure) {
03060
03061 fprintf(stdout,"\n\t Tableau de coefficients de la fonctions de base n° %d :\n\t",_basisfuncit);
03062 for ( _coefficientit=1; _coefficientit<= _nbofcoefficient; ++_coefficientit)
03063 fprintf(stdout," %4f ",_coefficient[_coefficientit]);
03064
03065 fprintf(stdout,"\n\t Tableau de puissances de la fonctions de base n° %d :\n\t",_basisfuncit);
03066 for ( _powerit=1; _powerit<= _nbofvariable*_nbofcoefficient; ++_powerit)
03067 fprintf(stdout," %4"MED_IFORMAT" ",_power[_powerit]);
03068 }
03069 }
03070 }
03071 fprintf(stdout,"\n");
03072 free(_coefficient);
03073 free(_power);
03074
03075 }
03076
03077 return;
03078 }
03079
03080
03081
03082
03083
03084
03085
03086
03087
03088
03089
03090
03091 void lecture_liens(med_idt fid,
03092 int lecture_en_tete_seulement)
03093 {
03094 med_err ret;
03095 char nomlien[MED_NAME_SIZE+1]="";
03096 char *lien = NULL;
03097 med_int nln=0,nval=0;
03098 int i;
03099
03100
03101
03102 nln = MEDnLink(fid);
03103
03104 if (nln) {
03105 fprintf(stdout,"\n(***********)\n");
03106 fprintf(stdout, "(* LIENS : *)\n");
03107 fprintf(stdout, "(***********)\n");
03108 printf("\nNombre de liens : "IFORMAT"\n\n",nln);
03109 }
03110
03111 for (i=1 ; i <= nln ; i++ ) {
03112 if ( MEDlinkInfo(fid, i, nomlien, &nval) < 0) {
03113 MESSAGE("Erreur a la demande d'information sur le lien n° : "); ISCRUTE_int(i);
03114 ret = -1;continue;
03115 }
03116 printf("\t- Lien n°%i de nom |%s| et de taille "IFORMAT"\n",i,nomlien,nval);
03117
03118 lien = (char * ) malloc((nval+1)*sizeof(char));
03119 EXIT_IF(lien == NULL,NULL,NULL);
03120
03121 if ( MEDlinkRd(fid, nomlien, lien ) < 0 ) {
03122 MESSAGE("Erreur a la lecture du lien : ");
03123 SSCRUTE(nomlien);SSCRUTE(lien);
03124 ret = -1;
03125 } else {
03126 lien[nval] = '\0';
03127 printf("\t\t|%s|\n\n",lien);
03128 }
03129 free(lien);
03130 }
03131 return;
03132 }
03133
03134
03135
03136
03137
03138
03139
03140
03141
03142
03143
03144
03145
03146
03147
03148 void lecture_localisation(med_idt fid,
03149 const med_switch_mode mode_coo,
03150 int lecture_en_tete_seulement)
03151 {
03152 med_err ret = 0;
03153 med_int nloc=0,locsdim=0,ngauss=0;
03154 med_geometry_type type_geo;
03155 med_float *refcoo=NULL, *gscoo=NULL, *wg=NULL;
03156 char locname [MED_NAME_SIZE+1]="";
03157 char geointerpname [MED_NAME_SIZE+1]="";
03158 char ipointstructmeshname[MED_NAME_SIZE+1]="";
03159 med_int nsectionmeshcell = 0;
03160 med_geometry_type sectiongeotype;
03161 char sectiongeotypename[MED_NAME_SIZE+1]="";
03162 med_int locentdim=0;
03163 med_int locnnodes=0;
03164 char _locgeotypename[MED_NAME_SIZE+1]="";
03165 int t1=0,t2=0,t3=0;
03166 int i=0,j=0;
03167
03168
03169
03170 nloc = MEDnLocalization(fid);
03171 if (nloc) {
03172 fprintf(stdout,"\n(********************************************)\n");
03173 fprintf(stdout, "(* LOCALISATIONS DES POINTS D'INTEGRATION : *)\n");
03174 fprintf(stdout, "(********************************************)\n");
03175 printf("\nNombre de localisations stockees : "IFORMAT"\n\n",nloc);
03176 }
03177
03178 for (i=1 ; i <= nloc ; i++ ) {
03179 if ( MEDlocalizationInfo(fid, i, locname, &type_geo, &locsdim, &ngauss,
03180 geointerpname, ipointstructmeshname, &nsectionmeshcell,
03181 §iongeotype) < 0) {
03182 MESSAGE("Erreur a la demande d'information sur la localisation n° : "); ISCRUTE_int(i);
03183 ret = -1;continue;
03184 }
03185 printf("\t- Loc. n°%i de nom |%s| de dimension "IFORMAT" avec "IFORMAT" pts de GAUSS \n",i,locname,locsdim,ngauss);
03186
03187 if ( MEDmeshGeotypeName(fid, type_geo,_locgeotypename) <0 ) {
03188 MESSAGE("Erreur à la lecture du nom associé au typegeo : "); ISCRUTE_int(type_geo);
03189 ret = -1;continue;
03190 }
03191
03192 if ( MEDmeshGeotypeParameter(fid, type_geo,&locentdim,&locnnodes) <0 ) {
03193 MESSAGE("Erreur à la lecture du nom associé au typegeo : "); ISCRUTE_int(type_geo);
03194 ret = -1;continue;
03195 }
03196
03197 if (strlen(ipointstructmeshname)) {
03198 if ( MEDmeshGeotypeName(fid, sectiongeotype,sectiongeotypename) <0 ) {
03199 MESSAGE("Erreur à la lecture du nom associé au sectiongeotype : "); ISCRUTE_int(sectiongeotype);
03200 SSCRUTE(ipointstructmeshname);
03201 ret = -1;continue;
03202 }
03203 }
03204
03205 t1 = locnnodes*locsdim;
03206 t2 = ngauss*locsdim;
03207 t3 = ngauss;
03208 refcoo = (med_float *) malloc(sizeof(med_float)*t1 );
03209 gscoo = (med_float *) malloc(sizeof(med_float)*t2 );
03210 wg = (med_float *) malloc(sizeof(med_float)*t3 );
03211
03212 if ( MEDlocalizationRd(fid, locname, mode_coo, refcoo, gscoo, wg ) < 0) {
03213 MESSAGE("Erreur a la lecture des valeurs de la localisation : ");
03214 SSCRUTE(locname);
03215 ret = -1;
03216 } else {
03217 if (!structure) {
03218 printf("\t Coordonnees de l'element de reference de type |%s| :\n\t\t",_locgeotypename);
03219
03220 for (j=0;j<locnnodes*locsdim;j++) {
03221 if (mode_coo == MED_FULL_INTERLACE && !(j % locsdim))
03222 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/locsdim + 1) );
03223 if (mode_coo == MED_NO_INTERLACE && ! (j % locnnodes))
03224 fprintf(stdout,"\n\n ");
03225 fprintf(stdout," %-+9.6f ",*(refcoo+j));
03226 }
03227 printf("\n");
03228 printf("\t Localisation des points de GAUSS : \n\t\t");
03229
03230 for (j=0;j<ngauss*locsdim;j++) {
03231 if (mode_coo == MED_FULL_INTERLACE && !(j % locsdim))
03232 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/locsdim + 1) );
03233 if (mode_coo == MED_NO_INTERLACE && ! (j % ngauss))
03234 fprintf(stdout,"\n\n ");
03235 fprintf(stdout," %-+9.6f ",*(gscoo+j));
03236 }
03237 printf("\n");
03238 printf("\t Poids associes aux points de GAUSS :\n\t\t");
03239 for (j=0;j<t3;j++) printf(" %f ",*(wg+j));
03240 printf("\n");
03241 }
03242 if (strlen(ipointstructmeshname)) {
03243 printf("\t Maillage support de section d'élément de structure |%s|.\n",ipointstructmeshname);
03244 printf("\t Mailles des sections d'élément de structure de type |%s|.\n",sectiongeotypename);
03245 printf("\t Nombre de mailles par section d'élément de structure : "IFORMAT".\n",nsectionmeshcell);
03246 }
03247 if (strlen(geointerpname)) {
03248 printf("\t Tranformation géométrique associée à la localisation |%s|.\n",geointerpname);
03249 }
03250 printf("\n\n");
03251 }
03252 free(refcoo);
03253 free(gscoo);
03254 free(wg);
03255 }
03256
03257 return;
03258 }
03259
03260
03261 med_idt ouverture_fichier_MED(char *fichier)
03262 {
03263 med_idt fid;
03264 med_err ret = 0;
03265 med_int majeur,mineur,release;
03266 med_bool hdfok;
03267 med_bool medok;
03268
03269
03270 ret = (int) access(fichier,F_OK);
03271 if (ret <0) { SSCRUTE(fichier);}
03272 EXIT_IF(ret < 0,"Le fichier n'est pas accessible ou n'existe pas ",
03273 fichier);
03274
03275
03276 ret = MEDfileCompatibility (fichier,&hdfok, &medok );
03277 EXIT_IF(ret < 0,"Impossible de déterminer la compatibilité de format. ",
03278 fichier);
03279
03280 EXIT_IF(!hdfok,"Le fichier n'est pas dans un format HDF compatible ", fichier);
03281 EXIT_IF(!medok,"Le fichier n'est pas dans un format MED compatible ", fichier);
03282
03283
03284 MEDlibraryNumVersion(&majeur,&mineur,&release);
03285 fprintf(stdout,
03286 "- Lecture du fichier à l'aide de la bibliotheque MED V"IFORMAT"."IFORMAT"."IFORMAT" \n",
03287 majeur,mineur,release);
03288
03289
03290 fid = MEDfileOpen(fichier,MED_ACC_RDONLY);
03291 EXIT_IF( fid < 0,"Ouverture du du fichier ",fichier);
03292
03293 MEDfileNumVersionRd(fid, &majeur, &mineur, &release);
03294 EXIT_IF(( (majeur < 2) || ( (majeur == 2) && (mineur < 2)) ), "Le fichier est antérieur à la version 2.2", NULL);
03295
03296 return fid;
03297 }
03298
03299 void lecture_en_tete(med_idt fid,char* fichier)
03300 {
03301 char fichier_en_tete[MED_COMMENT_SIZE+1];
03302 med_err ret = 0;
03303
03304
03305
03306 ret = MEDfileCommentRd(fid,fichier_en_tete);
03307
03308
03309 if (ret >= 0)
03310 fprintf(stdout,"- En-tete du fichier : %s \n",fichier_en_tete);
03311
03312 return;
03313 }
03314
03315 void parametrage(med_switch_mode *mode_coo,
03316 med_connectivity_mode *typ_con)
03317 {
03318 int reponse;
03319 char _temp[256]="";
03320
03321 fprintf(stdout,"(*****************)\n");
03322 fprintf(stdout,"(* PARAMETRAGE : *)\n");
03323 fprintf(stdout,"(*****************)\n");
03324 fprintf(stdout,"- Mode d'affichage des coordonnées des noeuds ? \n");
03325 fprintf(stdout," 1. Mode entrelacé : taper 1 \n");
03326 fprintf(stdout," 2. Mode non entrelacé : taper 2 \n");
03327 reponse = 0;
03328 do {
03329 fprintf(stdout," Reponse : ");
03330 if (!scanf("%d",&reponse)) fgets(_temp, 256, stdin) ;
03331 } while (reponse != 1 && reponse != 2);
03332 if (reponse == 1)
03333 *mode_coo = MED_FULL_INTERLACE;
03334 else
03335 *mode_coo = MED_NO_INTERLACE;
03336
03337 fprintf(stdout,"- Connectivité des éléments ? \n");
03338 fprintf(stdout," 1. Nodale : taper 1 \n");
03339 fprintf(stdout," 2. Descendante : taper 2 \n");
03340 reponse = 0;
03341 do {
03342 fprintf(stdout," Reponse : ");
03343 if (!scanf("%d",&reponse)) fgets(_temp, 256, stdin) ;
03344 } while (reponse != 1 && reponse != 2);
03345 if (reponse == 1)
03346 *typ_con = MED_NODAL;
03347 else
03348 *typ_con = MED_DESCENDING;
03349
03350 return;
03351 }
03352
03353
03354 void lecture_information_maillage(const med_idt fid,
03355 const int numero,
03356 char * nommaa,
03357 med_int * const mdim,
03358 med_int * const edim,
03359 med_mesh_type * const type_maillage,
03360 char * const maillage_description,
03361 med_int * const nstep,
03362 char * const dtunit,
03363 char * const nomcoo,
03364 char * const unicoo,
03365 med_axis_type *const rep)
03366 {
03367 char nom_universel[MED_LNAME_SIZE+1];
03368 med_err ret = 0;
03369 med_sorting_type sortingtype;
03370
03371 fprintf(stdout,"\n(**********************************************************)\n");
03372 fprintf(stdout,"(* INFORMATIONS GENERALES SUR LE MAILLAGE DE CALCUL N°%2.2d: *)\n",numero);
03373 fprintf(stdout,"(**********************************************************)\n\n");
03374
03375
03376 ret = MEDmeshInfo(fid, numero,nommaa,edim,mdim,type_maillage,maillage_description,
03377 dtunit,&sortingtype,nstep,rep,nomcoo,unicoo);
03378 EXIT_IF(ret < 0,"Lecture des informations sur le maillage",NULL);
03379
03380
03381 fprintf(stdout,"- Nom du maillage : <<%s>>\n",nommaa);
03382 fprintf(stdout,"- Dimension du maillage : "IFORMAT"\n",*mdim);
03383 if (*edim > *mdim)
03384 fprintf(stdout,"- La dimension de l'espace est "IFORMAT" \n",*edim);
03385 if (*type_maillage == MED_UNSTRUCTURED_MESH)
03386 fprintf(stdout,"- Type du maillage : MED_NON_STRUCTURE \n");
03387 else
03388 fprintf(stdout,"- Type du maillage : MED_STRUCTURE \n");
03389 fprintf(stdout,"- Description associee au maillage : %s\n",
03390 maillage_description);
03391
03392 if ( *nstep > 1 )
03393 fprintf(stdout,"- Nombre d'étapes de calcul associées au maillage : "IFORMAT"\n",
03394 *nstep);
03395 if (strlen(dtunit))
03396 fprintf(stdout,"- Unité des dates d'étapes de calcul associées au maillage : %s\n",
03397 dtunit);
03398
03399
03400 ret = MEDmeshUniversalNameRd(fid,nommaa,nom_universel);
03401 if (ret == 0)
03402 fprintf(stdout,"- Nom universel du maillage : %s \n",nom_universel);
03403
03404 return;
03405 }
03406
03407
03408
03409
03410
03411
03412
03413
03414
03415
03416
03417 int main (int argc, char **argv)
03418 {
03419 med_err ret = 0;
03420 med_idt fid;
03421 int i=0,numero=0,firstmesh=0,lastmesh=0,meshit=0;
03422 med_switch_mode mode_coo = MED_UNDEF_INTERLACE;
03423 med_connectivity_mode typ_con = MED_UNDEF_CONNECTIVITY_MODE;
03424 int lecture_en_tete_seulement = 0;
03425 med_int mdim=0,nmaa=0,nmaasup=0;
03426 char nommaa[MED_NAME_SIZE+1];
03427 char maillage_description[MED_COMMENT_SIZE+1];
03428 med_mesh_type type_maillage;
03429 med_int edim;
03430 int decalage;
03431 char nomcoo[3*MED_SNAME_SIZE+1]="";
03432 char unicoo[3*MED_SNAME_SIZE+1]="";
03433 char dtunit[MED_SNAME_SIZE+1]="";
03434 med_int nstep=0,numdt=MED_NO_DT,numit=MED_NO_IT;
03435 int csit=0;
03436 med_float dt=0.0;
03437 med_axis_type rep;
03438
03439
03440 char *filename=NULL,*typ_con_param=NULL,*mode_coo_param=NULL;
03441 size_t _bannerlen=0;
03442 char _temp[MAXBANNERLEN+1]="";
03443 char * _bannerstr=NULL;
03444
03445
03446
03447 med_int _nmodels=0;
03448 med_geometry_type *_geotype_elst = NULL;
03449 char *_geotypename_elst = NULL;
03450
03451
03452
03453
03454
03455
03456
03457 structure = 0;
03458 decalage = 0;
03459 if (argc > 2 && strcmp(argv[1], "--structure") == 0) {
03460 --argc;++decalage;
03461 structure = 1;
03462 }
03463
03464 if ( (argc != 2) && (argc != 5) )
03465
03466 fprintf(stderr,"Utilisation mdump [--structure] monfichier.med [ NODALE|DESCENDANTE "
03467 "NO_INTERLACE|FULL_INTERLACE|LECTURE_EN_TETE_SEULEMENT N°MAILLAGE|0 pour tous ] \n");
03468 EXIT_IF( (argc != 2) && (argc != 5),"nombre de parametres incorrect\n",NULL);
03469
03470
03471
03472
03473
03474 filename = argv[1+decalage];
03475 fid = ouverture_fichier_MED(filename);
03476
03477
03478
03479
03480
03481
03482
03483 fprintf(stdout,"\n >>>>>> DUMP DU FICHIER %s >>>>>>\n",filename);
03484
03485
03486 lecture_en_tete(fid,filename);
03487
03488
03489 if (argc == 2)
03490 parametrage(&mode_coo,&typ_con);
03491 else {
03492 typ_con_param=argv[2 + decalage];
03493
03494 if (! strcmp(typ_con_param,"NODALE")) typ_con = MED_NODAL;
03495 if (! strcmp(typ_con_param,"DESCENDANTE")) typ_con = MED_DESCENDING;
03496 EXIT_IF( typ_con==MED_UNDEF_CONNECTIVITY_MODE,"Le paramètre de connectivité doit être soit NODALE|DESCENDANTE",NULL);
03497 mode_coo_param=argv[3 + decalage];
03498
03499 if (!strcmp(mode_coo_param,"NO_INTERLACE")) mode_coo = MED_NO_INTERLACE;
03500 if (!strcmp(mode_coo_param,"FULL_INTERLACE")) mode_coo = MED_FULL_INTERLACE;
03501 if (!strcmp(mode_coo_param,"LECTURE_EN_TETE_SEULEMENT")) { lecture_en_tete_seulement = MED_LECTURE_ENTETE_SEULEMENT;
03502 mode_coo = MED_FULL_INTERLACE;}
03503 EXIT_IF( (mode_coo==MED_UNDEF_INTERLACE) ,
03504 "Le paramètre d'entrelacement doit être soit "
03505 "NO_INTERLACE|FULL_INTERLACE|LECTURE_EN_TETE_SEULEMENT",NULL);
03506 }
03507
03508
03509
03510
03511
03512 nmaa = MEDnMesh(fid);
03513
03514
03515
03516 if (argc == 2) {
03517 if (nmaa >0) {
03518 fprintf(stdout,"- Il y a "IFORMAT" maillages dans ce fichier \n",nmaa);
03519 fprintf(stdout," Lequel voulez-vous lire (0 pour tous|1|2|3|...|n) ?\n");
03520 do {
03521 fprintf(stdout," Reponse : ");
03522 if (!scanf("%d",&numero)) fgets(_temp, 256, stdin) ;
03523 } while ( (numero > nmaa) || (numero < 0) );
03524 } else {
03525 fprintf(stdout,"- Il n'y a pas de maillage dans ce fichier \n");
03526 }
03527 } else {
03528 if ( argc == 5 ) {
03529 numero = atoi(argv[4 + decalage]);
03530 EXIT_IF(numero > nmaa || numero < 0,"ce numero de maillage n'existe pas", NULL);
03531 }
03532 }
03533
03534
03535
03536
03537
03538 nmaasup= MEDnSupportMesh(fid);
03539 if (nmaasup ) {
03540 fprintf(stdout, "\n(*****************************************************)\n");
03541 fprintf(stdout, "(* INFORMATIONS GENERALES SUR LES MAILLAGES SUPPORT: *)\n");
03542 fprintf(stdout, "(*****************************************************)\n");
03543 }
03544 for (meshit=1;meshit <= nmaasup;++meshit) {
03545
03546
03547 MEDsupportMeshInfo(fid, meshit, nommaa, &edim, &mdim,
03548 maillage_description, &rep, nomcoo, unicoo);
03549 fprintf(stdout,"\n(*******************************************)\n");
03550 fprintf(stdout,"(******** Maillage support n°%2.2d/%2.2"MED_IFORMAT" : *******)\n",meshit,nmaasup);
03551 fprintf(stdout,"(*******************************************)\n");
03552
03553 fprintf(stdout,"- Nom du maillage support : <<%s>>\n",nommaa);
03554 fprintf(stdout,"- Dimension du maillage : "IFORMAT"\n",mdim);
03555 if (edim > mdim)
03556 fprintf(stdout,"- La dimension de l'espace est "IFORMAT" \n",edim);
03557
03558 lecture_maillage_non_structure(fid,nommaa,MED_NO_DT,MED_NO_IT,mdim,edim,mode_coo,typ_con,
03559 nomcoo,unicoo,&rep, &_nmodels, &_geotype_elst,&_geotypename_elst,
03560 MED_LECTURE_MAILLAGE_SUPPORT_UNIQUEMENT);
03561
03562 }
03563
03564
03565
03566
03567
03568
03569
03570 lecture_parametres_scalaires(fid,lecture_en_tete_seulement);
03571
03572
03573
03574
03575
03576 lecture_localisation(fid,mode_coo,lecture_en_tete_seulement);
03577
03578
03579
03580
03581
03582 lecture_profils(fid,lecture_en_tete_seulement);
03583
03584
03585
03586
03587
03588
03589 lecture_modeles_elstruct( fid, lecture_en_tete_seulement);
03590
03591
03592
03593
03594
03595 lecture_fonctions_interpolation( fid, lecture_en_tete_seulement);
03596
03597
03598
03599
03600
03601 lecture_liens(fid,lecture_en_tete_seulement);
03602
03603
03604
03605
03606
03607 if (numero) {
03608 firstmesh=numero;lastmesh=numero;
03609 } else {
03610 firstmesh=1;lastmesh=nmaa;
03611 }
03612
03613 for (meshit=firstmesh;meshit<=lastmesh;++meshit) {
03614
03615 lecture_information_maillage(fid,meshit,nommaa,&mdim,&edim,&type_maillage,
03616 maillage_description,&nstep,dtunit,nomcoo,unicoo,&rep);
03617
03618
03619 for (csit=1; csit <= nstep; ++csit) {
03620
03621 ret = MEDmeshComputationStepInfo(fid, nommaa, csit, &numdt, &numit, &dt);
03622 EXIT_IF(ret < 0,"lors de l'appel à MEDmeshComputationStepInfo",NULL);
03623
03624
03625
03626
03627
03628
03629
03630 _bannerstr ="(* MAILLAGE DE CALCUL |%s| n°%2.2d A L'ETAPE DE CALCUL (n°dt,n°it)="
03631 "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT"): %.*s*)\n";
03632 snprintf(_temp,MAXBANNERLEN+1,_bannerstr,nommaa,meshit,numdt,numit,0,"");
03633 _bannerlen =strlen(_temp);
03634 fprintf(stdout,"\n(");
03635 for (i=0;i< _bannerlen-6; i++) fprintf(stdout,"*");
03636 fprintf(stdout,")\n%s(",_temp);
03637 for (i=0;i< _bannerlen-6; i++) fprintf(stdout,"*");
03638 fprintf(stdout,")\n");
03639
03640
03641
03642
03643
03644
03645 if (type_maillage == MED_UNSTRUCTURED_MESH)
03646 lecture_maillage_non_structure(fid,nommaa,numdt,numit,mdim,edim,mode_coo,typ_con,
03647 nomcoo,unicoo,&rep,
03648 &_nmodels,&_geotype_elst,&_geotypename_elst,
03649 lecture_en_tete_seulement);
03650 else {
03651 lecture_maillage_structure(fid,nommaa,numdt,numit,mdim,edim,mode_coo,
03652 nomcoo,unicoo,lecture_en_tete_seulement);
03653 }
03654
03655
03656 lecture_resultats(fid,nommaa,numdt,numit,mode_coo,
03657 _nmodels,_geotype_elst,_geotypename_elst,
03658 lecture_en_tete_seulement);
03659
03660 free(_geotype_elst);
03661 free(_geotypename_elst);
03662 }
03663 }
03664
03665
03666
03667
03668 ret = MEDfileClose(fid);
03669 EXIT_IF(ret < 0,"lors de la fermeture du fichier",argv[1 + decalage]);
03670
03671 fprintf(stdout,"\n >>>>>> FIN DU DUMP DU FICHIER %s >>>>>>\n",argv[1 + decalage]);
03672
03673 return EXIT_SUCCESS;
03674 }