1 |
|
1 |
/*****************************************************************
|
2 |
|
|
|
3 |
|
|
m2d.c Type:Func
|
4 |
|
|
|
5 |
|
|
Maillage surfacique
|
6 |
|
|
|
7 |
|
|
Date de creation : Tue Jan 14 14:50:33 1997
|
8 |
|
|
|
9 |
|
|
Derniere version : Tue Jul 29 11:22:27 1997
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
Vincent FRANCOIS
|
16 |
|
|
|
17 |
|
|
*****************************************************************/
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
/**************************/
|
24 |
|
|
/* include */
|
25 |
|
|
#include <stdio.h>
|
26 |
|
|
#include <string.h>
|
27 |
|
|
#include <stdlib.h>
|
28 |
|
|
#include "const.h"
|
29 |
|
|
#include "memoire.h"
|
30 |
|
|
#include "struct.h"
|
31 |
|
|
#include "prototype.h"
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
/**************************/
|
35 |
|
|
/* variables globales */
|
36 |
|
|
extern struct s_acis *acis;
|
37 |
|
|
extern struct environnement env;
|
38 |
|
|
extern struct s_mesh *mesh;
|
39 |
|
|
extern struct s_param *para;
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
/**************************/
|
44 |
|
|
/* programme principal */
|
45 |
|
|
|
46 |
|
|
void m2d(void)
|
47 |
|
|
{
|
48 |
|
|
struct s_face *face;
|
49 |
|
|
struct s_cone *cone;
|
50 |
|
|
struct s_plane *plane;
|
51 |
|
|
struct s_quadtree *quadtree;
|
52 |
|
|
int i,j,nb_tri;
|
53 |
|
|
char message[255];
|
54 |
|
|
|
55 |
|
|
/* parametrisation d abord pour etude interference des surface */
|
56 |
|
|
aff_text(M2D_FACE);
|
57 |
|
|
for (j=0;j<acis->nb_face;j++)
|
58 |
|
|
{
|
59 |
|
|
face=ADRESSE(j,face,acis->);
|
60 |
|
|
/* phase 1 parametrisation des surface */
|
61 |
|
|
if (strcmp(acis->type_entite[face->surface],"cone-surface")==0)
|
62 |
|
|
{
|
63 |
|
|
cone=(struct s_cone *)acis->entity[face->surface];
|
64 |
|
|
m2d_param_cone(face,cone);
|
65 |
|
|
}
|
66 |
|
|
if (strcmp(acis->type_entite[face->surface],"plane-surface")==0)
|
67 |
|
|
{
|
68 |
|
|
plane=(struct s_plane *)acis->entity[face->surface];
|
69 |
|
|
m2d_param_plane(face,plane);
|
70 |
|
|
}
|
71 |
|
|
}
|
72 |
|
|
for (j=0;j<acis->nb_face;j++)
|
73 |
|
|
{
|
74 |
|
|
/* phase 2 constitution des frontieres */
|
75 |
|
|
face=ADRESSE(j,face,acis->);
|
76 |
|
|
if (face->sense==FORWARD) sprintf(message,M2D_FA_DI,j,face->num);
|
77 |
|
|
else sprintf(message,M2D_FA_IN,j,face->num);
|
78 |
|
|
nb_tri=mesh->nb_triangle;
|
79 |
|
|
aff_text(message);
|
80 |
|
|
aff_text(M2D_AC1);
|
81 |
|
|
NEW_ALLOC(frontiere,mesh->);
|
82 |
|
|
NEW_ALLOC(quadtree,mesh->);
|
83 |
|
|
NEW_ALLOC(front,mesh->);
|
84 |
|
|
m2d_frontiere(face);
|
85 |
|
|
/* phase 3 creation de la grille */
|
86 |
|
|
m2d_c_quad(face,face->rev_u,face->rev_v);
|
87 |
|
|
/* phase 4 initialisation du front */
|
88 |
|
|
m2d_ini_front(face);
|
89 |
|
|
/* phase 5 maillage */
|
90 |
|
|
mesh->tete_triangle=NULL;
|
91 |
|
|
m2d_gest_front(face);
|
92 |
|
|
/* phase 6 optimisation de maillage */
|
93 |
|
|
sprintf(message,M2D_AC2,env.opti);
|
94 |
|
|
aff_text(message);
|
95 |
|
|
o2d(face);
|
96 |
|
|
/* analyse de densite */
|
97 |
|
|
if (env.analyse==1)
|
98 |
|
|
{
|
99 |
|
|
aff_text(M2D_AC3);
|
100 |
|
|
m2d_ana_dens(face,nb_tri,mesh->nb_triangle);
|
101 |
|
|
}
|
102 |
|
|
/* fin */
|
103 |
|
|
mesh->nb_front=mesh->nb_front_tot;
|
104 |
|
|
LIBERE_LIEN(noeud,quadtree,mesh->);
|
105 |
|
|
LIBERE_LIEN(segment,quadtree,mesh->);
|
106 |
|
|
LIBERE_LIEN(triangle,quadtree,mesh->);
|
107 |
|
|
LIBERE_LIEN(frontiere,quadtree,mesh->);
|
108 |
|
|
LIBERE_LIEN(front,quadtree,mesh->);
|
109 |
|
|
LIBERE(quadtree,mesh->);
|
110 |
|
|
LIBERE(frontiere,mesh->);
|
111 |
|
|
LIBERE(front,mesh->);
|
112 |
|
|
mesh->tete_front=NULL;
|
113 |
|
|
mesh->vide_front=NULL;
|
114 |
|
|
mesh->nb_front_tot=0;
|
115 |
|
|
m2d_enreg();
|
116 |
|
|
}
|
117 |
|
|
/*m2d_resultat(1);*/
|
118 |
|
|
m2d_fin();
|
119 |
|
|
m2d_resultat(2);
|
120 |
|
|
}
|