1 |
francois |
283 |
//------------------------------------------------------------ |
2 |
|
|
//------------------------------------------------------------ |
3 |
|
|
// MAGiC |
4 |
|
|
// Jean Christophe Cuilli�e et Vincent FRANCOIS |
5 |
|
|
// D�artement de G�ie M�anique - UQTR |
6 |
|
|
//------------------------------------------------------------ |
7 |
|
|
// Le projet MAGIC est un projet de recherche du d�artement |
8 |
|
|
// de g�ie m�anique de l'Universit�du Qu�ec � |
9 |
|
|
// Trois Rivi�es |
10 |
|
|
// Les librairies ne peuvent �re utilis�s sans l'accord |
11 |
|
|
// des auteurs (contact : francois@uqtr.ca) |
12 |
|
|
//------------------------------------------------------------ |
13 |
|
|
//------------------------------------------------------------ |
14 |
|
|
// |
15 |
|
|
// main.cpp |
16 |
|
|
// |
17 |
|
|
//------------------------------------------------------------ |
18 |
|
|
//------------------------------------------------------------ |
19 |
|
|
// COPYRIGHT 2000 |
20 |
|
|
// Version du 02/03/2006 �11H25 |
21 |
|
|
//------------------------------------------------------------ |
22 |
|
|
//------------------------------------------------------------ |
23 |
|
|
#include "gestionversion.h" |
24 |
|
|
#ifdef WINDOWS_VERSION |
25 |
|
|
#include "fenetre.h" |
26 |
|
|
#endif |
27 |
|
|
|
28 |
|
|
#pragma hdrstop |
29 |
|
|
#include <string.h> |
30 |
|
|
#include "vct_comparaison_resultat.h" |
31 |
|
|
#include "vct_comparaison.h" |
32 |
|
|
#include "mg_file.h" |
33 |
|
|
#include <iostream> |
34 |
|
|
#include "ot_cpu.h" |
35 |
|
|
//--------------------------------------------------------------------------- |
36 |
francois |
363 |
#ifdef _COMPARESTEP_ |
37 |
francois |
283 |
|
38 |
francois |
363 |
#include "occ_import.h" |
39 |
|
|
|
40 |
|
|
#endif |
41 |
francois |
283 |
void affiche(char* message) |
42 |
|
|
{ |
43 |
|
|
#ifdef WINDOWS_VERSION |
44 |
|
|
Form1->Memo1->Lines->Add(message); |
45 |
|
|
#else |
46 |
|
|
std::cout << message << std::endl; |
47 |
|
|
#endif |
48 |
|
|
} |
49 |
|
|
|
50 |
|
|
|
51 |
|
|
#ifdef WINDOWS_VERSION |
52 |
|
|
int amain(int argc,char **argv) |
53 |
|
|
#else |
54 |
|
|
int main(int argc,char **argv) |
55 |
|
|
#endif |
56 |
|
|
{ |
57 |
|
|
if (argc<3) |
58 |
|
|
{ |
59 |
francois |
364 |
#ifdef _COMPARESTEP_ |
60 |
|
|
printf(" compare.exe -fichier1 fich1.step -fichier2 fich2.step -numgeo1 0 -numgeo2 0 -numvol1 0 -numvol2 0 -result fich.txt\n"); |
61 |
|
|
#else |
62 |
|
|
printf(" compare.exe -fichier1 fich1.magic -fichier2 fich2.magic -numgeo1 0 -numgeo2 0 -numvol1 0 -numvol2 0 -result fich.txt\n"); |
63 |
|
|
#endif |
64 |
|
|
return 1; |
65 |
francois |
283 |
} |
66 |
|
|
char fichier[1000],fichier2[1000],fichierout[1000]; |
67 |
|
|
int numgeo1=0,numgeo2=0; |
68 |
|
|
int numvol1=0,numvol2=0; |
69 |
|
|
for (int i=0;i<argc;i++) |
70 |
|
|
{ |
71 |
|
|
if (strcmp(argv[i],"-fichier1")==0) strcpy(fichier,argv[i+1]); |
72 |
|
|
if (strcmp(argv[i],"-fichier2")==0) strcpy(fichier2,argv[i+1]); |
73 |
|
|
if (strcmp(argv[i],"-result")==0) strcpy(fichierout,argv[i+1]); |
74 |
|
|
if (strcmp(argv[i],"-numgeo1")==0) numgeo1=atoi(argv[i+1]); |
75 |
|
|
if (strcmp(argv[i],"-numgeo2")==0) numgeo2=atoi(argv[i+1]); |
76 |
|
|
if (strcmp(argv[i],"-numvol1")==0) numvol1=atoi(argv[i+1]); |
77 |
|
|
if (strcmp(argv[i],"-numvol2")==0) numvol2=atoi(argv[i+1]); |
78 |
|
|
} |
79 |
|
|
affiche((char*)"***************************************"); |
80 |
|
|
affiche((char*)" COMPARATEUR DE GEOMETRIE "); |
81 |
|
|
affiche((char*)" UQTR - ERICCA "); |
82 |
|
|
affiche((char*)"***************************************"); |
83 |
|
|
affiche((char*)""); |
84 |
|
|
affiche((char*)""); |
85 |
|
|
OT_CPU compteur; |
86 |
|
|
affiche((char*)"Lecture fichier 1"); |
87 |
francois |
363 |
#ifdef _COMPARESTEP_ |
88 |
|
|
OCC_IMPORT occimport; |
89 |
|
|
MG_GESTIONNAIRE gest_1; |
90 |
|
|
MG_GESTIONNAIRE* gest1=&gest_1; |
91 |
|
|
MG_GEOMETRIE* geo1=occimport.importer(*gest1,fichier,FICHIERSTEP,1.,1e-6); |
92 |
|
|
MG_VOLUME* vol1=geo1->get_mg_volume(numvol1); |
93 |
|
|
#else |
94 |
|
|
MG_FILE *gest1=new MG_FILE(fichier); |
95 |
|
|
MG_GEOMETRIE* geo1=gest1->get_mg_geometrie(numgeo1); |
96 |
|
|
MG_VOLUME* vol1=geo1->get_mg_volume(numvol1); |
97 |
|
|
#endif |
98 |
francois |
283 |
geo1->construit_vectorisation(); |
99 |
|
|
compteur.ajouter_etape("Lecture fichier 1"); |
100 |
|
|
affiche((char*)"Lecture fichier 2"); |
101 |
francois |
363 |
#ifdef _COMPARESTEP_ |
102 |
|
|
MG_GESTIONNAIRE gest_2; |
103 |
|
|
MG_GESTIONNAIRE* gest2=&gest_2; |
104 |
|
|
MG_GEOMETRIE* geo2=occimport.importer(*gest2,fichier2,FICHIERSTEP,1.,1e-6); |
105 |
|
|
MG_VOLUME* vol2=geo2->get_mg_volume(numvol2); |
106 |
|
|
#else |
107 |
|
|
MG_FILE *gest2=new MG_FILE(fichier2); |
108 |
|
|
MG_GEOMETRIE* geo2=gest2->get_mg_geometrie(numgeo2); |
109 |
|
|
MG_VOLUME* vol2=geo2->get_mg_volume(numvol2); |
110 |
|
|
#endif |
111 |
|
|
|
112 |
francois |
283 |
geo2->construit_vectorisation(); |
113 |
|
|
int etapelf2=compteur.ajouter_etape("Lecture fichier 2"); |
114 |
|
|
affiche((char*)"Comparaison"); |
115 |
|
|
VCT_COMPARAISON compare(gest1,geo1,gest2,geo2); |
116 |
|
|
VCT_COMPARAISON_RESULTAT cmp(gest1,gest2,geo1,geo2); |
117 |
|
|
compare.active_affichage(affiche); |
118 |
|
|
compare.compare(cmp,vol1,vol2,&compteur); |
119 |
|
|
std::vector<std::string> tab; |
120 |
|
|
compteur.get_tabfinal(tab); |
121 |
|
|
for (int i=0;i<tab.size();i++) |
122 |
|
|
affiche((char*)tab[i].c_str()); |
123 |
|
|
double temps; |
124 |
|
|
std: |
125 |
|
|
string nom; |
126 |
|
|
compteur.get_etape(etapelf2,compteur.get_nb_etape(),nom,temps); |
127 |
|
|
char message[255]; |
128 |
|
|
sprintf(message," Temps CPU des algo de comparaison %.2lf s",temps); |
129 |
|
|
affiche((char*)message); |
130 |
|
|
affiche((char*)"Enregistrement resultat comparaison"); |
131 |
francois |
351 |
cmp.compare_enregistrement(fichierout,fichier,fichier2); |
132 |
francois |
363 |
|
133 |
|
|
|
134 |
|
|
#ifndef _COMPARESTEP_ |
135 |
|
|
delete gest1; |
136 |
|
|
delete gest2; |
137 |
|
|
#endif |
138 |
francois |
283 |
|
139 |
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
|
143 |
|
|
return 0; |
144 |
|
|
} |
145 |
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
#pragma package(smart_init) |