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 _nnode=0;
00778 med_int _ncell=0;
00779 med_entity_type _geocelltype=MED_NONE;
00780 med_int _nconstantatribute=0;
00781 med_bool _anyprofile=0;
00782 med_int _nvariableattribute=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,&_nnode,&_ncell,
00799 &_geocelltype,&_nconstantatribute,&_anyprofile,&_nvariableattribute);
00800
00801 if (_ncell > 0 )
00802 taille=_ncell*_geocelltype%100;
00803 else
00804 taille = _nnode;
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<_nvariableattribute; 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
00882 EXIT_IF(_atttype == MED_ATT_UNDEF,"à la lecture du type (valeur : MED_ATT_UNDEF) de l'attribut variable ",_attname);
00883 _atttypesize = MEDstructElementAttSizeof(_atttype);
00884
00885 _attvaluesize = nmailles[i]*_nattcomp*_atttypesize;
00886 if ( _atttype == MED_ATT_NAME) ++_attvaluesize;
00887 _attvalue = (void *) malloc( _attvaluesize*sizeof(char));
00888 --_attvaluesize;
00889
00890
00891 _ret =MEDmeshStructElementVarAttRd(fid, nommaa, numdt, numit,
00892 *(geotype+i), _attname, _attvalue );
00893 if (_ret < 0 ) free(_attvalue);
00894 EXIT_IF(_ret < 0,"lors de la lecture des attributs variables",NULL);
00895
00896 _printf=MEDstructPrintFunction(_atttype);
00897
00898 if (!structure) {
00899 fprintf(stdout,"\n - Valeurs de l'attribut |%s| pour le type géométrique |%s| : \n",_attname,
00900 &geotypename[i*(MED_NAME_SIZE+1)]);
00901 for (j=0;j<nmailles[i]*_nattcomp;j++) {
00902 if ( ( _nattcomp > 1 ) && !(j % _nattcomp) )
00903 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/_nattcomp +1) );
00904 _printf( (void *)( (char *)(_attvalue) + j*_atttypesize) );
00905 }
00906 }
00907
00908 free(_attvalue);
00909
00910 }
00911
00912
00913 free(connectivite);
00914 free(nomele);
00915 free(numele);
00916 free(nufael);
00917 }
00918
00919 return;
00920 }
00921
00922 void lecture_mailles_standards(const med_idt fid,
00923 const char *nommaa,
00924 const med_int numdt,
00925 const med_int numit,
00926 const med_int mdim,
00927 const med_int * const nmailles,
00928 const med_switch_mode mode_coo,
00929 const med_connectivity_mode typ_con)
00930 {
00931 med_int taille;
00932 med_int *connectivite;
00933 char *nomele;
00934 med_int *numele;
00935 med_int *nufael;
00936 med_bool inoele=MED_FALSE, inuele=MED_FALSE, inufael=MED_FALSE;
00937 med_int entdim;
00938 med_int nnodes;
00939 med_int nndes;
00940 med_int i,j;
00941 med_err ret = 0;
00942 char str[MED_SNAME_SIZE+1];
00943 med_int dispbanner=MED_FALSE;
00944
00945
00946 for (i=0;i<MED_N_CELL_GEO_FIXED_CON;i++)
00947 if (nmailles[i] > 0) {
00948
00949 ret=_MEDgetGeometricParameter(MED_CELL, typmai[i],&entdim,&nnodes,&nndes);
00950 EXIT_IF(ret < 0,"lors de la lecture des caractéristiques des mailles",NULL);
00951
00952 switch(typ_con) {
00953 case MED_NODAL :
00954 taille = nnodes;
00955 break;
00956
00957 case MED_DESCENDING :
00958 taille = nndes;
00959 break;
00960
00961 default :
00962 ret = -1;
00963 }
00964
00965
00966 connectivite = (med_int*) malloc(sizeof(med_int)*taille*nmailles[i]);
00967 EXIT_IF(connectivite == NULL,NULL,NULL);
00968 nomele = (char*) malloc(sizeof(char)*MED_SNAME_SIZE*nmailles[i]+1);
00969 EXIT_IF(nomele == NULL,NULL,NULL);
00970 numele = (med_int*) malloc(sizeof(med_int)*nmailles[i]);
00971 EXIT_IF(numele == NULL,NULL,NULL);
00972 nufael = (med_int*) malloc(sizeof(med_int)*nmailles[i]);
00973 EXIT_IF(nufael == NULL,NULL,NULL);
00974
00975
00976 ret = MEDmeshElementRd( fid,nommaa,numdt,numit,MED_CELL,typmai[i],
00977 typ_con, mode_coo, connectivite,
00978 &inoele,nomele,&inuele,numele,&inufael,nufael );
00979
00980 EXIT_IF(ret < 0,"lors de la lecture des mailles",NULL);
00981
00982 if ( !dispbanner) {
00983 fprintf(stdout,"\n(**************************)\n");
00984 fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n");
00985 fprintf(stdout,"(**************************)\n");
00986 dispbanner=MED_TRUE;
00987 }
00988 if (!structure) {
00989
00990 fprintf(stdout,"\n- Mailles de type %s : ", nommai[i]);
00991 fprintf(stdout,"\n - Connectivité : ");
00992 for (j=0;j<nmailles[i]*taille;j++) {
00993 if (mode_coo == MED_FULL_INTERLACE && !(j % taille))
00994 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/taille +1) );
00995 if (mode_coo == MED_NO_INTERLACE && !(j % nmailles[i]))
00996 fprintf(stdout,"\n");
00997 fprintf(stdout," %9"MED_IFORMAT" ",*(connectivite+j));
00998 }
00999
01000 if (inoele) {
01001 fprintf(stdout,"\n - Noms : \n");
01002 for (j=0;j<nmailles[i];j++) {
01003 strncpy(str,nomele+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
01004 str[MED_SNAME_SIZE] = '\0';
01005 fprintf(stdout," %s ",str);
01006 }
01007 }
01008 if (inuele) {
01009 fprintf(stdout,"\n - Numeros :\n");
01010 for (j=0;j<nmailles[i];j++)
01011 fprintf(stdout," "IFORMAT" ",*(numele+j));
01012 }
01013 fprintf(stdout,"\n - Numéros de familles : \n");
01014 for (j=0;j<nmailles[i];j++)
01015 if (inufael)
01016 fprintf(stdout," "IFORMAT" ",*(nufael+j));
01017 else
01018 fprintf(stdout," %d ",0);
01019 fprintf(stdout,"\n");
01020 }
01021
01022
01023 free(connectivite);
01024 free(nomele);
01025 free(numele);
01026 free(nufael);
01027 }
01028
01029 return;
01030 }
01031
01032
01033 med_int lecture_nombre_mailles_polygones(const med_idt fid,
01034 const char * const nommaa,
01035 const med_int numdt,
01036 const med_int numit,
01037 const med_connectivity_mode typ_con)
01038 {
01039
01040 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01041
01042 med_int nmpolygones = MEDmeshnEntity(fid,nommaa,numdt,numit,
01043 MED_CELL,MED_POLYGON,
01044 MED_INDEX_NODE,typ_con,&chgt,&trsf);
01045
01046 EXIT_IF(nmpolygones < 0,"lors de la lecture du nombre de mailles polygone\n",
01047 NULL);
01048 if (nmpolygones > 0 ) nmpolygones--; else nmpolygones=0;
01049 if (nmpolygones)
01050 fprintf(stdout,"- Nombre de mailles de type MED_POLYGONE : "IFORMAT" \n",
01051 nmpolygones);
01052
01053 return nmpolygones;
01054 }
01055
01056 void lecture_mailles_polygones(const med_idt fid,
01057 const char * const nommaa,
01058 const med_int numdt,
01059 const med_int numit,
01060 const med_int nmpolygones,
01061 const med_switch_mode mode_coo,
01062 const med_connectivity_mode typ_con)
01063 {
01064 med_int i,j;
01065 med_err ret = 0;
01066 med_int taille;
01067 med_int *connectivite;
01068 char *nomele;
01069 med_int *numele;
01070 med_int *nufael;
01071 med_int *indexp;
01072 int ind1,ind2;
01073 char tmp[MED_NAME_SIZE+1];
01074 med_err ret1,ret2,ret3;
01075 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01076
01077
01078
01079
01080 taille=MEDmeshnEntity(fid,nommaa,numdt,numit,
01081 MED_CELL,MED_POLYGON,MED_CONNECTIVITY,typ_con,
01082 &chgt,&trsf);
01083 EXIT_IF(taille < 0,"lors de la lecture des parametres des mailles polygones",
01084 NULL);
01085
01086
01087 indexp = (med_int *) malloc(sizeof(med_int)*(nmpolygones+1));
01088 EXIT_IF(indexp == NULL,NULL,NULL);
01089 connectivite = (med_int *) malloc(sizeof(med_int)*taille);
01090 EXIT_IF(connectivite == NULL,NULL,NULL);
01091 numele = (med_int *) malloc(sizeof(med_int)*nmpolygones);
01092 EXIT_IF(numele == NULL,NULL,NULL);
01093 nufael = (med_int *) malloc(sizeof(med_int)*nmpolygones);
01094 EXIT_IF(nufael == NULL,NULL,NULL);
01095 nomele = (char *) malloc(sizeof(char)*MED_SNAME_SIZE*nmpolygones+1);
01096 EXIT_IF(nomele == NULL,NULL,NULL);
01097
01098
01099 ret = MEDmeshPolygonRd(fid,nommaa,numdt,numit,MED_CELL,typ_con,
01100 indexp,connectivite);
01101
01102 EXIT_IF(ret < 0,"lors de la lecture des connectivites des mailles polygones",
01103 NULL);
01104
01105
01106 ret1 = MEDmeshEntityNameRd(fid,nommaa,numdt,numit,
01107 MED_CELL,MED_POLYGON, nomele);
01108
01109
01110 ret2 = (med_int) MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,
01111 MED_CELL, MED_POLYGON, numele);
01112
01113
01114 ret3 = MEDmeshEntityFamilyNumberRd(fid, nommaa, MED_NO_DT, MED_NO_IT,
01115 MED_CELL, MED_POLYGON, nufael);
01116
01117 if (!structure) {
01118
01119 fprintf(stdout,"\n\n- Mailles de type MED_POLYGONE : ");
01120 for (i=0;i<nmpolygones;i++) {
01121 fprintf(stdout,"\n >> Maille MED_POLYGONE "IFORMAT" : \n",i+1);
01122 fprintf(stdout,"\n - Connectivité : ");
01123 ind1 = *(indexp+i)-1;
01124 ind2 = *(indexp+i+1)-1;
01125 for (j=ind1;j<ind2;j++)
01126 printf(" "IFORMAT" ",*(connectivite+j));
01127 if (ret1 == 0) {
01128 strncpy(tmp,nomele+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
01129 tmp[MED_SNAME_SIZE] = '\0';
01130 fprintf(stdout,"\n - Nom : %s \n",tmp);
01131 }
01132 if (ret2 == 0)
01133 fprintf(stdout,"\n - Numero : "IFORMAT" \n",*(numele+i));
01134
01135 if ( ret3 >= 0 )
01136 fprintf(stdout,"\n - Numéro de famille : "IFORMAT" \n",*(nufael+i));
01137 else
01138 fprintf(stdout,"\n - Numéro de famille : %d \n",0);
01139 }
01140 }
01141
01142
01143 free(indexp);
01144 free(connectivite);
01145 free(numele);
01146 free(nufael);
01147 free(nomele);
01148
01149 return;
01150 }
01151
01152
01153 med_int lecture_nombre_mailles_polyedres(const med_idt fid,
01154 const char * const nommaa,
01155 const med_int numdt,
01156 const med_int numit,
01157 const med_connectivity_mode typ_con)
01158 {
01159 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01160
01161 med_int npolyedres = MEDmeshnEntity(fid,nommaa,numdt,numit,
01162 MED_CELL,MED_POLYHEDRON,
01163 MED_INDEX_FACE,typ_con,&chgt,&trsf);
01164
01165 EXIT_IF(npolyedres < 0,"lors de la lecture du nombre de mailles polyedre \n",
01166 NULL);
01167 if ( npolyedres > 0 ) npolyedres--; else npolyedres=0;
01168 if (npolyedres)
01169 fprintf(stdout,"- Nombre de mailles de type MED_POLYEDRE : "IFORMAT" \n",
01170 npolyedres);
01171
01172 return npolyedres;
01173 }
01174
01175
01176 void lecture_mailles_polyedres(const med_idt fid,
01177 const char * const nommaa,
01178 const med_int numdt,
01179 const med_int numit,
01180 const med_int npolyedres,
01181 const med_switch_mode mode_coo,
01182 const med_connectivity_mode typ_con)
01183 {
01184 med_int i,j,k;
01185 med_err ret = 0;
01186 med_int taille;
01187 med_int *connectivite;
01188 char *nomele;
01189 med_int *numele;
01190 med_int *nufael;
01191 med_int *indexf, *indexn;
01192 int ind1,ind2;
01193 char tmp[MED_SNAME_SIZE+1];
01194 med_err ret1,ret2,ret3;
01195 med_int nfa;
01196 med_int nnoe;
01197 med_int nindn;
01198 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01199
01200
01201
01202 taille = MEDmeshnEntity(fid,nommaa,numdt,numit,
01203 MED_CELL,MED_POLYHEDRON,MED_CONNECTIVITY,typ_con,
01204 &chgt,&trsf);
01205 EXIT_IF(taille < 0,"lors de la lecture des parametres des mailles polyedres",
01206 NULL);
01207
01208 nindn = MEDmeshnEntity(fid,nommaa,numdt,numit,
01209 MED_CELL,MED_POLYHEDRON,MED_INDEX_NODE,typ_con,
01210 &chgt,&trsf);
01211 EXIT_IF(nindn < 0,"lors de la lecture des parametres des mailles polyedres",
01212 NULL);
01213
01214
01215
01216 indexf = (med_int *) malloc(sizeof(med_int)*(npolyedres+1));
01217 EXIT_IF(indexf == NULL,NULL,NULL);
01218 indexn = (med_int *) malloc(sizeof(med_int)*nindn);
01219 EXIT_IF(indexn == NULL,NULL,NULL);
01220 connectivite = (med_int *) malloc(sizeof(med_int)*taille);
01221 EXIT_IF(connectivite == NULL,NULL,NULL);
01222 numele = (med_int *) malloc(sizeof(med_int)*npolyedres);
01223 EXIT_IF(numele == NULL,NULL,NULL);
01224 nufael = (med_int *) malloc(sizeof(med_int)*npolyedres);
01225 EXIT_IF(nufael == NULL,NULL,NULL);
01226 nomele = (char *) malloc(sizeof(char)*MED_SNAME_SIZE*npolyedres+1);
01227 EXIT_IF(nomele == NULL,NULL,NULL);
01228
01229 ret = MEDmeshPolyhedronRd(fid,nommaa,numdt,numit,MED_CELL,typ_con,
01230 indexf,indexn,connectivite);
01231 EXIT_IF(ret < 0,
01232 "lors de la lecture de la connectivite des mailles polyedres",
01233 NULL);
01234
01235
01236 ret1 = MEDmeshEntityNameRd(fid,nommaa,numdt,numit,MED_CELL,MED_POLYHEDRON,nomele);
01237
01238
01239 ret2 = MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,MED_CELL,MED_POLYHEDRON,numele);
01240
01241
01242 ret3 = MEDmeshEntityFamilyNumberRd(fid,nommaa,numdt,numit,MED_CELL,MED_POLYHEDRON,nufael);
01243
01244 if (!structure) {
01245
01246 fprintf(stdout,"\n\n- Mailles de type MED_POLYEDRE : ");
01247 for (i=0;i<npolyedres;i++) {
01248 fprintf(stdout,"\n >> Maille MED_POLYEDRE "IFORMAT" : \n",i+1);
01249 fprintf(stdout,"\n - Connectivité : \n");
01250 nfa = *(indexf+i+1) - *(indexf+i);
01251
01252 ind1 = *(indexf+i) - 1;
01253 for (j=0;j<nfa;j++) {
01254 if (typ_con == MED_NODAL) {
01255
01256
01257 ind2 = *(indexn+ind1+j) - 1;
01258 nnoe = *(indexn+ind1+j+1) - *(indexn+ind1+j);
01259 fprintf(stdout," - Face "IFORMAT" : [ ", j+1);
01260 for (k=0;k<nnoe;k++)
01261 printf(" "IFORMAT" ",*(connectivite+ind2+k));
01262 printf(" ] \n");
01263 }
01264 else {
01265 nfa = *(indexf+i+1) - *(indexf+i);
01266
01267
01268 ind1 = *(indexf+i) - 1;
01269 for (j=0;j<nfa;j++)
01270 fprintf(stdout," - Face "IFORMAT" de numero : "IFORMAT" et de type "IFORMAT" \n", j+1,
01271 *(connectivite+ind1+j),*(indexn+ind1+j));
01272 }
01273 }
01274 if (ret1 == 0) {
01275 strncpy(tmp,nomele+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
01276 tmp[MED_SNAME_SIZE] = '\0';
01277 fprintf(stdout,"\n - Nom : %s \n",tmp);
01278 }
01279 if (ret2 == 0)
01280 fprintf(stdout,"\n - Numero : "IFORMAT" \n",*(numele+i));
01281 if (ret3 >= 0)
01282 fprintf(stdout,"\n - Numéro de famille : "IFORMAT" \n",*(nufael+i));
01283 else
01284 fprintf(stdout,"\n - Numéro de famille : %d \n",0);
01285
01286 }
01287 }
01288
01289
01290 free(indexf);
01291 free(indexn);
01292 free(connectivite);
01293 free(numele);
01294 free(nufael);
01295 free(nomele);
01296
01297 return;
01298 }
01299
01300 med_int lecture_nombre_faces_standards(const med_idt fid,
01301 const char * const nommaa,
01302 const med_int numdt,
01303 const med_int numit,
01304 const med_geometry_type typ_geo,
01305 const med_int indice
01306 )
01307 {
01308
01309 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01310
01311 med_int nfaces = MEDmeshnEntity(fid,nommaa,numdt,numit,
01312 MED_DESCENDING_FACE,typ_geo,
01313 MED_CONNECTIVITY,MED_DESCENDING,&chgt,&trsf);
01314 EXIT_IF(nfaces < 0,"lors de la lecture du nombre de faces",NULL);
01315
01316 if ( (indice < (MED_N_FACE_GEO_FIXED_CON-2) ) ||
01317 (indice >= (MED_N_FACE_GEO_FIXED_CON-2) && (nfaces > 0) ) )
01318 if (nfaces)
01319 fprintf (stdout,"- Nombre de faces de type %s : "IFORMAT" \n",
01320 nomfac[indice],nfaces);
01321
01322 return nfaces;
01323 }
01324
01325 void lecture_faces_standard(const med_idt fid,
01326 const char * const nommaa,
01327 const med_int numdt,
01328 const med_int numit,
01329 const med_int mdim,
01330 const med_int *const nfaces,
01331 const med_switch_mode mode_coo)
01332 {
01333 med_int taille;
01334 med_int *connectivite;
01335 char *nomele;
01336 med_int *numele;
01337 med_int *nufael;
01338 med_bool inoele,inuele,inufael;
01339 med_int i,j;
01340 med_err ret = 0;
01341 char str[MED_SNAME_SIZE+1];
01342 med_int entdim;
01343 med_int nnodes;
01344
01345 for (i=0;i<MED_N_FACE_GEO_FIXED_CON;i++)
01346 if (nfaces[i] > 0 ) {
01347
01348
01349 ret=_MEDgetGeometricParameter(MED_DESCENDING_FACE, typfac[i],&entdim,&nnodes,&taille);
01350 EXIT_IF(ret < 0,"lors de la lecture des caractéristiques des mailles",NULL);
01351
01352
01353 connectivite = (med_int*)malloc(sizeof(med_int)*taille*nfaces[i]);
01354 EXIT_IF(connectivite == NULL,NULL,NULL);
01355 nomele = (char*)malloc(sizeof(char)*MED_SNAME_SIZE*nfaces[i]+1);
01356 EXIT_IF(nomele == NULL,NULL,NULL);
01357 numele = (med_int*)malloc(sizeof(med_int)*nfaces[i]);
01358 EXIT_IF(numele == NULL,NULL,NULL);
01359 nufael = (med_int*)malloc(sizeof(med_int)*nfaces[i]);
01360 EXIT_IF(nufael == NULL,NULL,NULL);
01361
01362
01363 ret = MEDmeshElementRd( fid,nommaa,numdt,numit,MED_DESCENDING_FACE,typmai[i],
01364 MED_DESCENDING, mode_coo, connectivite,
01365 &inoele,nomele,&inuele,numele,&inufael,nufael );
01366 EXIT_IF(ret < 0,"lors de la lecture des faces",NULL);
01367
01368 if (!structure) {
01369
01370 fprintf(stdout,"\n- Faces de type %s : ", nomfac[i]);
01371 fprintf(stdout,"\n - Connectivité : ");
01372 for (j=0;j<nfaces[i]*taille;j++) {
01373 if (mode_coo == MED_FULL_INTERLACE && !(j % taille))
01374 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/taille+1) );
01375 if (mode_coo == MED_NO_INTERLACE && !(j % nfaces[i]))
01376 fprintf(stdout,"\n");
01377 fprintf(stdout," %9"MED_IFORMAT" ",*(connectivite+j));
01378 }
01379
01380 if (inoele) {
01381 fprintf(stdout,"\n - Noms : \n");
01382 for (j=0;j<nfaces[i];j++) {
01383 strncpy(str,nomele+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
01384 str[MED_SNAME_SIZE] = '\0';
01385 fprintf(stdout," %s ",str);
01386 }
01387 }
01388 if (inuele) {
01389 fprintf(stdout,"\n - Numeros :\n");
01390 for (j=0;j<nfaces[i];j++)
01391 fprintf(stdout," "IFORMAT" ",*(numele+j));
01392 }
01393 fprintf(stdout,"\n - Numéros de familles : \n");
01394 for (j=0;j<nfaces[i];j++)
01395 if ( inufael )
01396 fprintf(stdout," "IFORMAT" ",*(nufael+j));
01397 else
01398 fprintf(stdout," %d ",0);
01399 }
01400
01401
01402 free(connectivite);
01403 free(nomele);
01404 free(numele);
01405 free(nufael);
01406 }
01407
01408 return;
01409 }
01410
01411 med_int lecture_nombre_faces_polygones(const med_idt fid,
01412 const char * const nommaa,
01413 const med_int numdt,
01414 const med_int numit)
01415 {
01416
01417 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01418
01419 med_int nfpolygones = MEDmeshnEntity(fid,nommaa,numdt,numit,
01420 MED_CELL,MED_POLYGON,
01421 MED_INDEX_NODE,MED_DESCENDING,&chgt,&trsf);
01422
01423 EXIT_IF(nfpolygones < 0,"lors de la lecture du nombre de faces polygone \n",
01424 NULL);
01425 if (nfpolygones > 0 ) nfpolygones--; else nfpolygones=0;
01426 if (nfpolygones)
01427 fprintf(stdout,"- Nombre de faces de type MED_POLYGONE : "IFORMAT" \n",
01428 nfpolygones);
01429
01430 return nfpolygones;
01431 }
01432
01433 void lecture_faces_polygones(const med_idt fid,
01434 const char * const nommaa,
01435 const med_int numdt,
01436 const med_int numit,
01437 const med_int nfpolygones,
01438 const med_switch_mode mode_coo)
01439 {
01440 med_int i,j;
01441 med_err ret = 0;
01442 char *nomele;
01443 med_int *numele;
01444 med_int *nufael;
01445 med_int *connectivite;
01446 med_int taille;
01447 med_int *indexp;
01448 int ind1,ind2;
01449 char tmp[MED_NAME_SIZE+1];
01450 med_err ret1,ret2,ret3;
01451 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01452
01453
01454 taille=MEDmeshnEntity(fid,nommaa,numdt,numit,
01455 MED_DESCENDING_FACE,MED_POLYGON,MED_CONNECTIVITY,MED_DESCENDING,
01456 &chgt,&trsf);
01457 EXIT_IF(taille < 0,"lors de la lecture des parametres des faces polygones",
01458 NULL);
01459
01460
01461 indexp = (med_int *) malloc(sizeof(med_int)*(nfpolygones+1));
01462 EXIT_IF(indexp == NULL,NULL,NULL);
01463 connectivite = (med_int *) malloc(sizeof(med_int)*taille);
01464 EXIT_IF(connectivite == NULL,NULL,NULL);
01465 numele = (med_int *) malloc(sizeof(med_int)*nfpolygones);
01466 EXIT_IF(numele == NULL,NULL,NULL);
01467 nufael = (med_int *) malloc(sizeof(med_int)*nfpolygones);
01468 EXIT_IF(nufael == NULL,NULL,NULL);
01469 nomele = (char *) malloc(sizeof(char)*MED_SNAME_SIZE*nfpolygones+1);
01470 EXIT_IF(nomele == NULL,NULL,NULL);
01471
01472
01473 ret = MEDmeshPolygonRd(fid,nommaa,numdt,numit,MED_DESCENDING_FACE,MED_DESCENDING,
01474 indexp,connectivite);
01475 EXIT_IF(ret < 0,"lors de la lecture des connectivites des faces polygones", NULL);
01476
01477
01478 ret1 = MEDmeshEntityNameRd(fid,nommaa,numdt,numit,
01479 MED_DESCENDING_FACE,MED_POLYGON, nomele);
01480
01481
01482 ret2 = (med_int) MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,
01483 MED_DESCENDING_FACE, MED_POLYGON, numele);
01484
01485
01486 ret3 = MEDmeshEntityFamilyNumberRd(fid, nommaa, MED_NO_DT, MED_NO_IT,
01487 MED_DESCENDING_FACE, MED_POLYGON, nufael);
01488
01489 if (!structure) {
01490
01491 fprintf(stdout,"\n\n- Faces de type MED_POLYGONE : ");
01492 for (i=0;i<nfpolygones;i++) {
01493 fprintf(stdout,"\n >> Face MED_POLYGONE "IFORMAT" : \n",i+1);
01494 fprintf(stdout,"\n - Connectivité : ");
01495 ind1 = *(indexp+i)-1;
01496 ind2 = *(indexp+i+1)-1;
01497 for (j=ind1;j<ind2;j++)
01498 fprintf(stdout," "IFORMAT" ",*(connectivite+j));
01499 if (ret1 == 0) {
01500 strncpy(tmp,nomele+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
01501 tmp[MED_SNAME_SIZE] = '\0';
01502 fprintf(stdout,"\n - Nom : %s \n",tmp);
01503 }
01504 if (ret2 == 0)
01505 fprintf(stdout,"\n - Numero : "IFORMAT" \n",*(numele+j));
01506 if ( ret3 > 0 )
01507 fprintf(stdout,"\n - Numéro de famille : "IFORMAT" \n",*(nufael+i));
01508 else
01509 fprintf(stdout,"\n - Numéro de famille : %d \n",0);
01510 }
01511 }
01512
01513
01514 free(indexp);
01515 free(connectivite);
01516 free(numele);
01517 free(nufael);
01518 free(nomele);
01519
01520 return;
01521 }
01522
01523
01524 med_int lecture_nombre_aretes_standards(const med_idt fid,
01525 const char *const nommaa,
01526 const med_int numdt,
01527 const med_int numit,
01528 const med_geometry_type typ_geo,
01529 const med_int indice)
01530 {
01531
01532 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01533
01534 med_int naretes = MEDmeshnEntity(fid,nommaa,numdt,numit,
01535 MED_DESCENDING_EDGE, typ_geo,
01536 MED_CONNECTIVITY,MED_DESCENDING,&chgt,&trsf);
01537 EXIT_IF(naretes < 0,"lors de la lecture du nombre d'aretes",NULL);
01538 if ( (indice < (MED_N_EDGE_GEO_FIXED_CON-1) ) ||
01539 (indice >= (MED_N_EDGE_GEO_FIXED_CON-1) && (naretes > 0) ) )
01540 if (naretes)
01541 fprintf (stdout,
01542 "- Nombre d'aretes de type %s : "IFORMAT" \n",nomare[indice],naretes);
01543
01544 return naretes;
01545 }
01546
01547 void lecture_aretes_standards(const med_idt fid,
01548 const char * const nommaa,
01549 const med_int numdt,
01550 const med_int numit,
01551 const med_int mdim,
01552 const med_int * const naretes,
01553 const med_switch_mode mode_coo)
01554 {
01555 med_int taille;
01556 med_int *connectivite;
01557 char *nomele;
01558 med_int *numele;
01559 med_int *nufael;
01560 med_bool inoele,inuele,inufael;
01561 med_int i,j;
01562 med_err ret = 0;
01563 char str[MED_SNAME_SIZE+1];
01564 med_int entdim;
01565 med_int nnodes;
01566
01567 for (i=0;i<MED_N_EDGE_GEO_FIXED_CON;i++)
01568 if (naretes[i] > 0) {
01569
01570 ret=_MEDgetGeometricParameter(MED_DESCENDING_EDGE, typare[i],&entdim,&nnodes,&taille);
01571 EXIT_IF(ret < 0,"lors de la lecture des caractéristiques des mailles",NULL);
01572
01573
01574 connectivite = (med_int*)malloc(sizeof(med_int)*taille*naretes[i]);
01575 EXIT_IF(connectivite == NULL,NULL,NULL);
01576 nomele = (char*)malloc(sizeof(char)*MED_SNAME_SIZE*naretes[i]+1);
01577 EXIT_IF(nomele == NULL,NULL,NULL);
01578 numele = (med_int*)malloc(sizeof(med_int)*naretes[i]);
01579 EXIT_IF(numele == NULL,NULL,NULL);
01580 nufael = (med_int*)malloc(sizeof(med_int)*naretes[i]);
01581 EXIT_IF(nufael == NULL,NULL,NULL);
01582
01583
01584 ret = MEDmeshElementRd( fid,nommaa,numdt,numit,MED_DESCENDING_EDGE,typare[i],
01585 MED_DESCENDING, mode_coo, connectivite,
01586 &inoele,nomele,&inuele,numele,&inufael,nufael );
01587 EXIT_IF(ret < 0,"lors de la lecture des aretes",
01588 NULL);
01589
01590 if (!structure) {
01591
01592 fprintf(stdout,"\n- Aretes de type %s : ", nomare[i]);
01593 fprintf(stdout,"\n - Connectivité : ");
01594 for (j=0;j<naretes[i]*taille;j++) {
01595 if (mode_coo == MED_FULL_INTERLACE && !(j % taille))
01596 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/taille+1) );
01597 if (mode_coo == MED_NO_INTERLACE && !(j % naretes[i]))
01598 fprintf(stdout,"\n");
01599 fprintf(stdout," %9"MED_IFORMAT" ",*(connectivite+j));
01600 }
01601
01602 if (inoele) {
01603 fprintf(stdout,"\n - Noms : \n");
01604 for (j=0;j<naretes[i];j++) {
01605 strncpy(str,nomele+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
01606 str[MED_SNAME_SIZE] = '\0';
01607 fprintf(stdout," %s ",str);
01608 }
01609 }
01610 if (inuele) {
01611 fprintf(stdout,"\n - Numeros :\n");
01612 for (j=0;j<naretes[i];j++)
01613 fprintf(stdout," "IFORMAT" ",*(numele+j));
01614 }
01615 fprintf(stdout,"\n - Numéros de familles : \n");
01616 for (j=0;j<naretes[i];j++)
01617 if ( inufael )
01618 fprintf(stdout," "IFORMAT" ",*(nufael+j));
01619 else
01620 fprintf(stdout," %d ",0);
01621 }
01622
01623
01624 free(connectivite);
01625 free(nomele);
01626 free(numele);
01627 free(nufael);
01628 }
01629
01630 return;
01631 }
01632
01633
01634
01635
01636
01637
01638
01639
01640
01641
01642
01643
01644
01645
01646
01647
01648
01649
01650 void lecture_maillage_non_structure(med_idt fid,
01651 const char *nommaa,
01652 const med_int numdt,
01653 const med_int numit,
01654 const med_int mdim,
01655 const med_int edim,
01656 const med_switch_mode mode_coo,
01657 const med_connectivity_mode typ_con,
01658 const char * const nomcoo,
01659 const char * const unicoo,
01660 const med_axis_type *const rep,
01661 med_int* nmodels,
01662 med_geometry_type** geotype_elst,
01663 char** geotypename_elst,
01664 const int lecture_en_tete_seulement)
01665 {
01666 med_int i;
01667
01668 med_int nnoe;
01669 med_int nmailles[MED_N_CELL_GEO_FIXED_CON];
01670 med_int nfaces[MED_N_FACE_GEO_FIXED_CON];
01671 med_int naretes[MED_N_EDGE_GEO_FIXED_CON];
01672
01673 med_int nmpolygones, npolyedres, nfpolygones;
01674
01675 med_int nfam;
01676
01677 med_int nequ;
01678
01679 med_int njnt;
01680
01681 med_int _nmodels=0,*_nmailles_elst = NULL;
01682 med_geometry_type *_geotype_elst = NULL;
01683 char *_geotypename_elst = NULL;
01684 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01685
01686
01687 nnoe = lecture_nombre_noeuds_maillage_non_structure(fid,nommaa,numdt,numit);
01688
01689
01690 _nmodels = MEDmeshnEntity(fid,nommaa,numdt,numit,
01691 MED_STRUCT_ELEMENT,MED_GEO_ALL,MED_CONNECTIVITY,MED_GLOBAL_PFLMODE,
01692 &chgt,&trsf);
01693 EXIT_IF(_nmodels<0,
01694 "Erreur à la lecture du nombre de type géométrique pour le type d'entités MED_STRUCT_ELEMENT",NULL);
01695
01696 _nmailles_elst = (med_int *) malloc(_nmodels*sizeof(med_int));
01697 _geotype_elst = (med_geometry_type *) malloc(_nmodels*sizeof(med_geometry_type));
01698 _geotypename_elst = (char *) malloc(_nmodels*sizeof(char)*(MED_NAME_SIZE+1));
01699
01700 for (i=0; i < _nmodels; i++) {
01701 _nmailles_elst[i]=lecture_nombre_et_type_mailles_elstruct(fid,nommaa,numdt,numit,i,
01702 &_geotype_elst[i],&_geotypename_elst[i*(MED_NAME_SIZE+1)]);
01703 }
01704 if (_nmodels) {
01705 *nmodels = _nmodels;
01706 *geotype_elst = _geotype_elst;
01707 *geotypename_elst = _geotypename_elst;
01708 } else *nmodels=0;
01709
01710
01711
01712 for (i=0;i<MED_N_CELL_GEO_FIXED_CON;i++)
01713 nmailles[i] = lecture_nombre_mailles_standards(fid,nommaa,numdt,numit,typmai[i],
01714 typ_con,i);
01715
01716
01717 nmpolygones = lecture_nombre_mailles_polygones(fid,nommaa,numdt,numit,typ_con);
01718
01719
01720 npolyedres = lecture_nombre_mailles_polyedres(fid,nommaa,numdt,numit,typ_con);
01721
01722
01723 if (typ_con == MED_DESCENDING) {
01724
01725
01726 for (i=0;i<MED_N_FACE_GEO_FIXED_CON;i++)
01727 nfaces[i] = lecture_nombre_faces_standards(fid,nommaa,numdt,numit,typfac[i],i);
01728
01729
01730 nfpolygones = lecture_nombre_faces_polygones(fid,nommaa,numdt,numit);
01731
01732
01733 for (i=0;i<MED_N_EDGE_GEO_FIXED_CON;i++)
01734 naretes[i] = lecture_nombre_aretes_standards(fid,nommaa,numdt,numit,typare[i],i);
01735 }
01736
01737 if (lecture_en_tete_seulement != MED_LECTURE_MAILLAGE_SUPPORT_UNIQUEMENT) {
01738
01739 nfam = lecture_nombre_famille(fid,nommaa);
01740
01741
01742 nequ = lecture_nombre_equivalence(fid,nommaa);
01743
01744
01745 njnt = lecture_nombre_joint(fid,nommaa);
01746 }
01747
01748
01749 if (lecture_en_tete_seulement == MED_LECTURE_ENTETE_SEULEMENT) {
01750
01751
01752
01753
01754
01755 return;
01756 }
01757
01758
01759
01760 lecture_noeuds_maillage_non_structure(fid,nommaa,numdt,numit,mdim,edim,nnoe,mode_coo,nomcoo,unicoo,rep);
01761
01762
01763
01764
01765
01766
01767
01768
01769
01770
01771
01772
01773
01774
01775
01776
01777 lecture_mailles_standards(fid,nommaa,numdt,numit,mdim,nmailles,mode_coo,typ_con);
01778
01779
01780 if (lecture_en_tete_seulement == MED_LECTURE_MAILLAGE_SUPPORT_UNIQUEMENT) return;
01781
01782 if (_nmodels>0) {
01783 lecture_mailles_elstruct(fid,nommaa,numdt,numit,_nmodels,
01784 _geotype_elst,_geotypename_elst,_nmailles_elst,mode_coo);
01785
01786
01787
01788
01789
01790 }
01791
01792
01793 if (nmpolygones > 0)
01794 lecture_mailles_polygones(fid,nommaa,numdt,numit,nmpolygones,mode_coo,typ_con);
01795
01796
01797 if (npolyedres > 0)
01798 lecture_mailles_polyedres(fid,nommaa,numdt,numit,npolyedres,mode_coo,typ_con);
01799
01800
01801
01802 if (typ_con == MED_DESCENDING) {
01803 lecture_faces_standard(fid,nommaa,numdt,numit,mdim,nfaces,mode_coo);
01804 if (nfpolygones > 0)
01805 lecture_faces_polygones(fid,nommaa,numdt,numit,nfpolygones,mode_coo);
01806 }
01807
01808
01809
01810 if (typ_con == MED_DESCENDING)
01811 lecture_aretes_standards(fid,nommaa,numdt,numit,mdim,naretes,mode_coo);
01812
01813
01814
01815
01816
01817 lecture_famille_maillage(fid,nommaa,nfam);
01818
01819
01820
01821
01822
01823
01824 lecture_equivalence_maillage(fid,nommaa,nequ);
01825
01826
01827
01828
01829
01830
01831 lecture_joint_maillage(fid,nommaa,njnt);
01832
01833
01834 return;
01835 }
01836
01837
01838 void lecture_caracteristiques_grille(const med_idt fid,
01839 const char * const nommaa,
01840 const med_int numdt,
01841 const med_int numit,
01842 const med_int mdim,
01843 med_int *nind,
01844 med_int *nnoe,
01845 med_int *nmai,
01846 med_grid_type *type)
01847 {
01848 med_err ret = 0;
01849 med_int axe;
01850 med_int *structure_grille;
01851 med_data_type quoi;
01852 med_int j;
01853 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
01854
01855
01856 ret = MEDmeshGridTypeRd(fid,nommaa,type);
01857 EXIT_IF(ret < 0,"a la lecture du type d'une grille ",NULL);
01858
01859 switch(*type) {
01860
01861 case MED_CARTESIAN_GRID :
01862 case MED_POLAR_GRID :
01863 if (*type == MED_CARTESIAN_GRID)
01864 fprintf(stdout,"- Type de grille : MED_GRILLE_CARTESIENNE \n");
01865 else
01866 fprintf(stdout,"- Type de grille : MED_GRILLE_POLAIRE \n");
01867 for (axe=1;axe<=mdim;axe++) {
01868 switch(axe) {
01869
01870 case 1:
01871 quoi = MED_COORDINATE_AXIS1;
01872 break;
01873
01874 case 2:
01875 quoi = MED_COORDINATE_AXIS2;
01876 break;
01877
01878 case 3:
01879 quoi = MED_COORDINATE_AXIS3;
01880 break;
01881 }
01882 nind[axe - 1] = MEDmeshnEntity(fid,nommaa, numdt, numit,
01883 MED_NODE, MED_NONE, quoi, MED_NO_CMODE, &chgt, &trsf);
01884
01885 EXIT_IF(nind[axe - 1] < 0,
01886 "lors de la lecture de la taille d'un indice d'une grille",
01887 NULL);
01888 *nnoe = nind[axe - 1] * (*nnoe);
01889 *nmai = (nind[axe - 1] - 1) * (*nmai);
01890 fprintf(stdout,
01891 "- Taille de l'indice de l'axe "IFORMAT" des coordonnees : "IFORMAT" \n",
01892 axe,nind[axe - 1]);
01893 }
01894 break;
01895
01896 case MED_CURVILINEAR_GRID:
01897 fprintf(stdout,"- Type de grille : MED_GRILLE_DESTRUCTUREE \n");
01898 *nnoe = MEDmeshnEntity(fid, nommaa, numdt, numit,
01899 MED_NODE, MED_NONE, MED_COORDINATE, MED_NO_CMODE, &chgt, &trsf);
01900 EXIT_IF(*nnoe < 0,"lors de la lecture du nombre de noeuds du maillage "
01901 ,nommaa);
01902
01903
01904 structure_grille = (med_int *) malloc(sizeof(med_int)*mdim);
01905 EXIT_IF(structure_grille == NULL,NULL,NULL);
01906
01907
01908 ret = MEDmeshGridStructRd(fid,nommaa,numdt, numit, structure_grille);
01909 EXIT_IF(ret < 0,"lors de la lecture de la structure de la grille",
01910 NULL);
01911 fprintf(stdout,"- Structure de la grille : [ ");
01912 for (j=0;j<mdim;j++) {
01913 *nmai = (*(structure_grille+j) - 1) * (*nmai);
01914 fprintf(stdout," "IFORMAT" ",*(structure_grille+j));
01915 }
01916 fprintf(stdout," ] \n");
01917
01918 free(structure_grille);
01919 break;
01920
01921 case MED_UNDEF_GRID_TYPE:
01922 default:
01923 EXIT_IF(-1,"Type de grille non reconnu.",nommaa);
01924
01925 }
01926
01927 fprintf(stdout,"- Nombre de noeuds : "IFORMAT" \n",*nnoe);
01928 fprintf(stdout,"- Nombre de mailles : "IFORMAT" \n",*nmai);
01929
01930 return;
01931 }
01932
01933
01934 void lecture_noeuds_maillage_structure(const med_idt fid,
01935 const char * const nommaa,
01936 const med_int numdt,
01937 const med_int numit,
01938 const med_int mdim,
01939 const med_int edim,
01940 const med_int * const nind,
01941 const med_int nnoe,
01942 const char * const comp,
01943 const char * const unit,
01944 const med_grid_type type,
01945 const med_switch_mode mode_coo)
01946 {
01947 med_err ret = 0;
01948 med_int axe,i,j;
01949 char str[MED_SNAME_SIZE+1];
01950 med_float *coo = NULL;
01951 med_float *indices = NULL;
01952 med_int *nufano = NULL;
01953 med_int *numnoe = NULL;
01954 char *nomnoe = NULL;
01955 med_bool inufael=MED_FALSE;
01956
01957 fprintf(stdout,"\n(*************************)\n");
01958 fprintf(stdout,"(* NOEUDS DE LA GRILLE : *)\n");
01959 fprintf(stdout,"(*************************)\n");
01960
01961 switch(type) {
01962
01963 case MED_CARTESIAN_GRID :
01964 case MED_POLAR_GRID :
01965
01966 for (axe = 1; axe<=mdim; axe++) {
01967
01968 indices = (med_float *) malloc(sizeof(med_float)*nind[axe - 1]);
01969 EXIT_IF(indices == NULL,NULL,NULL);
01970
01971
01972 ret = MEDmeshGridIndexCoordinateRd(fid,nommaa,numdt,numit, axe,indices);
01973 EXIT_IF(ret < 0,"lors de la lecture d'un tableau d'indice",
01974 NULL);
01975 fprintf(stdout,"\n - Axe %." xstr(MED_SNAME_SIZE) "s [%." xstr(MED_SNAME_SIZE) "s] : [ ",
01976 &comp[MED_SNAME_SIZE*(axe-1)],&unit[MED_SNAME_SIZE*(axe-1)]);
01977 for (j=0;j<nind[axe - 1];j++)
01978 fprintf(stdout," %f ",*(indices+j));
01979 printf(" ] \n");
01980
01981 free(indices);
01982 }
01983 break;
01984
01985 case MED_CURVILINEAR_GRID:
01986
01987 coo = (med_float *) malloc(sizeof(med_float)*nnoe*edim);
01988 EXIT_IF(coo == NULL,NULL,NULL);
01989
01990 ret = MEDmeshNodeCoordinateRd(fid,nommaa,numdt,numit, MED_FULL_INTERLACE,coo);
01991
01992 EXIT_IF(ret < 0,"lors de la lecture des noeuds du maillage",NULL);
01993
01994 fprintf(stdout,"- Nom des coordonnees : \n");
01995 for (i=0;i<edim;i++) {
01996 strncpy(str,comp+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
01997 str[MED_SNAME_SIZE] = '\0';
01998 fprintf(stdout," %s ",str);
01999 }
02000 fprintf(stdout,"\n- Unites des coordonnees : \n");
02001 for (i=0;i<edim;i++) {
02002 strncpy(str,unit+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
02003 str[MED_SNAME_SIZE] = '\0';
02004 fprintf(stdout," %s ",str);
02005 }
02006 if (!structure) {
02007 fprintf(stdout,"\n - Coordonnees des noeuds : [ ");
02008 for (j=0;j<nnoe*edim;j++)
02009 fprintf(stdout," %f ",*(coo+j));
02010 fprintf(stdout," ] \n");
02011 }
02012
02013
02014 free(coo);
02015 break;
02016
02017 case MED_UNDEF_GRID_TYPE:
02018 default:
02019 EXIT_IF(-1,"Type de grille non reconnu.",nommaa);
02020
02021 }
02022
02023
02024
02025
02026
02027
02028
02029 numnoe = (med_int *) malloc(sizeof(med_int)*nnoe);
02030 EXIT_IF(numnoe == NULL,NULL,NULL);
02031 nomnoe = (char*) malloc(MED_SNAME_SIZE*nnoe+1);
02032 EXIT_IF(nomnoe == NULL,NULL,NULL);
02033 nufano = (med_int *) malloc(sizeof(med_int)*nnoe);
02034 EXIT_IF(nufano == NULL,NULL,NULL);
02035
02036
02037 ret = MEDmeshEntityFamilyNumberRd(fid,nommaa,numdt,numit,MED_NODE,MED_NO_GEOTYPE,nufano);
02038 if (ret < 0) ret=0; else inufael=MED_TRUE;
02039
02040 EXIT_IF(ret < 0,"lors de la lecture des numeros de familles des noeuds",
02041 NULL);
02042 if (!structure) {
02043
02044 fprintf(stdout,"\n- Numeros des familles des noeuds : \n");
02045 for (i=0;i<nnoe;i++)
02046 if (inufael)
02047 fprintf(stdout," "IFORMAT" ",*(nufano+i));
02048 else
02049 fprintf(stdout," %d ",0);
02050 fprintf(stdout,"\n");
02051 }
02052
02053
02054 if (MEDmeshEntityNameRd(fid,nommaa,numdt,numit,MED_NODE,MED_NO_GEOTYPE,nomnoe) == 0) {
02055 if (!structure) {
02056 fprintf(stdout,"\n- Noms des noeuds : \n");
02057 for (i=0;i<nnoe;i++) {
02058 strncpy(str,nomnoe+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
02059 str[MED_SNAME_SIZE] = '\0';
02060 fprintf(stdout," %s ",str);
02061 }
02062 }
02063 }
02064
02065
02066 if (MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,MED_NODE,MED_NO_GEOTYPE,numnoe) == 0) {
02067 if (!structure) {
02068 fprintf(stdout,"\n- Numeros des noeuds : \n");
02069 for (i=0;i<nnoe;i++)
02070 fprintf(stdout," "IFORMAT" ",*(numnoe+i));
02071 }
02072 }
02073
02074
02075 free(nufano);
02076 free(numnoe);
02077 free(nomnoe);
02078
02079 return;
02080 }
02081
02082
02083 void lecture_mailles_maillage_structure(const med_idt fid,
02084 const char * const nommaa,
02085 const med_int numdt,
02086 const med_int numit,
02087 const med_int mdim,
02088 const med_int nmai)
02089
02090 {
02091 med_err ret = 0;
02092 med_int i;
02093 med_int *nufael = NULL;
02094 char *nomele = NULL;
02095 med_int *numele = NULL;
02096 char str[MED_SNAME_SIZE+1];
02097
02098 med_geometry_type typgeo;
02099
02100 fprintf(stdout,"\n(***************************)\n");
02101 fprintf(stdout,"(* ELEMENTS DE LA GRILLE : *)\n");
02102 fprintf(stdout,"(***************************)\n");
02103
02104
02105 switch(mdim) {
02106 case 0 :
02107 typgeo = MED_POINT1;
02108 break;
02109 case 1 :
02110 typgeo = MED_SEG2;
02111 break;
02112 case 2 :
02113 typgeo = MED_QUAD4;
02114 break;
02115 default :
02116 typgeo = MED_HEXA8;
02117 }
02118
02119
02120
02121
02122
02123
02124
02125
02126 numele = (med_int *) malloc(sizeof(med_int)*nmai);
02127 EXIT_IF(numele == NULL,NULL,NULL);
02128 nomele = (char *) malloc(sizeof(char)*MED_SNAME_SIZE*nmai+1);
02129 EXIT_IF(nomele == NULL,NULL,NULL);
02130 nufael = (med_int *) malloc(sizeof(med_int)*nmai);
02131 EXIT_IF(nufael == NULL,NULL,NULL);
02132
02133
02134 ret = MEDmeshEntityFamilyNumberRd(fid,nommaa,numdt,numit,MED_CELL,typgeo,nufael);
02135 if (ret < 0)
02136 for (i=0;i<nmai;i++)
02137 *(nufael+i) = 0;
02138
02139 if (!structure) {
02140
02141 fprintf(stdout,"\n- Numeros des familles des mailles : \n");
02142 for (i=0;i<nmai;i++)
02143 fprintf(stdout," "IFORMAT" ",*(nufael+i));
02144 fprintf(stdout,"\n");
02145 }
02146
02147
02148 if (MEDmeshEntityNameRd(fid,nommaa,numdt,numit,MED_CELL,typgeo,nomele) == 0) {
02149 if (!structure) {
02150 fprintf(stdout,"\n - Noms : \n");
02151 for (i=0;i<nmai;i++) {
02152 strncpy(str,nomele+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
02153 str[MED_SNAME_SIZE] = '\0';
02154 fprintf(stdout," %s ",str);
02155 }
02156 }
02157 }
02158
02159
02160 if (MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,MED_CELL,typgeo,numele) == 0) {
02161 if (!structure) {
02162 fprintf(stdout,"\n - Numeros :\n");
02163 for (i=0;i<nmai;i++)
02164 fprintf(stdout," "IFORMAT" ",*(numele+i));
02165 }
02166 }
02167
02168
02169 free(nufael);
02170 free(nomele);
02171 free(numele);
02172
02173 return;
02174 }
02175
02176 void lecture_maillage_structure(const med_idt fid,
02177 const char * const nommaa,
02178 const med_int numdt,
02179 const med_int numit,
02180 const med_int mdim,
02181 const med_int edim,
02182 const med_switch_mode mode_coo,
02183 const char * const comp,
02184 const char * const unit,
02185 const int lecture_en_tete_seulement)
02186 {
02187
02188 med_int nind[3];
02189 med_int nnoe = 1;
02190 med_int nmai = 1;
02191
02192 med_grid_type type;
02193
02194 med_int nfam;
02195
02196 med_int nequ;
02197
02198 med_int njnt;
02199
02200
02201
02202
02203
02204
02205 lecture_caracteristiques_grille(fid,nommaa,numdt,numit,mdim,nind,&nnoe,&nmai,&type);
02206
02207
02208 nfam = lecture_nombre_famille(fid,nommaa);
02209
02210
02211 nequ = lecture_nombre_equivalence(fid,nommaa);
02212
02213
02214 njnt = lecture_nombre_joint(fid,nommaa);
02215
02216 if (lecture_en_tete_seulement)
02217 return ;
02218
02219
02220
02221
02222 lecture_noeuds_maillage_structure(fid,nommaa,numdt,numit,mdim,edim,nind,nnoe,comp,unit,type,mode_coo);
02223
02224
02225
02226
02227 lecture_mailles_maillage_structure(fid,nommaa,numdt,numit,mdim,nmai);
02228
02229
02230
02231
02232 lecture_famille_maillage(fid,nommaa,nfam);
02233
02234
02235
02236
02237 lecture_equivalence_maillage(fid,nommaa,nequ);
02238
02239
02240
02241
02242 lecture_joint_maillage(fid,nommaa,njnt);
02243
02244 return ;
02245 }
02246
02247 med_err getFieldsOn(const med_idt fid,
02248 const char * const maillage,
02249 const med_int mnumdt,
02250 const med_int mnumit,
02251 const med_int nmodels,
02252 const med_geometry_type* const geotype_elst,
02253 const char* const geotypename_elst,
02254 const char * const nomcha,
02255 const char * const dtunit,
02256 const med_field_type typcha,
02257 const med_int ncomp,
02258 const char * const comp,
02259 const char * const unit,
02260 const med_entity_type entite,
02261 const med_switch_mode stockage,
02262 const med_int ncstp) {
02263
02264 int i,j,k,l,m,n,nb_geo=0;
02265 med_int nbpdtnor=0,pflsize,*pflval,ngauss=0,ngroup,*vale=NULL,nval;
02266 med_int numdt=0,numo=0,_nprofile;
02267 med_int meshnumdt=0,meshnumit=0;
02268 med_float *valr=NULL,dt=0.0;
02269 med_err ret=0;
02270 char pflname [MED_NAME_SIZE+1]="";
02271 char locname [MED_NAME_SIZE+1]="";
02272 char meshname [MED_NAME_SIZE+1]="";
02273 char maa_ass [MED_NAME_SIZE+1]="";
02274 char * lien = NULL;
02275 med_bool localmesh;
02276 med_int nmesh=0;
02277 med_int lnsize=0;
02278 med_geometry_type * type_geo;
02279
02280 size_t _bannerlen=255;
02281 size_t _bannerlen1=0,_bannershift1=0;
02282 char _temp1[MAXBANNERLEN+1]="";
02283 char * _bannerstr1=NULL;
02284 size_t _bannerlen2=0,_bannershift2=0;
02285 char _temp2[MAXBANNERLEN+1]="";
02286 char * _bannerstr2=NULL;
02287
02288 const char * const * AFF;
02289 const char * const * AFF_ENT=MED23FIELD_GET_ENTITY_TYPENAME+1;
02290 const char * * AFF_STRUCT = NULL;
02291
02292 switch (entite) {
02293 case MED_NODE :
02294 type_geo = MED23FIELD_GET_NODE_GEOMETRY_TYPE;
02295 nb_geo = MED_N_NODE_FIXED_GEO;
02296 AFF = MED23FIELD_GET_NODE_GEOMETRY_TYPENAME;
02297 break;
02298 case MED_CELL :
02299 case MED_NODE_ELEMENT :
02300 type_geo = MED23FIELD_GET_CELL_GEOMETRY_TYPE;
02301 nb_geo = MED_N_CELL_FIXED_GEO;
02302 AFF = MED23FIELD_GET_CELL_GEOMETRY_TYPENAME;
02303 break;
02304 case MED_DESCENDING_FACE :
02305 type_geo = MED23FIELD_GET_FACE_GEOMETRY_TYPE;
02306 nb_geo = MED_N_FACE_FIXED_GEO;
02307 AFF = MED23FIELD_GET_FACE_GEOMETRY_TYPENAME;
02308 break;
02309 case MED_DESCENDING_EDGE :
02310 type_geo = MED23FIELD_GET_EDGE_GEOMETRY_TYPE;
02311 nb_geo = MED_N_EDGE_FIXED_GEO;
02312 AFF = MED23FIELD_GET_EDGE_GEOMETRY_TYPENAME;
02313 break;
02314 case MED_STRUCT_ELEMENT :
02315 AFF_STRUCT = (const char * *) calloc(sizeof(const char * ),nmodels+1);
02316 for(i=0;i<nmodels;++i) AFF_STRUCT[i+1]= &geotypename_elst[(MED_NAME_SIZE+1)*i];
02317 type_geo = (med_geometry_type*)(geotype_elst)-1;
02318 nb_geo = nmodels;
02319 AFF = AFF_STRUCT;
02320 break;
02321 }
02322
02323 for (k=1;k<=nb_geo;k++) {
02324
02325
02326 nbpdtnor = ncstp;
02327 if (nbpdtnor < 1 ) continue;
02328
02329 for (j=0;j<nbpdtnor;j++) {
02330
02331 if ( MEDfield23ComputingStepMeshInfo(fid, nomcha,j+1, &numdt, &numo, &dt,
02332 &nmesh, maa_ass, &localmesh, &meshnumdt, &meshnumit ) <0) {
02333 MESSAGE("Erreur a la demande d'information sur (pdt,nor) : ");
02334 ISCRUTE(numdt); ISCRUTE(numo);ISCRUTE(nmesh);SSCRUTE(meshname);ISCRUTE_int(localmesh);
02335 ISCRUTE(meshnumdt);ISCRUTE(meshnumit);
02336 ret = -1; continue;
02337 }
02338
02339 for (i=0;i< nmesh;++i) {
02340
02341 if ( (_nprofile = MEDfield23nProfile(fid,nomcha,numdt,numo,entite,type_geo[k],i+1,
02342 meshname,pflname,locname ) ) < 0 ) {
02343 MESSAGE("Erreur a la demande du nombre de profils referencés par le champ : ");
02344 SSCRUTE(nomcha); ISCRUTE(numdt); ISCRUTE(numo);SSCRUTE(meshname);
02345 ISCRUTE_int(entite);ISCRUTE_int(type_geo[k]);SSCRUTE(pflname);SSCRUTE(locname);
02346 SSCRUTE(AFF_ENT[(int)entite]);SSCRUTE(AFF[k]);
02347 ret = -1; continue;
02348 };
02349
02350 for (l=0;l<_nprofile;l++) {
02351
02352 if ( (nval = MEDfield23nValueWithProfile(fid, nomcha, numdt, numo, entite, type_geo[k],meshname,
02353 l+1, USER_MODE, pflname,&pflsize,
02354 locname, &ngauss) ) < 0 ) {
02355 MESSAGE("Erreur a la lecture du nombre de valeurs du champ : ");
02356 SSCRUTE(nomcha);ISCRUTE(numdt);ISCRUTE(numo);SSCRUTE(meshname);
02357 ISCRUTE_int(entite);ISCRUTE_int(type_geo[k]);
02358 ISCRUTE_int(USER_MODE);
02359 ret = -1; continue;
02360 };
02361
02362 if ( (!strcmp(meshname,maillage)) && (meshnumdt == mnumdt) && (meshnumit == mnumit) ) {
02363
02364
02365 _bannerstr1 = "(* CHAMP |%s| A L'ÉTAPE DE CALCUL (n°dt,n°it)="
02366 "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT") , %.*s*)\n";
02367
02368 _bannerstr2 = "(* SUR LE MAILLAGE |%s| A L'ÉTAPE DE CALCUL (n°dt,n°it)="
02369 "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT") : %.*s*)\n";
02370 snprintf(_temp1,MAXBANNERLEN+1,_bannerstr1,nomcha,numdt,numo,0,"");
02371 snprintf(_temp2,MAXBANNERLEN+1,_bannerstr2,meshname,meshnumdt,meshnumit,0,"");
02372 _bannerlen1 = strlen(_temp1);
02373 _bannerlen2 = strlen(_temp2);
02374 _bannerlen=MAX(_bannerlen1,_bannerlen2);
02375 if (_bannerlen1>_bannerlen2) {
02376 _bannershift1 = 0; _bannershift2 = _bannerlen1-_bannerlen2;
02377 } else {
02378 _bannershift2 = 0; _bannershift1 = _bannerlen2-_bannerlen1;
02379 }
02380 fprintf(stdout,"\n(");
02381 for (i=0;i< _bannerlen-6; i++) fprintf(stdout,"*");
02382 fprintf(stdout,")\n");
02383 fprintf(stdout,_bannerstr1,nomcha,numdt,numo,_bannershift1,MED_NAME_BLANK);
02384 fprintf(stdout,_bannerstr2,meshname,meshnumdt,meshnumit,_bannershift2,MED_NAME_BLANK);
02385 fprintf(stdout,"(");
02386 for (i=0;i< _bannerlen-6; i++) fprintf(stdout,"*");
02387 fprintf(stdout,")\n");
02388
02389
02390
02391
02392
02393
02394
02395
02396
02397
02398
02399 fprintf(stdout,"- Valeur de la date du champ %f [%s] : \n",dt,dtunit);
02400 fprintf(stdout,"- Type des composantes du champ : %d\n",typcha);
02401 fprintf(stdout,"- Nombre de composantes par valeur : "IFORMAT"\n",ncomp);
02402 fprintf(stdout,"- Unité des composantes : |%s|\n",unit);
02403 fprintf(stdout,"- Nom des composantes : |%s|\n",comp);
02404
02405 printf("\t- Il y a "IFORMAT" entités qui portent des valeurs en mode %i."
02406 "\n\t Chaque entite %s de type geometrique %s associes au profil |%s| a "IFORMAT" point(s) d'intégration \n",
02407 nval,USER_MODE,AFF_ENT[(int)entite],AFF[k],pflname,ngauss);
02408
02409
02410 if ( !localmesh ) {
02411
02412 if ( (lnsize=MEDlinkInfoByName(fid,maa_ass) ) < 0 ) {
02413 MESSAGE("Erreur a la lecture de la taille du lien : ");
02414 SSCRUTE(maa_ass);
02415 ret = -1;
02416 } else {
02417 lien = (char *)malloc(lnsize*sizeof(char) + 1);
02418 EXIT_IF(lien == NULL,NULL,NULL);
02419
02420 if ( MEDlinkRd(fid, maa_ass, lien) < 0 ) {
02421 MESSAGE("Erreur a la lecture du lien : ");
02422 SSCRUTE(maa_ass);SSCRUTE(lien);
02423 ret = -1;
02424 } else {
02425 lien[lnsize] = '\0';
02426 printf("\tLe maillage |%s| est porte par un fichier distant |%s|\n",maa_ass,lien);
02427 }
02428 free(lien);
02429 }
02430 }
02431
02432
02433 if (typcha == MED_FLOAT64) {
02434
02435 valr = (med_float*) calloc(ncomp*nval*ngauss,sizeof(med_float));
02436 EXIT_IF(valr == NULL,NULL,NULL);
02437
02438 if (MEDfield23ValueWithProfileRd(fid, nomcha, numdt,numo, entite,type_geo[k],meshname,
02439 USER_MODE, pflname, stockage,MED_ALL_CONSTITUENT,
02440 (unsigned char*) valr) < 0 ) {
02441 MESSAGE("Erreur a la lecture des valeurs du champ : ");
02442 SSCRUTE(nomcha);ISCRUTE_int(entite);ISCRUTE_int(type_geo[k]);
02443 ISCRUTE(numdt);ISCRUTE(numo);
02444 ret = -1;
02445 }
02446 } else {
02447
02448 vale = (med_int*) calloc(ncomp*nval*ngauss,sizeof(med_int));
02449 EXIT_IF(vale == NULL,NULL,NULL);
02450
02451 if (MEDfield23ValueWithProfileRd(fid, nomcha, numdt,numo, entite,type_geo[k],meshname,
02452 USER_MODE, pflname, stockage,MED_ALL_CONSTITUENT,
02453 (unsigned char*) vale) < 0 ) {
02454 MESSAGE("Erreur a la lecture des valeurs du champ : ");
02455 SSCRUTE(nomcha);ISCRUTE_int(entite);ISCRUTE_int(type_geo[k]);
02456 ISCRUTE(numdt);ISCRUTE(numo);
02457 ret = -1;
02458 }
02459 }
02460
02461 if ( strlen(locname) && (_nprofile > 1) )
02462 printf("\t- Modèle de localisation des points de Gauss de nom |%s|\n",locname);
02463
02464 if (entite == MED_NODE_ELEMENT)
02465 ngroup = (type_geo[k] % 100);
02466 else
02467 ngroup = ngauss;
02468
02469 switch (stockage) {
02470
02471 case MED_FULL_INTERLACE :
02472 if (!structure) {
02473 printf("\t- Valeurs :\n\t");
02474 for (m=0;m<(nval*ngauss)/ngroup;m++) {
02475 printf("|");
02476 for (n=0;n<ngroup*ncomp;n++)
02477 if (typcha == MED_FLOAT64)
02478 printf(" %f ",*(valr+(m*ngroup*ncomp)+n));
02479 else
02480 printf(" "IFORMAT" ",*(vale+(m*ngroup*ncomp)+n));
02481 }
02482 }
02483 break;
02484
02485
02486 case MED_NO_INTERLACE :
02487 if (!structure) {
02488 printf("\t- Valeurs :\n\t");
02489 for (m=0;m<ncomp;m++) {
02490 printf("|");
02491 for (n=0;n<(nval*ngauss);n++)
02492 if (typcha == MED_FLOAT64)
02493 printf(" %f ",*(valr+(m*nval)+n));
02494 else
02495 printf(" "IFORMAT" ",*(vale+(m*nval)+n));
02496 }
02497 }
02498 break;
02499 }
02500
02501 if (!structure) {
02502 printf("|\n");
02503 }
02504
02505 if (typcha == MED_FLOAT64) {
02506 if ( valr ) {free(valr);valr = NULL;}}
02507 else
02508 if (vale) { free(vale);vale = NULL; }
02509
02510
02511 if (strcmp(pflname,MED_NO_PROFILE) == 0 ) {
02512 printf("\t- Profil : MED_NOPFL\n");
02513 } else {
02514 if ( (pflsize = MEDprofileSizeByName(fid,pflname)) <0 ) {
02515 MESSAGE("Erreur a la lecture du nombre de valeurs du profil : ");
02516 SSCRUTE(pflname);
02517 ret = -1; continue;
02518 }
02519
02520 printf("\t- Profil : |%s| de taille "IFORMAT"\n",pflname,pflsize);
02521
02522 pflval = (med_int*) malloc(sizeof(med_int)*pflsize);
02523 EXIT_IF(pflval == NULL,NULL,NULL);
02524 if ( MEDprofileRd(fid,pflname,pflval) <0) {
02525 MESSAGE("Erreur a la lecture des valeurs du profil : ");
02526 SSCRUTE(pflname);
02527 ret = -1;
02528 }
02529 if (!structure) {
02530 printf("\t");
02531 for (m=0;m<pflsize;m++) printf(" "IFORMAT" ",*(pflval+m));
02532 printf("\n");
02533 }
02534 free(pflval);
02535 }
02536 }
02537 }
02538 }
02539 }
02540 }
02541
02542 free(AFF_STRUCT);
02543 return ret;
02544 }
02545
02546
02547
02548
02549
02550
02551
02552
02553
02554
02555
02556
02557
02558
02559
02560 void lecture_resultats(const med_idt fid,
02561 const char * const maillage,
02562 const med_int mnumdt,
02563 const med_int mnumit,
02564 const med_switch_mode mode_coo,
02565 const med_int nmodels,
02566 const med_geometry_type* geotype_elst,
02567 const char* geotypename_elst,
02568 const int lecture_en_tete_seulement)
02569 {
02570 med_err ret,lret;
02571 char *comp, *unit;
02572 char nomcha [MED_NAME_SIZE+1]="";
02573 med_int ncomp,ncha;
02574 med_field_type typcha;
02575 int i;
02576
02577 char nommaa[MED_NAME_SIZE+1]="";
02578 med_bool localmaa = MED_FALSE;
02579 char dtunit[MED_SNAME_SIZE+1]="";
02580 med_int ncstp=0;
02581
02582
02583
02584 ncha = MEDnField(fid);
02585 EXIT_IF(ncha < 0,"lors de la lecture du nombre de champs",NULL);
02586
02587 if ( !strlen(maillage) || lecture_en_tete_seulement ) {
02588 fprintf(stdout,"\n(************************)\n");
02589 fprintf(stdout,"(* CHAMPS DU MAILLAGE : *)\n");
02590 fprintf(stdout,"(************************)\n");
02591 fprintf(stdout,"- Nombre de champs : "IFORMAT" \n",ncha);
02592 }
02593
02594
02595
02596
02597 ret = 0;
02598
02599
02600 for (i =0;i<ncha;i++) {
02601 lret = 0;
02602
02603
02604 if ((ncomp = MEDfieldnComponent(fid,i+1)) < 0) {
02605 MESSAGE("Erreur à la lecture du nombre de composantes : ");
02606 ISCRUTE(ncomp);
02607 ret = -1; continue;
02608 }
02609
02610
02611
02612 comp = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
02613 EXIT_IF(comp == NULL,NULL,NULL);
02614 unit = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
02615 EXIT_IF(unit == NULL,NULL,NULL);
02616
02617 if ( MEDfieldInfo(fid, i+1, nomcha, nommaa, &localmaa,
02618 &typcha, comp, unit, dtunit, &ncstp) < 0 ) {
02619 MESSAGE("Erreur à la demande d'information sur les champs : ");
02620 ret = -1; continue;
02621 }
02622
02623
02624 if ( !strlen(maillage) || lecture_en_tete_seulement ) {
02625 printf("\nChamp numero : |%d| \n",i+1);
02626 printf("Nom du champ : |%s| de type |%d|\n",nomcha,typcha);
02627 printf("Nom des composantes : |%s|\n",comp);
02628 printf("Unites des composantes : |%s| \n",unit);
02629 if (strlen(dtunit))
02630 printf("Unité des dates : |%s|\n",dtunit);
02631 if ( ncstp > 1 )
02632 printf("Nombre d'étapes de calcul : |"IFORMAT"| \n",ncstp);
02633 }
02634
02635
02636 if (lecture_en_tete_seulement) {
02637 free(comp);
02638 free(unit);
02639 continue;
02640 }
02641
02642
02643 lret = getFieldsOn(fid, maillage, mnumdt, mnumit, nmodels,geotype_elst,geotypename_elst,
02644 nomcha, dtunit, typcha, ncomp, comp, unit, MED_NODE,mode_coo, ncstp);
02645
02646
02647 if (lret == 0) lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels,geotype_elst,geotypename_elst,
02648 nomcha, dtunit, typcha, ncomp, comp, unit, MED_CELL,mode_coo, ncstp);
02649 else { MESSAGE("Erreur à la lecture des champs aux noeuds "); ret = -1; continue;}
02650
02651 if (lret == 0) lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels,geotype_elst,geotypename_elst,
02652 nomcha, dtunit, typcha, ncomp, comp, unit, MED_DESCENDING_FACE,mode_coo, ncstp);
02653 else { MESSAGE("Erreur à la lecture des champs aux mailles "); ret = -1; continue;}
02654
02655 if (lret == 0) lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels,geotype_elst,geotypename_elst,
02656 nomcha, dtunit, typcha, ncomp, comp, unit, MED_DESCENDING_EDGE,mode_coo, ncstp);
02657 else {MESSAGE("Erreur à la lecture des champs aux faces "); ret = -1; continue;}
02658
02659 if (lret == 0) lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels,geotype_elst,geotypename_elst,
02660 nomcha, dtunit, typcha, ncomp, comp, unit, MED_NODE_ELEMENT,mode_coo, ncstp);
02661 else {MESSAGE("Erreur a la lecture des champs aux aretes "); ret = -1; continue;}
02662
02663 if (lret != 0) {MESSAGE("Erreur a la lecture des champs aux noeuds des mailles "); ret = -1;};
02664
02665 if (nmodels)
02666 lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels, geotype_elst,geotypename_elst,
02667 nomcha, dtunit, typcha, ncomp, comp, unit, MED_STRUCT_ELEMENT,mode_coo, ncstp);
02668 if (lret != 0) {MESSAGE("Erreur a la lecture des champs aux éléments de sructure "); ret = -1;};
02669
02670 free(comp);
02671 free(unit);
02672
02673 }
02674
02675 return;
02676 }
02677
02678
02679
02680
02681
02682
02683
02684
02685
02686
02687
02688
02689 void lecture_parametres_scalaires(med_idt fid,
02690 int lecture_en_tete_seulement)
02691 {
02692 med_err ret = 0;
02693 char nom_scalaire[MED_NAME_SIZE+1];
02694 char description[MED_COMMENT_SIZE+1];
02695 med_int vali;
02696 med_float valr;
02697 med_int i,n,npdt,j;
02698 med_parameter_type type;
02699 med_int numdt,numo;
02700 med_float dt;
02701 char dt_unit[MED_SNAME_SIZE+1];
02702
02703
02704
02705 n = MEDnParameter(fid);
02706 EXIT_IF(n < 0,"lors de la lecture du nombre de scalaires",NULL);
02707
02708 if (n) {
02709 fprintf(stdout,"\n(*******************************)\n");
02710 fprintf(stdout,"(* VARIABLES SCALAIRES : *)\n");
02711 fprintf(stdout,"(*******************************)\n\n");
02712 fprintf(stdout,"- Nombre de variables scalaires : "IFORMAT"\n",n);
02713 }
02714 if (lecture_en_tete_seulement)
02715 return ;
02716
02717 for (i=1;i<=n;i++) {
02718
02719
02720 ret = MEDparameterInfo( fid,i,nom_scalaire,&type,description,
02721 dt_unit, &npdt );
02722 EXIT_IF(ret < 0,"lors de la lecture des parametres d'un scalaire",NULL);
02723 fprintf(stdout,"- Scalaire n°"IFORMAT" de nom %s \n",i,nom_scalaire);
02724 if (type == MED_FLOAT64)
02725 fprintf(stdout," Type flottant. \n");
02726 else
02727 fprintf(stdout," Type entier. \n");
02728 printf(" Description associee : [%s] \n",description);
02729
02730
02731
02732 EXIT_IF(npdt < 0,
02733 "lors de la lecture du nombre de pas de temps d'un scalaire"
02734 ,NULL);
02735 fprintf(stdout," Nombre de valeurs stockees : "IFORMAT" \n",npdt);
02736
02737 for (j=1;j<=npdt;j++) {
02738
02739 ret = MEDparameterComputationStepInfo(fid,nom_scalaire,j, &numdt,&numo,&dt);
02740 EXIT_IF(ret < 0,
02741 "lors de la lecture des parametres d'un pas de temps d'un scalaire",
02742 NULL);
02743
02744 if (numdt == MED_NO_DT)
02745 fprintf(stdout," - Aucun de pas de temps \n");
02746 else
02747 fprintf(stdout,
02748 " - Pas de de temps de numero "IFORMAT" de valeur %f [%s] \n",numdt,
02749 dt,dt_unit);
02750 if (numo == MED_NO_IT)
02751 fprintf(stdout," - Aucun numero d'ordre \n");
02752 else
02753 fprintf(stdout," - Numero d'ordre : "IFORMAT" \n",numo);
02754
02755 if (type == MED_FLOAT64) {
02756 ret = MEDparameterValueRd(fid,nom_scalaire,numdt,numo,(unsigned char * ) &valr);
02757 fprintf(stdout," - Valeur : %f \n",valr);
02758 }
02759 else {
02760 ret = MEDparameterValueRd(fid,nom_scalaire,numdt,numo,(unsigned char * ) &vali);
02761 fprintf(stdout," - Valeur : "IFORMAT" \n",vali);
02762 }
02763 EXIT_IF(ret < 0,"lors de la lecture de la valeur d'un scalaire",NULL);
02764
02765 }
02766 }
02767
02768 return ;
02769 }
02770
02771
02772
02773
02774
02775
02776
02777
02778
02779
02780
02781
02782 void lecture_profils(med_idt fid,
02783 int lecture_en_tete_seulement)
02784 {
02785 med_err ret;
02786 char pflname[MED_NAME_SIZE+1]="";
02787 med_int npro,*pflval,nval;
02788 int i,j;
02789
02790
02791
02792 npro = MEDnProfile(fid);
02793 EXIT_IF(npro < 0,"lors de la lecture du nombre de profils",NULL);
02794
02795 if (npro) {
02796 fprintf(stdout,"\n(*************)\n");
02797 fprintf(stdout, "(* PROFILS : *)\n");
02798 fprintf(stdout, "(*************)\n");
02799 printf("\nNombre de profils stockes : "IFORMAT"\n\n",npro);
02800 }
02801
02802 for (i=1 ; i <= npro ; i++ ) {
02803 if ( MEDprofileInfo(fid, i, pflname, &nval) < 0) {
02804 MESSAGE("Erreur a la demande d'information sur le profil n° : "); ISCRUTE_int(i);
02805 ret = -1;continue;
02806 }
02807 printf("\t- Profil n°%i de nom |%s| et de taille "IFORMAT"\n",i,pflname,nval);
02808 pflval = (med_int*) malloc(sizeof(med_int)*nval);
02809 if ( MEDprofileRd(fid, pflname, pflval) < 0) {
02810 MESSAGE("Erreur a la lecture des valeurs du profil : ");
02811 SSCRUTE(pflname);
02812 ret = -1;
02813 } else {
02814 if (!structure) {
02815 printf("\t");
02816 for (j=0;j<nval;j++) printf(" "IFORMAT" ",*(pflval+j));
02817 }
02818 printf("\n\n");
02819 }
02820 free(pflval);
02821 }
02822 return;
02823 }
02824
02825
02826
02827
02828
02829
02830
02831
02832
02833
02834
02835
02836 void lecture_modeles_elstruct(med_idt fid,
02837 int lecture_en_tete_seulement)
02838 {
02839 med_err _ret=0;
02840 int _i =0,_j=0,_k=0, _n=0,_nvalue=0;
02841 med_int _nstructelement=0;
02842
02843 med_geometry_type _geotype=MED_NONE;
02844
02845 char _elementname[MED_NAME_SIZE+1]="";
02846 med_int _elementdim=0;
02847 char _supportmeshname[MED_NAME_SIZE+1]="";
02848 med_entity_type _entitytype=MED_UNDEF_ENTITY_TYPE;
02849 med_int _nnode=0;
02850 med_int _ncell=0;
02851 med_geometry_type _geocelltype=MED_NONE;
02852 char _geocelltypename[MED_SNAME_SIZE+1]="";
02853 med_int _nconstantattribute=0;
02854 med_bool _anyprofile=0;
02855 med_int _nvariableattribute=0;
02856
02857 char _constattname[MED_NAME_SIZE+1]="";
02858 med_attribute_type _constatttype=MED_ATT_UNDEF;
02859 char _varattname[MED_NAME_SIZE+1]="";
02860 med_attribute_type _varatttype=MED_ATT_UNDEF;
02861 med_int _ncomponent=0;
02862 med_entity_type _attentitytype=MED_UNDEF_ENTITY_TYPE;
02863 char _profilename[MED_NAME_SIZE+1]="";
02864 med_int _profilesize=0;
02865
02866 unsigned char * _value=NULL;
02867 void (*_printf)(const void*);
02868 med_int _atttypesize=0;
02869
02870 _nstructelement = MEDnStructElement(fid);
02871 EXIT_IF(_nstructelement < 0,"lors de la lecture du nombre d'éléments de structure",NULL);
02872
02873 if(_nstructelement) {
02874 fprintf(stdout,"\n(*************************************)\n");
02875 fprintf(stdout, "(* MODELES D'ELEMENTS DE STRUCTURE : *)\n");
02876 fprintf(stdout, "(*************************************)\n");
02877 printf("\nNombre d'éléments de structure : "IFORMAT"\n\n",_nstructelement);
02878 }
02879
02880 for ( _i=1; _i<= _nstructelement; ++_i) {
02881
02882 _ret= MEDstructElementInfo(fid,_i,_elementname,&_geotype,&_elementdim,_supportmeshname,
02883 &_entitytype,&_nnode,&_ncell,&_geocelltype,&_nconstantattribute,&_anyprofile,
02884 &_nvariableattribute );
02885 EXIT_IF(_ret < 0,"lors de la demande d'information sur les éléments de structure",NULL);
02886
02887 fprintf(stdout,"\nElément de structure n°%d |%s| de type géométrique n°%d et de dimension "IFORMAT"\n",
02888 _i,_elementname,_geotype,_elementdim);
02889 if ( strlen(_supportmeshname) ) {
02890 fprintf(stdout,"\t Maillage support de nom |%s|",_supportmeshname);
02891 if (_ncell) {
02892 MEDmeshGeotypeName(fid,_geocelltype,_geocelltypename);
02893 fprintf(stdout," avec "IFORMAT" maille(s) de type |%s| et",_ncell,_geocelltypename);
02894 }
02895 if (_nnode)
02896 fprintf(stdout," avec "IFORMAT" noeud(s)\n",_nnode);
02897 else {
02898 fprintf(stderr,"\n Erreur : les noeuds doivent être définis s'il existe un maillage support\n");
02899 }
02900 } else
02901 fprintf(stdout,"\t Maillage support implicite sur noeud\n");
02902
02903 fprintf(stdout,"\t Nombre d'attribut(s) constant(s) : "IFORMAT"",_nconstantattribute);
02904 if (_anyprofile) fprintf(stdout,", avec profil.\n"); else fprintf(stdout,", sans profil.\n");
02905
02906 if ( _nconstantattribute ) {
02907 for (_j=1;_j<=_nconstantattribute;++_j) {
02908 _ret= MEDstructElementConstAttInfo(fid, _elementname,_j,
02909 _constattname, &_constatttype, &_ncomponent,
02910 &_attentitytype, _profilename, &_profilesize );
02911 EXIT_IF(_ret < 0,"lors de la demande d'information sur les attributs constants des éléments de structure",NULL);
02912
02913 fprintf(stdout,"\t\t Attribut constant de nom |%s| de type %d à "IFORMAT" composantes\n",
02914 _constattname,_constatttype,_ncomponent);
02915
02916 if (!_profilesize) {
02917 if (_attentitytype == MED_NODE) _nvalue = _nnode; else _nvalue=_ncell;
02918 } else {
02919 _nvalue = _profilesize;
02920 }
02921 _n = _ncomponent*_nvalue;
02922 if ( _attentitytype == MED_ATT_NAME) ++_n;
02923 _atttypesize = MEDstructElementAttSizeof(_constatttype);
02924 _value = (unsigned char *) malloc(_n*_atttypesize);
02925 if ( _attentitytype == MED_ATT_NAME) --_n;
02926
02927 _ret= MEDstructElementConstAttRd(fid, _elementname,_constattname, _value );
02928 if (_ret < 0 ) free(_value);
02929 EXIT_IF(_ret < 0,"lors de la lecture des valeurs des attributs constants",NULL);
02930 _printf=MEDstructPrintFunction(_constatttype);
02931
02932 if (!structure) {
02933 fprintf(stdout,"\t\t - Valeurs de l'attribut sur les d'entité |%s|",
02934 MED23MESH_GET_ENTITY_TYPENAME[_attentitytype+1]);
02935 if ( _profilesize)
02936 fprintf(stdout," avec un profil |%s| de taille "IFORMAT": ",_profilename,_profilesize);
02937 else
02938 fprintf(stdout," sans profil : ");
02939
02940 for (_k=0;_k<_nvalue*_ncomponent;_k++) {
02941
02942 if ( !(_k % _ncomponent) )
02943 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (_k/_ncomponent +1) );
02944 _printf( (void *)( (char *)(_value) + _k*_atttypesize) );
02945 }
02946 printf("\n");
02947 }
02948
02949 free(_value);
02950 printf("\n");
02951 }
02952 }
02953
02954 fprintf(stdout,"\t Nombre d'attribut(s) variable(s) : "IFORMAT"\n",_nvariableattribute);
02955 if ( _nvariableattribute ) {
02956 for (_j=1;_j<=_nvariableattribute;++_j) {
02957 _ret = MEDstructElementVarAttInfo(fid, _elementname,_j,_varattname,&_varatttype,&_ncomponent );
02958 EXIT_IF(_ret < 0,"lors de la lecture des valeurs des attributs variables",NULL);
02959 fprintf(stdout,"\t\t Attribut variable de nom |%s| de type %d à "IFORMAT" composantes\n",
02960 _varattname,_varatttype,_ncomponent);
02961 }
02962 }
02963
02964 }
02965
02966 return;
02967 }
02968
02969
02970
02971
02972
02973
02974
02975
02976
02977
02978
02979
02980 void lecture_fonctions_interpolation(med_idt fid,
02981 int lecture_en_tete_seulement)
02982 {
02983
02984 med_err _ret=-1;
02985 med_int _ninterp=0;
02986 int _interpit =0;
02987 char _interpname[MED_NAME_SIZE+1]="";
02988 med_geometry_type _geotype =MED_NONE;
02989 char _geotypename[MED_SNAME_SIZE+1]="";
02990 med_int _geodim=0,_geonnodes=0;
02991 med_bool _cellnodes =MED_FALSE;
02992 med_int _nbasisfunc =0;
02993 med_int _nvariable =0;
02994 med_int _maxdegree =0;
02995 med_int _nmaxcoefficient =0;
02996 int _basisfuncit =0;
02997 int _powerit =0;
02998 med_int _ncoefficient =0;
02999 med_int* _power =NULL;
03000 med_float* _coefficient =NULL;
03001 int _coefficientit =0;
03002
03003
03004 _ninterp = MEDnInterp(fid);
03005 if (_ninterp) {
03006 fprintf(stdout,"\n(********************************)\n");
03007 fprintf(stdout, "(* FONCTIONS D'INTERPOLATION : *)\n");
03008 fprintf(stdout, "(********************************)\n");
03009 printf("\nNombre de fonctions d'interpolation : "IFORMAT"\n\n",_ninterp);
03010 }
03011
03012 for ( _interpit=1; _interpit<= _ninterp; ++_interpit) {
03013
03014 if (MEDinterpInfo(fid,_interpit,_interpname,&_geotype,&_cellnodes,&_nbasisfunc,
03015 &_nvariable,&_maxdegree,&_nmaxcoefficient) < 0 ) {
03016 MESSAGE("Erreur à la demande d'information de la fonction d'interpolation n°");
03017 ISCRUTE_int(_interpit);
03018 _ret = -1;continue;
03019 }
03020
03021 MEDmeshGeotypeName(fid,_geotype,_geotypename);
03022 fprintf(stdout,"Fonction d'interpolation n° %d |%s| sur le type géométrique |%s|\n",
03023 _interpit,_interpname, _geotypename);
03024
03025 if ( MEDmeshGeotypeParameter(fid,_geotype,&_geodim,&_geonnodes) <0 ) {
03026 MESSAGE("Erreur à la lecture du nom associé au typegeo : "); ISCRUTE_int(_geotype);
03027 _ret = -1;continue;
03028 }
03029
03030 if ( _cellnodes ) {
03031 if ( _nbasisfunc == _geonnodes )
03032 fprintf(stdout,"\t Les noeuds de construction sont les noeuds de la maille de référence.\n");
03033 else {
03034 MESSAGE("Erreur : le nombre de noeuds de construction "\
03035 "est différent du nombre de noeuds de la maille de référence.\n");
03036 ISCRUTE(_nbasisfunc); ISCRUTE(_geonnodes);
03037 _ret = -1;continue;
03038 }
03039 }
03040
03041
03042
03043
03044
03045
03046
03047 fprintf(stdout,"\t Il y a "IFORMAT" fonctions de base avec "IFORMAT" variables\n ",_nbasisfunc,_nvariable);
03048 fprintf(stdout,"\t Le degré maximum des fonctions de base est "IFORMAT" et possèdent au maximum "IFORMAT" coefficients\n"
03049 ,_maxdegree,_nmaxcoefficient);
03050
03051
03052 _coefficient = (med_float*) calloc(sizeof(med_float),_nmaxcoefficient);
03053 _power = (med_int*) calloc(sizeof(med_int),_nvariable*_nmaxcoefficient);
03054
03055 for ( _basisfuncit=1; _basisfuncit<= _nbasisfunc; ++_basisfuncit) {
03056
03057
03058 if ( (_ret = MEDinterpBaseFunctionRd( fid,_interpname,_basisfuncit,&_ncoefficient,_power,_coefficient) <0) ) {
03059 MESSAGE("Erreur à la lecture de la fonction de base n°");ISCRUTE_int(_basisfuncit);
03060 _ret=-1;continue;
03061 } else {
03062 if (!structure) {
03063
03064 fprintf(stdout,"\n\t Tableau de coefficients de la fonctions de base n° %d :\n\t",_basisfuncit);
03065 for ( _coefficientit=1; _coefficientit<= _ncoefficient; ++_coefficientit)
03066 fprintf(stdout," %4f ",_coefficient[_coefficientit]);
03067
03068 fprintf(stdout,"\n\t Tableau de puissances de la fonctions de base n° %d :\n\t",_basisfuncit);
03069 for ( _powerit=1; _powerit<= _nvariable*_ncoefficient; ++_powerit)
03070 fprintf(stdout," %4"MED_IFORMAT" ",_power[_powerit]);
03071 }
03072 }
03073 }
03074 fprintf(stdout,"\n");
03075 free(_coefficient);
03076 free(_power);
03077
03078 }
03079
03080 return;
03081 }
03082
03083
03084
03085
03086
03087
03088
03089
03090
03091
03092
03093
03094 void lecture_liens(med_idt fid,
03095 int lecture_en_tete_seulement)
03096 {
03097 med_err ret;
03098 char nomlien[MED_NAME_SIZE+1]="";
03099 char *lien = NULL;
03100 med_int nln=0,nval=0;
03101 int i;
03102
03103
03104
03105 nln = MEDnLink(fid);
03106
03107 if (nln) {
03108 fprintf(stdout,"\n(***********)\n");
03109 fprintf(stdout, "(* LIENS : *)\n");
03110 fprintf(stdout, "(***********)\n");
03111 printf("\nNombre de liens : "IFORMAT"\n\n",nln);
03112 }
03113
03114 for (i=1 ; i <= nln ; i++ ) {
03115 if ( MEDlinkInfo(fid, i, nomlien, &nval) < 0) {
03116 MESSAGE("Erreur a la demande d'information sur le lien n° : "); ISCRUTE_int(i);
03117 ret = -1;continue;
03118 }
03119 printf("\t- Lien n°%i de nom |%s| et de taille "IFORMAT"\n",i,nomlien,nval);
03120
03121 lien = (char * ) malloc((nval+1)*sizeof(char));
03122 EXIT_IF(lien == NULL,NULL,NULL);
03123
03124 if ( MEDlinkRd(fid, nomlien, lien ) < 0 ) {
03125 MESSAGE("Erreur a la lecture du lien : ");
03126 SSCRUTE(nomlien);SSCRUTE(lien);
03127 ret = -1;
03128 } else {
03129 lien[nval] = '\0';
03130 printf("\t\t|%s|\n\n",lien);
03131 }
03132 free(lien);
03133 }
03134 return;
03135 }
03136
03137
03138
03139
03140
03141
03142
03143
03144
03145
03146
03147
03148
03149
03150
03151 void lecture_localisation(med_idt fid,
03152 const med_switch_mode mode_coo,
03153 int lecture_en_tete_seulement)
03154 {
03155 med_err ret = 0;
03156 med_int nloc=0,locsdim=0,ngauss=0;
03157 med_geometry_type type_geo;
03158 med_float *refcoo=NULL, *gscoo=NULL, *wg=NULL;
03159 char locname [MED_NAME_SIZE+1]="";
03160 char geointerpname [MED_NAME_SIZE+1]="";
03161 char ipointstructmeshname[MED_NAME_SIZE+1]="";
03162 med_int nsectionmeshcell = 0;
03163 med_geometry_type sectiongeotype;
03164 char sectiongeotypename[MED_NAME_SIZE+1]="";
03165 med_int locentdim=0;
03166 med_int locnnodes=0;
03167 char _locgeotypename[MED_NAME_SIZE+1]="";
03168 int t1=0,t2=0,t3=0;
03169 int i=0,j=0;
03170
03171
03172
03173 nloc = MEDnLocalization(fid);
03174 if (nloc) {
03175 fprintf(stdout,"\n(********************************************)\n");
03176 fprintf(stdout, "(* LOCALISATIONS DES POINTS D'INTEGRATION : *)\n");
03177 fprintf(stdout, "(********************************************)\n");
03178 printf("\nNombre de localisations stockees : "IFORMAT"\n\n",nloc);
03179 }
03180
03181 for (i=1 ; i <= nloc ; i++ ) {
03182 if ( MEDlocalizationInfo(fid, i, locname, &type_geo, &locsdim, &ngauss,
03183 geointerpname, ipointstructmeshname, &nsectionmeshcell,
03184 §iongeotype) < 0) {
03185 MESSAGE("Erreur a la demande d'information sur la localisation n° : "); ISCRUTE_int(i);
03186 ret = -1;continue;
03187 }
03188 printf("\t- Loc. n°%i de nom |%s| de dimension "IFORMAT" avec "IFORMAT" pts de GAUSS \n",i,locname,locsdim,ngauss);
03189
03190 if ( MEDmeshGeotypeName(fid, type_geo,_locgeotypename) <0 ) {
03191 MESSAGE("Erreur à la lecture du nom associé au typegeo : "); ISCRUTE_int(type_geo);
03192 ret = -1;continue;
03193 }
03194
03195 if ( MEDmeshGeotypeParameter(fid, type_geo,&locentdim,&locnnodes) <0 ) {
03196 MESSAGE("Erreur à la lecture du nom associé au typegeo : "); ISCRUTE_int(type_geo);
03197 ret = -1;continue;
03198 }
03199
03200 if (strlen(ipointstructmeshname)) {
03201 if ( MEDmeshGeotypeName(fid, sectiongeotype,sectiongeotypename) <0 ) {
03202 MESSAGE("Erreur à la lecture du nom associé au sectiongeotype : "); ISCRUTE_int(sectiongeotype);
03203 SSCRUTE(ipointstructmeshname);
03204 ret = -1;continue;
03205 }
03206 }
03207
03208 t1 = locnnodes*locsdim;
03209 t2 = ngauss*locsdim;
03210 t3 = ngauss;
03211 refcoo = (med_float *) malloc(sizeof(med_float)*t1 );
03212 gscoo = (med_float *) malloc(sizeof(med_float)*t2 );
03213 wg = (med_float *) malloc(sizeof(med_float)*t3 );
03214
03215 if ( MEDlocalizationRd(fid, locname, mode_coo, refcoo, gscoo, wg ) < 0) {
03216 MESSAGE("Erreur a la lecture des valeurs de la localisation : ");
03217 SSCRUTE(locname);
03218 ret = -1;
03219 } else {
03220 if (!structure) {
03221 printf("\t Coordonnees de l'element de reference de type |%s| :\n\t\t",_locgeotypename);
03222
03223 for (j=0;j<locnnodes*locsdim;j++) {
03224 if (mode_coo == MED_FULL_INTERLACE && !(j % locsdim))
03225 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/locsdim + 1) );
03226 if (mode_coo == MED_NO_INTERLACE && ! (j % locnnodes))
03227 fprintf(stdout,"\n\n ");
03228 fprintf(stdout," %-+9.6f ",*(refcoo+j));
03229 }
03230 printf("\n");
03231 printf("\t Localisation des points de GAUSS : \n\t\t");
03232
03233 for (j=0;j<ngauss*locsdim;j++) {
03234 if (mode_coo == MED_FULL_INTERLACE && !(j % locsdim))
03235 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/locsdim + 1) );
03236 if (mode_coo == MED_NO_INTERLACE && ! (j % ngauss))
03237 fprintf(stdout,"\n\n ");
03238 fprintf(stdout," %-+9.6f ",*(gscoo+j));
03239 }
03240 printf("\n");
03241 printf("\t Poids associes aux points de GAUSS :\n\t\t");
03242 for (j=0;j<t3;j++) printf(" %f ",*(wg+j));
03243 printf("\n");
03244 }
03245 if (strlen(ipointstructmeshname)) {
03246 printf("\t Maillage support de section d'élément de structure |%s|.\n",ipointstructmeshname);
03247 printf("\t Mailles des sections d'élément de structure de type |%s|.\n",sectiongeotypename);
03248 printf("\t Nombre de mailles par section d'élément de structure : "IFORMAT".\n",nsectionmeshcell);
03249 }
03250 if (strlen(geointerpname)) {
03251 printf("\t Tranformation géométrique associée à la localisation |%s|.\n",geointerpname);
03252 }
03253 printf("\n\n");
03254 }
03255 free(refcoo);
03256 free(gscoo);
03257 free(wg);
03258 }
03259
03260 return;
03261 }
03262
03263
03264 med_idt ouverture_fichier_MED(char *fichier)
03265 {
03266 med_idt fid;
03267 med_err ret = 0;
03268 med_int majeur,mineur,release;
03269 med_bool hdfok;
03270 med_bool medok;
03271
03272
03273 ret = (int) access(fichier,F_OK);
03274 if (ret <0) { SSCRUTE(fichier);}
03275 EXIT_IF(ret < 0,"Le fichier n'est pas accessible ou n'existe pas ",
03276 fichier);
03277
03278
03279 ret = MEDfileCompatibility (fichier,&hdfok, &medok );
03280 EXIT_IF(ret < 0,"Impossible de déterminer la compatibilité de format. ",
03281 fichier);
03282
03283 EXIT_IF(!hdfok,"Le fichier n'est pas dans un format HDF compatible ", fichier);
03284 EXIT_IF(!medok,"Le fichier n'est pas dans un format MED compatible ", fichier);
03285
03286
03287 MEDlibraryNumVersion(&majeur,&mineur,&release);
03288 fprintf(stdout,
03289 "- Lecture du fichier à l'aide de la bibliotheque MED V"IFORMAT"."IFORMAT"."IFORMAT" \n",
03290 majeur,mineur,release);
03291
03292
03293 fid = MEDfileOpen(fichier,MED_ACC_RDONLY);
03294 EXIT_IF( fid < 0,"Ouverture du du fichier ",fichier);
03295
03296 MEDfileNumVersionRd(fid, &majeur, &mineur, &release);
03297 EXIT_IF(( (majeur < 2) || ( (majeur == 2) && (mineur < 2)) ), "Le fichier est antérieur à la version 2.2", NULL);
03298
03299 return fid;
03300 }
03301
03302 void lecture_en_tete(med_idt fid,char* fichier)
03303 {
03304 char fichier_en_tete[MED_COMMENT_SIZE+1];
03305 med_err ret = 0;
03306
03307
03308
03309 ret = MEDfileCommentRd(fid,fichier_en_tete);
03310
03311
03312 if (ret >= 0)
03313 fprintf(stdout,"- En-tete du fichier : %s \n",fichier_en_tete);
03314
03315 return;
03316 }
03317
03318 void parametrage(med_switch_mode *mode_coo,
03319 med_connectivity_mode *typ_con)
03320 {
03321 int reponse;
03322 char _temp[256]="";
03323
03324 fprintf(stdout,"(*****************)\n");
03325 fprintf(stdout,"(* PARAMETRAGE : *)\n");
03326 fprintf(stdout,"(*****************)\n");
03327 fprintf(stdout,"- Mode d'affichage des coordonnées des noeuds ? \n");
03328 fprintf(stdout," 1. Mode entrelacé : taper 1 \n");
03329 fprintf(stdout," 2. Mode non entrelacé : taper 2 \n");
03330 reponse = 0;
03331 do {
03332 fprintf(stdout," Reponse : ");
03333 if (!scanf("%d",&reponse)) fgets(_temp, 256, stdin) ;
03334 } while (reponse != 1 && reponse != 2);
03335 if (reponse == 1)
03336 *mode_coo = MED_FULL_INTERLACE;
03337 else
03338 *mode_coo = MED_NO_INTERLACE;
03339
03340 fprintf(stdout,"- Connectivité des éléments ? \n");
03341 fprintf(stdout," 1. Nodale : taper 1 \n");
03342 fprintf(stdout," 2. Descendante : taper 2 \n");
03343 reponse = 0;
03344 do {
03345 fprintf(stdout," Reponse : ");
03346 if (!scanf("%d",&reponse)) fgets(_temp, 256, stdin) ;
03347 } while (reponse != 1 && reponse != 2);
03348 if (reponse == 1)
03349 *typ_con = MED_NODAL;
03350 else
03351 *typ_con = MED_DESCENDING;
03352
03353 return;
03354 }
03355
03356
03357 void lecture_information_maillage(const med_idt fid,
03358 const int numero,
03359 char * nommaa,
03360 med_int * const mdim,
03361 med_int * const edim,
03362 med_mesh_type * const type_maillage,
03363 char * const maillage_description,
03364 med_int * const nstep,
03365 char * const dtunit,
03366 char * const nomcoo,
03367 char * const unicoo,
03368 med_axis_type *const rep)
03369 {
03370 char nom_universel[MED_LNAME_SIZE+1];
03371 med_err ret = 0;
03372 med_sorting_type sortingtype;
03373
03374 fprintf(stdout,"\n(**********************************************************)\n");
03375 fprintf(stdout,"(* INFORMATIONS GENERALES SUR LE MAILLAGE DE CALCUL N°%2.2d: *)\n",numero);
03376 fprintf(stdout,"(**********************************************************)\n\n");
03377
03378
03379 ret = MEDmeshInfo(fid, numero,nommaa,edim,mdim,type_maillage,maillage_description,
03380 dtunit,&sortingtype,nstep,rep,nomcoo,unicoo);
03381 EXIT_IF(ret < 0,"Lecture des informations sur le maillage",NULL);
03382
03383
03384 fprintf(stdout,"- Nom du maillage : <<%s>>\n",nommaa);
03385 fprintf(stdout,"- Dimension du maillage : "IFORMAT"\n",*mdim);
03386 if (*edim > *mdim)
03387 fprintf(stdout,"- La dimension de l'espace est "IFORMAT" \n",*edim);
03388 if (*type_maillage == MED_UNSTRUCTURED_MESH)
03389 fprintf(stdout,"- Type du maillage : MED_NON_STRUCTURE \n");
03390 else
03391 fprintf(stdout,"- Type du maillage : MED_STRUCTURE \n");
03392 fprintf(stdout,"- Description associee au maillage : %s\n",
03393 maillage_description);
03394
03395 if ( *nstep > 1 )
03396 fprintf(stdout,"- Nombre d'étapes de calcul associées au maillage : "IFORMAT"\n",
03397 *nstep);
03398 if (strlen(dtunit))
03399 fprintf(stdout,"- Unité des dates d'étapes de calcul associées au maillage : %s\n",
03400 dtunit);
03401
03402
03403 ret = MEDmeshUniversalNameRd(fid,nommaa,nom_universel);
03404 if (ret == 0)
03405 fprintf(stdout,"- Nom universel du maillage : %s \n",nom_universel);
03406
03407 return;
03408 }
03409
03410
03411
03412
03413
03414
03415
03416
03417
03418
03419
03420 int main (int argc, char **argv)
03421 {
03422 med_err ret = 0;
03423 med_idt fid;
03424 int i=0,numero=0,firstmesh=0,lastmesh=0,meshit=0;
03425 med_switch_mode mode_coo = MED_UNDEF_INTERLACE;
03426 med_connectivity_mode typ_con = MED_UNDEF_CONNECTIVITY_MODE;
03427 int lecture_en_tete_seulement = 0;
03428 med_int mdim=0,nmaa=0,nmaasup=0;
03429 char nommaa[MED_NAME_SIZE+1];
03430 char maillage_description[MED_COMMENT_SIZE+1];
03431 med_mesh_type type_maillage;
03432 med_int edim;
03433 int decalage;
03434 char nomcoo[3*MED_SNAME_SIZE+1]="";
03435 char unicoo[3*MED_SNAME_SIZE+1]="";
03436 char dtunit[MED_SNAME_SIZE+1]="";
03437 med_int nstep=0,numdt=MED_NO_DT,numit=MED_NO_IT;
03438 int csit=0;
03439 med_float dt=0.0;
03440 med_axis_type rep;
03441
03442
03443 char *filename=NULL,*typ_con_param=NULL,*mode_coo_param=NULL;
03444 size_t _bannerlen=0;
03445 char _temp[MAXBANNERLEN+1]="";
03446 char * _bannerstr=NULL;
03447
03448
03449
03450 med_int _nmodels=0;
03451 med_geometry_type *_geotype_elst = NULL;
03452 char *_geotypename_elst = NULL;
03453
03454
03455
03456
03457
03458
03459
03460 structure = 0;
03461 decalage = 0;
03462 if (argc > 2 && strcmp(argv[1], "--structure") == 0) {
03463 --argc;++decalage;
03464 structure = 1;
03465 }
03466
03467 if ( (argc != 2) && (argc != 5) )
03468
03469 fprintf(stderr,"Utilisation mdump [--structure] monfichier.med [ NODALE|DESCENDANTE "
03470 "NO_INTERLACE|FULL_INTERLACE|LECTURE_EN_TETE_SEULEMENT N°MAILLAGE|0 pour tous ] \n");
03471 EXIT_IF( (argc != 2) && (argc != 5),"nombre de parametres incorrect\n",NULL);
03472
03473
03474
03475
03476
03477 filename = argv[1+decalage];
03478 fid = ouverture_fichier_MED(filename);
03479
03480
03481
03482
03483
03484
03485
03486 fprintf(stdout,"\n >>>>>> DUMP DU FICHIER %s >>>>>>\n",filename);
03487
03488
03489 lecture_en_tete(fid,filename);
03490
03491
03492 if (argc == 2)
03493 parametrage(&mode_coo,&typ_con);
03494 else {
03495 typ_con_param=argv[2 + decalage];
03496
03497 if (! strcmp(typ_con_param,"NODALE")) typ_con = MED_NODAL;
03498 if (! strcmp(typ_con_param,"DESCENDANTE")) typ_con = MED_DESCENDING;
03499 EXIT_IF( typ_con==MED_UNDEF_CONNECTIVITY_MODE,"Le paramètre de connectivité doit être soit NODALE|DESCENDANTE",NULL);
03500 mode_coo_param=argv[3 + decalage];
03501
03502 if (!strcmp(mode_coo_param,"NO_INTERLACE")) mode_coo = MED_NO_INTERLACE;
03503 if (!strcmp(mode_coo_param,"FULL_INTERLACE")) mode_coo = MED_FULL_INTERLACE;
03504 if (!strcmp(mode_coo_param,"LECTURE_EN_TETE_SEULEMENT")) { lecture_en_tete_seulement = MED_LECTURE_ENTETE_SEULEMENT;
03505 mode_coo = MED_FULL_INTERLACE;}
03506 EXIT_IF( (mode_coo==MED_UNDEF_INTERLACE) ,
03507 "Le paramètre d'entrelacement doit être soit "
03508 "NO_INTERLACE|FULL_INTERLACE|LECTURE_EN_TETE_SEULEMENT",NULL);
03509 }
03510
03511
03512
03513
03514
03515 nmaa = MEDnMesh(fid);
03516
03517
03518
03519 if (argc == 2) {
03520 if (nmaa >0) {
03521 fprintf(stdout,"- Il y a "IFORMAT" maillages dans ce fichier \n",nmaa);
03522 fprintf(stdout," Lequel voulez-vous lire (0 pour tous|1|2|3|...|n) ?\n");
03523 do {
03524 fprintf(stdout," Reponse : ");
03525 if (!scanf("%d",&numero)) fgets(_temp, 256, stdin) ;
03526 } while ( (numero > nmaa) || (numero < 0) );
03527 } else {
03528 fprintf(stdout,"- Il n'y a pas de maillage dans ce fichier \n");
03529 }
03530 } else {
03531 if ( argc == 5 ) {
03532 numero = atoi(argv[4 + decalage]);
03533 EXIT_IF(numero > nmaa || numero < 0,"ce numero de maillage n'existe pas", NULL);
03534 }
03535 }
03536
03537
03538
03539
03540
03541 nmaasup= MEDnSupportMesh(fid);
03542 if (nmaasup ) {
03543 fprintf(stdout, "\n(*****************************************************)\n");
03544 fprintf(stdout, "(* INFORMATIONS GENERALES SUR LES MAILLAGES SUPPORT: *)\n");
03545 fprintf(stdout, "(*****************************************************)\n");
03546 }
03547 for (meshit=1;meshit <= nmaasup;++meshit) {
03548
03549
03550 MEDsupportMeshInfo(fid, meshit, nommaa, &edim, &mdim,
03551 maillage_description, &rep, nomcoo, unicoo);
03552 fprintf(stdout,"\n(*******************************************)\n");
03553 fprintf(stdout,"(******** Maillage support n°%2.2d/%2.2"MED_IFORMAT" : *******)\n",meshit,nmaasup);
03554 fprintf(stdout,"(*******************************************)\n");
03555
03556 fprintf(stdout,"- Nom du maillage support : <<%s>>\n",nommaa);
03557 fprintf(stdout,"- Dimension du maillage : "IFORMAT"\n",mdim);
03558 if (edim > mdim)
03559 fprintf(stdout,"- La dimension de l'espace est "IFORMAT" \n",edim);
03560
03561 lecture_maillage_non_structure(fid,nommaa,MED_NO_DT,MED_NO_IT,mdim,edim,mode_coo,typ_con,
03562 nomcoo,unicoo,&rep, &_nmodels, &_geotype_elst,&_geotypename_elst,
03563 MED_LECTURE_MAILLAGE_SUPPORT_UNIQUEMENT);
03564
03565 }
03566
03567
03568
03569
03570
03571
03572
03573 lecture_parametres_scalaires(fid,lecture_en_tete_seulement);
03574
03575
03576
03577
03578
03579 lecture_localisation(fid,mode_coo,lecture_en_tete_seulement);
03580
03581
03582
03583
03584
03585 lecture_profils(fid,lecture_en_tete_seulement);
03586
03587
03588
03589
03590
03591
03592 lecture_modeles_elstruct( fid, lecture_en_tete_seulement);
03593
03594
03595
03596
03597
03598 lecture_fonctions_interpolation( fid, lecture_en_tete_seulement);
03599
03600
03601
03602
03603
03604 lecture_liens(fid,lecture_en_tete_seulement);
03605
03606
03607
03608
03609
03610 if (numero) {
03611 firstmesh=numero;lastmesh=numero;
03612 } else {
03613 firstmesh=1;lastmesh=nmaa;
03614 }
03615
03616 for (meshit=firstmesh;meshit<=lastmesh;++meshit) {
03617
03618 lecture_information_maillage(fid,meshit,nommaa,&mdim,&edim,&type_maillage,
03619 maillage_description,&nstep,dtunit,nomcoo,unicoo,&rep);
03620
03621
03622 for (csit=1; csit <= nstep; ++csit) {
03623
03624 ret = MEDmeshComputationStepInfo(fid, nommaa, csit, &numdt, &numit, &dt);
03625 EXIT_IF(ret < 0,"lors de l'appel à MEDmeshComputationStepInfo",NULL);
03626
03627
03628
03629
03630
03631
03632
03633 _bannerstr ="(* MAILLAGE DE CALCUL |%s| n°%2.2d A L'ETAPE DE CALCUL (n°dt,n°it)="
03634 "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT"): %.*s*)\n";
03635 snprintf(_temp,MAXBANNERLEN+1,_bannerstr,nommaa,meshit,numdt,numit,0,"");
03636 _bannerlen =strlen(_temp);
03637 fprintf(stdout,"\n(");
03638 for (i=0;i< _bannerlen-6; i++) fprintf(stdout,"*");
03639 fprintf(stdout,")\n%s(",_temp);
03640 for (i=0;i< _bannerlen-6; i++) fprintf(stdout,"*");
03641 fprintf(stdout,")\n");
03642
03643
03644
03645
03646
03647
03648 if (type_maillage == MED_UNSTRUCTURED_MESH)
03649 lecture_maillage_non_structure(fid,nommaa,numdt,numit,mdim,edim,mode_coo,typ_con,
03650 nomcoo,unicoo,&rep,
03651 &_nmodels,&_geotype_elst,&_geotypename_elst,
03652 lecture_en_tete_seulement);
03653 else {
03654 lecture_maillage_structure(fid,nommaa,numdt,numit,mdim,edim,mode_coo,
03655 nomcoo,unicoo,lecture_en_tete_seulement);
03656 }
03657
03658
03659 lecture_resultats(fid,nommaa,numdt,numit,mode_coo,
03660 _nmodels,_geotype_elst,_geotypename_elst,
03661 lecture_en_tete_seulement);
03662
03663 free(_geotype_elst);
03664 free(_geotypename_elst);
03665 }
03666 }
03667
03668
03669
03670
03671 ret = MEDfileClose(fid);
03672 EXIT_IF(ret < 0,"lors de la fermeture du fichier",argv[1 + decalage]);
03673
03674 fprintf(stdout,"\n >>>>>> FIN DU DUMP DU FICHIER %s >>>>>>\n",argv[1 + decalage]);
03675
03676 return EXIT_SUCCESS;
03677 }