1 |
|
5 |
//------------------------------------------------------------
|
2 |
|
|
//------------------------------------------------------------
|
3 |
|
|
// MAGiC
|
4 |
|
|
// Jean Christophe Cuillière et Vincent FRANCOIS
|
5 |
|
|
// Département de Génie Mécanique - UQTR
|
6 |
|
|
//------------------------------------------------------------
|
7 |
|
|
// Le projet MAGIC est un projet de recherche du département
|
8 |
|
|
// de génie mécanique de l'Université du Québec à
|
9 |
|
|
// Trois Rivières
|
10 |
|
|
// Les librairies ne peuvent être utilisées sans l'accord
|
11 |
|
|
// des auteurs (contact : francois@uqtr.ca)
|
12 |
|
|
//------------------------------------------------------------
|
13 |
|
|
//------------------------------------------------------------
|
14 |
|
|
//
|
15 |
|
|
// veriwin.cpp
|
16 |
|
|
//
|
17 |
|
|
//------------------------------------------------------------
|
18 |
|
|
//------------------------------------------------------------
|
19 |
|
|
// COPYRIGHT 2000
|
20 |
|
|
// Version du 02/03/2006 à 11H26
|
21 |
|
|
//------------------------------------------------------------
|
22 |
|
|
//------------------------------------------------------------
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
#include "gestionversion.h"
|
26 |
|
|
|
27 |
|
|
#include <vcl.h>
|
28 |
|
|
#pragma hdrstop
|
29 |
|
|
|
30 |
|
|
#include "veriwin.h"
|
31 |
|
|
#include "visugraph.h"
|
32 |
|
|
#include "main.h"
|
33 |
|
|
//---------------------------------------------------------------------------
|
34 |
|
|
#pragma package(smart_init)
|
35 |
|
|
#pragma resource "*.dfm"
|
36 |
|
|
Tverimesh *verimesh;
|
37 |
|
|
//---------------------------------------------------------------------------
|
38 |
|
|
__fastcall Tverimesh::Tverimesh(TComponent* Owner,MG_GESTIONNAIRE& gesttmp,BOITE_3D& b,TVisuWinform& form)
|
39 |
|
|
: TForm(Owner),gest(gesttmp),boite(b),visuform(form)
|
40 |
|
|
{
|
41 |
|
|
}
|
42 |
|
|
//---------------------------------------------------------------------------
|
43 |
|
|
void __fastcall Tverimesh::FormClose(TObject *Sender, TCloseAction &Action)
|
44 |
|
|
{
|
45 |
|
|
Action=caFree;
|
46 |
|
|
}
|
47 |
|
|
//---------------------------------------------------------------------------
|
48 |
|
|
void __fastcall Tverimesh::Button1Click(TObject *Sender)
|
49 |
|
|
{
|
50 |
|
|
Close();
|
51 |
|
|
}
|
52 |
|
|
//---------------------------------------------------------------------------
|
53 |
|
|
void __fastcall Tverimesh::ListBox1Click(TObject *Sender)
|
54 |
|
|
{
|
55 |
|
|
if (ListBox1->ItemIndex==(-1)) return;
|
56 |
|
|
char chaine[255];
|
57 |
|
|
ListBox2->Clear();
|
58 |
|
|
if (ListBox1->ItemIndex==0)
|
59 |
|
|
{
|
60 |
|
|
Edit1->Text="";
|
61 |
|
|
Edit2->Text="";
|
62 |
|
|
Edit3->Text="";
|
63 |
|
|
Edit4->Text="";
|
64 |
|
|
sprintf(chaine,"%.8f",boite.get_xmin());
|
65 |
|
|
Edit5->Text=chaine;
|
66 |
|
|
sprintf(chaine,"%.8f",boite.get_ymin());
|
67 |
|
|
Edit6->Text=chaine;
|
68 |
|
|
sprintf(chaine,"%.8f",boite.get_zmin());
|
69 |
|
|
Edit7->Text=chaine;
|
70 |
|
|
sprintf(chaine,"%.8f",boite.get_xmax());
|
71 |
|
|
Edit10->Text=chaine;
|
72 |
|
|
sprintf(chaine,"%.8f",boite.get_ymax());
|
73 |
|
|
Edit9->Text=chaine;
|
74 |
|
|
sprintf(chaine,"%.8f",boite.get_zmax());
|
75 |
|
|
Edit11->Text=chaine;
|
76 |
|
|
sprintf(chaine,"%.8f",boite.get_xcentre());
|
77 |
|
|
Edit16->Text=chaine;
|
78 |
|
|
sprintf(chaine,"%.8f",boite.get_ycentre());
|
79 |
|
|
Edit15->Text=chaine;
|
80 |
|
|
sprintf(chaine,"%.8f",boite.get_zcentre());
|
81 |
|
|
Edit14->Text=chaine;
|
82 |
|
|
return;
|
83 |
|
|
}
|
84 |
|
|
|
85 |
|
|
long id=atol(ListBox1->Items->Strings[ListBox1->ItemIndex].c_str());
|
86 |
|
|
MG_MAILLAGE* mgmai=gest.get_mg_maillageid(id);
|
87 |
|
|
FEM_MAILLAGE* femmai=gest.get_fem_maillageid(id);
|
88 |
|
|
if (mgmai!=NULL)
|
89 |
|
|
{
|
90 |
|
|
Edit1->Text=mgmai->get_nb_mg_noeud();
|
91 |
|
|
int nbseg=0;
|
92 |
|
|
LISTE_MG_SEGMENT::iterator it;
|
93 |
|
|
MG_SEGMENT* seg=mgmai->get_premier_segment(it);
|
94 |
|
|
while (seg!=NULL)
|
95 |
|
|
{
|
96 |
|
|
if (seg->get_lien_topologie()!=NULL)
|
97 |
|
|
if (seg->get_lien_topologie()->get_dimension()==1) nbseg++;
|
98 |
|
|
seg=mgmai->get_suivant_segment(it);
|
99 |
|
|
}
|
100 |
|
|
int nbtri=0;
|
101 |
|
|
LISTE_MG_TRIANGLE::iterator it2;
|
102 |
|
|
MG_TRIANGLE* tri=mgmai->get_premier_triangle(it2);
|
103 |
|
|
while (tri!=NULL)
|
104 |
|
|
{
|
105 |
|
|
if (tri->get_lien_topologie()!=NULL)
|
106 |
|
|
if (tri->get_lien_topologie()->get_dimension()==2) nbtri++;
|
107 |
|
|
tri=mgmai->get_suivant_triangle(it2);
|
108 |
|
|
}
|
109 |
|
|
Edit2->Text=nbseg;
|
110 |
|
|
Edit3->Text=nbtri;
|
111 |
|
|
Edit4->Text=mgmai->get_nb_mg_tetra();
|
112 |
|
|
double xmin,ymin,zmin;
|
113 |
|
|
double xmax,ymax,zmax;
|
114 |
|
|
double xmoy,ymoy,zmoy;
|
115 |
|
|
LISTE_MG_NOEUD::iterator it3;
|
116 |
|
|
MG_NOEUD* mgnoeud=mgmai->get_premier_noeud(it3);
|
117 |
|
|
double* xyz;
|
118 |
|
|
xyz=mgnoeud->get_coord();
|
119 |
|
|
xmin=xyz[0];xmax=xyz[0];xmoy=xyz[0];
|
120 |
|
|
ymin=xyz[1];ymax=xyz[1];ymoy=xyz[1];
|
121 |
|
|
zmin=xyz[2];zmax=xyz[2];zmoy=xyz[2];
|
122 |
|
|
mgnoeud=mgmai->get_suivant_noeud(it3);
|
123 |
|
|
int nbnoeud=mgmai->get_nb_mg_noeud();
|
124 |
|
|
while (mgnoeud!=NULL)
|
125 |
|
|
{
|
126 |
|
|
xyz=mgnoeud->get_coord();
|
127 |
|
|
if (xyz[0]<xmin) xmin=xyz[0];
|
128 |
|
|
if (xyz[1]<ymin) ymin=xyz[1];
|
129 |
|
|
if (xyz[2]<zmin) zmin=xyz[2];
|
130 |
|
|
if (xyz[0]>xmax) xmax=xyz[0];
|
131 |
|
|
if (xyz[1]>ymax) ymax=xyz[1];
|
132 |
|
|
if (xyz[2]>zmax) zmax=xyz[2];
|
133 |
|
|
xmoy=xmoy+xyz[0];
|
134 |
|
|
ymoy=ymoy+xyz[1];
|
135 |
|
|
zmoy=zmoy+xyz[2];
|
136 |
|
|
mgnoeud=mgmai->get_suivant_noeud(it3);
|
137 |
|
|
}
|
138 |
|
|
sprintf(chaine,"%.8f",xmin);
|
139 |
|
|
Edit5->Text=chaine;
|
140 |
|
|
sprintf(chaine,"%.8f",ymin);
|
141 |
|
|
Edit6->Text=chaine;
|
142 |
|
|
sprintf(chaine,"%.8f",zmin);
|
143 |
|
|
Edit7->Text=chaine;
|
144 |
|
|
sprintf(chaine,"%.8f",xmax);
|
145 |
|
|
Edit10->Text=chaine;
|
146 |
|
|
sprintf(chaine,"%.8f",ymax);
|
147 |
|
|
Edit9->Text=chaine;
|
148 |
|
|
sprintf(chaine,"%.8f",zmax);
|
149 |
|
|
Edit11->Text=chaine;
|
150 |
|
|
sprintf(chaine,"%.8f",xmoy/nbnoeud);
|
151 |
|
|
Edit16->Text=chaine;
|
152 |
|
|
sprintf(chaine,"%.8f",ymoy/nbnoeud);
|
153 |
|
|
Edit15->Text=chaine;
|
154 |
|
|
sprintf(chaine,"%.8f",zmoy/nbnoeud);
|
155 |
|
|
Edit14->Text=chaine;
|
156 |
|
|
ListBox2->Clear();
|
157 |
|
|
int nbsol=gest.get_nb_mg_solution();
|
158 |
|
|
for (int i=0;i<nbsol;i++)
|
159 |
|
|
{
|
160 |
|
|
MG_SOLUTION* sol=gest.get_mg_solution(i);
|
161 |
|
|
if (sol->get_maillage()==mgmai) ListBox2->Items->Add(sol->get_id());
|
162 |
|
|
}
|
163 |
|
|
}
|
164 |
|
|
if (femmai!=NULL)
|
165 |
|
|
{
|
166 |
|
|
Edit1->Text=femmai->get_nb_fem_noeud();
|
167 |
|
|
Edit2->Text=femmai->get_nb_fem_segment();
|
168 |
|
|
Edit3->Text=femmai->get_nb_fem_triangle();
|
169 |
|
|
Edit4->Text=femmai->get_nb_fem_tetra();
|
170 |
|
|
double xmin,ymin,zmin;
|
171 |
|
|
double xmax,ymax,zmax;
|
172 |
|
|
double xmoy,ymoy,zmoy;
|
173 |
|
|
LISTE_FEM_NOEUD::iterator it4;
|
174 |
|
|
FEM_NOEUD* femnoeud=femmai->get_premier_noeud(it4);
|
175 |
|
|
double* xyz;
|
176 |
|
|
xyz=femnoeud->get_coord();
|
177 |
|
|
xmin=xyz[0];xmax=xyz[0];xmoy=xyz[0];
|
178 |
|
|
ymin=xyz[1];ymax=xyz[1];ymoy=xyz[1];
|
179 |
|
|
zmin=xyz[2];zmax=xyz[2];zmoy=xyz[2];
|
180 |
|
|
long nbnoeud=femmai->get_nb_fem_noeud();
|
181 |
|
|
femnoeud=femmai->get_suivant_noeud(it4);
|
182 |
|
|
while (femnoeud!=NULL)
|
183 |
|
|
{
|
184 |
|
|
xyz=femnoeud->get_coord();
|
185 |
|
|
if (xyz[0]<xmin) xmin=xyz[0];
|
186 |
|
|
if (xyz[1]<ymin) ymin=xyz[1];
|
187 |
|
|
if (xyz[2]<zmin) zmin=xyz[2];
|
188 |
|
|
if (xyz[0]>xmax) xmax=xyz[0];
|
189 |
|
|
if (xyz[1]>ymax) ymax=xyz[1];
|
190 |
|
|
if (xyz[2]>zmax) zmax=xyz[2];
|
191 |
|
|
xmoy=xmoy+xyz[0];
|
192 |
|
|
ymoy=ymoy+xyz[1];
|
193 |
|
|
zmoy=zmoy+xyz[2];
|
194 |
|
|
femnoeud=femmai->get_suivant_noeud(it4);
|
195 |
|
|
}
|
196 |
|
|
sprintf(chaine,"%.8f",xmin);
|
197 |
|
|
Edit5->Text=chaine;
|
198 |
|
|
sprintf(chaine,"%.8f",ymin);
|
199 |
|
|
Edit6->Text=chaine;
|
200 |
|
|
sprintf(chaine,"%.8f",zmin);
|
201 |
|
|
Edit7->Text=chaine;
|
202 |
|
|
sprintf(chaine,"%.8f",xmax);
|
203 |
|
|
Edit10->Text=chaine;
|
204 |
|
|
sprintf(chaine,"%.8f",ymax);
|
205 |
|
|
Edit9->Text=chaine;
|
206 |
|
|
sprintf(chaine,"%.8f",zmax);
|
207 |
|
|
Edit11->Text=chaine;
|
208 |
|
|
sprintf(chaine,"%.8f",xmoy/nbnoeud);
|
209 |
|
|
Edit16->Text=chaine;
|
210 |
|
|
sprintf(chaine,"%.8f",ymoy/nbnoeud);
|
211 |
|
|
Edit15->Text=chaine;
|
212 |
|
|
sprintf(chaine,"%.8f",zmoy/nbnoeud);
|
213 |
|
|
Edit14->Text=chaine;
|
214 |
|
|
ListBox2->Clear();
|
215 |
|
|
int nbsol=gest.get_nb_fem_solution();
|
216 |
|
|
for (int i=0;i<nbsol;i++)
|
217 |
|
|
{
|
218 |
|
|
FEM_SOLUTION* sol=gest.get_fem_solution(i);
|
219 |
|
|
if (sol->get_maillage()==femmai) ListBox2->Items->Add(sol->get_id());
|
220 |
|
|
}
|
221 |
|
|
}
|
222 |
|
|
}
|
223 |
|
|
//---------------------------------------------------------------------------
|
224 |
|
|
void __fastcall Tverimesh::Button3Click(TObject *Sender)
|
225 |
|
|
{
|
226 |
|
|
if (ListBox1->ItemIndex==(-1)) return;
|
227 |
|
|
if (ListBox1->ItemIndex==0) return;
|
228 |
|
|
if (ListBox2->Items->Count!=0)
|
229 |
|
|
{
|
230 |
|
|
MessageBox(Handle,"Effacer d'abord les solutions liées","Erreur", MB_OK);
|
231 |
|
|
return;
|
232 |
|
|
}
|
233 |
|
|
long id=atol(ListBox1->Items->Strings[ListBox1->ItemIndex].c_str());
|
234 |
|
|
MG_MAILLAGE* mai=gest.get_mg_maillageid(id);
|
235 |
|
|
if (mai!=NULL) gest.supprimer_mg_maillageid(id); else gest.supprimer_fem_maillageid(id);
|
236 |
|
|
ListBox1->Items->Delete(ListBox1->ItemIndex);
|
237 |
|
|
|
238 |
|
|
gest.enregistrer(Caption.c_str());
|
239 |
|
|
visuform.miseajourmodeleExecute(Sender);
|
240 |
|
|
}
|
241 |
|
|
//---------------------------------------------------------------------------
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
void __fastcall Tverimesh::Button2Click(TObject *Sender)
|
245 |
|
|
{
|
246 |
|
|
GroupBox7->Visible=false;
|
247 |
|
|
if (ListBox1->ItemIndex==(-1)) return;
|
248 |
|
|
if (ListBox1->ItemIndex==0) return;
|
249 |
|
|
if (ListBox1->ItemIndex>gest.get_nb_mg_maillage()) return;
|
250 |
|
|
unsigned long id=atol(ListBox1->Items->Strings[ListBox1->ItemIndex].c_str());
|
251 |
|
|
MG_MAILLAGE* mgmai=gest.get_mg_maillageid(id);
|
252 |
|
|
char chaine[300];
|
253 |
|
|
GroupBox3->Visible=true;
|
254 |
|
|
sprintf(chaine,"Qualité (critère isotrope) du maillage %lu",id);
|
255 |
|
|
GroupBox3->Caption=chaine;
|
256 |
|
|
sprintf(chaine,"Mailles de qualité > %f",MainForm->valeurconfig[53]);
|
257 |
|
|
Label17->Caption=chaine;
|
258 |
|
|
Label26->Caption=chaine;
|
259 |
|
|
sprintf(chaine,"Mailles de qualité > %f",MainForm->valeurconfig[54]);
|
260 |
|
|
Label18->Caption=chaine;
|
261 |
|
|
Label27->Caption=chaine;
|
262 |
|
|
sprintf(chaine,"Mailles de qualité > %f",MainForm->valeurconfig[55]);
|
263 |
|
|
Label19->Caption=chaine;
|
264 |
|
|
Label28->Caption=chaine;
|
265 |
|
|
sprintf(chaine,"Autres",MainForm->valeurconfig[53]);
|
266 |
|
|
Label20->Caption=chaine;
|
267 |
|
|
Label29->Caption=chaine;
|
268 |
|
|
int nb_triangle=mgmai->get_nb_mg_triangle();
|
269 |
|
|
int nb_tetra=mgmai->get_nb_mg_tetra();
|
270 |
|
|
double qmin=1.,qmax=0.,qmoy=0.;
|
271 |
|
|
int tabqual[4]={0,0,0,0};
|
272 |
|
|
if (nb_triangle==0)
|
273 |
|
|
{
|
274 |
|
|
GroupBox4->Visible=false;
|
275 |
|
|
Button4->Visible=false;
|
276 |
|
|
return;
|
277 |
|
|
}
|
278 |
|
|
GroupBox4->Visible=true;
|
279 |
|
|
Button4->Visible=true;
|
280 |
|
|
for (int i=0;i<101;i++) {tab2d[i]=0;tab3d[i]=0;}
|
281 |
|
|
int nbtri=0;
|
282 |
|
|
LISTE_MG_TRIANGLE::iterator it_tri;
|
283 |
|
|
for (MG_TRIANGLE* tri=mgmai->get_premier_triangle(it_tri);tri;tri=mgmai->get_suivant_triangle(it_tri))
|
284 |
|
|
{
|
285 |
|
|
if (tri->get_lien_topologie()!=NULL) if (tri->get_lien_topologie()->get_dimension()!=2) continue;
|
286 |
|
|
nbtri++;
|
287 |
|
|
MG_NOEUD* no1=tri->get_noeud1();
|
288 |
|
|
MG_NOEUD* no2=tri->get_noeud2();
|
289 |
|
|
MG_NOEUD* no3=tri->get_noeud3();
|
290 |
|
|
double *xyz1=no1->get_coord();
|
291 |
|
|
double *xyz2=no2->get_coord();
|
292 |
|
|
double *xyz3=no3->get_coord();
|
293 |
|
|
double qualtmp=OPERATEUR::qualite_triangle(xyz1,xyz2,xyz3);
|
294 |
|
|
if (qualtmp>qmax) qmax=qualtmp;
|
295 |
|
|
if (qualtmp<qmin) qmin=qualtmp;
|
296 |
|
|
qmoy=qmoy+qualtmp;
|
297 |
|
|
if (qualtmp>MainForm->valeurconfig[53]) tabqual[0]=tabqual[0]+1;
|
298 |
|
|
else if (qualtmp>MainForm->valeurconfig[54]) tabqual[1]=tabqual[1]+1;
|
299 |
|
|
else if (qualtmp>MainForm->valeurconfig[55]) tabqual[2]=tabqual[2]+1;
|
300 |
|
|
else tabqual[3]=tabqual[3]+1;
|
301 |
|
|
tab2d[(int)(qualtmp*100.)]++;
|
302 |
|
|
}
|
303 |
|
|
sprintf(chaine,"%.6f",qmin);
|
304 |
|
|
Edit8->Text=chaine;
|
305 |
|
|
sprintf(chaine,"%.6f",qmax);
|
306 |
|
|
Edit12->Text=chaine;
|
307 |
|
|
sprintf(chaine,"%.6f",qmoy/nbtri);
|
308 |
|
|
Edit13->Text=chaine;
|
309 |
|
|
Edit17->Text=tabqual[0];
|
310 |
|
|
Edit18->Text=tabqual[1];
|
311 |
|
|
Edit19->Text=tabqual[2];
|
312 |
|
|
Edit20->Text=tabqual[3];
|
313 |
|
|
sprintf(chaine,"%.2f",tabqual[0]*100.0/nbtri);
|
314 |
|
|
Edit21->Text=chaine;
|
315 |
|
|
sprintf(chaine,"%.2f",tabqual[1]*100.0/nbtri);
|
316 |
|
|
Edit22->Text=chaine;
|
317 |
|
|
sprintf(chaine,"%.2f",tabqual[2]*100.0/nbtri);
|
318 |
|
|
Edit23->Text=chaine;
|
319 |
|
|
sprintf(chaine,"%.2f",tabqual[3]*100.0/nbtri);
|
320 |
|
|
Edit24->Text=chaine;
|
321 |
|
|
qmin=1.;qmax=0.;qmoy=0.;
|
322 |
|
|
tabqual[0]=0;tabqual[1]=0;tabqual[2]=0;tabqual[3]=0;
|
323 |
|
|
if (nb_tetra==0)
|
324 |
|
|
{
|
325 |
|
|
GroupBox5->Visible=false;
|
326 |
|
|
return;
|
327 |
|
|
}
|
328 |
|
|
GroupBox5->Visible=true;
|
329 |
|
|
LISTE_MG_TETRA::iterator it_tet;
|
330 |
|
|
MG_TETRA* tet=mgmai->get_premier_tetra(it_tet);
|
331 |
|
|
while (tet)
|
332 |
|
|
{
|
333 |
|
|
MG_NOEUD* no1=tet->get_noeud1();
|
334 |
|
|
MG_NOEUD* no2=tet->get_noeud2();
|
335 |
|
|
MG_NOEUD* no3=tet->get_noeud3();
|
336 |
|
|
MG_NOEUD* no4=tet->get_noeud4();
|
337 |
|
|
double *xyz1=no1->get_coord();
|
338 |
|
|
double *xyz2=no2->get_coord();
|
339 |
|
|
double *xyz3=no3->get_coord();
|
340 |
|
|
double *xyz4=no4->get_coord();
|
341 |
|
|
double qualtmp=OPERATEUR::qualite_tetra(xyz1,xyz2,xyz3,xyz4);
|
342 |
|
|
if (qualtmp>qmax) qmax=qualtmp;
|
343 |
|
|
if (qualtmp<qmin) qmin=qualtmp;
|
344 |
|
|
qmoy=qmoy+qualtmp;
|
345 |
|
|
if (qualtmp>MainForm->valeurconfig[53]) tabqual[0]=tabqual[0]+1;
|
346 |
|
|
else if (qualtmp>MainForm->valeurconfig[54]) tabqual[1]=tabqual[1]+1;
|
347 |
|
|
else if (qualtmp>MainForm->valeurconfig[55]) tabqual[2]=tabqual[2]+1;
|
348 |
|
|
else tabqual[3]=tabqual[3]+1;
|
349 |
|
|
tab3d[(int)(qualtmp*100.)]++;
|
350 |
|
|
tet=mgmai->get_suivant_tetra(it_tet);
|
351 |
|
|
}
|
352 |
|
|
sprintf(chaine,"%.6f",qmin);
|
353 |
|
|
Edit25->Text=chaine;
|
354 |
|
|
sprintf(chaine,"%.6f",qmax);
|
355 |
|
|
Edit26->Text=chaine;
|
356 |
|
|
sprintf(chaine,"%.6f",qmoy/nb_tetra);
|
357 |
|
|
Edit27->Text=chaine;
|
358 |
|
|
Edit28->Text=tabqual[0];
|
359 |
|
|
Edit29->Text=tabqual[1];
|
360 |
|
|
Edit30->Text=tabqual[2];
|
361 |
|
|
Edit31->Text=tabqual[3];
|
362 |
|
|
sprintf(chaine,"%.2f",tabqual[0]*100.0/nb_tetra);
|
363 |
|
|
Edit32->Text=chaine;
|
364 |
|
|
sprintf(chaine,"%.2f",tabqual[1]*100.0/nb_tetra);
|
365 |
|
|
Edit33->Text=chaine;
|
366 |
|
|
sprintf(chaine,"%.2f",tabqual[2]*100.0/nb_tetra);
|
367 |
|
|
Edit34->Text=chaine;
|
368 |
|
|
sprintf(chaine,"%.2f",tabqual[3]*100.0/nb_tetra);
|
369 |
|
|
Edit35->Text=chaine;
|
370 |
|
|
}
|
371 |
|
|
//---------------------------------------------------------------------------
|
372 |
|
|
|
373 |
|
|
void __fastcall Tverimesh::FormCreate(TObject *Sender)
|
374 |
|
|
{
|
375 |
|
|
ListBox1->Items->Add("Géométrie");
|
376 |
|
|
int nbmai=gest.get_nb_mg_maillage();
|
377 |
|
|
for (int i=0;i<nbmai;i++)
|
378 |
|
|
{
|
379 |
|
|
MG_MAILLAGE* mgmai=gest.get_mg_maillage(i);
|
380 |
|
|
ListBox1->Items->Add(mgmai->get_id());
|
381 |
|
|
}
|
382 |
|
|
int nbfemmai=gest.get_nb_fem_maillage();
|
383 |
|
|
for (int i=0;i<nbfemmai;i++)
|
384 |
|
|
{
|
385 |
|
|
FEM_MAILLAGE* femmai=gest.get_fem_maillage(i);
|
386 |
|
|
ListBox1->Items->Add(femmai->get_id());
|
387 |
|
|
}
|
388 |
|
|
}
|
389 |
|
|
//---------------------------------------------------------------------------
|
390 |
|
|
|
391 |
|
|
|
392 |
|
|
void __fastcall Tverimesh::Button4Click(TObject *Sender)
|
393 |
|
|
{
|
394 |
|
|
unsigned long id=atol(ListBox1->Items->Strings[ListBox1->ItemIndex].c_str());
|
395 |
|
|
char chaine[300];
|
396 |
|
|
if (GroupBox4->Visible)
|
397 |
|
|
{
|
398 |
|
|
Tgraph *form1=new Tgraph(Application);
|
399 |
|
|
form1->Width=MainForm->ClientWidth/2.;
|
400 |
|
|
form1->Height=MainForm->ClientHeight/2.;
|
401 |
|
|
form1->Left=0;
|
402 |
|
|
form1->Top=0;
|
403 |
|
|
form1->Caption=Caption;
|
404 |
|
|
form1->Series1->Clear();
|
405 |
|
|
form1->Chart1->Title->Text->Clear();
|
406 |
|
|
sprintf(chaine,"Qualité (critère isotrope) du maillage surfacique %lu",id);
|
407 |
|
|
form1->Chart1->Title->Text->Add(chaine);
|
408 |
|
|
form1->Chart1->Title->Text->Add(Caption.c_str());
|
409 |
|
|
for (int i=0;i<100;i++)
|
410 |
|
|
form1->Series1->AddXY(i/100.,tab2d[i],"",clRed);
|
411 |
|
|
}
|
412 |
|
|
if (GroupBox5->Visible)
|
413 |
|
|
{
|
414 |
|
|
Tgraph *form2=new Tgraph(Application);
|
415 |
|
|
form2->Width=MainForm->ClientWidth/2.;
|
416 |
|
|
form2->Height=MainForm->ClientHeight/2.;
|
417 |
|
|
form2->Left=MainForm->ClientWidth/2.+1;
|
418 |
|
|
form2->Top=0;
|
419 |
|
|
form2->Caption=Caption;
|
420 |
|
|
form2->Series1->Clear();
|
421 |
|
|
form2->Chart1->Title->Text->Clear();
|
422 |
|
|
sprintf(chaine,"Qualité (critère isotrope) du maillage volumique %lu",id);
|
423 |
|
|
form2->Chart1->Title->Text->Add(chaine);
|
424 |
|
|
form2->Chart1->Title->Text->Add(Caption.c_str());
|
425 |
|
|
for (int i=0;i<100;i++)
|
426 |
|
|
form2->Series1->AddXY(i/100.,tab3d[i],"",clRed);
|
427 |
|
|
}
|
428 |
|
|
}
|
429 |
|
|
//---------------------------------------------------------------------------
|
430 |
|
|
|
431 |
|
|
void __fastcall Tverimesh::Button5Click(TObject *Sender)
|
432 |
|
|
{
|
433 |
|
|
if (ListBox2->ItemIndex==(-1)) return;
|
434 |
|
|
long id=atol(ListBox2->Items->Strings[ListBox2->ItemIndex].c_str());
|
435 |
|
|
MG_SOLUTION* sol=gest.get_mg_solutionid(id);
|
436 |
|
|
if (sol!=NULL) gest.supprimer_mg_solutionid(id);
|
437 |
|
|
else gest.supprimer_fem_solutionid(id);
|
438 |
|
|
ListBox2->Items->Delete(ListBox2->ItemIndex);
|
439 |
|
|
gest.enregistrer(Caption.c_str());
|
440 |
|
|
visuform.miseajourmodeleExecute(Sender);
|
441 |
|
|
}
|
442 |
|
|
//---------------------------------------------------------------------------
|
443 |
|
|
|
444 |
|
|
void __fastcall Tverimesh::Button6Click(TObject *Sender)
|
445 |
|
|
{
|
446 |
|
|
if (ListBox1->ItemIndex>gest.get_nb_mg_maillage()) return;
|
447 |
|
|
GroupBox3->Visible=false;
|
448 |
|
|
Button4->Visible=false;
|
449 |
|
|
if (ListBox1->ItemIndex==(-1)) return;
|
450 |
|
|
if (ListBox1->ItemIndex==0) return;
|
451 |
|
|
unsigned long id=atol(ListBox1->Items->Strings[ListBox1->ItemIndex].c_str());
|
452 |
|
|
MG_MAILLAGE* mgmai=gest.get_mg_maillageid(id);
|
453 |
|
|
|
454 |
|
|
if (RadioButton1->Checked)
|
455 |
|
|
{
|
456 |
|
|
char chaine[300];
|
457 |
|
|
GroupBox7->Visible=true;
|
458 |
|
|
sprintf(chaine,"Liste de noeuds du maillage %lu",id);
|
459 |
|
|
GroupBox7->Caption=chaine;
|
460 |
|
|
StringGrid1->ColCount=6;
|
461 |
|
|
int nb=mgmai->get_nb_mg_noeud();
|
462 |
|
|
StringGrid1->RowCount=nb+1;
|
463 |
|
|
StringGrid1->Cells[0][0]="Numéro";
|
464 |
|
|
StringGrid1->Cells[1][0]="Id";
|
465 |
|
|
StringGrid1->Cells[2][0]="X";
|
466 |
|
|
StringGrid1->Cells[3][0]="Y";
|
467 |
|
|
StringGrid1->Cells[4][0]="Z";
|
468 |
|
|
StringGrid1->Cells[5][0]="Topologie";
|
469 |
|
|
LISTE_MG_NOEUD::iterator it_nd;
|
470 |
|
|
MG_NOEUD* mgnoeud=mgmai->get_premier_noeud(it_nd);
|
471 |
|
|
int i=0;
|
472 |
|
|
while (mgnoeud)
|
473 |
|
|
{
|
474 |
|
|
double *xyz=mgnoeud->get_coord();
|
475 |
|
|
StringGrid1->Cells[0][i+1]=i;
|
476 |
|
|
StringGrid1->Cells[1][i+1]=mgnoeud->get_id();
|
477 |
|
|
StringGrid1->Cells[2][i+1]=xyz[0];
|
478 |
|
|
StringGrid1->Cells[3][i+1]=xyz[1];
|
479 |
|
|
StringGrid1->Cells[4][i+1]=xyz[2];
|
480 |
|
|
if (mgnoeud->get_lien_topologie()!=NULL)
|
481 |
|
|
StringGrid1->Cells[5][i+1]=mgnoeud->get_lien_topologie()->get_id();
|
482 |
|
|
else
|
483 |
|
|
StringGrid1->Cells[5][i+1]="???";
|
484 |
|
|
mgnoeud=mgmai->get_suivant_noeud(it_nd);
|
485 |
|
|
i++;
|
486 |
|
|
}
|
487 |
|
|
}
|
488 |
|
|
if (RadioButton2->Checked)
|
489 |
|
|
{
|
490 |
|
|
char chaine[300];
|
491 |
|
|
GroupBox7->Visible=true;
|
492 |
|
|
sprintf(chaine,"Liste de segments du maillage %lu",id);
|
493 |
|
|
GroupBox7->Caption=chaine;
|
494 |
|
|
StringGrid1->ColCount=6;
|
495 |
|
|
int nb=mgmai->get_nb_mg_segment();
|
496 |
|
|
StringGrid1->RowCount=nb+1;
|
497 |
|
|
StringGrid1->Cells[0][0]="Numéro";
|
498 |
|
|
StringGrid1->Cells[1][0]="Id";
|
499 |
|
|
StringGrid1->Cells[2][0]="Id Noeud1";
|
500 |
|
|
StringGrid1->Cells[3][0]="Id Noeud2";
|
501 |
|
|
StringGrid1->Cells[4][0]="Longueur";
|
502 |
|
|
StringGrid1->Cells[5][0]="Topologie";
|
503 |
|
|
int num=0;
|
504 |
|
|
LISTE_MG_SEGMENT::iterator it_seg;
|
505 |
|
|
MG_SEGMENT* mgseg=mgmai->get_premier_segment(it_seg);
|
506 |
|
|
int i=0;
|
507 |
|
|
while (mgseg)
|
508 |
|
|
{
|
509 |
|
|
StringGrid1->RowCount=num+2;
|
510 |
|
|
if (!CheckBox1->Checked)
|
511 |
|
|
if (mgseg->get_lien_topologie()!=NULL)
|
512 |
|
|
if (mgseg->get_lien_topologie()->get_dimension()!=1)
|
513 |
|
|
{
|
514 |
|
|
mgseg=mgmai->get_suivant_segment(it_seg);
|
515 |
|
|
continue;
|
516 |
|
|
}
|
517 |
|
|
MG_NOEUD* noeud1=mgseg->get_noeud1();
|
518 |
|
|
MG_NOEUD* noeud2=mgseg->get_noeud2();
|
519 |
|
|
double* xyz1=noeud1->get_coord();
|
520 |
|
|
double* xyz2=noeud2->get_coord();
|
521 |
|
|
OT_VECTEUR_3D vec(xyz1,xyz2);
|
522 |
|
|
StringGrid1->Cells[0][i+1]=num;
|
523 |
|
|
StringGrid1->Cells[1][i+1]=mgseg->get_id();
|
524 |
|
|
StringGrid1->Cells[2][i+1]=noeud1->get_id();
|
525 |
|
|
StringGrid1->Cells[3][i+1]=noeud2->get_id();
|
526 |
|
|
StringGrid1->Cells[4][i+1]=vec.get_longueur();
|
527 |
|
|
if (mgseg->get_lien_topologie()!=NULL)
|
528 |
|
|
StringGrid1->Cells[5][i+1]=mgseg->get_lien_topologie()->get_id();
|
529 |
|
|
else
|
530 |
|
|
StringGrid1->Cells[5][i+1]="???";
|
531 |
|
|
num++;
|
532 |
|
|
mgseg=mgmai->get_suivant_segment(it_seg);
|
533 |
|
|
i++;
|
534 |
|
|
}
|
535 |
|
|
StringGrid1->RowCount=num+1;
|
536 |
|
|
}
|
537 |
|
|
if (RadioButton3->Checked)
|
538 |
|
|
{
|
539 |
|
|
char chaine[300];
|
540 |
|
|
GroupBox7->Visible=true;
|
541 |
|
|
sprintf(chaine,"Liste de triangles du maillage %lu",id);
|
542 |
|
|
GroupBox7->Caption=chaine;
|
543 |
|
|
StringGrid1->ColCount=8;
|
544 |
|
|
int nb=mgmai->get_nb_mg_triangle();
|
545 |
|
|
StringGrid1->RowCount=nb+1;
|
546 |
|
|
StringGrid1->Cells[0][0]="Numéro";
|
547 |
|
|
StringGrid1->Cells[1][0]="Id";
|
548 |
|
|
StringGrid1->Cells[2][0]="Id Noeud1";
|
549 |
|
|
StringGrid1->Cells[3][0]="Id Noeud2";
|
550 |
|
|
StringGrid1->Cells[4][0]="Id Noeud3";
|
551 |
|
|
StringGrid1->Cells[5][0]="Superficie";
|
552 |
|
|
StringGrid1->Cells[6][0]="Qualité";
|
553 |
|
|
StringGrid1->Cells[7][0]="Topologie";
|
554 |
|
|
int num=0;
|
555 |
|
|
LISTE_MG_TRIANGLE::iterator it_tri;
|
556 |
|
|
MG_TRIANGLE* mgtri=mgmai->get_premier_triangle(it_tri);
|
557 |
|
|
int i=0;
|
558 |
|
|
while (mgtri)
|
559 |
|
|
{
|
560 |
|
|
if (!CheckBox1->Checked)
|
561 |
|
|
if (mgtri->get_lien_topologie()!=NULL)
|
562 |
|
|
if (mgtri->get_lien_topologie()->get_dimension()!=2)
|
563 |
|
|
{
|
564 |
|
|
mgtri=mgmai->get_suivant_triangle(it_tri);
|
565 |
|
|
continue;
|
566 |
|
|
}
|
567 |
|
|
MG_NOEUD* noeud1=mgtri->get_noeud1();
|
568 |
|
|
MG_NOEUD* noeud2=mgtri->get_noeud2();
|
569 |
|
|
MG_NOEUD* noeud3=mgtri->get_noeud3();
|
570 |
|
|
double* xyz1=noeud1->get_coord();
|
571 |
|
|
double* xyz2=noeud2->get_coord();
|
572 |
|
|
double* xyz3=noeud3->get_coord();
|
573 |
|
|
OT_VECTEUR_3D vec1(xyz1,xyz2);
|
574 |
|
|
OT_VECTEUR_3D vec2(xyz1,xyz3);
|
575 |
|
|
OT_VECTEUR_3D vec=vec1&vec2;
|
576 |
|
|
double qualtmp=OPERATEUR::qualite_triangle(xyz1,xyz2,xyz3);
|
577 |
|
|
StringGrid1->Cells[0][i+1]=num;
|
578 |
|
|
StringGrid1->Cells[1][i+1]=mgtri->get_id();
|
579 |
|
|
StringGrid1->Cells[2][i+1]=noeud1->get_id();
|
580 |
|
|
StringGrid1->Cells[3][i+1]=noeud2->get_id();
|
581 |
|
|
StringGrid1->Cells[4][i+1]=noeud3->get_id();
|
582 |
|
|
StringGrid1->Cells[5][i+1]=vec.get_longueur()/2.;
|
583 |
|
|
StringGrid1->Cells[6][i+1]=qualtmp;
|
584 |
|
|
if (mgtri->get_lien_topologie()!=NULL)
|
585 |
|
|
StringGrid1->Cells[7][i+1]=mgtri->get_lien_topologie()->get_id();
|
586 |
|
|
else
|
587 |
|
|
StringGrid1->Cells[7][i+1]="???";
|
588 |
|
|
num++;
|
589 |
|
|
mgtri=mgmai->get_suivant_triangle(it_tri);
|
590 |
|
|
i++;
|
591 |
|
|
}
|
592 |
|
|
StringGrid1->RowCount=num+1;
|
593 |
|
|
}
|
594 |
|
|
if (RadioButton4->Checked)
|
595 |
|
|
{
|
596 |
|
|
char chaine[300];
|
597 |
|
|
GroupBox7->Visible=true;
|
598 |
|
|
sprintf(chaine,"Liste de tétraèdres du maillage %lu",id);
|
599 |
|
|
GroupBox7->Caption=chaine;
|
600 |
|
|
StringGrid1->ColCount=9;
|
601 |
|
|
int nb=mgmai->get_nb_mg_tetra();
|
602 |
|
|
StringGrid1->RowCount=nb+1;
|
603 |
|
|
StringGrid1->Cells[0][0]="Numéro";
|
604 |
|
|
StringGrid1->Cells[1][0]="Id";
|
605 |
|
|
StringGrid1->Cells[2][0]="Id Noeud1";
|
606 |
|
|
StringGrid1->Cells[3][0]="Id Noeud2";
|
607 |
|
|
StringGrid1->Cells[4][0]="Id Noeud3";
|
608 |
|
|
StringGrid1->Cells[5][0]="Id Noeud4";
|
609 |
|
|
StringGrid1->Cells[6][0]="Volume";
|
610 |
|
|
StringGrid1->Cells[7][0]="Qualité";
|
611 |
|
|
StringGrid1->Cells[8][0]="Topologie";
|
612 |
|
|
int num=0;
|
613 |
|
|
LISTE_MG_TETRA::iterator it_tet;
|
614 |
|
|
MG_TETRA* mgtet=mgmai->get_premier_tetra(it_tet);
|
615 |
|
|
int i=0;
|
616 |
|
|
while (mgtet)
|
617 |
|
|
{
|
618 |
|
|
StringGrid1->RowCount=num+2;
|
619 |
|
|
if (!CheckBox1->Checked)
|
620 |
|
|
if (mgtet->get_lien_topologie()!=NULL)
|
621 |
|
|
if (mgtet->get_lien_topologie()->get_dimension()!=3)
|
622 |
|
|
{
|
623 |
|
|
mgtet=mgmai->get_suivant_tetra(it_tet);
|
624 |
|
|
continue;
|
625 |
|
|
}
|
626 |
|
|
MG_NOEUD* noeud1=mgtet->get_noeud1();
|
627 |
|
|
MG_NOEUD* noeud2=mgtet->get_noeud2();
|
628 |
|
|
MG_NOEUD* noeud3=mgtet->get_noeud3();
|
629 |
|
|
MG_NOEUD* noeud4=mgtet->get_noeud4();
|
630 |
|
|
double* xyz1=noeud1->get_coord();
|
631 |
|
|
double* xyz2=noeud2->get_coord();
|
632 |
|
|
double* xyz3=noeud3->get_coord();
|
633 |
|
|
double* xyz4=noeud4->get_coord();
|
634 |
|
|
OT_VECTEUR_3D vec1(xyz1,xyz2);
|
635 |
|
|
OT_VECTEUR_3D vec2(xyz1,xyz3);
|
636 |
|
|
OT_VECTEUR_3D vec3(xyz1,xyz4);
|
637 |
|
|
OT_VECTEUR_3D vec=vec1&vec2;
|
638 |
|
|
double qualtmp=OPERATEUR::qualite_tetra(xyz1,xyz2,xyz3,xyz4);
|
639 |
|
|
StringGrid1->Cells[0][i+1]=num;
|
640 |
|
|
StringGrid1->Cells[1][i+1]=mgtet->get_id();
|
641 |
|
|
StringGrid1->Cells[2][i+1]=noeud1->get_id();
|
642 |
|
|
StringGrid1->Cells[3][i+1]=noeud2->get_id();
|
643 |
|
|
StringGrid1->Cells[4][i+1]=noeud3->get_id();
|
644 |
|
|
StringGrid1->Cells[5][i+1]=noeud4->get_id();
|
645 |
|
|
StringGrid1->Cells[6][i+1]=(vec*vec3)/3.;
|
646 |
|
|
StringGrid1->Cells[7][i+1]=qualtmp;
|
647 |
|
|
if (mgtet->get_lien_topologie()!=NULL)
|
648 |
|
|
StringGrid1->Cells[8][i+1]=mgtet->get_lien_topologie()->get_id();
|
649 |
|
|
else
|
650 |
|
|
StringGrid1->Cells[8][i+1]="???";
|
651 |
|
|
num++;
|
652 |
|
|
mgtet=mgmai->get_suivant_tetra(it_tet);
|
653 |
|
|
i++;
|
654 |
|
|
}
|
655 |
|
|
StringGrid1->RowCount=num+1;
|
656 |
|
|
}
|
657 |
|
|
|
658 |
|
|
}
|
659 |
|
|
//---------------------------------------------------------------------------
|
660 |
|
|
|
661 |
|
|
void __fastcall Tverimesh::CheckBox1Click(TObject *Sender)
|
662 |
|
|
{
|
663 |
|
|
if (GroupBox7->Visible==true) Button6Click(Sender);
|
664 |
|
|
}
|
665 |
|
|
//---------------------------------------------------------------------------
|
666 |
|
|
|
667 |
|
|
void __fastcall Tverimesh::RadioButton1Click(TObject *Sender)
|
668 |
|
|
{
|
669 |
|
|
if (GroupBox7->Visible==true) Button6Click(Sender);
|
670 |
|
|
}
|
671 |
|
|
//---------------------------------------------------------------------------
|
672 |
|
|
|
673 |
|
|
void __fastcall Tverimesh::RadioButton2Click(TObject *Sender)
|
674 |
|
|
{
|
675 |
|
|
if (GroupBox7->Visible==true) Button6Click(Sender);
|
676 |
|
|
}
|
677 |
|
|
//---------------------------------------------------------------------------
|
678 |
|
|
|
679 |
|
|
void __fastcall Tverimesh::RadioButton3Click(TObject *Sender)
|
680 |
|
|
{
|
681 |
|
|
if (GroupBox7->Visible==true) Button6Click(Sender);
|
682 |
|
|
}
|
683 |
|
|
//---------------------------------------------------------------------------
|
684 |
|
|
|
685 |
|
|
void __fastcall Tverimesh::RadioButton4Click(TObject *Sender)
|
686 |
|
|
{
|
687 |
|
|
if (GroupBox7->Visible==true) Button6Click(Sender);
|
688 |
|
|
}
|
689 |
|
|
//---------------------------------------------------------------------------
|
690 |
|
|
|