1 |
|
5 |
/* 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 |
|
|
|
10 |
|
|
extern GEST_MEM *gest ;
|
11 |
|
|
extern int debug ;
|
12 |
|
|
void m3d_wstar(int nb_noeud,int nb_tetra_cree,float *coord,int *numele,int *ierr)
|
13 |
|
|
{
|
14 |
|
|
FILE *output ;
|
15 |
|
|
char *ext_noe, *ext_mai ;
|
16 |
|
|
char temp[MAX_LINE] ;
|
17 |
|
|
int i, j, nb, type ;
|
18 |
|
|
float *coord2 ;
|
19 |
|
|
int *old, *neww ,ok, nb_cree ;
|
20 |
|
|
int j1,j2,j3,j4 ;
|
21 |
|
|
|
22 |
|
|
neww = gest->neww ;
|
23 |
|
|
old = gest->old ;
|
24 |
|
|
coord2 = gest->coord2 ;
|
25 |
|
|
if (gest->is_qua == VRAI)
|
26 |
|
|
{
|
27 |
|
|
if (debug) printf(" Pas de mailles quadratiques pour starcd M3DWRI\n") ;
|
28 |
|
|
*ierr = VRAI ;
|
29 |
|
|
return ;
|
30 |
|
|
}
|
31 |
|
|
/* pas de mailles quadratiques */
|
32 |
francois |
272 |
ext_noe = (char*)EXT_OUT_NOE_STAR ;
|
33 |
|
|
ext_mai = (char*)EXT_OUT_ELE_STAR ;
|
34 |
|
5 |
/* ecriture du _3D.STARNOE */
|
35 |
|
|
temp[0] = 0 ;
|
36 |
|
|
strcpy(temp,gest->name) ;
|
37 |
|
|
strncat(temp,ext_noe,11) ;
|
38 |
|
|
if ( (output = fopen(temp,"w")) == NULL)
|
39 |
|
|
{
|
40 |
|
|
if (debug) printf(" Erreur ouverture du fichier resultat M3DWRI\n") ;
|
41 |
|
|
*ierr = VRAI ;
|
42 |
|
|
return ;
|
43 |
|
|
}
|
44 |
|
|
/* peau */
|
45 |
|
|
for (i=0;i<gest->nb_init;i++)
|
46 |
|
|
fprintf(output,"%7d%16f%16f%16f\n",gest->tabcor[i+1],coord[x(i)],coord[y(i)],coord[z(i)]) ;
|
47 |
|
|
for (i=gest->nb_init;i<nb_noeud;i++)
|
48 |
|
|
fprintf(output,"%7d%16f%16f%16f\n",gest->numax+i+1-(gest->nb_init),coord[x(i)],coord[y(i)],coord[z(i)]) ;
|
49 |
|
|
fclose(output) ;
|
50 |
|
|
/* ecriture du _3D.STARELE */
|
51 |
|
|
temp[0] = 0 ;
|
52 |
|
|
strcpy(temp,gest->name) ;
|
53 |
|
|
strncat(temp,ext_mai,11) ;
|
54 |
|
|
if ( (output = fopen(temp,"w")) == NULL)
|
55 |
|
|
{
|
56 |
|
|
if (debug) printf(" Erreur ouverture du fichier resultat M3DWRI\n") ;
|
57 |
|
|
m3d_erreur(ERR_OPEN);
|
58 |
|
|
*ierr = VRAI ;
|
59 |
|
|
return ;
|
60 |
|
|
}
|
61 |
|
|
/* ecriture des elements */
|
62 |
|
|
j = 0 ;
|
63 |
|
|
nb = 0 ;
|
64 |
|
|
while (nb<nb_tetra_cree)
|
65 |
|
|
{
|
66 |
|
|
if (numele[4 * j] !=123456789)
|
67 |
|
|
{
|
68 |
|
|
nb++ ;
|
69 |
|
|
if (numele[4*j]<gest->nb_init) j1 = gest->tabcor[(numele[4*j])+1] ;
|
70 |
|
|
else j1 = (numele[4*j])+1 + gest->numax - gest->nb_init ;/* noeud genere */
|
71 |
|
|
|
72 |
|
|
if (numele[4*j+1]<gest->nb_init) j2 = gest->tabcor[(numele[4*j+1])+1] ;
|
73 |
|
|
else j2 = (numele[4*j+1])+1 + gest->numax - gest->nb_init ;/* noeud genere */
|
74 |
|
|
|
75 |
|
|
if (numele[4*j+2]<gest->nb_init) j3 = gest->tabcor[(numele[4*j+2])+1] ;
|
76 |
|
|
else j3 = (numele[4*j+2])+1 + gest->numax - gest->nb_init ;/* noeud genere */
|
77 |
|
|
|
78 |
|
|
if (numele[4*j+3]<gest->nb_init) j4 = gest->tabcor[(numele[4*j+3])+1] ;
|
79 |
|
|
else j4 = (numele[4*j+3])+1 + gest->numax - gest->nb_init ;/* noeud genere */
|
80 |
|
|
fprintf(output,"%7d %7d%7d%7d%7d%7d%7d%7d%7d%7d\n",nb,j1,j2,j3,j3,j4,j4,j4,j4,1) ;
|
81 |
|
|
}
|
82 |
|
|
j ++ ;
|
83 |
|
|
}
|
84 |
|
|
fclose(output) ;
|
85 |
|
|
return ;
|
86 |
|
|
}
|