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 |
|
|
// tsolve.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 "tsolve.h"
|
31 |
|
|
#include "solveur.h"
|
32 |
|
|
#include "sl_solve_elastique.h"
|
33 |
|
|
|
34 |
|
|
#pragma package(smart_init)
|
35 |
|
|
//---------------------------------------------------------------------------
|
36 |
|
|
|
37 |
|
|
// Important: Methods and properties of objects in VCL can only be
|
38 |
|
|
// used in a method called using Synchronize, for example:
|
39 |
|
|
//
|
40 |
|
|
// Synchronize(UpdateCaption);
|
41 |
|
|
//
|
42 |
|
|
// where UpdateCaption could look like:
|
43 |
|
|
//
|
44 |
|
|
// void __fastcall tsolve::UpdateCaption()
|
45 |
|
|
// {
|
46 |
|
|
// Form1->Caption = "Updated in a thread";
|
47 |
|
|
// }
|
48 |
|
|
//---------------------------------------------------------------------------
|
49 |
|
|
|
50 |
|
|
__fastcall tsolve::tsolve(bool CreateSuspended,Tfsolve &var)
|
51 |
|
|
: TThread(CreateSuspended),fen(var)
|
52 |
|
|
{
|
53 |
|
|
this->FreeOnTerminate=true;
|
54 |
|
|
debut=clock();
|
55 |
|
|
}
|
56 |
|
|
//---------------------------------------------------------------------------
|
57 |
|
|
void tsolve::SetName()
|
58 |
|
|
{
|
59 |
|
|
THREADNAME_INFO info;
|
60 |
|
|
info.dwType = 0x1000;
|
61 |
|
|
info.szName = "solve";
|
62 |
|
|
info.dwThreadID = -1;
|
63 |
|
|
info.dwFlags = 0;
|
64 |
|
|
|
65 |
|
|
__try
|
66 |
|
|
{
|
67 |
|
|
RaiseException( 0x406D1388, 0, sizeof(info)/sizeof(DWORD),(DWORD*)&info );
|
68 |
|
|
}
|
69 |
|
|
__except (EXCEPTION_CONTINUE_EXECUTION)
|
70 |
|
|
{
|
71 |
|
|
}
|
72 |
|
|
}
|
73 |
|
|
//---------------------------------------------------------------------------
|
74 |
|
|
void __fastcall tsolve::Execute()
|
75 |
|
|
{
|
76 |
|
|
this->OnTerminate=Terminate;
|
77 |
|
|
fen.Button1->Visible=false;
|
78 |
|
|
fen.Label1->Font->Color=clRed;
|
79 |
|
|
fen.Button2->Caption="Annuler";
|
80 |
|
|
fen.Timer1->Enabled=true;
|
81 |
|
|
SetName();
|
82 |
|
|
long id=atol(fen.ComboBox1->Text.c_str());
|
83 |
|
|
int num1,num2;
|
84 |
|
|
if (fen.RadioButton2->Checked) num1=1;
|
85 |
|
|
else if (fen.RadioButton3->Checked) num1=2;
|
86 |
|
|
if (fen.RadioButton4->Checked) num2=1;
|
87 |
|
|
else if (fen.RadioButton5->Checked) num2=4;
|
88 |
|
|
int num=10*num1+num2;
|
89 |
|
|
SL_SOLVE_ELASTIQUE solve(num,fen.Caption.c_str(),id);
|
90 |
|
|
solve.resoud();
|
91 |
|
|
fen.Button2->Caption="Fermer";
|
92 |
|
|
fen.Label1->Font->Color=clGreen;
|
93 |
|
|
fen.Timer1->Enabled=false;
|
94 |
|
|
fen.Button1->Visible=true;
|
95 |
|
|
|
96 |
|
|
}
|
97 |
|
|
//---------------------------------------------------------------------------
|
98 |
|
|
void __fastcall tsolve::Terminate(TObject *Sender)
|
99 |
|
|
{
|
100 |
|
|
if (fen.Button2->Caption!="Fermer") fen.Label1->Caption="Erreur";
|
101 |
|
|
|
102 |
|
|
fen.Button2->Caption="Fermer";
|
103 |
|
|
fen.Timer1->Enabled=false;
|
104 |
|
|
}
|