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 "remailleur.h" |
34 |
|
|
#include <iostream> |
35 |
|
|
//--------------------------------------------------------------------------- |
36 |
|
|
|
37 |
|
|
void affiche(char* message) |
38 |
|
|
{ |
39 |
|
|
#ifdef WINDOWS_VERSION |
40 |
|
|
Form1->Memo1->Lines->Add(message); |
41 |
|
|
#else |
42 |
|
|
std::cout << message << std::endl; |
43 |
|
|
#endif |
44 |
|
|
} |
45 |
|
|
|
46 |
|
|
|
47 |
|
|
#ifdef WINDOWS_VERSION |
48 |
|
|
int amain(int argc,char **argv) |
49 |
|
|
#else |
50 |
|
|
int main(int argc,char **argv) |
51 |
|
|
#endif |
52 |
|
|
{ |
53 |
|
|
if (argc<3) return 1; |
54 |
|
|
char fichier[1000],fichiers[1000],fichier2[1000],fichiercarte1[1000],fichiercarte2[1000],fichierres[1000]; |
55 |
|
|
int nummaiorigine=0,numgeomodifie=0,rescmp=0; |
56 |
|
|
int diff=0; |
57 |
francois |
375 |
bool versioncompilee=false; |
58 |
francois |
283 |
for (int i=0;i<argc;i++) |
59 |
|
|
{ |
60 |
francois |
375 |
if (strcmp(argv[i],"-version")==0) versioncompilee=true; |
61 |
|
|
if (strcmp(argv[i],"-origine")==0) strcpy(fichier,argv[i+1]); |
62 |
francois |
283 |
if (strcmp(argv[i],"-modifie")==0) strcpy(fichier2,argv[i+1]); |
63 |
|
|
if (strcmp(argv[i],"-carteorigine")==0) strcpy(fichiercarte1,argv[i+1]); |
64 |
|
|
if (strcmp(argv[i],"-cartemodifie")==0) strcpy(fichiercarte2,argv[i+1]); |
65 |
|
|
if (strcmp(argv[i],"-nummaiorigine")==0) nummaiorigine=atoi(argv[i+1]); |
66 |
|
|
if (strcmp(argv[i],"-numgeomodifie")==0) numgeomodifie=atoi(argv[i+1]); |
67 |
|
|
if (strcmp(argv[i],"-out")==0) { |
68 |
|
|
strcpy(fichiers,argv[i+1]); |
69 |
|
|
diff=1; |
70 |
|
|
} |
71 |
|
|
if (strcmp(argv[i],"-rescmp")==0) { |
72 |
|
|
strcpy(fichierres,argv[i+1]); |
73 |
|
|
rescmp=1; |
74 |
|
|
} |
75 |
|
|
|
76 |
|
|
} |
77 |
|
|
if (!diff) strcpy(fichiers,fichier2); |
78 |
|
|
affiche((char*)"*******************"); |
79 |
|
|
affiche((char*)" REMAILLEUR "); |
80 |
|
|
affiche((char*)"*******************"); |
81 |
francois |
375 |
if (versioncompilee) |
82 |
|
|
{ |
83 |
|
|
GESTIONVERSION v; |
84 |
|
|
char version[500]; |
85 |
|
|
v.print(version); |
86 |
|
|
affiche(version); |
87 |
|
|
} |
88 |
francois |
283 |
affiche((char*)""); |
89 |
|
|
affiche((char*)""); |
90 |
|
|
affiche((char*)"Lecture fichier 1"); |
91 |
|
|
MG_FILE *gest1=new MG_FILE(fichier); |
92 |
|
|
affiche((char*)"Lecture fichier 2"); |
93 |
|
|
MG_FILE *gest2=new MG_FILE(fichier2); |
94 |
|
|
MG_MAILLAGE* mai1=gest1->get_mg_maillage(nummaiorigine); |
95 |
|
|
MG_GEOMETRIE* geo2=gest2->get_mg_geometrie(numgeomodifie); |
96 |
|
|
affiche((char*)"Comparaison"); |
97 |
|
|
VCT_COMPARAISON_RESULTAT cmp(gest1,gest2,mai1->get_mg_geometrie(),geo2); |
98 |
|
|
VCT_COMPARAISON compare(gest1,mai1->get_mg_geometrie(),gest2,geo2); |
99 |
|
|
clock_t cpu=clock(); |
100 |
|
|
compare.compare(cmp); |
101 |
|
|
clock_t cpu2=clock(); |
102 |
|
|
//cout << " identification en " << (cpu2-cpu)*1.0/CLOCKS_PER_SEC << " secondes" << endl; |
103 |
|
|
affiche((char*)"Resultat comparaison"); |
104 |
|
|
if (rescmp) cmp.enregistrer(fichierres,fichier,fichiers); |
105 |
|
|
//compare.identifier_les_modifications_appliquees(cmp); |
106 |
|
|
clock_t cpu3=clock(); |
107 |
|
|
//cout << " Localisation en " << (cpu3-cpu2)*1.0/CLOCKS_PER_SEC << " secondes" << endl; |
108 |
|
|
if (rescmp) cmp.enregistrer(fichierres,fichier,fichiers); |
109 |
|
|
FCT_GENERATEUR_3D<4> carte1; |
110 |
|
|
carte1.lire(fichiercarte1); |
111 |
|
|
FCT_GENERATEUR_3D<4> carte2; |
112 |
|
|
carte2.lire(fichiercarte2); |
113 |
|
|
MG_MAILLAGE* mmodi=new MG_MAILLAGE(geo2); |
114 |
|
|
gest2->ajouter_mg_maillage(mmodi); |
115 |
|
|
REMAILLEUR rm(gest1,gest2,mai1->get_mg_geometrie(),geo2,&carte1,&carte2,mai1,mmodi,cmp); |
116 |
|
|
rm.active_affichage(affiche); |
117 |
|
|
rm.maille(); |
118 |
|
|
affiche((char*)"Enregistrer"); |
119 |
|
|
gest2->enregistrer(fichiers); |
120 |
|
|
if (rescmp) cmp.enregistrer(fichierres,fichier,fichiers); |
121 |
|
|
affiche((char*)"Fin"); |
122 |
|
|
|
123 |
|
|
delete gest1; |
124 |
|
|
delete gest2; |
125 |
|
|
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
return 0; |
132 |
|
|
} |
133 |
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
#pragma package(smart_init) |