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 |
|
|
// importcosmos.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 |
|
|
#include "mg_file.h"
|
30 |
|
|
#include "importcosmos.h"
|
31 |
|
|
//---------------------------------------------------------------------------
|
32 |
|
|
#pragma package(smart_init)
|
33 |
|
|
#pragma resource "*.dfm"
|
34 |
|
|
TCosmosWin *CosmosWin;
|
35 |
|
|
//---------------------------------------------------------------------------
|
36 |
|
|
__fastcall TCosmosWin::TCosmosWin(TComponent* Owner)
|
37 |
|
|
: TForm(Owner)
|
38 |
|
|
{
|
39 |
|
|
}
|
40 |
|
|
//---------------------------------------------------------------------------
|
41 |
|
|
void __fastcall TCosmosWin::Button2Click(TObject *Sender)
|
42 |
|
|
{
|
43 |
|
|
ComboBox1->Text="";
|
44 |
|
|
Close();
|
45 |
|
|
}
|
46 |
|
|
//---------------------------------------------------------------------------
|
47 |
|
|
void __fastcall TCosmosWin::BitBtn1Click(TObject *Sender)
|
48 |
|
|
{
|
49 |
|
|
Memo1->Clear();
|
50 |
|
|
Memo1->PasteFromClipboard();
|
51 |
|
|
}
|
52 |
|
|
//---------------------------------------------------------------------------
|
53 |
|
|
void __fastcall TCosmosWin::changegestionnaire(MG_GESTIONNAIRE* gesttmp)
|
54 |
|
|
{
|
55 |
|
|
gest=gesttmp;
|
56 |
|
|
}
|
57 |
|
|
void __fastcall TCosmosWin::Button1Click(TObject *Sender)
|
58 |
|
|
{
|
59 |
|
|
int nbligne=Memo1->Lines->Count;
|
60 |
|
|
if (nbligne==0)
|
61 |
|
|
{
|
62 |
|
|
MessageBox(Handle,"Pas d'information","Erreur",MB_OK);
|
63 |
|
|
return ;
|
64 |
|
|
}
|
65 |
|
|
if (ComboBox1->Text=="")
|
66 |
|
|
{
|
67 |
|
|
MessageBox(Handle,"Pas de maillage selectionné","Erreur",MB_OK);
|
68 |
|
|
return ;
|
69 |
|
|
}
|
70 |
|
|
int debut=0;
|
71 |
|
|
FEM_SOLUTION* femsol;
|
72 |
|
|
for (int i=0;i<nbligne;i++)
|
73 |
|
|
{
|
74 |
|
|
char chaine[500];
|
75 |
|
|
strcpy(chaine,Memo1->Lines->Strings[i].c_str());
|
76 |
|
|
if (debut==0)
|
77 |
|
|
{
|
78 |
|
|
char arg1[100],arg2[100],arg3[100],arg4[100],arg5[100],arg6[100],arg7[100],arg8[100],arg9[100],arg10[100],arg11[100];
|
79 |
|
|
int nbchamps=sscanf(chaine,"%s %s %s %s %s %s %s %s %s %s %s",arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11);
|
80 |
|
|
if (strcmp(arg1,"Node")==0)
|
81 |
|
|
{
|
82 |
|
|
char nomfichier[500];
|
83 |
|
|
strcpy(nomfichier,Label2->Caption.c_str());
|
84 |
|
|
nomfichier[strlen(nomfichier)-6]=0;
|
85 |
|
|
int nb_sol=gest->get_nb_fem_solution()+gest->get_nb_mg_solution();
|
86 |
|
|
char mess[255];
|
87 |
|
|
sprintf(mess,".sol%d",nb_sol+1);
|
88 |
|
|
strcat(nomfichier,mess);
|
89 |
|
|
long idmai=atol(ComboBox1->Text.c_str());;
|
90 |
|
|
FEM_MAILLAGE* femmai=gest->get_fem_maillageid(idmai);
|
91 |
|
|
int nb_noeud=femmai->get_nb_fem_noeud();
|
92 |
|
|
char messtmp[1000];
|
93 |
|
|
strcpy(messtmp,Edit1->Text.c_str());
|
94 |
|
|
string nomsol=messtmp;
|
95 |
|
|
femsol=new FEM_SOLUTION(femmai,nbchamps-1,nomfichier,nb_noeud,nomsol);
|
96 |
|
|
gest->ajouter_fem_solution(femsol);
|
97 |
|
|
for (int i=0;i<nbchamps;i++)
|
98 |
|
|
{
|
99 |
|
|
if (i==1) femsol->change_legende(i-1,arg2);
|
100 |
|
|
if (i==2) femsol->change_legende(i-1,arg3);
|
101 |
|
|
if (i==3) femsol->change_legende(i-1,arg4);
|
102 |
|
|
if (i==4) femsol->change_legende(i-1,arg5);
|
103 |
|
|
if (i==5) femsol->change_legende(i-1,arg6);
|
104 |
|
|
if (i==6) femsol->change_legende(i-1,arg7);
|
105 |
|
|
if (i==7) femsol->change_legende(i-1,arg8);
|
106 |
|
|
if (i==8) femsol->change_legende(i-1,arg9);
|
107 |
|
|
if (i==9) femsol->change_legende(i-1,arg10);
|
108 |
|
|
if (i==10) femsol->change_legende(i-1,arg11);
|
109 |
|
|
}
|
110 |
|
|
debut=1;
|
111 |
|
|
}
|
112 |
|
|
}
|
113 |
|
|
else if (debut==1)
|
114 |
|
|
{
|
115 |
|
|
int num;
|
116 |
|
|
double val[10];
|
117 |
|
|
int nbchamps=sscanf(chaine,"%d %le %le %le %le %le %le %le %le %le %le",&num,val,val+1,val+2,val+3,val+4,val+5,val+6,val+7,val+8,val+9);
|
118 |
|
|
for (int i=0;i<nbchamps-1;i++)
|
119 |
|
|
femsol->ecrire(num-1,i,val[i]);
|
120 |
|
|
}
|
121 |
|
|
}
|
122 |
|
|
gest->enregistrer(Label2->Caption.c_str());
|
123 |
|
|
Close();
|
124 |
|
|
}
|
125 |
|
|
//---------------------------------------------------------------------------
|
126 |
|
|
void __fastcall TCosmosWin::FormClose(TObject *Sender,
|
127 |
|
|
TCloseAction &Action)
|
128 |
|
|
{
|
129 |
|
|
Action=caFree;
|
130 |
|
|
}
|
131 |
|
|
//---------------------------------------------------------------------------
|
132 |
|
|
|