MED fichier
mdump4.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,"\t\t- Correspondance "IFORMAT" : "IFORMAT" et "IFORMAT" \n",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 med_geometry_type * _lgeotype=MED_NULL;
2321 med_int _ngeo=0;
2322 med_int _usedgeobyncs=0;
2323 char * * AFF_lgeotype = NULL;
2324
2325 size_t _bannerlen=255;
2326 size_t _bannerlen1=0,_bannershift1=0;
2327 char _temp1[MAXBANNERLEN+1]="";
2328 char * _bannerstr1=NULL;
2329 size_t _bannerlen2=0,_bannershift2=0;
2330 char _temp2[MAXBANNERLEN+1]="";
2331 char * _bannerstr2=NULL;
2332
2333 const char * const * AFF;
2334 const char * const * AFF_ENT=MED23FIELD_GET_ENTITY_TYPENAME+1;
2335 const char * * AFF_STRUCT = NULL;
2336
2337 switch (entite) {
2338 case MED_NODE :
2340 nb_geo = MED_N_NODE_FIXED_GEO;
2342 break;
2343 case MED_CELL :
2344 case MED_NODE_ELEMENT :
2346 nb_geo = MED_N_CELL_FIXED_GEO;
2348 break;
2349 case MED_DESCENDING_FACE :
2351 nb_geo = MED_N_FACE_FIXED_GEO;
2353 break;
2354 case MED_DESCENDING_EDGE :
2356 nb_geo = MED_N_EDGE_FIXED_GEO;
2358 break;
2359 case MED_STRUCT_ELEMENT :
2360 AFF_STRUCT = (const char * *) calloc(sizeof(const char * ),nmodels+1);
2361 for(i=0;i<nmodels;++i) AFF_STRUCT[i+1]= &geotypename_elst[(MED_NAME_SIZE+1)*i];
2362 type_geo = (med_geometry_type*)(geotype_elst)-1;
2363 nb_geo = nmodels;
2364 AFF = AFF_STRUCT;
2365 break;
2366 }
2367
2368 /*On itère sur les types géométriques ds la boucle externe à cause de la compatibilité 23 :
2369 En V2.3.6 :
2370 /CHA/<fieldname>/<entitytype>[.<geotype>]/" ....<numdt> ...<numit>"/<meshname>/MED_NOM_CO
2371 {MED_NOM_TYP, {MED_NOM_NDT,MED_NOM_PDT, {MED_NOM_NBR,
2372 MED_NOM_NCO MED_NOM_NOR,MED_NOM_MAI MED_NOM_PFL,
2373 MED_NOM_NOM, MED_NOM_UNI} MED_NOM_GAU,
2374 MED_NOM_UNI} MED_NOM_NGA}
2375 V3.0 :
2376 /CHA/<fieldname>/" ....<numdt> ...<numit>"/<entitytype>[.<geotype>]/<pflname>/MED_NOM_CO
2377 {MED_NOM_TYP, {MED_NOM_PDT, {MED_NOM_PFL(2), {MED_NOM_NBR(1),
2378 MED_NOM_MAI, MED_NOM_NDT,MED_NOM_NOR, MED_NOM_GAUSS(2)} MED_NOM_GAU(2),
2379 MED_NOM_NCO, MED_NOM_RDT,MED_NOM_ROR} MED_NOM_NGA}
2380 MED_NOM_NOM,
2381 MED_NOM_UNI,
2382 MED_NOM_UNT}
2383
2384 */
2385 /*
2386 TODO : Versionner getFieldsOn en 3.0 pour rendre l'algorithme plus efficace en fonction de la version de fichier lu.
2387 */
2388
2389 _ngeo=MEDfieldnGeometryType(fid,nomcha,MED_ALL_DT,MED_ALL_IT,entite);
2390 /* ISCRUTE(_ngeo); */
2391 _lgeotype=calloc(_ngeo+1,sizeof(med_geometry_type));_lgeotype[0]=MED_NO_GEOTYPE;
2392 MEDfieldGeometryType(fid,nomcha,MED_ALL_DT,MED_ALL_IT,entite,&_lgeotype[1],&_usedgeobyncs);
2393 type_geo = _lgeotype;
2394 AFF_lgeotype = ( char * *) calloc(_ngeo+1,sizeof(char * ));AFF_lgeotype[0]=MED_NULL;
2395 for(i=1;i<=_ngeo;++i) {
2396 AFF_lgeotype[i]=calloc(MED_NAME_SIZE+1,sizeof(char));
2397 MEDmeshGeotypeName(fid,_lgeotype[i],AFF_lgeotype[i]);
2398 }
2399 AFF = (const char * *) AFF_lgeotype;
2400
2401 /* for (k=1;k<=nb_geo;k++) { */
2402 for (k=1;k<=_ngeo;k++) {
2403
2404 /* Combien de (PDT,NOR) a lire */
2405 nbpdtnor = ncstp;
2406 if (nbpdtnor < 1 ) continue;
2407
2408 for (j=0;j<nbpdtnor;j++) {
2409
2410 if ( MEDfield23ComputingStepMeshInfo(fid, nomcha,j+1, &numdt, &numo, &dt,
2411 &nmesh, maa_ass, &localmesh, &meshnumdt, &meshnumit ) <0) {
2412 MESSAGE("Erreur a la demande d'information sur (pdt,nor) : ");
2413 ISCRUTE(numdt); ISCRUTE(numo);ISCRUTE(nmesh);SSCRUTE(meshname);ISCRUTE_int(localmesh);
2414 ISCRUTE(meshnumdt);ISCRUTE(meshnumit);
2415 ret = -1; continue;
2416 }
2417
2418 for (i=0;i< nmesh;++i) {
2419
2420 if ( (_nprofile = MEDfield23nProfile(fid,nomcha,numdt,numo,entite,type_geo[k],i+1,
2421 meshname,pflname,locname ) ) < 0 ) {
2422 MESSAGE("Erreur a la demande du nombre de profils referencés par le champ : ");
2423 SSCRUTE(nomcha); ISCRUTE(numdt); ISCRUTE(numo);SSCRUTE(meshname);
2424 ISCRUTE_int(entite);ISCRUTE_int(type_geo[k]);SSCRUTE(pflname);SSCRUTE(locname);
2425 SSCRUTE(AFF_ENT[(int)entite]);SSCRUTE(AFF[k]);
2426 ret = -1; continue;
2427 };
2428
2429 for (l=0;l<_nprofile;l++) {
2430
2431 if ( (nval = MEDfield23nValueWithProfile(fid, nomcha, numdt, numo, entite, type_geo[k],meshname,
2432 l+1, USER_MODE, pflname,&pflsize,
2433 locname, &ngauss) ) < 0 ) {
2434 MESSAGE("Erreur a la lecture du nombre de valeurs du champ : ");
2435 SSCRUTE(nomcha);ISCRUTE(numdt);ISCRUTE(numo);SSCRUTE(meshname);
2436 ISCRUTE_int(entite);ISCRUTE_int(type_geo[k]);
2438 ret = -1; continue;
2439 };
2440
2441 /* Affiche uniquement les informations du champ pour le maillage demandé <maillage,numit,nmumdt>
2442 Si le maillage demandé n'est pas précisé maillage == "", affiche les informations du champ
2443 pour tous les maillages */
2444 if ( ( (!strcmp(meshname,maillage)) && (meshnumdt == mnumdt) && (meshnumit == mnumit)) ||
2445 ( !strlen(maillage) )
2446 ) {
2447
2448 /*4 caractères spéciaux*/
2449 _bannerstr1 = "(* CHAMP |%s| A L'ÉTAPE DE CALCUL (n°dt,n°it)="
2450 "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT") , %.*s*)\n";
2451 /*4 caractères spéciaux */
2452 _bannerstr2 = "(* SUR LE MAILLAGE |%s| A L'ÉTAPE DE CALCUL (n°dt,n°it)="
2453 "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT") : %.*s*)\n";
2454 snprintf(_temp1,MAXBANNERLEN+1,_bannerstr1,nomcha,numdt,numo,0,"");
2455 snprintf(_temp2,MAXBANNERLEN+1,_bannerstr2,meshname,meshnumdt,meshnumit,0,"");
2456 _bannerlen1 = strlen(_temp1);
2457 _bannerlen2 = strlen(_temp2);
2458 _bannerlen=MAX(_bannerlen1,_bannerlen2);
2459 if (_bannerlen1>_bannerlen2) {
2460 _bannershift1 = 0; _bannershift2 = _bannerlen1-_bannerlen2;
2461 } else {
2462 _bannershift2 = 0; _bannershift1 = _bannerlen2-_bannerlen1;
2463 }
2464 fprintf(stdout,"\n(");
2465 for (i=0;i< _bannerlen-6; i++) fprintf(stdout,"*");
2466 fprintf(stdout,")\n");
2467 fprintf(stdout,_bannerstr1,nomcha,numdt,numo,_bannershift1,MED_NAME_BLANK);
2468 fprintf(stdout,_bannerstr2,meshname,meshnumdt,meshnumit,_bannershift2,MED_NAME_BLANK);
2469 fprintf(stdout,"(");
2470 for (i=0;i< _bannerlen-6; i++) fprintf(stdout,"*");
2471 fprintf(stdout,")\n");
2472
2473
2474
2475/* fprintf(stdout,"\n(********************************************************************************)\n"); */
2476/* fprintf(stdout,"(* CHAMP |%s| A L'ÉTAPE DE CALCUL (n°dt,n°it)=" */
2477/* "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT") : *)\n", */
2478/* nomcha,numdt,numo); */
2479/* fprintf(stdout,"(* SUR LE MAILLAGE |%s| A L'ÉTAPE DE CALCUL (n°dt,n°it)=" */
2480/* "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT") : *)\n", */
2481/* meshname,meshnumdt,meshnumit); */
2482/* fprintf(stdout,"(********************************************************************************)\n\n"); */
2483 fprintf(stdout,"- Valeur de la date du champ %f [%s] : \n",dt,dtunit);
2484 fprintf(stdout,"- Type des composantes du champ : %d\n",typcha);
2485 fprintf(stdout,"- Nombre de composantes par valeur : "IFORMAT"\n",ncomp);
2486 fprintf(stdout,"- Unité des composantes : |%s|\n",unit);
2487 fprintf(stdout,"- Nom des composantes : |%s|\n",comp);
2488
2489 printf("\t- Il y a "IFORMAT" entités qui portent des valeurs en mode %i."
2490 "\n\t Chaque entite %s de type geometrique %s associes au profil |%s| a "IFORMAT" point(s) d'intégration \n",
2491 nval,USER_MODE,AFF_ENT[(int)entite],AFF[k],pflname,ngauss);
2492
2493 /* Le maillage reference est-il porte par un autre fichier */
2494 if ( !localmesh ) {
2495
2496 if ( (lnsize=MEDlinkInfoByName(fid,maa_ass) ) < 0 ) {
2497 MESSAGE("Erreur a la lecture de la taille du lien : ");
2498 SSCRUTE(maa_ass);
2499 ret = -1;
2500 } else {
2501 lien = (char *)malloc(lnsize*sizeof(char) + 1);
2502 EXIT_IF(lien == NULL,NULL,NULL);
2503
2504 if ( MEDlinkRd(fid, maa_ass, lien) < 0 ) {
2505 MESSAGE("Erreur a la lecture du lien : ");
2506 SSCRUTE(maa_ass);SSCRUTE(lien);
2507 ret = -1;
2508 } else {
2509 lien[lnsize] = '\0';
2510 printf("\tLe maillage |%s| est porte par un fichier distant |%s|\n",maa_ass,lien);
2511 }
2512 free(lien);
2513 }
2514 }
2515
2516 /*Lecture des valeurs du champ */
2517 switch(typcha) {
2518 case MED_FLOAT64: medtype_size=sizeof(med_float64); break;
2519 case MED_FLOAT32: medtype_size=sizeof(med_float32); break;
2520 case MED_INT32 : medtype_size=sizeof(med_int32 ); break;
2521 case MED_INT64 : medtype_size=sizeof(med_int64 ); break;
2522 case MED_INT : medtype_size=sizeof(med_int) ; break;
2523 default:
2524 MESSAGE("Erreur a la lecture du type de champ : ");
2525 ISCRUTE_int(typcha);
2526 EXIT_IF(NULL == NULL,NULL,NULL);
2527 }
2528
2529 val = (unsigned char*) calloc(ncomp*nval*ngauss,medtype_size);
2530 EXIT_IF(val == NULL,NULL,NULL);
2531
2532
2533 if (MEDfield23ValueWithProfileRd(fid, nomcha, numdt,numo, entite,type_geo[k],meshname,
2534 USER_MODE, pflname, stockage,MED_ALL_CONSTITUENT,
2535 (unsigned char*) val) < 0 ) {
2536 MESSAGE("Erreur a la lecture des valeurs du champ : ");
2537 SSCRUTE(nomcha);ISCRUTE_int(entite);ISCRUTE_int(type_geo[k]);
2538 ISCRUTE(numdt);ISCRUTE(numo);
2539 ret = -1;
2540 }
2541
2542 if ( strlen(locname) && (_nprofile > 1) )
2543 printf("\t- Modèle de localisation des points de Gauss de nom |%s|\n",locname);
2544
2545 if (entite == MED_NODE_ELEMENT)
2546 ngroup = (type_geo[k] % 100);
2547 else
2548 ngroup = ngauss;
2549
2550 switch (stockage) {
2551
2552 case MED_FULL_INTERLACE :
2553 if (!structure) {
2554 printf("\t- Valeurs :\n\t");
2555 for (m=0;m<(nval*ngauss)/ngroup;m++) {
2556 printf("|");
2557 for (n=0;n<ngroup*ncomp;n++)
2558 switch(typcha) {
2559 case MED_FLOAT64:
2560 printf(" %f ",*(((med_double*)val)+(m*ngroup*ncomp)+n ) );
2561 /* printf(" %f ", ((med_double*)val)[(m*ngroup*ncomp)+n] ); */
2562 /* printf(" %f ", *( val+medtype_size*((m*ngroup*ncomp)+n)) ); */
2563 break;
2564 case MED_FLOAT32:
2565 printf(" %f ",*(((med_float32*)val)+((m*ngroup*ncomp)+n)));
2566 break;
2567 case MED_INT32 :
2568 printf(" %d ",*(((med_int32*)val)+(m*ngroup*ncomp)+n));
2569 break;
2570 case MED_INT64 :
2571 printf(" %ld ",*(((med_int64*)val)+(m*ngroup*ncomp)+n));
2572 break;
2573 case MED_INT :
2574 printf(" "IFORMAT" ",*(((med_int*)val)+(m*ngroup*ncomp)+n));
2575 break;
2576 default:
2577 break;
2578 }
2579 }
2580 }
2581 break;
2582
2583
2584 /*??? Affichage en fonction du profil à traiter ???*/
2585 case MED_NO_INTERLACE :
2586 if (!structure) {
2587 printf("\t- Valeurs :\n\t");
2588 for (m=0;m<ncomp;m++) {
2589 printf("|");
2590 for (n=0;n<(nval*ngauss);n++)
2591 switch(typcha) {
2592 case MED_FLOAT64:
2593 printf(" %f ",*(((med_double*)val)+(m*nval*ngauss)+n ) );
2594 /* printf(" %f ", ((med_double*)val)[(m*nval)+n] ); */
2595 /* printf(" %f ", *( val+medtype_size*((m*nval)+n)) ); */
2596 break;
2597 case MED_FLOAT32:
2598 printf(" %f ",*(((med_float32*)val)+((m*nval*ngauss)+n)));
2599 break;
2600 case MED_INT32 :
2601 printf(" %d ",*(((med_int32*)val)+(m*nval*ngauss)+n));
2602 break;
2603 case MED_INT64 :
2604 printf(" %ld ",*(((med_int64*)val)+(m*nval*ngauss)+n));
2605 break;
2606 case MED_INT :
2607 printf(" "IFORMAT" ",*(((med_int*)val)+(m*nval*ngauss)+n));
2608 break;
2609 default:
2610 break;
2611 }
2612 }
2613 }
2614 break;
2615 }
2616
2617 if (!structure) {
2618 printf("|\n");
2619 }
2620
2621 if ( val ) {free(val);val = NULL;}
2622
2623 /*Lecture du profil associe */
2624 if (strcmp(pflname,MED_NO_PROFILE) == 0 ) {
2625 printf("\t- Profil : MED_NOPFL\n");
2626 } else {
2627 if ( (pflsize = MEDprofileSizeByName(fid,pflname)) <0 ) {
2628 MESSAGE("Erreur a la lecture du nombre de valeurs du profil : ");
2629 SSCRUTE(pflname);
2630 ret = -1; continue;
2631 }
2632
2633 printf("\t- Profil : |%s| de taille "IFORMAT"\n",pflname,pflsize);
2634
2635 pflval = (med_int*) malloc(sizeof(med_int)*pflsize);
2636 EXIT_IF(pflval == NULL,NULL,NULL);
2637 if ( MEDprofileRd(fid,pflname,pflval) <0) {
2638 MESSAGE("Erreur a la lecture des valeurs du profil : ");
2639 SSCRUTE(pflname);
2640 ret = -1;
2641 }
2642 if (!structure) {
2643 printf("\t");
2644 for (m=0;m<pflsize;m++) printf(" "IFORMAT" ",*(pflval+m));
2645 printf("\n");
2646 }
2647 free(pflval);
2648 }
2649 }
2650 }
2651 }
2652 }
2653 } /* fin for sur les mailles*/
2654
2655 for(i=1;i<=_ngeo;++i) free(AFF_lgeotype[i]);
2656 free(AFF_lgeotype);
2657 free(_lgeotype);
2658 free(AFF_STRUCT);
2659 return ret;
2660}
2661
2662/******************************************************************************
2663 *
2664 * - Nom de la fonction : lecture_resultats
2665 * - Description : lecture et affichage des champs de resultats
2666 * associe a un maillage MED.
2667 * - Parametres :
2668 * - fid (IN) : ID du fichier MED.
2669 * - maillage (IN) : nom du maillage maillage.
2670 * - mode_coo (IN) : mode de stockage en memoire :
2671 * MED_FULL_INTERLACE |
2672 * MED_NO_INTERLACE.
2673 * - lecture_en_tete_seulement (IN) : mode de lecture.
2674 ******************************************************************************/
2675
2677 const char * const maillage,
2678 const med_int mnumdt,
2679 const med_int mnumit,
2680 const med_switch_mode mode_coo,
2681 const med_int nmodels,
2682 const med_geometry_type* geotype_elst,
2683 const char* geotypename_elst,
2684 const int lecture_en_tete_seulement)
2685{
2686 med_err ret,lret;
2687 char *comp, *unit;
2688 char nomcha [MED_NAME_SIZE+1]="";
2689 med_int ncomp,ncha;
2690 med_field_type typcha;
2691 int i,j;
2692
2693 char nommaa[MED_NAME_SIZE+1]="";
2694 med_bool localmaa = MED_FALSE;
2695 char dtunit[MED_SNAME_SIZE+1]="";
2696 med_int ncstp=0,_nentity=0;
2697 med_entity_type * _lentitytype =NULL;
2698 med_int _usedbyncs = 0;
2699
2700 /* combien de champs dans le fichier */
2701 ncha = MEDnField(fid);
2702 EXIT_IF(ncha < 0,"lors de la lecture du nombre de champs",NULL);
2703
2704 if ( !strlen(maillage) || lecture_en_tete_seulement ) {
2705 fprintf(stdout,"\n(************************)\n");
2706 fprintf(stdout,"(* CHAMPS RESULTATS : *)\n");
2707 fprintf(stdout,"(************************)\n");
2708 fprintf(stdout,"- Nombre de champs : "IFORMAT" \n",ncha);
2709 }
2710
2711 /****************************************************************************
2712 * LECTURE DES CHAMPS *
2713 ****************************************************************************/
2714 ret = 0;
2715
2716 /* lecture de tous les champs pour le maillage selectionne */
2717 for (i =0;i<ncha;i++) {
2718 lret = 0;
2719
2720 /* Lecture du nombre de composantes */
2721 if ((ncomp = MEDfieldnComponent(fid,i+1)) < 0) {
2722 MESSAGE("Erreur à la lecture du nombre de composantes : ");
2723 ISCRUTE(ncomp);
2724 ret = -1; continue;
2725 }
2726
2727 /* Lecture du type du champ, des noms des composantes et du nom de
2728 l'unité*/
2729 comp = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
2730 EXIT_IF(comp == NULL,NULL,NULL);
2731 unit = (char*) malloc(ncomp*MED_SNAME_SIZE+1);
2732 EXIT_IF(unit == NULL,NULL,NULL);
2733
2734 if ( MEDfieldInfo(fid, i+1, nomcha, nommaa, &localmaa,
2735 &typcha, comp, unit, dtunit, &ncstp) < 0 ) {
2736 MESSAGE("Erreur à la demande d'information sur les champs : ");
2737 ret = -1; continue;
2738 }
2739
2740
2741 if ( !strlen(maillage) || lecture_en_tete_seulement ) {
2742 printf("\nChamp numero : |%d| \n",i+1);
2743 printf("Nom du champ : |%s| de type |%d|\n",nomcha,typcha);
2744 printf("Nom des composantes : |%s|\n",comp);
2745 printf("Unites des composantes : |%s| \n",unit);
2746 if (strlen(dtunit))
2747 printf("Unité des dates : |%s|\n",dtunit);
2748 if ( ncstp > 1 )
2749 printf("Nombre d'étapes de calcul : |"IFORMAT"| \n",ncstp);
2750 }
2751
2752
2753 if (lecture_en_tete_seulement) {
2754 free(comp);
2755 free(unit);
2756 continue;
2757 }
2758
2759 _nentity = MEDfieldnEntityType(fid,nomcha,MED_ALL_DT,MED_ALL_IT);
2760 /*ISCRUTE(MEDfieldnEntityType(fid,nomcha,MED_ALL_DT,MED_ALL_IT)); */
2761 _lentitytype = calloc(_nentity,sizeof(med_entity_type));
2762 MEDfieldEntityType(fid,nomcha,MED_ALL_DT,MED_ALL_IT,_lentitytype,&_usedbyncs);
2763 /* ISCRUTE(__usedbyncs); */
2764 for (j=0; j < _nentity ; j++) {
2765 if (lret == 0)
2766 lret = getFieldsOn(fid, maillage, mnumdt, mnumit, nmodels,geotype_elst,geotypename_elst,
2767 nomcha, dtunit, typcha, ncomp, comp, unit,_lentitytype[j],mode_coo, ncstp);
2768 if (lret != 0) {
2769 MESSAGE("Erreur a la lecture des champs sur entités : ");SSCRUTE(MEDgetEntityTypeName(_lentitytype[j]));
2770 ret = -1;
2771 };
2772 }
2773 free(_lentitytype);
2774
2775 /* champs aux noeuds */
2776
2777 /* lret = getFieldsOn(fid, maillage, mnumdt, mnumit, nmodels,geotype_elst,geotypename_elst, */
2778 /* nomcha, dtunit, typcha, ncomp, comp, unit, MED_NODE,mode_coo, ncstp); */
2779
2780 /* /\* champs sur les elements et aux points de Gauss *\/ */
2781 /* if (lret == 0) lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels,geotype_elst,geotypename_elst, */
2782 /* nomcha, dtunit, typcha, ncomp, comp, unit, MED_CELL,mode_coo, ncstp); */
2783 /* else { MESSAGE("Erreur à la lecture des champs aux noeuds "); ret = -1; continue;} */
2784
2785 /* if (lret == 0) lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels,geotype_elst,geotypename_elst, */
2786 /* nomcha, dtunit, typcha, ncomp, comp, unit, MED_DESCENDING_FACE,mode_coo, ncstp); */
2787 /* else { MESSAGE("Erreur à la lecture des champs aux mailles "); ret = -1; continue;} */
2788
2789 /* if (lret == 0) lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels,geotype_elst,geotypename_elst, */
2790 /* nomcha, dtunit, typcha, ncomp, comp, unit, MED_DESCENDING_EDGE,mode_coo, ncstp); */
2791 /* else {MESSAGE("Erreur à la lecture des champs aux faces "); ret = -1; continue;} */
2792
2793 /* if (lret == 0) lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels,geotype_elst,geotypename_elst, */
2794 /* nomcha, dtunit, typcha, ncomp, comp, unit, MED_NODE_ELEMENT,mode_coo, ncstp); */
2795 /* else {MESSAGE("Erreur a la lecture des champs aux aretes "); ret = -1; continue;} */
2796
2797 /* if (lret != 0) {MESSAGE("Erreur a la lecture des champs aux noeuds des mailles "); ret = -1;}; */
2798
2799 /* if (nmodels) */
2800 /* lret = getFieldsOn(fid, maillage, mnumdt, mnumit , nmodels, geotype_elst,geotypename_elst, */
2801 /* nomcha, dtunit, typcha, ncomp, comp, unit, MED_STRUCT_ELEMENT,mode_coo, ncstp); */
2802 /* if (lret != 0) {MESSAGE("Erreur a la lecture des champs aux éléments de sructure "); ret = -1;}; */
2803
2804 free(comp);
2805 free(unit);
2806
2807 }
2808
2809 return;
2810}
2811
2812/******************************************************************************
2813 *
2814 * - Nom de la fonction : lecture_parametres_scalaires
2815 * - Description : lecture des parametres scalaires definis
2816 * hors champs et maillages.
2817 * - Parametres :
2818 * - fid (IN) : ID du fichier MED.
2819 * - lecture_en_tete_seule (IN) : mode de lecture.
2820 *
2821 ******************************************************************************/
2822
2824 int lecture_en_tete_seulement)
2825{
2826 med_err ret = 0;
2827 char nom_scalaire[MED_NAME_SIZE+1];
2828 char description[MED_COMMENT_SIZE+1];
2829 med_int vali;
2830 med_float valr;
2831 med_int i,n,npdt,j;
2832 med_parameter_type type;
2833 med_int numdt,numo;
2834 med_float dt;
2835 char dt_unit[MED_SNAME_SIZE+1];
2836
2837
2838 /* Combien de variables scalaire ? */
2839 n = MEDnParameter(fid);
2840 EXIT_IF(n < 0,"lors de la lecture du nombre de scalaires",NULL);
2841
2842 if (n) {
2843 fprintf(stdout,"\n(*******************************)\n");
2844 fprintf(stdout,"(* VARIABLES SCALAIRES : *)\n");
2845 fprintf(stdout,"(*******************************)\n\n");
2846 fprintf(stdout,"- Nombre de variables scalaires : "IFORMAT"\n",n);
2847 }
2848 if (lecture_en_tete_seulement)
2849 return ;
2850
2851 for (i=1;i<=n;i++) {
2852
2853 /* Lecture des infos (type,description) */
2854 ret = MEDparameterInfo( fid,i,nom_scalaire,&type,description,
2855 dt_unit, &npdt );
2856 EXIT_IF(ret < 0,"lors de la lecture des parametres d'un scalaire",NULL);
2857 fprintf(stdout,"- Scalaire n°"IFORMAT" de nom %s \n",i,nom_scalaire);
2858 if (type == MED_FLOAT64)
2859 fprintf(stdout," Type flottant. \n");
2860 else
2861 fprintf(stdout," Type entier. \n");
2862 printf(" Description associee : [%s] \n",description);
2863
2864 /* Pour chaque scalaire on regarde les valeurs associees
2865 eventuellement a des pas de temps et des numeros d'ordre */
2866 EXIT_IF(npdt < 0,
2867 "lors de la lecture du nombre de pas de temps d'un scalaire"
2868 ,NULL);
2869 fprintf(stdout," Nombre de valeurs stockees : "IFORMAT" \n",npdt);
2870
2871 for (j=1;j<=npdt;j++) {
2872
2873 ret = MEDparameterComputationStepInfo(fid,nom_scalaire,j, &numdt,&numo,&dt);
2874 EXIT_IF(ret < 0,
2875 "lors de la lecture des parametres d'un pas de temps d'un scalaire",
2876 NULL);
2877
2878 if (numdt == MED_NO_DT)
2879 fprintf(stdout," - Aucun de pas de temps \n");
2880 else
2881 fprintf(stdout,
2882 " - Pas de de temps de numero "IFORMAT" de valeur %f [%s] \n",numdt,
2883 dt,dt_unit);
2884 if (numo == MED_NO_IT)
2885 fprintf(stdout," - Aucun numero d'ordre \n");
2886 else
2887 fprintf(stdout," - Numero d'ordre : "IFORMAT" \n",numo);
2888
2889 if (type == MED_FLOAT64) {
2890 ret = MEDparameterValueRd(fid,nom_scalaire,numdt,numo,(unsigned char * ) &valr);
2891 fprintf(stdout," - Valeur : %f \n",valr);
2892 }
2893 else {
2894 ret = MEDparameterValueRd(fid,nom_scalaire,numdt,numo,(unsigned char * ) &vali);
2895 fprintf(stdout," - Valeur : "IFORMAT" \n",vali);
2896 }
2897 EXIT_IF(ret < 0,"lors de la lecture de la valeur d'un scalaire",NULL);
2898
2899 }
2900 }
2901
2902 return ;
2903}
2904
2905/******************************************************************************
2906 *
2907 * - Nom de la fonction : lecture_profils
2908 * - Description : lecture des différents profils
2909 * hors champs et maillages.
2910 * - Parametres :
2911 * - fid (IN) : ID du fichier MED.
2912 * - lecture_en_tete_seule (IN) : mode de lecture.
2913 *
2914 ******************************************************************************/
2915
2917 int lecture_en_tete_seulement)
2918{
2919 med_err ret;
2920 char pflname[MED_NAME_SIZE+1]="";
2921 med_int npro,*pflval,nval;
2922 int i,j;
2923
2924
2925 /* Interrogation des profils */
2926 npro = MEDnProfile(fid);
2927 EXIT_IF(npro < 0,"lors de la lecture du nombre de profils",NULL);
2928
2929 if (npro) {
2930 fprintf(stdout,"\n(*************)\n");
2931 fprintf(stdout, "(* PROFILS : *)\n");
2932 fprintf(stdout, "(*************)\n");
2933 printf("\nNombre de profils stockes : "IFORMAT"\n\n",npro);
2934 }
2935
2936 for (i=1 ; i <= npro ; i++ ) {
2937 if ( MEDprofileInfo(fid, i, pflname, &nval) < 0) {
2938 MESSAGE("Erreur a la demande d'information sur le profil n° : "); ISCRUTE_int(i);
2939 ret = -1;continue;
2940 }
2941 printf("\t- Profil n°%i de nom |%s| et de taille "IFORMAT"\n",i,pflname,nval);
2942 pflval = (med_int*) malloc(sizeof(med_int)*nval);
2943 if ( MEDprofileRd(fid, pflname, pflval) < 0) {
2944 MESSAGE("Erreur a la lecture des valeurs du profil : ");
2945 SSCRUTE(pflname);
2946 ret = -1;
2947 } else {
2948 if (!structure) {
2949 printf("\t");
2950 for (j=0;j<nval;j++) printf(" "IFORMAT" ",*(pflval+j));
2951 }
2952 printf("\n\n");
2953 }
2954 free(pflval);
2955 }
2956 return;
2957}
2958
2959/******************************************************************************
2960 *
2961 * - Nom de la fonction : lecture_modeles_elstruct
2962 * - Description : lecture des différents modèles d'éléments de structure
2963 * hors champs et maillages.
2964 * - Parametres :
2965 * - fid (IN) : ID du fichier MED.
2966 * - lecture_en_tete_seule (IN) : mode de lecture.
2967 *
2968 ******************************************************************************/
2969
2971 int lecture_en_tete_seulement)
2972{
2973 med_err _ret=0;
2974 int _i =0,_j=0,_k=0, _n=0,_nvalue=0;
2975 med_int _nstructelement=0;
2976
2977 med_geometry_type _geotype=MED_NONE;
2978
2979 char _elementname[MED_NAME_SIZE+1]="";
2980 med_int _elementdim=0;
2981 char _supportmeshname[MED_NAME_SIZE+1]="";
2983 med_int _nnode=0;
2984 med_int _ncell=0;
2985 med_geometry_type _geocelltype=MED_NONE;
2986 char _geocelltypename[MED_SNAME_SIZE+1]="";
2987 med_int _nconstantattribute=0;
2988 med_bool _anyprofile=MED_FALSE;
2989 med_int _nvariableattribute=0;
2990
2991 char _constattname[MED_NAME_SIZE+1]="";
2992 med_attribute_type _constatttype=MED_ATT_UNDEF;
2993 char _varattname[MED_NAME_SIZE+1]="";
2995 med_int _ncomponent=0;
2997 char _profilename[MED_NAME_SIZE+1]="";
2998 med_int _profilesize=0;
2999
3000 unsigned char * _value=NULL;
3001 void (*_printf)(const void*);
3002 med_int _atttypesize=0;
3003
3004 _nstructelement = MEDnStructElement(fid);
3005 EXIT_IF(_nstructelement < 0,"lors de la lecture du nombre d'éléments de structure",NULL);
3006
3007 if(_nstructelement) {
3008 fprintf(stdout,"\n(*************************************)\n");
3009 fprintf(stdout, "(* MODELES D'ELEMENTS DE STRUCTURE : *)\n");
3010 fprintf(stdout, "(*************************************)\n");
3011 printf("\nNombre d'éléments de structure : "IFORMAT"\n\n",_nstructelement);
3012 }
3013
3014 for ( _i=1; _i<= _nstructelement; ++_i) {
3015
3016 _ret= MEDstructElementInfo(fid,_i,_elementname,&_geotype,&_elementdim,_supportmeshname,
3017 &_entitytype,&_nnode,&_ncell,&_geocelltype,&_nconstantattribute,&_anyprofile,
3018 &_nvariableattribute );
3019 EXIT_IF(_ret < 0,"lors de la demande d'information sur les éléments de structure",NULL);
3020
3021 fprintf(stdout,"\nElément de structure n°%d |%s| de type géométrique n°%d et de dimension "IFORMAT"\n",
3022 _i,_elementname,_geotype,_elementdim);
3023 if ( strlen(_supportmeshname) ) {
3024 fprintf(stdout,"\t Maillage support de nom |%s|",_supportmeshname);
3025 if (_ncell) {
3026 MEDmeshGeotypeName(fid,_geocelltype,_geocelltypename);
3027 fprintf(stdout," avec "IFORMAT" maille(s) de type |%s| et",_ncell,_geocelltypename);
3028 }
3029 if (_nnode)
3030 fprintf(stdout," avec "IFORMAT" noeud(s)\n",_nnode);
3031 else {
3032 fprintf(stderr,"\n Erreur : les noeuds doivent être définis s'il existe un maillage support\n");
3033 }
3034 } else
3035 fprintf(stdout,"\t Maillage support implicite sur noeud\n");
3036
3037 fprintf(stdout,"\t Nombre d'attribut(s) constant(s) : "IFORMAT"",_nconstantattribute);
3038 if (_anyprofile) fprintf(stdout,", avec profil.\n"); else fprintf(stdout,", sans profil.\n");
3039
3040 if ( _nconstantattribute ) {
3041 for (_j=1;_j<=_nconstantattribute;++_j) {
3042 _ret= MEDstructElementConstAttInfo(fid, _elementname,_j,
3043 _constattname, &_constatttype, &_ncomponent,
3044 &_attentitytype, _profilename, &_profilesize );
3045 EXIT_IF(_ret < 0,"lors de la demande d'information sur les attributs constants des éléments de structure",NULL);
3046
3047 fprintf(stdout,"\t\t Attribut constant de nom |%s| de type %d à "IFORMAT" composantes\n",
3048 _constattname,_constatttype,_ncomponent);
3049
3050 if (!_profilesize) {
3051 if (_attentitytype == MED_NODE) _nvalue = _nnode; else _nvalue=_ncell;
3052 } else {
3053 _nvalue = _profilesize;
3054 }
3055 _n = _ncomponent*_nvalue;
3056 if ( _constatttype == MED_ATT_NAME) ++_n;
3057 _atttypesize = MEDstructElementAttSizeof(_constatttype);
3058 _value = (unsigned char *) malloc(_n*_atttypesize);
3059 if ( _constatttype == MED_ATT_NAME) --_n;
3060
3061 _ret= MEDstructElementConstAttRd(fid, _elementname,_constattname, _value );
3062 if (_ret < 0 ) free(_value);
3063 EXIT_IF(_ret < 0,"lors de la lecture des valeurs des attributs constants",NULL);
3064 _printf=MEDstructPrintFunction(_constatttype);
3065
3066 if (!structure) {
3067 fprintf(stdout,"\t\t - Valeurs de l'attribut sur les d'entité |%s|",
3068 MED23MESH_GET_ENTITY_TYPENAME[_attentitytype+1]);
3069 if ( _profilesize)
3070 fprintf(stdout," avec un profil |%s| de taille "IFORMAT": ",_profilename,_profilesize);
3071 else
3072 fprintf(stdout," sans profil : ");
3073
3074 for (_k=0;_k<_nvalue*_ncomponent;_k++) {
3075/* if ( ( _ncomponent > 1 ) && !(_k % _ncomponent) ) */
3076 if ( !(_k % _ncomponent) )
3077 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (_k/_ncomponent +1) );
3078 _printf( (void *)( (char *)(_value) + _k*_atttypesize) );
3079 }
3080 printf("\n");
3081 }
3082 /* free memory */
3083 free(_value);
3084 printf("\n");
3085 } /*fin boucle sur constatt*/
3086 } /*fin if _nconstantattribute */
3087
3088 fprintf(stdout,"\t Nombre d'attribut(s) variable(s) : "IFORMAT"\n",_nvariableattribute);
3089 if ( _nvariableattribute ) {
3090 for (_j=1;_j<=_nvariableattribute;++_j) {
3091 _ret = MEDstructElementVarAttInfo(fid, _elementname,_j,_varattname,&_varatttype,&_ncomponent );
3092 EXIT_IF(_ret < 0,"lors de la lecture des valeurs des attributs variables",NULL);
3093 fprintf(stdout,"\t\t Attribut variable de nom |%s| de type %d à "IFORMAT" composantes\n",
3094 _varattname,_varatttype,_ncomponent);
3095 }
3096 }
3097
3098 }
3099
3100 return;
3101}
3102
3103/******************************************************************************
3104 *
3105 * - Nom de la fonction : lecture_fonctions_interpolation
3106 * - Description : lecture des différentes fonctions d'interpolation
3107 * hors champs et maillages.
3108 * - Parametres :
3109 * - fid (IN) : ID du fichier MED.
3110 * - lecture_en_tete_seule (IN) : mode de lecture.
3111 *
3112 ******************************************************************************/
3113
3115 int lecture_en_tete_seulement)
3116{
3117
3118 med_err _ret=-1;
3119 med_int _ninterp=0;
3120 int _interpit =0;
3121 char _interpname[MED_NAME_SIZE+1]="";
3122 med_geometry_type _geotype =MED_NONE;
3123 char _geotypename[MED_SNAME_SIZE+1]="";
3124 med_int _geodim=0,_geonnodes=0;
3125 med_bool _cellnodes =MED_FALSE;
3126 med_int _nbasisfunc =0;
3127 med_int _nvariable =0;
3128 med_int _maxdegree =0;
3129 med_int _nmaxcoefficient =0;
3130 int _basisfuncit =0;
3131 int _powerit =0;
3132 med_int _ncoefficient =0;
3133 med_int* _power =NULL;
3134 med_float* _coefficient =NULL;
3135 int _coefficientit =0;
3136
3137
3138 _ninterp = MEDnInterp(fid);
3139 if (_ninterp) {
3140 fprintf(stdout,"\n(********************************)\n");
3141 fprintf(stdout, "(* FONCTIONS D'INTERPOLATION : *)\n");
3142 fprintf(stdout, "(********************************)\n");
3143 printf("\nNombre de fonctions d'interpolation : "IFORMAT"\n\n",_ninterp);
3144 }
3145
3146 for ( _interpit=1; _interpit<= _ninterp; ++_interpit) {
3147
3148 if (MEDinterpInfo(fid,_interpit,_interpname,&_geotype,&_cellnodes,&_nbasisfunc,
3149 &_nvariable,&_maxdegree,&_nmaxcoefficient) < 0 ) {
3150 MESSAGE("Erreur à la demande d'information de la fonction d'interpolation n°");
3151 ISCRUTE_int(_interpit);
3152 _ret = -1;continue;
3153 }
3154
3155 MEDmeshGeotypeName(fid,_geotype,_geotypename);
3156 fprintf(stdout,"Fonction d'interpolation n° %d |%s| sur le type géométrique |%s|\n",
3157 _interpit,_interpname, _geotypename);
3158
3159 if ( MEDmeshGeotypeParameter(fid,_geotype,&_geodim,&_geonnodes) <0 ) {
3160 MESSAGE("Erreur à la lecture du nom associé au typegeo : "); ISCRUTE_int(_geotype);
3161 _ret = -1;continue;
3162 }
3163
3164 if ( _cellnodes ) {
3165 if ( _nbasisfunc == _geonnodes )
3166 fprintf(stdout,"\t Les noeuds de construction sont les noeuds de la maille de référence.\n");
3167 else {
3168 MESSAGE("Erreur : le nombre de noeuds de construction "\
3169 "est différent du nombre de noeuds de la maille de référence.\n");
3170 ISCRUTE(_nbasisfunc); ISCRUTE(_geonnodes);
3171 _ret = -1;continue;
3172 }
3173 }
3174
3175/* if ( _nvariable != _geodim ) { */
3176/* MESSAGE("Erreur : le nombre de variables "\ */
3177/* "est différent de la dimension de l'espace de la maille de référence.\n"); */
3178/* ISCRUTE(_nvariable); ISCRUTE (_geodim); */
3179/* _ret = -1;continue; */
3180/* } else */
3181 fprintf(stdout,"\t Il y a "IFORMAT" fonctions de base avec "IFORMAT" variables\n ",_nbasisfunc,_nvariable);
3182 fprintf(stdout,"\t Le degré maximum des fonctions de base est "IFORMAT" et possèdent au maximum "IFORMAT" coefficients\n"
3183 ,_maxdegree,_nmaxcoefficient);
3184
3185
3186 _coefficient = (med_float*) calloc(sizeof(med_float),_nmaxcoefficient);
3187 _power = (med_int*) calloc(sizeof(med_int),_nvariable*_nmaxcoefficient);
3188
3189 for ( _basisfuncit=1; _basisfuncit<= _nbasisfunc; ++_basisfuncit) {
3190
3191
3192 if ( (_ret = MEDinterpBaseFunctionRd( fid,_interpname,_basisfuncit,&_ncoefficient,_power,_coefficient) <0) ) {
3193 MESSAGE("Erreur à la lecture de la fonction de base n°");ISCRUTE_int(_basisfuncit);
3194 _ret=-1;continue;
3195 } else {
3196 if (!structure) {
3197
3198 fprintf(stdout,"\n\t Tableau de coefficients de la fonctions de base n° %d :\n\t",_basisfuncit);
3199 for ( _coefficientit=1; _coefficientit<= _ncoefficient; ++_coefficientit)
3200 fprintf(stdout," %4f ",_coefficient[_coefficientit]);
3201
3202 fprintf(stdout,"\n\t Tableau de puissances de la fonctions de base n° %d :\n\t",_basisfuncit);
3203 for ( _powerit=1; _powerit<= _nvariable*_ncoefficient; ++_powerit)
3204 fprintf(stdout," %4"MED_IFORMAT" ",_power[_powerit]);
3205 }
3206 }
3207 }
3208 fprintf(stdout,"\n");
3209 free(_coefficient);
3210 free(_power);
3211
3212 }
3213
3214 return;
3215}
3216
3217/******************************************************************************
3218 *
3219 * - Nom de la fonction : lecture_liens
3220 * - Description : lecture des différents liens
3221 * hors champs et maillages.
3222 * - Parametres :
3223 * - fid (IN) : ID du fichier MED.
3224 * - lecture_en_tete_seule (IN) : mode de lecture.
3225 *
3226 ******************************************************************************/
3227
3229 int lecture_en_tete_seulement)
3230{
3231 med_err ret=0;
3232 char nomlien[MED_NAME_SIZE+1]="";
3233 char *lien = NULL;
3234 med_int nln=0,nval=0;
3235 int i;
3236
3237
3238 /* Interrogation des liens */
3239 nln = MEDnLink(fid);
3240
3241 if (nln) {
3242 fprintf(stdout,"\n(***********)\n");
3243 fprintf(stdout, "(* LIENS : *)\n");
3244 fprintf(stdout, "(***********)\n");
3245 printf("\nNombre de liens : "IFORMAT"\n\n",nln);
3246 }
3247
3248 for (i=1 ; i <= nln ; i++ ) {
3249 if ( MEDlinkInfo(fid, i, nomlien, &nval) < 0) {
3250 MESSAGE("Erreur a la demande d'information sur le lien n° : "); ISCRUTE_int(i);
3251 ret = -1;continue;
3252 }
3253 printf("\t- Lien n°%i de nom |%s| et de taille "IFORMAT"\n",i,nomlien,nval);
3254
3255 lien = (char * ) malloc((nval+1)*sizeof(char));
3256 EXIT_IF(lien == NULL,NULL,NULL);
3257
3258 if ( MEDlinkRd(fid, nomlien, lien ) < 0 ) {
3259 MESSAGE("Erreur a la lecture du lien : ");
3260 SSCRUTE(nomlien);SSCRUTE(lien);
3261 ret = -1;
3262 } else {
3263 lien[nval] = '\0'; /*On s'assure qu'il y a un terminateur de chaîne */
3264 printf("\t\t|%s|\n\n",lien);
3265
3266 /*Si le montage des liens est demandé : montage les liens */
3267 if (montage)
3268 if (( FIDS.array[FIDS.n++]=MEDfileObjectsMount(fid, lien,MED_MESH)) < 0 ) {
3269 printf("Erreur au montage du lien : |%s|\n",lien);
3270 FIDS.array[FIDS.n--]=0;
3271 ret=-1;
3272 }
3273 }
3274 free(lien);
3275 }
3276 return;
3277}
3278
3279/******************************************************************************
3280 *
3281 * - Nom de la fonction : lecture_localisation
3282 * - Description : lecture des différentes localisations
3283 * hors champs et maillages.
3284 * - Parametres :
3285 * - fid (IN) : ID du fichier MED.
3286 * - mode_coo (IN) : mode de stockage en memoire :
3287 * MED_FULL_INTERLACE |
3288 * MED_NO_INTERLACE.
3289 * - lecture_en_tete_seule (IN) : mode de lecture.
3290 *
3291 ******************************************************************************/
3292
3294 const med_switch_mode mode_coo,
3295 int lecture_en_tete_seulement)
3296{
3297 med_err ret = 0;
3298 med_int nloc=0,locsdim=0,ngauss=0;
3299 med_geometry_type type_geo;
3300 med_float *refcoo=NULL, *gscoo=NULL, *wg=NULL;
3301 char locname [MED_NAME_SIZE+1]="";
3302 char geointerpname [MED_NAME_SIZE+1]="";
3303 char ipointstructmeshname[MED_NAME_SIZE+1]="";
3304 med_int nsectionmeshcell = 0;
3305 med_geometry_type sectiongeotype;
3306 char sectiongeotypename[MED_NAME_SIZE+1]="";
3307 med_int locentdim=0;
3308 med_int locnnodes=0;
3309 char _locgeotypename[MED_NAME_SIZE+1]="";
3310 int t1=0,t2=0,t3=0;
3311 int i=0,j=0;
3312
3313
3314 /* Interrogation des localisations des points de GAUSS */
3315 nloc = MEDnLocalization(fid);
3316 if (nloc) {
3317 fprintf(stdout,"\n(********************************************)\n");
3318 fprintf(stdout, "(* LOCALISATIONS DES POINTS D'INTEGRATION : *)\n");
3319 fprintf(stdout, "(********************************************)\n");
3320 printf("\nNombre de localisations stockees : "IFORMAT"\n\n",nloc);
3321 }
3322
3323 for (i=1 ; i <= nloc ; i++ ) {
3324 if ( MEDlocalizationInfo(fid, i, locname, &type_geo, &locsdim, &ngauss,
3325 geointerpname, ipointstructmeshname, &nsectionmeshcell,
3326 &sectiongeotype) < 0) {
3327 MESSAGE("Erreur a la demande d'information sur la localisation n° : "); ISCRUTE_int(i);
3328 ret = -1;continue;
3329 }
3330 printf("\t- Loc. n°%i de nom |%s| de dimension "IFORMAT" avec "IFORMAT" pts de GAUSS \n",i,locname,locsdim,ngauss);
3331
3332 if ( MEDmeshGeotypeName(fid, type_geo,_locgeotypename) <0 ) {
3333 MESSAGE("Erreur à la lecture du nom associé au typegeo : "); ISCRUTE_int(type_geo);
3334 ret = -1;continue;
3335 }
3336
3337 if ( MEDmeshGeotypeParameter(fid, type_geo,&locentdim,&locnnodes) <0 ) {
3338 MESSAGE("Erreur à la lecture du nom associé au typegeo : "); ISCRUTE_int(type_geo);
3339 ret = -1;continue;
3340 }
3341
3342 if (strlen(ipointstructmeshname)) {
3343 if ( MEDmeshGeotypeName(fid, sectiongeotype,sectiongeotypename) <0 ) {
3344 MESSAGE("Erreur à la lecture du nom associé au sectiongeotype : "); ISCRUTE_int(sectiongeotype);
3345 SSCRUTE(ipointstructmeshname);
3346 ret = -1;continue;
3347 }
3348 }
3349
3350 t1 = locnnodes*locsdim;
3351 t2 = ngauss*locsdim;
3352 t3 = ngauss;
3353 refcoo = (med_float *) malloc(sizeof(med_float)*t1 );
3354 gscoo = (med_float *) malloc(sizeof(med_float)*t2 );
3355 wg = (med_float *) malloc(sizeof(med_float)*t3 );
3356
3357 if ( MEDlocalizationRd(fid, locname, mode_coo, refcoo, gscoo, wg ) < 0) {
3358 MESSAGE("Erreur a la lecture des valeurs de la localisation : ");
3359 SSCRUTE(locname);
3360 ret = -1;
3361 } else {
3362 if (!structure) {
3363 printf("\t Coordonnees de l'element de reference de type |%s| :\n\t\t",_locgeotypename);
3364/* for (j=0;j<t1;j++) printf(" %f ",*(refcoo+j)); */
3365 for (j=0;j<locnnodes*locsdim;j++) {
3366 if (mode_coo == MED_FULL_INTERLACE && !(j % locsdim))
3367 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/locsdim + 1) );
3368 if (mode_coo == MED_NO_INTERLACE && ! (j % locnnodes))
3369 fprintf(stdout,"\n\n ");
3370 fprintf(stdout," %-+9.6f ",*(refcoo+j));
3371 }
3372 printf("\n");
3373 printf("\t Localisation des points de GAUSS : \n\t\t");
3374/* for (j=0;j<t2;j++) printf(" %f ",*(gscoo+j)); */
3375 for (j=0;j<ngauss*locsdim;j++) {
3376 if (mode_coo == MED_FULL_INTERLACE && !(j % locsdim))
3377 fprintf(stdout,"\n [ %5"MED_IFORMAT" ] : ", (j/locsdim + 1) );
3378 if (mode_coo == MED_NO_INTERLACE && ! (j % ngauss))
3379 fprintf(stdout,"\n\n ");
3380 fprintf(stdout," %-+9.6f ",*(gscoo+j));
3381 }
3382 printf("\n");
3383 printf("\t Poids associes aux points de GAUSS :\n\t\t");
3384 for (j=0;j<t3;j++) printf(" %f ",*(wg+j));
3385 printf("\n");
3386 }
3387 if (strlen(ipointstructmeshname)) {
3388 printf("\t Maillage support de section d'élément de structure |%s|.\n",ipointstructmeshname);
3389 printf("\t Mailles des sections d'élément de structure de type |%s|.\n",sectiongeotypename);
3390 printf("\t Nombre de mailles par section d'élément de structure : "IFORMAT".\n",nsectionmeshcell);
3391 }
3392 if (strlen(geointerpname)) {
3393 printf("\t Tranformation géométrique associée à la localisation |%s|.\n",geointerpname);
3394 }
3395 printf("\n\n");
3396 }
3397 free(refcoo);
3398 free(gscoo);
3399 free(wg);
3400 }
3401
3402 return;
3403}
3404
3405
3407{
3408 med_idt fid;
3409 med_err ret = 0;
3410 med_int majeur,mineur,release;
3411 med_bool hdfok;
3412 med_bool medok;
3413
3414 /* on regarde si le fichier existe */
3415 ret = (int) access(fichier,F_OK);
3416 if (ret <0) { SSCRUTE(fichier);}
3417 EXIT_IF(ret < 0,"Le fichier n'est pas accessible ou n'existe pas ",
3418 fichier);
3419
3420 /* on regarde s'il s'agit d'un fichier au format HDF 5 */
3421 ret = MEDfileCompatibility (fichier,&hdfok, &medok );
3422 EXIT_IF(ret < 0,"Impossible de déterminer la compatibilité de format. ",
3423 fichier);
3424
3425 EXIT_IF(!hdfok,"Le fichier n'est pas dans un format HDF compatible ", fichier);
3426 EXIT_IF(!medok,"Le fichier n'est pas dans un format MED compatible ", fichier);
3427
3428 /* Quelle version de MED est utilise par mdump ? */
3429 MEDlibraryNumVersion(&majeur,&mineur,&release);
3430 fprintf(stdout,
3431 "- Lecture du fichier à l'aide de la bibliotheque MED V"IFORMAT"."IFORMAT"."IFORMAT" \n",
3432 majeur,mineur,release);
3433
3434 /* Ouverture du fichier MED en lecture seule */
3435 /* Le mode lecture seul ne permet pas le montage de fichier distants*/
3436 fid = MEDfileOpen(fichier,MED_ACC_RDONLY);
3437 EXIT_IF( fid < 0,"Ouverture du du fichier ",fichier);
3438
3439 MEDfileNumVersionRd(fid, &majeur, &mineur, &release);
3440 EXIT_IF(( (majeur < 2) || ( (majeur == 2) && (mineur < 2)) ), "Le fichier est antérieur à la version 2.2", NULL);
3441
3442 return fid;
3443}
3444
3445void lecture_en_tete(med_idt fid,char* fichier)
3446{
3447 char fichier_en_tete[MED_COMMENT_SIZE+1];
3448 med_err ret = 0;
3449
3450 /* lecture de l'en-tete du fichier (optionnel) */
3451 /* on va lire dans le fichier */
3452 ret = MEDfileCommentRd(fid,fichier_en_tete);
3453
3454 /* on affiche */
3455 if (ret >= 0)
3456 fprintf(stdout,"- En-tete du fichier : %s \n",fichier_en_tete);
3457
3458 return;
3459}
3460
3462 med_connectivity_mode *typ_con)
3463{
3464 int reponse;
3465 char _temp[256]="";
3466
3467 fprintf(stdout,"(*****************)\n");
3468 fprintf(stdout,"(* PARAMETRAGE : *)\n");
3469 fprintf(stdout,"(*****************)\n");
3470 fprintf(stdout,"- Mode d'affichage des coordonnées des noeuds ? \n");
3471 fprintf(stdout," 1. Mode entrelacé : taper 1 \n");
3472 fprintf(stdout," 2. Mode non entrelacé : taper 2 \n");
3473 reponse = 0;
3474 do {
3475 fprintf(stdout," Reponse : ");
3476 if (!scanf("%d",&reponse)) fgets(_temp, 256, stdin) ;
3477 } while (reponse != 1 && reponse != 2);
3478 if (reponse == 1)
3479 *mode_coo = MED_FULL_INTERLACE;
3480 else
3481 *mode_coo = MED_NO_INTERLACE;
3482
3483 fprintf(stdout,"- Connectivité des éléments ? \n");
3484 fprintf(stdout," 1. Nodale : taper 1 \n");
3485 fprintf(stdout," 2. Descendante : taper 2 \n");
3486 reponse = 0;
3487 do {
3488 fprintf(stdout," Reponse : ");
3489 if (!scanf("%d",&reponse)) fgets(_temp, 256, stdin) ;
3490 } while (reponse != 1 && reponse != 2);
3491 if (reponse == 1)
3492 *typ_con = MED_NODAL;
3493 else
3494 *typ_con = MED_DESCENDING;
3495
3496 return;
3497}
3498
3499
3501 const int numero,
3502 char * nommaa,
3503 med_int * const mdim,
3504 med_int * const edim,
3505 med_mesh_type * const type_maillage,
3506 char * const maillage_description,
3507 med_int * const nstep,
3508 char * const dtunit,
3509 char * const nomcoo,
3510 char * const unicoo,
3511 med_axis_type *const rep)
3512{
3513 char nom_universel[MED_LNAME_SIZE+1];
3514 med_err ret = 0;
3515 med_sorting_type sortingtype;
3516
3517 fprintf(stdout,"\n(**********************************************************)\n");
3518 fprintf(stdout,"(* INFORMATIONS GENERALES SUR LE MAILLAGE DE CALCUL N°%2.2d: *)\n",numero);
3519 fprintf(stdout,"(**********************************************************)\n\n");
3520
3521 /* lecture du nom et de la dimension du maillage */
3522 ret = MEDmeshInfo(fid, numero,nommaa,edim,mdim,type_maillage,maillage_description,
3523 dtunit,&sortingtype,nstep,rep,nomcoo,unicoo);
3524 EXIT_IF(ret < 0,"Lecture des informations sur le maillage",NULL);
3525
3526 /* affichage des donnees lues */
3527 fprintf(stdout,"- Nom du maillage : <<%s>>\n",nommaa);
3528 fprintf(stdout,"- Dimension du maillage : "IFORMAT"\n",*mdim);
3529 if (*edim > *mdim)
3530 fprintf(stdout,"- La dimension de l'espace est "IFORMAT" \n",*edim);
3531 if (*type_maillage == MED_UNSTRUCTURED_MESH)
3532 fprintf(stdout,"- Type du maillage : MED_NON_STRUCTURE \n");
3533 else
3534 fprintf(stdout,"- Type du maillage : MED_STRUCTURE \n");
3535 fprintf(stdout,"- Description associee au maillage : %s\n",
3536 maillage_description);
3537
3538 if ( *nstep > 1 )
3539 fprintf(stdout,"- Nombre d'étapes de calcul associées au maillage : "IFORMAT"\n",
3540 *nstep);
3541 if (strlen(dtunit))
3542 fprintf(stdout,"- Unité des dates d'étapes de calcul associées au maillage : %s\n",
3543 dtunit);
3544
3545 /* lecture du nom universel (presence optionnelle) */
3546 ret = MEDmeshUniversalNameRd(fid,nommaa,nom_universel);
3547 if (ret == 0)
3548 fprintf(stdout,"- Nom universel du maillage : %s \n",nom_universel);
3549
3550 return;
3551}
3552
3553/******************************************************************************
3554 *
3555 * - Nom de la fonction : main
3556 * - Description : fonction "main" de l'outil de DUMP d'un fichier MED.
3557 * - Parametres :
3558 * - argc (IN) : nombre d'arguments sur la ligne de commande.
3559 * - argv (IN) : liste des arguments.
3560 *
3561 ******************************************************************************/
3562
3563int main (int argc, char **argv)
3564{
3565 med_err ret = 0;
3566 med_idt fid;
3567 int i=0,numero=0,firstmesh=0,lastmesh=0,meshit=0;
3570 int lecture_en_tete_seulement = 0;
3571 med_int mdim=0,nmaa=0,nmaasup=0;
3572 char nommaa[MED_NAME_SIZE+1];
3573 char maillage_description[MED_COMMENT_SIZE+1];
3574 med_mesh_type type_maillage;
3575 med_int edim;
3576 int decalage;
3577 char nomcoo[3*MED_SNAME_SIZE+1]="";
3578 char unicoo[3*MED_SNAME_SIZE+1]="";
3579 char dtunit[MED_SNAME_SIZE+1]="";
3580 med_int nstep=0,numdt=MED_NO_DT,numit=MED_NO_IT;
3581 int csit=0;
3582 med_float dt=0.0;
3583 med_axis_type rep;
3584
3585 /*Gestion des paramètres de la ligne de commande*/
3586 char *filename=NULL,*typ_con_param=NULL,*mode_coo_param=NULL;
3587 size_t _bannerlen=0;
3588 char _temp[MAXBANNERLEN+1]="";
3589 char * _bannerstr=NULL;
3590 /* Focntionnalité non encore activée.*/
3591 med_bool _montage=MED_FALSE;
3592
3593 /*Modèles d'élements de structure utilisés par le maillage spécifié*/
3594 /*Celà permet de demander les champs uniquement sur ces modèles*/
3595 med_int _nmodels=0;
3596 med_geometry_type *_geotype_elst = NULL;
3597 char *_geotypename_elst = NULL;
3598
3599
3600 /****************************************************************************
3601 * TEST DU NOMBRE D'ARGUMENTS *
3602 ****************************************************************************/
3603
3604 structure = 0;
3605 decalage = 0;
3606
3607 if (argc > 2 && strcmp(argv[1], "--structure") == 0) {
3608 --argc;++decalage;
3609 structure = 1;
3610 }
3611
3612 /*S'il y a deux arguments nous sommes en interactif, sinon il en faut 5*/
3613 if ( (argc != 2) && (argc != 5) ) {
3614/* fprintf(stderr,"Utilisation mdump [--structure] monfichier.med\n"); */
3615 fprintf(stderr,"Utilisation mdump [--structure] monfichier.med [ NODALE|DESCENDANTE "
3616 "NO_INTERLACE|FULL_INTERLACE|LECTURE_EN_TETE_SEULEMENT N°MAILLAGE|0 pour tous ] \n");
3617 fprintf(stderr,
3618 "\t--structure : Lis l'ensemble des données sans afficher les données volumineuses\n"
3619 "\tNODALE : Scrute la connectivité nodale des maillages\n"
3620 "\tDESCENDANTE : Scrute la connectivité descendante des maillages\n"
3621 "\tFULL_INTERLACE : Affiche les connectivités en mode entrelacé x1y1x2y2\n"
3622 "\tNO_INTERLACE : Affiche les connectivités en mode non entrelacé x1x2y1y2\n"
3623 "\tLECTURE_EN_TETE_SEULEMENT : Affiche uniquement les entêtes, désactive la lecture et l'affichage des données volumineuses\n"
3624 "\tN°MAILLAGE == i : Affiche le maillage n°i et ses champs associés\n"
3625 "\tN°MAILLAGE == 0 : Affiche l'ensemble des maillages et leurs champs associés\n"
3626 "\tN°MAILLAGE == -1 : Affiche l'ensemble des champs qu'ils soient associés ou non à un maillage local\n");
3627 }
3628 EXIT_IF( (argc != 2) && (argc != 5),"nombre de parametres incorrect\n",NULL);
3629
3630
3631 /****************************************************************************
3632 * OUVERTURE DU FICHIER EN LECTURE *
3633 ****************************************************************************/
3634 filename = argv[1+decalage];
3636/* ICI;_MEDobjetsOuverts(fid); */
3637
3638 /****************************************************************************
3639 * QUESTIONS PRELIMINAIRES *
3640 * 1. Mode d'affichage des coordonnees (entrelace ou non) ? *
3641 * 2. Connectivite des elements (nodale ou descendante) ? *
3642 ***************************************************************************/
3643 fprintf(stdout,"\n >>>>>> DUMP DU FICHIER %s >>>>>>\n",filename);
3644
3645 /* lecture et affichage de l'en-tete du fichier */
3647/* ICI;_MEDobjetsOuverts(fid); */
3648
3649 if (argc == 2)
3650 parametrage(&mode_coo,&typ_con);
3651 else {
3652 typ_con_param=argv[2 + decalage];
3653/* SSCRUTE(typ_con_param); */
3654 if (! strcmp(typ_con_param,"NODALE")) typ_con = MED_NODAL;
3655 if (! strcmp(typ_con_param,"DESCENDANTE")) typ_con = MED_DESCENDING;
3656 EXIT_IF( typ_con==MED_UNDEF_CONNECTIVITY_MODE,"Le paramètre de connectivité doit être soit NODALE|DESCENDANTE",NULL);
3657 mode_coo_param=argv[3 + decalage];
3658/* SSCRUTE(mode_coo_param); */
3659 if (!strcmp(mode_coo_param,"NO_INTERLACE")) mode_coo = MED_NO_INTERLACE;
3660 if (!strcmp(mode_coo_param,"FULL_INTERLACE")) mode_coo = MED_FULL_INTERLACE;
3661 if (!strcmp(mode_coo_param,"LECTURE_EN_TETE_SEULEMENT")) { lecture_en_tete_seulement = MED_LECTURE_ENTETE_SEULEMENT;
3662 mode_coo = MED_FULL_INTERLACE;}
3663 EXIT_IF( (mode_coo==MED_UNDEF_INTERLACE) ,
3664 "Le paramètre d'entrelacement doit être soit "
3665 "NO_INTERLACE|FULL_INTERLACE|LECTURE_EN_TETE_SEULEMENT",NULL);
3666 }
3667
3668
3669 /****************************************************************************
3670 * LIENS *
3671 ****************************************************************************/
3672
3673 /*On s'informe sur les liens avant de vérifier les paramètres de la ligne de commande
3674 afin de proposer le montage des maillages distants et de les comptabiliser dans les maillages disponibles */
3675 /* Cette option n'est pas encore activée */
3676 lecture_liens(fid, _montage, lecture_en_tete_seulement);
3677/* _MEDobjetsOuverts(fid); */
3678
3679
3680 /****************************************************************************
3681 * QUEL MAILLAGE LIRE ? *
3682 ***************************************************************************/
3683 nmaa = MEDnMesh(fid);
3684/* ICI;_MEDobjetsOuverts(fid); */
3685
3686 /* Quel maillage lire ? */
3687 if (argc == 2) {
3688 if (nmaa >0) {
3689 fprintf(stdout,"- Il y a "IFORMAT" maillage(s) de type local dans ce fichier \n",nmaa);
3690 fprintf(stdout," Lequel voulez-vous lire (0 pour tous|1|2|3|...|n) ?\n");
3691 do {
3692 fprintf(stdout," Reponse : ");
3693 if (!scanf("%d",&numero)) fgets(_temp, 256, stdin) ;
3694 } while ( (numero > nmaa) || (numero < -1) );
3695 } else {
3696 fprintf(stdout,"- Il n'y a pas de maillage local dans ce fichier \n");
3697 }
3698 } else {
3699 if ( argc == 5 ) {
3700 numero = atoi(argv[4 + decalage]);
3701 EXIT_IF(numero > nmaa || numero < -1,"ce numero de maillage n'existe pas", NULL);
3702 }
3703 }
3704
3705 /****************************************************************************
3706 * MAILLAGES SUPPORTS *
3707 ****************************************************************************/
3708
3709 nmaasup= MEDnSupportMesh(fid);
3710 if (nmaasup ) {
3711 fprintf(stdout, "\n(*****************************************************)\n");
3712 fprintf(stdout, "(* INFORMATIONS GENERALES SUR LES MAILLAGES SUPPORT: *)\n");
3713 fprintf(stdout, "(*****************************************************)\n");
3714 }
3715 for (meshit=1;meshit <= nmaasup;++meshit) {
3716
3717
3718 MEDsupportMeshInfo(fid, meshit, nommaa, &edim, &mdim,
3719 maillage_description, &rep, nomcoo, unicoo);
3720 fprintf(stdout,"\n(*******************************************)\n");
3721 fprintf(stdout,"(******** Maillage support n°%2.2d/%2.2"MED_IFORMAT" : *******)\n",meshit,nmaasup);
3722 fprintf(stdout,"(*******************************************)\n");
3723
3724 fprintf(stdout,"- Nom du maillage support : <<%s>>\n",nommaa);
3725 fprintf(stdout,"- Dimension du maillage : "IFORMAT"\n",mdim);
3726 if (edim > mdim)
3727 fprintf(stdout,"- La dimension de l'espace est "IFORMAT" \n",edim);
3728
3729 lecture_maillage_non_structure(fid,nommaa,MED_NO_DT,MED_NO_IT,mdim,edim,mode_coo,typ_con,
3730 nomcoo,unicoo,&rep, &_nmodels, &_geotype_elst,&_geotypename_elst,
3732
3733 }
3734
3735
3736 /****************************************************************************
3737 * PARAMETRES SCALAIRES *
3738 ****************************************************************************/
3739
3740 /* on va lire l'ensemble des parametres scalaire */
3741 lecture_parametres_scalaires(fid,lecture_en_tete_seulement);
3742/* _MEDobjetsOuverts(fid); */
3743
3744 /****************************************************************************
3745 * LOCALISATIONS *
3746 ****************************************************************************/
3747 lecture_localisation(fid,mode_coo,lecture_en_tete_seulement);
3748/* _MEDobjetsOuverts(fid); */
3749
3750 /****************************************************************************
3751 * PROFILS *
3752 ****************************************************************************/
3753 lecture_profils(fid,lecture_en_tete_seulement);
3754/* _MEDobjetsOuverts(fid); */
3755
3756
3757 /****************************************************************************
3758 * MODELES D'ELEMENT DE STRUCTURE *
3759 ****************************************************************************/
3760 lecture_modeles_elstruct( fid, lecture_en_tete_seulement);
3761/* _MEDobjetsOuverts(fid); */
3762
3763 /****************************************************************************
3764 * FONCTIONS D'INTERPOLATION *
3765 ****************************************************************************/
3766 lecture_fonctions_interpolation( fid, lecture_en_tete_seulement);
3767/* _MEDobjetsOuverts(fid); */
3768
3769
3770 /**********************************************************************************
3771 * INFOS GENERALES SUR LE MAILLAGE, PUIS MAILLAGE+CHAMPS SUR CE MAILLAGE *
3772 ***********************************************************************************/
3773 if (numero > 0) {
3774 firstmesh=numero;lastmesh=numero;
3775 } else if (numero == 0) {
3776 firstmesh=1;lastmesh=nmaa;
3777 } else {
3778 firstmesh = nmaa +1;
3779 }
3780
3781 for (meshit=firstmesh;meshit<=lastmesh;++meshit) {
3782
3783 lecture_information_maillage(fid,meshit,nommaa,&mdim,&edim,&type_maillage,
3784 maillage_description,&nstep,dtunit,nomcoo,unicoo,&rep);
3785 /* _MEDobjetsOuverts(fid); */
3786
3787 if ( nstep == 0 ) {
3788 fprintf(stderr,"Warning : Ce maillage n'a aucune étape de calcul, ceci est anormal..."
3789 "\n\t Recherche des champs résultats associés à ce maillage.\n");
3790 csit=0;}
3791 else csit =1;
3792 for (; csit <= nstep; ++csit) {
3793
3794 if (csit) {
3795
3796 ret = MEDmeshComputationStepInfo(fid, nommaa, csit, &numdt, &numit, &dt);
3797 EXIT_IF(ret < 0,"lors de l'appel à MEDmeshComputationStepInfo",NULL);
3798
3799 /* fprintf(stdout,"\n(*********************************************************************************)\n"); */
3800 /* fprintf(stdout, "(* MAILLAGE DE CALCUL |%s| N°%2.2d À L'ÉTAPE DE CALCUL (n°dt,n°it)=" */
3801 /* "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT"): *)\n",nommaa,meshit,numdt,numit); */
3802 /* fprintf(stdout, "(*********************************************************************************)\n\n"); */
3803
3804 /*les caractères ° sont comptabilisés comme deux caractères en locale "C" ? */
3805 _bannerstr ="(* MAILLAGE DE CALCUL |%s| n°%2.2d A L'ETAPE DE CALCUL (n°dt,n°it)="
3806 "(% 2.2"MED_IFORMAT",% 2.2"MED_IFORMAT"): %.*s*)\n";
3807 snprintf(_temp,MAXBANNERLEN+1,_bannerstr,nommaa,meshit,numdt,numit,0,"");
3808 _bannerlen =strlen(_temp);
3809 fprintf(stdout,"\n(");
3810 for (i=0;i< _bannerlen-6; i++) fprintf(stdout,"*");
3811 fprintf(stdout,")\n%s(",_temp);
3812 for (i=0;i< _bannerlen-6; i++) fprintf(stdout,"*");
3813 fprintf(stdout,")\n");
3814
3815 /****************************************************************************
3816 * LECTURE DU MAILLAGE ET DES RESULTATS ASSOCIES *
3817 ****************************************************************************/
3818 /* _MEDobjetsOuverts(fid); */
3819
3820 if (type_maillage == MED_UNSTRUCTURED_MESH)
3821 lecture_maillage_non_structure(fid,nommaa,numdt,numit,mdim,edim,mode_coo,typ_con,
3822 nomcoo,unicoo,&rep,
3823 &_nmodels,&_geotype_elst,&_geotypename_elst,
3824 lecture_en_tete_seulement);
3825 else {
3826 lecture_maillage_structure(fid,nommaa,numdt,numit,mdim,edim,mode_coo,
3827 nomcoo,unicoo,lecture_en_tete_seulement);
3828 }
3829 /* _MEDobjetsOuverts(fid); */
3830
3831 }
3832 /* on lit ensuite les resultats associes au
3833 maillage selectionné à une étape de calcul de maillage donnée */
3834 lecture_resultats(fid,nommaa,numdt,numit,mode_coo,
3835 _nmodels,_geotype_elst,_geotypename_elst,
3836 lecture_en_tete_seulement);
3837
3838 free(_geotype_elst);
3839 free(_geotypename_elst);
3840 }
3841 }
3842
3843
3844 /****************************************************************************
3845 * LECTURE DES CHAMPS RESULTATS QLQ SOIENT LES MAILLAGES *
3846 ****************************************************************************/
3847
3848 if (numero == -1) {
3849 lecture_resultats(fid,"",numdt,numit,mode_coo,
3850 _nmodels,_geotype_elst,_geotypename_elst,
3851 lecture_en_tete_seulement);
3852
3853 free(_geotype_elst);
3854 free(_geotypename_elst);
3855 }
3856
3857 /****************************************************************************
3858 * FERMETURE DU FICHIER *
3859 ****************************************************************************/
3860 for (i=1;i < FIDS.n ; ++i)
3861 if ( MEDfileObjectsUnmount(fid, FIDS.array[i], MED_MESH) < 0 ) {
3862 printf("Erreur de démontage du fichier n°%d\n",i);
3863 }
3864
3865
3866 ret = MEDfileClose(fid);
3867 EXIT_IF(ret < 0,"lors de la fermeture du fichier",argv[1 + decalage]);
3868
3869 fprintf(stdout,"\n >>>>>> FIN DU DUMP DU FICHIER %s >>>>>>\n",argv[1 + decalage]);
3870
3871 return EXIT_SUCCESS;
3872}
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_err MEDfieldGeometryType(const med_idt fid, const char *const fieldname, const med_int numdt, const med_int numit, const med_entity_type entitytype, med_geometry_type *const geometrytypes, med_int *const usedbyncs)
Cette fonction retourne la liste des types géométrique présents dans un champ (med_geometry_type) pou...
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_err MEDfieldEntityType(const med_idt fid, const char *const fieldname, const med_int numdt, const med_int numit, med_entity_type *const entitytypes, med_int *const usedbyncs)
Cette fonction retourne la liste des types d'entité présents dans un champ (med_entity_type).
MEDC_EXPORT med_int MEDfieldnEntityType(const med_idt fid, const char *const fieldname, const med_int numdt, const med_int numit)
Cette fonction indique le nombre de types d'entité présents dans un champ (med_entity_type).
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_int MEDfieldnGeometryType(const med_idt fid, const char *const fieldname, const med_int numdt, const med_int numit, const med_entity_type entitytype)
Cette fonction indique le nombre de types géométriques (med_geometry_type) présents dans le champ fie...
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 mdump4.c:157
const char *const * nomare
Definition mdump4.c:135
FIDS_t FIDS
Definition mdump4.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 mdump4.c:1331
const char *const * nomfac
Definition mdump4.c:134
const char *const MED23FIELD_GET_CELL_GEOMETRY_TYPENAME[MED_N_CELL_FIXED_GEO+2]
const med_geometry_type *const typmai
Definition mdump4.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 mdump4.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 mdump4.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 mdump4.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 mdump4.c:3500
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 mdump4.c:711
void lecture_fonctions_interpolation(med_idt fid, int lecture_en_tete_seulement)
Definition mdump4.c:3114
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 mdump4.c:2676
const char * MED23MESH_GET_EDGE_GEOMETRY_TYPENAME[MED_N_EDGE_FIXED_GEO+2]
#define MDUMP_MAX_FILE_OPEN
Definition mdump4.c:114
med_int lecture_nombre_equivalence(med_idt fid, const char *const nommaa)
Definition mdump4.c:291
int main(int argc, char **argv)
Definition mdump4.c:3563
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 mdump4.c:151
const med_geometry_type *const typfac
Definition mdump4.c:130
#define USER_MODE
Definition mdump4.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 mdump4.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 mdump4.c:935
med_geometry_type MED23MESH_GET_NODE_GEOMETRY_TYPE[MED_N_NODE_FIXED_GEO+2]
const med_geometry_type *const typare
Definition mdump4.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 mdump4.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 mdump4.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 mdump4.c:1184
void lecture_modeles_elstruct(med_idt fid, int lecture_en_tete_seulement)
Definition mdump4.c:2970
#define MED_LECTURE_ENTETE_SEULEMENT
Definition mdump4.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 mdump4.c:165
void lecture_parametres_scalaires(med_idt fid, int lecture_en_tete_seulement)
Definition mdump4.c:2823
void parametrage(med_switch_mode *mode_coo, med_connectivity_mode *typ_con)
Definition mdump4.c:3461
#define MDUMP_MAX_FILE_OPEN_INIT
Definition mdump4.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 mdump4.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 mdump4.c:1972
_myfuncptr MEDstructPrintFunction(med_attribute_type atttype)
Definition mdump4.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 mdump4.c:1356
void lecture_equivalence_maillage(med_idt fid, const char *const nommaa, med_int nequ)
Definition mdump4.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 mdump4.c:2916
med_int lecture_nombre_famille(med_idt fid, const char *const nommaa)
Definition mdump4.c:193
#define MAXBANNERLEN
Definition mdump4.c:148
int structure
Definition mdump4.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 mdump4.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 mdump4.c:1555
void lecture_localisation(med_idt fid, const med_switch_mode mode_coo, int lecture_en_tete_seulement)
Definition mdump4.c:3293
med_idt ouverture_fichier_MED(char *fichier)
Definition mdump4.c:3406
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 mdump4.c:736
#define MED_LECTURE_MAILLAGE_SUPPORT_UNIQUEMENT
Definition mdump4.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 mdump4.c:2285
void lecture_liens(med_idt fid, med_bool montage, int lecture_en_tete_seulement)
Definition mdump4.c:3228
const char *const * nommai
Definition mdump4.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 mdump4.c:1876
#define str(s)
Definition mdump4.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 mdump4.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 mdump4.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 mdump4.c:1046
const char *const MED23MESH_GET_FACE_GEOMETRY_TYPENAME[MED_N_FACE_FIXED_GEO+2]
void(* _myfuncptr)(const void *)
Definition mdump4.c:171
#define xstr(s)
Definition mdump4.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 mdump4.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 mdump4.c:1464
void lecture_en_tete(med_idt fid, char *fichier)
Definition mdump4.c:3445
void lecture_famille_maillage(med_idt fid, const char *const nommaa, med_int nfam)
Definition mdump4.c:202
#define MAX(a, b)
Definition mdump4.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 mdump4.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_ALL_DT
Definition med.h:309
#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
#define MED_ALL_IT
Definition med.h:310
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
#define MED_NULL
Definition med.h:75
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
MEDC_EXPORT const char *const MEDgetEntityTypeName(med_entity_type entitytype)
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