1 |
|
1 |
/*****************************************************************
|
2 |
|
|
|
3 |
|
|
r3d_gene_triangle.c Type:Func
|
4 |
|
|
|
5 |
|
|
Generation des mailles 2D
|
6 |
|
|
|
7 |
|
|
Date de creation : Fri Aug 1 10:30:39 1997
|
8 |
|
|
|
9 |
|
|
Derniere version : Tue Aug 5 14:29:57 1997
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
Vincent FRANCOIS
|
14 |
|
|
|
15 |
|
|
*****************************************************************/
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
/**************************/
|
22 |
|
|
/* include */
|
23 |
|
|
#include <stdio.h>
|
24 |
|
|
#include <string.h>
|
25 |
|
|
#include <stdlib.h>
|
26 |
|
|
#include "const.h"
|
27 |
|
|
#include "memoire.h"
|
28 |
|
|
#include "struct.h"
|
29 |
|
|
#include "prototype.h"
|
30 |
|
|
|
31 |
|
|
/**************************/
|
32 |
|
|
/* variables globales */
|
33 |
|
|
extern struct environnement env;
|
34 |
|
|
extern struct s_mesh *mesh;
|
35 |
|
|
extern struct s_maillage *maillage;
|
36 |
|
|
extern struct s_acis *acis;
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
/**************************/
|
41 |
|
|
/* programme principal */
|
42 |
|
|
|
43 |
|
|
void r3d_gene_triangle(void)
|
44 |
|
|
{
|
45 |
|
|
int i,num,j,k,l;
|
46 |
|
|
int nb_place;
|
47 |
|
|
struct s_mnoeud *mno1,*mno2,*mno3,*mno;
|
48 |
|
|
struct s_mtriangle *mtri,*mtri2;
|
49 |
|
|
struct s_mfacette *mfa,*mfacette;
|
50 |
|
|
|
51 |
|
|
mfacette=(struct s_mfacette *)calloc(acis->nb_entity,sizeof(struct s_mfacette));
|
52 |
|
|
ERREUR_ALLOC(mfacette);
|
53 |
|
|
for (i=0;i<maillage->nb_mtriangle;i++)
|
54 |
|
|
{
|
55 |
|
|
mtri=ADRESSE(i,mtriangle,maillage->);
|
56 |
|
|
mno1=ADRESSE(mtri->n1,mnoeud,maillage->);
|
57 |
|
|
mno2=ADRESSE(mtri->n2,mnoeud,maillage->);
|
58 |
|
|
mno3=ADRESSE(mtri->n3,mnoeud,maillage->);
|
59 |
|
|
if ((mno1->etat==GARDE)&&(mno2->etat==GARDE)&&(mno3->etat==GARDE))
|
60 |
|
|
{
|
61 |
|
|
NEW_POINTEUR(num,mtriangle,(mfacette+mtri->num_ent)->);
|
62 |
|
|
(mfacette+mtri->num_ent)->mtriangle[num]=mtri;
|
63 |
|
|
mtri->mfacette=mfacette+mtri->num_ent;
|
64 |
|
|
}
|
65 |
|
|
}
|
66 |
|
|
/* separation des facettes */
|
67 |
|
|
for (i=0;i<acis->nb_entity;i++)
|
68 |
|
|
if ((mfacette+i)->nb_mtriangle!=0)
|
69 |
|
|
{
|
70 |
|
|
nb_place=0;
|
71 |
|
|
while (nb_place!=(mfacette+i)->nb_mtriangle)
|
72 |
|
|
{
|
73 |
|
|
j=0;
|
74 |
|
|
while ((mfacette+i)->mtriangle[j]->mfacette!=(mfacette+i)) j++;
|
75 |
|
|
mtri=(mfacette+i)->mtriangle[j];
|
76 |
|
|
NEW_ENTITE(mfa,mfacette,maillage->);
|
77 |
|
|
mfa->num=maillage->nb_mfacette-1;
|
78 |
|
|
NEW_POINTEUR(num,mtriangle,mfa->);
|
79 |
|
|
mfa->mtriangle[num]=mtri;
|
80 |
|
|
mtri->mfacette=mfa;
|
81 |
|
|
nb_place++;
|
82 |
|
|
for (k=0;k<mfa->nb_mtriangle;k++)
|
83 |
|
|
{
|
84 |
|
|
mtri=mfa->mtriangle[k];
|
85 |
|
|
mno=ADRESSE(mtri->n1,mnoeud,maillage->);
|
86 |
|
|
for (l=0;l<mno->nb_mtriangle;l++)
|
87 |
|
|
{
|
88 |
|
|
mtri2=mno->mtriangle[l];
|
89 |
|
|
if (mtri2->mfacette==(mfacette+i))
|
90 |
|
|
{
|
91 |
|
|
NEW_POINTEUR(num,mtriangle,mfa->);
|
92 |
|
|
mfa->mtriangle[num]=mtri2;
|
93 |
|
|
mtri2->mfacette=mfa;
|
94 |
|
|
nb_place++;
|
95 |
|
|
}
|
96 |
|
|
}
|
97 |
|
|
mno=ADRESSE(mtri->n2,mnoeud,maillage->);
|
98 |
|
|
for (l=0;l<mno->nb_mtriangle;l++)
|
99 |
|
|
{
|
100 |
|
|
mtri2=mno->mtriangle[l];
|
101 |
|
|
if (mtri2->mfacette==(mfacette+i))
|
102 |
|
|
{
|
103 |
|
|
NEW_POINTEUR(num,mtriangle,mfa->);
|
104 |
|
|
mfa->mtriangle[num]=mtri2;
|
105 |
|
|
mtri2->mfacette=mfa;
|
106 |
|
|
nb_place++;
|
107 |
|
|
}
|
108 |
|
|
}
|
109 |
|
|
mno=ADRESSE(mtri->n3,mnoeud,maillage->);
|
110 |
|
|
for (l=0;l<mno->nb_mtriangle;l++)
|
111 |
|
|
{
|
112 |
|
|
mtri2=mno->mtriangle[l];
|
113 |
|
|
if (mtri2->mfacette==(mfacette+i))
|
114 |
|
|
{
|
115 |
|
|
NEW_POINTEUR(num,mtriangle,mfa->);
|
116 |
|
|
mfa->mtriangle[num]=mtri2;
|
117 |
|
|
mtri2->mfacette=mfa;
|
118 |
|
|
nb_place++;
|
119 |
|
|
}
|
120 |
|
|
}
|
121 |
|
|
|
122 |
|
|
}
|
123 |
|
|
}
|
124 |
|
|
}
|
125 |
|
|
free(mfacette);
|
126 |
|
|
}
|