ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/app/microstructure/src/main.cpp
Revision: 929
Committed: Fri May 11 18:14:54 2018 UTC (7 years ago) by couturad
File size: 26966 byte(s)
Log Message:
Mise a jour des fonctionnalites de MICROSTRUCTURE

File Contents

# User Rev Content
1 francois 756 //------------------------------------------------------------
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     // main.cpp
16     //
17     //------------------------------------------------------------
18     //------------------------------------------------------------
19     // COPYRIGHT 2000
20     // Version du 02/03/2006 � 11H25
21     //------------------------------------------------------------
22     //------------------------------------------------------------
23    
24    
25    
26    
27     #include "gestionversion.h"
28     #include "magic_application.h"
29 couturad 919 #include "mstruct_ves.h"
30     #include "mstruct_ver.h"
31     #include "mstruct_parametres.h"
32     #include "mg_gestionnaire.h"
33     #include "mg_file.h"
34     #include "fct_taille_fem_solution.h"
35 couturad 926 #include "mstruct_ves_file.h"
36 couturad 919 #ifdef ALL_OCC
37     #include "occ_import.h"
38     #endif
39 francois 756 //---------------------------------------------------------------------------
40    
41    
42 couturad 919 using namespace MICROSTRUCTURE;
43 francois 756
44     int main(int argc,char **argv)
45     {
46     std::vector<MAGIC_PARAMETRE_APPLICATION> lst;
47 couturad 919
48     // p_in(1) -in
49     // p_out(2) -out
50     MAGIC_PARAMETRE_APPLICATION p1(3,(char*)"-ves_in",MAGIC_PARAMETRE_APPLICATION::STRING,(char*)"Fichier VES d'entree");
51     MAGIC_PARAMETRE_APPLICATION p2(4,(char*)"-ves_out",MAGIC_PARAMETRE_APPLICATION::STRING,(char*)"Fichier VES de sortie");
52     MAGIC_PARAMETRE_APPLICATION p3(5,(char*)"-param",MAGIC_PARAMETRE_APPLICATION::STRING,(char*)"Fichier de parametres");
53     MAGIC_PARAMETRE_APPLICATION p4(6,(char*)"-lstparam",MAGIC_PARAMETRE_APPLICATION::STRING,(char*)"Fichier listant plusieurs fichiers de parametres");
54     MAGIC_PARAMETRE_APPLICATION p5(7,(char*)"-gen_geo",MAGIC_PARAMETRE_APPLICATION::ACTION,(char*)"Generer la geometrie");
55     MAGIC_PARAMETRE_APPLICATION p6(8,(char*)"-gen_mat",MAGIC_PARAMETRE_APPLICATION::ACTION,(char*)"Generer les materiaux");
56     MAGIC_PARAMETRE_APPLICATION p7(9,(char*)"-gen_carte",MAGIC_PARAMETRE_APPLICATION::ACTION,(char*)"Generer la carte de taille");
57     MAGIC_PARAMETRE_APPLICATION p8(10,(char*)"-gen_mg_maill",MAGIC_PARAMETRE_APPLICATION::ACTION,(char*)"Generer le MG maillage");
58     MAGIC_PARAMETRE_APPLICATION p9(11,(char*)"-gen_fem_maill",MAGIC_PARAMETRE_APPLICATION::ACTION,(char*)"Generer le FEM maillage");
59     MAGIC_PARAMETRE_APPLICATION p10(12,(char*)"-gen_etude",MAGIC_PARAMETRE_APPLICATION::ACTION,(char*)"Generer l'etude");
60 couturad 926 MAGIC_PARAMETRE_APPLICATION p11(13,(char*)"-gen_analyse",MAGIC_PARAMETRE_APPLICATION::ACTION,(char*)"Generer l'analyse des resultats");
61 couturad 919 MAGIC_PARAMETRE_APPLICATION p12(14,(char*)"-carte",MAGIC_PARAMETRE_APPLICATION::STRING,(char*)"Carte de taille FEM solution");
62     MAGIC_PARAMETRE_APPLICATION p13(15,(char*)"-calcul",MAGIC_PARAMETRE_APPLICATION::ACTION,(char*)"Lancer la resolution numerique");
63     MAGIC_PARAMETRE_APPLICATION p14(16,(char*)"-creeparam",MAGIC_PARAMETRE_APPLICATION::ACTION,(char*)"Creer une structure de parametres");
64     MAGIC_PARAMETRE_APPLICATION p15(17,(char*)"-tristl",MAGIC_PARAMETRE_APPLICATION::ACTION,(char*)"Importation de la triangulation STL de la microstructure");
65     MAGIC_PARAMETRE_APPLICATION p16(18,(char*)"-eps",MAGIC_PARAMETRE_APPLICATION::DOUBLE,(char*)"Distance max entre la triangulation et la géométrie");
66     MAGIC_PARAMETRE_APPLICATION p17(19,(char*)"-paramaster",MAGIC_PARAMETRE_APPLICATION::STRING,(char*)"Fichier de parametre aster");
67 couturad 926 MAGIC_PARAMETRE_APPLICATION p18(20,(char*)"-dossier",MAGIC_PARAMETRE_APPLICATION::STRING,(char*)"Dossier de resultat");
68     MAGIC_PARAMETRE_APPLICATION p19(21,(char*)"-cumuler_analyse",MAGIC_PARAMETRE_APPLICATION::ACTION,(char*)"Cumuler les analyses d'une liste de VES");
69 couturad 919 MAGIC_PARAMETRE_APPLICATION p20(22,(char*)"-lstves",MAGIC_PARAMETRE_APPLICATION::STRING,(char*)"Liste de VES");
70 couturad 926 MAGIC_PARAMETRE_APPLICATION p21(23,(char*)"-affiche_contenu",MAGIC_PARAMETRE_APPLICATION::ACTION,(char*)"Affiche le contenu d'un fichier VES");
71     MAGIC_PARAMETRE_APPLICATION p22(24,(char*)"-incrementale",MAGIC_PARAMETRE_APPLICATION::BOOL,(char*)"Cumuler les analyses de facon incrementale");
72     MAGIC_PARAMETRE_APPLICATION p23(25,(char*)"-avec_histogramme",MAGIC_PARAMETRE_APPLICATION::BOOL,(char*)"Generer les histogrammes");
73 couturad 927 MAGIC_PARAMETRE_APPLICATION p24(26,(char*)"-calculer_modules_meca",MAGIC_PARAMETRE_APPLICATION::ACTION,(char*)"Calculer les modules mecaniques d'une liste de VES");
74     MAGIC_PARAMETRE_APPLICATION p25(27,(char*)"-lstves_spherique",MAGIC_PARAMETRE_APPLICATION::STRING,(char*)"Liste de VES de type chargement spherique");
75     MAGIC_PARAMETRE_APPLICATION p26(28,(char*)"-lstves_deviatorique",MAGIC_PARAMETRE_APPLICATION::STRING,(char*)"Liste de VES de type chargement deviatorique");
76 couturad 929 MAGIC_PARAMETRE_APPLICATION p27(29,(char*)"-type_etude",MAGIC_PARAMETRE_APPLICATION::INTEGER,(char*)"Type d'etude : [0] mecanique, [1] thermique");
77 couturad 919
78     p5.ajouter_dependance(4);p5.ajouter_dependance(5);p5.ajouter_dependance(6);
79     p6.ajouter_dependance(3);p6.ajouter_dependance(4);p6.ajouter_dependance(5);p6.ajouter_dependance(6);
80 couturad 926 p7.ajouter_dependance(3);p7.ajouter_dependance(4);p7.ajouter_dependance(5);
81 couturad 919 p8.ajouter_dependance(3);p8.ajouter_dependance(4);p8.ajouter_dependance(5);p8.ajouter_dependance(14);
82     p9.ajouter_dependance(3);p9.ajouter_dependance(4);p9.ajouter_dependance(5);
83     p10.ajouter_dependance(3);p10.ajouter_dependance(4);p10.ajouter_dependance(5);
84 couturad 926 p11.ajouter_dependance(3);p11.ajouter_dependance(4);p11.ajouter_dependance(5);p11.ajouter_dependance(6);
85 couturad 919 p13.ajouter_dependance(3);p13.ajouter_dependance(4);p13.ajouter_dependance(5);p13.ajouter_dependance(19);
86 couturad 929 p14.ajouter_dependance(5);p14.ajouter_dependance(29);
87 couturad 919 p15.ajouter_dependance(3);p15.ajouter_dependance(18);p15.ajouter_dependance(4);
88 couturad 926 p19.ajouter_dependance(22);p19.ajouter_dependance(5);p19.ajouter_dependance(6);p19.ajouter_dependance(20);p19.ajouter_dependance(24);p19.ajouter_dependance(25);
89 couturad 919 p21.ajouter_dependance(3);
90 couturad 927 p24.ajouter_dependance(5);p24.ajouter_dependance(6);p24.ajouter_dependance(20);p24.ajouter_dependance(24);p24.ajouter_dependance(25);p24.ajouter_dependance(27);p24.ajouter_dependance(28);
91 couturad 772 lst.push_back(p1);
92     lst.push_back(p2);
93     lst.push_back(p3);
94 couturad 919 lst.push_back(p4);
95     lst.push_back(p5);
96     lst.push_back(p6);
97     lst.push_back(p7);
98     lst.push_back(p8);
99     lst.push_back(p9);
100     lst.push_back(p10);
101     lst.push_back(p11);
102     lst.push_back(p12);
103     lst.push_back(p13);
104     lst.push_back(p14);
105     lst.push_back(p15);
106     lst.push_back(p16);
107     lst.push_back(p17);
108     lst.push_back(p18);
109     lst.push_back(p19);
110     lst.push_back(p20);
111     lst.push_back(p21);
112 couturad 926 lst.push_back(p22);
113     lst.push_back(p23);
114 couturad 927 lst.push_back(p24);
115     lst.push_back(p25);
116     lst.push_back(p26);
117 couturad 929 lst.push_back(p27);
118 francois 756
119 couturad 919 MAGIC_APPLICATION app((char*)"Homogéinisation d'une microstructure",argc,argv,lst,true,true);
120     if(app.get_erreur()==true) return 0;
121    
122     if(app.get_action()==7)
123 couturad 772 {
124 couturad 919 app.affiche((char*)"**************************************");
125     app.affiche((char*)"*** Generation de la geometrie ***");
126     app.affiche((char*)"**************************************");
127     char fichier_ves_out[500];
128     char fichier_param[500];
129     char fichier_lstparam[500];
130     app.recupere_parametre_string(4,fichier_ves_out,(char*)"Fichier VES de sortie manquant");
131     app.recupere_parametre_string_avec_defaut(5,fichier_param,(char*)"");
132     app.recupere_parametre_string_avec_defaut(6,fichier_lstparam,(char*)"");
133     if (app.get_erreur()==true) return 0;
134     std::string str_fichier_ves_out = fichier_ves_out;
135     size_t found = str_fichier_ves_out.rfind((char*)".");
136     std::string str_fichier_magic_out = str_fichier_ves_out.substr(0,found);
137     str_fichier_magic_out.append((char*)".magic");
138     if(strlen(fichier_param)>0 && strlen(fichier_lstparam)>0)
139     {
140     app.affiche_erreur((char*)"Une seule valeur pour -param OU -lstparam doit etre fournie");
141     return 0;
142     }
143     if(strlen(fichier_param)>0)
144     {
145     std::vector<OT_PARAMETRES*> vector_param_geometrie;
146     OT_PARAMETRES* param_geometrie = new OT_PARAMETRES;
147     PARAMETRES::importer_fichier_parametres(fichier_param,param_geometrie);
148     vector_param_geometrie.push_back(param_geometrie);
149 couturad 926 MSTRUCT_VES ves;
150 couturad 919 ves.active_affichage(app.affiche);
151     ves.generer_geometrie(vector_param_geometrie);
152     ves.enregistrer(fichier_ves_out,(char*)str_fichier_magic_out.c_str());
153     delete param_geometrie;
154     }
155     else if(strlen(fichier_lstparam)>0)
156     {
157     std::vector<OT_PARAMETRES*> vector_param_geometrie;
158     PARAMETRES::importer_fichier_liste_parametres(fichier_lstparam,vector_param_geometrie);
159 couturad 926 MSTRUCT_VES ves;
160 couturad 919 ves.active_affichage(app.affiche);
161     ves.generer_geometrie(vector_param_geometrie);
162     ves.enregistrer(fichier_ves_out,(char*)str_fichier_magic_out.c_str());
163     std::vector<OT_PARAMETRES*>::iterator it_vector;
164     for(it_vector=vector_param_geometrie.begin();it_vector!=vector_param_geometrie.end();it_vector++)
165     {
166     delete *it_vector;
167     }
168     }
169 couturad 772 }
170 francois 756
171 couturad 919 if(app.get_action()==8)
172 couturad 772 {
173 couturad 919 app.affiche((char*)"************************************");
174     app.affiche((char*)"*** Generation des materiaux ***");
175     app.affiche((char*)"************************************");
176     char fichier_ves_in[500];
177     char fichier_ves_out[500];
178     char fichier_param[500];
179     char fichier_lstparam[500];
180     app.recupere_parametre_string(3,fichier_ves_in,(char*)"Fichier VES de entrant manquant");
181     app.recupere_parametre_string(4,fichier_ves_out,(char*)"Fichier VES de sortie manquant");
182     app.recupere_parametre_string_avec_defaut(5,fichier_param,(char*)"");
183     app.recupere_parametre_string_avec_defaut(6,fichier_lstparam,(char*)"");
184     if (app.get_erreur()==true) return 0;
185     std::string str_fichier_ves_out = fichier_ves_out;
186     size_t found = str_fichier_ves_out.rfind((char*)".");
187     std::string str_fichier_magic_out = str_fichier_ves_out.substr(0,found);
188     str_fichier_magic_out.append((char*)".magic");
189     if(strlen(fichier_param)>0 && strlen(fichier_lstparam)>0)
190     {
191     app.affiche_erreur((char*)"Une seule valeur pour -param OU -lstparam doit etre fournie");
192     return 0;
193     }
194     if(strlen(fichier_param)>0)
195     {
196     std::vector<OT_PARAMETRES*> vector_param_materiau;
197     OT_PARAMETRES* param_materiau = new OT_PARAMETRES;
198     PARAMETRES::importer_fichier_parametres(fichier_param,param_materiau);
199     vector_param_materiau.push_back(param_materiau);
200 couturad 926 MSTRUCT_VES ves(fichier_ves_in);
201 couturad 919 ves.active_affichage(app.affiche);
202     ves.generer_materiau(vector_param_materiau);
203     ves.enregistrer(fichier_ves_out,(char*)str_fichier_magic_out.c_str());
204     delete param_materiau;
205     }
206     else if(strlen(fichier_lstparam)>0)
207     {
208     std::vector<OT_PARAMETRES*> vector_param_materiau;
209     PARAMETRES::importer_fichier_liste_parametres(fichier_lstparam,vector_param_materiau);
210 couturad 926 MSTRUCT_VES ves(fichier_ves_in);
211 couturad 919 ves.active_affichage(app.affiche);
212     ves.generer_materiau(vector_param_materiau);
213     ves.enregistrer(fichier_ves_out,(char*)str_fichier_magic_out.c_str());
214     std::vector<OT_PARAMETRES*>::iterator it_vector;
215     for(it_vector=vector_param_materiau.begin();it_vector!=vector_param_materiau.end();it_vector++)
216     {
217     delete *it_vector;
218     }
219     }
220 couturad 772 }
221 couturad 919
222     if(app.get_action()==9)
223     {
224     app.affiche((char*)"********************************************");
225     app.affiche((char*)"*** Generation de la carte de taille ***");
226     app.affiche((char*)"********************************************");
227     char fichier_ves_in[500];
228     char fichier_param[500];
229 couturad 926 char fichier_ves_out[500];
230 couturad 919 app.recupere_parametre_string(3,fichier_ves_in,(char*)"Fichier VES de entrant manquant");
231 couturad 926 app.recupere_parametre_string(4,fichier_ves_out,(char*)"Fichier VES de sortie manquant");
232 couturad 919 app.recupere_parametre_string(5,fichier_param,(char*)"Fichier de parametre manquant");
233     if (app.get_erreur()==true) return 0;
234     OT_PARAMETRES* param_carte = new OT_PARAMETRES;
235     PARAMETRES::importer_fichier_parametres(fichier_param,param_carte);
236 couturad 926 MSTRUCT_VES ves(fichier_ves_in);
237 couturad 919 ves.active_affichage(app.affiche);
238     ves.generer_carte(param_carte);
239 couturad 926 ves.enregistrer(fichier_ves_out);
240 couturad 919 delete param_carte;
241     }
242    
243     if(app.get_action()==10)
244     {
245     app.affiche((char*)"**********************************");
246     app.affiche((char*)"*** Generation du maillage ***");
247     app.affiche((char*)"**********************************");
248     char fichier_ves_in[500];
249     char fichier_ves_out[500];
250     char fichier_param[500];
251     char fichier_carte[500];
252     app.recupere_parametre_string(3,fichier_ves_in,(char*)"Fichier VES de entrant manquant");
253     app.recupere_parametre_string(4,fichier_ves_out,(char*)"Fichier VES de sortie manquant");
254     app.recupere_parametre_string(5,fichier_param,(char*)"Fichier de parametre manquant");
255     app.recupere_parametre_string(14,fichier_carte,(char*)"Fichier de carte de taille manquant");
256     if (app.get_erreur()==true) return 0;
257     std::string str_fichier_ves_out = fichier_ves_out;
258     size_t found = str_fichier_ves_out.rfind((char*)".");
259     std::string str_fichier_magic_out = str_fichier_ves_out.substr(0,found);
260     str_fichier_magic_out.append((char*)".magic");
261     OT_PARAMETRES* param_maillage = new OT_PARAMETRES;
262     PARAMETRES::importer_fichier_parametres(fichier_param,param_maillage);
263 couturad 926 MSTRUCT_VES ves(fichier_ves_in);
264 couturad 919 ves.active_affichage(app.affiche);
265     FCT_TAILLE_FEM_SOLUTION *carte=new FCT_TAILLE_FEM_SOLUTION(fichier_carte);
266     ves.generer_maillage(param_maillage,carte);
267     ves.enregistrer(fichier_ves_out,(char*)str_fichier_magic_out.c_str());
268     delete param_maillage;
269     delete carte;
270     }
271    
272     if(app.get_action()==11)
273     {
274     app.affiche((char*)"**************************************");
275     app.affiche((char*)"*** Generation du FEM maillage ***");
276     app.affiche((char*)"**************************************");
277     char fichier_ves_in[500];
278     char fichier_ves_out[500];
279     char fichier_param[500];
280     app.recupere_parametre_string(3,fichier_ves_in,(char*)"Fichier VES de entrant manquant");
281     app.recupere_parametre_string(4,fichier_ves_out,(char*)"Fichier VES de sortie manquant");
282     app.recupere_parametre_string(5,fichier_param,(char*)"Fichier de parametre manquant");
283     if (app.get_erreur()==true) return 0;
284     std::string str_fichier_ves_out = fichier_ves_out;
285     size_t found = str_fichier_ves_out.rfind((char*)".");
286     std::string str_fichier_magic_out = str_fichier_ves_out.substr(0,found);
287     str_fichier_magic_out.append((char*)".magic");
288     OT_PARAMETRES* param_maillage = new OT_PARAMETRES;
289     PARAMETRES::importer_fichier_parametres(fichier_param,param_maillage);
290 couturad 926 MSTRUCT_VES ves(fichier_ves_in);
291 couturad 919 ves.active_affichage(app.affiche);
292     ves.generer_fem_maillage(param_maillage);
293     ves.enregistrer(fichier_ves_out,(char*)str_fichier_magic_out.c_str());
294     delete param_maillage;
295     }
296    
297    
298     if(app.get_action()==12)
299     {
300     app.affiche((char*)"*********************************");
301     app.affiche((char*)"*** Generation de l'etude ***");
302     app.affiche((char*)"*********************************");
303     char fichier_ves_in[500];
304     char fichier_ves_out[500];
305     char fichier_param[500];
306     app.recupere_parametre_string(3,fichier_ves_in,(char*)"Fichier VES de entrant manquant");
307     app.recupere_parametre_string(4,fichier_ves_out,(char*)"Fichier VES de sortie manquant");
308     app.recupere_parametre_string(5,fichier_param,(char*)"Fichier de parametre manquant");
309     if (app.get_erreur()==true) return 0;
310     std::string str_fichier_ves_out = fichier_ves_out;
311     size_t found = str_fichier_ves_out.rfind((char*)".");
312     std::string str_fichier_magic_out = str_fichier_ves_out.substr(0,found);
313     str_fichier_magic_out.append((char*)".magic");
314     OT_PARAMETRES* param_etude = new OT_PARAMETRES;
315     PARAMETRES::importer_fichier_parametres(fichier_param,param_etude);
316 couturad 926 MSTRUCT_VES ves(fichier_ves_in);
317 couturad 919 ves.active_affichage(app.affiche);
318     ves.generer_etude(param_etude);
319     ves.enregistrer(fichier_ves_out,(char*)str_fichier_magic_out.c_str());
320     delete param_etude;
321     }
322    
323     if(app.get_action()==13)
324     {
325 couturad 926 app.affiche((char*)"*************************************************");
326     app.affiche((char*)"*** Generation de l'analyse des resultats ***");
327     app.affiche((char*)"*************************************************");
328 couturad 919 char fichier_ves_in[500];
329 couturad 926 char fichier_ves_out[500];
330 couturad 919 char fichier_param[500];
331 couturad 926 char fichier_lstparam[500];
332 couturad 919 app.recupere_parametre_string(3,fichier_ves_in,(char*)"Fichier VES de entrant manquant");
333 couturad 926 app.recupere_parametre_string(4,fichier_ves_out,(char*)"Fichier VES de sortie manquant");
334     app.recupere_parametre_string_avec_defaut(5,fichier_param,(char*)"");
335     app.recupere_parametre_string_avec_defaut(6,fichier_lstparam,(char*)"");
336 couturad 919 if (app.get_erreur()==true) return 0;
337 couturad 926 if(strlen(fichier_param)>0 && strlen(fichier_lstparam)>0)
338     {
339     app.affiche_erreur((char*)"Une seule valeur pour -param OU -lstparam doit etre fournie");
340     return 0;
341     }
342     if(strlen(fichier_param)>0)
343     {
344     std::vector<OT_PARAMETRES*> vector_param_analyse;
345     OT_PARAMETRES* param_analyse = new OT_PARAMETRES;
346     PARAMETRES::importer_fichier_parametres(fichier_param,param_analyse);
347     vector_param_analyse.push_back(param_analyse);
348     MSTRUCT_VES ves(fichier_ves_in);
349     ves.active_affichage(app.affiche);
350     ves.generer_analyse(vector_param_analyse);
351     ves.enregistrer(fichier_ves_out);
352     delete param_analyse;
353     }
354     else if(strlen(fichier_lstparam)>0)
355     {
356     std::vector<OT_PARAMETRES*> vector_param_analyse;
357     PARAMETRES::importer_fichier_liste_parametres(fichier_lstparam,vector_param_analyse);
358     MSTRUCT_VES ves(fichier_ves_in);
359     ves.active_affichage(app.affiche);
360     ves.generer_analyse(vector_param_analyse);
361     ves.enregistrer(fichier_ves_out);
362     std::vector<OT_PARAMETRES*>::iterator it_vector;
363     for(it_vector=vector_param_analyse.begin();it_vector!=vector_param_analyse.end();it_vector++)
364     {
365     delete *it_vector;
366     }
367     }
368 couturad 919 }
369    
370     if(app.get_action()==15)
371     {
372     app.affiche((char*)"******************");
373     app.affiche((char*)"*** Calcul ***");
374     app.affiche((char*)"******************");
375     char fichier_ves_in[500];
376     char fichier_ves_out[500];
377     char fichier_param[500];
378     char fichier_param_aster[500];
379     app.recupere_parametre_string(3,fichier_ves_in,(char*)"Fichier VES de entrant manquant");
380     app.recupere_parametre_string(4,fichier_ves_out,(char*)"Fichier VES de sortie manquant");
381     app.recupere_parametre_string(5,fichier_param,(char*)"Fichier de parametre manquant");
382     app.recupere_parametre_string(19,fichier_param_aster,(char*)"Fichier de parametre aster manquant");
383     if (app.get_erreur()==true) return 0;
384     std::string str_fichier_ves_out = fichier_ves_out;
385     size_t found = str_fichier_ves_out.rfind((char*)".");
386     std::string str_fichier_magic_out = str_fichier_ves_out.substr(0,found);
387     str_fichier_magic_out.append((char*)".magic");
388     OT_PARAMETRES* param_etude = new OT_PARAMETRES;
389     PARAMETRES::importer_fichier_parametres(fichier_param,param_etude);
390 couturad 926 MSTRUCT_VES ves(fichier_ves_in);
391 couturad 919 ves.active_affichage(app.affiche);
392 couturad 926 ves.generer_calcul(param_etude,fichier_param_aster);
393 couturad 919 ves.enregistrer(fichier_ves_out,(char*)str_fichier_magic_out.c_str());
394     delete param_etude;
395     }
396    
397     if(app.get_action()==16)
398     {
399 couturad 929 app.affiche((char*)"***********************************************");
400     app.affiche((char*)"*** Creation des fichiers de parametres ***");
401     app.affiche((char*)"***********************************************");
402 couturad 919 char fichier_param[500];
403 couturad 929 int type_etude;
404 couturad 919 app.recupere_parametre_string(5,fichier_param,(char*)"Fichier de parametre manquant");
405 couturad 929 app.recupere_parametre_int(29,type_etude,(char*)"Type d'etude manquant");
406 couturad 919 if (app.get_erreur()==true) return 0;
407     PARAMETRES::generer_fichier_parametres(fichier_param);
408 couturad 929 PARAMETRES::generer_script_ves(type_etude);
409 couturad 919 }
410    
411     if(app.get_action()==17)
412     {
413     #ifdef ALL_OCC
414     app.affiche((char*)"********************************************************************");
415     app.affiche((char*)"*** Importation de la triangulation STL de la microstructure ***");
416     app.affiche((char*)"********************************************************************");
417     char fichier_ves_in[500];
418     char fichier_ves_out[500];
419     app.recupere_parametre_string(3,fichier_ves_in,(char*)"Fichier VES de entrant manquant");
420     app.recupere_parametre_string(4,fichier_ves_out,(char*)"Fichier VES de sortie manquant");
421     double eps;
422     app.recupere_parametre_double_avec_defaut(18,eps,0.1);
423     if (app.get_erreur()==true) return 0;
424     std::string str_fichier_ves_out = fichier_ves_out;
425     size_t found = str_fichier_ves_out.rfind((char*)".");
426     std::string str_fichier_magic_out = str_fichier_ves_out.substr(0,found);
427     str_fichier_magic_out.append((char*)".magic");
428 couturad 926 MSTRUCT_VES ves(fichier_ves_in);
429 couturad 919 MG_GESTIONNAIRE* gest = ves.get_mg_gestionnaire();
430     MG_GEOMETRIE* mggeo = ves.get_mg_geometrie();
431     OCC_IMPORT occ_import;
432     MG_MAILLAGE* tristl = occ_import.importer_triangulation_V2017(*gest,mggeo,eps);
433     ves.enregistrer(fichier_ves_out,(char*)str_fichier_magic_out.c_str());
434     #endif
435     }
436    
437     if(app.get_action()==21)
438     {
439 couturad 926 app.affiche((char*)"******************************");
440     app.affiche((char*)"*** Cumul des analyses ***");
441     app.affiche((char*)"******************************");
442 couturad 919 char fichier_lst_ves[500];
443     char fichier_param[500];
444     char fichier_lstparam[500];
445 couturad 926 char dossier_resultat[500];
446     bool incrementale;
447     bool avec_histogramme;
448 couturad 919 app.recupere_parametre_string(22,fichier_lst_ves,(char*)"Fichier de liste de VES");
449     app.recupere_parametre_string_avec_defaut(5,fichier_param,(char*)"");
450     app.recupere_parametre_string_avec_defaut(6,fichier_lstparam,(char*)"");
451 couturad 926 app.recupere_parametre_string_avec_defaut(20,dossier_resultat,(char*)"");
452     app.recupere_parametre_bool_avec_defaut(24,incrementale,false);
453     app.recupere_parametre_bool_avec_defaut(25,avec_histogramme,false);
454 couturad 919 if (app.get_erreur()==true) return 0;
455     if(strlen(fichier_param)>0 && strlen(fichier_lstparam)>0)
456     {
457     app.affiche_erreur((char*)"Une seule valeur pour -param OU -lstparam doit etre fournie");
458     return 0;
459     }
460     if(strlen(fichier_param)>0)
461     {
462     std::vector<OT_PARAMETRES*> vector_param;
463     OT_PARAMETRES* param = new OT_PARAMETRES;
464     PARAMETRES::importer_fichier_parametres(fichier_param,param);
465     vector_param.push_back(param);
466 couturad 926 MSTRUCT_VER ver;
467 couturad 919 ver.active_affichage(app.affiche);
468 couturad 926 ver.cumuler_analyse(fichier_lst_ves,vector_param,dossier_resultat,incrementale,avec_histogramme);
469 couturad 919 delete param;
470     }
471     else if(strlen(fichier_lstparam)>0)
472     {
473     std::vector<OT_PARAMETRES*> vector_param;
474     PARAMETRES::importer_fichier_liste_parametres(fichier_lstparam,vector_param);
475 couturad 926 MSTRUCT_VER ver;
476 couturad 919 ver.active_affichage(app.affiche);
477 couturad 926 ver.cumuler_analyse(fichier_lst_ves,vector_param,dossier_resultat,incrementale,avec_histogramme);
478 couturad 919 std::vector<OT_PARAMETRES*>::iterator it_vector;
479     for(it_vector=vector_param.begin();it_vector!=vector_param.end();it_vector++)
480     {
481     delete *it_vector;
482     }
483     }
484     }
485    
486     if(app.get_action()==23)
487     {
488 couturad 926 app.affiche((char*)"***************************");
489     app.affiche((char*)"*** AFFICHE CONTENU ***");
490     app.affiche((char*)"***************************");
491 couturad 919 char fichier_ves_in[500];
492     app.recupere_parametre_string(3,fichier_ves_in,(char*)"Fichier VES de entrant manquant");
493     if (app.get_erreur()==true) return 0;
494 couturad 926 MSTRUCT_VES_FILE ves_file;
495     ves_file.ouvrir(fichier_ves_in);
496     ves_file.affiche_contenu(app.affiche);
497 couturad 919 }
498    
499 couturad 927 if(app.get_action()==26)
500     {
501     app.affiche((char*)"*****************************************");
502     app.affiche((char*)"*** Calcul des modules mecaniques ***");
503     app.affiche((char*)"*****************************************");
504     char fichier_lst_ves_sph[500];
505     char fichier_lst_ves_dev[500];
506     char fichier_param[500];
507     char fichier_lstparam[500];
508     char dossier_resultat[500];
509     bool incrementale;
510     bool avec_histogramme;
511     app.recupere_parametre_string(27,fichier_lst_ves_sph,(char*)"Liste de VES de type chargement spherique");
512     app.recupere_parametre_string(28,fichier_lst_ves_dev,(char*)"Liste de VES de type chargement deviatorique");
513     app.recupere_parametre_string_avec_defaut(5,fichier_param,(char*)"");
514     app.recupere_parametre_string_avec_defaut(6,fichier_lstparam,(char*)"");
515     app.recupere_parametre_string_avec_defaut(20,dossier_resultat,(char*)"");
516     app.recupere_parametre_bool_avec_defaut(24,incrementale,false);
517     app.recupere_parametre_bool_avec_defaut(25,avec_histogramme,false);
518     if (app.get_erreur()==true) return 0;
519     if(strlen(fichier_param)>0 && strlen(fichier_lstparam)>0)
520     {
521     app.affiche_erreur((char*)"Une seule valeur pour -param OU -lstparam doit etre fournie");
522     return 0;
523     }
524     if(strlen(fichier_param)>0)
525     {
526     std::vector<OT_PARAMETRES*> vector_param;
527     OT_PARAMETRES* param = new OT_PARAMETRES;
528     PARAMETRES::importer_fichier_parametres(fichier_param,param);
529     vector_param.push_back(param);
530     MSTRUCT_VER ver;
531     ver.active_affichage(app.affiche);
532     ver.calculer_modules_mecaniques(fichier_lst_ves_sph,fichier_lst_ves_dev,vector_param,dossier_resultat,incrementale,avec_histogramme);
533     delete param;
534     }
535     else if(strlen(fichier_lstparam)>0)
536     {
537     std::vector<OT_PARAMETRES*> vector_param;
538     PARAMETRES::importer_fichier_liste_parametres(fichier_lstparam,vector_param);
539     MSTRUCT_VER ver;
540     ver.active_affichage(app.affiche);
541     ver.calculer_modules_mecaniques(fichier_lst_ves_sph,fichier_lst_ves_dev,vector_param,dossier_resultat,incrementale,avec_histogramme);
542     std::vector<OT_PARAMETRES*>::iterator it_vector;
543     for(it_vector=vector_param.begin();it_vector!=vector_param.end();it_vector++)
544     {
545     delete *it_vector;
546     }
547     }
548     }
549    
550 francois 756 app.affiche((char*)"Fin");
551 couturad 919 // MAGIC_PARAMETRE_APPLICATION p1(2,(char*)"-construire",MAGIC_PARAMETRE_APPLICATION::ACTION,(char*)"Construction du VER selon le fichier de parametre");
552     // MAGIC_PARAMETRE_APPLICATION p2(3,(char*)"-param",MAGIC_PARAMETRE_APPLICATION::STRING,(char*)"Nom du fichier parametre");
553     // MAGIC_PARAMETRE_APPLICATION p3(4,(char*)"-creeparam",MAGIC_PARAMETRE_APPLICATION::ACTION,(char*)"Création d'un fichier parametre");
554     // p1.ajouter_dependance(3);
555     // p3.ajouter_dependance(1);
556     // lst.push_back(p1);
557     // lst.push_back(p2);
558     // lst.push_back(p3);
559     // MAGIC_APPLICATION app((char*)"Homogéinisation d'une microstructure",argc,argv,lst,false,true);
560     // if (app.get_erreur()==true) return 0;
561     //
562     // if (app.get_action()==2)
563     // {
564     // char fichierparam[1000];
565     // app.recupere_parametre_string(3,fichierparam,(char*)"Fichier parametre manquant");
566     // VE_VES *ves = new VE_VES();
567     // ves->active_affichage(app.affiche);
568     // ves->lire_param_VES(fichierparam);
569     // ves->construire();
570     //
571     // }
572     //
573     // if (app.get_action()==4)
574     // {
575     // char fichierout[1000];
576     // app.recupere_parametre_string(1,fichierout,(char*)"Fichier resultat manquant");
577     // OT_PARAMETRES param;
578     // ini_param_VER(&param);
579     // param.enregistrer(fichierout);
580     // }
581     // app.affiche((char*)"Fin");
582 francois 756 return 0;
583     }
584    
585    
586    
587     #pragma package(smart_init)