ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/app/compare/src/main.cpp
Revision: 276
Committed: Wed Jun 15 18:25:46 2011 UTC (13 years, 11 months ago) by francois
File size: 4068 byte(s)
Log Message:
Correction de bug + Version toIbrep  version du premier exmple complet + construction de la vectorisation a la lecture du fichier

File Contents

# User Rev Content
1 francois 275 //------------------------------------------------------------
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 francois 276 #include "ot_cpu.h"
36 francois 275 //---------------------------------------------------------------------------
37    
38     void affiche(char* message)
39     {
40     #ifdef WINDOWS_VERSION
41     Form1->Memo1->Lines->Add(message);
42     #else
43     std::cout << message << std::endl;
44     #endif
45     }
46    
47    
48     #ifdef WINDOWS_VERSION
49     int amain(int argc,char **argv)
50     #else
51     int main(int argc,char **argv)
52     #endif
53     {
54     if (argc<3)
55     {
56     printf(" compare.exe -fichier1 fich1.magic -fichier2 fich2.magic -numgeo1 0 -numgeo2 0 -numvol1 0 -numvol2 0 -result fich.txt\n");
57     return 1;
58     }
59     char fichier[1000],fichier2[1000],fichierout[1000];
60     int numgeo1=0,numgeo2=0;
61     int numvol1=0,numvol2=0;
62     for (int i=0;i<argc;i++)
63     {
64     if (strcmp(argv[i],"-fichier1")==0) strcpy(fichier,argv[i+1]);
65     if (strcmp(argv[i],"-fichier2")==0) strcpy(fichier2,argv[i+1]);
66     if (strcmp(argv[i],"-result")==0) strcpy(fichierout,argv[i+1]);
67     if (strcmp(argv[i],"-numgeo1")==0) numgeo1=atoi(argv[i+1]);
68     if (strcmp(argv[i],"-numgeo2")==0) numgeo2=atoi(argv[i+1]);
69     if (strcmp(argv[i],"-numvol1")==0) numvol1=atoi(argv[i+1]);
70     if (strcmp(argv[i],"-numvol2")==0) numvol2=atoi(argv[i+1]);
71     }
72     affiche((char*)"***************************************");
73     affiche((char*)" COMPARATEUR DE GEOMETRIE ");
74     affiche((char*)" UQTR - ERICCA ");
75     affiche((char*)"***************************************");
76     affiche((char*)"");
77     affiche((char*)"");
78 francois 276 OT_CPU compteur;
79 francois 275 affiche((char*)"Lecture fichier 1");
80     MG_FILE *gest1=new MG_FILE(fichier);
81     MG_GEOMETRIE* geo1=gest1->get_mg_geometrie(numgeo1);
82     MG_VOLUME* vol1=geo1->get_mg_volume(numvol1);
83 francois 276 geo1->construit_vectorisation();
84     compteur.ajouter_etape("Lecture fichier 1");
85 francois 275 affiche((char*)"Lecture fichier 2");
86     MG_FILE *gest2=new MG_FILE(fichier2);
87     MG_GEOMETRIE* geo2=gest2->get_mg_geometrie(numgeo2);
88     MG_VOLUME* vol2=geo2->get_mg_volume(numvol2);
89 francois 276 geo2->construit_vectorisation();
90     int etapelf2=compteur.ajouter_etape("Lecture fichier 2");
91 francois 275 affiche((char*)"Comparaison");
92     VCT_COMPARAISON compare(gest1,geo1,gest2,geo2);
93     VCT_COMPARAISON_RESULTAT cmp(gest1,gest2,geo1,geo2);
94     compare.active_affichage(affiche);
95 francois 276 compare.compare(cmp,vol1,vol2,&compteur);
96     std::vector<std::string> tab;
97     compteur.get_tabfinal(tab);
98     for (int i=0;i<tab.size();i++)
99     affiche((char*)tab[i].c_str());
100     double temps;
101     std:string nom;
102     compteur.get_etape(etapelf2,compteur.get_nb_etape(),nom,temps);
103     char message[255];
104     sprintf(message," Temps CPU des algo de comparaison %.2lf s",temps);
105     affiche((char*)message);
106 francois 275 affiche((char*)"Enregistrement resultat comparaison");
107     cmp.enregistrer(fichierout,fichier,fichier2);
108    
109     delete gest1;
110     delete gest2;
111    
112    
113    
114    
115    
116    
117     return 0;
118     }
119    
120    
121    
122     #pragma package(smart_init)