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 |
|
|
// solveur.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 "solveur.h"
|
31 |
|
|
#include "process.h"
|
32 |
francois |
56 |
#include "mg_export.h"
|
33 |
|
5 |
#include <stdio.h>
|
34 |
|
|
//---------------------------------------------------------------------------
|
35 |
|
|
#pragma package(smart_init)
|
36 |
|
|
#pragma resource "*.dfm"
|
37 |
|
|
Tfsolve *fsolve;
|
38 |
|
|
//---------------------------------------------------------------------------
|
39 |
|
|
__fastcall Tfsolve::Tfsolve(TComponent* Owner,MG_GESTIONNAIRE *gestion)
|
40 |
|
|
: TForm(Owner),gest(gestion)
|
41 |
|
|
{
|
42 |
|
|
}
|
43 |
|
|
//---------------------------------------------------------------------------
|
44 |
|
|
void __fastcall Tfsolve::Button1Click(TObject *Sender)
|
45 |
|
|
{
|
46 |
|
|
long id=atol(ComboBox1->Text.c_str());
|
47 |
|
|
int num1,num2;
|
48 |
|
|
if ((RadioButton6->Checked) || (RadioButton1->Checked))
|
49 |
|
|
{
|
50 |
|
|
MG_MAILLAGE* mai=gest->get_mg_maillageid(id);
|
51 |
|
|
if (RadioButton2->Checked) num1=1;
|
52 |
|
|
else if (RadioButton3->Checked) num1=2;
|
53 |
|
|
if (RadioButton4->Checked) num2=1;
|
54 |
|
|
else if (RadioButton5->Checked) num2=4;
|
55 |
|
|
int num=10*num1+num2;
|
56 |
|
|
char name[500],arg1[10],arg2[10];
|
57 |
|
|
sprintf(arg1,"%d",num);
|
58 |
|
|
sprintf(arg2,"%ld",id);
|
59 |
|
|
DWORD type,taille;
|
60 |
|
|
HKEY clef;
|
61 |
|
|
char fichier[500];
|
62 |
|
|
sprintf(fichier,"\"%s\"",Caption.c_str());
|
63 |
|
|
RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\UQTR\\VMM\\",0,KEY_EXECUTE,&clef);
|
64 |
|
|
RegQueryValueEx(clef,"pathmodule",0,&type,0,&taille);
|
65 |
|
|
RegQueryValueEx(clef,"pathmodule",0,&type,name,&taille);
|
66 |
|
|
strcat(name,"\\solveur");
|
67 |
|
|
FEM_MAILLAGE* femmai=NULL;
|
68 |
|
|
int nb_fem_maillage=gest->get_nb_fem_maillage();
|
69 |
|
|
for (int i=0;i<nb_fem_maillage;i++)
|
70 |
|
|
{
|
71 |
|
|
FEM_MAILLAGE* femtmp=gest->get_fem_maillage(i);
|
72 |
|
|
long id2=femtmp->get_mg_maillage()->get_id();
|
73 |
|
|
if ((id==id2) && (num1==femtmp->get_degre()))
|
74 |
|
|
femmai=femtmp;
|
75 |
|
|
}
|
76 |
|
|
if (femmai==NULL)
|
77 |
|
|
{
|
78 |
|
|
femmai=new FEM_MAILLAGE(mai->get_mg_geometrie(),mai,num1);
|
79 |
|
|
gest->ajouter_fem_maillage(femmai);
|
80 |
|
|
femmai->construire(1);
|
81 |
|
|
gest->enregistrer(Caption.c_str());
|
82 |
|
|
char mess[255];
|
83 |
|
|
sprintf(mess,"Création du Maillage FEM %lu",femmai->get_id());
|
84 |
|
|
Label1->Caption=mess;
|
85 |
|
|
}
|
86 |
|
|
else
|
87 |
|
|
{
|
88 |
|
|
char mess[255];
|
89 |
|
|
sprintf(mess,"Activation du Maillage FEM %lu",femmai->get_id());
|
90 |
|
|
Label1->Caption=mess;
|
91 |
|
|
}
|
92 |
|
|
char idchar[20];
|
93 |
|
|
sprintf(idchar,"%lu",femmai->get_id());
|
94 |
|
|
char typeetude[50];
|
95 |
|
|
if (RadioButton1->Checked==true) sprintf(typeetude,"-elastoplastique");
|
96 |
|
|
if (RadioButton6->Checked==true) sprintf(typeetude,"-elastique");
|
97 |
|
|
spawnl(P_NOWAIT,name,name,typeetude,"-fichier",fichier,"-code",arg1,"-id",idchar,NULL);
|
98 |
|
|
}
|
99 |
|
|
if (RadioButton7->Checked)
|
100 |
|
|
{
|
101 |
|
|
int degre;
|
102 |
|
|
if (RadioButton2->Checked) degre=1;
|
103 |
|
|
else if (RadioButton3->Checked) degre=2;
|
104 |
|
|
MG_MAILLAGE* mai=gest->get_mg_maillageid(id);
|
105 |
|
|
FEM_MAILLAGE* femmai=new FEM_MAILLAGE(mai->get_mg_geometrie(),mai,degre);
|
106 |
|
|
gest->ajouter_fem_maillage(femmai);
|
107 |
|
|
femmai->construire(1);
|
108 |
|
|
gest->enregistrer(Caption.c_str());
|
109 |
|
|
char mess[255];
|
110 |
|
|
sprintf(mess,"Création du Maillage FEM %lu",femmai->get_id());
|
111 |
|
|
Label1->Caption=mess;
|
112 |
|
|
}
|
113 |
|
|
if (RadioButton8->Checked)
|
114 |
|
|
{
|
115 |
|
|
MG_MAILLAGE* mai=gest->get_mg_maillageid(id);
|
116 |
|
|
int degre;
|
117 |
|
|
if (RadioButton2->Checked) degre=1;
|
118 |
|
|
else if (RadioButton3->Checked) degre=2;
|
119 |
|
|
int nb_fem_maillage=gest->get_nb_fem_maillage();
|
120 |
|
|
FEM_MAILLAGE* femmai=NULL;
|
121 |
|
|
for (int i=0;i<nb_fem_maillage;i++)
|
122 |
|
|
{
|
123 |
|
|
FEM_MAILLAGE* femtmp=gest->get_fem_maillage(i);
|
124 |
|
|
long id2=femtmp->get_mg_maillage()->get_id();
|
125 |
|
|
if ((id==id2) && (degre==femtmp->get_degre()))
|
126 |
|
|
femmai=femtmp;
|
127 |
|
|
}
|
128 |
|
|
if (femmai==NULL)
|
129 |
|
|
{
|
130 |
|
|
femmai=new FEM_MAILLAGE(mai->get_mg_geometrie(),mai,degre);
|
131 |
|
|
gest->ajouter_fem_maillage(femmai);
|
132 |
|
|
femmai->construire(1);
|
133 |
|
|
gest->enregistrer(Caption.c_str());
|
134 |
|
|
char mess[255];
|
135 |
|
|
sprintf(mess,"Création du Maillage FEM %lu",femmai->get_id());
|
136 |
|
|
Label1->Caption=mess;
|
137 |
|
|
}
|
138 |
|
|
else
|
139 |
|
|
{
|
140 |
|
|
char mess[255];
|
141 |
|
|
sprintf(mess,"Activation du Maillage FEM %lu",femmai->get_id());
|
142 |
|
|
Label1->Caption=mess;
|
143 |
|
|
}
|
144 |
|
|
|
145 |
|
|
if (SaveDialog1->Execute())
|
146 |
|
|
{
|
147 |
|
|
string namefic=SaveDialog1->FileName.c_str();
|
148 |
|
|
femmai->exporter_cosmos(namefic);
|
149 |
|
|
}
|
150 |
|
|
}
|
151 |
francois |
56 |
if (RadioButton9->Checked)
|
152 |
|
|
{
|
153 |
|
|
MG_MAILLAGE* mai=gest->get_mg_maillageid(id);
|
154 |
|
|
int degre;
|
155 |
|
|
if (RadioButton2->Checked) degre=1;
|
156 |
|
|
else if (RadioButton3->Checked) degre=2;
|
157 |
|
|
int nb_fem_maillage=gest->get_nb_fem_maillage();
|
158 |
|
|
FEM_MAILLAGE* femmai=NULL;
|
159 |
|
|
for (int i=0;i<nb_fem_maillage;i++)
|
160 |
|
|
{
|
161 |
|
|
FEM_MAILLAGE* femtmp=gest->get_fem_maillage(i);
|
162 |
|
|
long id2=femtmp->get_mg_maillage()->get_id();
|
163 |
|
|
if ((id==id2) && (degre==femtmp->get_degre()))
|
164 |
|
|
femmai=femtmp;
|
165 |
|
|
}
|
166 |
|
|
if (femmai==NULL)
|
167 |
|
|
{
|
168 |
|
|
femmai=new FEM_MAILLAGE(mai->get_mg_geometrie(),mai,degre);
|
169 |
|
|
gest->ajouter_fem_maillage(femmai);
|
170 |
|
|
femmai->construire(1);
|
171 |
|
|
gest->enregistrer(Caption.c_str());
|
172 |
|
|
char mess[255];
|
173 |
|
|
sprintf(mess,"Création du Maillage FEM %lu",femmai->get_id());
|
174 |
|
|
Label1->Caption=mess;
|
175 |
|
|
}
|
176 |
|
|
else
|
177 |
|
|
{
|
178 |
|
|
char mess[255];
|
179 |
|
|
sprintf(mess,"Activation du Maillage FEM %lu",femmai->get_id());
|
180 |
|
|
Label1->Caption=mess;
|
181 |
|
|
}
|
182 |
|
|
|
183 |
|
|
if (SaveDialog1->Execute())
|
184 |
|
|
{
|
185 |
|
|
string namefic=SaveDialog1->FileName.c_str();
|
186 |
|
|
MG_EXPORT exp;
|
187 |
francois |
196 |
exp.aster(femmai,namefic,0,"00011111");
|
188 |
francois |
56 |
}
|
189 |
|
|
}
|
190 |
|
5 |
}
|
191 |
|
|
//---------------------------------------------------------------------------
|
192 |
|
|
void __fastcall Tfsolve::Button2Click(TObject *Sender)
|
193 |
|
|
{
|
194 |
|
|
Close();
|
195 |
|
|
}
|
196 |
|
|
//---------------------------------------------------------------------------
|
197 |
|
|
void __fastcall Tfsolve::FormClose(TObject *Sender, TCloseAction &Action)
|
198 |
|
|
{
|
199 |
|
|
Action=caFree;
|
200 |
|
|
}
|
201 |
|
|
//---------------------------------------------------------------------------
|
202 |
|
|
void __fastcall Tfsolve::RadioButton6Click(TObject *Sender)
|
203 |
|
|
{
|
204 |
|
|
GroupBox3->Enabled=true;
|
205 |
|
|
}
|
206 |
|
|
//---------------------------------------------------------------------------
|
207 |
|
|
|
208 |
|
|
void __fastcall Tfsolve::RadioButton1Click(TObject *Sender)
|
209 |
|
|
{
|
210 |
|
|
GroupBox3->Enabled=true;
|
211 |
|
|
}
|
212 |
|
|
//---------------------------------------------------------------------------
|
213 |
|
|
|
214 |
|
|
void __fastcall Tfsolve::RadioButton7Click(TObject *Sender)
|
215 |
|
|
{
|
216 |
|
|
GroupBox3->Enabled=false;
|
217 |
|
|
|
218 |
|
|
}
|
219 |
|
|
//---------------------------------------------------------------------------
|
220 |
|
|
|
221 |
|
|
void __fastcall Tfsolve::RadioButton8Click(TObject *Sender)
|
222 |
|
|
{
|
223 |
|
|
GroupBox3->Enabled=false;
|
224 |
|
|
}
|
225 |
|
|
//---------------------------------------------------------------------------
|
226 |
|
|
|