1 |
/*****************************************************************
|
2 |
|
3 |
m1d_enreg.c Type:Func
|
4 |
|
5 |
Enregistrement du maillage lineique
|
6 |
|
7 |
Date de creation : Wed Nov 27 11:17:56 1996
|
8 |
|
9 |
Derniere version : Tue Apr 22 11:50:53 1997
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
Vincent FRANCOIS
|
15 |
|
16 |
*****************************************************************/
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
/**************************/
|
23 |
/* include */
|
24 |
#include <stdio.h>
|
25 |
#include <string.h>
|
26 |
#include "const.h"
|
27 |
#include "struct.h"
|
28 |
#include "memoire.h"
|
29 |
#include "prototype.h"
|
30 |
|
31 |
/**************************/
|
32 |
/* variables globales */
|
33 |
extern struct s_mesh *mesh;
|
34 |
extern struct environnement env;
|
35 |
|
36 |
|
37 |
|
38 |
/**************************/
|
39 |
/* programme principal */
|
40 |
|
41 |
void m1d_enreg(void)
|
42 |
{
|
43 |
FILE *fic;
|
44 |
int i;
|
45 |
struct s_noeud *no;
|
46 |
struct s_segment *seg;
|
47 |
char string[255];
|
48 |
|
49 |
strcpy(string,env.fich);
|
50 |
string[strlen(string)-4]=0;
|
51 |
strcat(string,"_1D.mai");
|
52 |
fic=fopen(string,"wt");
|
53 |
fprintf(fic,"%d %d \n",mesh->nb_noeud,mesh->nb_segment);
|
54 |
for (i=0;i<mesh->nb_noeud;i++)
|
55 |
{
|
56 |
no=ADRESSE(i,noeud,mesh->);
|
57 |
if (no->type==VERTEX) strcpy(string,"vertex");
|
58 |
if (no->type==EDGE) strcpy(string,"edge");
|
59 |
if (no->type==FACE) strcpy(string,"face");
|
60 |
fprintf(fic,"%d %f %f %f %s %d %f\n",i+1,no->x,no->y,no->z,string,no->num_ent,no->dens);
|
61 |
}
|
62 |
for (i=0;i<mesh->nb_segment;i++)
|
63 |
{
|
64 |
seg=ADRESSE(i,segment,mesh->);
|
65 |
if (no->type==EDGE) strcpy(string,"edge");
|
66 |
if (no->type==FACE) strcpy(string,"face");
|
67 |
fprintf(fic,"2 %d %d %s %d\n",seg->n1+1,seg->n2+1,string,seg->num_ent);
|
68 |
}
|
69 |
fclose(fic);
|
70 |
}
|