1 |
|
5 |
//---------------------------------------------------------------------------
|
2 |
|
|
|
3 |
|
|
#include <vcl.h>
|
4 |
|
|
#pragma hdrstop
|
5 |
|
|
|
6 |
|
|
#include "recons.h"
|
7 |
|
|
#include "process.h"
|
8 |
|
|
//---------------------------------------------------------------------------
|
9 |
|
|
#pragma package(smart_init)
|
10 |
|
|
#pragma resource "*.dfm"
|
11 |
|
|
Tfrecons *frecons;
|
12 |
|
|
//---------------------------------------------------------------------------
|
13 |
|
|
__fastcall Tfrecons::Tfrecons(TComponent* Owner,MG_GESTIONNAIRE* gestion)
|
14 |
|
|
: TForm(Owner),gest(gestion)
|
15 |
|
|
{
|
16 |
|
|
}
|
17 |
|
|
//---------------------------------------------------------------------------
|
18 |
|
|
void __fastcall Tfrecons::Button1Click(TObject *Sender)
|
19 |
|
|
{
|
20 |
|
|
Close();
|
21 |
|
|
}
|
22 |
|
|
//---------------------------------------------------------------------------
|
23 |
|
|
|
24 |
|
|
void __fastcall Tfrecons::FormClose(TObject *Sender, TCloseAction &Action)
|
25 |
|
|
{
|
26 |
|
|
Action=caFree;
|
27 |
|
|
}
|
28 |
|
|
//---------------------------------------------------------------------------
|
29 |
|
|
|
30 |
|
|
void __fastcall Tfrecons::ListBox1Click(TObject *Sender)
|
31 |
|
|
{
|
32 |
|
|
FEM_MAILLAGE* mai=gest->get_fem_maillage(ListBox1->ItemIndex);
|
33 |
|
|
int nbsol=gest->get_nb_fem_solution();
|
34 |
|
|
ListBox2->Clear();
|
35 |
|
|
ListBox3->Clear();
|
36 |
|
|
for (int i=0;i<nbsol;i++)
|
37 |
|
|
{
|
38 |
|
|
FEM_SOLUTION* sol=gest->get_fem_solution(i);
|
39 |
|
|
if (sol->get_maillage()==mai)
|
40 |
|
|
{
|
41 |
|
|
char chaine[1000];
|
42 |
|
|
sprintf(chaine,"%s",sol->get_nom().c_str());
|
43 |
|
|
ListBox2->Items->Add(chaine);
|
44 |
|
|
}
|
45 |
|
|
else
|
46 |
|
|
ListBox2->Items->Add("N/A");
|
47 |
|
|
|
48 |
|
|
}
|
49 |
|
|
}
|
50 |
|
|
//---------------------------------------------------------------------------
|
51 |
|
|
|
52 |
|
|
void __fastcall Tfrecons::ListBox2Click(TObject *Sender)
|
53 |
|
|
{
|
54 |
|
|
FEM_SOLUTION* sol=gest->get_fem_solution(ListBox2->ItemIndex);
|
55 |
|
|
ListBox3->Clear();
|
56 |
|
|
int nb=sol->get_nb_champ();
|
57 |
|
|
for (int i=0;i<nb;i++)
|
58 |
|
|
ListBox3->Items->Add(sol->get_legende(i).c_str());
|
59 |
|
|
|
60 |
|
|
}
|
61 |
|
|
//---------------------------------------------------------------------------
|
62 |
|
|
|
63 |
|
|
void __fastcall Tfrecons::dx1Click(TObject *Sender)
|
64 |
|
|
{
|
65 |
|
|
Label5->Caption=ListBox1->Items->Strings[ListBox1->ItemIndex];
|
66 |
|
|
Label6->Caption=ListBox2->Items->Strings[ListBox2->ItemIndex];
|
67 |
|
|
Label7->Caption=ListBox3->Items->Strings[ListBox3->ItemIndex];
|
68 |
|
|
xsol=ListBox2->ItemIndex;
|
69 |
|
|
xchamps=ListBox3->ItemIndex;
|
70 |
|
|
}
|
71 |
|
|
//---------------------------------------------------------------------------
|
72 |
|
|
|
73 |
|
|
void __fastcall Tfrecons::dy1Click(TObject *Sender)
|
74 |
|
|
{
|
75 |
|
|
Label9->Caption=ListBox1->Items->Strings[ListBox1->ItemIndex];
|
76 |
|
|
Label10->Caption=ListBox2->Items->Strings[ListBox2->ItemIndex];
|
77 |
|
|
Label11->Caption=ListBox3->Items->Strings[ListBox3->ItemIndex];
|
78 |
|
|
ysol=ListBox2->ItemIndex;
|
79 |
|
|
ychamps=ListBox3->ItemIndex;
|
80 |
|
|
}
|
81 |
|
|
//---------------------------------------------------------------------------
|
82 |
|
|
|
83 |
|
|
void __fastcall Tfrecons::dz1Click(TObject *Sender)
|
84 |
|
|
{
|
85 |
|
|
Label13->Caption=ListBox1->Items->Strings[ListBox1->ItemIndex];
|
86 |
|
|
Label14->Caption=ListBox2->Items->Strings[ListBox2->ItemIndex];
|
87 |
|
|
Label15->Caption=ListBox3->Items->Strings[ListBox3->ItemIndex];
|
88 |
|
|
zsol=ListBox2->ItemIndex;
|
89 |
|
|
zchamps=ListBox3->ItemIndex;
|
90 |
|
|
}
|
91 |
|
|
//---------------------------------------------------------------------------
|
92 |
|
|
|
93 |
|
|
void __fastcall Tfrecons::Button2Click(TObject *Sender)
|
94 |
|
|
{
|
95 |
|
|
if (ListBox1->ItemIndex<0)
|
96 |
|
|
{
|
97 |
|
|
MessageBox(Handle,"Pas de maillage selectionné","Erreur",MB_OK);
|
98 |
|
|
return;
|
99 |
|
|
}
|
100 |
|
|
FEM_MAILLAGE* mai=gest->get_fem_maillage(ListBox1->ItemIndex);
|
101 |
|
|
FEM_MAILLAGE* newmai=mai->dupliquer(gest);
|
102 |
|
|
char chaine[50];
|
103 |
|
|
sprintf(chaine,"Maillage %lu crée",newmai->get_id());
|
104 |
|
|
Label22->Caption=chaine;
|
105 |
|
|
LISTE_FEM_NOEUD::iterator it,itori;
|
106 |
|
|
FEM_SOLUTION* solution=gest->get_fem_solution(xsol);
|
107 |
|
|
solution->active_solution(xchamps);
|
108 |
|
|
FEM_NOEUD* noeudori=mai->get_premier_noeud(itori);
|
109 |
|
|
for (FEM_NOEUD* noeud=newmai->get_premier_noeud(it);noeud;noeud=newmai->get_suivant_noeud(it))
|
110 |
|
|
{
|
111 |
|
|
noeud->change_x(noeudori->get_solution()/newmai->get_mg_geometrie()->get_valeur_unite()+noeud->get_x());
|
112 |
|
|
noeudori=mai->get_suivant_noeud(itori);
|
113 |
|
|
}
|
114 |
|
|
solution=gest->get_fem_solution(ysol);
|
115 |
|
|
solution->active_solution(ychamps);
|
116 |
|
|
noeudori=mai->get_premier_noeud(itori);
|
117 |
|
|
for (FEM_NOEUD* noeud=newmai->get_premier_noeud(it);noeud;noeud=newmai->get_suivant_noeud(it))
|
118 |
|
|
{
|
119 |
|
|
noeud->change_y(noeudori->get_solution()/newmai->get_mg_geometrie()->get_valeur_unite()+noeud->get_y());
|
120 |
|
|
noeudori=mai->get_suivant_noeud(itori);
|
121 |
|
|
}
|
122 |
|
|
solution=gest->get_fem_solution(zsol);
|
123 |
|
|
solution->active_solution(zchamps);
|
124 |
|
|
noeudori=mai->get_premier_noeud(itori);
|
125 |
|
|
for (FEM_NOEUD* noeud=newmai->get_premier_noeud(it);noeud;noeud=newmai->get_suivant_noeud(it))
|
126 |
|
|
{
|
127 |
|
|
noeud->change_z(noeudori->get_solution()/newmai->get_mg_geometrie()->get_valeur_unite()+noeud->get_z());
|
128 |
|
|
noeudori=mai->get_suivant_noeud(itori);
|
129 |
|
|
}
|
130 |
|
|
gest->enregistrer(Caption.c_str());
|
131 |
|
|
}
|
132 |
|
|
//---------------------------------------------------------------------------
|
133 |
|
|
|
134 |
|
|
void __fastcall Tfrecons::Button3Click(TObject *Sender)
|
135 |
|
|
{
|
136 |
|
|
ListBox1->Clear();
|
137 |
|
|
ListBox2->Clear();
|
138 |
|
|
ListBox3->Clear();
|
139 |
|
|
int nbmai=gest->get_nb_fem_maillage();
|
140 |
|
|
for (int i=0;i<nbmai;i++)
|
141 |
|
|
{
|
142 |
|
|
FEM_MAILLAGE* mai=gest->get_fem_maillage(i);
|
143 |
|
|
ListBox1->Items->Add(mai->get_id());
|
144 |
|
|
}
|
145 |
|
|
}
|
146 |
|
|
//---------------------------------------------------------------------------
|
147 |
|
|
|
148 |
|
|
void __fastcall Tfrecons::Button4Click(TObject *Sender)
|
149 |
|
|
{
|
150 |
|
|
ListBox4->Clear();
|
151 |
|
|
int nbmai=gest->get_nb_fem_maillage();
|
152 |
|
|
for (int i=0;i<nbmai;i++)
|
153 |
|
|
{
|
154 |
|
|
FEM_MAILLAGE* mai=gest->get_fem_maillage(i);
|
155 |
|
|
ListBox4->Items->Add(mai->get_id());
|
156 |
|
|
}
|
157 |
|
|
}
|
158 |
|
|
//---------------------------------------------------------------------------
|
159 |
|
|
|
160 |
|
|
void __fastcall Tfrecons::Maillageoriginal1Click(TObject *Sender)
|
161 |
|
|
{
|
162 |
|
|
Label26->Caption=ListBox1->Items->Strings[ListBox4->ItemIndex];
|
163 |
|
|
}
|
164 |
|
|
//---------------------------------------------------------------------------
|
165 |
|
|
|
166 |
|
|
void __fastcall Tfrecons::Maillagedform1Click(TObject *Sender)
|
167 |
|
|
{
|
168 |
|
|
Label27->Caption=ListBox1->Items->Strings[ListBox4->ItemIndex];
|
169 |
|
|
}
|
170 |
|
|
//---------------------------------------------------------------------------
|
171 |
|
|
|
172 |
|
|
|
173 |
|
|
void __fastcall Tfrecons::Button5Click(TObject *Sender)
|
174 |
|
|
{
|
175 |
|
|
char name[500],step[500];
|
176 |
|
|
DWORD type,taille;
|
177 |
|
|
HKEY clef;
|
178 |
|
|
char fichier[500];
|
179 |
|
|
sprintf(fichier,"\"%s\"",Caption.c_str());
|
180 |
|
|
sprintf(step,"\"%s\"",Edit1->Text.c_str());
|
181 |
|
|
RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\UQTR\\VMM\\",0,KEY_EXECUTE,&clef);
|
182 |
|
|
RegQueryValueEx(clef,"pathmodule",0,&type,0,&taille);
|
183 |
|
|
RegQueryValueEx(clef,"pathmodule",0,&type,name,&taille);
|
184 |
|
|
strcat(name,"\\reconstruction");
|
185 |
|
|
spawnl(P_NOWAIT,name,name,"-fichier",fichier,"-step",step,"-idmaillageori",Label26->Caption.c_str(),"-idmaillagedef",Label27->Caption.c_str(),NULL);
|
186 |
|
|
|
187 |
|
|
}
|
188 |
|
|
//---------------------------------------------------------------------------
|
189 |
|
|
|
190 |
|
|
void __fastcall Tfrecons::Button6Click(TObject *Sender)
|
191 |
|
|
{
|
192 |
|
|
if (SaveDialog1->Execute())
|
193 |
|
|
Edit1->Text=SaveDialog1->FileName;
|
194 |
|
|
}
|
195 |
|
|
//---------------------------------------------------------------------------
|
196 |
|
|
|
197 |
|
|
void __fastcall Tfrecons::Button7Click(TObject *Sender)
|
198 |
|
|
{
|
199 |
|
|
char name[500],step[500];
|
200 |
|
|
DWORD type,taille;
|
201 |
|
|
HKEY clef;
|
202 |
|
|
char fichier[500];
|
203 |
|
|
sprintf(fichier,"\"%s\"",Caption.c_str());
|
204 |
|
|
sprintf(step,"\"%s\"",Edit1->Text.c_str());
|
205 |
|
|
RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\UQTR\\VMM\\",0,KEY_EXECUTE,&clef);
|
206 |
|
|
RegQueryValueEx(clef,"pathmodule",0,&type,0,&taille);
|
207 |
|
|
RegQueryValueEx(clef,"pathmodule",0,&type,name,&taille);
|
208 |
|
|
strcat(name,"\\reconstruction");
|
209 |
|
|
spawnl(P_NOWAIT,name,name,"-fichier",fichier,"-step",step,"-idmaillageori",Label26->Caption.c_str(),"-idmaillagedef",Label27->Caption.c_str(),"-idealiser",NULL);
|
210 |
|
|
}
|
211 |
|
|
//---------------------------------------------------------------------------
|
212 |
|
|
|