1 |
francois |
283 |
/* ecriture des fichiers */ |
2 |
|
|
#include <stdio.h> |
3 |
|
|
#include <string.h> |
4 |
|
|
#include "m3d_const.h" |
5 |
|
|
#include "m3d_hotes.h" |
6 |
|
|
#include "m3d_struct.h" |
7 |
|
|
#include "m3d_erreur.h" |
8 |
|
|
#include "prototype.h" |
9 |
|
|
extern GEST_MEM *gest ; |
10 |
|
|
extern int debug ; |
11 |
|
|
extern int recover ; |
12 |
|
|
void m3d_wsysmesh(int nb_noeud,int nb_tetra_cree,float *coord,int *numele,int *ierr) |
13 |
|
|
{ |
14 |
|
|
FILE *output ; |
15 |
|
|
char *ext_mai ; |
16 |
|
|
char temp[MAX_LINE] ; |
17 |
|
|
int i, nb_cree ; |
18 |
|
|
|
19 |
|
|
ext_mai = (char*)EXT_RECOVER ; |
20 |
|
|
temp[0] = 0 ; |
21 |
|
|
strcpy(temp,gest->name) ; |
22 |
|
|
strncat(temp,ext_mai,4) ; |
23 |
|
|
/* ouverture du fichier */ |
24 |
|
|
if ( (output = fopen(temp,"w")) == NULL) |
25 |
|
|
{ |
26 |
|
|
m3d_erreur(ERR_FIN); |
27 |
|
|
*ierr = VRAI ; |
28 |
|
|
return ; |
29 |
|
|
} |
30 |
|
|
nb_cree = 0 ;/* nombre d'elements */ |
31 |
|
|
for (i=0;i<gest->nb_tetra;i++) |
32 |
|
|
if (numele[4*i]!=123456789) nb_cree++ ; |
33 |
|
|
fprintf(output,"%6d%6d\n",gest->nb_noeud,nb_cree) ; |
34 |
|
|
/* elements */ |
35 |
|
|
for (i=0;i<gest->nb_tetra;i++) |
36 |
|
|
if (numele[4*i]!=123456789) fprintf(output,"%6d%6d%6d%6d\n",numele[4*i],numele[4*i+1],numele[4*i+2],numele[4*i+3]) ; |
37 |
|
|
/* coordonnees */ |
38 |
|
|
for (i=0;i<gest->nb_noeud;i++) |
39 |
|
|
fprintf(output,"%6d%16f%16f%16f\n",i,coord[x(i)],coord[y(i)],coord[z(i)]) ; |
40 |
|
|
|
41 |
|
|
fclose(output) ; |
42 |
|
|
return ; |
43 |
|
|
} |