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 char ext_out[MAX_LINE] ; |
12 |
|
|
void m3d_wacsis(int nb_noeud,int nb_tetra_cree,float *coord,int *numele,int *ierr) |
13 |
|
|
{ |
14 |
|
|
FILE *output ; |
15 |
|
|
char temp[MAX_LINE] ; |
16 |
|
|
int i, j ; |
17 |
|
|
int nb ; |
18 |
|
|
int j1,j2,j3,j4; |
19 |
|
|
|
20 |
|
|
temp[0] = 0 ; |
21 |
|
|
strcpy(temp,gest->name); |
22 |
|
|
temp[strlen(temp)-2]='3'; |
23 |
|
|
strcat(temp,".") ; |
24 |
|
|
strcat(temp,gest->extension) ; |
25 |
|
|
/* ouverture du fichier */ |
26 |
|
|
if ( (output = fopen(temp,"w")) == NULL) |
27 |
|
|
{ |
28 |
|
|
m3d_erreur(ERR_OPEN_RESU) ; |
29 |
|
|
*ierr = VRAI ; |
30 |
|
|
return ; |
31 |
|
|
} |
32 |
|
|
if (gest->is_qua == FAUX)/* mailles lineaires */ |
33 |
|
|
{ |
34 |
|
|
fprintf(output,"%10d %10d\n",nb_noeud,nb_tetra_cree) ; |
35 |
|
|
/* noeuds de la peau */ |
36 |
|
|
for (i=0;i<gest->nb_init;i++) |
37 |
|
|
fprintf(output,"%5d %16f %16f %16f\n",gest->tabcor[i+1],coord[x(i)],coord[y(i)],coord[z(i)]) ; |
38 |
|
|
for (i=gest->nb_init;i<nb_noeud;i++) fprintf(output,"%5d %16f %16f %16f\n",i+1,coord[x(i)],coord[y(i)],coord[z(i)]) ; |
39 |
|
|
nb = 0 ; |
40 |
|
|
j = 0 ; |
41 |
|
|
while (nb<nb_tetra_cree) |
42 |
|
|
{ |
43 |
|
|
if (numele[4 * j] !=123456789) |
44 |
|
|
{ |
45 |
|
|
nb++ ; |
46 |
|
|
/* noeud de la peau */ |
47 |
|
|
if (numele[4*j]<gest->nb_init) j1 = gest->tabcor[(numele[4*j])+1] ; |
48 |
|
|
else j1 = (numele[4*j])+1 ;/* noeud genere */ |
49 |
|
|
|
50 |
|
|
if (numele[4*j+1]<gest->nb_init) j2 = gest->tabcor[(numele[4*j+1])+1] ; |
51 |
|
|
else j2 = (numele[4*j+1])+1 ;/* noeud genere */ |
52 |
|
|
|
53 |
|
|
if (numele[4*j+2]<gest->nb_init) j3 = gest->tabcor[(numele[4*j+2])+1] ; |
54 |
|
|
else j3 = (numele[4*j+2])+1;/* noeud genere */ |
55 |
|
|
|
56 |
|
|
if (numele[4*j+3]<gest->nb_init) j4 = gest->tabcor[(numele[4*j+3])+1] ; |
57 |
|
|
else j4 = (numele[4*j+3])+1 ;/* noeud genere */ |
58 |
|
|
fprintf(output,"%5d %5d %5d %5d %5d\n",4,j1,j2,j3,j4) ; |
59 |
|
|
} |
60 |
|
|
j ++ ; |
61 |
|
|
} |
62 |
|
|
|
63 |
|
|
|
64 |
|
|
fclose(output) ; |
65 |
|
|
|
66 |
|
|
return ; |
67 |
|
|
} |
68 |
|
|
|
69 |
|
|
return ; |
70 |
|
|
} |
71 |
|
|
|
72 |
|
|
|