MED fichier
mdump3.c
Aller à la documentation de ce fichier.
1/* This file is part of MED.
2 *
3 * COPYRIGHT (C) 1999 - 2020 EDF R&D, CEA/DEN
4 * MED is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * MED is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with MED. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/******************************************************************************
19 * - Nom du fichier : mdump.c
20 *
21 * - Description : utilitaire de dump pour fichier MED
22 * Ce fichier contient les fonctions suivantes
23 * qui constituent des modeles de programmation
24 * pour une lecture generique d'un fichier MED :
25 * - lecture_maillage_non_structure () :
26 * 1. Noeuds.
27 * 2. Mailles.
28 * 3. Faces (connectivite descendante).
29 * 4. Aretes (connectivite descendante).
30 * 5. Familles.
31 * 6. Equivalences.
32 * 7. Joints.
33 * - lecture_maillage_structure () :
34 * 1. Noeuds.
35 * 2. Mailles.
36 * 3. Familles.
37 * 4. Equivalences.
38 * 5. Joints.
39 * - lecture_resultats () :
40 * 1. Champs de resultats relatifs à un maillage.
41 * - Entites :
42 * - Noeuds
43 * - Mailles
44 * - Faces
45 * - Aretes
46 * - Gestion des pas de temps et numeros d'ordre :
47 * valeurs associees a un ou plusieurs maillages sous
48 * un meme pas de temps.
49 * - Gestion des profils.
50 * - Gestion des liens vers des maillages distants
51 * - Gestion des points de Gauss :
52 * - localisation des points de Gauss.
53 * - lecture_parametres_scalaires () :
54 * - Valeurs scalaires entieres ou flottantes.
55 * - Gestion des pas de temps et numeros d'ordre.
56 * - main() : infos generales + lecture de tous les champs et
57 * du fichier MED passe en parametre.
58 *
59 *****************************************************************************/
60
61#ifndef MESGERR
62#define MESGERR 1
63#endif
64
65#ifdef __cplusplus
66extern "C" {
67#endif
68
69#include <med.h>
70#include <med_config.h>
71#include <med_utils.h>
72#include <med_misc.h>
73#include <stdio.h>
74#include <string.h>
75#include <stdlib.h>
76
77#ifdef __cplusplus
78}
79#endif
80
81#ifdef PPRO_NT
82#define F_OK 0
83#define snprintf _snprintf
84#else
85#include <unistd.h>
86#endif
87
88
90extern const char * const MED23MESH_GET_ENTITY_TYPENAME[MED_N_ENTITY_TYPES+2];
99
101extern const char * const MED23FIELD_GET_ENTITY_TYPENAME[MED_N_ENTITY_TYPES+2];
110
111/* Stockage des fids des fichiers ouverts dans le cas où le montage des fichiers
112 distants est demandé (variable mountage)
113*/
114#define MDUMP_MAX_FILE_OPEN 200
115#define MDUMP_MAX_FILE_OPEN_INIT {INIT2X(INIT10X(INIT10X(0))) }
116
117typedef struct {
118 int n;
120} FIDS_t;
122
123/* Indique si on vérifie seulement la structure
124 Lecture complète du fichier mais pas d'affichage des données volumineuses
125*/
126int structure = 0;
127
128/* types geometriques des mailles references dans le modele MED */
132
136
137#define MED_LECTURE_MAILLAGE_SUPPORT_UNIQUEMENT 2
138#define MED_LECTURE_ENTETE_SEULEMENT 1
139
140#define USER_MODE MED_COMPACT_STMODE
141
142#define xstr(s) str(s)
143#define str(s) #s
144
145#define MIN(a,b) ((a) < (b) ? (a) : (b))
146#define MAX(a,b) ((a) > (b) ? (a) : (b))
147
148#define MAXBANNERLEN 255
149
150/*Afficheurs pour la fonction polymorphique : MEDstructPrintFunction*/
151void affd(const void *pva)
152{
153 const double *pa = (const double *) pva;
154 printf(" %f ",*pa);
155}
156
157void affi(const void *pva)
158{
159 const med_int *pa = (const med_int *) pva;
160/* La ligne suivante ne fonctionne pas à cause du % contenu dans IFORMAT*/
161/* printf(" %9"IFORMAT" " ,*pa); */
162 printf(" "IFORMAT" " ,*pa);
163}
164
165void affs(const void *pva)
166{
167 const char *pa = (const char *) pva;
168 printf(" %.*s ",MED_NAME_SIZE,pa);
169}
170
171typedef void (*_myfuncptr)(const void*);
172
174 switch (atttype) {
175 case MED_ATT_INT :
176 return affi;
177 break;
178 case MED_ATT_FLOAT64:
179 return affd;
180 break;
181 case MED_ATT_NAME:
182 return affs;
183 break;
184 default:
185 EXIT_IF(-1,"lors de la lecture du type d'attribut à afficher.",NULL);
186 return NULL;
187
188 }
189 return NULL;
190
191}
192
193med_int lecture_nombre_famille(med_idt fid,const char * const nommaa)
194{
195 med_int nfam = MEDnFamily(fid,nommaa);
196 EXIT_IF(nfam < 0,"lors de la lecture du nombre de familles",NULL);
197 fprintf(stdout,"- Nombre de familles : "IFORMAT" \n",nfam);
198
199 return nfam;
200}
201
202void lecture_famille_maillage(med_idt fid,const char * const nommaa,med_int nfam)
203{
204 med_int i,j;
205 med_int natt,ngro;
206 char *attdes=NULL,*gro=NULL;
207 med_int *attval=NULL,*attide=NULL;
208 char nomfam[MED_NAME_SIZE+1];
209 med_int numfam;
210 char str1[MED_COMMENT_SIZE+1];
211 char str2[MED_LNAME_SIZE+1];
212 med_err ret = 0;
213 int famille_0 = 0;
214
215 if (nfam) {
216 fprintf(stdout,"\n(**************************)\n");
217 fprintf(stdout,"(* FAMILLES DU MAILLAGE : *)\n");
218 fprintf(stdout,"(**************************)\n");
219 }
220
221 for (i=0;i<nfam;i++) {
222
223 /* nombre de groupes */
224 ngro = MEDnFamilyGroup(fid,nommaa,i+1);
225 EXIT_IF(ngro < 0,"lors de la lecture du nombre de groupe d'une famille",
226 NULL);
227
228 /* nombre d'attributs */
229 natt = MEDnFamily23Attribute(fid,nommaa,i+1);
230 EXIT_IF(natt < 0,"lors de la lecture du nombre d'attributs d'une famille",
231 NULL);
232
233 fprintf(stdout,"- Famille "IFORMAT" a "IFORMAT" attributs et "IFORMAT" groupes \n",i+1,natt,
234 ngro);
235
236 /* nom,numero,attributs,groupes */
237
238 /* allocation memoire */
239 attide = (med_int*) malloc(sizeof(med_int)*natt);
240 EXIT_IF(attide == NULL,NULL,NULL);
241 attval = (med_int*) malloc(sizeof(med_int)*natt);
242 EXIT_IF(attval == NULL,NULL,NULL);
243 attdes = (char *) malloc(MED_COMMENT_SIZE*natt+1);
244 EXIT_IF(attdes == NULL,NULL,NULL);
245 gro = (char*) malloc(MED_LNAME_SIZE*ngro+1);
246 EXIT_IF(gro == NULL,NULL,NULL);
247 ret = MEDfamily23Info(fid,nommaa,i+1,nomfam,attide,attval,
248 attdes,&numfam,gro);
249 EXIT_IF(ret < 0,"lors de la lecture des informations d'une famille",
250 NULL);
251 if (numfam == 0)
252 famille_0 = 1;
253
254 if (!structure) {
255 /* affichage des resultats */
256 fprintf(stdout," - Famille de nom %s et de numero "IFORMAT" : \n",nomfam,numfam);
257 fprintf(stdout," - Attributs : \n");
258 for (j=0;j<natt;j++) {
259 strncpy(str1,attdes+j*MED_COMMENT_SIZE,MED_COMMENT_SIZE);
260 str1[MED_COMMENT_SIZE] = '\0';
261 fprintf(stdout," ide = "IFORMAT" - val = "IFORMAT" - des = %s\n",*(attide+j),
262 *(attval+j),str1);
263 }
264 }
265
266 /* on libere la memoire */
267 if (attide) {free(attide);attide=NULL;}
268 if (attval) {free(attval);attval=NULL;}
269 if (attdes) {free(attdes);attdes=NULL;}
270
271 if (!structure) {
272 fprintf(stdout," - Groupes :\n");
273 for (j=0;j<ngro;j++) {
274 strncpy(str2,gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
275 str2[MED_LNAME_SIZE] = '\0';
276 fprintf(stdout," gro = %s\n",str2);
277 }
278 }
279
280 /* on libere la memoire */
281 if (gro) {free(gro);gro=NULL;}
282 }
283
284 if (famille_0 != 1) {
285 MESSAGE("Erreur : La famille FAMILLE_ZERO n'a pas été trouvée, elle est obligatoire. ");
286 }
287
288 return;
289}
290
291med_int lecture_nombre_equivalence(med_idt fid,const char * const nommaa)
292{
293 med_int nequ = MEDnEquivalence(fid,nommaa);
294 EXIT_IF(nequ < 0,"lors de la lecture du nombre d'equivalences",NULL);
295 fprintf(stdout,"- Nombre d'equivalences : "IFORMAT" \n",nequ);
296
297 return nequ;
298}
299
300/* nombre de mailles concernees par les equivalences */
301void lecture_equivalence_maillage(med_idt fid,const char * const nommaa,med_int nequ)
302{
303 med_int i,j,k;
304 med_int ncor;
305 med_int *cor;
306 char equ[MED_NAME_SIZE+1];
307 char des[MED_COMMENT_SIZE+1];
308 med_err ret = 0;
309 med_int nstep=0,nocstpncor=0;
310 int _cstpit=0;
311 med_int _numdt,_numit;
312
313
314 if ( (nequ != 0) ) {
315 fprintf(stdout,"\n(******************************)\n");
316 fprintf(stdout,"(* EQUIVALENCES DU MAILLAGE : *)\n");
317 fprintf(stdout,"(******************************)\n");
318 }
319
320 /* lecture de toutes les equivalences associes a nommaa */
321 for (i = 0;i<nequ;i++) {
322
323 /* lecture des infos sur l'equivalence */
324 ret = MEDequivalenceInfo(fid,nommaa,i+1,equ,des,&nstep,&nocstpncor);
325 EXIT_IF(ret < 0,"lors de la lecture des informations sur une equivalence",
326 NULL);
327
328/* if (!structure) { */
329 fprintf(stdout,"- Equivalence numero : "IFORMAT" ",i+1);
330 fprintf(stdout,"\n - Nom de l'equivalence: %s \n",equ);
331 fprintf(stdout,"\n - Description de l'equivalence : %s \n",des);
332 if (nstep > 1)
333 fprintf(stdout,"\n - L'equivalence est définie sur "IFORMAT" étapes de calcul\n",nstep);
334/* } */
335
336 for (_cstpit=1; _cstpit <= nstep; ++_cstpit) {
337
338 ret = MEDequivalenceComputingStepInfo (fid, nommaa, equ, _cstpit,
339 & _numdt, &_numit,&nocstpncor);
340 EXIT_IF(ret < 0,
341 "lors de la lecture des valeurs d'étape de calcul d'une equivalence",
342 NULL);
343
344 if ( (_numdt != MED_NO_DT) || (_numit != MED_NO_IT) )
345 fprintf(stdout,"\n - Etape de calcul définie sur (numdt,numit) ("IFORMAT","IFORMAT") :\n",_numdt,_numit);
346
347 /* lecture des correspondances sur les differents types d'entites */
348
349 /* les noeuds */
350 ret = MEDequivalenceCorrespondenceSize(fid,nommaa,equ,_numdt,_numit,MED_NODE,MED_NONE,&ncor);
351 EXIT_IF(ret < 0,
352 "lors de la lecture du nombre de correspondances d'une equivalence",
353 NULL);
354 fprintf(stdout,"\n - Il y a "IFORMAT" correspondances sur les noeuds \n",ncor);
355
356 if (ncor > 0) {
357
358 /* allocation memoire */
359 cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
360 EXIT_IF(cor == NULL,NULL,NULL);
361 ret= MEDequivalenceCorrespondenceRd(fid,nommaa,equ,_numdt,_numit,
362 MED_NODE,MED_NONE,cor);
363 EXIT_IF(ret < 0,"lors de la lecture du tableau des correspondances",
364 NULL);
365 if (!structure) {
366 for (j=0;j<ncor;j++)
367 fprintf(stdout,"\n - Correspondance "IFORMAT" : "IFORMAT" et "IFORMAT" \n",j+1,*(cor+2*j),
368 *(cor+2*j+1));
369 }
370 free(cor);
371 }
372
373 /* sur les mailles : */
374 for (j=0;j<MED_N_CELL_FIXED_GEO;j++) {
375
376 ret = MEDequivalenceCorrespondenceSize(fid,nommaa,equ,_numdt,_numit,MED_CELL,typmai[j],&ncor);
377 EXIT_IF(ret < 0,
378 "lors de la lecture du nombre de correspondances dans une equivalence",
379 NULL);
380 fprintf(stdout,"\n - Il y a "IFORMAT" correspondances sur les mailles %s \n",ncor,
381 nommai[j]);
382
383 if (ncor > 0) {
384
385 /* allocation memoire */
386 cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
387 EXIT_IF(cor == NULL,NULL,NULL);
388 ret = MEDequivalenceCorrespondenceRd(fid,nommaa,equ,_numdt,_numit,
389 MED_CELL,typmai[j],cor);
390 EXIT_IF(ret < 0,"lors de la lecture du tableau des equivalences",
391 NULL);
392
393 if (!structure) {
394 for (k=0;k<ncor;k++)
395 fprintf(stdout,"\n - Correspondance "IFORMAT" : "IFORMAT" et "IFORMAT" \n",k+1,
396 *(cor+2*k),*(cor+2*k+1));
397 }
398 free(cor);
399 }
400 }
401
402
403 /* sur les faces */
404 for (j=0;j<MED_N_FACE_FIXED_GEO;j++) {
405
406 ret = MEDequivalenceCorrespondenceSize(fid,nommaa,equ,_numdt,_numit,
407 MED_DESCENDING_FACE,typfac[j],&ncor);
408
409 EXIT_IF(ret < 0,
410 "lors de la lecture du nombre de correspondances dans une equivalence",
411 NULL);
412 fprintf(stdout,"\n - Il y a "IFORMAT" correspondances sur les faces %s\n",ncor,
413 nomfac[j]);
414
415 if (ncor > 0) {
416
417 /* allocation memoire */
418 cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
419 EXIT_IF(cor == NULL,NULL,NULL);
420 ret = MEDequivalenceCorrespondenceRd(fid,nommaa,equ,_numdt,_numit,
422 EXIT_IF(ret < 0,"lors de la lecture du tableau des equivalences",
423 NULL);
424
425 if (!structure) {
426 for (k=0;k<ncor;k++)
427 fprintf(stdout,"\n - Correspondance "IFORMAT" : "IFORMAT" et "IFORMAT" \n",k+1,*(cor+2*k),
428 *(cor+2*k+1));
429 }
430 free(cor);
431 }
432 }
433
434
435 /* sur les aretes */
436 for (j=0;j<MED_N_NODE_FIXED_GEO;j++) {
437
438 ret = MEDequivalenceCorrespondenceSize(fid,nommaa,equ,_numdt,_numit,
439 MED_DESCENDING_EDGE,typare[j],&ncor);
440 EXIT_IF(ret < 0,"lors de la lecture du nombre de correspondances",
441 NULL);
442 fprintf(stdout,"\n - Il y a "IFORMAT" correspondances sur les aretes %s \n",
443 ncor,nomare[j]);
444
445 if (ncor > 0) {
446
447 /* allocation memoire */
448 cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
449 EXIT_IF(cor == NULL,NULL,NULL);
450 ret =MEDequivalenceCorrespondenceRd(fid,nommaa,equ,_numdt,_numit,
452 EXIT_IF(ret < 0,"lors de la lecture du tableau des equivalences",
453 NULL);
454
455 if (!structure) {
456 for (k=0;k<ncor;k++)
457 fprintf(stdout,"\n Correspondance "IFORMAT" : "IFORMAT" et "IFORMAT" \n",k+1,*(cor+2*k),
458 *(cor+2*k+1));
459 }
460
461 free(cor);
462 }
463 }
464 }
465 }
466
467 return;
468}
469
470
471med_int lecture_nombre_joint(med_idt fid,const char * const nommaa)
472{
473 med_int njnt = MEDnSubdomainJoint(fid,nommaa);
474 EXIT_IF(njnt < 0,"lors de la lecture du nombre de joints",NULL);
475 fprintf(stdout,"- Nombre de joints : "IFORMAT" \n",njnt);
476
477 return njnt;
478}
479
480
481void lecture_joint_maillage(med_idt fid,const char * const nommaa,med_int njnt)
482{
483 med_int i,k;
484 char des[MED_COMMENT_SIZE+1];
485 med_int ndom,nent;
486 med_entity_type typ_ent_local,typ_ent_distant;
487 med_int typ_geo_local,typ_geo_distant;
488/* med_int geo_ent_local,geo_ent_distant; */
489
490 char jn [MED_NAME_SIZE+1]="";
491 char maa_dist [MED_NAME_SIZE+1]="";
492 char nom_geo_ent_local [MED_NAME_SIZE+1]="";
493 char nom_geo_ent_distant [MED_NAME_SIZE+1]="";
494 med_int *cortab;
495
496 med_err ret = 0;
497 med_int njstep=0,ncor=0,nodtitncor=0;
498 int corit=0,csit=0;
499 med_int _numdt,_numit;
500
501 if ( (njnt != 0) ) {
502 fprintf(stdout,"\n(******************************)\n");
503 fprintf(stdout,"(* JOINTS DU MAILLAGE : *)\n");
504 fprintf(stdout,"(******************************)\n");
505 }
506
507 /* lecture de touts les joints associes a nommaa */
508 for (i = 0;i<njnt;i++) {
509 fprintf(stdout,"- Joint numero : "IFORMAT" ",i+1);
510
511 /* lecture des infos sur le joint */
512 ret = MEDsubdomainJointInfo(fid,nommaa,i+1,jn,des,&ndom,maa_dist,&njstep,&nodtitncor);
513 EXIT_IF(ret < 0,"lors de la lecture des informations sur un joint",
514 NULL);
515
516 fprintf(stdout,"\n - Nom du joint: %s \n",jn);
517 fprintf(stdout,"\n - Description du joint : %s ",des);
518 fprintf(stdout,"\n - Domaine en regard : "IFORMAT" ",ndom);
519 fprintf(stdout,"\n - Maillage distant : %s ",maa_dist);
520 if (njstep > 1 ) {
521 printf("Nombre d'étapes de calcul : "IFORMAT" \n",njstep);
522 printf("Nombre de correspondance pour (NO_DT,NO_IT) : "IFORMAT" \n",nodtitncor);
523 }
524
525 for (csit=1; csit <= njstep; ++csit) {
526
527 ret = MEDsubdomainComputingStepInfo( fid, nommaa, jn, csit, &_numdt, &_numit, &ncor);
528 EXIT_IF(ret < 0,"Erreur a la lecture des valeurs (numdt,numit) dans les joints",
529 NULL);
530 if ( (_numdt != MED_NO_DT) || (_numit != MED_NO_IT) ) {
531 printf("Etape de calcul (numdt,numit) : ("IFORMAT","IFORMAT")\n",_numdt,_numit);
532 }
533 corit=1;
534 while ( corit <= ncor ) {
535
536 ret = MEDsubdomainCorrespondenceSizeInfo(fid,nommaa,jn,_numdt,_numit,corit,
537 (med_entity_type *) &typ_ent_local, (med_geometry_type *) &typ_geo_local,
538 (med_entity_type *) &typ_ent_distant,(med_geometry_type *)&typ_geo_distant,
539 &nent);
540 EXIT_IF(ret < 0,"Erreur a la lecture des infos sur le nombre d'entite en regard",
541 NULL);
542 if (nent > 0) {
543 if (typ_ent_local == MED_NODE) strcpy(nom_geo_ent_local,"MED_NOEUD");
544 else ret = _MEDgetInternalGeometryTypeName(fid,nom_geo_ent_local,typ_geo_local);
545 EXIT_IF(ret < 0,"Erreur à l'appel de _MEDgetInternalGeometryTypeName", NULL);
546 if (typ_ent_distant == MED_NODE) strcpy(nom_geo_ent_distant,"MED_NOEUD");
547 else ret = _MEDgetInternalGeometryTypeName(fid,nom_geo_ent_distant,typ_geo_distant);
548 EXIT_IF(ret < 0,"Erreur à l'appel de _MEDgetInternalGeometryTypeName", NULL);
549 fprintf(stdout,"\n\t\t- nb de couples d'entites en regard (local,distant)=(%s,%s) : "IFORMAT" \n",
550 nom_geo_ent_local,nom_geo_ent_distant, nent);
551 /*TODO : Supprimer la ligne suivante*/
552/* fprintf(stdout," %d \n",nent); */
553 cortab = (med_int*) malloc(sizeof(med_int)*nent*2);
554 if ( (ret=MEDsubdomainCorrespondenceRd(fid,nommaa,jn,_numdt,_numit,
555 typ_ent_local,typ_geo_local,typ_ent_distant,typ_geo_distant,
556 cortab)) < 0) {
557 fprintf(stdout,"\n\t\t- Erreur a la lecture des correspondances sur (%s,%s,%s,%s)",
558 MED23MESH_GET_ENTITY_TYPENAME[typ_ent_local+1],nom_geo_ent_local,
559 MED23MESH_GET_ENTITY_TYPENAME[typ_ent_distant+1],nom_geo_ent_distant);
560 } else {
561 if (!structure) {
562 for (k=0;k<nent;k++)
563 fprintf(stdout,"\n\t\t- Correspondance "IFORMAT" : "IFORMAT" et "IFORMAT" ",k+1,
564 *(cortab+2*k),*(cortab+2*k+1));
565 }
566 }
567 free(cortab);
568 }
569
570 corit++;
571 }
572 }
573 }
574
575 return;
576}
577
578
580 const char * nommaa,
581 const med_int numdt,
582 const med_int numit)
583{
584
585
586 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
587
588 med_int nnoe = MEDmeshnEntity(fid,nommaa,numdt,numit,
590 MED_COORDINATE,MED_NODAL,&chgt,&trsf);
591 EXIT_IF(nnoe < 0,"lors de la lecture du nombre de noeuds",NULL);
592 fprintf(stdout,"- Nombre de noeuds : "IFORMAT" \n",nnoe);
593
594 return nnoe;
595}
596
597
599 const char * const nommaa,
600 const med_int numdt,
601 const med_int numit,
602 const med_int mdim,
603 const med_int edim,
604 const med_int nnoe,
605 const med_switch_mode mode_coo,
606 const char * const nomcoo,
607 const char * const unicoo,
608 const med_axis_type *const rep)
609{
610 med_float *coo;
611 char *nomnoe;
612 med_int *numnoe;
613 med_int *nufano;
614 med_bool inonoe,inunoe,ifano;
615 med_err ret = 0;
616 med_int i;
617 char str[MED_SNAME_SIZE+1];
618
619
620 /* Allocations memoires */
621 /* table des coordonnees
622 profil : (dimension * nombre de noeuds ) */
623 coo = (med_float*) malloc(sizeof(med_float)*nnoe*edim);
624 EXIT_IF(coo == NULL,NULL,NULL);
625 /* table des numeros, des numeros de familles des noeuds
626 profil : (nombre de noeuds) */
627 numnoe = (med_int*) malloc(sizeof(med_int)*nnoe);
628 EXIT_IF(numnoe == NULL,NULL,NULL);
629 nufano = (med_int*) malloc(sizeof(med_int)*nnoe);
630 EXIT_IF(nufano == NULL,NULL,NULL);
631 /* table des noms des noeuds
632 profil : (nnoe*MED_SNAME_SIZE+1) */
633 nomnoe = (char*) malloc(MED_SNAME_SIZE*nnoe+1);
634 EXIT_IF(nomnoe == NULL,NULL,NULL);
635
636 /* lecture des noeuds :
637 - coordonnees
638 - noms (optionnel dans un fichier MED)
639 - numeros (optionnel dans un fichier MED)
640 - numeros des familles */
641 ret = MEDmeshNodeRd(fid,nommaa,numdt,numit, mode_coo, coo,
642 &inonoe,nomnoe,&inunoe,numnoe,&ifano,nufano);
643
644
645 EXIT_IF(ret < 0,"lors de la lecture des noeuds du maillage \n",NULL);
646
647 /* affichage des resultats */
648 if (nnoe) {
649 fprintf(stdout,"\n(************************)\n");
650 fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n");
651 fprintf(stdout,"(************************)\n\n");
652 }
653 if (!structure) {
654 fprintf(stdout,"- Type de repere des coordonnees : %d \n",*rep);
655 fprintf(stdout,"- Nom des coordonnees : \n");
656 for (i=0;i<edim;i++) {
657 strncpy(str,nomcoo+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
658 str[MED_SNAME_SIZE] = '\0';
659 fprintf(stdout," %s ",str);
660 }
661 fprintf(stdout,"\n- Unites des coordonnees : \n");
662 for (i=0;i<edim;i++) {
663 strncpy(str,unicoo+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
664 str[MED_SNAME_SIZE] = '\0';
665 fprintf(stdout," %s ",str);
666 }
667 fprintf(stdout,"\n- Coordonnees des noeuds : ");
668 for (i=0;i<nnoe*edim;i++) {
669 if (mode_coo == MED_FULL_INTERLACE && !(i % edim))
670 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (i/edim + 1) );
671 if (mode_coo == MED_NO_INTERLACE && ! (i % nnoe))
672 fprintf(stdout,"\n\n ");
673 fprintf(stdout," %-+9.6f ",*(coo+i));
674 }
675
676 if (inonoe) {
677 fprintf(stdout,"\n- Noms des noeuds : \n");
678 for (i=0;i<nnoe;i++) {
679 strncpy(str,nomnoe+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
680 str[MED_SNAME_SIZE] = '\0';
681 fprintf(stdout," %s ",str);
682 }
683 }
684 if (inunoe) {
685 fprintf(stdout,"\n- Numeros des noeuds : \n");
686 for (i=0;i<nnoe;i++)
687 fprintf(stdout," "IFORMAT" ",*(numnoe+i));
688 }
689
690 fprintf(stdout,"\n- Numeros des familles des noeuds : \n");
691 for (i=0;i<nnoe;i++) {
692 if (ifano)
693 fprintf(stdout," "IFORMAT" ",*(nufano+i));
694 else
695 fprintf(stdout," %d ",0);
696 }
697 fprintf(stdout,"\n");
698 }
699
700
701 /* liberation memoire */
702 free(coo);
703 free(nomnoe);
704 free(numnoe);
705 free(nufano);
706
707 return;
708}
709
710
712 const char * const nommaa,
713 const med_int numdt,
714 const med_int numit,
715 const med_geometry_type typ_geo,
716 const med_connectivity_mode typ_con,
717 const int indice)
718{
719
720 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
721
722 med_int nmailles = MEDmeshnEntity(fid,nommaa,numdt,numit,
723 MED_CELL,typ_geo,
724 MED_CONNECTIVITY,typ_con,&chgt,&trsf);
725 EXIT_IF(nmailles < 0," lors de la lecture du nombre de mailles",NULL);
726
727 if ( (indice < (MED_N_CELL_GEO_FIXED_CON-5) ) ||
728 (indice >= (MED_N_CELL_GEO_FIXED_CON-5) && (nmailles > 0) ) )
729 if (nmailles)
730 fprintf (stdout,"- Nombre de mailles de type %s : "IFORMAT" \n",nommai[indice],
731 nmailles);
732
733 return nmailles;
734}
735
737 const char * const nommaa,
738 const med_int numdt,
739 const med_int numit,
740 const int indice,
741 med_geometry_type* geotype,
742 char* geotypename
743 )
744{
745 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
746 med_err _ret=-1;
747 med_int _nmailles=0;
748
749 _ret = MEDmeshEntityInfo(fid,nommaa,numdt,numit, MED_STRUCT_ELEMENT,
750 indice+1,geotypename,geotype );
751 EXIT_IF(_ret<0,
752 "Erreur à la demande d'informations pour le type d'entités MED_STRUCT_ELEMENT",NULL);
753
754 _nmailles = MEDmeshnEntity(fid,nommaa,numdt,numit,
755 MED_STRUCT_ELEMENT,*geotype,
756 MED_CONNECTIVITY,MED_NODAL,&chgt,&trsf);
757
758 EXIT_IF(_nmailles < 0," lors de la lecture du nombre de mailles",NULL);
759
760 if (_nmailles)
761 fprintf (stdout,"- Nombre de mailles de type %s : "IFORMAT" \n",geotypename, _nmailles);
762
763 return _nmailles;
764}
765
767 const char * const nommaa,
768 const med_int numdt,
769 const med_int numit,
770 const med_int nmodels,
771 const med_geometry_type* const geotype,
772 const char* const geotypename,
773 const med_int * const nmailles,
774 const med_switch_mode mode_coo)
775{
776 med_err _ret=-1;
777 med_int taille=0;
778 char str[MED_SNAME_SIZE+1];
779
780 med_int *connectivite;
781 char *nomele;
782 med_int *numele;
783 med_int *nufael;
784 med_bool inoele=MED_FALSE, inuele=MED_FALSE, inufael=MED_FALSE;
785
787 med_int _elementdim=0;
788 char _supportmeshname[MED_NAME_SIZE+1]="";
790 med_int _nnode=0;
791 med_int _ncell=0;
792 med_geometry_type _geocelltype=MED_NONE;
793 med_int _nconstantatribute=0;
794 med_bool _anyprofile=MED_FALSE;
795 med_int _nvariableattribute=0;
796
797 char _attname[MED_NAME_SIZE+1]="";
798 med_attribute_type _atttype;
799 med_int _atttypesize=0;
800 med_int _attvaluesize=0;
801 med_int _nattcomp=0;
802 void *_attvalue=NULL;
803 void (*_printf)(const void*);
804 int i=0,j=0,k=0;
805 med_int dispbanner=MED_FALSE;
806
807 for (i=0; i<nmodels; i++ ) {
808
809 _ret = MEDstructElementInfoByName(fid, &geotypename[i*(MED_NAME_SIZE+1)],
810 &_geotype,&_elementdim,
811 _supportmeshname,&_entitytype,&_nnode,&_ncell,
812 &_geocelltype,&_nconstantatribute,&_anyprofile,&_nvariableattribute);
813
814 if (_ncell > 0 )
815 taille=_ncell*_geocelltype%100;
816 else
817 taille = _nnode;
818
819/* SSCRUTE(&geotypename[i*(MED_NAME_SIZE+1)]); */
820/* ISCRUTE(_nnode); */
821/* ISCRUTE(_ncell); */
822/* ISCRUTE(taille); */
823
824 /* allocation memoire */
825 connectivite = (med_int*) calloc(taille*nmailles[i],sizeof(med_int));
826 EXIT_IF(connectivite == NULL,NULL,NULL);
827 nomele = (char*) malloc(sizeof(char)*MED_SNAME_SIZE*nmailles[i]+1);
828 EXIT_IF(nomele == NULL,NULL,NULL);
829 numele = (med_int*) malloc(sizeof(med_int)*nmailles[i]);
830 EXIT_IF(numele == NULL,NULL,NULL);
831 nufael = (med_int*) malloc(sizeof(med_int)*nmailles[i]);
832 EXIT_IF(nufael == NULL,NULL,NULL);
833
834 /* lecture des données */
835 _ret = MEDmeshElementRd( fid,nommaa,numdt,numit,MED_STRUCT_ELEMENT,geotype[i],
836 MED_NODAL, mode_coo, connectivite,
837 &inoele,nomele,&inuele,numele,&inufael,nufael );
838
839 EXIT_IF(_ret < 0,"lors de la lecture des mailles",NULL);
840
841
842 if ( !dispbanner) {
843 fprintf(stdout,"\n(***************************************)\n");
844 fprintf(stdout, "(* ELEMENTS DE STRUCTURE DU MAILLAGE : *)\n");
845 fprintf(stdout, "(***************************************)\n");
846 dispbanner=MED_TRUE;
847 }
848 if (!structure) {
849 /* affichage des resultats */
850 fprintf(stdout,"\n- Mailles de type %s : ", &geotypename[i*(MED_NAME_SIZE+1)]);
851 if (strcmp(&geotypename[i*(MED_NAME_SIZE+1)],"MED_PARTICLE") ) {
852 fprintf(stdout,"\n - Connectivité : ");
853 for (j=0;j<nmailles[i]*taille;j++) {
854 if (mode_coo == MED_FULL_INTERLACE && !(j % taille))
855 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/taille +1) );
856 if (mode_coo == MED_NO_INTERLACE && !(j % nmailles[i]))
857 fprintf(stdout,"\n");
858 fprintf(stdout," %9"MED_IFORMAT" ",*(connectivite+j));
859 }
860 }
861
862 if (inoele) {
863 fprintf(stdout,"\n - Noms : \n");
864 for (j=0;j<nmailles[i];j++) {
865 strncpy(str,nomele+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
866 str[MED_SNAME_SIZE] = '\0';
867 fprintf(stdout," %s ",str);
868 }
869 }
870 if (inuele) {
871 fprintf(stdout,"\n - Numeros :\n");
872 for (j=0;j<nmailles[i];j++)
873 fprintf(stdout," "IFORMAT" ",*(numele+j));
874 }
875 fprintf(stdout,"\n - Numéros de familles : \n");
876 for (j=0;j<nmailles[i];j++)
877 if (inufael)
878 fprintf(stdout," "IFORMAT" ",*(nufael+j));
879 else
880 fprintf(stdout," %d ",0);
881 fprintf(stdout,"\n");
882 }
883
884
885 /* Read variable attribute(s) */
886 for (k=0; k<_nvariableattribute; k++) {
887
888 /* read informations about the attribute */
889 _ret = MEDstructElementVarAttInfo(fid, &geotypename[i*(MED_NAME_SIZE+1)], k+1,
890 _attname, &_atttype, &_nattcomp);
891 EXIT_IF(_ret < 0,"lors de la lecture des caractéristiques de attributs variables",NULL);
892
893
894 /* Memory allocation */
895 EXIT_IF(_atttype == MED_ATT_UNDEF,"à la lecture du type (valeur : MED_ATT_UNDEF) de l'attribut variable ",_attname);
896 _atttypesize = MEDstructElementAttSizeof(_atttype);
897
898 _attvaluesize = nmailles[i]*_nattcomp*_atttypesize;
899 if ( _atttype == MED_ATT_NAME) ++_attvaluesize;
900 _attvalue = (void *) malloc( _attvaluesize*sizeof(char));
901 --_attvaluesize;
902
903 /* read attribute values */
904 _ret =MEDmeshStructElementVarAttRd(fid, nommaa, numdt, numit,
905 *(geotype+i), _attname, _attvalue );
906 if (_ret < 0 ) free(_attvalue);
907 EXIT_IF(_ret < 0,"lors de la lecture des attributs variables",NULL);
908
909 _printf=MEDstructPrintFunction(_atttype);
910
911 if (!structure) {
912 fprintf(stdout,"\n - Valeurs de l'attribut |%s| pour le type géométrique |%s| : \n",_attname,
913 &geotypename[i*(MED_NAME_SIZE+1)]);
914 for (j=0;j<nmailles[i]*_nattcomp;j++) {
915 if ( ( _nattcomp > 1 ) && !(j % _nattcomp) )
916 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/_nattcomp +1) );
917 _printf( (void *)( (char *)(_attvalue) + j*_atttypesize) );
918 }
919 }
920 /* free memory */
921 free(_attvalue);
922
923 }
924
925 /* liberation memoire */
926 free(connectivite);
927 free(nomele);
928 free(numele);
929 free(nufael);
930 }
931
932 return;
933}
934
936 const char *nommaa,
937 const med_int numdt,
938 const med_int numit,
939 const med_int mdim,
940 const med_int * const nmailles,
941 const med_switch_mode mode_coo,
942 const med_connectivity_mode typ_con)
943{
944 med_int taille;
945 med_int *connectivite;
946 char *nomele;
947 med_int *numele;
948 med_int *nufael;
949 med_bool inoele=MED_FALSE, inuele=MED_FALSE, inufael=MED_FALSE;
950 med_int entdim;
951 med_int nnodes;
952 med_int nndes;
953 med_int i,j;
954 med_err ret = 0;
955 char str[MED_SNAME_SIZE+1];
956 med_int dispbanner=MED_FALSE;
957
958 /* Lecture des connectivites, noms, numeros des mailles */
959 for (i=0;i<MED_N_CELL_GEO_FIXED_CON;i++)
960 if (nmailles[i] > 0) {
961
962 ret=_MEDgetGeometricParameter(MED_CELL, typmai[i],&entdim,&nnodes,&nndes);
963 EXIT_IF(ret < 0,"lors de la lecture des caractéristiques des mailles",NULL);
964
965 switch(typ_con) {
966 case MED_NODAL :
967 taille = nnodes;
968 break;
969
970 case MED_DESCENDING :
971 taille = nndes;
972 break;
973
974 default :
975 ret = -1;
976 }
977
978 /* allocation memoire */
979 connectivite = (med_int*) malloc(sizeof(med_int)*taille*nmailles[i]);
980 EXIT_IF(connectivite == NULL,NULL,NULL);
981 nomele = (char*) malloc(sizeof(char)*MED_SNAME_SIZE*nmailles[i]+1);
982 EXIT_IF(nomele == NULL,NULL,NULL);
983 numele = (med_int*) malloc(sizeof(med_int)*nmailles[i]);
984 EXIT_IF(numele == NULL,NULL,NULL);
985 nufael = (med_int*) malloc(sizeof(med_int)*nmailles[i]);
986 EXIT_IF(nufael == NULL,NULL,NULL);
987
988 /* lecture des données */
989 ret = MEDmeshElementRd( fid,nommaa,numdt,numit,MED_CELL,typmai[i],
990 typ_con, mode_coo, connectivite,
991 &inoele,nomele,&inuele,numele,&inufael,nufael );
992
993 EXIT_IF(ret < 0,"lors de la lecture des mailles",NULL);
994
995 if ( !dispbanner) {
996 fprintf(stdout,"\n(**************************)\n");
997 fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n");
998 fprintf(stdout,"(**************************)\n");
999 dispbanner=MED_TRUE;
1000 }
1001 if (!structure) {
1002 /* affichage des resultats */
1003 fprintf(stdout,"\n- Mailles de type %s : ", nommai[i]);
1004 fprintf(stdout,"\n - Connectivité : ");
1005 for (j=0;j<nmailles[i]*taille;j++) {
1006 if (mode_coo == MED_FULL_INTERLACE && !(j % taille))
1007 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/taille +1) );
1008 if (mode_coo == MED_NO_INTERLACE && !(j % nmailles[i]))
1009 fprintf(stdout,"\n");
1010 fprintf(stdout," %9"MED_IFORMAT" ",*(connectivite+j));
1011 }
1012
1013 if (inoele) {
1014 fprintf(stdout,"\n - Noms : \n");
1015 for (j=0;j<nmailles[i];j++) {
1016 strncpy(str,nomele+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
1017 str[MED_SNAME_SIZE] = '\0';
1018 fprintf(stdout," %s ",str);
1019 }
1020 }
1021 if (inuele) {
1022 fprintf(stdout,"\n - Numeros :\n");
1023 for (j=0;j<nmailles[i];j++)
1024 fprintf(stdout," "IFORMAT" ",*(numele+j));
1025 }
1026 fprintf(stdout,"\n - Numéros de familles : \n");
1027 for (j=0;j<nmailles[i];j++)
1028 if (inufael)
1029 fprintf(stdout," "IFORMAT" ",*(nufael+j));
1030 else
1031 fprintf(stdout," %d ",0);
1032 fprintf(stdout,"\n");
1033 }
1034
1035 /* liberation memoire */
1036 free(connectivite);
1037 free(nomele);
1038 free(numele);
1039 free(nufael);
1040 }
1041
1042 return;
1043}
1044
1045
1047 const char * const nommaa,
1048 const med_int numdt,
1049 const med_int numit,
1050 const med_geometry_type polytype,
1051 const med_connectivity_mode typ_con)
1052{
1053
1054 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
1055 char polytypename[MED_NAME_SIZE+1]="Undefined GeoType";
1056 med_int nmpolygones;
1057
1058 EXIT_IF( (( polytype != MED_POLYGON) &&
1059 ( polytype != MED_POLYGON2) ),
1061
1062
1063 nmpolygones = MEDmeshnEntity(fid,nommaa,numdt,numit,
1064 MED_CELL,polytype,
1065 MED_INDEX_NODE,typ_con,&chgt,&trsf);
1066
1067 EXIT_IF(nmpolygones < 0,"lors de la lecture du nombre de mailles polygone\n",
1068 NULL);
1069 if (nmpolygones > 0 ) nmpolygones--; else nmpolygones=0;
1070 if (nmpolygones) {
1071 MEDmeshGeotypeName(fid,polytype,polytypename);
1072 fprintf(stdout,"- Nombre de mailles de type %s : "IFORMAT" \n",
1073 polytypename,nmpolygones);
1074 }
1075 polytypename[0]='\0';
1076 return nmpolygones;
1077}
1078
1080 const char * const nommaa,
1081 const med_int numdt,
1082 const med_int numit,
1083 const med_geometry_type polytype,
1084 const med_int nmpolygones,
1085 const med_switch_mode mode_coo,
1086 const med_connectivity_mode typ_con)
1087{
1088 med_int i,j;
1089 med_err ret = 0;
1090 med_int taille;
1091 med_int *connectivite;
1092 char *nomele;
1093 med_int *numele;
1094 med_int *nufael;
1095 med_int *indexp;
1096 int ind1,ind2;
1097 char tmp[MED_NAME_SIZE+1];
1098 med_err ret1,ret2,ret3;
1099 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
1100 char polytypename[MED_NAME_SIZE+1]="Undefined GeoType";
1101
1102 EXIT_IF( (( polytype != MED_POLYGON) &&
1103 ( polytype != MED_POLYGON2) ),
1105
1106 /* lecture des mailles de type MED_POLYGONE */
1107
1108 /* quelle taille pour le tableau des connectivites ? */
1109 taille=MEDmeshnEntity(fid,nommaa,numdt,numit,
1110 MED_CELL,polytype,MED_CONNECTIVITY,typ_con,
1111 &chgt,&trsf);
1112 EXIT_IF(taille < 0,"lors de la lecture des parametres des mailles polygones",
1113 NULL);
1114
1115 /* allocation memoire */
1116 indexp = (med_int *) malloc(sizeof(med_int)*(nmpolygones+1));
1117 EXIT_IF(indexp == NULL,NULL,NULL);
1118 connectivite = (med_int *) malloc(sizeof(med_int)*taille);
1119 EXIT_IF(connectivite == NULL,NULL,NULL);
1120 numele = (med_int *) malloc(sizeof(med_int)*nmpolygones);
1121 EXIT_IF(numele == NULL,NULL,NULL);
1122 nufael = (med_int *) malloc(sizeof(med_int)*nmpolygones);
1123 EXIT_IF(nufael == NULL,NULL,NULL);
1124 nomele = (char *) malloc(sizeof(char)*MED_SNAME_SIZE*nmpolygones+1);
1125 EXIT_IF(nomele == NULL,NULL,NULL);
1126
1127 /* lecture de la connectivite des mailles polygones */
1128 ret = MEDmeshPolygon2Rd(fid,nommaa,numdt,numit,MED_CELL,polytype,typ_con,
1129 indexp,connectivite);
1130
1131 EXIT_IF(ret < 0,"lors de la lecture des connectivites des mailles polygones",
1132 NULL);
1133
1134 /* lecture noms */
1135 ret1 = MEDmeshEntityNameRd(fid,nommaa,numdt,numit,
1136 MED_CELL,polytype, nomele);
1137
1138 /* lecture des numeros */
1139 ret2 = (med_int) MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,
1140 MED_CELL, polytype, numele);
1141
1142 /* lecture des numeros de familles */
1143 ret3 = MEDmeshEntityFamilyNumberRd(fid, nommaa, MED_NO_DT, MED_NO_IT,
1144 MED_CELL, polytype, nufael);
1145
1146 if (!structure) {
1147 /* affichage des resultats */
1148 MEDmeshGeotypeName(fid,polytype,polytypename);
1149 fprintf(stdout,"\n\n- Mailles de type %s : ",polytypename);
1150 for (i=0;i<nmpolygones;i++) {
1151 fprintf(stdout,"\n >> Maille MED_POLYGONE "IFORMAT" : \n",i+1);
1152 fprintf(stdout,"\n - Connectivité : ");
1153 ind1 = *(indexp+i)-1;
1154 ind2 = *(indexp+i+1)-1;
1155 for (j=ind1;j<ind2;j++)
1156 printf(" "IFORMAT" ",*(connectivite+j));
1157 if (ret1 == 0) {
1158 strncpy(tmp,nomele+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
1159 tmp[MED_SNAME_SIZE] = '\0';
1160 fprintf(stdout,"\n - Nom : %s \n",tmp);
1161 }
1162 if (ret2 == 0)
1163 fprintf(stdout,"\n - Numero : "IFORMAT" \n",*(numele+i));
1164
1165 if ( ret3 >= 0 )
1166 fprintf(stdout,"\n - Numéro de famille : "IFORMAT" \n",*(nufael+i));
1167 else
1168 fprintf(stdout,"\n - Numéro de famille : %d \n",0);
1169 }
1170 polytypename[0]='\0';
1171 }
1172
1173 /* on libere la memoire */
1174 free(indexp);
1175 free(connectivite);
1176 free(numele);
1177 free(nufael);
1178 free(nomele);
1179
1180 return;
1181}
1182
1183
1185 const char * const nommaa,
1186 const med_int numdt,
1187 const med_int numit,
1188 const med_connectivity_mode typ_con)
1189{
1190 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
1191
1192 med_int npolyedres = MEDmeshnEntity(fid,nommaa,numdt,numit,
1194 MED_INDEX_FACE,typ_con,&chgt,&trsf);
1195
1196 EXIT_IF(npolyedres < 0,"lors de la lecture du nombre de mailles polyedre \n",
1197 NULL);
1198 if ( npolyedres > 0 ) npolyedres--; else npolyedres=0;
1199 if (npolyedres)
1200 fprintf(stdout,"- Nombre de mailles de type MED_POLYEDRE : "IFORMAT" \n",
1201 npolyedres);
1202
1203 return npolyedres;
1204}
1205
1206
1208 const char * const nommaa,
1209 const med_int numdt,
1210 const med_int numit,
1211 const med_int npolyedres,
1212 const med_switch_mode mode_coo,
1213 const med_connectivity_mode typ_con)
1214{
1215 med_int i,j,k;
1216 med_err ret = 0;
1217 med_int taille;
1218 med_int *connectivite;
1219 char *nomele;
1220 med_int *numele;
1221 med_int *nufael;
1222 med_int *indexf, *indexn;
1223 int ind1,ind2;
1224 char tmp[MED_SNAME_SIZE+1];
1225 med_err ret1,ret2,ret3;
1226 med_int nfa;
1227 med_int nnoe;
1228 med_int nindn;
1229 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
1230
1231
1232 /* lecture des parametres de base */
1233 taille = MEDmeshnEntity(fid,nommaa,numdt,numit,
1235 &chgt,&trsf);
1236 EXIT_IF(taille < 0,"lors de la lecture des parametres des mailles polyedres",
1237 NULL);
1238
1239 nindn = MEDmeshnEntity(fid,nommaa,numdt,numit,
1241 &chgt,&trsf);
1242 EXIT_IF(nindn < 0,"lors de la lecture des parametres des mailles polyedres",
1243 NULL);
1244
1245 /* allocation memoire */
1246 /* nindf == npolyedres+1 */
1247 indexf = (med_int *) malloc(sizeof(med_int)*(npolyedres+1));
1248 EXIT_IF(indexf == NULL,NULL,NULL);
1249 indexn = (med_int *) malloc(sizeof(med_int)*nindn);
1250 EXIT_IF(indexn == NULL,NULL,NULL);
1251 connectivite = (med_int *) malloc(sizeof(med_int)*taille);
1252 EXIT_IF(connectivite == NULL,NULL,NULL);
1253 numele = (med_int *) malloc(sizeof(med_int)*npolyedres);
1254 EXIT_IF(numele == NULL,NULL,NULL);
1255 nufael = (med_int *) malloc(sizeof(med_int)*npolyedres);
1256 EXIT_IF(nufael == NULL,NULL,NULL);
1257 nomele = (char *) malloc(sizeof(char)*MED_SNAME_SIZE*npolyedres+1);
1258 EXIT_IF(nomele == NULL,NULL,NULL);
1259
1260 ret = MEDmeshPolyhedronRd(fid,nommaa,numdt,numit,MED_CELL,typ_con,
1261 indexf,indexn,connectivite);
1262 EXIT_IF(ret < 0,
1263 "lors de la lecture de la connectivite des mailles polyedres",
1264 NULL);
1265
1266 /* lecture des noms */
1267 ret1 = MEDmeshEntityNameRd(fid,nommaa,numdt,numit,MED_CELL,MED_POLYHEDRON,nomele);
1268
1269 /* lecture des numeros */
1270 ret2 = MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,MED_CELL,MED_POLYHEDRON,numele);
1271
1272 /* lecture des numeros de familles */
1273 ret3 = MEDmeshEntityFamilyNumberRd(fid,nommaa,numdt,numit,MED_CELL,MED_POLYHEDRON,nufael);
1274
1275 if (!structure) {
1276 /* affichage des resultats */
1277 fprintf(stdout,"\n\n- Mailles de type MED_POLYEDRE : ");
1278 for (i=0;i<npolyedres;i++) {
1279 fprintf(stdout,"\n >> Maille MED_POLYEDRE "IFORMAT" : \n",i+1);
1280 fprintf(stdout,"\n - Connectivité : \n");
1281 nfa = *(indexf+i+1) - *(indexf+i);
1282 /* ind1 = indice dans "faces" pour acceder aux numeros des faces */
1283 ind1 = *(indexf+i) - 1;
1284 for (j=0;j<nfa;j++) {
1285 if (typ_con == MED_NODAL) {
1286 /* ind2 = indice dans "connectivite"
1287 pour acceder au premier noeud de la face */
1288 ind2 = *(indexn+ind1+j) - 1;
1289 nnoe = *(indexn+ind1+j+1) - *(indexn+ind1+j);
1290 fprintf(stdout," - Face "IFORMAT" : [ ", j+1);
1291 for (k=0;k<nnoe;k++)
1292 printf(" "IFORMAT" ",*(connectivite+ind2+k));
1293 printf(" ] \n");
1294 }
1295 else {
1296 nfa = *(indexf+i+1) - *(indexf+i);
1297 /* ind1 = indice dans "connectivite"
1298 pour acceder aux numeros des faces */
1299 ind1 = *(indexf+i) - 1;
1300 for (j=0;j<nfa;j++)
1301 fprintf(stdout," - Face "IFORMAT" de numero : "IFORMAT" et de type "IFORMAT" \n", j+1,
1302 *(connectivite+ind1+j),*(indexn+ind1+j));
1303 }
1304 }
1305 if (ret1 == 0) {
1306 strncpy(tmp,nomele+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
1307 tmp[MED_SNAME_SIZE] = '\0';
1308 fprintf(stdout,"\n - Nom : %s \n",tmp);
1309 }
1310 if (ret2 == 0)
1311 fprintf(stdout,"\n - Numero : "IFORMAT" \n",*(numele+i));
1312 if (ret3 >= 0)
1313 fprintf(stdout,"\n - Numéro de famille : "IFORMAT" \n",*(nufael+i));
1314 else
1315 fprintf(stdout,"\n - Numéro de famille : %d \n",0);
1316
1317 }
1318 }
1319
1320 /* on libere la memoire */
1321 free(indexf);
1322 free(indexn);
1323 free(connectivite);
1324 free(numele);
1325 free(nufael);
1326 free(nomele);
1327
1328 return;
1329}
1330
1332 const char * const nommaa,
1333 const med_int numdt,
1334 const med_int numit,
1335 const med_geometry_type typ_geo,
1336 const med_int indice
1337 )
1338{
1339
1340 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
1341
1342 med_int nfaces = MEDmeshnEntity(fid,nommaa,numdt,numit,
1343 MED_DESCENDING_FACE,typ_geo,
1344 MED_CONNECTIVITY,MED_DESCENDING,&chgt,&trsf);
1345 EXIT_IF(nfaces < 0,"lors de la lecture du nombre de faces",NULL);
1346
1347 if ( (indice < (MED_N_FACE_GEO_FIXED_CON-2) ) ||
1348 (indice >= (MED_N_FACE_GEO_FIXED_CON-2) && (nfaces > 0) ) )
1349 if (nfaces)
1350 fprintf (stdout,"- Nombre de faces de type %s : "IFORMAT" \n",
1351 nomfac[indice],nfaces);
1352
1353 return nfaces;
1354}
1355
1357 const char * const nommaa,
1358 const med_int numdt,
1359 const med_int numit,
1360 const med_int mdim,
1361 const med_int *const nfaces,
1362 const med_switch_mode mode_coo)
1363{
1364 med_int taille;
1365 med_int *connectivite;
1366 char *nomele;
1367 med_int *numele;
1368 med_int *nufael;
1369 med_bool inoele,inuele,inufael;
1370 med_int i,j;
1371 med_err ret = 0;
1372 char str[MED_SNAME_SIZE+1];
1373 med_int entdim;
1374 med_int nnodes;
1375
1376 for (i=0;i<MED_N_FACE_GEO_FIXED_CON;i++)
1377 if (nfaces[i] > 0 ) {
1378
1379 /* taille de la description : nombre d'aretes */
1380 ret=_MEDgetGeometricParameter(MED_DESCENDING_FACE, typfac[i],&entdim,&nnodes,&taille);
1381 EXIT_IF(ret < 0,"lors de la lecture des caractéristiques des mailles",NULL);
1382
1383 /* allocation memoire */
1384 connectivite = (med_int*)malloc(sizeof(med_int)*taille*nfaces[i]);
1385 EXIT_IF(connectivite == NULL,NULL,NULL);
1386 nomele = (char*)malloc(sizeof(char)*MED_SNAME_SIZE*nfaces[i]+1);
1387 EXIT_IF(nomele == NULL,NULL,NULL);
1388 numele = (med_int*)malloc(sizeof(med_int)*nfaces[i]);
1389 EXIT_IF(numele == NULL,NULL,NULL);
1390 nufael = (med_int*)malloc(sizeof(med_int)*nfaces[i]);
1391 EXIT_IF(nufael == NULL,NULL,NULL);
1392
1393 /* lecture des données */
1394 ret = MEDmeshElementRd( fid,nommaa,numdt,numit,MED_DESCENDING_FACE,typmai[i],
1395 MED_DESCENDING, mode_coo, connectivite,
1396 &inoele,nomele,&inuele,numele,&inufael,nufael );
1397 EXIT_IF(ret < 0,"lors de la lecture des faces",NULL);
1398
1399 if (!structure) {
1400 /* affichage des resultats */
1401 fprintf(stdout,"\n- Faces de type %s : ", nomfac[i]);
1402 fprintf(stdout,"\n - Connectivité : ");
1403 for (j=0;j<nfaces[i]*taille;j++) {
1404 if (mode_coo == MED_FULL_INTERLACE && !(j % taille))
1405 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/taille+1) );
1406 if (mode_coo == MED_NO_INTERLACE && !(j % nfaces[i]))
1407 fprintf(stdout,"\n");
1408 fprintf(stdout," %9"MED_IFORMAT" ",*(connectivite+j));
1409 }
1410
1411 if (inoele) {
1412 fprintf(stdout,"\n - Noms : \n");
1413 for (j=0;j<nfaces[i];j++) {
1414 strncpy(str,nomele+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
1415 str[MED_SNAME_SIZE] = '\0';
1416 fprintf(stdout," %s ",str);
1417 }
1418 }
1419 if (inuele) {
1420 fprintf(stdout,"\n - Numeros :\n");
1421 for (j=0;j<nfaces[i];j++)
1422 fprintf(stdout," "IFORMAT" ",*(numele+j));
1423 }
1424 fprintf(stdout,"\n - Numéros de familles : \n");
1425 for (j=0;j<nfaces[i];j++)
1426 if ( inufael )
1427 fprintf(stdout," "IFORMAT" ",*(nufael+j));
1428 else
1429 fprintf(stdout," %d ",0);
1430 }
1431
1432 /* liberation memoire */
1433 free(connectivite);
1434 free(nomele);
1435 free(numele);
1436 free(nufael);
1437 }
1438
1439 return;
1440}
1441
1443 const char * const nommaa,
1444 const med_int numdt,
1445 const med_int numit)
1446{
1447
1448 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
1449
1450 med_int nfpolygones = MEDmeshnEntity(fid,nommaa,numdt,numit,
1452 MED_INDEX_NODE,MED_DESCENDING,&chgt,&trsf);
1453
1454 EXIT_IF(nfpolygones < 0,"lors de la lecture du nombre de faces polygone \n",
1455 NULL);
1456 if (nfpolygones > 0 ) nfpolygones--; else nfpolygones=0;
1457 if (nfpolygones)
1458 fprintf(stdout,"- Nombre de faces de type MED_POLYGONE : "IFORMAT" \n",
1459 nfpolygones);
1460
1461 return nfpolygones;
1462}
1463
1465 const char * const nommaa,
1466 const med_int numdt,
1467 const med_int numit,
1468 const med_int nfpolygones,
1469 const med_switch_mode mode_coo)
1470{
1471 med_int i,j;
1472 med_err ret = 0;
1473 char *nomele;
1474 med_int *numele;
1475 med_int *nufael;
1476 med_int *connectivite;
1477 med_int taille;
1478 med_int *indexp;
1479 int ind1,ind2;
1480 char tmp[MED_NAME_SIZE+1];
1481 med_err ret1,ret2,ret3;
1482 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
1483
1484 /* quelle taille pour le tableau des connectivites ? */
1485 taille=MEDmeshnEntity(fid,nommaa,numdt,numit,
1487 &chgt,&trsf);
1488 EXIT_IF(taille < 0,"lors de la lecture des parametres des faces polygones",
1489 NULL);
1490
1491 /* allocation memoire */
1492 indexp = (med_int *) malloc(sizeof(med_int)*(nfpolygones+1));
1493 EXIT_IF(indexp == NULL,NULL,NULL);
1494 connectivite = (med_int *) malloc(sizeof(med_int)*taille);
1495 EXIT_IF(connectivite == NULL,NULL,NULL);
1496 numele = (med_int *) malloc(sizeof(med_int)*nfpolygones);
1497 EXIT_IF(numele == NULL,NULL,NULL);
1498 nufael = (med_int *) malloc(sizeof(med_int)*nfpolygones);
1499 EXIT_IF(nufael == NULL,NULL,NULL);
1500 nomele = (char *) malloc(sizeof(char)*MED_SNAME_SIZE*nfpolygones+1);
1501 EXIT_IF(nomele == NULL,NULL,NULL);
1502
1503 /* lecture de la connectivite des faces polygones */
1504 ret = MEDmeshPolygonRd(fid,nommaa,numdt,numit,MED_DESCENDING_FACE,MED_DESCENDING,
1505 indexp,connectivite);
1506 EXIT_IF(ret < 0,"lors de la lecture des connectivites des faces polygones", NULL);
1507
1508 /* lecture noms */
1509 ret1 = MEDmeshEntityNameRd(fid,nommaa,numdt,numit,
1511
1512 /* lecture des numeros */
1513 ret2 = (med_int) MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,
1515
1516 /* lecture des numeros de familles */
1517 ret3 = MEDmeshEntityFamilyNumberRd(fid, nommaa, MED_NO_DT, MED_NO_IT,
1519
1520 if (!structure) {
1521 /* affichage des resultats */
1522 fprintf(stdout,"\n\n- Faces de type MED_POLYGONE : ");
1523 for (i=0;i<nfpolygones;i++) {
1524 fprintf(stdout,"\n >> Face MED_POLYGONE "IFORMAT" : \n",i+1);
1525 fprintf(stdout,"\n - Connectivité : ");
1526 ind1 = *(indexp+i)-1;
1527 ind2 = *(indexp+i+1)-1;
1528 for (j=ind1;j<ind2;j++)
1529 fprintf(stdout," "IFORMAT" ",*(connectivite+j));
1530 if (ret1 == 0) {
1531 strncpy(tmp,nomele+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
1532 tmp[MED_SNAME_SIZE] = '\0';
1533 fprintf(stdout,"\n - Nom : %s \n",tmp);
1534 }
1535 if (ret2 == 0)
1536 fprintf(stdout,"\n - Numero : "IFORMAT" \n",*(numele+j));
1537 if ( ret3 > 0 )
1538 fprintf(stdout,"\n - Numéro de famille : "IFORMAT" \n",*(nufael+i));
1539 else
1540 fprintf(stdout,"\n - Numéro de famille : %d \n",0);
1541 }
1542 }
1543
1544 /* on libere la memoire */
1545 free(indexp);
1546 free(connectivite);
1547 free(numele);
1548 free(nufael);
1549 free(nomele);
1550
1551 return;
1552}
1553
1554
1556 const char *const nommaa,
1557 const med_int numdt,
1558 const med_int numit,
1559 const med_geometry_type typ_geo,
1560 const med_int indice)
1561{
1562
1563 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
1564
1565 med_int naretes = MEDmeshnEntity(fid,nommaa,numdt,numit,
1566 MED_DESCENDING_EDGE, typ_geo,
1567 MED_CONNECTIVITY,MED_DESCENDING,&chgt,&trsf);
1568 EXIT_IF(naretes < 0,"lors de la lecture du nombre d'aretes",NULL);
1569 if ( (indice < (MED_N_EDGE_GEO_FIXED_CON-1) ) ||
1570 (indice >= (MED_N_EDGE_GEO_FIXED_CON-1) && (naretes > 0) ) )
1571 if (naretes)
1572 fprintf (stdout,
1573 "- Nombre d'aretes de type %s : "IFORMAT" \n",nomare[indice],naretes);
1574
1575 return naretes;
1576}
1577
1579 const char * const nommaa,
1580 const med_int numdt,
1581 const med_int numit,
1582 const med_int mdim,
1583 const med_int * const naretes,
1584 const med_switch_mode mode_coo)
1585{
1586 med_int taille;
1587 med_int *connectivite;
1588 char *nomele;
1589 med_int *numele;
1590 med_int *nufael;
1591 med_bool inoele,inuele,inufael;
1592 med_int i,j;
1593 med_err ret = 0;
1594 char str[MED_SNAME_SIZE+1];
1595 med_int entdim;
1596 med_int nnodes;
1597
1598 for (i=0;i<MED_N_EDGE_GEO_FIXED_CON;i++)
1599 if (naretes[i] > 0) {
1600
1601 ret=_MEDgetGeometricParameter(MED_DESCENDING_EDGE, typare[i],&entdim,&nnodes,&taille);
1602 EXIT_IF(ret < 0,"lors de la lecture des caractéristiques des mailles",NULL);
1603
1604 /* allocation memoire */
1605 connectivite = (med_int*)malloc(sizeof(med_int)*taille*naretes[i]);
1606 EXIT_IF(connectivite == NULL,NULL,NULL);
1607 nomele = (char*)malloc(sizeof(char)*MED_SNAME_SIZE*naretes[i]+1);
1608 EXIT_IF(nomele == NULL,NULL,NULL);
1609 numele = (med_int*)malloc(sizeof(med_int)*naretes[i]);
1610 EXIT_IF(numele == NULL,NULL,NULL);
1611 nufael = (med_int*)malloc(sizeof(med_int)*naretes[i]);
1612 EXIT_IF(nufael == NULL,NULL,NULL);
1613
1614 /* lecture des données */
1615 ret = MEDmeshElementRd( fid,nommaa,numdt,numit,MED_DESCENDING_EDGE,typare[i],
1616 MED_DESCENDING, mode_coo, connectivite,
1617 &inoele,nomele,&inuele,numele,&inufael,nufael );
1618 EXIT_IF(ret < 0,"lors de la lecture des aretes",
1619 NULL);
1620
1621 if (!structure) {
1622 /* affichage des resultats */
1623 fprintf(stdout,"\n- Aretes de type %s : ", nomare[i]);
1624 fprintf(stdout,"\n - Connectivité : ");
1625 for (j=0;j<naretes[i]*taille;j++) {
1626 if (mode_coo == MED_FULL_INTERLACE && !(j % taille))
1627 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/taille+1) );
1628 if (mode_coo == MED_NO_INTERLACE && !(j % naretes[i]))
1629 fprintf(stdout,"\n");
1630 fprintf(stdout," %9"MED_IFORMAT" ",*(connectivite+j));
1631 }
1632
1633 if (inoele) {
1634 fprintf(stdout,"\n - Noms : \n");
1635 for (j=0;j<naretes[i];j++) {
1636 strncpy(str,nomele+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
1637 str[MED_SNAME_SIZE] = '\0';
1638 fprintf(stdout," %s ",str);
1639 }
1640 }
1641 if (inuele) {
1642 fprintf(stdout,"\n - Numeros :\n");
1643 for (j=0;j<naretes[i];j++)
1644 fprintf(stdout," "IFORMAT" ",*(numele+j));
1645 }
1646 fprintf(stdout,"\n - Numéros de familles : \n");
1647 for (j=0;j<naretes[i];j++)
1648 if ( inufael )
1649 fprintf(stdout," "IFORMAT" ",*(nufael+j));
1650 else
1651 fprintf(stdout," %d ",0);
1652 }
1653
1654 /* liberation memoire */
1655 free(connectivite);
1656 free(nomele);
1657 free(numele);
1658 free(nufael);
1659 }
1660
1661 return;
1662}
1663
1664
1665/******************************************************************************
1666 * - Nom de la fonction : lecture_maillage_non_structure
1667 * - Description : lecture et affichage d'un maillage MED_NON_STRUCTURE.
1668 * - Parametres :
1669 * - fid (IN) : ID du fichier MED.
1670 * - nommaa (IN) : nom du maillage a lire.
1671 * - mdim (IN) : dimension du maillage.
1672 * - mode_coo (IN) : mode de stockage en memoire :
1673 * MED_FULL_INTERLACE : entrelace |
1674 * MED_NO_INTERLACE : non entrelace.
1675 * - typ_con (IN) : mode de connectivite :
1676 * MED_DESCENDING : descendante |
1677 * MED_NODAL : nodale.
1678 * - lecture_en_tete_seulement (IN) : mode de lecture et d'affichage.
1679 ******************************************************************************/
1680
1682 const char *nommaa,
1683 const med_int numdt,
1684 const med_int numit,
1685 const med_int mdim,
1686 const med_int edim,
1687 const med_switch_mode mode_coo,
1688 const med_connectivity_mode typ_con,
1689 const char * const nomcoo,
1690 const char * const unicoo,
1691 const med_axis_type *const rep,
1692 med_int* nmodels,
1693 med_geometry_type** geotype_elst,
1694 char** geotypename_elst,
1695 const int lecture_en_tete_seulement)
1696{
1697 med_int i;
1698 /* nombre d'objets MED : noeuds, mailles, faces, aretes , ... */
1699 med_int nnoe;
1703 /* polygones et polyedres */
1704 med_int nmpolygones,nmpolygones2, npolyedres, nfpolygones;
1705 /* familles */
1706 med_int nfam;
1707 /* equivalences */
1708 med_int nequ;
1709 /* joints */
1710 med_int njnt;
1711 /* Eléments de structure */
1712 med_int _nmodels=0,*_nmailles_elst = NULL;
1713 med_geometry_type *_geotype_elst = NULL;
1714 char *_geotypename_elst = NULL;
1715 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
1716
1717 /* Combien de noeuds dans le maillage ? */
1718 nnoe = lecture_nombre_noeuds_maillage_non_structure(fid,nommaa,numdt,numit);
1719
1720 /* Combien de types d'éléments de structure utilisés dans le maillage */
1721 _nmodels = MEDmeshnEntity(fid,nommaa,numdt,numit,
1723 &chgt,&trsf);
1724 EXIT_IF(_nmodels<0,
1725 "Erreur à la lecture du nombre de type géométrique pour le type d'entités MED_STRUCT_ELEMENT",NULL);
1726
1727 _nmailles_elst = (med_int *) malloc(_nmodels*sizeof(med_int));
1728 _geotype_elst = (med_geometry_type *) malloc(_nmodels*sizeof(med_geometry_type));
1729 _geotypename_elst = (char *) malloc(_nmodels*sizeof(char)*(MED_NAME_SIZE+1));
1730 /* Combien mailles par types d'éléments de structure */
1731 for (i=0; i < _nmodels; i++) {
1732 _nmailles_elst[i]=lecture_nombre_et_type_mailles_elstruct(fid,nommaa,numdt,numit,i,
1733 &_geotype_elst[i],&_geotypename_elst[i*(MED_NAME_SIZE+1)]);
1734 }
1735 if (_nmodels) {
1736 *nmodels = _nmodels;
1737 *geotype_elst = _geotype_elst;
1738 *geotypename_elst = _geotypename_elst;
1739 } else *nmodels=0;
1740
1741 /*TODO : AFFICHER DT ( DTUNIT ) */
1742 /* Combien de mailles, faces ou aretes pour chaque type geometrique ? */
1743 for (i=0;i<MED_N_CELL_GEO_FIXED_CON;i++)
1744 nmailles[i] = lecture_nombre_mailles_standards(fid,nommaa,numdt,numit,typmai[i],
1745 typ_con,i);
1746
1747 /* Combien de mailles polygones simples */
1748 nmpolygones = lecture_nombre_mailles_polygones(fid,nommaa,numdt,numit,MED_POLYGON,typ_con);
1749
1750 /* Combien de mailles polygones quadratiques */
1751 nmpolygones2 = lecture_nombre_mailles_polygones(fid,nommaa,numdt,numit,MED_POLYGON2,typ_con);
1752
1753 /* Combien de mailles polyedres quelconques ? */
1754 npolyedres = lecture_nombre_mailles_polyedres(fid,nommaa,numdt,numit,typ_con);
1755
1756 /* Pour la connectivite descendante */
1757 if (typ_con == MED_DESCENDING) {
1758
1759 /* Combien de faces : types geometriques standards ? */
1760 for (i=0;i<MED_N_FACE_GEO_FIXED_CON;i++)
1761 nfaces[i] = lecture_nombre_faces_standards(fid,nommaa,numdt,numit,typfac[i],i);
1762
1763 /* Combien de faces polygones quelconques ? */
1764 nfpolygones = lecture_nombre_faces_polygones(fid,nommaa,numdt,numit);
1765
1766 /* Combien d'aretes */
1767 for (i=0;i<MED_N_EDGE_GEO_FIXED_CON;i++)
1768 naretes[i] = lecture_nombre_aretes_standards(fid,nommaa,numdt,numit,typare[i],i);
1769 }
1770
1771 if (lecture_en_tete_seulement != MED_LECTURE_MAILLAGE_SUPPORT_UNIQUEMENT) {
1772 /* combien de familles ? */
1773 nfam = lecture_nombre_famille(fid,nommaa);
1774
1775 /* combien d'equivalences ? */
1776 nequ = lecture_nombre_equivalence(fid,nommaa);
1777
1778 /* combien de joints ? */
1779 njnt = lecture_nombre_joint(fid,nommaa);
1780 }
1781
1782 /* en fonction du mode de lecture, on continue ou non */
1783 if (lecture_en_tete_seulement == MED_LECTURE_ENTETE_SEULEMENT) {
1784/* Ces desallocations sont effectuées
1785 après la lecture des champs sur ces éléments de structure */
1786/* free(_nmailles_elst); */
1787/* free(_geotype_elst); */
1788/* free(_geotypename_elst); */
1789 return;
1790 }
1791 /****************************************************************************
1792 * LECTURE DES NOEUDS *
1793 ****************************************************************************/
1794 lecture_noeuds_maillage_non_structure(fid,nommaa,numdt,numit,mdim,edim,nnoe,mode_coo,nomcoo,unicoo,rep);
1795 /*ICI;_MEDobjetsOuverts(fid);*/
1796
1797
1798 /****************************************************************************
1799 * LECTURE DES ELEMENTS *
1800 * Mailles : *
1801 * - Types geometriques classiques : MED_SEG2, MED_SEG3, MED_TRIA3, ... *
1802 * - Elements de structure *
1803 * - Polygones quelconques. *
1804 * - Polyedres quelconques. *
1805 * Faces (connectivite descendante uniquement) : *
1806 * - Types geometriques classiques. *
1807 * - Polygones quelconques. *
1808 ****************************************************************************/
1809
1810 /* lecture et affichage des mailles */
1811 lecture_mailles_standards(fid,nommaa,numdt,numit,mdim,nmailles,mode_coo,typ_con);
1812 /*ICI;_MEDobjetsOuverts(fid);*/
1813
1814 if (lecture_en_tete_seulement == MED_LECTURE_MAILLAGE_SUPPORT_UNIQUEMENT) return;
1815
1816 if (_nmodels>0) {
1817 lecture_mailles_elstruct(fid,nommaa,numdt,numit,_nmodels,
1818 _geotype_elst,_geotypename_elst,_nmailles_elst,mode_coo);
1819 /* Ces desallocations sont effectuées
1820 après la lecture des champs sur ces éléments de structure */
1821/* free(_nmailles_elst); */
1822/* free(_geotype_elst); */
1823/* free(_geotypename_elst); */
1824 }
1825 /*ICI;_MEDobjetsOuverts(fid);*/
1826
1827 if (nmpolygones > 0)
1828 lecture_mailles_polygones(fid,nommaa,numdt,numit,MED_POLYGON,nmpolygones,mode_coo,typ_con);
1829 /*ICI;_MEDobjetsOuverts(fid);*/
1830
1831 if (nmpolygones2 > 0)
1832 lecture_mailles_polygones(fid,nommaa,numdt,numit,MED_POLYGON2,nmpolygones2,mode_coo,typ_con);
1833 /*ICI;_MEDobjetsOuverts(fid);*/
1834
1835 if (npolyedres > 0)
1836 lecture_mailles_polyedres(fid,nommaa,numdt,numit,npolyedres,mode_coo,typ_con);
1837 /*ICI;_MEDobjetsOuverts(fid);*/
1838
1839 /* lecture et affichage des faces en connectivite descendante uniquement */
1840 if (typ_con == MED_DESCENDING) {
1841 lecture_faces_standard(fid,nommaa,numdt,numit,mdim,nfaces,mode_coo);
1842 if (nfpolygones > 0)
1843 lecture_faces_polygones(fid,nommaa,numdt,numit,nfpolygones,mode_coo);
1844 }
1845 /*ICI;_MEDobjetsOuverts(fid);*/
1846
1847 /* lecture et affichage des aretes en connectivite descendante uniquement */
1848 if (typ_con == MED_DESCENDING)
1849 lecture_aretes_standards(fid,nommaa,numdt,numit,mdim,naretes,mode_coo);
1850 /*ICI;_MEDobjetsOuverts(fid);*/
1851
1852 /****************************************************************************
1853 * LECTURE DES FAMILLES *
1854 ****************************************************************************/
1855 lecture_famille_maillage(fid,nommaa,nfam);
1856 /*ICI;_MEDobjetsOuverts(fid);*/
1857
1858
1859 /****************************************************************************
1860 * LECTURE DES EQUIVALENCES *
1861 ****************************************************************************/
1862 lecture_equivalence_maillage(fid,nommaa,nequ);
1863 /*ICI;_MEDobjetsOuverts(fid);*/
1864
1865
1866 /****************************************************************************
1867 * LECTURE DES JOINTS *
1868 ****************************************************************************/
1869 lecture_joint_maillage(fid,nommaa,njnt);
1870 /*ICI;_MEDobjetsOuverts(fid);*/
1871
1872 return;
1873}
1874
1875
1877 const char * const nommaa,
1878 const med_int numdt,
1879 const med_int numit,
1880 const med_int mdim,
1881 med_int *nind,
1882 med_int *nnoe,
1883 med_int *nmai,
1884 med_grid_type *type)
1885{
1886 med_err ret = 0;
1887 med_int axe;
1888 med_int *structure_grille;
1889 med_data_type quoi;
1890 med_int j;
1891 med_bool chgt=MED_FALSE,trsf=MED_FALSE;
1892
1893 /* lecture de la nature du maillage structure : MED_GRILLE_CARTESIENNE ,...*/
1894 ret = MEDmeshGridTypeRd(fid,nommaa,type);
1895 EXIT_IF(ret < 0,"a la lecture du type d'une grille ",NULL);
1896
1897 switch(*type) {
1898
1899 case MED_CARTESIAN_GRID :
1900 case MED_POLAR_GRID :
1901 if (*type == MED_CARTESIAN_GRID)
1902 fprintf(stdout,"- Type de grille : MED_GRILLE_CARTESIENNE \n");
1903 else
1904 fprintf(stdout,"- Type de grille : MED_GRILLE_POLAIRE \n");
1905 for (axe=1;axe<=mdim;axe++) {
1906 switch(axe) {
1907
1908 case 1:
1909 quoi = MED_COORDINATE_AXIS1;
1910 break;
1911
1912 case 2:
1913 quoi = MED_COORDINATE_AXIS2;
1914 break;
1915
1916 case 3:
1917 quoi = MED_COORDINATE_AXIS3;
1918 break;
1919 }
1920 nind[axe - 1] = MEDmeshnEntity(fid,nommaa, numdt, numit,
1921 MED_NODE, MED_NONE, quoi, MED_NO_CMODE, &chgt, &trsf);
1922
1923 EXIT_IF(nind[axe - 1] < 0,
1924 "lors de la lecture de la taille d'un indice d'une grille",
1925 NULL);
1926 *nnoe = nind[axe - 1] * (*nnoe);
1927 *nmai = (nind[axe - 1] - 1) * (*nmai);
1928 fprintf(stdout,
1929 "- Taille de l'indice de l'axe "IFORMAT" des coordonnees : "IFORMAT" \n",
1930 axe,nind[axe - 1]);
1931 }
1932 break;
1933
1935 fprintf(stdout,"- Type de grille : MED_GRILLE_DESTRUCTUREE \n");
1936 *nnoe = MEDmeshnEntity(fid, nommaa, numdt, numit,
1937 MED_NODE, MED_NONE, MED_COORDINATE, MED_NO_CMODE, &chgt, &trsf);
1938 EXIT_IF(*nnoe < 0,"lors de la lecture du nombre de noeuds du maillage "
1939 ,nommaa);
1940
1941 /* on alloue la memoire */
1942 structure_grille = (med_int *) malloc(sizeof(med_int)*mdim);
1943 EXIT_IF(structure_grille == NULL,NULL,NULL);
1944 /* on lit la structure de la grille
1945 et on affiche le resultat */
1946 ret = MEDmeshGridStructRd(fid,nommaa,numdt, numit, structure_grille);
1947 EXIT_IF(ret < 0,"lors de la lecture de la structure de la grille",
1948 NULL);
1949 fprintf(stdout,"- Structure de la grille : [ ");
1950 for (j=0;j<mdim;j++) {
1951 *nmai = (*(structure_grille+j) - 1) * (*nmai);
1952 fprintf(stdout," "IFORMAT" ",*(structure_grille+j));
1953 }
1954 fprintf(stdout," ] \n");
1955 /* on nettoie la memoire */
1956 free(structure_grille);
1957 break;
1958
1960 default:
1961 EXIT_IF(-1,"Type de grille non reconnu.",nommaa);
1962
1963 }
1964
1965 fprintf(stdout,"- Nombre de noeuds : "IFORMAT" \n",*nnoe);
1966 fprintf(stdout,"- Nombre de mailles : "IFORMAT" \n",*nmai);
1967
1968 return;
1969}
1970
1971
1973 const char * const nommaa,
1974 const med_int numdt,
1975 const med_int numit,
1976 const med_int mdim,
1977 const med_int edim,
1978 const med_int * const nind,
1979 const med_int nnoe,
1980 const char * const comp,
1981 const char * const unit,
1982 const med_grid_type type,
1983 const med_switch_mode mode_coo)
1984{
1985 med_err ret = 0;
1986 med_int axe,i,j;
1987 char str[MED_SNAME_SIZE+1];
1988 med_float *coo = NULL;
1989 med_float *indices = NULL;
1990 med_int *nufano = NULL;
1991 med_int *numnoe = NULL;
1992 char *nomnoe = NULL;
1993 med_bool inufael=MED_FALSE;
1994
1995 fprintf(stdout,"\n(*************************)\n");
1996 fprintf(stdout,"(* NOEUDS DE LA GRILLE : *)\n");
1997 fprintf(stdout,"(*************************)\n");
1998
1999 switch(type) {
2000
2001 case MED_CARTESIAN_GRID :
2002 case MED_POLAR_GRID :
2003 /* on affiche les coordonnees de chacun des axes */
2004 for (axe = 1; axe<=mdim; axe++) {
2005 /* on alloue la memoire */
2006 indices = (med_float *) malloc(sizeof(med_float)*nind[axe - 1]);
2007 EXIT_IF(indices == NULL,NULL,NULL);
2008 /* on lit le tableau des indices de coordonnees
2009 et on affiche le resultat */
2010 ret = MEDmeshGridIndexCoordinateRd(fid,nommaa,numdt,numit, axe,indices);
2011 EXIT_IF(ret < 0,"lors de la lecture d'un tableau d'indice",
2012 NULL);
2013 fprintf(stdout,"\n - Axe %." xstr(MED_SNAME_SIZE) "s [%." xstr(MED_SNAME_SIZE) "s] : [ ",
2014 &comp[MED_SNAME_SIZE*(axe-1)],&unit[MED_SNAME_SIZE*(axe-1)]);
2015 for (j=0;j<nind[axe - 1];j++)
2016 fprintf(stdout," %f ",*(indices+j));
2017 printf(" ] \n");
2018 /* on nettoie la memoire */
2019 free(indices);
2020 }
2021 break;
2022
2024 /* on alloue la memoire */
2025 coo = (med_float *) malloc(sizeof(med_float)*nnoe*edim);
2026 EXIT_IF(coo == NULL,NULL,NULL);
2027 /* on va lire les coordonnees des noeuds */
2028 ret = MEDmeshNodeCoordinateRd(fid,nommaa,numdt,numit, MED_FULL_INTERLACE,coo);
2029
2030 EXIT_IF(ret < 0,"lors de la lecture des noeuds du maillage",NULL);
2031 /* on affiche le resultat */
2032 fprintf(stdout,"- Nom des coordonnees : \n");
2033 for (i=0;i<edim;i++) {
2034 strncpy(str,comp+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
2035 str[MED_SNAME_SIZE] = '\0';
2036 fprintf(stdout," %s ",str);
2037 }
2038 fprintf(stdout,"\n- Unites des coordonnees : \n");
2039 for (i=0;i<edim;i++) {
2040 strncpy(str,unit+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
2041 str[MED_SNAME_SIZE] = '\0';
2042 fprintf(stdout," %s ",str);
2043 }
2044 if (!structure) {
2045 fprintf(stdout,"\n - Coordonnees des noeuds : [ ");
2046 for (j=0;j<nnoe*edim;j++)
2047 fprintf(stdout," %f ",*(coo+j));
2048 fprintf(stdout," ] \n");
2049 }
2050
2051 /* on nettoie la memoire */
2052 free(coo);
2053 break;
2054
2056 default:
2057 EXIT_IF(-1,"Type de grille non reconnu.",nommaa);
2058
2059 }
2060
2061 /* lecture et affichage des :
2062 - numeros de familles des noeuds
2063 - noms des noeuds (optionnel)
2064 - numeros des noeuds (optionnel) */
2065
2066 /* on alloue la memoire */
2067 numnoe = (med_int *) malloc(sizeof(med_int)*nnoe);
2068 EXIT_IF(numnoe == NULL,NULL,NULL);
2069 nomnoe = (char*) malloc(MED_SNAME_SIZE*nnoe+1);
2070 EXIT_IF(nomnoe == NULL,NULL,NULL);
2071 nufano = (med_int *) malloc(sizeof(med_int)*nnoe);
2072 EXIT_IF(nufano == NULL,NULL,NULL);
2073
2074 /* on va lire les numeros de familles des noeuds */
2075 ret = MEDmeshEntityFamilyNumberRd(fid,nommaa,numdt,numit,MED_NODE,MED_NO_GEOTYPE,nufano);
2076 if (ret < 0) ret=0; else inufael=MED_TRUE;
2077
2078 EXIT_IF(ret < 0,"lors de la lecture des numeros de familles des noeuds",
2079 NULL);
2080 if (!structure) {
2081 /* on affiche le resultat */
2082 fprintf(stdout,"\n- Numeros des familles des noeuds : \n");
2083 for (i=0;i<nnoe;i++)
2084 if (inufael)
2085 fprintf(stdout," "IFORMAT" ",*(nufano+i));
2086 else
2087 fprintf(stdout," %d ",0);
2088 fprintf(stdout,"\n");
2089 }
2090
2091 /* on va lire et afficher les noms des noeuds */
2092 if (MEDmeshEntityNameRd(fid,nommaa,numdt,numit,MED_NODE,MED_NO_GEOTYPE,nomnoe) == 0) {
2093 if (!structure) {
2094 fprintf(stdout,"\n- Noms des noeuds : \n");
2095 for (i=0;i<nnoe;i++) {
2096 strncpy(str,nomnoe+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
2097 str[MED_SNAME_SIZE] = '\0';
2098 fprintf(stdout," %s ",str);
2099 }
2100 }
2101 }
2102
2103 /* on va lire et afficher les numeros des noeuds */
2104 if (MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,MED_NODE,MED_NO_GEOTYPE,numnoe) == 0) {
2105 if (!structure) {
2106 fprintf(stdout,"\n- Numeros des noeuds : \n");
2107 for (i=0;i<nnoe;i++)
2108 fprintf(stdout," "IFORMAT" ",*(numnoe+i));
2109 }
2110 }
2111
2112 /* on nettoie la memoire */
2113 free(nufano);
2114 free(numnoe);
2115 free(nomnoe);
2116
2117 return;
2118}
2119
2120
2122 const char * const nommaa,
2123 const med_int numdt,
2124 const med_int numit,
2125 const med_int mdim,
2126 const med_int nmai)
2127
2128{
2129 med_err ret = 0;
2130 med_int i;
2131 med_int *nufael = NULL;
2132 char *nomele = NULL;
2133 med_int *numele = NULL;
2134 char str[MED_SNAME_SIZE+1];
2135 /* type geometrique des elements */
2136 med_geometry_type typgeo;
2137
2138 fprintf(stdout,"\n(***************************)\n");
2139 fprintf(stdout,"(* ELEMENTS DE LA GRILLE : *)\n");
2140 fprintf(stdout,"(***************************)\n");
2141
2142 /* type des mailles */
2143 switch(mdim) {
2144 case 0 :
2145 typgeo = MED_POINT1;
2146 break;
2147 case 1 :
2148 typgeo = MED_SEG2;
2149 break;
2150 case 2 :
2151 typgeo = MED_QUAD4;
2152 break;
2153 default :
2154 typgeo = MED_HEXA8;
2155 }
2156
2157 /* On va lire et afficher :
2158 * - Les numeros de familles
2159 * - Les noms (optionnel)
2160 * - Les numeros (optionnel)
2161 */
2162
2163 /* on alloue la memoire */
2164 numele = (med_int *) malloc(sizeof(med_int)*nmai);
2165 EXIT_IF(numele == NULL,NULL,NULL);
2166 nomele = (char *) malloc(sizeof(char)*MED_SNAME_SIZE*nmai+1);
2167 EXIT_IF(nomele == NULL,NULL,NULL);
2168 nufael = (med_int *) malloc(sizeof(med_int)*nmai);
2169 EXIT_IF(nufael == NULL,NULL,NULL);
2170
2171 /* lecture des numeros de famille */
2172 ret = MEDmeshEntityFamilyNumberRd(fid,nommaa,numdt,numit,MED_CELL,typgeo,nufael);
2173 if (ret < 0)
2174 for (i=0;i<nmai;i++)
2175 *(nufael+i) = 0;
2176
2177 if (!structure) {
2178 /* on affiche le resultat */
2179 fprintf(stdout,"\n- Numeros des familles des mailles : \n");
2180 for (i=0;i<nmai;i++)
2181 fprintf(stdout," "IFORMAT" ",*(nufael+i));
2182 fprintf(stdout,"\n");
2183 }
2184
2185 /* on va lire et afficher les noms des mailles */
2186 if (MEDmeshEntityNameRd(fid,nommaa,numdt,numit,MED_CELL,typgeo,nomele) == 0) {
2187 if (!structure) {
2188 fprintf(stdout,"\n - Noms : \n");
2189 for (i=0;i<nmai;i++) {
2190 strncpy(str,nomele+i*MED_SNAME_SIZE,MED_SNAME_SIZE);
2191 str[MED_SNAME_SIZE] = '\0';
2192 fprintf(stdout," %s ",str);
2193 }
2194 }
2195 }
2196
2197 /* on va lire et afficher les numeros des mailles */
2198 if (MEDmeshEntityNumberRd(fid,nommaa,numdt,numit,MED_CELL,typgeo,numele) == 0) {
2199 if (!structure) {
2200 fprintf(stdout,"\n - Numeros :\n");
2201 for (i=0;i<nmai;i++)
2202 fprintf(stdout," "IFORMAT" ",*(numele+i));
2203 }
2204 }
2205
2206 /* on libere la memoire */
2207 free(nufael);
2208 free(nomele);
2209 free(numele);
2210
2211 return;
2212}
2213
2215 const char * const nommaa,
2216 const med_int numdt,
2217 const med_int numit,
2218 const med_int mdim,
2219 const med_int edim,
2220 const med_switch_mode mode_coo,
2221 const char * const comp,
2222 const char * const unit,
2223 const int lecture_en_tete_seulement)
2224{
2225 /* nombre de valeurs selon les axes du repere */
2226 med_int nind[3];
2227 med_int nnoe = 1;
2228 med_int nmai = 1;
2229 /* type de la grille */
2230 med_grid_type type;
2231 /* nombre de familles */
2232 med_int nfam;
2233 /* nombre d'equivalences */
2234 med_int nequ;
2235 /* nombre de joints */
2236 med_int njnt;
2237
2238 /* lecture selon la nature de la grille des caracteristiques
2239 du maillage :
2240 - nombre de noeuds
2241 - nombre de mailles
2242 */
2243 lecture_caracteristiques_grille(fid,nommaa,numdt,numit,mdim,nind,&nnoe,&nmai,&type);
2244
2245 /* nombre de familles */
2246 nfam = lecture_nombre_famille(fid,nommaa);
2247
2248 /* nombre d'equivalences */
2249 nequ = lecture_nombre_equivalence(fid,nommaa);
2250
2251 /* combien de joints */
2252 njnt = lecture_nombre_joint(fid,nommaa);
2253
2254 if (lecture_en_tete_seulement)
2255 return ;
2256
2257 /****************************************************************************
2258 * LECTURE DES NOEUDS *
2259 ****************************************************************************/
2260 lecture_noeuds_maillage_structure(fid,nommaa,numdt,numit,mdim,edim,nind,nnoe,comp,unit,type,mode_coo);
2261
2262 /****************************************************************************
2263 * LECTURE DES ELEMENTS *
2264 ****************************************************************************/
2265 lecture_mailles_maillage_structure(fid,nommaa,numdt,numit,mdim,nmai);
2266
2267 /****************************************************************************
2268 * LECTURE DES FAMILLES *
2269 ****************************************************************************/
2270 lecture_famille_maillage(fid,nommaa,nfam);
2271
2272 /****************************************************************************
2273 * LECTURE DES EQUIVALENCES *
2274 ****************************************************************************/
2275 lecture_equivalence_maillage(fid,nommaa,nequ);
2276
2277 /****************************************************************************
2278 * LECTURE DES JOINTS *
2279 ****************************************************************************/
2280 lecture_joint_maillage(fid,nommaa,njnt);
2281
2282 return ;
2283}
2284
2286 const char * const maillage,
2287 const med_int mnumdt,
2288 const med_int mnumit,
2289 const med_int nmodels,
2290 const med_geometry_type* const geotype_elst,
2291 const char* const geotypename_elst,
2292 const char * const nomcha,
2293 const char * const dtunit,
2294 const med_field_type typcha,
2295 const med_int ncomp,
2296 const char * const comp,
2297 const char * const unit,
2298 const med_entity_type entite,
2299 const med_switch_mode stockage,
2300 const med_int ncstp) {
2301
2302 int i,j,k,l,m,n,nb_geo=0;
2303 med_int nbpdtnor=0,pflsize,*pflval,ngauss=0,ngroup,nval;
2304 unsigned char *val = NULL;
2305 med_int numdt=0,numo=0,_nprofile;
2306 med_int meshnumdt=0,meshnumit=0;
2307 med_size medtype_size=0;
2308 med_float dt=0.0;
2309 med_err ret=0;
2310 char pflname [MED_NAME_SIZE+1]="";
2311 char locname [MED_NAME_SIZE+1]="";
2312 char meshname [MED_NAME_SIZE+1]="";
2313 char maa_ass [MED_NAME_SIZE+1]="";
2314 char * lien = NULL;
2315 med_bool localmesh;
2316 med_int nmesh=0;
2317 med_int lnsize=0;
2318 med_geometry_type * type_geo;
2319
2320 size_t _bannerlen=255;
2321 size_t _bannerlen1=0,_bannershift1=0;
2322 char _temp1[MAXBANNERLEN+1]="";
2323 char * _bannerstr1=NULL;
2324 size_t _bannerlen2=0,_bannershift2=0;
2325 char _temp2[MAXBANNERLEN+1]="";
2326 char * _bannerstr2=NULL;
2327
2328 const char * const * AFF;
2329 const char * const * AFF_ENT=MED23FIELD_GET_ENTITY_TYPENAME+1;
2330 const char * * AFF_STRUCT = NULL;
2331
2332 switch (entite) {
2333 case MED_NODE :
2335 nb_geo = MED_N_NODE_FIXED_GEO;
2337 break;
2338 case MED_CELL :
2339 case MED_NODE_ELEMENT :
2341 nb_geo = MED_N_CELL_FIXED_GEO;
2343 break;
2344 case MED_DESCENDING_FACE :
2346 nb_geo = MED_N_FACE_FIXED_GEO;
2348 break;
2349 case MED_DESCENDING_EDGE :
2351 nb_geo = MED_N_EDGE_FIXED_GEO;
2353 break;
2354 case MED_STRUCT_ELEMENT :
2355 AFF_STRUCT = (const char * *) calloc(sizeof(const char * ),nmodels+1);
2356 for(i=0;i<nmodels;++i) AFF_STRUCT[i+1]= &geotypename_elst[(MED_NAME_SIZE+1)*i];
2357 type_geo = (med_geometry_type*)(geotype_elst)-1;
2358 nb_geo = nmodels;
2359 AFF = AFF_STRUCT;
2360 break;
2361 }
2362
2363 /*On itère sur les types géométriques ds la boucle externe à cause de la compatibilité 23 :
2364 En V2.3.6 :
2365 /CHA/<fieldname>/<entitytype>[.<geotype>]/" ....<numdt> ...<numit>"/<meshname>/MED_NOM_CO
2366 {MED_NOM_TYP, {MED_NOM_NDT,MED_NOM_PDT, {MED_NOM_NBR,
2367 MED_NOM_NCO MED_NOM_NOR,MED_NOM_MAI MED_NOM_PFL,
2368 MED_NOM_NOM, MED_NOM_UNI} MED_NOM_GAU,
2369 MED_NOM_UNI} MED_NOM_NGA}
2370 V3.0 :
2371 /CHA/<fieldname>/" ....<numdt> ...<numit>"/<entitytype>[.<geotype>]/<pflname>/MED_NOM_CO
2372 {MED_NOM_TYP, {MED_NOM_PDT, {MED_NOM_PFL(2), {MED_NOM_NBR(1),
2373 MED_NOM_MAI, MED_NOM_NDT,MED_NOM_NOR, MED_NOM_GAUSS(2)} MED_NOM_GAU(2),
2374 MED_NOM_NCO, MED_NOM_RDT,MED_NOM_ROR} MED_NOM_NGA}
2375 MED_NOM_NOM,
2376 MED_NOM_UNI,
2377 MED_NOM_UNT}
2378
2379 */
2380 /*
2381 TODO : Versionner getFieldsOn en 3.0 pour rendre l'algorithme plus efficace en fonction de la version de fichier lu.
2382 */
2383
2384 for (k=1;k<=nb_geo;k++) {
2385
2386 /* Combien de (PDT,NOR) a lire */
2387 nbpdtnor = ncstp;
2388 if (nbpdtnor < 1 ) continue;
2389
2390 for (j=0;j<nbpdtnor;j++) {
2391
2392 if ( MEDfield23ComputingStepMeshInfo(fid, nomcha,j+1, &numdt, &numo, &dt,
2393 &nmesh, maa_ass, &localmesh, &meshnumdt, &meshnumit ) <0) {
2394 MESSAGE("Erreur a la demande d'information sur (pdt,nor) : ");
2395 ISCRUTE(numdt); ISCRUTE(numo);ISCRUTE(nmesh);SSCRUTE(meshname);ISCRUTE_int(localmesh);
2396 ISCRUTE(meshnumdt);ISCRUTE(meshnumit);
2397 ret = -1; continue;
2398 }
2399
2400 for (i=0;i< nmesh;++i) {
2401
2402 if ( (_nprofile = MEDfield23nProfile(fid,nomcha,numdt,numo,entite,type_geo[k],i+1,
2403 meshname,pflname,locname ) ) < 0 ) {
2404 MESSAGE("Erreur a la demande du nombre de profils referencés par le champ : ");
2405 SSCRUTE(nomcha); ISCRUTE(numdt); ISCRUTE(numo);SSCRUTE(meshname);
2406 ISCRUTE_int(entite);ISCRUTE_int(type_geo[k]);SSCRUTE(pflname);SSCRUTE(locname);
2407 SSCRUTE(AFF_ENT[(int)entite]);SSCRUTE(AFF[k]);
2408 ret = -1; continue;
2409 };
2410
2411 for (l=0;l<_nprofile;l++) {
2412
2413 if ( (nval = MEDfield23nValueWithProfile(fid, nomcha, numdt, numo, entite, type_geo[k],meshname,
2414 l+1, USER_MODE, pflname,&pflsize,
2415 locname, &ngauss) ) < 0 ) {
2416 MESSAGE("Erreur a la lecture du nombre de valeurs du champ : ");
2417 SSCRUTE(nomcha);ISCRUTE(numdt);ISCRUTE(numo);SSCRUTE(meshname);
2418 ISCRUTE_int(entite);ISCRUTE_int(type_geo[k]);
2420 ret = -1; continue;
2421 };
2422
2423 /* Affiche uniquement les informations du champ pour le maillage demandé <maillage,numit,nmumdt>
2424 Si le maillage demandé n'est pas précisé maillage == "", affiche les informations du champ
2425 pour tous les maillages */
2426 if ( ( (!strcmp(meshname,maillage)) && (meshnumdt == mnumdt) && (meshnumit == mnumit)) ||
2427 ( !strlen(maillage) )
2428 ) {
2429
2430 /*4 caractères spéciaux*/
2431 _bannerstr1 = "(* CHAMP |%s| A L'ÉTAPE DE CALCUL (n°dt,n°it)="
2432 "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT") , %.*s*)\n";
2433 /*4 caractères spéciaux */
2434 _bannerstr2 = "(* SUR LE MAILLAGE |%s| A L'ÉTAPE DE CALCUL (n°dt,n°it)="
2435 "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT") : %.*s*)\n";
2436 snprintf(_temp1,MAXBANNERLEN+1,_bannerstr1,nomcha,numdt,numo,0,"");
2437 snprintf(_temp2,MAXBANNERLEN+1,_bannerstr2,meshname,meshnumdt,meshnumit,0,"");
2438 _bannerlen1 = strlen(_temp1);
2439 _bannerlen2 = strlen(_temp2);
2440 _bannerlen=MAX(_bannerlen1,_bannerlen2);
2441 if (_bannerlen1>_bannerlen2) {
2442 _bannershift1 = 0; _bannershift2 = _bannerlen1-_bannerlen2;
2443 } else {
2444 _bannershift2 = 0; _bannershift1 = _bannerlen2-_bannerlen1;
2445 }
2446 fprintf(stdout,"\n(");
2447 for (i=0;i< _bannerlen-6; i++) fprintf(stdout,"*");
2448 fprintf(stdout,")\n");
2449 fprintf(stdout,_bannerstr1,nomcha,numdt,numo,_bannershift1,MED_NAME_BLANK);
2450 fprintf(stdout,_bannerstr2,meshname,meshnumdt,meshnumit,_bannershift2,MED_NAME_BLANK);
2451 fprintf(stdout,"(");
2452 for (i=0;i< _bannerlen-6; i++) fprintf(stdout,"*");
2453 fprintf(stdout,")\n");
2454
2455
2456
2457/* fprintf(stdout,"\n(********************************************************************************)\n"); */
2458/* fprintf(stdout,"(* CHAMP |%s| A L'ÉTAPE DE CALCUL (n°dt,n°it)=" */
2459/* "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT") : *)\n", */
2460/* nomcha,numdt,numo); */
2461/* fprintf(stdout,"(* SUR LE MAILLAGE |%s| A L'ÉTAPE DE CALCUL (n°dt,n°it)=" */
2462/* "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT") : *)\n", */
2463/* meshname,meshnumdt,meshnumit); */
2464/* fprintf(stdout,"(********************************************************************************)\n\n"); */
2465 fprintf(stdout,"- Valeur de la date du champ %f [%s] : \n",dt,dtunit);
2466 fprintf(stdout,"- Type des composantes du champ : %d\n",typcha);
2467 fprintf(stdout,"- Nombre de composantes par valeur : "IFORMAT"\n",ncomp);
2468 fprintf(stdout,"- Unité des composantes : |%s|\n",unit);
2469 fprintf(stdout,"- Nom des composantes : |%s|\n",comp);
2470
2471 printf("\t- Il y a "IFORMAT" entités qui portent des valeurs en mode %i."
2472 "\n\t Chaque entite %s de type geometrique %s associes au profil |%s| a "IFORMAT" point(s) d'intégration \n",
2473 nval,USER_MODE,AFF_ENT[(int)entite],AFF[k],pflname,ngauss);
2474
2475 /* Le maillage reference est-il porte par un autre fichier */
2476 if ( !localmesh ) {
2477
2478 if ( (lnsize=MEDlinkInfoByName(fid,maa_ass) ) < 0 ) {
2479 MESSAGE("Erreur a la lecture de la taille du lien : ");
2480 SSCRUTE(maa_ass);
2481 ret = -1;
2482 } else {
2483 lien = (char *)malloc(lnsize*sizeof(char) + 1);
2484 EXIT_IF(lien == NULL,NULL,NULL);
2485
2486 if ( MEDlinkRd(fid, maa_ass, lien) < 0 ) {
2487 MESSAGE("Erreur a la lecture du lien : ");
2488 SSCRUTE(maa_ass);SSCRUTE(lien);
2489 ret = -1;
2490 } else {
2491 lien[lnsize] = '\0';
2492 printf("\tLe maillage |%s| est porte par un fichier distant |%s|\n",maa_ass,lien);
2493 }
2494 free(lien);
2495 }
2496 }
2497
2498 /*Lecture des valeurs du champ */
2499 switch(typcha) {
2500 case MED_FLOAT64: medtype_size=sizeof(med_float64); break;
2501 case MED_FLOAT32: medtype_size=sizeof(med_float32); break;
2502 case MED_INT32 : medtype_size=sizeof(med_int32 ); break;
2503 case MED_INT64 : medtype_size=sizeof(med_int64 ); break;
2504 case MED_INT : medtype_size=sizeof(med_int) ; break;
2505 default:
2506 MESSAGE("Erreur a la lecture du type de champ : ");
2507 ISCRUTE_int(typcha);
2508 EXIT_IF(NULL == NULL,NULL,NULL);
2509 }
2510
2511 val = (unsigned char*) calloc(ncomp*nval*ngauss,medtype_size);
2512 EXIT_IF(val == NULL,NULL,NULL);
2513
2514
2515 if (MEDfield23ValueWithProfileRd(fid, nomcha, numdt,numo, entite,type_geo[k],meshname,
2516 USER_MODE, pflname, stockage,MED_ALL_CONSTITUENT,
2517 (unsigned char*) val) < 0 ) {
2518 MESSAGE("Erreur a la lecture des valeurs du champ : ");
2519 SSCRUTE(nomcha);ISCRUTE_int(entite);ISCRUTE_int(type_geo[k]);
2520 ISCRUTE(numdt);ISCRUTE(numo);
2521 ret = -1;
2522 }
2523
2524 if ( strlen(locname) && (_nprofile > 1) )
2525 printf("\t- Modèle de localisation des points de Gauss de nom |%s|\n",locname);
2526
2527 if (entite == MED_NODE_ELEMENT)
2528 ngroup = (type_geo[k] % 100);
2529 else
2530 ngroup = ngauss;
2531
2532 switch (stockage) {
2533
2534 case MED_FULL_INTERLACE :
2535 if (!structure) {
2536 printf("\t- Valeurs :\n\t");
2537 for (m=0;m<(nval*ngauss)/ngroup;m++) {
2538 printf("|");
2539 for (n=0;n<ngroup*ncomp;n++)
2540 switch(typcha) {
2541 case MED_FLOAT64:
2542 printf(" %f ",*(((med_double*)val)+(m*ngroup*ncomp)+n ) );
2543 /* printf(" %f ", ((med_double*)val)[(m*ngroup*ncomp)+n] ); */
2544 /* printf(" %f ", *( val+medtype_size*((m*ngroup*ncomp)+n)) ); */
2545 break;
2546 case MED_FLOAT32:
2547 printf(" %f ",*(((med_float32*)val)+((m*ngroup*ncomp)+n)));
2548 break;
2549 case MED_INT32 :
2550 printf(" %d ",*(((med_int32*)val)+(m*ngroup*ncomp)+n));
2551 break;
2552 case MED_INT64 :
2553 printf(" %ld ",*(((med_int64*)val)+(m*ngroup*ncomp)+n));
2554 break;
2555 case MED_INT :
2556 printf(" "IFORMAT" ",*(((med_int*)val)+(m*ngroup*ncomp)+n));
2557 break;
2558 default:
2559 break;
2560 }
2561 }
2562 }
2563 break;
2564
2565
2566 /*??? Affichage en fonction du profil à traiter ???*/
2567 case MED_NO_INTERLACE :
2568 if (!structure) {
2569 printf("\t- Valeurs :\n\t");
2570 for (m=0;m<ncomp;m++) {
2571 printf("|");
2572 for (n=0;n<(nval*ngauss);n++)
2573 switch(typcha) {
2574 case MED_FLOAT64:
2575 printf(" %f ",*(((med_double*)val)+(m*nval*ngauss)+n ) );
2576 /* printf(" %f ", ((med_double*)val)[(m*nval)+n] ); */
2577 /* printf(" %f ", *( val+medtype_size*((m*nval)+n)) ); */
2578 break;
2579 case MED_FLOAT32:
2580 printf(" %f ",*(((med_float32*)val)+((m*nval*ngauss)+n)));
2581 break;
2582 case MED_INT32 :
2583 printf(" %d ",*(((med_int32*)val)+(m*nval*ngauss)+n));
2584 break;
2585 case MED_INT64 :
2586 printf(" %ld ",*(((med_int64*)val)+(m*nval*ngauss)+n));
2587 break;
2588 case MED_INT :
2589 printf(" "IFORMAT" ",*(((med_int*)val)+(m*nval*ngauss)+n));
2590 break;
2591 default:
2592 break;
2593 }
2594 }
2595 }
2596 break;
2597 }
2598
2599 if (!structure) {
2600 printf("|\n");
2601 }
2602
2603 if ( val ) {free(val);val = NULL;}
2604
2605 /*Lecture du profil associe */
2606 if (strcmp(pflname,MED_NO_PROFILE) == 0 ) {
2607 printf("\t- Profil : MED_NOPFL\n");
2608 } else {
2609 if ( (pflsize = MEDprofileSizeByName(fid,pflname)) <0 ) {
2610 MESSAGE("Erreur a la lecture du nombre de valeurs du profil : ");
2611 SSCRUTE(pflname);
2612 ret = -1; continue;
2613 }
2614
2615 printf("\t- Profil : |%s| de taille "IFORMAT"\n",pflname,pflsize);
2616
2617 pflval = (med_int*) malloc(sizeof(med_int)*pflsize);
2618 EXIT_IF(pflval == NULL,NULL,NULL);
2619 if ( MEDprofileRd(fid,pflname,pflval) <0) {
2620 MESSAGE("Erreur a la lecture des valeurs du profil : ");
2621 SSCRUTE(pflname);
2622 ret = -1;
2623 }
2624 if (!structure) {
2625 printf("\t");
2626 for (m=0;m<pflsize;m++) printf(" "IFORMAT" ",*(pflval+m));
2627 printf("\n");
2628 }
2629 free(pflval);
2630 }
2631 }
2632 }
2633 }
2634 }
2635 } /* fin for sur les mailles*/
2636
2637 free(AFF_STRUCT);
2638 return ret;
2639}
2640
2641/******************************************************************************
2642 *
2643 * - Nom de la fonction : lecture_resultats
2644 * - Description : lecture et affichage des champs de resultats
2645 * associe a un maillage MED.
2646 * - Parametres :
2647 * - fid (IN) : ID du fichier MED.
2648 * - maillage (IN) : nom du maillage maillage.
2649 * - mode_coo (IN) : mode de stockage en memoire :
2650 * MED_FULL_INTERLACE |
2651 * MED_NO_INTERLACE.
2652 * - lecture_en_tete_seulement (IN) : mode de lecture.
2653 ******************************************************************************/
2654
2656 const char * const maillage,
2657 const med_int mnumdt,
2658 const med_int mnumit,
2659 const med_switch_mode mode_coo,
2660 const med_int nmodels,
2661 const med_geometry_type* geotype_elst,
2662 const char* geotypename_elst,
2663 const int lecture_en_tete_seulement)
2664{
2665 med_err ret,lret;
2666 char *comp, *unit;
2667 char nomcha [MED_NAME_SIZE+1]="";
2668 med_int ncomp,ncha;
2669 med_field_type typcha;
2670 int i;
2671
2672 char nommaa[MED_NAME_SIZE+1]="";
2673 med_bool localmaa = MED_FALSE;
2674 char dtunit[MED_SNAME_SIZE+1]="";
2675 med_int ncstp=0;
2676
2677
2678 /* combien de champs dans le fichier */
2679 ncha = MEDnField(fid);
2680 EXIT_IF(ncha < 0,"lors de la lecture du nombre de champs",NULL);
2681
2682 if ( !strlen(maillage) || lecture_en_tete_seulement ) {
2683 fprintf(stdout,"\n(************************)\n");
2684 fprintf(stdout,"(* CHAMPS RESULTATS : *)\n");
2685 fprintf(stdout,"(************************)\n");
2686 fprintf(stdout,"- Nombre de champs : "IFORMAT" \n",ncha);
2687 }
2688
2689 /****************************************************************************
2690 * LECTURE DES CHAMPS *
2691 ****************************************************************************/
2692 ret = 0;
2693
2694 /* lecture de tous les champs pour le maillage selectionne */
2695 for (i =0;i<ncha;i++) {
2696 lret = 0;
2697
2698 /* Lecture du nombre de composantes */
2699 if ((ncomp = MEDfieldnComponent(fid,i+1)) < 0) {
2700 MESSAGE("Erreur à la lecture du nombre de composantes : ");
2701 ISCRUTE(ncomp);
2702 ret = -1; continue;
2703 }
2704
2705 /* Lecture du type du champ, des noms des composantes et du nom de
2706 l'unité*/
2707 comp = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
2708 EXIT_IF(comp == NULL,NULL,NULL);
2709 unit = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
2710 EXIT_IF(unit == NULL,NULL,NULL);
2711
2712 if ( MEDfieldInfo(fid, i+1, nomcha, nommaa, &localmaa,
2713 &typcha, comp, unit, dtunit, &ncstp) < 0 ) {
2714 MESSAGE("Erreur à la demande d'information sur les champs : ");
2715 ret = -1; continue;
2716 }
2717
2718
2719 if ( !strlen(maillage) || lecture_en_tete_seulement ) {
2720 printf("\nChamp numero : |%d| \n",i+1);
2721 printf("Nom du champ : |%s| de type |%d|\n",nomcha,typcha);
2722 printf("Nom des composantes : |%s|\n",comp);
2723 printf("Unites des composantes : |%s| \n",unit);
2724 if (strlen(dtunit))
2725 printf("Unité des dates : |%s|\n",dtunit);
2726 if ( ncstp > 1 )
2727 printf("Nombre d'étapes de calcul : |"IFORMAT"| \n",ncstp);
2728 }
2729
2730
2731 if (lecture_en_tete_seulement) {
2732 free(comp);
2733 free(unit);
2734 continue;
2735 }
2736
2737 /* champs aux noeuds */
2738 lret = getFieldsOn(fid, maillage, mnumdt, mnumit, nmodels,geotype_elst,geotypename_elst,
2739 nomcha, dtunit, typcha, ncomp, comp, unit, MED_NODE,mode_coo, ncstp);
2740
2741 /* champs sur les elements et aux points de Gauss */
2742 if (lret == 0) lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels,geotype_elst,geotypename_elst,
2743 nomcha, dtunit, typcha, ncomp, comp, unit, MED_CELL,mode_coo, ncstp);
2744 else { MESSAGE("Erreur à la lecture des champs aux noeuds "); ret = -1; continue;}
2745
2746 if (lret == 0) lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels,geotype_elst,geotypename_elst,
2747 nomcha, dtunit, typcha, ncomp, comp, unit, MED_DESCENDING_FACE,mode_coo, ncstp);
2748 else { MESSAGE("Erreur à la lecture des champs aux mailles "); ret = -1; continue;}
2749
2750 if (lret == 0) lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels,geotype_elst,geotypename_elst,
2751 nomcha, dtunit, typcha, ncomp, comp, unit, MED_DESCENDING_EDGE,mode_coo, ncstp);
2752 else {MESSAGE("Erreur à la lecture des champs aux faces "); ret = -1; continue;}
2753
2754 if (lret == 0) lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels,geotype_elst,geotypename_elst,
2755 nomcha, dtunit, typcha, ncomp, comp, unit, MED_NODE_ELEMENT,mode_coo, ncstp);
2756 else {MESSAGE("Erreur a la lecture des champs aux aretes "); ret = -1; continue;}
2757
2758 if (lret != 0) {MESSAGE("Erreur a la lecture des champs aux noeuds des mailles "); ret = -1;};
2759
2760 if (nmodels)
2761 lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels, geotype_elst,geotypename_elst,
2762 nomcha, dtunit, typcha, ncomp, comp, unit, MED_STRUCT_ELEMENT,mode_coo, ncstp);
2763 if (lret != 0) {MESSAGE("Erreur a la lecture des champs aux éléments de sructure "); ret = -1;};
2764
2765 free(comp);
2766 free(unit);
2767
2768 }
2769
2770 return;
2771}
2772
2773/******************************************************************************
2774 *
2775 * - Nom de la fonction : lecture_parametres_scalaires
2776 * - Description : lecture des parametres scalaires definis
2777 * hors champs et maillages.
2778 * - Parametres :
2779 * - fid (IN) : ID du fichier MED.
2780 * - lecture_en_tete_seule (IN) : mode de lecture.
2781 *
2782 ******************************************************************************/
2783
2785 int lecture_en_tete_seulement)
2786{
2787 med_err ret = 0;
2788 char nom_scalaire[MED_NAME_SIZE+1];
2789 char description[MED_COMMENT_SIZE+1];
2790 med_int vali;
2791 med_float valr;
2792 med_int i,n,npdt,j;
2793 med_parameter_type type;
2794 med_int numdt,numo;
2795 med_float dt;
2796 char dt_unit[MED_SNAME_SIZE+1];
2797
2798
2799 /* Combien de variables scalaire ? */
2800 n = MEDnParameter(fid);
2801 EXIT_IF(n < 0,"lors de la lecture du nombre de scalaires",NULL);
2802
2803 if (n) {
2804 fprintf(stdout,"\n(*******************************)\n");
2805 fprintf(stdout,"(* VARIABLES SCALAIRES : *)\n");
2806 fprintf(stdout,"(*******************************)\n\n");
2807 fprintf(stdout,"- Nombre de variables scalaires : "IFORMAT"\n",n);
2808 }
2809 if (lecture_en_tete_seulement)
2810 return ;
2811
2812 for (i=1;i<=n;i++) {
2813
2814 /* Lecture des infos (type,description) */
2815 ret = MEDparameterInfo( fid,i,nom_scalaire,&type,description,
2816 dt_unit, &npdt );
2817 EXIT_IF(ret < 0,"lors de la lecture des parametres d'un scalaire",NULL);
2818 fprintf(stdout,"- Scalaire n°"IFORMAT" de nom %s \n",i,nom_scalaire);
2819 if (type == MED_FLOAT64)
2820 fprintf(stdout," Type flottant. \n");
2821 else
2822 fprintf(stdout," Type entier. \n");
2823 printf(" Description associee : [%s] \n",description);
2824
2825 /* Pour chaque scalaire on regarde les valeurs associees
2826 eventuellement a des pas de temps et des numeros d'ordre */
2827 EXIT_IF(npdt < 0,
2828 "lors de la lecture du nombre de pas de temps d'un scalaire"
2829 ,NULL);
2830 fprintf(stdout," Nombre de valeurs stockees : "IFORMAT" \n",npdt);
2831
2832 for (j=1;j<=npdt;j++) {
2833
2834 ret = MEDparameterComputationStepInfo(fid,nom_scalaire,j, &numdt,&numo,&dt);
2835 EXIT_IF(ret < 0,
2836 "lors de la lecture des parametres d'un pas de temps d'un scalaire",
2837 NULL);
2838
2839 if (numdt == MED_NO_DT)
2840 fprintf(stdout," - Aucun de pas de temps \n");
2841 else
2842 fprintf(stdout,
2843 " - Pas de de temps de numero "IFORMAT" de valeur %f [%s] \n",numdt,
2844 dt,dt_unit);
2845 if (numo == MED_NO_IT)
2846 fprintf(stdout," - Aucun numero d'ordre \n");
2847 else
2848 fprintf(stdout," - Numero d'ordre : "IFORMAT" \n",numo);
2849
2850 if (type == MED_FLOAT64) {
2851 ret = MEDparameterValueRd(fid,nom_scalaire,numdt,numo,(unsigned char * ) &valr);
2852 fprintf(stdout," - Valeur : %f \n",valr);
2853 }
2854 else {
2855 ret = MEDparameterValueRd(fid,nom_scalaire,numdt,numo,(unsigned char * ) &vali);
2856 fprintf(stdout," - Valeur : "IFORMAT" \n",vali);
2857 }
2858 EXIT_IF(ret < 0,"lors de la lecture de la valeur d'un scalaire",NULL);
2859
2860 }
2861 }
2862
2863 return ;
2864}
2865
2866/******************************************************************************
2867 *
2868 * - Nom de la fonction : lecture_profils
2869 * - Description : lecture des différents profils
2870 * hors champs et maillages.
2871 * - Parametres :
2872 * - fid (IN) : ID du fichier MED.
2873 * - lecture_en_tete_seule (IN) : mode de lecture.
2874 *
2875 ******************************************************************************/
2876
2878 int lecture_en_tete_seulement)
2879{
2880 med_err ret;
2881 char pflname[MED_NAME_SIZE+1]="";
2882 med_int npro,*pflval,nval;
2883 int i,j;
2884
2885
2886 /* Interrogation des profils */
2887 npro = MEDnProfile(fid);
2888 EXIT_IF(npro < 0,"lors de la lecture du nombre de profils",NULL);
2889
2890 if (npro) {
2891 fprintf(stdout,"\n(*************)\n");
2892 fprintf(stdout, "(* PROFILS : *)\n");
2893 fprintf(stdout, "(*************)\n");
2894 printf("\nNombre de profils stockes : "IFORMAT"\n\n",npro);
2895 }
2896
2897 for (i=1 ; i <= npro ; i++ ) {
2898 if ( MEDprofileInfo(fid, i, pflname, &nval) < 0) {
2899 MESSAGE("Erreur a la demande d'information sur le profil n° : "); ISCRUTE_int(i);
2900 ret = -1;continue;
2901 }
2902 printf("\t- Profil n°%i de nom |%s| et de taille "IFORMAT"\n",i,pflname,nval);
2903 pflval = (med_int*) malloc(sizeof(med_int)*nval);
2904 if ( MEDprofileRd(fid, pflname, pflval) < 0) {
2905 MESSAGE("Erreur a la lecture des valeurs du profil : ");
2906 SSCRUTE(pflname);
2907 ret = -1;
2908 } else {
2909 if (!structure) {
2910 printf("\t");
2911 for (j=0;j<nval;j++) printf(" "IFORMAT" ",*(pflval+j));
2912 }
2913 printf("\n\n");
2914 }
2915 free(pflval);
2916 }
2917 return;
2918}
2919
2920/******************************************************************************
2921 *
2922 * - Nom de la fonction : lecture_modeles_elstruct
2923 * - Description : lecture des différents modèles d'éléments de structure
2924 * hors champs et maillages.
2925 * - Parametres :
2926 * - fid (IN) : ID du fichier MED.
2927 * - lecture_en_tete_seule (IN) : mode de lecture.
2928 *
2929 ******************************************************************************/
2930
2932 int lecture_en_tete_seulement)
2933{
2934 med_err _ret=0;
2935 int _i =0,_j=0,_k=0, _n=0,_nvalue=0;
2936 med_int _nstructelement=0;
2937
2938 med_geometry_type _geotype=MED_NONE;
2939
2940 char _elementname[MED_NAME_SIZE+1]="";
2941 med_int _elementdim=0;
2942 char _supportmeshname[MED_NAME_SIZE+1]="";
2944 med_int _nnode=0;
2945 med_int _ncell=0;
2946 med_geometry_type _geocelltype=MED_NONE;
2947 char _geocelltypename[MED_SNAME_SIZE+1]="";
2948 med_int _nconstantattribute=0;
2949 med_bool _anyprofile=MED_FALSE;
2950 med_int _nvariableattribute=0;
2951
2952 char _constattname[MED_NAME_SIZE+1]="";
2953 med_attribute_type _constatttype=MED_ATT_UNDEF;
2954 char _varattname[MED_NAME_SIZE+1]="";
2956 med_int _ncomponent=0;
2958 char _profilename[MED_NAME_SIZE+1]="";
2959 med_int _profilesize=0;
2960
2961 unsigned char * _value=NULL;
2962 void (*_printf)(const void*);
2963 med_int _atttypesize=0;
2964
2965 _nstructelement = MEDnStructElement(fid);
2966 EXIT_IF(_nstructelement < 0,"lors de la lecture du nombre d'éléments de structure",NULL);
2967
2968 if(_nstructelement) {
2969 fprintf(stdout,"\n(*************************************)\n");
2970 fprintf(stdout, "(* MODELES D'ELEMENTS DE STRUCTURE : *)\n");
2971 fprintf(stdout, "(*************************************)\n");
2972 printf("\nNombre d'éléments de structure : "IFORMAT"\n\n",_nstructelement);
2973 }
2974
2975 for ( _i=1; _i<= _nstructelement; ++_i) {
2976
2977 _ret= MEDstructElementInfo(fid,_i,_elementname,&_geotype,&_elementdim,_supportmeshname,
2978 &_entitytype,&_nnode,&_ncell,&_geocelltype,&_nconstantattribute,&_anyprofile,
2979 &_nvariableattribute );
2980 EXIT_IF(_ret < 0,"lors de la demande d'information sur les éléments de structure",NULL);
2981
2982 fprintf(stdout,"\nElément de structure n°%d |%s| de type géométrique n°%d et de dimension "IFORMAT"\n",
2983 _i,_elementname,_geotype,_elementdim);
2984 if ( strlen(_supportmeshname) ) {
2985 fprintf(stdout,"\t Maillage support de nom |%s|",_supportmeshname);
2986 if (_ncell) {
2987 MEDmeshGeotypeName(fid,_geocelltype,_geocelltypename);
2988 fprintf(stdout," avec "IFORMAT" maille(s) de type |%s| et",_ncell,_geocelltypename);
2989 }
2990 if (_nnode)
2991 fprintf(stdout," avec "IFORMAT" noeud(s)\n",_nnode);
2992 else {
2993 fprintf(stderr,"\n Erreur : les noeuds doivent être définis s'il existe un maillage support\n");
2994 }
2995 } else
2996 fprintf(stdout,"\t Maillage support implicite sur noeud\n");
2997
2998 fprintf(stdout,"\t Nombre d'attribut(s) constant(s) : "IFORMAT"",_nconstantattribute);
2999 if (_anyprofile) fprintf(stdout,", avec profil.\n"); else fprintf(stdout,", sans profil.\n");
3000
3001 if ( _nconstantattribute ) {
3002 for (_j=1;_j<=_nconstantattribute;++_j) {
3003 _ret= MEDstructElementConstAttInfo(fid, _elementname,_j,
3004 _constattname, &_constatttype, &_ncomponent,
3005 &_attentitytype, _profilename, &_profilesize );
3006 EXIT_IF(_ret < 0,"lors de la demande d'information sur les attributs constants des éléments de structure",NULL);
3007
3008 fprintf(stdout,"\t\t Attribut constant de nom |%s| de type %d à "IFORMAT" composantes\n",
3009 _constattname,_constatttype,_ncomponent);
3010
3011 if (!_profilesize) {
3012 if (_attentitytype == MED_NODE) _nvalue = _nnode; else _nvalue=_ncell;
3013 } else {
3014 _nvalue = _profilesize;
3015 }
3016 _n = _ncomponent*_nvalue;
3017 if ( _constatttype == MED_ATT_NAME) ++_n;
3018 _atttypesize = MEDstructElementAttSizeof(_constatttype);
3019 _value = (unsigned char *) malloc(_n*_atttypesize);
3020 if ( _constatttype == MED_ATT_NAME) --_n;
3021
3022 _ret= MEDstructElementConstAttRd(fid, _elementname,_constattname, _value );
3023 if (_ret < 0 ) free(_value);
3024 EXIT_IF(_ret < 0,"lors de la lecture des valeurs des attributs constants",NULL);
3025 _printf=MEDstructPrintFunction(_constatttype);
3026
3027 if (!structure) {
3028 fprintf(stdout,"\t\t - Valeurs de l'attribut sur les d'entité |%s|",
3029 MED23MESH_GET_ENTITY_TYPENAME[_attentitytype+1]);
3030 if ( _profilesize)
3031 fprintf(stdout," avec un profil |%s| de taille "IFORMAT": ",_profilename,_profilesize);
3032 else
3033 fprintf(stdout," sans profil : ");
3034
3035 for (_k=0;_k<_nvalue*_ncomponent;_k++) {
3036/* if ( ( _ncomponent > 1 ) && !(_k % _ncomponent) ) */
3037 if ( !(_k % _ncomponent) )
3038 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (_k/_ncomponent +1) );
3039 _printf( (void *)( (char *)(_value) + _k*_atttypesize) );
3040 }
3041 printf("\n");
3042 }
3043 /* free memory */
3044 free(_value);
3045 printf("\n");
3046 } /*fin boucle sur constatt*/
3047 } /*fin if _nconstantattribute */
3048
3049 fprintf(stdout,"\t Nombre d'attribut(s) variable(s) : "IFORMAT"\n",_nvariableattribute);
3050 if ( _nvariableattribute ) {
3051 for (_j=1;_j<=_nvariableattribute;++_j) {
3052 _ret = MEDstructElementVarAttInfo(fid, _elementname,_j,_varattname,&_varatttype,&_ncomponent );
3053 EXIT_IF(_ret < 0,"lors de la lecture des valeurs des attributs variables",NULL);
3054 fprintf(stdout,"\t\t Attribut variable de nom |%s| de type %d à "IFORMAT" composantes\n",
3055 _varattname,_varatttype,_ncomponent);
3056 }
3057 }
3058
3059 }
3060
3061 return;
3062}
3063
3064/******************************************************************************
3065 *
3066 * - Nom de la fonction : lecture_fonctions_interpolation
3067 * - Description : lecture des différentes fonctions d'interpolation
3068 * hors champs et maillages.
3069 * - Parametres :
3070 * - fid (IN) : ID du fichier MED.
3071 * - lecture_en_tete_seule (IN) : mode de lecture.
3072 *
3073 ******************************************************************************/
3074
3076 int lecture_en_tete_seulement)
3077{
3078
3079 med_err _ret=-1;
3080 med_int _ninterp=0;
3081 int _interpit =0;
3082 char _interpname[MED_NAME_SIZE+1]="";
3083 med_geometry_type _geotype =MED_NONE;
3084 char _geotypename[MED_SNAME_SIZE+1]="";
3085 med_int _geodim=0,_geonnodes=0;
3086 med_bool _cellnodes =MED_FALSE;
3087 med_int _nbasisfunc =0;
3088 med_int _nvariable =0;
3089 med_int _maxdegree =0;
3090 med_int _nmaxcoefficient =0;
3091 int _basisfuncit =0;
3092 int _powerit =0;
3093 med_int _ncoefficient =0;
3094 med_int* _power =NULL;
3095 med_float* _coefficient =NULL;
3096 int _coefficientit =0;
3097
3098
3099 _ninterp = MEDnInterp(fid);
3100 if (_ninterp) {
3101 fprintf(stdout,"\n(********************************)\n");
3102 fprintf(stdout, "(* FONCTIONS D'INTERPOLATION : *)\n");
3103 fprintf(stdout, "(********************************)\n");
3104 printf("\nNombre de fonctions d'interpolation : "IFORMAT"\n\n",_ninterp);
3105 }
3106
3107 for ( _interpit=1; _interpit<= _ninterp; ++_interpit) {
3108
3109 if (MEDinterpInfo(fid,_interpit,_interpname,&_geotype,&_cellnodes,&_nbasisfunc,
3110 &_nvariable,&_maxdegree,&_nmaxcoefficient) < 0 ) {
3111 MESSAGE("Erreur à la demande d'information de la fonction d'interpolation n°");
3112 ISCRUTE_int(_interpit);
3113 _ret = -1;continue;
3114 }
3115
3116 MEDmeshGeotypeName(fid,_geotype,_geotypename);
3117 fprintf(stdout,"Fonction d'interpolation n° %d |%s| sur le type géométrique |%s|\n",
3118 _interpit,_interpname, _geotypename);
3119
3120 if ( MEDmeshGeotypeParameter(fid,_geotype,&_geodim,&_geonnodes) <0 ) {
3121 MESSAGE("Erreur à la lecture du nom associé au typegeo : "); ISCRUTE_int(_geotype);
3122 _ret = -1;continue;
3123 }
3124
3125 if ( _cellnodes ) {
3126 if ( _nbasisfunc == _geonnodes )
3127 fprintf(stdout,"\t Les noeuds de construction sont les noeuds de la maille de référence.\n");
3128 else {
3129 MESSAGE("Erreur : le nombre de noeuds de construction "\
3130 "est différent du nombre de noeuds de la maille de référence.\n");
3131 ISCRUTE(_nbasisfunc); ISCRUTE(_geonnodes);
3132 _ret = -1;continue;
3133 }
3134 }
3135
3136/* if ( _nvariable != _geodim ) { */
3137/* MESSAGE("Erreur : le nombre de variables "\ */
3138/* "est différent de la dimension de l'espace de la maille de référence.\n"); */
3139/* ISCRUTE(_nvariable); ISCRUTE (_geodim); */
3140/* _ret = -1;continue; */
3141/* } else */
3142 fprintf(stdout,"\t Il y a "IFORMAT" fonctions de base avec "IFORMAT" variables\n ",_nbasisfunc,_nvariable);
3143 fprintf(stdout,"\t Le degré maximum des fonctions de base est "IFORMAT" et possèdent au maximum "IFORMAT" coefficients\n"
3144 ,_maxdegree,_nmaxcoefficient);
3145
3146
3147 _coefficient = (med_float*) calloc(sizeof(med_float),_nmaxcoefficient);
3148 _power = (med_int*) calloc(sizeof(med_int),_nvariable*_nmaxcoefficient);
3149
3150 for ( _basisfuncit=1; _basisfuncit<= _nbasisfunc; ++_basisfuncit) {
3151
3152
3153 if ( (_ret = MEDinterpBaseFunctionRd( fid,_interpname,_basisfuncit,&_ncoefficient,_power,_coefficient) <0) ) {
3154 MESSAGE("Erreur à la lecture de la fonction de base n°");ISCRUTE_int(_basisfuncit);
3155 _ret=-1;continue;
3156 } else {
3157 if (!structure) {
3158
3159 fprintf(stdout,"\n\t Tableau de coefficients de la fonctions de base n° %d :\n\t",_basisfuncit);
3160 for ( _coefficientit=1; _coefficientit<= _ncoefficient; ++_coefficientit)
3161 fprintf(stdout," %4f ",_coefficient[_coefficientit]);
3162
3163 fprintf(stdout,"\n\t Tableau de puissances de la fonctions de base n° %d :\n\t",_basisfuncit);
3164 for ( _powerit=1; _powerit<= _nvariable*_ncoefficient; ++_powerit)
3165 fprintf(stdout," %4"MED_IFORMAT" ",_power[_powerit]);
3166 }
3167 }
3168 }
3169 fprintf(stdout,"\n");
3170 free(_coefficient);
3171 free(_power);
3172
3173 }
3174
3175 return;
3176}
3177
3178/******************************************************************************
3179 *
3180 * - Nom de la fonction : lecture_liens
3181 * - Description : lecture des différents liens
3182 * hors champs et maillages.
3183 * - Parametres :
3184 * - fid (IN) : ID du fichier MED.
3185 * - lecture_en_tete_seule (IN) : mode de lecture.
3186 *
3187 ******************************************************************************/
3188
3190 int lecture_en_tete_seulement)
3191{
3192 med_err ret=0;
3193 char nomlien[MED_NAME_SIZE+1]="";
3194 char *lien = NULL;
3195 med_int nln=0,nval=0;
3196 int i;
3197
3198
3199 /* Interrogation des liens */
3200 nln = MEDnLink(fid);
3201
3202 if (nln) {
3203 fprintf(stdout,"\n(***********)\n");
3204 fprintf(stdout, "(* LIENS : *)\n");
3205 fprintf(stdout, "(***********)\n");
3206 printf("\nNombre de liens : "IFORMAT"\n\n",nln);
3207 }
3208
3209 for (i=1 ; i <= nln ; i++ ) {
3210 if ( MEDlinkInfo(fid, i, nomlien, &nval) < 0) {
3211 MESSAGE("Erreur a la demande d'information sur le lien n° : "); ISCRUTE_int(i);
3212 ret = -1;continue;
3213 }
3214 printf("\t- Lien n°%i de nom |%s| et de taille "IFORMAT"\n",i,nomlien,nval);
3215
3216 lien = (char * ) malloc((nval+1)*sizeof(char));
3217 EXIT_IF(lien == NULL,NULL,NULL);
3218
3219 if ( MEDlinkRd(fid, nomlien, lien ) < 0 ) {
3220 MESSAGE("Erreur a la lecture du lien : ");
3221 SSCRUTE(nomlien);SSCRUTE(lien);
3222 ret = -1;
3223 } else {
3224 lien[nval] = '\0'; /*On s'assure qu'il y a un terminateur de chaîne */
3225 printf("\t\t|%s|\n\n",lien);
3226
3227 /*Si le montage des liens est demandé : montage les liens */
3228 if (montage)
3229 if (( FIDS.array[FIDS.n++]=MEDfileObjectsMount(fid, lien,MED_MESH)) < 0 ) {
3230 printf("Erreur au montage du lien : |%s|\n",lien);
3231 FIDS.array[FIDS.n--]=0;
3232 ret=-1;
3233 }
3234 }
3235 free(lien);
3236 }
3237 return;
3238}
3239
3240/******************************************************************************
3241 *
3242 * - Nom de la fonction : lecture_localisation
3243 * - Description : lecture des différentes localisations
3244 * hors champs et maillages.
3245 * - Parametres :
3246 * - fid (IN) : ID du fichier MED.
3247 * - mode_coo (IN) : mode de stockage en memoire :
3248 * MED_FULL_INTERLACE |
3249 * MED_NO_INTERLACE.
3250 * - lecture_en_tete_seule (IN) : mode de lecture.
3251 *
3252 ******************************************************************************/
3253
3255 const med_switch_mode mode_coo,
3256 int lecture_en_tete_seulement)
3257{
3258 med_err ret = 0;
3259 med_int nloc=0,locsdim=0,ngauss=0;
3260 med_geometry_type type_geo;
3261 med_float *refcoo=NULL, *gscoo=NULL, *wg=NULL;
3262 char locname [MED_NAME_SIZE+1]="";
3263 char geointerpname [MED_NAME_SIZE+1]="";
3264 char ipointstructmeshname[MED_NAME_SIZE+1]="";
3265 med_int nsectionmeshcell = 0;
3266 med_geometry_type sectiongeotype;
3267 char sectiongeotypename[MED_NAME_SIZE+1]="";
3268 med_int locentdim=0;
3269 med_int locnnodes=0;
3270 char _locgeotypename[MED_NAME_SIZE+1]="";
3271 int t1=0,t2=0,t3=0;
3272 int i=0,j=0;
3273
3274
3275 /* Interrogation des localisations des points de GAUSS */
3276 nloc = MEDnLocalization(fid);
3277 if (nloc) {
3278 fprintf(stdout,"\n(********************************************)\n");
3279 fprintf(stdout, "(* LOCALISATIONS DES POINTS D'INTEGRATION : *)\n");
3280 fprintf(stdout, "(********************************************)\n");
3281 printf("\nNombre de localisations stockees : "IFORMAT"\n\n",nloc);
3282 }
3283
3284 for (i=1 ; i <= nloc ; i++ ) {
3285 if ( MEDlocalizationInfo(fid, i, locname, &type_geo, &locsdim, &ngauss,
3286 geointerpname, ipointstructmeshname, &nsectionmeshcell,
3287 &sectiongeotype) < 0) {
3288 MESSAGE("Erreur a la demande d'information sur la localisation n° : "); ISCRUTE_int(i);
3289 ret = -1;continue;
3290 }
3291 printf("\t- Loc. n°%i de nom |%s| de dimension "IFORMAT" avec "IFORMAT" pts de GAUSS \n",i,locname,locsdim,ngauss);
3292
3293 if ( MEDmeshGeotypeName(fid, type_geo,_locgeotypename) <0 ) {
3294 MESSAGE("Erreur à la lecture du nom associé au typegeo : "); ISCRUTE_int(type_geo);
3295 ret = -1;continue;
3296 }
3297
3298 if ( MEDmeshGeotypeParameter(fid, type_geo,&locentdim,&locnnodes) <0 ) {
3299 MESSAGE("Erreur à la lecture du nom associé au typegeo : "); ISCRUTE_int(type_geo);
3300 ret = -1;continue;
3301 }
3302
3303 if (strlen(ipointstructmeshname)) {
3304 if ( MEDmeshGeotypeName(fid, sectiongeotype,sectiongeotypename) <0 ) {
3305 MESSAGE("Erreur à la lecture du nom associé au sectiongeotype : "); ISCRUTE_int(sectiongeotype);
3306 SSCRUTE(ipointstructmeshname);
3307 ret = -1;continue;
3308 }
3309 }
3310
3311 t1 = locnnodes*locsdim;
3312 t2 = ngauss*locsdim;
3313 t3 = ngauss;
3314 refcoo = (med_float *) malloc(sizeof(med_float)*t1 );
3315 gscoo = (med_float *) malloc(sizeof(med_float)*t2 );
3316 wg = (med_float *) malloc(sizeof(med_float)*t3 );
3317
3318 if ( MEDlocalizationRd(fid, locname, mode_coo, refcoo, gscoo, wg ) < 0) {
3319 MESSAGE("Erreur a la lecture des valeurs de la localisation : ");
3320 SSCRUTE(locname);
3321 ret = -1;
3322 } else {
3323 if (!structure) {
3324 printf("\t Coordonnees de l'element de reference de type |%s| :\n\t\t",_locgeotypename);
3325/* for (j=0;j<t1;j++) printf(" %f ",*(refcoo+j)); */
3326 for (j=0;j<locnnodes*locsdim;j++) {
3327 if (mode_coo == MED_FULL_INTERLACE && !(j % locsdim))
3328 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/locsdim + 1) );
3329 if (mode_coo == MED_NO_INTERLACE && ! (j % locnnodes))
3330 fprintf(stdout,"\n\n ");
3331 fprintf(stdout," %-+9.6f ",*(refcoo+j));
3332 }
3333 printf("\n");
3334 printf("\t Localisation des points de GAUSS : \n\t\t");
3335/* for (j=0;j<t2;j++) printf(" %f ",*(gscoo+j)); */
3336 for (j=0;j<ngauss*locsdim;j++) {
3337 if (mode_coo == MED_FULL_INTERLACE && !(j % locsdim))
3338 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/locsdim + 1) );
3339 if (mode_coo == MED_NO_INTERLACE && ! (j % ngauss))
3340 fprintf(stdout,"\n\n ");
3341 fprintf(stdout," %-+9.6f ",*(gscoo+j));
3342 }
3343 printf("\n");
3344 printf("\t Poids associes aux points de GAUSS :\n\t\t");
3345 for (j=0;j<t3;j++) printf(" %f ",*(wg+j));
3346 printf("\n");
3347 }
3348 if (strlen(ipointstructmeshname)) {
3349 printf("\t Maillage support de section d'élément de structure |%s|.\n",ipointstructmeshname);
3350 printf("\t Mailles des sections d'élément de structure de type |%s|.\n",sectiongeotypename);
3351 printf("\t Nombre de mailles par section d'élément de structure : "IFORMAT".\n",nsectionmeshcell);
3352 }
3353 if (strlen(geointerpname)) {
3354 printf("\t Tranformation géométrique associée à la localisation |%s|.\n",geointerpname);
3355 }
3356 printf("\n\n");
3357 }
3358 free(refcoo);
3359 free(gscoo);
3360 free(wg);
3361 }
3362
3363 return;
3364}
3365
3366
3368{
3369 med_idt fid;
3370 med_err ret = 0;
3371 med_int majeur,mineur,release;
3372 med_bool hdfok;
3373 med_bool medok;
3374
3375 /* on regarde si le fichier existe */
3376 ret = (int) access(fichier,F_OK);
3377 if (ret <0) { SSCRUTE(fichier);}
3378 EXIT_IF(ret < 0,"Le fichier n'est pas accessible ou n'existe pas ",
3379 fichier);
3380
3381 /* on regarde s'il s'agit d'un fichier au format HDF 5 */
3382 ret = MEDfileCompatibility (fichier,&hdfok, &medok );
3383 EXIT_IF(ret < 0,"Impossible de déterminer la compatibilité de format. ",
3384 fichier);
3385
3386 EXIT_IF(!hdfok,"Le fichier n'est pas dans un format HDF compatible ", fichier);
3387 EXIT_IF(!medok,"Le fichier n'est pas dans un format MED compatible ", fichier);
3388
3389 /* Quelle version de MED est utilise par mdump ? */
3390 MEDlibraryNumVersion(&majeur,&mineur,&release);
3391 fprintf(stdout,
3392 "- Lecture du fichier à l'aide de la bibliotheque MED V"IFORMAT"."IFORMAT"."IFORMAT" \n",
3393 majeur,mineur,release);
3394
3395 /* Ouverture du fichier MED en lecture seule */
3396 /* Le mode lecture seul ne permet pas le montage de fichier distants*/
3397 fid = MEDfileOpen(fichier,MED_ACC_RDONLY);
3398 EXIT_IF( fid < 0,"Ouverture du du fichier ",fichier);
3399
3400 MEDfileNumVersionRd(fid, &majeur, &mineur, &release);
3401 EXIT_IF(( (majeur < 2) || ( (majeur == 2) && (mineur < 2)) ), "Le fichier est antérieur à la version 2.2", NULL);
3402
3403 return fid;
3404}
3405
3406void lecture_en_tete(med_idt fid,char* fichier)
3407{
3408 char fichier_en_tete[MED_COMMENT_SIZE+1];
3409 med_err ret = 0;
3410
3411 /* lecture de l'en-tete du fichier (optionnel) */
3412 /* on va lire dans le fichier */
3413 ret = MEDfileCommentRd(fid,fichier_en_tete);
3414
3415 /* on affiche */
3416 if (ret >= 0)
3417 fprintf(stdout,"- En-tete du fichier : %s \n",fichier_en_tete);
3418
3419 return;
3420}
3421
3423 med_connectivity_mode *typ_con)
3424{
3425 int reponse;
3426 char _temp[256]="";
3427
3428 fprintf(stdout,"(*****************)\n");
3429 fprintf(stdout,"(* PARAMETRAGE : *)\n");
3430 fprintf(stdout,"(*****************)\n");
3431 fprintf(stdout,"- Mode d'affichage des coordonnées des noeuds ? \n");
3432 fprintf(stdout," 1. Mode entrelacé : taper 1 \n");
3433 fprintf(stdout," 2. Mode non entrelacé : taper 2 \n");
3434 reponse = 0;
3435 do {
3436 fprintf(stdout," Reponse : ");
3437 if (!scanf("%d",&reponse)) fgets(_temp, 256, stdin) ;
3438 } while (reponse != 1 && reponse != 2);
3439 if (reponse == 1)
3440 *mode_coo = MED_FULL_INTERLACE;
3441 else
3442 *mode_coo = MED_NO_INTERLACE;
3443
3444 fprintf(stdout,"- Connectivité des éléments ? \n");
3445 fprintf(stdout," 1. Nodale : taper 1 \n");
3446 fprintf(stdout," 2. Descendante : taper 2 \n");
3447 reponse = 0;
3448 do {
3449 fprintf(stdout," Reponse : ");
3450 if (!scanf("%d",&reponse)) fgets(_temp, 256, stdin) ;
3451 } while (reponse != 1 && reponse != 2);
3452 if (reponse == 1)
3453 *typ_con = MED_NODAL;
3454 else
3455 *typ_con = MED_DESCENDING;
3456
3457 return;
3458}
3459
3460
3462 const int numero,
3463 char * nommaa,
3464 med_int * const mdim,
3465 med_int * const edim,
3466 med_mesh_type * const type_maillage,
3467 char * const maillage_description,
3468 med_int * const nstep,
3469 char * const dtunit,
3470 char * const nomcoo,
3471 char * const unicoo,
3472 med_axis_type *const rep)
3473{
3474 char nom_universel[MED_LNAME_SIZE+1];
3475 med_err ret = 0;
3476 med_sorting_type sortingtype;
3477
3478 fprintf(stdout,"\n(**********************************************************)\n");
3479 fprintf(stdout,"(* INFORMATIONS GENERALES SUR LE MAILLAGE DE CALCUL N°%2.2d: *)\n",numero);
3480 fprintf(stdout,"(**********************************************************)\n\n");
3481
3482 /* lecture du nom et de la dimension du maillage */
3483 ret = MEDmeshInfo(fid, numero,nommaa,edim,mdim,type_maillage,maillage_description,
3484 dtunit,&sortingtype,nstep,rep,nomcoo,unicoo);
3485 EXIT_IF(ret < 0,"Lecture des informations sur le maillage",NULL);
3486
3487 /* affichage des donnees lues */
3488 fprintf(stdout,"- Nom du maillage : <<%s>>\n",nommaa);
3489 fprintf(stdout,"- Dimension du maillage : "IFORMAT"\n",*mdim);
3490 if (*edim > *mdim)
3491 fprintf(stdout,"- La dimension de l'espace est "IFORMAT" \n",*edim);
3492 if (*type_maillage == MED_UNSTRUCTURED_MESH)
3493 fprintf(stdout,"- Type du maillage : MED_NON_STRUCTURE \n");
3494 else
3495 fprintf(stdout,"- Type du maillage : MED_STRUCTURE \n");
3496 fprintf(stdout,"- Description associee au maillage : %s\n",
3497 maillage_description);
3498
3499 if ( *nstep > 1 )
3500 fprintf(stdout,"- Nombre d'étapes de calcul associées au maillage : "IFORMAT"\n",
3501 *nstep);
3502 if (strlen(dtunit))
3503 fprintf(stdout,"- Unité des dates d'étapes de calcul associées au maillage : %s\n",
3504 dtunit);
3505
3506 /* lecture du nom universel (presence optionnelle) */
3507 ret = MEDmeshUniversalNameRd(fid,nommaa,nom_universel);
3508 if (ret == 0)
3509 fprintf(stdout,"- Nom universel du maillage : %s \n",nom_universel);
3510
3511 return;
3512}
3513
3514/******************************************************************************
3515 *
3516 * - Nom de la fonction : main
3517 * - Description : fonction "main" de l'outil de DUMP d'un fichier MED.
3518 * - Parametres :
3519 * - argc (IN) : nombre d'arguments sur la ligne de commande.
3520 * - argv (IN) : liste des arguments.
3521 *
3522 ******************************************************************************/
3523
3524int main (int argc, char **argv)
3525{
3526 med_err ret = 0;
3527 med_idt fid;
3528 int i=0,numero=0,firstmesh=0,lastmesh=0,meshit=0;
3531 int lecture_en_tete_seulement = 0;
3532 med_int mdim=0,nmaa=0,nmaasup=0;
3533 char nommaa[MED_NAME_SIZE+1];
3534 char maillage_description[MED_COMMENT_SIZE+1];
3535 med_mesh_type type_maillage;
3536 med_int edim;
3537 int decalage;
3538 char nomcoo[3*MED_SNAME_SIZE+1]="";
3539 char unicoo[3*MED_SNAME_SIZE+1]="";
3540 char dtunit[MED_SNAME_SIZE+1]="";
3541 med_int nstep=0,numdt=MED_NO_DT,numit=MED_NO_IT;
3542 int csit=0;
3543 med_float dt=0.0;
3544 med_axis_type rep;
3545
3546 /*Gestion des paramètres de la ligne de commande*/
3547 char *filename=NULL,*typ_con_param=NULL,*mode_coo_param=NULL;
3548 size_t _bannerlen=0;
3549 char _temp[MAXBANNERLEN+1]="";
3550 char * _bannerstr=NULL;
3551 /* Focntionnalité non encore activée.*/
3552 med_bool _montage=MED_FALSE;
3553
3554 /*Modèles d'élements de structure utilisés par le maillage spécifié*/
3555 /*Celà permet de demander les champs uniquement sur ces modèles*/
3556 med_int _nmodels=0;
3557 med_geometry_type *_geotype_elst = NULL;
3558 char *_geotypename_elst = NULL;
3559
3560
3561 /****************************************************************************
3562 * TEST DU NOMBRE D'ARGUMENTS *
3563 ****************************************************************************/
3564
3565 structure = 0;
3566 decalage = 0;
3567
3568 if (argc > 2 && strcmp(argv[1], "--structure") == 0) {
3569 --argc;++decalage;
3570 structure = 1;
3571 }
3572
3573 /*S'il y a deux arguments nous sommes en interactif, sinon il en faut 5*/
3574 if ( (argc != 2) && (argc != 5) ) {
3575/* fprintf(stderr,"Utilisation mdump [--structure] monfichier.med\n"); */
3576 fprintf(stderr,"Utilisation mdump [--structure] monfichier.med [ NODALE|DESCENDANTE "
3577 "NO_INTERLACE|FULL_INTERLACE|LECTURE_EN_TETE_SEULEMENT N°MAILLAGE|0 pour tous ] \n");
3578 fprintf(stderr,
3579 "\t--structure : Lis l'ensemble des données sans afficher les données volumineuses\n"
3580 "\tNODALE : Scrute la connectivité nodale des maillages\n"
3581 "\tDESCENDANTE : Scrute la connectivité descendante des maillages\n"
3582 "\tFULL_INTERLACE : Affiche les connectivités en mode entrelacé x1y1x2y2\n"
3583 "\tNO_INTERLACE : Affiche les connectivités en mode non entrelacé x1x2y1y2\n"
3584 "\tLECTURE_EN_TETE_SEULEMENT : Affiche uniquement les entêtes, désactive la lecture et l'affichage des données volumineuses\n"
3585 "\tN°MAILLAGE == i : Affiche le maillage n°i et ses champs associés\n"
3586 "\tN°MAILLAGE == 0 : Affiche l'ensemble des maillages et leurs champs associés\n"
3587 "\tN°MAILLAGE == -1 : Affiche l'ensemble des champs qu'ils soient associés ou non à un maillage local\n");
3588 }
3589 EXIT_IF( (argc != 2) && (argc != 5),"nombre de parametres incorrect\n",NULL);
3590
3591
3592 /****************************************************************************
3593 * OUVERTURE DU FICHIER EN LECTURE *
3594 ****************************************************************************/
3595 filename = argv[1+decalage];
3597/* ICI;_MEDobjetsOuverts(fid); */
3598
3599 /****************************************************************************
3600 * QUESTIONS PRELIMINAIRES *
3601 * 1. Mode d'affichage des coordonnees (entrelace ou non) ? *
3602 * 2. Connectivite des elements (nodale ou descendante) ? *
3603 ***************************************************************************/
3604 fprintf(stdout,"\n >>>>>> DUMP DU FICHIER %s >>>>>>\n",filename);
3605
3606 /* lecture et affichage de l'en-tete du fichier */
3608/* ICI;_MEDobjetsOuverts(fid); */
3609
3610 if (argc == 2)
3611 parametrage(&mode_coo,&typ_con);
3612 else {
3613 typ_con_param=argv[2 + decalage];
3614/* SSCRUTE(typ_con_param); */
3615 if (! strcmp(typ_con_param,"NODALE")) typ_con = MED_NODAL;
3616 if (! strcmp(typ_con_param,"DESCENDANTE")) typ_con = MED_DESCENDING;
3617 EXIT_IF( typ_con==MED_UNDEF_CONNECTIVITY_MODE,"Le paramètre de connectivité doit être soit NODALE|DESCENDANTE",NULL);
3618 mode_coo_param=argv[3 + decalage];
3619/* SSCRUTE(mode_coo_param); */
3620 if (!strcmp(mode_coo_param,"NO_INTERLACE")) mode_coo = MED_NO_INTERLACE;
3621 if (!strcmp(mode_coo_param,"FULL_INTERLACE")) mode_coo = MED_FULL_INTERLACE;
3622 if (!strcmp(mode_coo_param,"LECTURE_EN_TETE_SEULEMENT")) { lecture_en_tete_seulement = MED_LECTURE_ENTETE_SEULEMENT;
3623 mode_coo = MED_FULL_INTERLACE;}
3624 EXIT_IF( (mode_coo==MED_UNDEF_INTERLACE) ,
3625 "Le paramètre d'entrelacement doit être soit "
3626 "NO_INTERLACE|FULL_INTERLACE|LECTURE_EN_TETE_SEULEMENT",NULL);
3627 }
3628
3629
3630 /****************************************************************************
3631 * LIENS *
3632 ****************************************************************************/
3633
3634 /*On s'informe sur les liens avant de vérifier les paramètres de la ligne de commande
3635 afin de proposer le montage des maillages distants et de les comptabiliser dans les maillages disponibles */
3636 /* Cette option n'est pas encore activée */
3637 lecture_liens(fid, _montage, lecture_en_tete_seulement);
3638/* _MEDobjetsOuverts(fid); */
3639
3640
3641 /****************************************************************************
3642 * QUEL MAILLAGE LIRE ? *
3643 ***************************************************************************/
3644 nmaa = MEDnMesh(fid);
3645/* ICI;_MEDobjetsOuverts(fid); */
3646
3647 /* Quel maillage lire ? */
3648 if (argc == 2) {
3649 if (nmaa >0) {
3650 fprintf(stdout,"- Il y a "IFORMAT" maillage(s) de type local dans ce fichier \n",nmaa);
3651 fprintf(stdout," Lequel voulez-vous lire (0 pour tous|1|2|3|...|n) ?\n");
3652 do {
3653 fprintf(stdout," Reponse : ");
3654 if (!scanf("%d",&numero)) fgets(_temp, 256, stdin) ;
3655 } while ( (numero > nmaa) || (numero < -1) );
3656 } else {
3657 fprintf(stdout,"- Il n'y a pas de maillage local dans ce fichier \n");
3658 }
3659 } else {
3660 if ( argc == 5 ) {
3661 numero = atoi(argv[4 + decalage]);
3662 EXIT_IF(numero > nmaa || numero < -1,"ce numero de maillage n'existe pas", NULL);
3663 }
3664 }
3665
3666 /****************************************************************************
3667 * MAILLAGES SUPPORTS *
3668 ****************************************************************************/
3669
3670 nmaasup= MEDnSupportMesh(fid);
3671 if (nmaasup ) {
3672 fprintf(stdout, "\n(*****************************************************)\n");
3673 fprintf(stdout, "(* INFORMATIONS GENERALES SUR LES MAILLAGES SUPPORT: *)\n");
3674 fprintf(stdout, "(*****************************************************)\n");
3675 }
3676 for (meshit=1;meshit <= nmaasup;++meshit) {
3677
3678
3679 MEDsupportMeshInfo(fid, meshit, nommaa, &edim, &mdim,
3680 maillage_description, &rep, nomcoo, unicoo);
3681 fprintf(stdout,"\n(*******************************************)\n");
3682 fprintf(stdout,"(******** Maillage support n°%2.2d/%2.2"MED_IFORMAT" : *******)\n",meshit,nmaasup);
3683 fprintf(stdout,"(*******************************************)\n");
3684
3685 fprintf(stdout,"- Nom du maillage support : <<%s>>\n",nommaa);
3686 fprintf(stdout,"- Dimension du maillage : "IFORMAT"\n",mdim);
3687 if (edim > mdim)
3688 fprintf(stdout,"- La dimension de l'espace est "IFORMAT" \n",edim);
3689
3690 lecture_maillage_non_structure(fid,nommaa,MED_NO_DT,MED_NO_IT,mdim,edim,mode_coo,typ_con,
3691 nomcoo,unicoo,&rep, &_nmodels, &_geotype_elst,&_geotypename_elst,
3693
3694 }
3695
3696
3697 /****************************************************************************
3698 * PARAMETRES SCALAIRES *
3699 ****************************************************************************/
3700
3701 /* on va lire l'ensemble des parametres scalaire */
3702 lecture_parametres_scalaires(fid,lecture_en_tete_seulement);
3703/* _MEDobjetsOuverts(fid); */
3704
3705 /****************************************************************************
3706 * LOCALISATIONS *
3707 ****************************************************************************/
3708 lecture_localisation(fid,mode_coo,lecture_en_tete_seulement);
3709/* _MEDobjetsOuverts(fid); */
3710
3711 /****************************************************************************
3712 * PROFILS *
3713 ****************************************************************************/
3714 lecture_profils(fid,lecture_en_tete_seulement);
3715/* _MEDobjetsOuverts(fid); */
3716
3717
3718 /****************************************************************************
3719 * MODELES D'ELEMENT DE STRUCTURE *
3720 ****************************************************************************/
3721 lecture_modeles_elstruct( fid, lecture_en_tete_seulement);
3722/* _MEDobjetsOuverts(fid); */
3723
3724 /****************************************************************************
3725 * FONCTIONS D'INTERPOLATION *
3726 ****************************************************************************/
3727 lecture_fonctions_interpolation( fid, lecture_en_tete_seulement);
3728/* _MEDobjetsOuverts(fid); */
3729
3730
3731 /**********************************************************************************
3732 * INFOS GENERALES SUR LE MAILLAGE, PUIS MAILLAGE+CHAMPS SUR CE MAILLAGE *
3733 ***********************************************************************************/
3734 if (numero > 0) {
3735 firstmesh=numero;lastmesh=numero;
3736 } else if (numero == 0) {
3737 firstmesh=1;lastmesh=nmaa;
3738 } else {
3739 firstmesh = nmaa +1;
3740 }
3741
3742 for (meshit=firstmesh;meshit<=lastmesh;++meshit) {
3743
3744 lecture_information_maillage(fid,meshit,nommaa,&mdim,&edim,&type_maillage,
3745 maillage_description,&nstep,dtunit,nomcoo,unicoo,&rep);
3746 /* _MEDobjetsOuverts(fid); */
3747
3748 if ( nstep == 0 ) {
3749 fprintf(stderr,"Warning : Ce maillage n'a aucune étape de calcul, ceci est anormal..."
3750 "\n\t Recherche des champs résultats associés à ce maillage.\n");
3751 csit=0;}
3752 else csit =1;
3753 for (; csit <= nstep; ++csit) {
3754
3755 if (csit) {
3756
3757 ret = MEDmeshComputationStepInfo(fid, nommaa, csit, &numdt, &numit, &dt);
3758 EXIT_IF(ret < 0,"lors de l'appel à MEDmeshComputationStepInfo",NULL);
3759
3760 /* fprintf(stdout,"\n(*********************************************************************************)\n"); */
3761 /* fprintf(stdout, "(* MAILLAGE DE CALCUL |%s| N°%2.2d À L'ÉTAPE DE CALCUL (n°dt,n°it)=" */
3762 /* "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT"): *)\n",nommaa,meshit,numdt,numit); */
3763 /* fprintf(stdout, "(*********************************************************************************)\n\n"); */
3764
3765 /*les caractères ° sont comptabilisés comme deux caractères en locale "C" ? */
3766 _bannerstr ="(* MAILLAGE DE CALCUL |%s| n°%2.2d A L'ETAPE DE CALCUL (n°dt,n°it)="
3767 "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT"): %.*s*)\n";
3768 snprintf(_temp,MAXBANNERLEN+1,_bannerstr,nommaa,meshit,numdt,numit,0,"");
3769 _bannerlen =strlen(_temp);
3770 fprintf(stdout,"\n(");
3771 for (i=0;i< _bannerlen-6; i++) fprintf(stdout,"*");
3772 fprintf(stdout,")\n%s(",_temp);
3773 for (i=0;i< _bannerlen-6; i++) fprintf(stdout,"*");
3774 fprintf(stdout,")\n");
3775
3776 /****************************************************************************
3777 * LECTURE DU MAILLAGE ET DES RESULTATS ASSOCIES *
3778 ****************************************************************************/
3779 /* _MEDobjetsOuverts(fid); */
3780
3781 if (type_maillage == MED_UNSTRUCTURED_MESH)
3782 lecture_maillage_non_structure(fid,nommaa,numdt,numit,mdim,edim,mode_coo,typ_con,
3783 nomcoo,unicoo,&rep,
3784 &_nmodels,&_geotype_elst,&_geotypename_elst,
3785 lecture_en_tete_seulement);
3786 else {
3787 lecture_maillage_structure(fid,nommaa,numdt,numit,mdim,edim,mode_coo,
3788 nomcoo,unicoo,lecture_en_tete_seulement);
3789 }
3790 /* _MEDobjetsOuverts(fid); */
3791
3792 }
3793 /* on lit ensuite les resultats associes au
3794 maillage selectionné à une étape de calcul de maillage donnée */
3795 lecture_resultats(fid,nommaa,numdt,numit,mode_coo,
3796 _nmodels,_geotype_elst,_geotypename_elst,
3797 lecture_en_tete_seulement);
3798
3799 free(_geotype_elst);
3800 free(_geotypename_elst);
3801 }
3802 }
3803
3804
3805 /****************************************************************************
3806 * LECTURE DES CHAMPS RESULTATS QLQ SOIENT LES MAILLAGES *
3807 ****************************************************************************/
3808
3809 if (numero == -1) {
3810 lecture_resultats(fid,"",numdt,numit,mode_coo,
3811 _nmodels,_geotype_elst,_geotypename_elst,
3812 lecture_en_tete_seulement);
3813
3814 free(_geotype_elst);
3815 free(_geotypename_elst);
3816 }
3817
3818 /****************************************************************************
3819 * FERMETURE DU FICHIER *
3820 ****************************************************************************/
3821 for (i=1;i < FIDS.n ; ++i)
3822 if ( MEDfileObjectsUnmount(fid, FIDS.array[i], MED_MESH) < 0 ) {
3823 printf("Erreur de démontage du fichier n°%d\n",i);
3824 }
3825
3826
3827 ret = MEDfileClose(fid);
3828 EXIT_IF(ret < 0,"lors de la fermeture du fichier",argv[1 + decalage]);
3829
3830 fprintf(stdout,"\n >>>>>> FIN DU DUMP DU FICHIER %s >>>>>>\n",argv[1 + decalage]);
3831
3832 return EXIT_SUCCESS;
3833}
MEDC_EXPORT med_err MEDequivalenceInfo(const med_idt fid, const char *const meshname, const int equivit, char *const equivname, char *const equivdescription, med_int *const nstep, med_int *const nocstpncorrespondence)
Cette routine permet lire les informations d'une équivalence portant sur les entités d'un maillage.
MEDC_EXPORT med_int MEDnEquivalence(const med_idt fid, const char *const meshname)
Cette routine permet de lire le nombre d'équivalence dans un fichier.
MEDC_EXPORT med_err MEDequivalenceCorrespondenceSize(const med_idt fid, const char *const meshname, const char *const equivname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_geometry_type geotype, med_int *const nentity)
Cette routine permet de lire le nombre de correspondances dans une équivalence pour une étape de calc...
MEDC_EXPORT med_err MEDequivalenceCorrespondenceRd(const med_idt fid, const char *const meshname, const char *const equivname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_geometry_type geotype, med_int *const correspondence)
Cette routine permet de lire un tableau de correspondances entre les entités d'un maillage dans une é...
MEDC_EXPORT med_err MEDequivalenceComputingStepInfo(const med_idt fid, const char *const meshname, const char *const equivname, const int csit, med_int *const numdt, med_int *const numit, med_int *const ncorrespondence)
Cette routine permet de lire les informations relatives à une équivalence pour une étape de calcul do...
MEDC_EXPORT med_err MEDfamily23Info(const med_idt fid, const char *const meshname, const int famit, char *const familyname, med_int *const attributenumber, med_int *const attributevalue, char *const attributedes, med_int *const familynumber, char *const groupname)
Cette routine permet de lire les informations relatives à une famille d'un maillage créé avec MED 2....
MEDC_EXPORT med_int MEDnFamily23Attribute(const med_idt fid, const char *const meshname, const int famit)
Cette routine permet de lire le nombre d'attribut dans une famille dans un maillage créé avec MED 2....
MEDC_EXPORT med_int MEDnFamily(const med_idt fid, const char *const meshname)
Cette routine permet de lire le nombre de famille dans un maillage.
Definition MEDnFamily.c:35
MEDC_EXPORT med_int MEDnFamilyGroup(const med_idt fid, const char *const meshname, const int famit)
Cette routine permet de lire le nombre de groupe dans une famille.
MEDC_EXPORT med_int MEDnField(const med_idt fid)
Cette fonction permet de lire le nombre de champs dans un fichier.
Definition MEDnField.c:35
MEDC_EXPORT med_int MEDfield23nProfile(const med_idt fid, const char *const fieldname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_geometry_type geotype, const int meshit, char *const meshname, char *const defaultprofilename, char *const defaultlocalizationname)
Cette fonction permet de lire le nombre de profils référencés dans un champ pour une étape de calcul,...
MEDC_EXPORT med_int MEDfield23nValueWithProfile(const med_idt fid, const char *const fieldname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_geometry_type geotype, const char *const meshname, const int profileit, const med_storage_mode storagemode, char *const profilename, med_int *const profilesize, char *const localizationname, med_int *const nintegrationpoint)
Cette fonction permet de lire le nombre de valeurs à lire dans un champ pour une étape de calcul,...
MEDC_EXPORT med_err MEDfield23ValueWithProfileRd(const med_idt fid, const char *const fieldname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_geometry_type geotype, const char *const meshname, const med_storage_mode storagemode, const char *const profilename, const med_switch_mode switchmode, const med_int componentselect, unsigned char *const value)
Cette fonction permet de lire les valeurs d'un champ définies sur des entités d'un maillage pour une ...
MEDC_EXPORT med_int MEDfieldnComponent(const med_idt fid, const int ind)
Cette fonction lit le nombre de composantes d'un champ.
MEDC_EXPORT med_err MEDfield23ComputingStepMeshInfo(const med_idt fid, const char *const fieldname, const int csit, med_int *const numdt, med_int *const numit, med_float *const dt, med_int *const nmesh, char *const meshname, med_bool *const localmesh, med_int *const meshnumdt, med_int *const meshnumit)
Cette fonction permet de lire les informations caractérisant une étape de calcul : numéro de pas de t...
MEDC_EXPORT med_err MEDfieldInfo(const med_idt fid, const int ind, char *const fieldname, char *const meshname, med_bool *const localmesh, med_field_type *const fieldtype, char *const componentname, char *const componentunit, char *const dtunit, med_int *const ncstp)
Cette fonction permet de lire les informations concernant le champ d'indice ind .
MEDC_EXPORT med_err MEDfileClose(med_idt fid)
Fermeture d'un fichier MED.
MEDC_EXPORT med_idt MEDfileObjectsMount(const med_idt fid, const char *const filename, const med_class medclass)
Cette routine permet de monter dans le fichier courant un type de données (exemples les maillages,...
MEDC_EXPORT med_err MEDfileObjectsUnmount(const med_idt fid, const med_idt mid, const med_class medclass)
Une fois le démontage effectué, les données précédemment montées ne sont plus accessibles.
MEDC_EXPORT med_idt MEDfileOpen(const char *const filename, const med_access_mode accessmode)
Ouverture d'un fichier MED.
Definition MEDfileOpen.c:42
MEDC_EXPORT med_err MEDfileCommentRd(const med_idt fid, char *const comment)
Lecture d'un descripteur dans un fichier MED.
MEDC_EXPORT med_err MEDfileCompatibility(const char *const filename, med_bool *const hdfok, med_bool *const medok)
Vérification de la compatibilité d'un fichier avec HDF et MED.
MEDC_EXPORT med_err MEDfileNumVersionRd(const med_idt fid, med_int *const major, med_int *const minor, med_int *const release)
Lecture du numéro de version de la bibliothèque MED utilisée pour créer le fichier.
MEDC_EXPORT med_int MEDnInterp(const med_idt fid)
Cette routine renvoie le nombre d'interpolations disponibles dans le fichier.
Definition MEDnInterp.c:34
MEDC_EXPORT med_err MEDinterpInfo(const med_idt fid, const int interpit, char *const interpname, med_geometry_type *const geotype, med_bool *const cellnode, med_int *const nbasisfunc, med_int *const nvariable, med_int *const maxdegree, med_int *const nmaxcoef)
Cette fonction informe des caractéristiques de la fonction d'interpolation n° interpit.
MEDC_EXPORT med_err MEDinterpBaseFunctionRd(const med_idt fid, const char *const interpname, const int basisfuncit, med_int *const ncoef, med_int *const power, med_float *const coefficient)
Cette routine permet la lecture d'une fonction de base/forme de l'interpolation interpname.
MEDC_EXPORT med_err MEDlibraryNumVersion(med_int *const major, med_int *const minor, med_int *const release)
Renvoie les 3 numéros de version de la librairie MED.
MEDC_EXPORT med_int MEDnLocalization(const med_idt fid)
Cette routine permet de lire le nombre de localisations de points d'intégration contenues dans un fic...
MEDC_EXPORT med_err MEDlocalizationRd(const med_idt fid, const char *const localizationname, const med_switch_mode switchmode, med_float *const elementcoordinate, med_float *const ipointcoordinate, med_float *const weight)
Cette routine permet la lecture d'une localisation localizationname de points d'intégration dans/auto...
MEDC_EXPORT med_err MEDlocalizationInfo(const med_idt fid, const int localizationit, char *const localizationname, med_geometry_type *const geotype, med_int *const spacedimension, med_int *const nipoint, char *const geointerpname, char *const sectionmeshname, med_int *const nsectionmeshcell, med_geometry_type *const sectiongeotype)
Cette routine permet d'obtenir la description de la localisation de points d'intégration n° localizat...
MEDC_EXPORT med_int MEDnMesh(const med_idt fid)
Cette routine permet de lire le nombre de maillages dans un fichier.
Definition MEDnMesh.c:34
MEDC_EXPORT med_err MEDmeshEntityInfo(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_entity_type entitype, const int geotypeit, char *const geotypename, med_geometry_type *const geotype)
Cette routine indique de façon itérative les types géométriques disponibles dans un maillage.
MEDC_EXPORT med_err MEDmeshNodeCoordinateRd(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_switch_mode switchmode, med_float *const coordinates)
Cette routine permet de lire dans un maillage le tableau des coordonnées des noeuds,...
MEDC_EXPORT med_err MEDmeshPolyhedronRd(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_connectivity_mode cmode, med_int *const faceindex, med_int *const nodeindex, med_int *const connectivity)
Cette routine permet la lecture dans un maillage des connectivités de polyèdres.
MEDC_EXPORT med_err MEDmeshComputationStepInfo(const med_idt fid, const char *const meshname, const int csit, med_int *const numdt, med_int *const numit, med_float *const dt)
Cette routine permet de lire les informations relatives à une étape de calcul d'un maillage.
MEDC_EXPORT med_err MEDmeshPolygon2Rd(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_geometry_type polytype, const med_connectivity_mode cmode, med_int *const polyindex, med_int *const connectivity)
Cette routine permet la lecture des connectivités de polygones.
MEDC_EXPORT med_int MEDmeshnEntity(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_geometry_type geotype, const med_data_type datatype, const med_connectivity_mode cmode, med_bool *const changement, med_bool *const transformation)
Cette routine permet de lire le nombre d'entités dans un maillage pour une étape de calcul donnée.
MEDC_EXPORT med_err MEDmeshPolygonRd(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_connectivity_mode cmode, med_int *const polyindex, med_int *const connectivity)
Cette routine permet la lecture des connectivités de polygones.
MEDC_EXPORT med_err MEDmeshGridStructRd(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, med_int *const gridstruct)
Cette routine permet la lecture de la structure (nombre de points sur chaque axe du repère) d'un mail...
MEDC_EXPORT med_err MEDmeshEntityNameRd(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_geometry_type geotype, char *const name)
Cette routine permet de lire les noms d'un type d'entité d'un maillage.
MEDC_EXPORT med_err MEDmeshNodeRd(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_switch_mode switchmode, med_float *const coordinate, med_bool *const withnodename, char *const nodename, med_bool *const withnodenumber, med_int *const nodenumber, med_bool *const withfamnumber, med_int *const famnumber)
Cette routine permet la lecture des noeuds d'un maillage non structuré pour une étape de calcul donné...
MEDC_EXPORT med_err MEDmeshInfo(const med_idt fid, const int meshit, char *const meshname, med_int *const spacedim, med_int *const meshdim, med_mesh_type *const meshtype, char *const description, char *const dtunit, med_sorting_type *const sortingtype, med_int *const nstep, med_axis_type *const axistype, char *const axisname, char *const axisunit)
Cette routine permet de lire les informations relatives à un maillage dans un fichier.
Definition MEDmeshInfo.c:43
MEDC_EXPORT med_err MEDmeshEntityFamilyNumberRd(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_geometry_type geotype, med_int *const number)
Cette routine permet la lecture des numéros de famille d'un type d'entité d'un maillage.
MEDC_EXPORT med_err MEDmeshElementRd(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_geometry_type geotype, const med_connectivity_mode cmode, const med_switch_mode switchmode, med_int *const connectivity, med_bool *const withelementname, char *const elementname, med_bool *const withelementnumber, med_int *const elementnumber, med_bool *const withfamnumber, med_int *const famnumber)
Cette routine permet la lecture d'un type d'élément d'un maillage non structuré pour une étape de cal...
MEDC_EXPORT med_err MEDmeshEntityNumberRd(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_entity_type entitype, const med_geometry_type geotype, med_int *const number)
Cette routine permet de lire les numéros d'un type d'entité d'un maillage.
MEDC_EXPORT med_err MEDmeshGridIndexCoordinateRd(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_int axis, med_float *const gridindex)
Cette routine permet la lecture des coordonnées des noeuds d'un maillage structuré selon un axe du re...
MEDC_EXPORT med_err MEDmeshGeotypeParameter(const med_idt fid, const med_geometry_type geotype, med_int *const geodim, med_int *const nnodes)
Cette routine renvoie les caractéristiques d'un type géométrique de maille.
MEDC_EXPORT med_err MEDmeshGridTypeRd(const med_idt fid, const char *const meshname, med_grid_type *const gridtype)
Cette routine permet de lire le type d'un maillage structuré (MED_STRUCTURED_MESH).
MEDC_EXPORT med_err MEDmeshGeotypeName(const med_idt fid, const med_geometry_type geotype, char *const geotypename)
Cette routine renvoie le nom associé à un type géométrique.
MEDC_EXPORT med_err MEDmeshUniversalNameRd(const med_idt fid, const char *const meshname, char *const univname)
Cette routine permet la lecture du nom universel d'un maillage.
MEDC_EXPORT med_err MEDparameterComputationStepInfo(const med_idt fid, const char *const paramname, const int csit, med_int *const numdt, med_int *const numit, med_float *const dt)
Cette routine permet la lecture des informations relatives à une étape de calcul du paramètre numériq...
MEDC_EXPORT med_int MEDnParameter(const med_idt fid)
Cette routine permet la lecture du nombre de paramètre numérique scalaire dans un fichier.
MEDC_EXPORT med_err MEDparameterInfo(const med_idt fid, const int paramit, char *const paramname, med_parameter_type *const paramtype, char *const description, char *const dtunit, med_int *const nstep)
Cette routine permet la lecture des informations relatives à un paramètre scalaire via un itérateur.
MEDC_EXPORT med_err MEDparameterValueRd(const med_idt fid, const char *const paramname, const med_int numdt, const med_int numit, unsigned char *const value)
Cette routine permet la lecture de la valeur d'un paramètre numérique scalaire.
MEDC_EXPORT med_int MEDprofileSizeByName(const med_idt fid, const char *const profilename)
Cette routine permet de lire la taille d'un profil dont on connait le nom.
MEDC_EXPORT med_err MEDprofileInfo(const med_idt fid, const int profileit, char *const profilename, med_int *const profilesize)
Cette routine permet de lire les informations sur un profil dans un fichier MED.
MEDC_EXPORT med_err MEDprofileRd(const med_idt fid, const char *const profilename, med_int *const profilearray)
Cette routine permet de lire un profil dans un fichier MED.
MEDC_EXPORT med_int MEDnProfile(const med_idt fid)
Cette routine permet de lire le nombre de profils dans un fichier MED.
Definition MEDnProfile.c:37
MEDC_EXPORT med_int MEDnStructElement(const med_idt fid)
Cette routine renvoie le nombre de modèles d'éléments de structure.
MEDC_EXPORT med_err MEDstructElementVarAttInfo(const med_idt fid, const char *const modelname, const int attit, char *const varattname, med_attribute_type *const varatttype, med_int *const ncomponent)
Cette routine décrit les caractéristiques d'un attribut variable de modèle d'élément de structure par...
MEDC_EXPORT med_err MEDstructElementInfo(const med_idt fid, const int mit, char *const modelname, med_geometry_type *const mgeotype, med_int *const modeldim, char *const supportmeshname, med_entity_type *const sentitytype, med_int *const snnode, med_int *const sncell, med_geometry_type *const sgeotype, med_int *const nconstantattribute, med_bool *const anyprofile, med_int *const nvariableattribute)
Cette routine décrit les caractéristiques d'un modèle d'élément de structure par itération.
MEDC_EXPORT int MEDstructElementAttSizeof(const med_attribute_type atttype)
Cette routine renvoie la taille en octets du type élémentaire atttype.
MEDC_EXPORT med_err MEDstructElementConstAttRd(const med_idt fid, const char *const modelname, const char *const constattname, void *const value)
Cette routine lit la valeur d'un attribut caractéristique constant d'un modèle d'éléments de structur...
MEDC_EXPORT med_err MEDmeshStructElementVarAttRd(const med_idt fid, const char *const meshname, const med_int numdt, const med_int numit, const med_geometry_type mgeotype, const char *const varattname, void *const value)
Cette routine lit les valeurs d'un attribut caractéristique variable sur les éléments de structure d'...
MEDC_EXPORT med_err MEDstructElementConstAttInfo(const med_idt fid, const char *const modelname, const int attit, char *const constattname, med_attribute_type *const constatttype, med_int *const ncomponent, med_entity_type *const sentitytype, char *const profilename, med_int *const profilesize)
Cette routine décrit les caractéristiques d'un attribut constant de modèle d'élément de structure par...
MEDC_EXPORT med_err MEDstructElementInfoByName(const med_idt fid, const char *const modelname, med_geometry_type *const mgeotype, med_int *const modeldim, char *const supportmeshname, med_entity_type *const sentitytype, med_int *const snnode, med_int *const sncell, med_geometry_type *const sgeotype, med_int *const nconstantatribute, med_bool *const anyprofile, med_int *const nvariableattribute)
Cette routine décrit les caractéristiques d'un modèle d'élément de structure à partir de son nom.
MEDC_EXPORT med_err MEDsubdomainJointInfo(const med_idt fid, const char *const meshname, const int jointit, char *const jointname, char *const description, med_int *const domainnumber, char *const remotemeshname, med_int *const nstep, med_int *const nocstpncorrespondence)
Cette routine permet de lire les informations sur un joint dans un maillage.
MEDC_EXPORT med_err MEDsubdomainCorrespondenceRd(const med_idt fid, const char *const meshname, const char *const jointname, const med_int numdt, const med_int numit, const med_entity_type localentitytype, const med_geometry_type localgeotype, const med_entity_type remoteentitytype, const med_geometry_type remotegeotype, med_int *const correspondence)
Cette routine permet la lecture d'une correspondance dans un joint pour un type de couple d'entité en...
MEDC_EXPORT med_int MEDnSubdomainJoint(const med_idt fid, const char *const meshname)
Cette routine permet la lecture du nombre de joint dans un maillage.
MEDC_EXPORT med_err MEDsubdomainCorrespondenceSizeInfo(const med_idt fid, const char *const meshname, const char *const jointname, const med_int numdt, const med_int numit, const int corit, med_entity_type *const localentitytype, med_geometry_type *const localgeotype, med_entity_type *const remoteentitytype, med_geometry_type *const remotegeotype, med_int *const nentity)
Cette routine permet de lire les informations sur les couples d'entités en correspondance dans un joi...
MEDC_EXPORT med_err MEDsubdomainComputingStepInfo(const med_idt fid, const char *const meshname, const char *const jointname, const int csit, med_int *const numdt, med_int *const numit, med_int *const ncorrespondence)
Cette routine permet de lire les informations sur les correspondances entre types d'entités dans un m...
MEDC_EXPORT med_int MEDnSupportMesh(const med_idt fid)
Cette routine permet de lire le nombre de maillages support dans un fichier.
MEDC_EXPORT med_err MEDsupportMeshInfo(const med_idt fid, const int meshit, char *const supportmeshname, med_int *const spacedim, med_int *const meshdim, char *const description, med_axis_type *const axistype, char *const axisname, char *const axisunit)
Cette routine permet de lire les informations relatives à un maillage support dans un fichier.
const char *const MED23FIELD_GET_ENTITY_TYPENAME[MED_N_ENTITY_TYPES+2]
void affi(const void *pva)
Definition mdump3.c:157
const char *const * nomare
Definition mdump3.c:135
FIDS_t FIDS
Definition mdump3.c:121
med_int lecture_nombre_faces_standards(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const med_geometry_type typ_geo, const med_int indice)
Definition mdump3.c:1331
const char *const * nomfac
Definition mdump3.c:134
const char *const MED23FIELD_GET_CELL_GEOMETRY_TYPENAME[MED_N_CELL_FIXED_GEO+2]
const med_geometry_type *const typmai
Definition mdump3.c:129
void lecture_aretes_standards(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const med_int mdim, const med_int *const naretes, const med_switch_mode mode_coo)
Definition mdump3.c:1578
med_geometry_type MED23MESH_GET_FACE_GEOMETRY_TYPE[MED_N_FACE_FIXED_GEO+2]
void lecture_joint_maillage(med_idt fid, const char *const nommaa, med_int njnt)
Definition mdump3.c:481
med_entity_type MED23MESH_GET_ENTITY_TYPE[MED_N_ENTITY_TYPES+2]
med_int lecture_nombre_faces_polygones(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit)
Definition mdump3.c:1442
void lecture_information_maillage(const med_idt fid, const int numero, char *nommaa, med_int *const mdim, med_int *const edim, med_mesh_type *const type_maillage, char *const maillage_description, med_int *const nstep, char *const dtunit, char *const nomcoo, char *const unicoo, med_axis_type *const rep)
Definition mdump3.c:3461
med_geometry_type MED23FIELD_GET_NODE_GEOMETRY_TYPE[MED_N_NODE_FIXED_GEO+2]
med_int lecture_nombre_mailles_standards(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const med_geometry_type typ_geo, const med_connectivity_mode typ_con, const int indice)
Definition mdump3.c:711
void lecture_fonctions_interpolation(med_idt fid, int lecture_en_tete_seulement)
Definition mdump3.c:3075
void lecture_resultats(const med_idt fid, const char *const maillage, const med_int mnumdt, const med_int mnumit, const med_switch_mode mode_coo, const med_int nmodels, const med_geometry_type *geotype_elst, const char *geotypename_elst, const int lecture_en_tete_seulement)
Definition mdump3.c:2655
const char * MED23MESH_GET_EDGE_GEOMETRY_TYPENAME[MED_N_EDGE_FIXED_GEO+2]
#define MDUMP_MAX_FILE_OPEN
Definition mdump3.c:114
med_int lecture_nombre_equivalence(med_idt fid, const char *const nommaa)
Definition mdump3.c:291
int main(int argc, char **argv)
Definition mdump3.c:3524
med_geometry_type MED23FIELD_GET_CELL_GEOMETRY_TYPE[MED_N_CELL_FIXED_GEO+2]
med_entity_type MED23FIELD_GET_ENTITY_TYPE[MED_N_ENTITY_TYPES+2]
void affd(const void *pva)
Definition mdump3.c:151
const med_geometry_type *const typfac
Definition mdump3.c:130
#define USER_MODE
Definition mdump3.c:140
med_geometry_type MED23FIELD_GET_EDGE_GEOMETRY_TYPE[MED_N_EDGE_FIXED_GEO+2]
void lecture_mailles_elstruct(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const med_int nmodels, const med_geometry_type *const geotype, const char *const geotypename, const med_int *const nmailles, const med_switch_mode mode_coo)
Definition mdump3.c:766
void lecture_mailles_standards(const med_idt fid, const char *nommaa, const med_int numdt, const med_int numit, const med_int mdim, const med_int *const nmailles, const med_switch_mode mode_coo, const med_connectivity_mode typ_con)
Definition mdump3.c:935
med_geometry_type MED23MESH_GET_NODE_GEOMETRY_TYPE[MED_N_NODE_FIXED_GEO+2]
const med_geometry_type *const typare
Definition mdump3.c:131
void lecture_mailles_polygones(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const med_geometry_type polytype, const med_int nmpolygones, const med_switch_mode mode_coo, const med_connectivity_mode typ_con)
Definition mdump3.c:1079
void lecture_maillage_non_structure(med_idt fid, const char *nommaa, const med_int numdt, const med_int numit, const med_int mdim, const med_int edim, const med_switch_mode mode_coo, const med_connectivity_mode typ_con, const char *const nomcoo, const char *const unicoo, const med_axis_type *const rep, med_int *nmodels, med_geometry_type **geotype_elst, char **geotypename_elst, const int lecture_en_tete_seulement)
Definition mdump3.c:1681
med_int lecture_nombre_mailles_polyedres(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const med_connectivity_mode typ_con)
Definition mdump3.c:1184
void lecture_modeles_elstruct(med_idt fid, int lecture_en_tete_seulement)
Definition mdump3.c:2931
#define MED_LECTURE_ENTETE_SEULEMENT
Definition mdump3.c:138
const char *const MED23MESH_GET_ENTITY_TYPENAME[MED_N_ENTITY_TYPES+2]
const char * MED23MESH_GET_NODE_GEOMETRY_TYPENAME[MED_N_NODE_FIXED_GEO+2]
void affs(const void *pva)
Definition mdump3.c:165
void lecture_parametres_scalaires(med_idt fid, int lecture_en_tete_seulement)
Definition mdump3.c:2784
void parametrage(med_switch_mode *mode_coo, med_connectivity_mode *typ_con)
Definition mdump3.c:3422
#define MDUMP_MAX_FILE_OPEN_INIT
Definition mdump3.c:115
med_geometry_type MED23FIELD_GET_FACE_GEOMETRY_TYPE[MED_N_FACE_FIXED_GEO+2]
med_int lecture_nombre_joint(med_idt fid, const char *const nommaa)
Definition mdump3.c:471
void lecture_noeuds_maillage_structure(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const med_int mdim, const med_int edim, const med_int *const nind, const med_int nnoe, const char *const comp, const char *const unit, const med_grid_type type, const med_switch_mode mode_coo)
Definition mdump3.c:1972
_myfuncptr MEDstructPrintFunction(med_attribute_type atttype)
Definition mdump3.c:173
const char *const MED23FIELD_GET_FACE_GEOMETRY_TYPENAME[MED_N_FACE_FIXED_GEO+2]
void lecture_faces_standard(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const med_int mdim, const med_int *const nfaces, const med_switch_mode mode_coo)
Definition mdump3.c:1356
void lecture_equivalence_maillage(med_idt fid, const char *const nommaa, med_int nequ)
Definition mdump3.c:301
const char *const MED23MESH_GET_CELL_GEOMETRY_TYPENAME[MED_N_CELL_FIXED_GEO+2]
void lecture_profils(med_idt fid, int lecture_en_tete_seulement)
Definition mdump3.c:2877
med_int lecture_nombre_famille(med_idt fid, const char *const nommaa)
Definition mdump3.c:193
#define MAXBANNERLEN
Definition mdump3.c:148
int structure
Definition mdump3.c:126
med_geometry_type MED23MESH_GET_EDGE_GEOMETRY_TYPE[MED_N_EDGE_FIXED_GEO+2]
void lecture_mailles_maillage_structure(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const med_int mdim, const med_int nmai)
Definition mdump3.c:2121
med_int lecture_nombre_aretes_standards(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const med_geometry_type typ_geo, const med_int indice)
Definition mdump3.c:1555
void lecture_localisation(med_idt fid, const med_switch_mode mode_coo, int lecture_en_tete_seulement)
Definition mdump3.c:3254
med_idt ouverture_fichier_MED(char *fichier)
Definition mdump3.c:3367
med_int lecture_nombre_et_type_mailles_elstruct(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const int indice, med_geometry_type *geotype, char *geotypename)
Definition mdump3.c:736
#define MED_LECTURE_MAILLAGE_SUPPORT_UNIQUEMENT
Definition mdump3.c:137
med_err getFieldsOn(const med_idt fid, const char *const maillage, const med_int mnumdt, const med_int mnumit, const med_int nmodels, const med_geometry_type *const geotype_elst, const char *const geotypename_elst, const char *const nomcha, const char *const dtunit, const med_field_type typcha, const med_int ncomp, const char *const comp, const char *const unit, const med_entity_type entite, const med_switch_mode stockage, const med_int ncstp)
Definition mdump3.c:2285
void lecture_liens(med_idt fid, med_bool montage, int lecture_en_tete_seulement)
Definition mdump3.c:3189
const char *const * nommai
Definition mdump3.c:133
void lecture_caracteristiques_grille(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const med_int mdim, med_int *nind, med_int *nnoe, med_int *nmai, med_grid_type *type)
Definition mdump3.c:1876
#define str(s)
Definition mdump3.c:143
void lecture_noeuds_maillage_non_structure(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const med_int mdim, const med_int edim, const med_int nnoe, const med_switch_mode mode_coo, const char *const nomcoo, const char *const unicoo, const med_axis_type *const rep)
Definition mdump3.c:598
med_int lecture_nombre_noeuds_maillage_non_structure(const med_idt fid, const char *nommaa, const med_int numdt, const med_int numit)
Definition mdump3.c:579
med_int lecture_nombre_mailles_polygones(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const med_geometry_type polytype, const med_connectivity_mode typ_con)
Definition mdump3.c:1046
const char *const MED23MESH_GET_FACE_GEOMETRY_TYPENAME[MED_N_FACE_FIXED_GEO+2]
void(* _myfuncptr)(const void *)
Definition mdump3.c:171
#define xstr(s)
Definition mdump3.c:142
void lecture_mailles_polyedres(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const med_int npolyedres, const med_switch_mode mode_coo, const med_connectivity_mode typ_con)
Definition mdump3.c:1207
med_geometry_type MED23MESH_GET_CELL_GEOMETRY_TYPE[MED_N_CELL_FIXED_GEO+2]
void lecture_faces_polygones(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const med_int nfpolygones, const med_switch_mode mode_coo)
Definition mdump3.c:1464
void lecture_en_tete(med_idt fid, char *fichier)
Definition mdump3.c:3406
void lecture_famille_maillage(med_idt fid, const char *const nommaa, med_int nfam)
Definition mdump3.c:202
#define MAX(a, b)
Definition mdump3.c:146
void lecture_maillage_structure(const med_idt fid, const char *const nommaa, const med_int numdt, const med_int numit, const med_int mdim, const med_int edim, const med_switch_mode mode_coo, const char *const comp, const char *const unit, const int lecture_en_tete_seulement)
Definition mdump3.c:2214
const char * MED23FIELD_GET_EDGE_GEOMETRY_TYPENAME[MED_N_EDGE_FIXED_GEO+2]
const char * MED23FIELD_GET_NODE_GEOMETRY_TYPENAME[MED_N_NODE_FIXED_GEO+2]
#define MED_NAME_SIZE
Definition med.h:81
med_switch_mode
Definition med.h:96
@ MED_NO_INTERLACE
Definition med.h:98
@ MED_UNDEF_INTERLACE
Definition med.h:100
@ MED_FULL_INTERLACE
Definition med.h:96
int med_geometry_type
Definition med.h:194
#define MED_LNAME_SIZE
Definition med.h:83
#define MED_SNAME_SIZE
Definition med.h:82
med_bool
Definition med.h:260
@ MED_FALSE
Definition med.h:260
@ MED_TRUE
Definition med.h:260
#define MED_QUAD4
Definition med.h:204
med_data_type
Definition med.h:149
@ MED_INDEX_FACE
Definition med.h:151
@ MED_COORDINATE_AXIS1
Definition med.h:150
@ MED_COORDINATE_AXIS2
Definition med.h:150
@ MED_UNDEF_DATATYPE
Definition med.h:152
@ MED_CONNECTIVITY
Definition med.h:149
@ MED_COORDINATE
Definition med.h:149
@ MED_COORDINATE_AXIS3
Definition med.h:150
@ MED_INDEX_NODE
Definition med.h:151
#define MED_SEG2
Definition med.h:200
#define MED_NAME_BLANK
Definition med.h:86
double med_double
Definition med.h:329
med_grid_type
Definition med.h:137
@ MED_CARTESIAN_GRID
Definition med.h:137
@ MED_UNDEF_GRID_TYPE
Definition med.h:140
@ MED_POLAR_GRID
Definition med.h:138
@ MED_CURVILINEAR_GRID
Definition med.h:139
int32_t med_int32
Definition med.h:334
#define MED_N_CELL_GEO_FIXED_CON
Definition med.h:240
med_field_type
Definition med.h:165
@ MED_INT
Definition med.h:170
@ MED_INT64
Definition med.h:169
@ MED_INT32
Definition med.h:168
@ MED_FLOAT64
Definition med.h:166
@ MED_FLOAT32
Definition med.h:167
med_axis_type
Definition med.h:258
med_sorting_type
Definition med.h:300
@ MED_MESH
Definition med.h:188
#define MED_ALL_CONSTITUENT
Definition med.h:293
double med_float64
Definition med.h:328
#define MED_POLYGON2
Definition med.h:224
med_mesh_type
Definition med.h:131
@ MED_UNSTRUCTURED_MESH
Definition med.h:131
#define MED_POLYGON
Definition med.h:223
#define MED_NO_GEOTYPE
Definition med.h:232
int med_int
Definition med.h:333
#define MED_NO_DT
Definition med.h:311
#define MED_N_FACE_GEO_FIXED_CON
Definition med.h:244
#define MED_N_NODE_FIXED_GEO
Definition med.h:251
#define MED_NO_IT
Definition med.h:312
#define MED_NONE
Definition med.h:231
#define MED_N_ENTITY_TYPES
Definition med.h:146
#define MED_NO_PROFILE
Definition med.h:279
med_entity_type
Definition med.h:143
@ MED_NODE
Definition med.h:143
@ MED_UNDEF_ENTITY_TYPE
Definition med.h:145
@ MED_CELL
Definition med.h:143
@ MED_NODE_ELEMENT
Definition med.h:144
@ MED_DESCENDING_FACE
Definition med.h:143
@ MED_STRUCT_ELEMENT
Definition med.h:144
@ MED_DESCENDING_EDGE
Definition med.h:143
#define MED_POINT1
Definition med.h:198
#define MED_N_FACE_FIXED_GEO
Definition med.h:243
#define MED_HEXA8
Definition med.h:213
double med_float
Definition med.h:327
med_attribute_type
Definition med.h:173
@ MED_ATT_UNDEF
Definition med.h:176
@ MED_ATT_FLOAT64
Definition med.h:173
@ MED_ATT_INT
Definition med.h:174
@ MED_ATT_NAME
Definition med.h:175
#define MED_COMMENT_SIZE
Definition med.h:79
hsize_t med_size
Definition med.h:320
#define MED_N_EDGE_FIXED_GEO
Definition med.h:247
herr_t med_err
Definition med.h:323
#define MED_N_CELL_FIXED_GEO
Definition med.h:239
float med_float32
Definition med.h:330
#define MED_GEO_ALL
Definition med.h:236
@ MED_ACC_RDONLY
Definition med.h:120
#define MED_POLYHEDRON
Definition med.h:225
int64_t med_int64
Definition med.h:335
#define MED_N_EDGE_GEO_FIXED_CON
Definition med.h:248
hid_t med_idt
Definition med.h:322
med_connectivity_mode
Definition med.h:255
@ MED_NO_CMODE
Definition med.h:255
@ MED_NODAL
Definition med.h:255
@ MED_DESCENDING
Definition med.h:255
@ MED_UNDEF_CONNECTIVITY_MODE
Definition med.h:255
#define MED_ERR_GEOMETRY_MSG
Definition med_err.h:158
#define MED_ERR_RANGE_MSG
Definition med_err.h:61
MEDC_EXPORT med_err _MEDgetGeometricParameter(const med_entity_type entitytype, const med_geometry_type geotype, med_int *const entdim, med_int *const nnodes, med_int *const nndes)
MEDC_EXPORT med_err _MEDgetInternalGeometryTypeName(const med_idt fid, char *const geotypename, med_geometry_type geotype)
#define EXIT_IF(expression, message, arg)
Definition med_utils.h:343
#define SSCRUTE(chaine)
Definition med_utils.h:323
#define MED_IFORMAT
Definition med_utils.h:153
#define MESSAGE(chaine)
Definition med_utils.h:324
#define ISCRUTE(entier)
Definition med_utils.h:313
#define IFORMAT
Definition med_utils.h:145
#define ISCRUTE_int(entier)
Definition med_utils.h:314
med_idt array[MDUMP_MAX_FILE_OPEN]
Definition mdump3.c:119
int n
Definition mdump3.c:118
#define filename
Definition test10.c:73