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

File Contents

# Content
1 /*****************************************************************
2
3 o2d.c Type:Func
4
5 optimisation de maillage 2d
6
7 Date de creation : Tue May 27 09:54:25 1997
8
9 Derniere version : Tue May 27 09:54:25 1997
10
11
12
13
14
15
16
17 Vincent FRANCOIS
18
19 *****************************************************************/
20
21
22
23
24
25 /**************************/
26 /* include */
27 #include <stdio.h>
28 #include <string.h>
29 #include "const.h"
30 #include "struct.h"
31 #include "memoire.h"
32 #include "prototype.h"
33
34 /**************************/
35 /* variables globales */
36 extern struct environnement env;
37 extern struct s_mesh *mesh;
38
39
40
41 /**************************/
42 /* programme principal */
43
44 void o2d(struct s_face *face)
45 {
46 struct s_triangle *tri;
47 struct s_noeud *no[3];
48 float tab[4],x[4],y[4],z[4],u[4],v[4];
49 int ierr,fin,numero,i;
50
51 /* phase 1 : qualite croissante */
52 if (mesh->tete_triangle==NULL) return;
53 fin=0;
54 while (fin==0)
55 {
56 voir();
57 tri=mesh->tete_triangle;
58 if (tri->crit<env.opti*1./10)
59 {
60 no[0]=ADRESSE(tri->n1,noeud,mesh->);
61 no[1]=ADRESSE(tri->n2,noeud,mesh->);
62 no[2]=ADRESSE(tri->n3,noeud,mesh->);
63 ierr=o2d_opt_point(face,no[0],&tab[0],&u[0],&v[0],&x[0],&y[0],&z[0]);
64 if (ierr==0) tab[0]=0.;
65 ierr=o2d_opt_point(face,no[1],&tab[1],&u[1],&v[1],&x[1],&y[1],&z[1]);
66 if (ierr==0) tab[1]=0.;
67 ierr=o2d_opt_point(face,no[2],&tab[2],&u[2],&v[2],&x[2],&y[2],&z[2]);
68 if (ierr==0) tab[2]=0.;
69 MAXI(tab[3],tab[0],tab[1]);
70 MAXI(tab[3],tab[3],tab[2]);
71 if (tab[3]<tri->crit)
72 tri->opt=(-1);
73 else
74 {
75 if (tab[3]==tab[0]) numero=0;
76 if (tab[3]==tab[1]) numero=1;
77 if (tab[3]==tab[2]) numero=2;
78 tri->opt=1;
79 no[numero]->x=x[numero];
80 no[numero]->y=y[numero];
81 no[numero]->z=z[numero];
82 no[numero]->u=u[numero];
83 no[numero]->v=v[numero];
84 for (i=0;i<no[numero]->nb_triangle;i++)
85 no[numero]->triangle[i]->crit=m2d_cal_qual(no[numero]->triangle[i]->n1,no[numero]->triangle[i]->n2,no[numero]->triangle[i]->n3);
86 }
87 }
88 mesh->tete_triangle=tri->suivant;
89 if (mesh->tete_triangle==NULL) fin=1;
90 else
91 {
92 tri->suivant->precedent=NULL;
93 tri->suivant=NULL;
94 }
95 o2d_ord_tri2(tri);
96 }
97 /* phase 2 : qualite decroissante */
98 fin=0;
99 while (fin==0)
100 {
101 voir();
102 tri=mesh->tete_triangle2;
103 if (tri->crit<env.opti*1./10)
104 {
105 no[0]=ADRESSE(tri->n1,noeud,mesh->);
106 no[1]=ADRESSE(tri->n2,noeud,mesh->);
107 no[2]=ADRESSE(tri->n3,noeud,mesh->);
108 ierr=o2d_opt_point(face,no[0],&tab[0],&u[0],&v[0],&x[0],&y[0],&z[0]);
109 if (ierr==0) tab[0]=0.;
110 ierr=o2d_opt_point(face,no[1],&tab[1],&u[1],&v[1],&x[1],&y[1],&z[1]);
111 if (ierr==0) tab[1]=0.;
112 ierr=o2d_opt_point(face,no[2],&tab[2],&u[2],&v[2],&x[2],&y[2],&z[2]);
113 if (ierr==0) tab[2]=0.;
114 MAXI(tab[3],tab[0],tab[1]);
115 MAXI(tab[3],tab[3],tab[2]);
116 if (tab[3]<tri->crit)
117 tri->opt=(-1);
118 else
119 {
120 if (tab[3]==tab[0]) numero=0;
121 if (tab[3]==tab[1]) numero=1;
122 if (tab[3]==tab[2]) numero=2;
123 tri->opt=1;
124 no[numero]->x=x[numero];
125 no[numero]->y=y[numero];
126 no[numero]->z=z[numero];
127 no[numero]->u=u[numero];
128 no[numero]->v=v[numero];
129 for (i=0;i<no[numero]->nb_triangle;i++)
130 no[numero]->triangle[i]->crit=m2d_cal_qual(no[numero]->triangle[i]->n1,no[numero]->triangle[i]->n2,no[numero]->triangle[i]->n3);
131 }
132 }
133 mesh->tete_triangle2=tri->suivant;
134 if (mesh->tete_triangle2==NULL) fin=1;
135 else
136 {
137 tri->suivant->precedent=NULL;
138 tri->suivant=NULL;
139 }
140 }
141 }