ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/acismesh/m3d_d_tetra.cpp
Revision: 1
Committed: Mon Jun 11 22:53:07 2007 UTC (17 years, 11 months ago)
File size: 4925 byte(s)
Log Message:

File Contents

# Content
1 /*****************************************************************
2
3 m3d_d_tetra.cpp Type:Func
4
5 Destruction d'un tetraedre
6
7 Date de creation : 24-8-1999 12 :5 :59
8 Derniere version : 24-8-1999 12 :5 :59
9
10 Vincent FRANCOIS
11
12 *****************************************************************/
13
14
15
16
17
18 /**************************/
19 /* include */
20 #include <stdio.h>
21 #include <string.h>
22 #include <stdlib.h>
23 #include <math.h>
24 #include "const.h"
25 #include "memoire.h"
26 #include "struct.h"
27 #include "struct3d.h"
28 #include "prototype.h"
29
30
31 /**************************/
32 /* variables globales */
33 extern struct environnment env;
34 extern struct s_mesh *mesh;
35
36 extern int test_front(void);
37
38 /**************************/
39 /* programme principal */
40
41
42 int m3d_d_tetra(struct s_front3d *ft,struct s_tetra *tetra)
43 {
44 struct s_tetra *tet;
45 struct s_triangle *tri;
46 struct s_front3d *ftn1,*tab_ft[20],*tab_ft2[20];
47 struct s_noeud *no;
48 int test;
49 int i,nb_tab,nb_tab2;
50
51 if (tetra==NULL)
52 {
53 if (ft->tri->type==FACE) return(NONVALIDE);
54 tet=ft->tri->tetra[0];
55 }
56 else tet=tetra;
57 if (tet->etat==INACTIF) return(VALIDE);
58 tet->etat=INACTIF;
59 nb_tab=0;
60 nb_tab2=0;
61 for (i=0;i<4;i++)
62 {
63 tri=tet->triangle[i];
64 if (tri->front==1)
65 {
66 ftn1=tri->ft;
67 tab_ft[nb_tab++]=ftn1->voisin[0].ft;
68 tab_ft[nb_tab++]=ftn1->voisin[1].ft;
69 tab_ft[nb_tab++]=ftn1->voisin[2].ft;
70 m3d_ac_front(&ftn1,DETRUIT);
71 tri->front=tri->front-2;
72 }
73 if (tri->front==2)
74 {
75 tri->front=tri->front-1;
76 m3d_ac_front(&ftn1,NEW);
77 ftn1->tri=tri;
78 ftn1->tri->front=1;
79 ftn1->tri->ft=ftn1;
80 if (i==0)
81 {
82 ftn1->n1=tet->n1;
83 ftn1->n2=tet->n2;
84 ftn1->n3=tet->n3;
85 }
86 if (i==1)
87 {
88 ftn1->n1=tet->n1;
89 ftn1->n2=tet->n4;
90 ftn1->n3=tet->n2;
91 }
92 if (i==2)
93 {
94 ftn1->n1=tet->n2;
95 ftn1->n2=tet->n4;
96 ftn1->n3=tet->n3;
97 }
98 if (i==3)
99 {
100 ftn1->n1=tet->n1;
101 ftn1->n2=tet->n3;
102 ftn1->n3=tet->n4;
103 }
104 m3d_ord_front(ftn1,PRIORITAIRE);
105 ftn1->etat=2;
106 if (ftn1->tri->tetra[0]==tet)
107 ftn1->tri->tetra[0]=ftn1->tri->tetra[1];
108 ftn1->tri->tetra[1]=NULL;
109 oc_ins_obj(FRONT3D,ftn1->num,mesh->first);
110 //m3d_update_front(&ftn1,NULL,tri,NEW);
111 tab_ft2[nb_tab2++]=ftn1;
112 }
113
114 }
115 for (i=0;i<nb_tab;i++)
116 if (tab_ft[i]->tri!=NULL) m3d_update_front(&(tab_ft[i]),NULL,NULL,LIAISON);
117 for (i=0;i<nb_tab2;i++)
118 {
119 m3d_update_front(&(tab_ft2[i]),NULL,NULL,LIAISON);
120 m3d_update_front(&(tab_ft2[i]->voisin[0].ft),NULL,NULL,LIAISON);
121 m3d_update_front(&(tab_ft2[i]->voisin[1].ft),NULL,NULL,LIAISON);
122 m3d_update_front(&(tab_ft2[i]->voisin[2].ft),NULL,NULL,LIAISON);
123 }
124 no=ADRESSE(tet->n1,noeud,mesh->);
125 test=False;
126 for (i=0;i<no->nb_tetra;i++)
127 if (no->tetra[i]->etat==ACTIF) test=True;
128 if (no->type!=BODY) test=True;
129 if (test==False)
130 no->etat=INACTIF;
131 no=ADRESSE(tet->n2,noeud,mesh->);
132 test=False;
133 for (i=0;i<no->nb_tetra;i++)
134 if (no->tetra[i]->etat==ACTIF) test=True;
135 if (no->type!=BODY) test=True;
136 if (test==False)
137 no->etat=INACTIF;
138 no=ADRESSE(tet->n3,noeud,mesh->);
139 test=False;
140 for (i=0;i<no->nb_tetra;i++)
141 if (no->tetra[i]->etat==ACTIF) test=True;
142 if (no->type!=BODY) test=True;
143 if (test==False)
144 no->etat=INACTIF;
145 no=ADRESSE(tet->n4,noeud,mesh->);
146 test=False;
147 for (i=0;i<no->nb_tetra;i++)
148 if (no->tetra[i]->etat==ACTIF) test=True;
149 if (no->type!=BODY) test=True;
150 if (test==False)
151 no->etat=INACTIF;
152 return(VALIDE);
153 }